@inkeep/agents-ui 0.0.0-dev-20260611215917 → 0.0.0-dev-20260612033415

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.
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),r=require("react"),b=require("../../atoms/icons/custom-icon.cjs"),_=require("../../providers/image-preview-provider.cjs"),y=require("../../providers/message-provider.cjs"),m=require("./chat-provider.cjs"),p=require("../../atoms/file-upload.cjs"),g=require("../../utils/misc.cjs"),c=require("../../utils/compose-event-handlers.cjs"),o=require("../factory.cjs"),w=require("../../providers/config-provider.cjs"),E={"application/pdf":"filePdf","text/plain":"fileText","text/markdown":"fileMarkdown","text/html":"fileHtml","text/csv":"fileCsv","text/x-log":"fileLog","application/json":"fileJson","text/x-sql":"fileSql","application/x-sql":"fileSql","text/x-script.python":"filePy","text/x-python":"filePy","text/x-python-script":"filePy"};function C(t){return t.startsWith("image/")}const u={"image/png":[".png"],"image/jpeg":[".jpg",".jpeg"],"image/webp":[".webp"],"application/pdf":[".pdf"],"text/plain":[".txt",".text",".bat",".cfg",".conf",".def",".dic",".in",".list"],"text/x-log":[".log"],"text/markdown":[".md",".markdown"],"text/html":[".html",".htm"],"text/csv":[".csv"],"text/xml":[".xml"],"text/css":[".css"],"application/json":[".json"],"application/yaml":[".yaml",".yml"],"application/x-yaml":[".yaml",".yml"],"text/x-yaml":[".yaml",".yml"],"application/toml":[".toml"],"application/x-toml":[".toml"],"application/graphql":[".graphql",".gql"],"application/x-graphql":[".graphql",".gql"],"text/x-graphql":[".graphql",".gql"],"application/x-ndjson":[".ndjson"],"application/json5":[".json5"],"application/x-json5":[".json5"],"application/javascript":[".js",".mjs"],"text/javascript":[".js",".mjs"],"application/typescript":[".ts"],"text/x-typescript":[".ts"],"text/jsx":[".jsx"],"text/tsx":[".tsx"],"text/x-sh":[".sh"],"text/x-bash":[".bash"],"application/x-bash":[".bash"],"text/x-zsh":[".zsh"],"text/x-shellscript":[".sh",".ksh"],"application/x-powershell":[".ps1"],"text/vbscript":[".vbs"],"text/x-awk":[".awk"],"application/x-awk":[".awk"],"text/x-c":[".c",".h"],"text/x-c++":[".cpp",".cc",".cxx",".hh"],"text/x-csharp":[".cs"],"text/x-objectivec":[".m"],"text/x-objectivec++":[".mm"],"text/x-java":[".java"],"text/x-scala":[".scala"],"application/x-scala":[".scala"],"text/x-kotlin":[".kt"],"text/x-groovy":[".groovy"],"text/x-clojure":[".clj"],"text/x-go":[".go"],"text/x-golang":[".go"],"text/x-rust":[".rs"],"application/x-rust":[".rs"],"text/x-swift":[".swift"],"text/x-dart":[".dart"],"text/x-python":[".py"],"text/x-script.python":[".py"],"text/x-python-script":[".py"],"text/x-ruby":[".rb"],"text/x-perl":[".pl"],"text/x-lua":[".lua"],"text/x-r":[".r"],"text/x-R":[".r"],"text/x-julia":[".jl"],"text/x-elixir":[".ex"],"text/x-erlang":[".erl"],"text/x-haskell":[".hs"],"text/x-lisp":[".lisp"],"text/x-php":[".php"],"application/x-php":[".php"],"application/x-httpd-php":[".php"],"application/x-httpd-php-source":[".php"],"text/x-tex":[".tex"],"text/x-rst":[".rst"],"text/x-handlebars":[".hbs"],"text/x-mustache":[".mustache"],"text/x-ejs":[".ejs"],"text/x-jinja2":[".jinja",".jinja2"],"text/x-liquid":[".liquid"],"text/x-erb":[".erb"],"text/x-twig":[".twig"],"text/x-pug":[".pug"],"text/x-jade":[".jade"],"text/x-tmpl":[".tmpl"],"text/x-astro":[".astro"],"text/x-sass":[".sass"],"text/x-scss":[".scss"],"text/x-less":[".less"],"text/x-sql":[".sql"],"application/x-sql":[".sql"],"text/x-makefile":[".makefile",".mk"],"text/x-cmake":[".cmake"],"text/x-dockerfile":[".dockerfile"],"text/x-gradle":[".gradle"],"text/x-ini":[".ini"],"text/x-properties":[".properties"],"text/x-protobuf":[".proto"],"application/x-protobuf":[".proto"],"text/x-hcl":[".hcl"],"text/x-terraform":[".tf"],"application/x-terraform":[".tf"],"text/x-diff":[".diff"],"text/x-patch":[".patch"],"application/x-patch":[".patch"],"text/x-asm":[".asm",".s"],"message/rfc822":[".eml",".mht",".mhtml",".mime",".nws"],"text/srt":[".srt"],"application/x-subrip":[".srt"],"text/x-subrip":[".srt"],"text/vtt":[".vtt"],"text/x-vcard":[".vcf"],"text/calendar":[".ics",".ifb"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":[".pptx"],"application/vnd.oasis.opendocument.text":[".odt"],"application/vnd.oasis.opendocument.spreadsheet":[".ods"],"application/vnd.oasis.opendocument.presentation":[".odp"],"application/vnd.apple.pages":[".pages"],"application/vnd.apple.numbers":[".numbers"],"application/vnd.apple.keynote":[".key"],"application/x-iwork-pages-sffpages":[".pages"],"application/x-iwork-numbers-sffnumbers":[".numbers"],"application/x-iwork-keynote-sffkey":[".key"]},j=new Set(Object.keys(u)),F=10,I=1024*1024*10,N=Object.entries(u).reduce((t,[e,i])=>{for(const n of i)t[n]=e;return t},{});function k(t){if(t.type)return t;const e=`.${t.name.split(".").pop()?.toLowerCase()}`,i=N[e];return i?new File([t],t.name,{type:i}):t}function T(t){if(!t.length)return null;const e=i=>t.some(n=>n.errors.includes(i));return e("TOO_MANY_FILES")?{title:"Attachment limit reached",message:`You can only attach up to ${F} files per message.`}:e("FILE_INVALID_TYPE")?{title:"Unsupported file type",message:"Supported formats include images, PDFs, text, code, and document files."}:e("FILE_TOO_LARGE")?{title:"File too large",message:`Files must be smaller than ${I/1024/1024}MB.`}:e("FILE_EXISTS")?{title:"File already exists",message:`The file "${t.find(n=>n.errors.includes("FILE_EXISTS"))?.file.name??"file"}" is already attached to this message.`}:{title:"File rejected",message:"This file could not be added."}}const M=o.ikp("div",{_id:"aiChatMessage__Files"}),q=({children:t,...e})=>{const{message:i}=y.useMessage();if(i.role!=="user")return null;const n=(i.parts??[]).filter(s=>{if(s.type!=="file")return!1;const l=s.mediaType;return j.has(l??"")});return n.length?a.jsx(M,{...e,children:t(n)}):null},L=o.ikp("button",{_id:"aiChatMessage__File"}),A=({url:t,name:e,mediaType:i,onClick:n,...s})=>{const{openImagePreview:l}=_.useImagePreview(),[d,h]=r.useState(!0),f=r.useMemo(()=>new File([],e??"file",{type:i}),[e,i]);return a.jsx(P.Provider,{value:{file:f,objectUrl:t,isLoading:d,setIsLoading:h,onRemove:()=>{}},children:a.jsx(L,{type:"button","aria-label":C(i??"")?`Preview ${e??"file"}`:`Open ${e??"file"} in new tab`,"data-loading":g.dataAttr(d),onClick:c.composeEventHandlers(n,()=>{if(C(i??""))l({url:t,name:e??"file"});else if(t)if(t.startsWith("data:")){const v=document.createElement("a");v.href=t,v.download=e??"file",v.click()}else window.open(t,"_blank","noopener,noreferrer")}),...s})})},U=o.ikp("div",{_id:"aiChatInput__Fieldset"}),S=t=>{const e=p.useFileUploadApi();return a.jsx(U,{...e.getDropzoneProps({disableClick:!0}),"data-drag-over":g.dataAttr(e.dragging),...t})},R=({...t})=>{const{files:e,setFiles:i,showInputNotification:n}=m.useChat();return a.jsx(p.FileUploadRoot,{accept:u,maxFiles:F,maxFileSize:I,preventDocumentDrop:!0,acceptedFiles:e,onFileAccept:s=>i(s.files),onFileReject:s=>{const l=T(s.files);l&&n(l)},children:a.jsx(S,{...t})})},O=o.ikp("div",{_id:"aiChatInput__DropZone"}),H=o.ikp("div",{_id:"aiChatInput__Notification"}),D=t=>{const{inputNotification:e}=m.useChat();return e?a.jsx(H,{role:"alert",...t}):null},B=o.ikp("p",{_id:"aiChatInput__NotificationTitle"}),X=({children:t,...e})=>{const{inputNotification:i}=m.useChat();return i?.title?a.jsxs(B,{...e,children:[t,i.title]}):null},Y=o.ikp("p",{_id:"aiChatInput__NotificationMessage"}),$=t=>{const{inputNotification:e}=m.useChat();return a.jsx(Y,{...t,children:e?.message})},z=o.ikp("button",{_id:"aiChatInput__NotificationClose"}),Z=({onClick:t,...e})=>{const{clearInputNotification:i}=m.useChat();return a.jsx(z,{type:"button","aria-label":"Dismiss",onClick:c.composeEventHandlers(t,i),...e})},K=o.ikp("div",{_id:"aiChatInput__NotificationContent"}),V=o.ikp("div",{_id:"aiChatInput__NotificationHeader"}),W=o.ikp(b.CustomIcon,{_id:"aiChatInput__FileUploadButtonIcon",iconKey:"fileUpload"}),G=o.ikp("button",{_id:"aiChatInput__FileUploadButton"}),J=t=>{const{aiChatSettings:e}=w.useInkeepConfig(),i=p.useFileUploadApi(),{onClick:n,...s}=t;return a.jsx(G,{type:"button","aria-label":"Upload file",disabled:e.isViewOnly,onClick:c.composeEventHandlers(n,()=>i.openFilePicker()),...s})},Q=o.ikp("input",{_id:"aiChatInput__FileInput"}),tt=t=>{const e=p.useFileUploadApi();return a.jsx(Q,{...t,...e.getHiddenInputProps()})},et=o.ikp("div",{_id:"aiChatInput__FileList"}),it=({children:t,...e})=>{const n=p.useFileUploadApi().acceptedFiles;return n.length?a.jsx(et,{...e,children:t(n)}):null},P=r.createContext(null);function x(){const t=r.useContext(P);if(!t)throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");return t}const nt=o.ikp("div",{_id:"aiChatInput__FileItem"}),at=({file:t,...e})=>{const i=p.useFileUploadApi(),[n,s]=r.useState(void 0),[l,d]=r.useState(!0);r.useEffect(()=>i.createFileUrl(t,f=>{s(f),d(!0)}),[t]);const h=()=>i.deleteFile(t);return a.jsx(P.Provider,{value:{file:t,objectUrl:n,isLoading:l,setIsLoading:d,onRemove:h},children:a.jsx(nt,{"data-loading":g.dataAttr(l),...e})})},ot=o.ikp("button",{_id:"aiChatInput__FilePreviewTrigger"}),st=({onClick:t,...e})=>{const{objectUrl:i,file:n}=x(),{openImagePreview:s}=_.useImagePreview();return a.jsx(ot,{type:"button","aria-label":`Preview ${n.name}`,disabled:!i,onClick:c.composeEventHandlers(t,()=>{i&&s({url:i,name:n.name})}),...e})},lt=o.ikp("span",{_id:"aiChatInput__FileContent"}),rt=t=>a.jsx(lt,{...t}),pt=o.ikp("img",{_id:"aiChatInput__FileThumbnail"}),ct=({onLoad:t,...e})=>{const{objectUrl:i,file:n,setIsLoading:s}=x();return a.jsx(pt,{src:i,alt:n.name,onLoad:c.composeEventHandlers(t,()=>s(!1)),...e})},dt=({className:t})=>{const{file:e}=x(),i=E[k(e).type]??"file";return a.jsx(b.CustomIcon,{iconKey:i,className:t})},mt=o.ikp("span",{_id:"aiChatInput__FileName"}),xt=t=>{const{file:e}=x();return a.jsx(mt,{...t,children:e.name})},ut=o.ikp("button",{_id:"aiChatInput__FileRemove"}),ht=o.ikp(b.CustomIcon,{_id:"aiChatInput__FileRemoveIcon",iconKey:"close"}),ft=({onClick:t,...e})=>{const{onRemove:i}=x();return a.jsx(ut,{type:"button","aria-label":"Remove file",onClick:c.composeEventHandlers(t,i),...e})};exports.ACCEPTED_FILE_MIME_TYPES=j;exports.EmbeddedChatPrimitiveDropZone=O;exports.EmbeddedChatPrimitiveFileContent=rt;exports.EmbeddedChatPrimitiveFileInput=tt;exports.EmbeddedChatPrimitiveFileItem=at;exports.EmbeddedChatPrimitiveFileList=it;exports.EmbeddedChatPrimitiveFileName=xt;exports.EmbeddedChatPrimitiveFilePreviewTrigger=st;exports.EmbeddedChatPrimitiveFileRemove=ft;exports.EmbeddedChatPrimitiveFileRemoveIcon=ht;exports.EmbeddedChatPrimitiveFileThumbnail=ct;exports.EmbeddedChatPrimitiveFileTypeIcon=dt;exports.EmbeddedChatPrimitiveFileUploadButton=J;exports.EmbeddedChatPrimitiveFileUploadButtonIcon=W;exports.EmbeddedChatPrimitiveInputFieldset=R;exports.EmbeddedChatPrimitiveInputNotification=D;exports.EmbeddedChatPrimitiveInputNotificationClose=Z;exports.EmbeddedChatPrimitiveInputNotificationContent=K;exports.EmbeddedChatPrimitiveInputNotificationHeader=V;exports.EmbeddedChatPrimitiveInputNotificationMessage=$;exports.EmbeddedChatPrimitiveInputNotificationTitle=X;exports.EmbeddedChatPrimitiveMessageFile=A;exports.EmbeddedChatPrimitiveMessageFiles=q;exports.FILE_ACCEPT_MAP=u;exports.FILE_TYPE_ICON_MAP=E;exports.MAX_FILES=F;exports.MAX_FILE_SIZE=I;exports.isImageMimeType=C;exports.normalizeFileType=k;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),p=require("react"),b=require("../../atoms/icons/custom-icon.cjs"),E=require("../../providers/image-preview-provider.cjs"),M=require("../../providers/message-provider.cjs"),u=require("./chat-provider.cjs"),m=require("../../atoms/file-upload.cjs"),F=require("../../utils/misc.cjs"),x=require("../../utils/compose-event-handlers.cjs"),s=require("../factory.cjs"),j=require("../../providers/config-provider.cjs"),y={"application/pdf":"filePdf","text/plain":"fileText","text/markdown":"fileMarkdown","text/html":"fileHtml","text/csv":"fileCsv","text/x-log":"fileLog","application/json":"fileJson","text/x-sql":"fileSql","application/x-sql":"fileSql","text/x-script.python":"filePy","text/x-python":"filePy","text/x-python-script":"filePy"};function g(t){return t.startsWith("image/")}const v={"image/png":[".png"],"image/jpeg":[".jpg",".jpeg"],"image/webp":[".webp"],"application/pdf":[".pdf"],"text/plain":[".txt",".text",".bat",".cfg",".conf",".def",".dic",".in",".list"],"text/x-log":[".log"],"text/markdown":[".md",".markdown"],"text/html":[".html",".htm"],"text/csv":[".csv"],"text/xml":[".xml"],"text/css":[".css"],"application/json":[".json"],"application/yaml":[".yaml",".yml"],"application/x-yaml":[".yaml",".yml"],"text/x-yaml":[".yaml",".yml"],"application/toml":[".toml"],"application/x-toml":[".toml"],"application/graphql":[".graphql",".gql"],"application/x-graphql":[".graphql",".gql"],"text/x-graphql":[".graphql",".gql"],"application/x-ndjson":[".ndjson"],"application/json5":[".json5"],"application/x-json5":[".json5"],"application/javascript":[".js",".mjs"],"text/javascript":[".js",".mjs"],"application/typescript":[".ts"],"text/x-typescript":[".ts"],"text/jsx":[".jsx"],"text/tsx":[".tsx"],"text/x-sh":[".sh"],"text/x-bash":[".bash"],"application/x-bash":[".bash"],"text/x-zsh":[".zsh"],"text/x-shellscript":[".sh",".ksh"],"application/x-powershell":[".ps1"],"text/vbscript":[".vbs"],"text/x-awk":[".awk"],"application/x-awk":[".awk"],"text/x-c":[".c",".h"],"text/x-c++":[".cpp",".cc",".cxx",".hh"],"text/x-csharp":[".cs"],"text/x-objectivec":[".m"],"text/x-objectivec++":[".mm"],"text/x-java":[".java"],"text/x-scala":[".scala"],"application/x-scala":[".scala"],"text/x-kotlin":[".kt"],"text/x-groovy":[".groovy"],"text/x-clojure":[".clj"],"text/x-go":[".go"],"text/x-golang":[".go"],"text/x-rust":[".rs"],"application/x-rust":[".rs"],"text/x-swift":[".swift"],"text/x-dart":[".dart"],"text/x-python":[".py"],"text/x-script.python":[".py"],"text/x-python-script":[".py"],"text/x-ruby":[".rb"],"text/x-perl":[".pl"],"text/x-lua":[".lua"],"text/x-r":[".r"],"text/x-R":[".r"],"text/x-julia":[".jl"],"text/x-elixir":[".ex"],"text/x-erlang":[".erl"],"text/x-haskell":[".hs"],"text/x-lisp":[".lisp"],"text/x-php":[".php"],"application/x-php":[".php"],"application/x-httpd-php":[".php"],"application/x-httpd-php-source":[".php"],"text/x-tex":[".tex"],"text/x-rst":[".rst"],"text/x-handlebars":[".hbs"],"text/x-mustache":[".mustache"],"text/x-ejs":[".ejs"],"text/x-jinja2":[".jinja",".jinja2"],"text/x-liquid":[".liquid"],"text/x-erb":[".erb"],"text/x-twig":[".twig"],"text/x-pug":[".pug"],"text/x-jade":[".jade"],"text/x-tmpl":[".tmpl"],"text/x-astro":[".astro"],"text/x-sass":[".sass"],"text/x-scss":[".scss"],"text/x-less":[".less"],"text/x-sql":[".sql"],"application/x-sql":[".sql"],"text/x-makefile":[".makefile",".mk"],"text/x-cmake":[".cmake"],"text/x-dockerfile":[".dockerfile"],"text/x-gradle":[".gradle"],"text/x-ini":[".ini"],"text/x-properties":[".properties"],"text/x-protobuf":[".proto"],"application/x-protobuf":[".proto"],"text/x-hcl":[".hcl"],"text/x-terraform":[".tf"],"application/x-terraform":[".tf"],"text/x-diff":[".diff"],"text/x-patch":[".patch"],"application/x-patch":[".patch"],"text/x-asm":[".asm",".s"],"message/rfc822":[".eml",".mht",".mhtml",".mime",".nws"],"text/srt":[".srt"],"application/x-subrip":[".srt"],"text/x-subrip":[".srt"],"text/vtt":[".vtt"],"text/x-vcard":[".vcf"],"text/calendar":[".ics",".ifb"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":[".pptx"],"application/vnd.oasis.opendocument.text":[".odt"],"application/vnd.oasis.opendocument.spreadsheet":[".ods"],"application/vnd.oasis.opendocument.presentation":[".odp"],"application/vnd.apple.pages":[".pages"],"application/vnd.apple.numbers":[".numbers"],"application/vnd.apple.keynote":[".key"],"application/x-iwork-pages-sffpages":[".pages"],"application/x-iwork-numbers-sffnumbers":[".numbers"],"application/x-iwork-keynote-sffkey":[".key"]},k=new Set(Object.keys(v)),I=10,P=1024*1024*10,T=Object.entries(v).reduce((t,[e,i])=>{for(const n of i)t[n]=e;return t},{});function w(t){if(t.type)return t;const e=`.${t.name.split(".").pop()?.toLowerCase()}`,i=T[e];return i?new File([t],t.name,{type:i}):t}function N(t){if(!t.length)return null;const e=i=>t.some(n=>n.errors.includes(i));return e("TOO_MANY_FILES")?{title:"Attachment limit reached",message:`You can only attach up to ${I} files per message.`}:e("FILE_INVALID_TYPE")?{title:"Unsupported file type",message:"Supported formats include images, PDFs, text, code, and document files."}:e("FILE_TOO_LARGE")?{title:"File too large",message:`Files must be smaller than ${P/1024/1024}MB.`}:e("FILE_EXISTS")?{title:"File already exists",message:`The file "${t.find(n=>n.errors.includes("FILE_EXISTS"))?.file.name??"file"}" is already attached to this message.`}:{title:"File rejected",message:"This file could not be added."}}const q=s.ikp("div",{_id:"aiChatMessage__Files"}),f=new WeakSet;function L(t,e){const i=e.map(a=>{if(!a.providerMetadata)return{...a};try{return{...a,providerMetadata:structuredClone(a.providerMetadata)}}catch{return{...a}}});let n;try{n=t(i)}catch(a){return f.has(t)||(f.add(t),console.warn("[aiChatSettings] transformMessageFiles threw",a)),e}return Array.isArray(n)?n.filter(a=>a!=null):(f.has(t)||(f.add(t),console.warn("[aiChatSettings] transformMessageFiles must return an array, got:",n)),e)}const A=({children:t,...e})=>{const{message:i}=M.useMessage(),{aiChatSettings:n}=j.useInkeepConfig();if(i.role!=="user")return null;const a=(i.parts??[]).filter(l=>l.type==="file"),r=n.transformMessageFiles,d=(r?L(r,a):a).filter(l=>k.has(l.mediaType??""));return d.length?o.jsx(q,{...e,children:t(d)}):null},S=s.ikp("button",{_id:"aiChatMessage__File"}),U=({url:t,name:e,mediaType:i,onClick:n,...a})=>{const{openImagePreview:r}=E.useImagePreview(),[c,d]=p.useState(!0),l=p.useMemo(()=>new File([],e??"file",{type:i}),[e,i]);return o.jsx(_.Provider,{value:{file:l,objectUrl:t,isLoading:c,setIsLoading:d,onRemove:()=>{}},children:o.jsx(S,{type:"button","aria-label":g(i??"")?`Preview ${e??"file"}`:`Open ${e??"file"} in new tab`,"data-loading":F.dataAttr(c),onClick:x.composeEventHandlers(n,()=>{if(g(i??""))r({url:t,name:e??"file"});else if(t)if(t.startsWith("data:")){const C=document.createElement("a");C.href=t,C.download=e??"file",C.click()}else window.open(t,"_blank","noopener,noreferrer")}),...a})})},R=s.ikp("div",{_id:"aiChatInput__Fieldset"}),O=t=>{const e=m.useFileUploadApi();return o.jsx(R,{...e.getDropzoneProps({disableClick:!0}),"data-drag-over":F.dataAttr(e.dragging),...t})},H=({...t})=>{const{files:e,setFiles:i,showInputNotification:n}=u.useChat();return o.jsx(m.FileUploadRoot,{accept:v,maxFiles:I,maxFileSize:P,preventDocumentDrop:!0,acceptedFiles:e,onFileAccept:a=>i(a.files),onFileReject:a=>{const r=N(a.files);r&&n(r)},children:o.jsx(O,{...t})})},D=s.ikp("div",{_id:"aiChatInput__DropZone"}),B=s.ikp("div",{_id:"aiChatInput__Notification"}),X=t=>{const{inputNotification:e}=u.useChat();return e?o.jsx(B,{role:"alert",...t}):null},Y=s.ikp("p",{_id:"aiChatInput__NotificationTitle"}),$=({children:t,...e})=>{const{inputNotification:i}=u.useChat();return i?.title?o.jsxs(Y,{...e,children:[t,i.title]}):null},z=s.ikp("p",{_id:"aiChatInput__NotificationMessage"}),Z=t=>{const{inputNotification:e}=u.useChat();return o.jsx(z,{...t,children:e?.message})},K=s.ikp("button",{_id:"aiChatInput__NotificationClose"}),W=({onClick:t,...e})=>{const{clearInputNotification:i}=u.useChat();return o.jsx(K,{type:"button","aria-label":"Dismiss",onClick:x.composeEventHandlers(t,i),...e})},V=s.ikp("div",{_id:"aiChatInput__NotificationContent"}),G=s.ikp("div",{_id:"aiChatInput__NotificationHeader"}),J=s.ikp(b.CustomIcon,{_id:"aiChatInput__FileUploadButtonIcon",iconKey:"fileUpload"}),Q=s.ikp("button",{_id:"aiChatInput__FileUploadButton"}),tt=t=>{const{aiChatSettings:e}=j.useInkeepConfig(),i=m.useFileUploadApi(),{onClick:n,...a}=t;return o.jsx(Q,{type:"button","aria-label":"Upload file",disabled:e.isViewOnly,onClick:x.composeEventHandlers(n,()=>i.openFilePicker()),...a})},et=s.ikp("input",{_id:"aiChatInput__FileInput"}),it=t=>{const e=m.useFileUploadApi();return o.jsx(et,{...t,...e.getHiddenInputProps()})},nt=s.ikp("div",{_id:"aiChatInput__FileList"}),at=({children:t,...e})=>{const n=m.useFileUploadApi().acceptedFiles;return n.length?o.jsx(nt,{...e,children:t(n)}):null},_=p.createContext(null);function h(){const t=p.useContext(_);if(!t)throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");return t}const ot=s.ikp("div",{_id:"aiChatInput__FileItem"}),st=({file:t,...e})=>{const i=m.useFileUploadApi(),[n,a]=p.useState(void 0),[r,c]=p.useState(!0);p.useEffect(()=>i.createFileUrl(t,l=>{a(l),c(!0)}),[t]);const d=()=>i.deleteFile(t);return o.jsx(_.Provider,{value:{file:t,objectUrl:n,isLoading:r,setIsLoading:c,onRemove:d},children:o.jsx(ot,{"data-loading":F.dataAttr(r),...e})})},rt=s.ikp("button",{_id:"aiChatInput__FilePreviewTrigger"}),lt=({onClick:t,...e})=>{const{objectUrl:i,file:n}=h(),{openImagePreview:a}=E.useImagePreview();return o.jsx(rt,{type:"button","aria-label":`Preview ${n.name}`,disabled:!i,onClick:x.composeEventHandlers(t,()=>{i&&a({url:i,name:n.name})}),...e})},pt=s.ikp("span",{_id:"aiChatInput__FileContent"}),ct=t=>o.jsx(pt,{...t}),dt=s.ikp("img",{_id:"aiChatInput__FileThumbnail"}),mt=({onLoad:t,...e})=>{const{objectUrl:i,file:n,setIsLoading:a}=h();return o.jsx(dt,{src:i,alt:n.name,onLoad:x.composeEventHandlers(t,()=>a(!1)),...e})},xt=({className:t})=>{const{file:e}=h(),i=y[w(e).type]??"file";return o.jsx(b.CustomIcon,{iconKey:i,className:t})},ut=s.ikp("span",{_id:"aiChatInput__FileName"}),ht=t=>{const{file:e}=h();return o.jsx(ut,{...t,children:e.name})},ft=s.ikp("button",{_id:"aiChatInput__FileRemove"}),vt=s.ikp(b.CustomIcon,{_id:"aiChatInput__FileRemoveIcon",iconKey:"close"}),Ct=({onClick:t,...e})=>{const{onRemove:i}=h();return o.jsx(ft,{type:"button","aria-label":"Remove file",onClick:x.composeEventHandlers(t,i),...e})};exports.ACCEPTED_FILE_MIME_TYPES=k;exports.EmbeddedChatPrimitiveDropZone=D;exports.EmbeddedChatPrimitiveFileContent=ct;exports.EmbeddedChatPrimitiveFileInput=it;exports.EmbeddedChatPrimitiveFileItem=st;exports.EmbeddedChatPrimitiveFileList=at;exports.EmbeddedChatPrimitiveFileName=ht;exports.EmbeddedChatPrimitiveFilePreviewTrigger=lt;exports.EmbeddedChatPrimitiveFileRemove=Ct;exports.EmbeddedChatPrimitiveFileRemoveIcon=vt;exports.EmbeddedChatPrimitiveFileThumbnail=mt;exports.EmbeddedChatPrimitiveFileTypeIcon=xt;exports.EmbeddedChatPrimitiveFileUploadButton=tt;exports.EmbeddedChatPrimitiveFileUploadButtonIcon=J;exports.EmbeddedChatPrimitiveInputFieldset=H;exports.EmbeddedChatPrimitiveInputNotification=X;exports.EmbeddedChatPrimitiveInputNotificationClose=W;exports.EmbeddedChatPrimitiveInputNotificationContent=V;exports.EmbeddedChatPrimitiveInputNotificationHeader=G;exports.EmbeddedChatPrimitiveInputNotificationMessage=Z;exports.EmbeddedChatPrimitiveInputNotificationTitle=$;exports.EmbeddedChatPrimitiveMessageFile=U;exports.EmbeddedChatPrimitiveMessageFiles=A;exports.FILE_ACCEPT_MAP=v;exports.FILE_TYPE_ICON_MAP=y;exports.MAX_FILES=I;exports.MAX_FILE_SIZE=P;exports.isImageMimeType=g;exports.normalizeFileType=w;
@@ -1,15 +1,15 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as j } from "react/jsx-runtime";
3
- import C, { useState as h, useEffect as E, useMemo as w } from "react";
2
+ import { jsx as s, jsxs as w } from "react/jsx-runtime";
3
+ import I, { useState as g, useEffect as k, useMemo as M } from "react";
4
4
  import { CustomIcon as v } from "../../atoms/icons/custom-icon.js";
5
- import { useImagePreview as I } from "../../providers/image-preview-provider.js";
6
- import { useMessage as k } from "../../providers/message-provider.js";
7
- import { useChat as c } from "./chat-provider.js";
8
- import { useFileUploadApi as d, FileUploadRoot as N } from "../../atoms/file-upload.js";
9
- import { dataAttr as g } from "../../utils/misc.js";
10
- import { composeEventHandlers as r } from "../../utils/compose-event-handlers.js";
5
+ import { useImagePreview as P } from "../../providers/image-preview-provider.js";
6
+ import { useMessage as N } from "../../providers/message-provider.js";
7
+ import { useChat as x } from "./chat-provider.js";
8
+ import { useFileUploadApi as m, FileUploadRoot as T } from "../../atoms/file-upload.js";
9
+ import { dataAttr as _ } from "../../utils/misc.js";
10
+ import { composeEventHandlers as d } from "../../utils/compose-event-handlers.js";
11
11
  import { ikp as o } from "../factory.js";
12
- import { useInkeepConfig as T } from "../../providers/config-provider.js";
12
+ import { useInkeepConfig as y } from "../../providers/config-provider.js";
13
13
  const L = {
14
14
  "application/pdf": "filePdf",
15
15
  "text/plain": "fileText",
@@ -24,10 +24,10 @@ const L = {
24
24
  "text/x-python": "filePy",
25
25
  "text/x-python-script": "filePy"
26
26
  };
27
- function F(t) {
27
+ function C(t) {
28
28
  return t.startsWith("image/");
29
29
  }
30
- const _ = {
30
+ const b = {
31
31
  // Images
32
32
  "image/png": [".png"],
33
33
  "image/jpeg": [".jpg", ".jpeg"],
@@ -173,7 +173,7 @@ const _ = {
173
173
  "application/x-iwork-pages-sffpages": [".pages"],
174
174
  "application/x-iwork-numbers-sffnumbers": [".numbers"],
175
175
  "application/x-iwork-keynote-sffkey": [".key"]
176
- }, M = new Set(Object.keys(_)), P = 10, y = 1024 * 1024 * 10, q = Object.entries(_).reduce(
176
+ }, q = new Set(Object.keys(b)), j = 10, E = 1024 * 1024 * 10, S = Object.entries(b).reduce(
177
177
  (t, [e, i]) => {
178
178
  for (const n of i) t[n] = e;
179
179
  return t;
@@ -182,7 +182,7 @@ const _ = {
182
182
  );
183
183
  function R(t) {
184
184
  if (t.type) return t;
185
- const e = `.${t.name.split(".").pop()?.toLowerCase()}`, i = q[e];
185
+ const e = `.${t.name.split(".").pop()?.toLowerCase()}`, i = S[e];
186
186
  return i ? new File([t], t.name, { type: i }) : t;
187
187
  }
188
188
  function U(t) {
@@ -190,13 +190,13 @@ function U(t) {
190
190
  const e = (i) => t.some((n) => n.errors.includes(i));
191
191
  return e("TOO_MANY_FILES") ? {
192
192
  title: "Attachment limit reached",
193
- message: `You can only attach up to ${P} files per message.`
193
+ message: `You can only attach up to ${j} files per message.`
194
194
  } : e("FILE_INVALID_TYPE") ? {
195
195
  title: "Unsupported file type",
196
196
  message: "Supported formats include images, PDFs, text, code, and document files."
197
197
  } : e("FILE_TOO_LARGE") ? {
198
198
  title: "File too large",
199
- message: `Files must be smaller than ${y / 1024 / 1024}MB.`
199
+ message: `Files must be smaller than ${E / 1024 / 1024}MB.`
200
200
  } : e("FILE_EXISTS") ? {
201
201
  title: "File already exists",
202
202
  message: `The file "${t.find((n) => n.errors.includes("FILE_EXISTS"))?.file.name ?? "file"}" is already attached to this message.`
@@ -205,266 +205,282 @@ function U(t) {
205
205
  message: "This file could not be added."
206
206
  };
207
207
  }
208
- const S = o("div", {
208
+ const A = o("div", {
209
209
  _id: "aiChatMessage__Files"
210
- }), dt = ({ children: t, ...e }) => {
211
- const { message: i } = k();
212
- if (i.role !== "user") return null;
213
- const n = (i.parts ?? []).filter((s) => {
214
- if (s.type !== "file") return !1;
215
- const l = s.mediaType;
216
- return M.has(l ?? "");
210
+ }), f = /* @__PURE__ */ new WeakSet();
211
+ function O(t, e) {
212
+ const i = e.map((a) => {
213
+ if (!a.providerMetadata) return { ...a };
214
+ try {
215
+ return { ...a, providerMetadata: structuredClone(a.providerMetadata) };
216
+ } catch {
217
+ return { ...a };
218
+ }
217
219
  });
218
- return n.length ? /* @__PURE__ */ a(S, { ...e, children: t(n) }) : null;
219
- }, A = o("button", {
220
+ let n;
221
+ try {
222
+ n = t(i);
223
+ } catch (a) {
224
+ return f.has(t) || (f.add(t), console.warn("[aiChatSettings] transformMessageFiles threw", a)), e;
225
+ }
226
+ return Array.isArray(n) ? n.filter((a) => a != null) : (f.has(t) || (f.add(t), console.warn("[aiChatSettings] transformMessageFiles must return an array, got:", n)), e);
227
+ }
228
+ const mt = ({ children: t, ...e }) => {
229
+ const { message: i } = N(), { aiChatSettings: n } = y();
230
+ if (i.role !== "user") return null;
231
+ const a = (i.parts ?? []).filter((l) => l.type === "file"), r = n.transformMessageFiles, c = (r ? O(r, a) : a).filter(
232
+ (l) => q.has(l.mediaType ?? "")
233
+ );
234
+ return c.length ? /* @__PURE__ */ s(A, { ...e, children: t(c) }) : null;
235
+ }, D = o("button", {
220
236
  _id: "aiChatMessage__File"
221
- }), xt = ({
237
+ }), ut = ({
222
238
  url: t,
223
239
  name: e,
224
240
  mediaType: i,
225
241
  onClick: n,
226
- ...s
242
+ ...a
227
243
  }) => {
228
- const { openImagePreview: l } = I(), [p, m] = h(!0), u = w(
244
+ const { openImagePreview: r } = P(), [p, c] = g(!0), l = M(
229
245
  () => new File([], e ?? "file", { type: i }),
230
246
  [e, i]
231
247
  );
232
- return /* @__PURE__ */ a(
233
- b.Provider,
248
+ return /* @__PURE__ */ s(
249
+ F.Provider,
234
250
  {
235
- value: { file: u, objectUrl: t, isLoading: p, setIsLoading: m, onRemove: () => {
251
+ value: { file: l, objectUrl: t, isLoading: p, setIsLoading: c, onRemove: () => {
236
252
  } },
237
- children: /* @__PURE__ */ a(
238
- A,
253
+ children: /* @__PURE__ */ s(
254
+ D,
239
255
  {
240
256
  type: "button",
241
- "aria-label": F(i ?? "") ? `Preview ${e ?? "file"}` : `Open ${e ?? "file"} in new tab`,
242
- "data-loading": g(p),
243
- onClick: r(n, () => {
244
- if (F(i ?? ""))
245
- l({ url: t, name: e ?? "file" });
257
+ "aria-label": C(i ?? "") ? `Preview ${e ?? "file"}` : `Open ${e ?? "file"} in new tab`,
258
+ "data-loading": _(p),
259
+ onClick: d(n, () => {
260
+ if (C(i ?? ""))
261
+ r({ url: t, name: e ?? "file" });
246
262
  else if (t)
247
263
  if (t.startsWith("data:")) {
248
- const f = document.createElement("a");
249
- f.href = t, f.download = e ?? "file", f.click();
264
+ const h = document.createElement("a");
265
+ h.href = t, h.download = e ?? "file", h.click();
250
266
  } else
251
267
  window.open(t, "_blank", "noopener,noreferrer");
252
268
  }),
253
- ...s
269
+ ...a
254
270
  }
255
271
  )
256
272
  }
257
273
  );
258
- }, O = o("div", {
274
+ }, $ = o("div", {
259
275
  _id: "aiChatInput__Fieldset"
260
- }), D = (t) => {
261
- const e = d();
262
- return /* @__PURE__ */ a(
263
- O,
276
+ }), B = (t) => {
277
+ const e = m();
278
+ return /* @__PURE__ */ s(
279
+ $,
264
280
  {
265
281
  ...e.getDropzoneProps({ disableClick: !0 }),
266
- "data-drag-over": g(e.dragging),
282
+ "data-drag-over": _(e.dragging),
267
283
  ...t
268
284
  }
269
285
  );
270
- }, mt = ({
286
+ }, ft = ({
271
287
  ...t
272
288
  }) => {
273
- const { files: e, setFiles: i, showInputNotification: n } = c();
274
- return /* @__PURE__ */ a(
275
- N,
289
+ const { files: e, setFiles: i, showInputNotification: n } = x();
290
+ return /* @__PURE__ */ s(
291
+ T,
276
292
  {
277
- accept: _,
278
- maxFiles: P,
279
- maxFileSize: y,
293
+ accept: b,
294
+ maxFiles: j,
295
+ maxFileSize: E,
280
296
  preventDocumentDrop: !0,
281
297
  acceptedFiles: e,
282
- onFileAccept: (s) => i(s.files),
283
- onFileReject: (s) => {
284
- const l = U(s.files);
285
- l && n(l);
298
+ onFileAccept: (a) => i(a.files),
299
+ onFileReject: (a) => {
300
+ const r = U(a.files);
301
+ r && n(r);
286
302
  },
287
- children: /* @__PURE__ */ a(D, { ...t })
303
+ children: /* @__PURE__ */ s(B, { ...t })
288
304
  }
289
305
  );
290
- }, ut = o("div", {
306
+ }, ht = o("div", {
291
307
  _id: "aiChatInput__DropZone"
292
- }), $ = o("div", {
308
+ }), z = o("div", {
293
309
  _id: "aiChatInput__Notification"
294
- }), ft = (t) => {
295
- const { inputNotification: e } = c();
296
- return e ? /* @__PURE__ */ a($, { role: "alert", ...t }) : null;
297
- }, B = o("p", {
310
+ }), gt = (t) => {
311
+ const { inputNotification: e } = x();
312
+ return e ? /* @__PURE__ */ s(z, { role: "alert", ...t }) : null;
313
+ }, H = o("p", {
298
314
  _id: "aiChatInput__NotificationTitle"
299
- }), ht = ({
315
+ }), vt = ({
300
316
  children: t,
301
317
  ...e
302
318
  }) => {
303
- const { inputNotification: i } = c();
304
- return i?.title ? /* @__PURE__ */ j(B, { ...e, children: [
319
+ const { inputNotification: i } = x();
320
+ return i?.title ? /* @__PURE__ */ w(H, { ...e, children: [
305
321
  t,
306
322
  i.title
307
323
  ] }) : null;
308
- }, z = o("p", {
324
+ }, X = o("p", {
309
325
  _id: "aiChatInput__NotificationMessage"
310
- }), vt = (t) => {
311
- const { inputNotification: e } = c();
312
- return /* @__PURE__ */ a(z, { ...t, children: e?.message });
313
- }, H = o("button", {
326
+ }), _t = (t) => {
327
+ const { inputNotification: e } = x();
328
+ return /* @__PURE__ */ s(X, { ...t, children: e?.message });
329
+ }, Y = o("button", {
314
330
  _id: "aiChatInput__NotificationClose"
315
- }), gt = ({
331
+ }), bt = ({
316
332
  onClick: t,
317
333
  ...e
318
334
  }) => {
319
- const { clearInputNotification: i } = c();
320
- return /* @__PURE__ */ a(
321
- H,
335
+ const { clearInputNotification: i } = x();
336
+ return /* @__PURE__ */ s(
337
+ Y,
322
338
  {
323
339
  type: "button",
324
340
  "aria-label": "Dismiss",
325
- onClick: r(t, i),
341
+ onClick: d(t, i),
326
342
  ...e
327
343
  }
328
344
  );
329
- }, _t = o("div", {
345
+ }, Ft = o("div", {
330
346
  _id: "aiChatInput__NotificationContent"
331
- }), bt = o("div", {
347
+ }), Ct = o("div", {
332
348
  _id: "aiChatInput__NotificationHeader"
333
- }), Ft = o(v, {
349
+ }), It = o(v, {
334
350
  _id: "aiChatInput__FileUploadButtonIcon",
335
351
  iconKey: "fileUpload"
336
- }), X = o("button", {
352
+ }), K = o("button", {
337
353
  _id: "aiChatInput__FileUploadButton"
338
- }), Ct = (t) => {
339
- const { aiChatSettings: e } = T(), i = d(), { onClick: n, ...s } = t;
340
- return /* @__PURE__ */ a(
341
- X,
354
+ }), Pt = (t) => {
355
+ const { aiChatSettings: e } = y(), i = m(), { onClick: n, ...a } = t;
356
+ return /* @__PURE__ */ s(
357
+ K,
342
358
  {
343
359
  type: "button",
344
360
  "aria-label": "Upload file",
345
361
  disabled: e.isViewOnly,
346
- onClick: r(n, () => i.openFilePicker()),
347
- ...s
362
+ onClick: d(n, () => i.openFilePicker()),
363
+ ...a
348
364
  }
349
365
  );
350
- }, Y = o("input", {
366
+ }, W = o("input", {
351
367
  _id: "aiChatInput__FileInput"
352
- }), It = (t) => {
353
- const e = d();
354
- return /* @__PURE__ */ a(Y, { ...t, ...e.getHiddenInputProps() });
355
- }, K = o("div", {
368
+ }), yt = (t) => {
369
+ const e = m();
370
+ return /* @__PURE__ */ s(W, { ...t, ...e.getHiddenInputProps() });
371
+ }, Z = o("div", {
356
372
  _id: "aiChatInput__FileList"
357
- }), Pt = ({ children: t, ...e }) => {
358
- const n = d().acceptedFiles;
359
- return n.length ? /* @__PURE__ */ a(K, { ...e, children: t(n) }) : null;
360
- }, b = C.createContext(null);
361
- function x() {
362
- const t = C.useContext(b);
373
+ }), jt = ({ children: t, ...e }) => {
374
+ const n = m().acceptedFiles;
375
+ return n.length ? /* @__PURE__ */ s(Z, { ...e, children: t(n) }) : null;
376
+ }, F = I.createContext(null);
377
+ function u() {
378
+ const t = I.useContext(F);
363
379
  if (!t) throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");
364
380
  return t;
365
381
  }
366
- const Z = o("div", {
382
+ const V = o("div", {
367
383
  _id: "aiChatInput__FileItem"
368
- }), yt = ({ file: t, ...e }) => {
369
- const i = d(), [n, s] = h(void 0), [l, p] = h(!0);
370
- E(() => i.createFileUrl(t, (u) => {
371
- s(u), p(!0);
384
+ }), Et = ({ file: t, ...e }) => {
385
+ const i = m(), [n, a] = g(void 0), [r, p] = g(!0);
386
+ k(() => i.createFileUrl(t, (l) => {
387
+ a(l), p(!0);
372
388
  }), [t]);
373
- const m = () => i.deleteFile(t);
374
- return /* @__PURE__ */ a(b.Provider, { value: { file: t, objectUrl: n, isLoading: l, setIsLoading: p, onRemove: m }, children: /* @__PURE__ */ a(Z, { "data-loading": g(l), ...e }) });
375
- }, V = o("button", {
389
+ const c = () => i.deleteFile(t);
390
+ return /* @__PURE__ */ s(F.Provider, { value: { file: t, objectUrl: n, isLoading: r, setIsLoading: p, onRemove: c }, children: /* @__PURE__ */ s(V, { "data-loading": _(r), ...e }) });
391
+ }, G = o("button", {
376
392
  _id: "aiChatInput__FilePreviewTrigger"
377
- }), jt = ({
393
+ }), wt = ({
378
394
  onClick: t,
379
395
  ...e
380
396
  }) => {
381
- const { objectUrl: i, file: n } = x(), { openImagePreview: s } = I();
382
- return /* @__PURE__ */ a(
383
- V,
397
+ const { objectUrl: i, file: n } = u(), { openImagePreview: a } = P();
398
+ return /* @__PURE__ */ s(
399
+ G,
384
400
  {
385
401
  type: "button",
386
402
  "aria-label": `Preview ${n.name}`,
387
403
  disabled: !i,
388
- onClick: r(t, () => {
389
- i && s({ url: i, name: n.name });
404
+ onClick: d(t, () => {
405
+ i && a({ url: i, name: n.name });
390
406
  }),
391
407
  ...e
392
408
  }
393
409
  );
394
- }, W = o("span", {
410
+ }, J = o("span", {
395
411
  _id: "aiChatInput__FileContent"
396
- }), Et = (t) => /* @__PURE__ */ a(W, { ...t }), G = o("img", {
412
+ }), kt = (t) => /* @__PURE__ */ s(J, { ...t }), Q = o("img", {
397
413
  _id: "aiChatInput__FileThumbnail"
398
- }), wt = ({
414
+ }), Mt = ({
399
415
  onLoad: t,
400
416
  ...e
401
417
  }) => {
402
- const { objectUrl: i, file: n, setIsLoading: s } = x();
403
- return /* @__PURE__ */ a(
404
- G,
418
+ const { objectUrl: i, file: n, setIsLoading: a } = u();
419
+ return /* @__PURE__ */ s(
420
+ Q,
405
421
  {
406
422
  src: i,
407
423
  alt: n.name,
408
- onLoad: r(t, () => s(!1)),
424
+ onLoad: d(t, () => a(!1)),
409
425
  ...e
410
426
  }
411
427
  );
412
- }, kt = ({ className: t }) => {
413
- const { file: e } = x(), i = L[R(e).type] ?? "file";
414
- return /* @__PURE__ */ a(v, { iconKey: i, className: t });
415
- }, J = o("span", {
428
+ }, Nt = ({ className: t }) => {
429
+ const { file: e } = u(), i = L[R(e).type] ?? "file";
430
+ return /* @__PURE__ */ s(v, { iconKey: i, className: t });
431
+ }, tt = o("span", {
416
432
  _id: "aiChatInput__FileName"
417
- }), Nt = (t) => {
418
- const { file: e } = x();
419
- return /* @__PURE__ */ a(J, { ...t, children: e.name });
420
- }, Q = o("button", {
433
+ }), Tt = (t) => {
434
+ const { file: e } = u();
435
+ return /* @__PURE__ */ s(tt, { ...t, children: e.name });
436
+ }, et = o("button", {
421
437
  _id: "aiChatInput__FileRemove"
422
- }), Tt = o(v, {
438
+ }), Lt = o(v, {
423
439
  _id: "aiChatInput__FileRemoveIcon",
424
440
  iconKey: "close"
425
- }), Lt = ({
441
+ }), qt = ({
426
442
  onClick: t,
427
443
  ...e
428
444
  }) => {
429
- const { onRemove: i } = x();
430
- return /* @__PURE__ */ a(
431
- Q,
445
+ const { onRemove: i } = u();
446
+ return /* @__PURE__ */ s(
447
+ et,
432
448
  {
433
449
  type: "button",
434
450
  "aria-label": "Remove file",
435
- onClick: r(t, i),
451
+ onClick: d(t, i),
436
452
  ...e
437
453
  }
438
454
  );
439
455
  };
440
456
  export {
441
- M as ACCEPTED_FILE_MIME_TYPES,
442
- ut as EmbeddedChatPrimitiveDropZone,
443
- Et as EmbeddedChatPrimitiveFileContent,
444
- It as EmbeddedChatPrimitiveFileInput,
445
- yt as EmbeddedChatPrimitiveFileItem,
446
- Pt as EmbeddedChatPrimitiveFileList,
447
- Nt as EmbeddedChatPrimitiveFileName,
448
- jt as EmbeddedChatPrimitiveFilePreviewTrigger,
449
- Lt as EmbeddedChatPrimitiveFileRemove,
450
- Tt as EmbeddedChatPrimitiveFileRemoveIcon,
451
- wt as EmbeddedChatPrimitiveFileThumbnail,
452
- kt as EmbeddedChatPrimitiveFileTypeIcon,
453
- Ct as EmbeddedChatPrimitiveFileUploadButton,
454
- Ft as EmbeddedChatPrimitiveFileUploadButtonIcon,
455
- mt as EmbeddedChatPrimitiveInputFieldset,
456
- ft as EmbeddedChatPrimitiveInputNotification,
457
- gt as EmbeddedChatPrimitiveInputNotificationClose,
458
- _t as EmbeddedChatPrimitiveInputNotificationContent,
459
- bt as EmbeddedChatPrimitiveInputNotificationHeader,
460
- vt as EmbeddedChatPrimitiveInputNotificationMessage,
461
- ht as EmbeddedChatPrimitiveInputNotificationTitle,
462
- xt as EmbeddedChatPrimitiveMessageFile,
463
- dt as EmbeddedChatPrimitiveMessageFiles,
464
- _ as FILE_ACCEPT_MAP,
457
+ q as ACCEPTED_FILE_MIME_TYPES,
458
+ ht as EmbeddedChatPrimitiveDropZone,
459
+ kt as EmbeddedChatPrimitiveFileContent,
460
+ yt as EmbeddedChatPrimitiveFileInput,
461
+ Et as EmbeddedChatPrimitiveFileItem,
462
+ jt as EmbeddedChatPrimitiveFileList,
463
+ Tt as EmbeddedChatPrimitiveFileName,
464
+ wt as EmbeddedChatPrimitiveFilePreviewTrigger,
465
+ qt as EmbeddedChatPrimitiveFileRemove,
466
+ Lt as EmbeddedChatPrimitiveFileRemoveIcon,
467
+ Mt as EmbeddedChatPrimitiveFileThumbnail,
468
+ Nt as EmbeddedChatPrimitiveFileTypeIcon,
469
+ Pt as EmbeddedChatPrimitiveFileUploadButton,
470
+ It as EmbeddedChatPrimitiveFileUploadButtonIcon,
471
+ ft as EmbeddedChatPrimitiveInputFieldset,
472
+ gt as EmbeddedChatPrimitiveInputNotification,
473
+ bt as EmbeddedChatPrimitiveInputNotificationClose,
474
+ Ft as EmbeddedChatPrimitiveInputNotificationContent,
475
+ Ct as EmbeddedChatPrimitiveInputNotificationHeader,
476
+ _t as EmbeddedChatPrimitiveInputNotificationMessage,
477
+ vt as EmbeddedChatPrimitiveInputNotificationTitle,
478
+ ut as EmbeddedChatPrimitiveMessageFile,
479
+ mt as EmbeddedChatPrimitiveMessageFiles,
480
+ b as FILE_ACCEPT_MAP,
465
481
  L as FILE_TYPE_ICON_MAP,
466
- P as MAX_FILES,
467
- y as MAX_FILE_SIZE,
468
- F as isImageMimeType,
482
+ j as MAX_FILES,
483
+ E as MAX_FILE_SIZE,
484
+ C as isImageMimeType,
469
485
  R as normalizeFileType
470
486
  };
@@ -654,6 +654,9 @@ video {
654
654
  .top-\\[5\\%\\] {
655
655
  top: 5%;
656
656
  }
657
+ .isolate {
658
+ isolation: isolate;
659
+ }
657
660
  .z-10 {
658
661
  z-index: 10;
659
662
  }
@@ -655,6 +655,9 @@ video {
655
655
  .top-\\[5\\%\\] {
656
656
  top: 5%;
657
657
  }
658
+ .isolate {
659
+ isolation: isolate;
660
+ }
658
661
  .z-10 {
659
662
  z-index: 10;
660
663
  }
@@ -43,6 +43,25 @@ export interface InkeepAIChatSettings {
43
43
  * @beta This type is subject to change.
44
44
  */
45
45
  files?: FileUIPart[];
46
+ /**
47
+ * Transform the file attachments displayed on a user message before they render as
48
+ * chips. Called per message at render time with the message's file parts, for live
49
+ * and history-loaded messages alike. The input includes all of the message's file
50
+ * parts regardless of MIME type; the widget's accepted-file-types filter is
51
+ * re-applied to the returned list, so unsupported types still never render. Return
52
+ * the parts to display: omit entries to hide them, or return shallow-modified copies
53
+ * (for example, with a friendlier filename) to rename them. Display-only, so it does
54
+ * not affect what is sent to the agent, stored, or visible to the LLM. Not a
55
+ * security boundary: hidden parts are still sent, stored in conversation history,
56
+ * and present in client memory, and if the transformer throws or returns a
57
+ * non-array, the widget fails open and renders the original untransformed parts.
58
+ * Null entries in a returned array are dropped, treated as intent to omit rather
59
+ * than as a failure. Must be pure and cheap, since it runs on every message render.
60
+ * Return new or copied objects and do not mutate the input parts.
61
+ *
62
+ * @beta This type is subject to change.
63
+ */
64
+ transformMessageFiles?: (files: FileUIPart[]) => FileUIPart[];
46
65
  /**
47
66
  * The placeholder text to display in the chat input field when empty.
48
67
  * Use this to provide guidance on what kind of questions users can ask.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-ui",
3
- "version": "0.0.0-dev-20260611215917",
3
+ "version": "0.0.0-dev-20260612033415",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "repository": {