1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9317],{49317:(e,t,o)=>{o.r(t),o.d(t,{default:()=>m});var r=o(73365),s=o(9803),l=o.n(s),a=o(1521),n=o(47502),c=o(83878),i=o(6921);o(51727),o(64068);var f=o(60318),d=o(92547),h=o(64188),u=o(17687),x=o(949);function m(e){let{sessionId:t,onEditorReady:o,className:s="",currentFileName:m,onSaveFile:g,onClearFile:b,onQuoteToChat:j}=e,{resolvedTheme:k}=(0,i.D)(),[p,N]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),w=(0,a.useMemo)(()=>f.Z.create({blockSpecs:f.a1}),[]),S=(0,c.Hx)({schema:w});return((0,a.useEffect)(()=>{S&&o&&o(S)},[S,o]),(0,a.useEffect)(()=>{if(!S)return;let e=S.onSelectionChange(()=>{let e=S.getSelection();y(void 0!==e&&e.blocks.length>0)});return()=>{"function"==typeof e&&e()}},[S]),(0,a.useEffect)(()=>{S&&(async()=>{try{let e=localStorage.getItem("blocknote-content-".concat(t));if(e){let t=JSON.parse(e);t&&t.length>0&&S.replaceBlocks(S.document,t)}}catch(e){console.error("Failed to load editor content:",e)}finally{N(!0)}})()},[t,S]),(0,a.useEffect)(()=>{if(!S||!p)return;let e=S.onChange(()=>{try{let e=S.document;localStorage.setItem("blocknote-content-".concat(t),JSON.stringify(e))}catch(e){console.error("Failed to save editor content:",e)}});return()=>{"function"==typeof e&&e()}},[t,S,p]),S)?(0,r.jsxs)("div",{className:"flex h-full flex-col ".concat(s," bg-[#1F1F1F]"),children:[m&&(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-700 bg-[#2A2A2A] px-4 py-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-sm text-gray-400",children:"Editing:"}),(0,r.jsx)("span",{className:"text-sm font-medium text-white",children:m})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[g&&(0,r.jsxs)(d.$,{size:"sm",variant:"default",onClick:g,className:"h-7 gap-1.5 text-xs",children:[(0,r.jsx)(h.A,{className:"h-3.5 w-3.5"}),"Save"]}),b&&(0,r.jsx)(d.$,{size:"sm",variant:"ghost",onClick:b,className:"h-7 gap-1.5 text-xs",title:"Close file",children:(0,r.jsx)(u.A,{className:"h-3.5 w-3.5"})})]})]}),(0,r.jsxs)("div",{className:"jsx-f9faee3f4f501185 relative flex-1 overflow-auto pt-6",children:[(0,r.jsx)(l(),{id:"f9faee3f4f501185",children:".bn-editor{background-color:#1f1f1f!important}.bn-block-content{color:#fff!important}"}),(0,r.jsx)(n.NP,{editor:S,theme:"dark"===k?"dark":"light"}),j&&v&&(0,r.jsx)("button",{onClick:()=>{if(S&&j)try{let e=S.getSelection();if(e&&e.blocks.length>0){let t=e.blocks,o=S.blocksToMarkdownLossy(t);o&&o.trim().length>0&&j(o);return}let t=S.document;if(!t||0===t.length)return;let o=S.blocksToMarkdownLossy(t);o&&o.trim().length>0&&j(o)}catch(e){console.error("Error quoting editor content:",e)}},title:"Quote selected text to Chat","aria-label":"Quote selected text to chat",className:"jsx-f9faee3f4f501185 absolute bottom-6 right-6 flex h-12 w-12 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg transition hover:bg-primary/90 hover:shadow-xl",children:(0,r.jsx)(x.A,{className:"h-5 w-5"})})]})]}):(0,r.jsx)("div",{className:"h-full overflow-auto ".concat(s," flex items-center justify-center"),children:(0,r.jsx)("div",{className:"text-muted-foreground",children:"Loading editor..."})})}}}]);
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.