1"use strict";(self.webpackChunkclient=self.webpackChunkclient||[]).push([[924],{43924(e,t,r){r.d(t,{Ay:()=>m,r6:()=>v});var n=r(65043),i=r(23768),o=r(65377),l=r(4818),a=r(42629),s=r(59065),d=r(58156),c=r(11983),x=r(20835),u=r(81495),p=r(46690),h=r(70579);function v(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function f(e,t){return"mcp"===e?t?"AI app (".concat(t,")"):"Connected AI app":"restore"===e?"Restored from history":"Knowledge Hub"}const y={intro:{fontSize:"13px",color:"var(--text-secondary)",margin:"0 0 16px",lineHeight:1.55,maxWidth:"720px"},toolbar:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"18px",flexWrap:"wrap"},count:{fontSize:"12.5px",color:"var(--text-muted)"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:"16px"},card:e=>({background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"var(--radius-lg)",boxShadow:e?"var(--shadow-md)":"var(--shadow)",transition:"box-shadow 0.15s",display:"flex",flexDirection:"column",minWidth:0,overflow:"hidden"}),accent:{height:"3px",background:"linear-gradient(90deg, #6d28d9 0%, var(--cux-accent, #2563eb) 100%)"},body:{padding:"14px 16px 12px",display:"flex",flexDirection:"column",gap:"8px",flex:1,minWidth:0},head:{display:"flex",alignItems:"flex-start",gap:"8px"},title:{flex:1,minWidth:0,fontSize:"14px",fontWeight:600,color:"var(--text-primary)",lineHeight:1.4,wordBreak:"break-word"},chip:{flexShrink:0,fontSize:"11px",fontWeight:700,color:"#6d28d9",background:"#ede9fe",borderRadius:"99px",padding:"2px 8px",lineHeight:"16px"},preview:{maxHeight:"140px",overflow:"hidden",WebkitMaskImage:"linear-gradient(180deg, #000 70%, transparent)",maskImage:"linear-gradient(180deg, #000 70%, transparent)"},foot:{display:"flex",alignItems:"center",gap:"6px",padding:"8px 12px 8px 16px",background:"#f8fafc",borderTop:"1px solid var(--border)"},meta:{flex:1,minWidth:0,fontSize:"11.5px",color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},aiDot:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",background:"#7c3aed",marginRight:"6px",verticalAlign:"middle"},historyWrap:{display:"grid",gridTemplateColumns:"220px 1fr",gap:"16px",minHeight:"320px"},list:{display:"flex",flexDirection:"column",gap:"6px",maxHeight:"420px",overflowY:"auto",paddingRight:"4px"},vRow:e=>({textAlign:"left",border:"1px solid ".concat(e?"var(--accent)":"var(--border)"),background:e?"var(--accent-light)":"var(--surface)",borderRadius:"var(--radius-md)",padding:"8px 10px",cursor:"pointer",display:"flex",flexDirection:"column",gap:"2px"}),vTitle:{fontSize:"12.5px",fontWeight:600,color:"var(--text-primary)"},vMeta:{fontSize:"11px",color:"var(--text-muted)",wordBreak:"break-word"},viewer:{border:"1px solid var(--border)",borderRadius:"var(--radius-md)",padding:"12px 14px",maxHeight:"420px",overflowY:"auto",background:"#fcfcfd"},viewerHead:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},viewerTitle:{flex:1,fontSize:"14px",fontWeight:600,color:"var(--text-primary)"}};function b(e){let{ctx:t,onEdit:r,onHistory:i,onDelete:o}=e;const[l,a]=(0,n.useState)(!1),s=t.body.length>420?"".concat(t.body.slice(0,420),"\u2026"):t.body,c=t.version>1,b=[{label:"Created by",value:t.createdBy||"\u2014"},{label:"Created",value:v(t.createdAt)},{label:"Created in",value:f(t.createdSource)},...c?[{label:"Last edited by",value:t.updatedBy||"\u2014"},{label:"Last edited",value:v(t.updatedAt)},{label:"Edited in",value:f(t.lastSource,t.lastClientName)}]:[],{label:"Version",value:"v".concat(t.version)}];return(0,h.jsxs)("div",{"data-testid":"cf-memory-context-card",style:y.card(l),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[(0,h.jsx)("div",{style:y.accent}),(0,h.jsxs)(p.A,{title:"Context details",rows:b,style:y.body,testId:"cf-memory-context-meta",children:[(0,h.jsxs)("div",{style:y.head,children:[(0,h.jsx)("span",{style:y.title,children:t.title}),(0,h.jsxs)("span",{style:y.chip,title:"".concat(t.version," saved version").concat(1===t.version?"":"s"),children:["v",t.version]})]}),(0,h.jsx)("div",{style:y.preview,children:(0,h.jsx)(d.A,{text:s})})]}),(0,h.jsxs)("div",{style:y.foot,children:[(0,h.jsxs)("span",{style:y.meta,children:[("mcp"===t.lastSource||"mcp"===t.createdSource)&&(0,h.jsx)("span",{style:y.aiDot,title:"Written from a connected AI app"}),c?"Edited ".concat(v(t.updatedAt)):"Created ".concat(v(t.createdAt))]}),(0,h.jsx)(x.Ex,{title:"Edit context",ariaLabel:"Edit ".concat(t.title),onClick:()=>r(t)}),(0,h.jsx)(u.Cn,{ariaLabel:"Version history of ".concat(t.title),onClick:()=>i(t)}),(0,h.jsx)(x.Xo,{title:"Delete context",ariaLabel:"Delete ".concat(t.title),onClick:()=>o(t)})]})]})}function g(e){var t;let{ctx:r,onClose:a,onRestored:s}=e;
1const[x,p]=(0,n.useState)({loading:!0,versions:[],error:null}),[b,g]=(0,n.useState)(null),[m,j]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=!0;return o.default.get("/memory/contexts/".concat(r._id,"/versions")).then(t=>{let{data:r}=t;if(!e)return;const n=Array.isArray(null===r||void 0===r?void 0:r.versions)?r.versions:[];p({loading:!1,versions:n,error:null}),g(n[0]||null)}).catch(t=>{e&&p({loading:!1,versions:[],error:(0,l.Q8)(t,"Failed to load the history")})}),()=>{e=!1}},[r._id]);const C=null===(t=x.versions[0])||void 0===t?void 0:t.version;return(0,h.jsx)(c.aF,{title:"History \u2014 ".concat(r.title),width:820,busy:m,onClose:a,footer:(0,h.jsx)(c.$n,{onClick:a,disabled:m,children:"Close"}),children:x.loading?(0,h.jsx)("p",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:"Loading\u2026"}):x.error?(0,h.jsx)("p",{style:{fontSize:"13px",color:"var(--error)"},children:x.error}):(0,h.jsxs)("div",{style:y.historyWrap,children:[(0,h.jsx)("div",{style:y.list,role:"listbox","aria-label":"Saved versions",children:x.versions.map(e=>(0,h.jsxs)("button",{type:"button",role:"option","aria-selected":(null===b||void 0===b?void 0:b._id)===e._id,style:y.vRow((null===b||void 0===b?void 0:b._id)===e._id),onClick:()=>g(e),children:[(0,h.jsxs)("span",{style:y.vTitle,children:["Version ",e.version,e.version===C?" \xb7 current":""]}),(0,h.jsx)("span",{style:y.vMeta,children:v(e.editedAt)}),(0,h.jsxs)("span",{style:y.vMeta,children:[e.editedBy||"\u2014"," \xb7 ",f(e.source,e.clientName),e.restoredFrom?" (from v".concat(e.restoredFrom,")"):""]})]},e._id))}),(0,h.jsx)("div",{style:y.viewer,"data-testid":"cf-memory-context-version",children:b&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{style:y.viewerHead,children:[(0,h.jsx)("span",{style:y.viewerTitle,children:b.title}),b.version!==C&&(0,h.jsx)(u.Y5,{disabled:m,ariaLabel:"Restore version ".concat(b.version),onClick:async()=>{if(b){j(!0);try{const{data:e}=await o.default.post("/memory/contexts/".concat(r._id,"/versions/").concat(b.version,"/restore"));i.Ay.success("Version ".concat(b.version," restored as version ").concat(e.version)),s(e)}catch(e){i.Ay.error((0,l.Q8)(e,"Failed to restore this version"))}finally{j(!1)}}}})]}),(0,h.jsx)(d.A,{text:b.body})]})})]})})}function m(e){let{onChanged:t}=e;
1const[r,d]=(0,n.useState)([]),[x,u]=(0,n.useState)(!0),[p,v]=(0,n.useState)(null),[f,m]=(0,n.useState)(null),[j,C]=(0,n.useState)(null),[w,k]=(0,n.useState)(!1),S=(0,n.useCallback)(async()=>{try{const{data:e}=await o.default.get("/memory/contexts");d(Array.isArray(null===e||void 0===e?void 0:e.contexts)?e.contexts:[])}catch(e){i.Ay.error((0,l.Q8)(e,"Failed to load contexts"))}finally{u(!1)}},[]);(0,n.useEffect)(()=>{S()},[S]);const A=e=>d(t=>[e,...t.filter(t=>t._id!==e._id)]);return(0,h.jsxs)("div",{"data-testid":"cf-memory-context-panel",children:[(0,h.jsx)("p",{style:y.intro,children:"Short, typed context your team \u2014 or a connected AI app like Claude or ChatGPT \u2014 wants remembered. Every save is kept as a version, and each context is searchable in Search Memory."}),(0,h.jsxs)("div",{style:y.toolbar,children:[(0,h.jsx)("button",{type:"button",className:"btn-height",style:a.N.btnPrimary,onClick:()=>v({mode:"add"}),children:"+ New context"}),!x&&r.length>0&&(0,h.jsxs)("span",{style:y.count,children:[r.length," ",1===r.length?"context":"contexts"]})]}),x?(0,h.jsx)("p",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:"Loading\u2026"}):0===r.length?(0,h.jsx)("p",{style:a.N.empty,children:"No contexts yet. Add one, or ask a connected AI app to save context for you."}):(0,h.jsx)("div",{style:y.grid,children:r.map(e=>(0,h.jsx)(b,{ctx:e,onEdit:e=>v({mode:"edit",ctx:e}),onHistory:m,onDelete:C},e._id))}),p&&(0,h.jsx)(s.A,{title:"edit"===p.mode?"Edit context \xb7 v".concat(p.ctx.version):"New context",nameLabel:"Title",bodyLabel:"Context",namePlaceholder:"e.g. Brand voice, Q4 priorities",bodyPlaceholder:"Type what should be remembered\u2026",initialName:"edit"===p.mode?p.ctx.title:"",initialBody:"edit"===p.mode?p.ctx.body:"",saving:w,onSave:async e=>{let{name:r,body:n}=e;const a=String(r||"").trim(),s=String(n||"").trim();if(a&&s){k(!0);try{if("edit"===p.mode){const{data:e}=await o.default.put("/memory/contexts/".concat(p.ctx._id),{title:a,body:s,baseVersion:p.ctx.version});A(e),i.Ay.success(e.version>p.ctx.version?"Saved as version ".concat(e.version):"No changes to save")}else{const{data:e}=await o.default.post("/memory/contexts",{title:a,body:s});A(e),i.Ay.success("Context added")}v(null),null===t||void 0===t||t()}catch(c){var d;409===(null===c||void 0===c||null===(d=c.response)||void 0===d?void 0:d.status)?(i.Ay.error((0,l.Q8)(c,"This context changed while you were editing it.")),S()):i.Ay.error((0,l.Q8)(c,"Failed to save the context"))}finally{k(!1)}}else i.Ay.error("Add a title and the context itself.")},onClose:()=>v(null)},"edit"===p.mode?p.ctx._id:"add"),f&&(0,h.jsx)(g,{ctx:f,onClose:()=>m(null),onRestored:e=>{A(e),m(null),null===t||void 0===t||t()}}),j&&(0,h.jsx)(c.TM,{title:"Delete context",message:'"'.concat(j.title,'" and all ').concat(j.version," of its versions will be removed from memory and from search. This cannot be undone."),confirmLabel:"Delete",busyLabel:"Deleting\u2026",busy:w,onConfirm:async()=>{const e=j;k(!0);try{await o.default.delete("/memory/contexts/".concat(e._id)),d(t=>t.filter(t=>t._id!==e._id)),C(null),i.Ay.success("Context deleted"),null===t||void 0===t||t()}catch(r){i.Ay.error((0,l.Q8)(r,"Failed to delete the context"))}finally{k(!1)}},onClose:()=>{w||C(null)}})]})}},81495(e,t,r){r.d(t,{Cn:()=>l,Ke:()=>h,XB:()=>s,Y5:()=>a,bD:()=>v,h$:()=>p,m8:()=>u,oT:()=>x,rB:()=>d,y9:()=>c});r(65043);var n=r(20835),i=r(70579);const o=(e,t)=>(0,i.jsx)("svg",{width:e,height:e,viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:(0,i.jsx)("g",{stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round",children:t})});function l(e){let{onClick:t,title:r="Version history",ariaLabel:l,size:a=22,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"#7c3aed",hoverBg:"#f5f3ff",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M12.5 20a7.5 7.5 0 1 0 2.2-5.3L12.5 17"}),(0,i.jsx)("path",{d:"M12.5 12.5V17h4.5"}),(0,i.jsx)("path",{d:"M20 16v4.2l2.8 1.8"})]}))})}function a(e){let{onClick:t,title:r="Restore this version",ariaLabel:l,size:a=22,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"#059669",hoverBg:"#ecfdf5",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M13.3 17.5a7.1 7.1 0 1 1 1.4 7.2"}),(0,i.jsx)("path",{d:"M12.5 12.5v5h5"})]}))})}function s(e){let{onClick:t,title:r="Add",ariaLabel:l,size:a=24,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"var(--cux-accent, #2563eb)",hoverBg:"var(--cux-accent-light, #eff6ff)",restColor:"var(--cux-accent, #2563eb)",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("rect",{x:"11.5",y:"11.5",width:"17",height:"17",rx:"4"}),(0,i.jsx)("path",{d:"M20 16.5v7M16.5 20h7"})]}))})}function d(e){let{onClick:t,title:r="Import CSV",ariaLabel:l,size:a=24,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"#0891b2",hoverBg:"#ecfeff",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M12.5 22.5v3.3c0 .9.7 1.7 1.7 1.7h11.6c.9 0 1.7-.8 1.7-1.7v-3.3"}),(0,i.jsx)("path",{d:"M20 23.3V12.5M16 16.5l4-4 4 4"})]}))})}function c(e){let{onClick:t,title:r="Download CSV template",ariaLabel:l,size:a=24,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"#475569",hoverBg:"#f1f5f9",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M22.5 11.7h-7c-1 0-1.7.7-1.7 1.6v13.4c0 .9.7 1.6 1.7 1.6h9c1 0 1.7-.7 1.7-1.6V15.4z"}),(0,i.jsx)("path",{d:"M22.5 11.7v3.7h3.7"}),(0,i.jsx)("path",{d:"M20 18.3v6.2M17.5 22l2.5 2.5 2.5-2.5"})]}))})}function x(e){let{onClick:t,title:r="Generate with AI",ariaLabel:l,size:a=24,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"#7c3aed",hoverBg:"#f5f3ff",restColor:"#7c3aed",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M18.3 12.5l1.6 4.2 4.2 1.6-4.2 1.6-1.6 4.2-1.6-4.2-4.2-1.6 4.2-1.6z"}),(0,i.jsx)("path",{d:"M25.8 22.5l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z"})]}))})}function u(e){let{onClick:t,title:r="Zoom in",ariaLabel:l,size:a=22,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"var(--cux-accent, #2563eb)",hoverBg:"var(--cux-accent-light, #eff6ff)",restColor:"#475569",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("circle",{cx:"18.3",cy:"18.3",r:"5.8"}),(0,i.jsx)("path",{d:"M22.5 22.5l4.2 4.2M18.3 15.8v5M15.8 18.3h5"})]}))})}function p(e){let{onClick:t,title:r="Zoom out",ariaLabel:l,size:a=22,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"var(--cux-accent, #2563eb)",hoverBg:"var(--cux-accent-light, #eff6ff)",restColor:"#475569",disabled:d,style:s,children:o(a,(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("circle",{cx:"18.3",cy:"18.3",r:"5.8"}),(0,i.jsx)("path",{d:"M22.5 22.5l4.2 4.2M15.8 18.3h5"})]}))})}function h(e){let{onClick:t,title:r="Reset zoom",ariaLabel:l,size:a=22,style:s,disabled:d}=e;return(0,i.jsx)(n.ul,{onClick:t,title:r,ariaLabel:l,hoverColor:"var(--cux-accent, #2563eb)",hoverBg:"var(--cux-accent-light, #eff6ff)",restColor:"#475569",disabled:d,style:s,children:o(a,(0,i.jsx)("path",{d:"M12.5 16.7v-4.2h4.2M23.3 12.5h4.2v4.2M27.5 23.3v4.2h-4.2M16.7 27.5h-4.2v-4.2"}))})}function v(e){let{onClick:t,open:r=!1,title:o,ariaLabel:l,size:a=22,style:s}=e;return(0,i.jsx)(n.ul,{onClick:t,title:o||(r?"Show less":"See more"),ariaLabel:l||(r?"Show less":"See more"),pressed:r,hoverColor:"var(--cux-accent, #2563eb)",hoverBg:"var(--cux-accent-light, #eff6ff)",restColor:r?"var(--cux-accent, #2563eb)":"#64748b",style:s,children:(0,i.jsx)("svg",{width:a,height:a,viewBox:"0 0 40 40",fill:"none","aria-hidden":"true",focusable:"false",style:{transition:"transform 0.18s",transform:r?"rotate(180deg)":"none"},children:(0,i.jsx)("path",{d:"M15 17.5l5 5 5-5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})}},59065(e,t,r){r.d(t,{A:()=>p});var n=r(89379),i=r(65043);const o={overlay:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px"},modal:{background:"var(--surface, #fff)",borderRadius:"14px",width:"100%",maxWidth:"760px",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(15,23,42,0.30)",overflow:"hidden"},head:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:"1px solid var(--border, #e2e8f0)"},title:{fontWeight:700,fontSize:"15px",color:"var(--text-primary, #1e293b)"},bodyWrap:{padding:"14px 18px",display:"flex",flexDirection:"column",gap:"10px",flex:1,minHeight:0},label:{fontSize:"12.5px",fontWeight:600,color:"var(--text-primary, #0f172a)"},nameInput:{width:"100%",padding:"9px 12px",border:"1px solid var(--border, #e2e8f0)",borderRadius:"8px",fontSize:"14px",fontFamily:"inherit",color:"var(--text-primary, #1e293b)",background:"#fff"},toolbar:{display:"flex",alignItems:"center",gap:"10px",flexWrap:"wrap"},toolBtn:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"5px 10px",border:"1px solid var(--border, #e2e8f0)",borderRadius:"7px",background:"#fff",cursor:"pointer",fontSize:"12px",fontWeight:600,color:"var(--text-secondary, #475569)"},area:{width:"100%",flex:1,minHeight:"48vh",resize:"none",padding:"12px 14px",border:"1px solid var(--border, #e2e8f0)",borderRadius:"10px",fontSize:"14px",lineHeight:1.6,fontFamily:"inherit",color:"var(--text-primary, #1e293b)",background:"#fff"},foot:{display:"flex",justifyContent:"flex-end",gap:"10px",padding:"12px 18px",borderTop:"1px solid var(--border, #e2e8f0)"},btnPrimary:{padding:"8px 18px",border:"none",borderRadius:"8px",background:"var(--primary, var(--cux-accent, #2563eb))",color:"#fff",fontWeight:600,fontSize:"13px",cursor:"pointer"},btnGhost:{padding:"8px 16px",border:"1px solid var(--border, #e2e8f0)",borderRadius:"8px",background:"#fff",color:"var(--text-secondary, #475569)",fontWeight:600,fontSize:"13px",cursor:"pointer"}};function l(e,t,r){e&&requestAnimationFrame(()=>{e.focus(),e.selectionStart=t,e.selectionEnd=null!==r&&void 0!==r?r:t})}const a=(e,t,r)=>{const n=e.lastIndexOf("\n",t-1)+1;let i=e.indexOf("\n",r);return-1===i&&(i=e.length),[n,i]};function s(e,t){if(!e)return;const{selectionStart:r,selectionEnd:n,value:i}=e,[o,s]=a(i,r,n),d=i.slice(o,s).split("\n").map(e=>""===e.trim()?e:t>0?" "+e:e.replace(/^ {1,2}/,"")).join("\n");e.value=i.slice(0,o)+d+i.slice(s),l(e,o,o+d.length)}function d(e){if(!e)return;const{selectionStart:t,selectionEnd:r,value:n}=e;if(t===r)return e.value="".concat(n.slice(0,t),"****").concat(n.slice(r)),void l(e,t+2);const i=n.slice(t,r);
1if(i.startsWith("**")&&i.endsWith("**")&&i.length>=4){const o=i.slice(2,-2);return e.value=n.slice(0,t)+o+n.slice(r),void l(e,t,t+o.length)}if("**"===n.slice(Math.max(0,t-2),t)&&"**"===n.slice(r,r+2))return e.value=n.slice(0,t-2)+i+n.slice(r+2),void l(e,t-2,t-2+i.length);e.value="".concat(n.slice(0,t),"**").concat(i,"**").concat(n.slice(r)),l(e,t,t+i.length+4)}function c(e){const t=e.target;if((e.metaKey||e.ctrlKey)&&"b"===String(e.key).toLowerCase())return e.preventDefault(),void d(t);if("Tab"===e.key)return e.preventDefault(),void s(t,e.shiftKey?-1:1);if("Enter"!==e.key||e.shiftKey)return;const{selectionStart:r,selectionEnd:n,value:i}=t;if(r!==n)return;const o=i.lastIndexOf("\n",r-1)+1,a=i.slice(o,r),c=/^(\s*)- (.*)$/.exec(a);if(!c)return;if(e.preventDefault(),""===c[2].trim())return t.value=i.slice(0,o)+i.slice(r),void l(t,o,o);const x="\n".concat(c[1],"- ");t.value=i.slice(0,r)+x+i.slice(n),l(t,r+x.length,r+x.length)}var x=r(70579);function u(e){let{taRef:t}=e;const r=()=>null===t||void 0===t?void 0:t.current;return(0,x.jsxs)("div",{style:o.toolbar,children:[(0,x.jsx)("button",{type:"button",style:(0,n.A)((0,n.A)({},o.toolBtn),{},{fontWeight:800}),onClick:()=>d(r()),title:"Bold the selection (Ctrl/Cmd+B) \u2014 wraps it in **",children:"B"}),(0,x.jsx)("button",{type:"button",style:o.toolBtn,onClick:()=>function(e){if(!e)return;const{selectionStart:t,selectionEnd:r,value:n}=e,[i,o]=a(n,t,r),s=n.slice(i,o).split("\n"),d=s.filter(e=>""!==e.trim()),c=d.length>0&&d.every(e=>/^\s*- /.test(e)),x=s.map(e=>""===e.trim()?e:c?e.replace(/^(\s*)- /,"$1"):/^\s*- /.test(e)?e:e.replace(/^(\s*)/,"$1- ")).join("\n");e.value=n.slice(0,i)+x+n.slice(o),l(e,i,i+x.length)}(r()),title:"Turn the selected lines into bullet points (-)",children:"\u2022\xa0 Bullets"}),(0,x.jsx)("button",{type:"button",style:o.toolBtn,onClick:()=>s(r(),1),title:"Indent the selected lines one level (Tab)",children:"\u21e5\xa0 Indent"}),(0,x.jsx)("button",{type:"button",style:o.toolBtn,onClick:()=>s(r(),-1),title:"Outdent the selected lines one level (Shift+Tab)",children:"\u21e4\xa0 Outdent"}),(0,x.jsx)("span",{style:{fontSize:"11px",color:"var(--text-muted, #94a3b8)"},children:"**bold**, \u201c- \u201d bullets, Tab/Shift+Tab to nest \u2014 the note renders with this structure everywhere, and Context nodes write it the same way."})]})}function p(e){let{title:t="Add",nameLabel:r="Name",bodyLabel:l,namePlaceholder:a,bodyPlaceholder:s,initialName:d="",initialBody:p="",saving:h=!1,allowAppend:v=!1,onSave:f,onClose:y}=e;const b=(0,i.useRef)(null),g=(0,i.useRef)(null),[m,j]=(0,i.useState)(d),[C,w]=(0,i.useState)(!1),k=(0,i.useRef)(y);k.current=y;const S=(0,i.useRef)(h);S.current=h;const A=(0,i.useRef)(!!d);(0,i.useEffect)(()=>{const e=setTimeout(()=>{var e,t;A.current?null===(e=g.current)||void 0===e||e.focus():null===(t=b.current)||void 0===t||t.focus()},30),t=e=>{"Escape"!==e.key||S.current||k.current()};return document.addEventListener("keydown",t),()=>{clearTimeout(e),document.removeEventListener("keydown",t)}},[]);const L=()=>{h||y()};return(0,x.jsx)("div",{style:o.overlay,onMouseDown:e=>{e.target===e.currentTarget&&L()},children:(0,x.jsxs)("div",{style:o.modal,children:[(0,x.jsxs)("div",{style:o.head,children:[(0,x.jsx)("span",{style:o.title,children:t}),(0,x.jsx)("button",{type:"button",onClick:L,style:(0,n.A)((0,n.A)({},o.btnGhost),{},{padding:"4px 10px"}),"aria-label":"Close",children:"\u2715"})]}),(0,x.jsxs)("div",{style:o.bodyWrap,children:[(0,x.jsxs)("div",{children:[(0,x.jsxs)("label",{style:o.label,children:[r," ",(0,x.jsx)("span",{style:{color:"#ef4444"},children:"*"})]}),(0,x.jsx)("input",{ref:b,type:"text",value:m,onChange:e=>j(e.target.value),placeholder:a,style:(0,n.A)((0,n.A)({},o.nameInput),{},{marginTop:"6px"})})]}),!1,l&&(0,x.jsxs)("label",{style:(0,n.A)((0,n.A)({},o.label),{},{marginTop:"4px"}),children:[C?"Content to append":l," ",(0,x.jsx)("span",{style:{color:"#ef4444"},children:"*"})]}),(0,x.jsx)("textarea",{ref:g,defaultValue:p,placeholder:s,onKeyDown:c,style:(0,n.A)((0,n.A)({},o.area),{},{minHeight:"36vh"})}),(0,x.jsx)(u,{taRef:g})]}),(0,x.jsxs)("div",{style:o.foot,children:[(0,x.jsx)("button",{type:"button",style:o.btnGhost,onClick:L,disabled:h,children:"Cancel"}),(0,x.jsx)("button",{type:"button",style:(0,n.A)((0,n.A)({},o.btnPrimary),{},{opacity:h?.7:1,cursor:h?"default":"pointer"}),onClick:()=>{var e,t;h||f({name:m,body:null!==(e=null===(t=g.current)||void 0===t?void 0:t.value)&&void 0!==e?e:"",append:C})},disabled:h,children:h?"Saving\u2026":"Save"})]})]})})}},58156(e,t,r){r.d(t,{A:()=>d});var n=r(89379),i=r(65043),o=r(70579);const l={wrap:{fontSize:"12.5px",color:"var(--text-secondary, #64748b)",lineHeight:1.6,margin:0},strong:{fontWeight:700,color:"var(--text-primary, #1e293b)"},bulletRow:e=>({display:"flex",gap:"7px",paddingLeft:"".concat(16*e,"px")}),bulletDot:{flexShrink:0,color:"var(--text-muted, #94a3b8)"},plain:e=>({paddingLeft:"".concat(16*e,"px"),whiteSpace:"pre-wrap"}),divider:{border:"none",borderTop:"1px solid var(--border, #e2e8f0)",margin:"8px 0"},gap:{height:"6px"}},a=["\u2022","\u25e6","\u25aa"];function s(e){return String(null!==e&&void 0!==e?e:"").split(/(\*\*[^*]+\*\*)/g).map((e,t)=>{const r=/^\*\*([^*]+)\*\*$/.exec(e);return r?(0,o.jsx)("strong",{style:l.strong,children:r[1]},t):(0,o.jsx)(i.Fragment,{children:e},t)})}function d(e){let{text:t,style:r}=e;const i=String(null!==t&&void 0!==t?t:"").split("\n");return(0,o.jsx)("div",{style:(0,n.A)((0,n.A)({},l.wrap),r),children:i.map((e,t)=>{if("---"===e.trim())return(0,o.jsx)("hr",{style:l.divider},t);if(""===e.trim())return(0,o.jsx)("div",{style:l.gap},t);const r=/^(\s*)- (.*)$/.exec(e);if(r){const e=Math.floor(r[1].length/2);return(0,o.jsxs)("div",{style:l.bulletRow(e),children:[(0,o.jsx)("span",{style:l.bulletDot,children:a[Math.min(e,a.length-1)]}),(0,o.jsx)("span",{children:s(r[2])})]},t)}const n=/^(\s*)/.exec(e)[1].length;return(0,o.jsx)("div",{style:l.plain(Math.floor(n/2)),children:s(e.trimStart())},t)})})}}}]); 2//# sourceMappingURL=924.96159121.chunk.js.map
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.