PageSourceSearch

https://platform.colleague.ai/assets/useUploadSourceDialogs-CXJ1ayEO.js

js colleague.ai collected 2026-09-24 12:10:41 UTC 2,294 bytes, 1 lines download raw bytes

1import{s as e}from"./rolldown-runtime-BcKkbAw3.js";import{_ as t}from"./react-vendor-BriIVOc-.js";import{Ol as n}from"./useInteractiveGeneration-Clyl1drg.js";import{dt as r,tt as i}from"./useInteractive-BL3ARUYa.js";import{t as a}from"./whiteboardAttachmentName-a-Jw1s2g.js";import{n as o,r as s,t as c}from"./languageUtils-gPhJCvQv.js";var l=e(t());function u({attachments:e,setAttachments:t,setIsUploadingFiles:u}){let[d,f]=(0,l.useState)(void 0),[p,m]=(0,l.useState)(void 0),[h,g]=(0,l.useState)(null),_=n(),v=n(),y=(0,l.useRef)(null);return{whiteboardDialog:_,codeEditorDialog:v,codeEditorRef:y,selectedWhiteboardMetadata:d,selectedCodeMetadata:p,handleWhiteboardClick:(0,l.useCallback)(()=>{_.open()},[_]),handleCodeEditorClick:(0,l.useCallback)(()=>{v.open()},[v]),handleWhiteboardResult:(0,l.useCallback)(e=>{let n=a(),r={name:n,size:0,content:``,isSourceFile:!1,fileExtension:`.jpg`,url:e.imgUrl,whiteboardMetdataUrl:e.metadataUrl};t(e=>{let t=e.findIndex(e=>e.name===n);if(t===-1)return[...e,r];let i=[...e];return i[t]=r,i}),f(void 0)},[t]),handleCloseWhiteboard:(0,l.useCallback)(()=>{f(void 0),_.close()},[_]),handleCloseCodeEditor:(0,l.useCallback)(()=>{m(void 0),g(null),v.close()},[v]),handleAddCodeContent:(0,l.useCallback)(async()=>{if(!y.current)return;let n=y.current.getCode(),i=y.current.getLanguage(),a=c(i),o=h===null?`code-${Date.now()}${a}`:e[h].name,s=new Blob([n],{type:`text/plain`}),l=new File([s],o,{type:`text/plain`});u(!0);try{let e=await r(l);if(!e)return;let i={...e,content:n};t(e=>{if(h!==null){let t=[...e];return t[h]=i,t}return[...e,i]})}finally{u(!1),m(void 0),g(null),v.close()}},[e,v,h,t,u]),handleOnImageAttachmentClick:(0,l.useCallback)(e=>{`whiteboardMetdataUrl`in e&&fetch(e.whiteboardMetdataUrl).then(e=>e.json()).catch(()=>null).then(e=>{e&&(f(e),_.open())})},[_]),handleOnAttachmentClick:(0,l.useCallback)(t=>{if(!s(t.name,t.fileExtension))return!1;let n=e.findIndex(e=>e===t),r=t.content;if(!r&&t.url)return i(t.url).then(e=>e.text()).then(e=>{let r=t.fileExtension??`.`+t.name.split(`.`).pop()?.toLowerCase(),i=o(r||`.txt`);m({code:e,language:i}),g(n>=0?n:null),v.open()}),!0;let a=t.fileExtension??`.`+t.name.split(`.`).pop()?.toLowerCase(),c=o(a||`.txt`);return m({code:r||``,language:c}),g(n>=0?n:null),v.open(),!0},[e,v])}}export{u 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.