pagedex 0.1.3 → 0.1.5

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.
@@ -0,0 +1 @@
1
+ :root{color-scheme:dark;--bg: #111216;--bg-alt: #181a20;--bg-hover: rgba(255, 255, 255, .06);--border: rgba(255, 255, 255, .09);--text: #eceef2;--muted: #9499a6;--accent: #8b5cf6;--accent-hover: #7c3aed;--accent-soft: rgba(139, 92, 246, .16);--green: #4ade80;--amber: #fbbf24;--code-bg: #16181f;--glass: rgba(24, 26, 32, .88);--font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace}[data-theme=light]{color-scheme:light;--bg: #ffffff;--bg-alt: #f7f7f9;--bg-hover: rgba(0, 0, 0, .05);--border: rgba(0, 0, 0, .09);--text: #18181b;--muted: #6b7280;--accent: #6d28d9;--accent-hover: #5b21b6;--accent-soft: rgba(109, 40, 217, .1);--green: #16a34a;--amber: #d97706;--code-bg: #f3f4f6;--glass: rgba(247, 247, 249, .9)}*{box-sizing:border-box}html,body,#root{margin:0;height:100%;background:var(--bg);color:var(--text);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;overscroll-behavior-x:none;overflow-x:hidden}.app{display:grid;grid-template-columns:270px 1fr;height:100vh}.sidebar,.rightbar{background:var(--bg-alt);border-right:1px solid var(--border);display:flex;flex-direction:column;min-height:0}.workspace-body{flex:1;display:flex;min-height:0;min-width:0}.workspace-body.outline-right,.workspace-body.outline-hidden{flex-direction:row}.workspace-body.outline-bottom{flex-direction:column}.note-pane{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0}.workspace-body.outline-bottom .note-pane{flex:7 1 0%}.rightbar{border-right:0;border-left:1px solid var(--border);padding:0;width:240px;flex-shrink:0;overflow:hidden}.workspace-body.outline-bottom .rightbar{flex:3 1 0%;width:100%;max-height:none;min-height:0;border-left:0;border-top:1px solid var(--border)}.rightbar-head{height:44px;padding:0 12px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}.rightbar-body{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:18px}.workspace-body.outline-bottom .rightbar-body{display:grid;grid-template-columns:1fr 1fr;gap:16px;padding:10px 20px 14px}.rightbar-sec{min-width:0}.panel-subtitle{display:none}.workspace-body.outline-bottom .panel-subtitle{display:block;font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin:2px 0 4px}.backlinks-title{margin-top:0}.workspace-body.outline-bottom .backlinks-title{font-size:10.5px;margin:2px 0 4px}.brand{height:44px;padding:0 12px 0 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}.brand-title{font-weight:700;font-size:14px;display:flex;align-items:center;gap:8px}.brand-logo{display:block;flex-shrink:0;border-radius:5px}.pill{font-size:11px;padding:2px 7px;border-radius:999px;background:var(--accent-soft);color:var(--green);font-weight:600}.pill.off{color:var(--amber)}.sidebar-tabs{display:grid;grid-template-columns:1fr 1fr;gap:2px;margin:10px 12px 0;padding:3px;border-radius:8px;background:var(--bg);border:1px solid var(--border)}.sidebar-tab{background:transparent;border:0;color:var(--muted);font-size:12px;font-weight:600;padding:5px 8px;border-radius:6px;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:center;gap:6px}.sidebar-tab:hover{color:var(--text)}.sidebar-tab.active{background:var(--bg-alt);color:var(--text);box-shadow:0 1px 2px #00000040}.search-wrap{padding:8px 12px 10px;border-bottom:1px solid var(--border)}.search{width:100%;padding:7px 10px;border-radius:6px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px;outline:none}.search:focus{border-color:var(--accent)}.git-badge{font-size:10.5px;font-weight:700;min-width:18px;text-align:center;padding:1px 5px;border-radius:4px;font-family:var(--font-mono);flex-shrink:0}.git-M{color:var(--amber);background:#fbbf2424}.git-U,.git-A{color:var(--green);background:#4ade8024}.git-D{color:#f87171;background:#f8717124}.changes-bar{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:6px 8px 8px;border-bottom:1px solid var(--border);margin-bottom:6px}.changes-select{background:var(--bg);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:4px 8px;font-size:12px;outline:none}.commit-files{max-height:220px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;background:var(--bg);padding:6px;margin-bottom:12px}.commit-file-row{display:flex;align-items:center;gap:8px;padding:5px 6px;font-size:12.5px;cursor:pointer;border-radius:6px}.commit-file-row:hover{background:var(--bg-hover)}.git-output{background:var(--code-bg);border:1px solid var(--border);border-radius:8px;padding:10px;font-family:var(--font-mono);font-size:11.5px;white-space:pre-wrap;max-height:140px;overflow-y:auto;margin-top:8px}.diff-wrap{margin:0 auto}.diff-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;flex-wrap:wrap}.diff-hunk{border:1px solid var(--border);border-radius:10px;overflow:hidden;margin-bottom:14px;background:var(--code-bg)}.diff-hunk-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;background:var(--bg-alt);border-bottom:1px solid var(--border);font-family:var(--font-mono);font-size:11.5px;color:var(--muted)}.diff-line{display:grid;grid-template-columns:36px 20px 1fr 28px;align-items:start;font-family:var(--font-mono);font-size:12.5px;line-height:1.5;padding:1px 6px}.diff-line.add{background:#4ade801f}.diff-line.del{background:#f8717121}.diff-ln{color:var(--muted);font-size:11px;-webkit-user-select:none;user-select:none;text-align:right;padding-right:8px}.diff-sig{-webkit-user-select:none;user-select:none;font-weight:700}.diff-line.add .diff-sig{color:var(--green)}.diff-line.del .diff-sig{color:#f87171}.diff-txt{white-space:pre-wrap;word-break:break-word}.diff-discard-btn{background:none;border:0;color:var(--muted);cursor:pointer;font-size:13px;padding:0 4px;border-radius:4px;line-height:1.4}.diff-discard-btn:hover{color:#f87171;background:#f8717129}.tree{flex:1;overflow-y:auto;padding:8px;font-size:13px}.tree-dir-btn,.tree-file{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:5px 8px;border-radius:5px;cursor:pointer;display:flex;align-items:center;gap:6px;font-size:13px;font-family:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.tree-dir-btn{color:var(--muted);font-weight:600}.tree-dir-btn:hover,.tree-file-row:hover{background:var(--bg-hover)}.tree-file-row{display:flex;align-items:center;border-radius:5px;gap:2px}.tree-file-row.active{background:var(--accent-soft)}.tree-file-row .tree-file,.tree-file-row .tree-dir-btn{flex:1;min-width:0}.tree-file-row .tree-file:hover,.tree-file-row .tree-dir-btn:hover{background:none}.tree-file.active{background:none;color:var(--accent);font-weight:600}.tree-row-more{background:none;border:0;color:var(--muted);cursor:pointer;padding:4px 6px;border-radius:4px;font-size:13px;line-height:1;opacity:0;flex-shrink:0}.tree-file-row:hover .tree-row-more,.tree-file-row.active .tree-row-more{opacity:1}.tree-row-more:hover{color:var(--text);background:var(--bg-hover)}@media(hover:none),(max-width:768px){.tree-row-more{opacity:.75}}.file-ctx-menu{position:fixed;z-index:60;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:10px;padding:5px;min-width:170px;display:flex;flex-direction:column;gap:2px;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);overflow-y:auto;overscroll-behavior:contain;box-shadow:0 12px 32px #00000080}.file-ctx-menu .more-item{flex-shrink:0;justify-content:flex-start;gap:8px}.file-ctx-menu-icon{width:14px;height:14px;flex-shrink:0;opacity:.85}.tree-children{padding-left:14px}.main{display:flex;flex-direction:column;min-width:0;min-height:0}.topbar{height:44px;padding:0 14px 0 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}.topbar-left{display:flex;align-items:center;gap:8px;min-width:0}.crumbs{font-family:var(--font-mono);font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;gap:6px;align-items:center;position:relative}.icon-btn{width:30px;height:30px;padding:0;border-radius:7px;border:0;background:transparent;color:var(--muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .12s,color .12s}.icon-btn:hover,.icon-btn:active{background:var(--bg-hover);color:var(--text)}.icon-btn.active{color:var(--accent);background:var(--accent-soft)}@media(max-width:960px){.outline-toggle-btn.active{color:var(--muted);background:transparent}}.more-menu{position:absolute;top:calc(100% + 6px);right:0;z-index:35;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:12px;padding:5px;min-width:155px;display:flex;flex-direction:column;gap:2px;box-shadow:0 12px 32px #00000073}.more-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:8px 10px;border-radius:8px;font-size:13px;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:space-between}.more-item:hover{background:var(--bg-hover)}.more-item.active{color:var(--accent);font-weight:600}.outline-menu-trigger{display:none}.outline-menu-trigger.show-desktop{display:flex}.tiptap-wrap{margin:0 auto}.tiptap-toolbar{display:flex;gap:4px;align-items:center;overflow-x:auto;padding:6px 8px;margin-bottom:16px;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:12px;position:sticky;top:0;z-index:5}.tiptap-toolbar .btn{border-color:transparent;background:transparent;padding:5px 9px;border-radius:7px}.tiptap-toolbar .btn:hover{background:var(--bg-hover)}.tiptap-toolbar .btn.active{background:var(--accent-soft);color:var(--accent)}.tiptap-toolbar .btn.primary{background:var(--accent);color:#fff;padding:5px 12px;border-radius:8px}.tiptap-body .ProseMirror{outline:none;min-height:55vh;overflow-wrap:anywhere;word-break:break-word}.tiptap-body .ProseMirror>:first-child{margin-top:0}.btn{background:var(--bg-alt);border:1px solid var(--border);color:var(--text);border-radius:8px;padding:5px 11px;font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;flex-shrink:0;transition:background .12s,border-color .12s}.btn:hover{background:var(--bg-hover)}.btn.active{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}.btn.primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}.menu-btn{display:none;gap:5px}.backdrop{display:none}.content-scroll{flex:1;overflow-y:auto;overflow-x:hidden;min-width:0;padding:28px 36px 80px}.doc{max-width:780px;width:100%;margin:0 auto;line-height:1.65;font-size:15px;overflow-wrap:anywhere;word-break:break-word}.doc h1,.doc h2,.doc h3,.doc h4{margin-top:1.5em;margin-bottom:.5em;line-height:1.25}.doc h1{font-size:1.85em;border-bottom:1px solid var(--border);padding-bottom:.3em;margin-top:0}.doc h2{font-size:1.35em}.doc h3{font-size:1.12em}.doc p{margin:.8em 0}.doc a,.wikilink{color:var(--accent);text-decoration:none;cursor:pointer}.doc a:hover,.wikilink:hover{text-decoration:underline}.wikilink.broken{color:var(--amber);border-bottom:1px dashed var(--amber)}.doc code{font-family:var(--font-mono);font-size:.88em;background:var(--code-bg);padding:2px 5px;border-radius:4px;overflow-wrap:anywhere}.doc pre{background:var(--code-bg);border:1px solid var(--border);padding:14px 16px;border-radius:8px;max-width:100%;overflow-x:auto;font-size:13px;line-height:1.5}.doc pre code{background:none;padding:0}.doc blockquote{margin:1em 0;padding:8px 14px;border-left:3px solid var(--accent);background:var(--accent-soft);border-radius:0 6px 6px 0}.doc blockquote p{margin:.3em 0}.doc ul,.doc ol{padding-left:1.5em}.doc li{margin:.3em 0}.doc hr{border:0;border-top:1px solid var(--border);margin:1.8em 0}.doc table{display:block;max-width:100%;overflow-x:auto;border-collapse:collapse;margin:1em 0;font-size:14px}.doc th,.doc td{border:1px solid var(--border);padding:7px 10px;text-align:left}.doc th{background:var(--bg-alt)}.doc img{max-width:100%;height:auto;border-radius:8px;border:1px solid var(--border)}.raw-view{max-width:860px;width:100%;margin:0 auto;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font-family:var(--font-mono);font-size:13px;line-height:1.55;background:var(--code-bg);border:1px solid var(--border);padding:18px;border-radius:8px}.hljs{color:var(--text);background:transparent}.hljs-comment,.hljs-quote{color:#7f849c;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst,.hljs-section{color:#c084fc}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#f59e0b}.hljs-string,.hljs-doctag,.hljs-regexp{color:#4ade80}.hljs-title,.hljs-title.function_,.hljs-title.class_{color:#60a5fa}.hljs-type,.hljs-built_in,.hljs-class .hljs-title{color:#38bdf8}.hljs-attr,.hljs-attribute,.hljs-symbol,.hljs-bullet,.hljs-link{color:#f472b6}.hljs-addition{color:#4ade80;background:#4ade801f}.hljs-deletion{color:#f87171;background:#f871711f}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}[data-theme=light] .hljs-comment,[data-theme=light] .hljs-quote{color:#6b7280}[data-theme=light] .hljs-keyword,[data-theme=light] .hljs-selector-tag,[data-theme=light] .hljs-subst,[data-theme=light] .hljs-section{color:#7c3aed}[data-theme=light] .hljs-number,[data-theme=light] .hljs-literal,[data-theme=light] .hljs-variable,[data-theme=light] .hljs-template-variable,[data-theme=light] .hljs-tag .hljs-attr{color:#b45309}[data-theme=light] .hljs-string,[data-theme=light] .hljs-doctag,[data-theme=light] .hljs-regexp{color:#15803d}[data-theme=light] .hljs-title,[data-theme=light] .hljs-title.function_,[data-theme=light] .hljs-title.class_{color:#2563eb}[data-theme=light] .hljs-type,[data-theme=light] .hljs-built_in,[data-theme=light] .hljs-class .hljs-title{color:#0369a1}[data-theme=light] .hljs-attr,[data-theme=light] .hljs-attribute,[data-theme=light] .hljs-symbol,[data-theme=light] .hljs-bullet,[data-theme=light] .hljs-link{color:#be185d}.img-wrap{text-align:center}.img-wrap img{max-width:100%;max-height:80vh}.binary-card{max-width:460px;margin:40px auto;padding:28px 24px;border:1px solid var(--border);border-radius:12px;background:var(--bg-alt);text-align:center}.binary-card-name{font-size:16px;font-weight:700;margin-bottom:6px}.binary-card-path{font-size:12.5px;color:var(--muted);font-family:var(--font-mono);margin-bottom:18px}.panel-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:8px 0}.toc-item,.backlink-item{display:block;padding:4px 6px;border-radius:4px;font-size:12.5px;color:var(--text);text-decoration:none;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.toc-item:hover,.backlink-item:hover{background:var(--bg-hover);color:var(--accent)}.toc-h2{padding-left:14px;color:var(--muted)}.toc-h3{padding-left:24px;color:var(--muted);font-size:12px}.empty-note{font-size:12px;color:var(--muted);padding:4px 6px}.fab-wrap{position:fixed;right:18px;bottom:18px;z-index:25;display:flex;flex-direction:column;align-items:flex-end;gap:8px}.fab-btn{width:48px;height:48px;border-radius:999px;border:0;background:var(--accent);color:#fff;font-size:20px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px #00000059}.fab-menu{background:var(--bg-alt);border:1px solid var(--border);border-radius:10px;padding:6px;min-width:170px;display:flex;flex-direction:column;gap:2px;box-shadow:0 10px 28px #0006}.fab-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:8px 10px;border-radius:6px;font-size:13px;cursor:pointer;display:flex;align-items:center;gap:8px;font-family:inherit}.fab-item:hover{background:var(--bg-hover);color:var(--accent)}.mobile-bar,.sheet-backdrop,.bottom-sheet{display:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#000000a6;z-index:50;display:flex;align-items:center;justify-content:center;padding:12px}.modal{width:min(96vw,760px);height:min(90vh,660px);background:var(--bg-alt);border:1px solid var(--border);border-radius:14px;box-shadow:0 18px 48px #0000008c;display:flex;flex-direction:column;overflow:hidden}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);flex-shrink:0}.modal-head h2{margin:0;font-size:16px}.settings-tabs{display:flex;gap:6px;padding:10px 16px;border-bottom:1px solid var(--border);overflow-x:auto;flex-shrink:0;background:var(--bg)}.settings-tab{background:none;border:1px solid transparent;color:var(--muted);padding:6px 12px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap;font-family:inherit}.settings-tab:hover{color:var(--text);background:var(--bg-hover)}.settings-tab.active{color:var(--accent);background:var(--accent-soft);border-color:var(--accent)}.modal-body{flex:1;overflow-y:auto;padding:18px}.field{margin-bottom:16px}.field label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px;font-weight:600}.field-hint{font-size:11.5px;color:var(--muted);margin-top:4px}.field input[type=text],.field select{width:100%;padding:9px 11px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px;outline:none}.field input[type=range]{width:100%}.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-radius:8px;background:var(--bg);border:1px solid var(--border);margin-bottom:12px;font-size:13px;cursor:pointer}.endpoint-box{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:10px 12px;font-family:var(--font-mono);font-size:12px;margin-bottom:8px;word-break:break-all}.modal-foot{display:flex;justify-content:space-between;gap:8px;padding:12px 18px;border-top:1px solid var(--border);flex-shrink:0}.switcher-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#0000008c;z-index:45;display:flex;align-items:flex-end;justify-content:center;padding:14px}@media(min-width:769px){.switcher-backdrop{align-items:center}}.switcher{width:100%;max-width:520px;max-height:70vh;background:var(--bg-alt);border:1px solid var(--border);border-radius:16px;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 18px 48px #0000008c}.switcher-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-bottom:1px solid var(--border)}.switcher-tabs{display:flex;gap:4px}.switcher-tab{background:none;border:0;color:var(--muted);font-size:12px;font-weight:600;padding:5px 10px;border-radius:7px;cursor:pointer;font-family:inherit}.switcher-tab:hover{color:var(--text);background:var(--bg-hover)}.switcher-tab.active{background:var(--accent-soft);color:var(--accent)}.switcher-cap{font-size:11px;color:var(--muted);font-family:var(--font-mono)}.switcher-group-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);padding:8px 10px 4px}.switcher-row-top{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%}.switcher-time{font-size:11px;color:var(--muted);font-family:var(--font-mono);flex-shrink:0}.switcher-list{flex:1;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:2px}.switcher-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:10px 12px;border-radius:10px;cursor:pointer;font-family:inherit;display:flex;flex-direction:column;gap:2px}.switcher-item:hover,.switcher-item.selected{background:var(--accent-soft);color:var(--accent)}.switcher-path{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.switcher-snippet{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.switcher-input-wrap{padding:10px 12px;border-top:1px solid var(--border);display:flex;align-items:center;gap:8px;background:var(--bg-alt)}.switcher-input{flex:1;padding:10px 14px;border-radius:999px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:14px;outline:none}.switcher-input:focus{border-color:var(--accent)}.switcher-clear{width:30px;height:30px;border-radius:999px;border:0;background:var(--bg-hover);color:var(--text);font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}.folder-picker{margin-top:6px;max-height:170px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;background:var(--bg);padding:4px;display:flex;flex-direction:column;gap:2px}.folder-pick-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:6px 8px;border-radius:6px;cursor:pointer;font-size:12.5px;font-family:var(--font-mono)}.folder-pick-item:hover{background:var(--bg-hover)}.folder-pick-item.active{background:var(--accent-soft);color:var(--accent);font-weight:600}.desktop-tabs{display:flex;align-items:center;gap:4px;padding:6px 14px 0;background:var(--bg-alt);border-bottom:1px solid var(--border);overflow-x:auto}.desktop-tab{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:8px 8px 0 0;border:1px solid transparent;border-bottom:0;background:none;color:var(--muted);font-size:12px;cursor:pointer;font-family:inherit;white-space:nowrap;max-width:180px}.desktop-tab:hover{background:var(--bg-hover);color:var(--text)}.desktop-tab.active{background:var(--bg);color:var(--text);border-color:var(--border);font-weight:600}.desktop-tab-title{overflow:hidden;text-overflow:ellipsis}.desktop-tab-close{border:0;background:none;color:var(--muted);cursor:pointer;padding:0 2px;font-size:13px;line-height:1}.desktop-tab-close:hover{color:var(--text)}.desktop-tab-add{border:0;background:none;color:var(--muted);cursor:pointer;padding:4px 8px;font-size:16px;border-radius:6px}.desktop-tab-add:hover{background:var(--bg-hover);color:var(--text)}.new-tab-view{min-height:60vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}.new-tab-btn{width:210px;padding:12px 18px;border-radius:999px;border:1px solid var(--border);background:var(--bg-alt);color:var(--text);font-size:14px;font-family:inherit;cursor:pointer;display:flex;align-items:center;gap:12px}.new-tab-btn:hover,.new-tab-btn:active{background:var(--bg-hover);border-color:var(--accent);color:var(--accent)}.new-tab-btn svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}.tabs-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0a0c12f0;z-index:42;display:flex;flex-direction:column;justify-content:flex-end}.tabs-grid{overflow-y:auto;padding:20px 14px 12px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;max-width:680px;width:100%;margin:0 auto}.tab-card-wrap{display:flex;flex-direction:column;align-items:center;gap:6px}.tab-card{width:100%;height:190px;background:var(--bg-alt);border:1.5px solid var(--border);border-radius:16px;padding:12px;position:relative;cursor:pointer;overflow:hidden;text-align:left;color:var(--text);font-family:inherit;display:flex;flex-direction:column;gap:6px}.tab-card.active{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}.tab-card-close{position:absolute;top:8px;right:8px;width:24px;height:24px;border-radius:999px;border:0;background:var(--bg-hover);color:var(--text);font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center}.tab-card-title{font-size:13px;font-weight:700;color:var(--accent);padding-right:26px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tab-card-preview{font-size:11px;line-height:1.45;color:var(--muted);overflow:hidden;white-space:pre-wrap}.tab-card-label{font-size:12px;font-weight:600;color:var(--text);max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabs-footer{display:flex;align-items:center;justify-content:space-between;padding:12px 18px calc(14px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--border);background:var(--bg-alt)}.tabs-footer-btn{background:none;border:0;color:var(--text);font-size:15px;font-weight:600;cursor:pointer;padding:4px 8px;font-family:inherit}.tabs-count-badge{width:21px;height:21px;border:1.7px solid currentColor;border-radius:5px;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center}@media(max-width:960px){.app{grid-template-columns:230px 1fr}.outline-menu-trigger{display:flex}.backdrop.open{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:20}.workspace-body:not(.outline-bottom) .rightbar{position:fixed;inset:0 0 0 auto;width:min(84vw,300px);z-index:30;transform:translate(100%);transition:transform .18s ease}.workspace-body:not(.outline-bottom) .rightbar.mobile-open{transform:translate(0)}}@media(max-width:768px){.app{grid-template-columns:1fr}.workspace-body.outline-bottom .rightbar-body{grid-template-columns:1fr;gap:10px;padding:10px 14px calc(74px + env(safe-area-inset-bottom,0px))}.menu-btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0}.menu-btn svg{width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.icon-btn{width:34px;height:34px}.desktop-tabs,.fab-wrap{display:none}.sheet-backdrop,.bottom-sheet{display:block}.sidebar{position:fixed;inset:0 auto 0 0;width:min(84vw,310px);z-index:30;transform:translate(-100%);transition:transform .18s ease}.sidebar.open{transform:translate(0)}.backdrop.open{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:20}.brand{height:48px;padding:0 12px 0 14px}.brand-title{font-size:15px;gap:8px}.sidebar-tabs{margin:10px 12px 0;padding:3px;gap:2px}.sidebar-tab{font-size:13px;padding:6px 8px;border-radius:6px}.search-wrap{padding:8px 12px 10px}.search{font-size:16px;padding:8px 11px;border-radius:7px}.tree{padding:8px 10px;font-size:14px}.tree-dir-btn,.tree-file{padding:8px 9px;font-size:14px;border-radius:6px}.tree-row-more{min-width:32px;min-height:32px;padding:4px 6px;font-size:15px;display:inline-flex;align-items:center;justify-content:center}.changes-bar{padding:6px 8px 8px}.changes-select{font-size:13.5px;padding:6px 9px}.topbar{height:48px;padding:0 12px}.rightbar-head{height:44px;padding:0 12px}.crumbs{font-size:13px}.btn{padding:8px 13px;font-size:13.5px;border-radius:8px}.more-menu,.file-ctx-menu{min-width:200px;padding:5px;border-radius:12px}.more-item{padding:10px 12px;font-size:14px;border-radius:8px}.new-tab-view{gap:12px}.new-tab-btn{width:min(84vw,270px);padding:14px 20px;font-size:15.5px}.new-tab-btn svg{width:19px;height:19px}.switcher-tab{font-size:13.5px;padding:7px 12px}.switcher-item{padding:12px 14px}.switcher-path{font-size:15px}.switcher-snippet{font-size:13px}.switcher-input{font-size:16px;padding:11px 16px}.switcher-clear{width:34px;height:34px;font-size:17px}.field label{font-size:13px}.field input[type=text],.field select{font-size:16px;padding:11px 12px;border-radius:9px}.folder-picker{max-height:200px;padding:6px}.folder-pick-item{padding:10px 12px;font-size:14px;border-radius:7px}.toggle-row{padding:12px 14px;font-size:14px}.commit-file-row{padding:8px 10px;font-size:14px}.content-scroll{padding:18px 16px calc(86px + env(safe-area-inset-bottom,0px))}.mobile-bar{position:fixed;left:50%;transform:translate(-50%);bottom:calc(14px + env(safe-area-inset-bottom,0px));z-index:25;display:flex;align-items:center;gap:6px;background:var(--glass);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border:1px solid var(--border);border-radius:999px;padding:7px 12px;box-shadow:0 10px 30px #00000073}.mobile-bar-btn{background:none;border:0;color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;width:42px;height:40px;border-radius:999px}.mobile-bar-btn svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.mobile-bar-btn.active,.mobile-bar-btn:active{color:var(--accent);background:var(--accent-soft)}.tabs-count-badge{width:23px;height:23px;font-size:12px}.sheet-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:35}.bottom-sheet{position:fixed;left:0;right:0;bottom:0;z-index:36;background:var(--bg-alt);border-top:1px solid var(--border);border-radius:18px 18px 0 0;padding:10px 14px calc(18px + env(safe-area-inset-bottom,0px));box-shadow:0 -12px 36px #00000080}.sheet-handle{width:38px;height:4px;border-radius:999px;background:var(--border);margin:0 auto 12px}.sheet-list{background:var(--bg);border:1px solid var(--border);border-radius:12px;overflow:hidden}.sheet-item{width:100%;background:none;border:0;border-bottom:1px solid var(--border);color:var(--text);padding:14px 16px;font-size:15px;font-family:inherit;display:flex;align-items:center;gap:12px;cursor:pointer;text-align:left}.sheet-item:last-child{border-bottom:0}.sheet-item:active,.sheet-item:hover{background:var(--bg-hover);color:var(--accent)}.sheet-item svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;color:var(--muted)}}.media-viewer{display:flex;flex-direction:column;height:100%;min-height:480px}.media-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid var(--border);background:var(--bg-alt);font-size:13px;color:var(--muted)}.pdf-frame,.html-frame{flex:1;width:100%;height:100%;min-height:600px;border:0;background:#fff}.video-player{width:100%;max-width:960px;max-height:calc(100vh - 180px);margin:24px auto;border-radius:10px;background:#000}.csv-scroll{overflow-x:auto}.folder-picker-wrap{display:flex;flex-direction:column;gap:8px}.folder-picker-toggle{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-family:var(--font-mono);font-size:13px;cursor:pointer;text-align:left}.folder-picker-toggle:hover{border-color:var(--accent)}.folder-picker-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.folder-picker-caret{color:var(--muted);flex-shrink:0}.folder-picker-panel{display:flex;flex-direction:column;gap:8px}.pinned-section{margin-bottom:10px;padding:6px;border:1px solid var(--border);border-radius:10px;background:var(--bg-elev)}.pinned-toggle{width:100%;display:flex;align-items:center;gap:6px;padding:4px 6px;border:none;border-radius:6px;background:transparent;color:var(--muted);font-size:11px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;cursor:pointer;text-align:left}.pinned-toggle:hover{background:var(--bg-hover);color:var(--text)}.pinned-icon{color:var(--accent);flex-shrink:0}.pinned-count{margin-left:auto;padding:1px 6px;border-radius:999px;border:1px solid var(--border);background:var(--bg);font-size:10px;font-weight:600;color:var(--muted)}.pinned-list{margin-top:4px}.tree-section-divider{display:flex;align-items:center;gap:8px;margin:12px 4px 6px;font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}.tree-section-divider:before,.tree-section-divider:after{content:"";flex:1;height:1px;background:var(--border)}
@@ -0,0 +1,185 @@
1
+ import{a as u,j as e,R as On,c as Vn}from"./vendor-react-E4kvVwMA.js";import{m as Qt}from"./vendor-markdown-C94ubdL7.js";import{H as Oe,d as Xn}from"./vendor-hljs-B8we2J8a.js";import{u as Gn,E as Kn,s as Jn,M as Yn}from"./vendor-tiptap-ChgD7Piv.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const p of c.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function o(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(a){if(a.ep)return;a.ep=!0;const c=o(a);fetch(a.href,c)}})();const he={theme:"dark",fontSize:15,lineHeight:1.65,maxWidth:780,outlinePosition:"right",startupMode:"newtab",startupPath:"README.md",autoCollapsed:["apps"],hiddenFolders:[]};function Qn(){try{const s=localStorage.getItem("vault-settings");if(!s)return he;const t=JSON.parse(s);return{...he,...t,theme:t.theme==="light"?"light":"dark",fontSize:Number(t.fontSize)>=12&&Number(t.fontSize)<=22?Number(t.fontSize):15,lineHeight:Number(t.lineHeight)>=1.3&&Number(t.lineHeight)<=2.1?Number(t.lineHeight):1.65,maxWidth:Number(t.maxWidth)>=560&&Number(t.maxWidth)<=1040?Number(t.maxWidth):780,outlinePosition:["right","bottom","hidden"].includes(t.outlinePosition)?t.outlinePosition:"right",autoCollapsed:Array.isArray(t.autoCollapsed)?t.autoCollapsed:["apps"],hiddenFolders:Array.isArray(t.hiddenFolders)?t.hiddenFolders:[]}}catch{return he}}function Zn(s){const t=decodeURIComponent(location.hash.slice(1)||"");return t||(s.startupMode==="readme"?"README.md":s.startupMode==="last"?localStorage.getItem("vault-last-path")||null:s.startupMode==="custom"&&s.startupPath.trim()||null)}function ge(s){return s?s.split("/").pop().replace(/\.md$/i,""):"New tab"}function Ze(s){return/\.(md|markdown|mdx)$/i.test(s)}function Pe(s){return/\.(png|jpe?g|gif|webp|svg|ico)$/i.test(s)}function Zt(s){return/\.svg$/i.test(s)}function et(s){return/\.pdf$/i.test(s)}function tt(s){return/\.(mp3|wav|m4a|ogg)$/i.test(s)}function st(s){return/\.(mp4|webm|mov)$/i.test(s)}function ea(s){return/\.html?$/i.test(s)}function ta(s){return/\.(csv|tsv)$/i.test(s)}function nt(s){return/\.(epub|zip|tar|gz|tgz|7z|rar|docx?|xlsx?|pptx?|odt|ods|odp|mkv|avi|dmg|exe|bin|whl|sqlite|db)$/i.test(s)}function cs(s,t){const o=t.split("#")[0],i=s.includes("/")?s.split("/").slice(0,-1).join("/"):"",a=(i?`${i}/`:"")+o,c=[];for(const p of a.split("/"))p==="."||p===""||(p===".."?c.pop():c.push(p));return c.join("/")}function sa(s,t){const o=s.split("|")[0].split("#")[0].trim().replace(/\.md$/i,"").replace(/^\/+/,"").toLowerCase();if(!o)return null;const i=t.filter(p=>p.endsWith(".md")),a=i.find(p=>p.slice(0,-3).toLowerCase()===o);if(a)return a;const c=o.split("/").pop();return i.find(p=>p.slice(0,-3).split("/").pop().toLowerCase()===c)||null}function it(s,t){const o=(s||"").trim().replace(/^\/+|\/+$/g,"");if(!o)return"";const i=/\.[a-z0-9]+$/i.test(o)?o:`${o}.md`,a=(t||"").trim().replace(/^\/+|\/+$/g,"");return a?`${a}/${i}`:i}Oe.registerLanguage("dockerfile",Xn);const es={js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",py:"python",pyw:"python",sh:"bash",bash:"bash",zsh:"bash",json:"json",jsonc:"json",yml:"yaml",yaml:"yaml",css:"css",scss:"scss",less:"less",html:"xml",htm:"xml",xml:"xml",svg:"xml",md:"markdown",markdown:"markdown",sql:"sql",rs:"rust",go:"go",java:"java",kt:"kotlin",c:"c",h:"c",cpp:"cpp",hpp:"cpp",cc:"cpp",toml:"ini",ini:"ini",conf:"ini",env:"ini",diff:"diff",patch:"diff",rb:"ruby",php:"php",swift:"swift",makefile:"makefile",dockerfile:"dockerfile"};function ds(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hs(s,t){const o=String(s??"");try{const i=(t||"").trim().toLowerCase();if(i&&Oe.getLanguage(i))return Oe.highlight(o,{language:i,ignoreIllegals:!0}).value;if(o.length<=15e4)return Oe.highlightAuto(o).value}catch{}return ds(o)}function na(s,t,o){const i=[],c=s.split(/(```[\s\S]*?```)/g).map((r,d)=>d%2===1?r:r.replace(/\[\[([^\]]+)\]\]/g,(k,j)=>{const[f,E]=j.split("|"),$=(E||f).trim(),C=sa(j,o);return C?`<a class="wikilink" data-path="${C.replace(/"/g,"&quot;")}">${$}</a>`:`<span class="wikilink broken" title="Note not created yet">${$}</span>`})).join(""),p=new Qt.Renderer;return p.heading=({tokens:r,depth:d})=>{const k=p.parser.parseInline(r),j=k.replace(/<[^>]+>/g,""),f=j.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return i.push({level:d,text:j,id:f}),`<h${d} id="${f}">${k}</h${d}>`},p.image=({href:r,title:d,text:k})=>`<img src="${/^https?:\/\//.test(r)?r:`/api/v1/file?path=${encodeURIComponent(cs(t,r))}`}" alt="${k||""}"${d?` title="${d}"`:""} />`,p.link=({href:r,title:d,tokens:k})=>{const j=p.parser.parseInline(k);return/^https?:\/\//.test(r)?`<a href="${r}" target="_blank" rel="noreferrer"${d?` title="${d}"`:""}>${j}</a>`:`<a class="md-rel-link" data-href="${r.replace(/"/g,"&quot;")}">${j}</a>`},p.code=({text:r,lang:d})=>{const k=hs(r,d);return`<pre><code class="${d?`hljs language-${ds(d.trim())}`:"hljs"}">${k}</code></pre>`},{renderedHtml:Qt.parse(c,{renderer:p,gfm:!0,breaks:!1}),headings:i}}function aa(s,t){if(!s)return"";const o=t.split("/").pop().toLowerCase(),i=o.includes(".")?o.split(".").pop():o,a=es[i]||es[o]||"";return hs(s,a)}const ia=120,oa=.28,ts=6,Be=.25,Ue=.28,qe=18;function la(s){let t=s;for(;t&&t!==document.body;){const o=t.tagName;if(o==="PRE"||o==="TABLE"||o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||t.isContentEditable)return!0;if(t.scrollWidth>t.clientWidth+2){const i=getComputedStyle(t).overflowX;if(i==="auto"||i==="scroll")return!0}t=t.parentElement}return!1}function ss(s,t){if(s)for(const o of t)s.style[o]=""}function ra({drawerOpen:s,outlineDrawerOpen:t,outlinePosition:o="right",setDrawerOpen:i,onOpenOutline:a,setOutlineDrawerOpen:c,disabled:p=!1}){const b=u.useRef({drawerOpen:s,outlineDrawerOpen:t,outlinePosition:o,setDrawerOpen:i,onOpenOutline:a,setOutlineDrawerOpen:c,disabled:p});b.current={drawerOpen:s,outlineDrawerOpen:t,outlinePosition:o,setDrawerOpen:i,onOpenOutline:a,setOutlineDrawerOpen:c,disabled:p},u.useEffect(()=>{let r=null;const d=C=>{C&&(ss(C.panelEl,["transform","transition"]),ss(C.backdropEl,["display","position","inset","zIndex","background","opacity","transition"]))},k=C=>{const g=b.current;if(g.disabled||C.touches.length!==1)return;const l=C.touches[0],v=l.clientX,N=l.clientY,x=document.documentElement.clientWidth||window.innerWidth,z=Math.min(ia,Math.round(x*oa));let y=null,A=null;if(g.drawerOpen&&x<=768?(y="left",A="close"):g.outlineDrawerOpen&&x<=960&&g.outlinePosition!=="bottom"?(y="right",A="close"):!g.drawerOpen&&!g.outlineDrawerOpen&&!la(C.target)&&(v<=z&&x<=768?(y="left",A="open"):v>=x-z&&x<=960&&g.outlinePosition!=="bottom"&&(y="right",A="open")),!y)return;const M=document.querySelector(y==="left"?".sidebar":".rightbar"),U=document.querySelector(".backdrop"),Y=(M==null?void 0:M.offsetWidth)||(y==="left"?310:300);r={side:y,action:A,startX:v,startY:N,lastX:v,startTime:performance.now(),lastTime:performance.now(),locked:null,panelEl:M,backdropEl:U,width:Y}},j=C=>{if(!r||C.touches.length!==1)return;const g=C.touches[0],l=g.clientX-r.startX,v=g.clientY-r.startY;if(r.lastX=g.clientX,r.lastTime=performance.now(),!r.locked){if(Math.abs(v)>=ts&&Math.abs(v)>=Math.abs(l)){r.locked="vertical",r=null;return}if(Math.abs(l)>=ts&&Math.abs(l)>Math.abs(v)){if(!(r.side==="left"&&r.action==="open"&&l>0||r.side==="left"&&r.action==="close"&&l<0||r.side==="right"&&r.action==="open"&&l<0||r.side==="right"&&r.action==="close"&&l>0)){r=null;return}r.locked="horizontal",r.panelEl&&(r.panelEl.style.transition="none"),r.backdropEl&&(r.backdropEl.style.display="block",r.backdropEl.style.position="fixed",r.backdropEl.style.inset="0",r.backdropEl.style.zIndex="20",r.backdropEl.style.background="rgba(0, 0, 0, 0.5)",r.backdropEl.style.transition="none")}else return}r.locked==="horizontal"&&C.cancelable&&C.preventDefault();const N=r.width;let x;if(r.side==="left"?x=r.action==="open"?l/N:1+l/N:x=r.action==="open"?-l/N:1-l/N,x=Math.max(0,Math.min(1,x)),r.panelEl){const z=r.side==="left"?(x-1)*100:(1-x)*100;r.panelEl.style.transform=`translateX(${z}%)`}r.backdropEl&&(r.backdropEl.style.opacity=String(x))},f=C=>{if(!r)return;const g=r;if(r=null,g.locked!=="horizontal"){d(g);return}const l=g.lastX-g.startX,v=Math.max(1,g.lastTime-g.startTime),N=l/v;let x=!1;if(C||(g.side==="left"&&g.action==="open"?x=l>=g.width*Be||l>=qe&&N>=Ue:g.side==="left"&&g.action==="close"||g.side==="right"&&g.action==="open"?x=-l>=g.width*Be||-l>=qe&&-N>=Ue:g.side==="right"&&g.action==="close"&&(x=l>=g.width*Be||l>=qe&&N>=Ue)),d(g),!x)return;const z=b.current;g.side==="left"?g.action==="open"?(z.setOutlineDrawerOpen(!1),z.setDrawerOpen(!0)):z.setDrawerOpen(!1):g.action==="open"?z.onOpenOutline():z.setOutlineDrawerOpen(!1)},E=()=>f(!1),$=()=>f(!0);return window.addEventListener("touchstart",k,{passive:!0}),window.addEventListener("touchmove",j,{passive:!1}),window.addEventListener("touchend",E,{passive:!0}),window.addEventListener("touchcancel",$,{passive:!0}),()=>{window.removeEventListener("touchstart",k),window.removeEventListener("touchmove",j),window.removeEventListener("touchend",E),window.removeEventListener("touchcancel",$)}},[])}/**
2
+ * @license lucide-react v1.73.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ca=s=>s==null?void 0:s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
7
+ * @license lucide-react v1.73.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */function da(s,t,o=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:ca(s),size:24,node:t,...o.length>0?{aliases:o}:{}}}/**
12
+ * @license lucide-react v1.73.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const ha=s=>{let t="",o=!1;for(const i of s){if(i==="-"||i==="_"||i<=" "){o=t.length>0;continue}t.length===0?t+=i.toLowerCase():t+=o?i.toUpperCase():i,o=!1}return t};/**
17
+ * @license lucide-react v1.73.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const ua=s=>{const t=ha(s);return t.charAt(0).toUpperCase()+t.slice(1)};/**
22
+ * @license lucide-react v1.73.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const ot=(...s)=>s.filter((t,o,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===o).join(" ").trim();/**
27
+ * @license lucide-react v1.73.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const de={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
32
+ * @license lucide-react v1.73.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */function at(s){return s!=null}function pa(s,t={}){var f,E;const o=t.attributeNames??{},i=$=>o[$]??$,a=s.size??s.width??de.width,c=s.size??s.height??de.height,p=((f=s.aliases)==null?void 0:f.filter($=>typeof $=="string"&&$.trim()!=="").map($=>`lucide-${$}`))??[],b=[...s.name?[`lucide-${s.name}`]:[],...p],r=((E=t.className)==null?void 0:E.split(" ").filter(Boolean))??[],d=t.includeDefaultClasses===!1?ot(...r):ot("lucide",...b,...r),k=t.absoluteStrokeWidth?Number(t.strokeWidth??de["stroke-width"])*Number(s.size??s.width??de.width)/Number(t.size??t.width??de.width):t.strokeWidth??de["stroke-width"];return["svg",{...Object.entries(de).reduce(($,[C,g])=>($[i(C)]=g,$),{}),..."color"in t&&t.color&&{[i("stroke")]:t.color},..."size"in t&&at(t.size)&&{[i("width")]:t.size,[i("height")]:t.size},..."width"in t&&at(t.width)&&{[i("width")]:t.width},..."height"in t&&at(t.height)&&{[i("height")]:t.height},[i("stroke-width")]:k,...d&&{[i("class")]:d},[i("viewBox")]:`0 0 ${a} ${c}`,...t.hasA11yProp===!1?{[i("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},s.node.map($=>{const[C,g,l]=$,v=t.nonScalingStroke?{[i("vector-effect")]:"non-scaling-stroke",...g}:g;return l?[C,v,l]:[C,v]})]}/**
37
+ * @license lucide-react v1.73.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */function ma(s,t={}){return pa(s,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}/**
42
+ * @license lucide-react v1.73.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const fa=s=>{for(const t in s)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},xa=u.createContext({}),ja=()=>u.useContext(xa),va=u.forwardRef(({color:s,size:t,width:o,height:i,strokeWidth:a,absoluteStrokeWidth:c,nonScalingStroke:p,className:b="",children:r,iconNode:d=[],icon:k={node:d,aliases:[],size:24},...j},f)=>{const{size:E=24,strokeWidth:$=2,absoluteStrokeWidth:C=!1,nonScalingStroke:g=!1,color:l="currentColor",className:v=""}=ja()??{},N=!!r||fa(j),[x,z,y=[]]=ma(k,{color:s??l,width:o??t??E,height:i??t??E,strokeWidth:a??$,absoluteStrokeWidth:c??C,nonScalingStroke:p??g,className:ot(v,b),hasA11yProp:N,attributes:j});return u.createElement(x,{ref:f,...z},[...y.map(([A,M])=>u.createElement(A,M)),...Array.isArray(r)?r:[r]])});/**
47
+ * @license lucide-react v1.73.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */function R(s,t=[],o=[]){const i=typeof s=="string"?da(s,t,o):s,a=u.forwardRef(({className:c,...p},b)=>u.createElement(va,{ref:b,icon:i,className:c,...p}));return i.name&&(a.displayName=ua(i.name)),a}/**
52
+ * @license lucide-react v1.73.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const us={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};us.node;const ka=R(us);/**
57
+ * @license lucide-react v1.73.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const ps={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};ps.node;const ga=R(ps);/**
62
+ * @license lucide-react v1.73.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const ms={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};ms.node;const ba=R(ms);/**
67
+ * @license lucide-react v1.73.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const fs={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};fs.node;const wa=R(fs);/**
72
+ * @license lucide-react v1.73.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const xs={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};xs.node;const ns=R(xs);/**
77
+ * @license lucide-react v1.73.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const js={name:"ellipsis-vertical",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],aliases:["more-vertical"]};js.node;const vs=R(js);/**
82
+ * @license lucide-react v1.73.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const ks={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};ks.node;const Na=R(ks);/**
87
+ * @license lucide-react v1.73.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const gs={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]};gs.node;const as=R(gs);/**
92
+ * @license lucide-react v1.73.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const bs={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};bs.node;const ya=R(bs);/**
97
+ * @license lucide-react v1.73.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const ws={name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]};ws.node;const Ns=R(ws);/**
102
+ * @license lucide-react v1.73.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const ys={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};ys.node;const Cs=R(ys);/**
107
+ * @license lucide-react v1.73.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const Ss={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};Ss.node;const Ca=R(Ss);/**
112
+ * @license lucide-react v1.73.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const $s={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]};$s.node;const Sa=R($s);/**
117
+ * @license lucide-react v1.73.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const Es={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};Es.node;const zs=R(Es);/**
122
+ * @license lucide-react v1.73.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const Ds={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};Ds.node;const lt=R(Ds);/**
127
+ * @license lucide-react v1.73.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const Ls={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};Ls.node;const Ts=R(Ls);/**
132
+ * @license lucide-react v1.73.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const Ws={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};Ws.node;const rt=R(Ws);/**
137
+ * @license lucide-react v1.73.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const Rs={name:"pin-off",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]};Rs.node;const is=R(Rs);/**
142
+ * @license lucide-react v1.73.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const Ms={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};Ms.node;const ct=R(Ms);/**
147
+ * @license lucide-react v1.73.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const As={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};As.node;const ut=R(As);/**
152
+ * @license lucide-react v1.73.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const _s={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]};_s.node;const $a=R(_s);/**
157
+ * @license lucide-react v1.73.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const Is={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};Is.node;const dt=R(Is);/**
162
+ * @license lucide-react v1.73.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const Hs={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};Hs.node;const Fs=R(Hs);/**
167
+ * @license lucide-react v1.73.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const Ps={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};Ps.node;const Bs=R(Ps);/**
172
+ * @license lucide-react v1.73.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const Us={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};Us.node;const Ea=R(Us);/**
177
+ * @license lucide-react v1.73.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const qs={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};qs.node;const za=R(qs);function Os(s,t){var o;for(const i of s||[]){if(i.path===t)return i;if(i.type==="dir"&&((o=i.children)!=null&&o.length)){const a=Os(i.children,t);if(a)return a}}return null}const Da=450,os=8;function ls(s){const t=u.useRef(null),o=u.useRef(null),i=u.useRef(!1),a=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return{onTouchStart:c=>{if(c.touches.length!==1)return;const p=c.touches[0],b=c.currentTarget.closest(".tree-file-row")||c.currentTarget;o.current={x:p.clientX,y:p.clientY},i.current=!1,a(),t.current=setTimeout(()=>{var r;t.current=null,i.current=!0,(r=navigator.vibrate)==null||r.call(navigator,10),s(b.getBoundingClientRect())},Da)},onTouchMove:c=>{if(!t.current||!o.current||c.touches.length!==1)return;const p=c.touches[0];(Math.abs(p.clientX-o.current.x)>os||Math.abs(p.clientY-o.current.y)>os)&&a()},onTouchEnd:()=>a(),onTouchCancel:()=>a(),onContextMenu:c=>{c.preventDefault();const p=c.currentTarget.closest(".tree-file-row")||c.currentTarget;s(p.getBoundingClientRect())},consumeClick:c=>i.current?(i.current=!1,c.preventDefault(),c.stopPropagation(),!0):!1}}function ht({node:s,activePath:t,filter:o,collapsed:i,hiddenSet:a,onToggleDir:c,onSelectFile:p,onOpenMenu:b}){const r=ls(k=>b(s.path,k,"dir")),d=ls(k=>b(s.path,k,"file"));if(s.type==="dir"){if(a.has(s.path.toLowerCase())||a.has(s.name.toLowerCase()))return null;const k=f=>f.type==="file"?f.path.toLowerCase().includes(o):f.children.some(k);if(o&&!k(s))return null;const j=!o&&i.has(s.path);return e.jsxs("div",{children:[e.jsxs("div",{className:"tree-file-row",children:[e.jsxs("button",{className:"tree-dir-btn",title:s.path,onTouchStart:r.onTouchStart,onTouchMove:r.onTouchMove,onTouchEnd:r.onTouchEnd,onTouchCancel:r.onTouchCancel,onContextMenu:r.onContextMenu,onClick:f=>{r.consumeClick(f)||c(s.path)},children:[j?"▸ ":"▾ ",s.name]}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for folder ${s.name}`,onClick:f=>{f.stopPropagation(),b(s.path,f.currentTarget.getBoundingClientRect(),"dir")},children:"⋯"})]}),!j&&e.jsx("div",{className:"tree-children",children:s.children.map(f=>e.jsx(ht,{node:f,activePath:t,filter:o,collapsed:i,hiddenSet:a,onToggleDir:c,onSelectFile:p,onOpenMenu:b},f.path))})]})}return o&&!s.path.toLowerCase().includes(o)?null:e.jsxs("div",{className:`tree-file-row${s.path===t?" active":""}`,children:[e.jsx("button",{className:`tree-file${s.path===t?" active":""}`,title:s.path,onTouchStart:d.onTouchStart,onTouchMove:d.onTouchMove,onTouchEnd:d.onTouchEnd,onTouchCancel:d.onTouchCancel,onContextMenu:d.onContextMenu,onClick:k=>{d.consumeClick(k)||p(s.path)},children:s.name}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for ${s.name}`,onClick:k=>{k.stopPropagation(),b(s.path,k.currentTarget.getBoundingClientRect())},children:"⋯"})]})}function La({drawerOpen:s,live:t,settings:o,setSettings:i,sidebarTab:a,setSidebarTab:c,gitChanges:p,searchRef:b,filter:r,setFilter:d,tree:k,pinned:j=[],activePath:f,collapsed:E,hiddenSet:$,toggleDir:C,setViewMode:g,openFile:l,openRowMenu:v,changesSort:N,setChangesSort:x,openCommitDialog:z,sortedChanges:y,loadDiff:A}){const[M,U]=u.useState(!0),[Y,be]=u.useState(()=>new Set),ue=D=>{be(q=>{const K=new Set(q);return K.has(D)?K.delete(D):K.add(D),K})},G=j.map(D=>Os(k,D.path)).filter(Boolean);return e.jsxs("aside",{className:`sidebar${s?" open":""}`,children:[e.jsxs("div",{className:"brand",children:[e.jsxs("div",{className:"brand-title",children:[e.jsx("img",{src:"/vault-logo.svg",alt:"",width:"20",height:"20",className:"brand-logo"}),e.jsx("span",{children:"Vault"}),e.jsx("span",{className:`pill${t?"":" off"}`,children:t?"Live":"Reconnecting"})]}),e.jsx("button",{className:"icon-btn","aria-label":o.theme==="dark"?"Switch to light theme":"Switch to dark theme",title:o.theme==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>i(D=>({...D,theme:D.theme==="dark"?"light":"dark"})),children:o.theme==="dark"?e.jsx(Bs,{size:15,strokeWidth:1.9}):e.jsx(zs,{size:15,strokeWidth:1.9})})]}),e.jsxs("div",{className:"sidebar-tabs",children:[e.jsx("button",{className:`sidebar-tab${a==="files"?" active":""}`,onClick:()=>c("files"),children:"Files"}),e.jsxs("button",{className:`sidebar-tab${a==="changes"?" active":""}`,onClick:()=>c("changes"),children:[e.jsx("span",{children:"Changes"}),p.length>0&&e.jsx("span",{className:"pill",children:p.length})]})]}),e.jsx("div",{className:"search-wrap",children:e.jsx("input",{ref:b,className:"search",type:"search",placeholder:a==="files"?"Filter files... (/)":"Filter changes...",value:r,onChange:D=>d(D.target.value.trim().toLowerCase())})}),e.jsx("div",{className:"tree",children:a==="files"?e.jsxs(e.Fragment,{children:[G.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pinned-section",children:[e.jsxs("button",{type:"button",className:"pinned-toggle","aria-expanded":M,onClick:()=>U(D=>!D),children:[e.jsx("span",{className:"chev",children:M?"▾":"▸"}),e.jsx(ct,{size:12,strokeWidth:2,className:"pinned-icon","aria-hidden":"true"}),e.jsx("span",{children:"Pinned"}),e.jsx("span",{className:"pinned-count",children:G.length})]}),M&&e.jsx("div",{className:"pinned-list",children:G.map(D=>e.jsx(ht,{node:D,activePath:f,filter:r,collapsed:Y,hiddenSet:$,onToggleDir:ue,onSelectFile:q=>{g("preview"),l(q)},onOpenMenu:v},`pinned:${D.path}`))})]}),e.jsx("div",{className:"tree-section-divider",children:e.jsx("span",{children:"All files"})})]}),k.map(D=>e.jsx(ht,{node:D,activePath:f,filter:r,collapsed:E,hiddenSet:$,onToggleDir:C,onSelectFile:q=>{g("preview"),l(q)},onOpenMenu:v},D.path))]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"changes-bar",children:[e.jsxs("select",{className:"changes-select","aria-label":"Sort changes",value:N,onChange:D=>x(D.target.value),children:[e.jsx("option",{value:"path",children:"Sort: Path"}),e.jsx("option",{value:"recent",children:"Sort: Recent"}),e.jsx("option",{value:"status",children:"Sort: Status"})]}),p.length>0&&e.jsx("button",{className:"btn primary",onClick:z,children:"Commit"})]}),y.length===0?e.jsx("div",{className:"empty-note",style:{padding:"10px 8px"},children:"Working tree clean"}):y.map(D=>e.jsxs("div",{className:`tree-file-row${D.path===f?" active":""}`,children:[e.jsxs("button",{className:`tree-file${D.path===f?" active":""}`,title:D.path,onClick:()=>{D.status!=="D"&&(g("diff"),l(D.path),A(D.path))},children:[e.jsx("span",{className:`git-badge git-${D.status}`,children:D.status}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:D.path})]}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for ${D.path}`,onClick:q=>{q.stopPropagation(),v(D.path,q.currentTarget.getBoundingClientRect())},children:"⋯"})]},D.path))]})})]})}function Ta({tabs:s,activeTabId:t,switchTab:o,closeTab:i,createNewTab:a}){return e.jsxs("div",{className:"desktop-tabs",children:[s.map(c=>e.jsxs("div",{className:`desktop-tab${c.id===t?" active":""}`,onClick:()=>o(c),children:[e.jsx("span",{className:"desktop-tab-title",children:c.title}),e.jsx("button",{className:"desktop-tab-close",onClick:p=>i(c.id,p),children:"×"})]},c.id)),e.jsx("button",{className:"desktop-tab-add",title:"New tab",onClick:a,children:"+"})]})}function Wa({setDrawerOpen:s,activePath:t,moreMenuOpen:o,setMoreMenuOpen:i,viewMode:a,setViewMode:c,loadDiff:p,setDeleteError:b,setDeleteTarget:r,outlinePosition:d,outlineDrawerOpen:k,onToggleOutline:j,onOpenOutline:f}){const E=k||d!=="hidden";return e.jsxs("div",{className:"topbar",children:[e.jsxs("div",{className:"topbar-left",children:[e.jsx("button",{className:"icon-btn menu-btn","aria-label":"Toggle files",onClick:()=>s($=>!$),children:e.jsx(lt,{size:17,strokeWidth:1.8})}),e.jsx("div",{className:"crumbs",children:t||"New tab"})]}),e.jsxs("div",{className:"actions",children:[e.jsx("button",{className:`icon-btn outline-toggle-btn${E?" active":""}`,"aria-label":"Toggle outline",title:"Toggle outline & backlinks",onClick:j,children:e.jsx(Ts,{size:17,strokeWidth:1.8})}),e.jsx("button",{className:"icon-btn","aria-label":"Note options",title:"Note options",onClick:()=>i($=>!$),children:e.jsx(vs,{size:16,strokeWidth:1.9})}),o&&e.jsxs("div",{className:"more-menu",onMouseLeave:()=>i(!1),children:[t&&e.jsx("a",{className:"more-item",href:`/api/v1/file?path=${encodeURIComponent(t)}&download=1`,download:t.split("/").pop(),style:{textDecoration:"none",borderBottom:"1px solid var(--border)",marginBottom:3,paddingBottom:9},onClick:()=>i(!1),children:e.jsx("span",{children:"Download"})}),e.jsxs("button",{className:`more-item${a==="preview"?" active":""}`,onClick:()=>{c("preview"),i(!1)},children:[e.jsx("span",{children:"Preview"}),a==="preview"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${a==="edit"?" active":""}`,onClick:()=>{c("edit"),i(!1)},children:[e.jsx("span",{children:"Edit"}),a==="edit"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${a==="diff"?" active":""}`,onClick:()=>{c("diff"),i(!1),p(t)},children:[e.jsx("span",{children:"Diff"}),a==="diff"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${a==="raw"?" active":""}`,onClick:()=>{c("raw"),i(!1)},children:[e.jsx("span",{children:"Raw"}),a==="raw"&&e.jsx("span",{children:"✓"})]}),e.jsx("button",{className:`more-item outline-menu-trigger${d==="hidden"?" show-desktop":""}`,style:{borderTop:"1px solid var(--border)",marginTop:3,paddingTop:9},onClick:()=>{i(!1),f()},children:e.jsx("span",{children:"Outline"})}),t&&e.jsx("button",{className:"more-item",style:{color:"#f87171",borderTop:"1px solid var(--border)",marginTop:3,paddingTop:9},onClick:()=>{i(!1),b(""),r(t)},children:e.jsx("span",{children:"Delete"})})]})]})]})}function Ra(s,t=","){const o=[];let i=[],a="",c=!1;for(let p=0;p<s.length;p+=1){const b=s[p];if(c){b==='"'?s[p+1]==='"'?(a+='"',p+=1):c=!1:a+=b;continue}b==='"'?c=!0:b===t?(i.push(a),a=""):b==="\r"?(s[p+1]===`
182
+ `&&(p+=1),i.push(a),o.push(i),i=[],a=""):b===`
183
+ `?(i.push(a),o.push(i),i=[],a=""):a+=b}return(a.length>0||i.length>0)&&(i.push(a),o.push(i)),o}function Ma({content:s,fileKey:t,fontSize:o,lineHeight:i,maxWidth:a,saving:c,dirty:p,onChange:b,onSave:r}){const d=Gn({extensions:[Jn,Yn],content:s});return u.useEffect(()=>{var j,f;if(!d)return;(((f=(j=d.storage.markdown)==null?void 0:j.getMarkdown)==null?void 0:f.call(j))??"")!==s&&!p&&d.commands.setContent(s)},[t,s,d,p]),u.useEffect(()=>{if(!d)return;const k=()=>{var f,E;const j=((E=(f=d.storage.markdown)==null?void 0:f.getMarkdown)==null?void 0:E.call(f))??"";b(j)};return d.on("update",k),()=>d.off("update",k)},[d,b]),d?e.jsxs("div",{className:"tiptap-wrap",style:{maxWidth:`${a}px`},children:[e.jsxs("div",{className:"tiptap-toolbar",children:[e.jsx("button",{className:`btn${d.isActive("bold")?" active":""}`,onClick:()=>d.chain().focus().toggleBold().run(),children:"B"}),e.jsx("button",{className:`btn${d.isActive("italic")?" active":""}`,onClick:()=>d.chain().focus().toggleItalic().run(),children:"I"}),e.jsx("button",{className:`btn${d.isActive("heading",{level:1})?" active":""}`,onClick:()=>d.chain().focus().toggleHeading({level:1}).run(),children:"H1"}),e.jsx("button",{className:`btn${d.isActive("heading",{level:2})?" active":""}`,onClick:()=>d.chain().focus().toggleHeading({level:2}).run(),children:"H2"}),e.jsx("button",{className:`btn${d.isActive("bulletList")?" active":""}`,onClick:()=>d.chain().focus().toggleBulletList().run(),children:"List"}),e.jsx("button",{className:`btn${d.isActive("codeBlock")?" active":""}`,onClick:()=>d.chain().focus().toggleCodeBlock().run(),children:"Code"}),e.jsx("button",{className:`btn${p?" primary":""}`,style:{marginLeft:"auto"},disabled:c,onClick:()=>{var k,j;return r(((j=(k=d.storage.markdown)==null?void 0:k.getMarkdown)==null?void 0:j.call(k))??"")},children:c?"Saving...":p?"Save *":"Saved"})]}),e.jsx("div",{className:"doc tiptap-body",style:{fontSize:`${o}px`,lineHeight:i},children:e.jsx(Kn,{editor:d})})]}):null}function Aa({scrollRef:s,activePath:t,openNewNoteDialog:o,openFile:i,openSwitcher:a,setDrawerOpen:c,setSettingsOpen:p,isImg:b,isSvg:r,isMarkdown:d,isPdf:k,isAudio:j,isVideo:f,isHtml:E,isCsv:$,reloadTick:C,isBinaryDownload:g,viewMode:l,settings:v,diffData:N,requestDiscard:x,content:z,saving:y,dirty:A,setDraftContent:M,setDirty:U,saveActiveNote:Y,highlightedRawHtml:be,handleDocClick:ue,renderedHtml:G}){var oe,Se;const D=u.useMemo(()=>{if(!$||l!=="preview"||!z)return[];const P=t.toLowerCase().endsWith(".tsv")?" ":",";return Ra(z,P)},[$,l,z,t]),q=t?`/api/v1/file?path=${encodeURIComponent(t)}&t=${C}`:"",K=t?`/api/v1/file?path=${encodeURIComponent(t)}&download=1`:"",ie=t?`/raw/${t.split("/").map(encodeURIComponent).join("/")}?t=${C}`:"";return e.jsx("div",{ref:s,className:"content-scroll",children:t?b&&!(r&&l==="raw")?e.jsx("div",{className:"doc img-wrap",children:e.jsx("img",{src:q,alt:t})}):k?e.jsxs("div",{className:"media-viewer pdf-viewer",children:[e.jsxs("div",{className:"media-bar",children:[e.jsx("span",{children:t.split("/").pop()}),e.jsx("a",{className:"btn",href:K,download:t.split("/").pop(),children:"Download PDF"})]}),e.jsx("iframe",{className:"pdf-frame",src:q,title:t})]}):j?e.jsxs("div",{className:"doc binary-card audio-viewer",children:[e.jsx("div",{className:"binary-card-name",children:t.split("/").pop()}),e.jsx("div",{className:"binary-card-path",children:t}),e.jsx("audio",{controls:!0,src:q,style:{width:"100%",maxWidth:460}}),e.jsx("a",{className:"btn",href:K,download:t.split("/").pop(),style:{textDecoration:"none",display:"inline-flex",alignItems:"center",gap:6,marginTop:12},children:"Download audio"})]}):f?e.jsxs("div",{className:"media-viewer video-viewer",children:[e.jsxs("div",{className:"media-bar",children:[e.jsx("span",{children:t.split("/").pop()}),e.jsx("a",{className:"btn",href:K,download:t.split("/").pop(),children:"Download video"})]}),e.jsx("video",{controls:!0,src:q,className:"video-player"})]}):g?e.jsxs("div",{className:"doc binary-card",children:[e.jsx("div",{className:"binary-card-name",children:t.split("/").pop()}),e.jsx("div",{className:"binary-card-path",children:t}),e.jsx("a",{className:"btn primary",href:`/api/v1/file?path=${encodeURIComponent(t)}&download=1`,download:t.split("/").pop(),style:{textDecoration:"none",display:"inline-flex",alignItems:"center",gap:6},children:"Download file"})]}):l==="diff"?e.jsxs("div",{className:"diff-wrap",style:{maxWidth:`${v.maxWidth+80}px`},children:[e.jsxs("div",{className:"diff-head",children:[e.jsx("span",{style:{fontSize:13,color:"var(--muted)"},children:N!=null&&N.untracked?"Untracked file":`${((oe=N==null?void 0:N.hunks)==null?void 0:oe.length)||0} hunk(s)`}),((Se=N==null?void 0:N.hunks)==null?void 0:Se.length)>0&&e.jsx("button",{className:"btn",style:{color:"#f87171"},onClick:()=>x(),children:"Discard file"})]}),!N||N.hunks.length===0?e.jsx("div",{className:"empty-note",children:"No uncommitted changes for this file."}):N.hunks.map((P,ee)=>e.jsxs("div",{className:"diff-hunk",children:[e.jsxs("div",{className:"diff-hunk-bar",children:[e.jsx("span",{children:P.header}),!N.untracked&&e.jsx("button",{className:"btn",onClick:()=>x({hunkIndex:ee}),children:"Discard hunk"})]}),P.lines.map((X,F)=>e.jsxs("div",{className:`diff-line ${X.type}`,children:[e.jsx("span",{className:"diff-ln",children:X.newLine??X.oldLine??""}),e.jsx("span",{className:"diff-sig",children:X.type==="add"?"+":X.type==="del"?"-":" "}),e.jsx("span",{className:"diff-txt",children:X.text||" "}),!N.untracked&&X.type!=="context"?e.jsx("button",{className:"diff-discard-btn",title:"Discard line",onClick:()=>x({hunkIndex:ee,lineIndex:F,previewText:`${X.type==="add"?"+":"-"} ${X.text}`}),children:"↺"}):e.jsx("span",{})]},F))]},ee))]}):l==="edit"&&d?e.jsx(Ma,{fileKey:t,content:z,fontSize:v.fontSize,lineHeight:v.lineHeight,maxWidth:v.maxWidth,saving:y,dirty:A,onChange:P=>{M(P),U(P!==z)},onSave:Y}):E&&l==="preview"?e.jsx("div",{className:"media-viewer html-viewer",children:e.jsx("iframe",{className:"html-frame",src:ie,sandbox:"allow-scripts",title:t})}):$&&l==="preview"?e.jsx("div",{className:"doc csv-wrap",style:{fontSize:`${Math.max(12,v.fontSize-1)}px`,maxWidth:`${v.maxWidth+160}px`},children:D.length===0?e.jsx("div",{className:"empty-note",children:"Empty table."}):e.jsx("div",{className:"csv-scroll",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsx("tr",{children:D[0].map((P,ee)=>e.jsx("th",{children:P},ee))})}),e.jsx("tbody",{children:D.slice(1).map((P,ee)=>e.jsx("tr",{children:D[0].map((X,F)=>e.jsx("td",{children:P[F]??""},F))},ee))})]})})}):l==="raw"||!d?e.jsx("pre",{className:"raw-view",style:{fontSize:`${Math.max(12,v.fontSize-2)}px`,maxWidth:`${v.maxWidth+80}px`},children:e.jsx("code",{className:"hljs",dangerouslySetInnerHTML:{__html:be}})}):e.jsx("div",{className:"doc",style:{fontSize:`${v.fontSize}px`,lineHeight:v.lineHeight,maxWidth:`${v.maxWidth}px`},onClick:ue,dangerouslySetInnerHTML:{__html:G}}):e.jsxs("div",{className:"new-tab-view",children:[e.jsxs("button",{className:"new-tab-btn",onClick:()=>o(""),children:[e.jsx(ut,{size:16,strokeWidth:1.9}),e.jsx("span",{children:"Create new note"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>i("README.md"),children:[e.jsx(Cs,{size:16,strokeWidth:1.9}),e.jsx("span",{children:"Go to README"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:a,children:[e.jsx(dt,{size:16,strokeWidth:1.9}),e.jsx("span",{children:"Go to file"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>c(!0),children:[e.jsx(ya,{size:16,strokeWidth:1.9}),e.jsx("span",{children:"Browse files"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>p(!0),children:[e.jsx(Fs,{size:16,strokeWidth:1.9}),e.jsx("span",{children:"Settings"})]})]})})}function _a({headings:s,isImg:t,isBinaryDownload:o,viewMode:i,currentBacklinks:a,openFile:c,position:p="right",onChangePosition:b,mobileOpen:r=!1,onCloseMobile:d}){const[k,j]=u.useState(!1);if(p==="hidden"&&!r&&window.innerWidth>960)return null;const f=t?"Image preview":o?"Binary file":i==="raw"?"Raw view":i==="edit"?"Edit mode":i==="diff"?"Diff mode":"No headings";return e.jsxs("aside",{className:`rightbar${r?" mobile-open":""}`,children:[e.jsxs("div",{className:"rightbar-head",children:[e.jsx("div",{className:"panel-title",style:{margin:0},children:p==="bottom"?"Outline & Backlinks":"Outline"}),e.jsxs("div",{className:"actions",children:[e.jsx("button",{className:"icon-btn","aria-label":"Outline panel options",title:"Outline panel options",onClick:()=>j(E=>!E),children:e.jsx(vs,{size:16,strokeWidth:1.9})}),k&&e.jsxs("div",{className:"more-menu",onMouseLeave:()=>j(!1),children:[e.jsxs("button",{className:`more-item${p==="right"?" active":""}`,onClick:()=>{b("right"),j(!1)},children:[e.jsx("span",{children:"Position: Right"}),p==="right"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${p==="bottom"?" active":""}`,onClick:()=>{b("bottom"),d==null||d(),j(!1)},children:[e.jsx("span",{children:"Position: Bottom"}),p==="bottom"&&e.jsx("span",{children:"✓"})]}),e.jsx("button",{className:"more-item",style:{borderTop:"1px solid var(--border)",marginTop:2,paddingTop:8},onClick:()=>{window.innerWidth<=960&&r?d==null||d():b("hidden"),j(!1)},children:e.jsx("span",{children:"Hide panel"})})]})]})]}),e.jsxs("div",{className:"rightbar-body",children:[e.jsxs("div",{className:"rightbar-sec",children:[e.jsx("div",{className:"panel-subtitle",children:"Outline"}),s.length===0?e.jsx("div",{className:"empty-note",children:f}):s.map((E,$)=>e.jsx("a",{className:`toc-item toc-h${E.level}`,onClick:()=>{var C;(C=document.getElementById(E.id))==null||C.scrollIntoView({behavior:"smooth"}),d==null||d()},children:E.text},`${E.id}-${$}`))]}),e.jsxs("div",{className:"rightbar-sec",children:[e.jsx("div",{className:"panel-title backlinks-title",children:"Backlinks"}),a.length===0?e.jsx("div",{className:"empty-note",children:"No backlinks yet"}):a.map(E=>e.jsx("a",{className:"backlink-item",onClick:()=>{c(E),d==null||d()},children:E},E))]})]})]})}function Ia({fabOpen:s,setFabOpen:t,openSwitcher:o,drawerOpen:i,setDrawerOpen:a,openFile:c,viewMode:p,setViewMode:b,settings:r,setSettings:d,setSettingsOpen:k,scrollRef:j,loadDiff:f,activePath:E,createNewTab:$,tabsOpen:C,setTabsOpen:g,tabs:l,activeTabId:v,switchTab:N,closeTab:x,onToggleOutline:z}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"fab-wrap",children:[s&&e.jsxs("div",{className:"fab-menu",children:[e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),o()},children:"🔍 Quick switcher"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),a(y=>!y)},children:"📁 Toggle files"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),z==null||z()},children:"📑 Toggle outline"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),c("README.md")},children:"🏠 Home (README)"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),b(y=>y==="raw"?"preview":"raw")},children:p==="raw"?"📄 Preview mode":"🧾 Raw view"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),d(y=>({...y,theme:y.theme==="dark"?"light":"dark"}))},children:r.theme==="dark"?"☀️ Light theme":"🌙 Dark theme"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),k(!0)},children:"⚙️ Settings"}),e.jsx("button",{className:"fab-item",onClick:()=>{var y;t(!1),(y=j.current)==null||y.scrollTo({top:0,behavior:"smooth"})},children:"⬆️ Scroll to top"})]}),e.jsx("button",{className:"fab-btn","aria-label":"Quick actions",onClick:()=>t(y=>!y),children:s?"×":"+"})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sheet-backdrop",onClick:()=>t(!1)}),e.jsxs("div",{className:"bottom-sheet",role:"dialog","aria-label":"Quick actions",children:[e.jsx("div",{className:"sheet-handle"}),e.jsxs("div",{className:"sheet-list",children:[e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),o()},children:[e.jsx(dt,{size:18,strokeWidth:1.9}),e.jsx("span",{children:"Open quick switcher"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),a(y=>!y)},children:[e.jsx(lt,{size:18,strokeWidth:1.9}),e.jsx("span",{children:"Toggle files sidebar"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),z==null||z()},children:[e.jsx(Ts,{size:18,strokeWidth:1.9}),e.jsx("span",{children:"Toggle outline sidebar"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),c("README.md")},children:[e.jsx(Cs,{size:18,strokeWidth:1.9}),e.jsx("span",{children:"Go to Home (README)"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b(y=>y==="edit"?"preview":"edit")},children:[e.jsx(rt,{size:18,strokeWidth:1.9}),e.jsx("span",{children:p==="edit"?"Switch to Preview mode":"Switch to Edit mode"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b("diff"),f(E)},children:[e.jsx(Ns,{size:18,strokeWidth:1.9}),e.jsx("span",{children:"View Git Diff"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b(y=>y==="raw"?"preview":"raw")},children:[e.jsx(ga,{size:18,strokeWidth:1.9}),e.jsx("span",{children:p==="raw"?"Switch to Preview mode":"Switch to Raw view"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{var y;t(!1),(y=j.current)==null||y.scrollTo({top:0,behavior:"smooth"})},children:[e.jsx(ka,{size:18,strokeWidth:1.9}),e.jsx("span",{children:"Scroll to top"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),d(y=>({...y,theme:y.theme==="dark"?"light":"dark"}))},children:[r.theme==="dark"?e.jsx(Bs,{size:18,strokeWidth:1.9}):e.jsx(zs,{size:18,strokeWidth:1.9}),e.jsx("span",{children:r.theme==="dark"?"Switch to Light theme":"Switch to Dark theme"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),k(!0)},children:[e.jsx(Fs,{size:18,strokeWidth:1.9}),e.jsx("span",{children:"Settings"})]})]})]})]}),e.jsxs("nav",{className:"mobile-bar","aria-label":"Mobile quick actions",children:[e.jsx("button",{className:`mobile-bar-btn${i?" active":""}`,"aria-label":"Files",onClick:()=>{t(!1),a(y=>!y)},children:e.jsx(lt,{size:19,strokeWidth:1.9})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Back",onClick:()=>window.history.back(),children:e.jsx(ba,{size:19,strokeWidth:1.9})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Forward",onClick:()=>window.history.forward(),children:e.jsx(wa,{size:19,strokeWidth:1.9})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Search",onClick:()=>{t(!1),o()},children:e.jsx(dt,{size:19,strokeWidth:1.9})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"New tab",onClick:$,children:e.jsx(ut,{size:19,strokeWidth:1.9})}),e.jsx("button",{className:`mobile-bar-btn${C?" active":""}`,"aria-label":"Open tabs",onClick:()=>{t(!1),g(!0)},children:e.jsx("span",{className:"tabs-count-badge",children:l.length})}),e.jsx("button",{className:`mobile-bar-btn${s?" active":""}`,"aria-label":"Menu",onClick:()=>t(y=>!y),children:e.jsx(Sa,{size:19,strokeWidth:1.9})})]}),C&&e.jsxs("div",{className:"tabs-overlay",onClick:()=>g(!1),children:[e.jsx("div",{className:"tabs-grid",onClick:y=>y.stopPropagation(),children:l.map(y=>e.jsxs("div",{className:"tab-card-wrap",children:[e.jsxs("div",{className:`tab-card${y.id===v?" active":""}`,onClick:()=>N(y),children:[e.jsx("button",{className:"tab-card-close","aria-label":"Close tab",onClick:A=>x(y.id,A),children:"×"}),e.jsx("div",{className:"tab-card-title",children:y.title}),e.jsx("div",{className:"tab-card-preview",children:y.preview||(y.path?y.path:"Empty tab")})]}),e.jsx("div",{className:"tab-card-label",children:y.title})]},y.id))}),e.jsxs("div",{className:"tabs-footer",onClick:y=>y.stopPropagation(),children:[e.jsx("button",{className:"tabs-footer-btn","aria-label":"New tab",onClick:$,children:"+"}),e.jsxs("span",{style:{fontSize:14,fontWeight:600},children:[l.length," ",l.length===1?"tab":"tabs"]}),e.jsx("button",{className:"tabs-footer-btn",onClick:()=>g(!1),children:"Done"})]})]})]})}function Ha({switcherOpen:s,setSwitcherOpen:t,switcherTab:o,setSwitcherTab:i,switcherIdx:a,setSwitcherIdx:c,switcherInputRef:p,totalFiles:b,fileStats:r,switcherItems:d,switcherData:k,openFile:j,isLargeVault:f,pagedFiles:E,loadMorePagedFiles:$,switcherQuery:C,setSwitcherQuery:g}){return s?e.jsx("div",{className:"switcher-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"switcher",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"switcher-head",children:[e.jsxs("div",{className:"switcher-tabs",children:[e.jsx("button",{className:`switcher-tab${o==="recent"?" active":""}`,onClick:()=>{var l;i("recent"),c(0),(l=p.current)==null||l.focus()},children:"Recent"}),e.jsx("button",{className:`switcher-tab${o==="alpha"?" active":""}`,onClick:()=>{var l;i("alpha"),c(0),(l=p.current)==null||l.focus()},children:"A–Z"})]}),b>r.length&&e.jsxs("span",{className:"switcher-cap",children:[r.length.toLocaleString()," / ",b.toLocaleString()," indexed"]})]}),e.jsxs("div",{className:"switcher-list",children:[d.length===0?e.jsx("div",{className:"empty-note",style:{padding:"12px"},children:"No matching notes"}):(()=>{let l=0;const v=Date.now(),N=x=>{if(!x)return"";const z=Math.max(0,v-x);return z<6e4?"now":z<36e5?`${Math.floor(z/6e4)}m`:z<864e5?`${Math.floor(z/36e5)}h`:z<7*864e5?`${Math.floor(z/864e5)}d`:new Date(x).toLocaleDateString(void 0,{month:"short",day:"numeric"})};return k.groups.map(x=>e.jsxs(On.Fragment,{children:[x.label&&e.jsx("div",{className:"switcher-group-title",children:x.label}),x.items.map(z=>{const y=l++;return e.jsxs("button",{className:`switcher-item${y===a?" selected":""}`,onClick:()=>{t(!1),j(z.path)},children:[e.jsxs("div",{className:"switcher-row-top",children:[e.jsx("span",{className:"switcher-path",children:z.path}),z.mtimeMs>0&&e.jsx("span",{className:"switcher-time",children:N(z.mtimeMs)})]}),z.snippet&&e.jsx("span",{className:"switcher-snippet",children:z.snippet})]},z.path)})]},x.label||"all"))})(),f&&E.hasMore&&e.jsx("button",{className:"btn",style:{margin:"8px auto",display:"block"},onClick:$,children:"Load more"})]}),e.jsxs("div",{className:"switcher-input-wrap",children:[e.jsx("input",{ref:p,className:"switcher-input",type:"text",placeholder:"Find a note...",value:C,onChange:l=>{g(l.target.value),c(0)},onKeyDown:l=>{l.key==="ArrowDown"?(l.preventDefault(),c(v=>Math.min(v+1,Math.max(0,d.length-1)))):l.key==="ArrowUp"?(l.preventDefault(),c(v=>Math.max(v-1,0))):l.key==="Enter"&&d[a]&&(l.preventDefault(),t(!1),j(d[a].path))}}),e.jsx("button",{className:"switcher-clear","aria-label":"Clear or close",onClick:()=>C?g(""):t(!1),children:"×"})]})]})}):null}function O({icon:s}){return e.jsx(s,{className:"file-ctx-menu-icon",size:14,strokeWidth:1.9,"aria-hidden":"true"})}function Fa({fileMenu:s,setFileMenu:t,openNewNoteDialog:o,uploadDirRef:i,uploadInputRef:a,setRenameError:c,setRenameTarget:p,setMoveError:b,setMoveTarget:r,openInNewTab:d,gitChanges:k,loadDiff:j,requestDiscard:f,setDeleteError:E,setDeleteTarget:$,isPinned:C,togglePin:g}){return s?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>t(null),children:e.jsx("div",{className:"file-ctx-menu",style:{left:s.x,top:s.y,maxHeight:`calc(100dvh - ${s.y+8}px)`},onClick:l=>l.stopPropagation(),children:s.type==="dir"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path;t(null),o(l)},children:[e.jsx(O,{icon:ut}),e.jsx("span",{children:"New note here"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{var l;i.current=s.path,t(null),(l=a.current)==null||l.click()},children:[e.jsx(O,{icon:za}),e.jsx("span",{children:"Upload file..."})]}),e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path,v=l.split("/"),N=v.pop()||"",x=v.join("/");t(null),c(""),p({type:"dir",oldPath:l,parentDir:x,newName:N})},children:[e.jsx(O,{icon:rt}),e.jsx("span",{children:"Rename"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path,v=l.split("/"),N=v.pop()||"",x=v.join("/");t(null),b(""),r({type:"dir",oldPath:l,name:N,destFolder:x})},children:[e.jsx(O,{icon:as}),e.jsx("span",{children:"Move"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path,v=s.type;t(null),g(l,v)},children:[e.jsx(O,{icon:C(s.path)?is:ct}),e.jsx("span",{children:C(s.path)?"Unpin":"Pin"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{var l;(l=navigator.clipboard)==null||l.writeText(s.path),t(null)},children:[e.jsx(O,{icon:ns}),e.jsx("span",{children:"Copy path"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path;t(null),d(l,"preview")},children:[e.jsx(O,{icon:Na}),e.jsx("span",{children:"Open in new tab"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path,v=s.type;t(null),g(l,v)},children:[e.jsx(O,{icon:C(s.path)?is:ct}),e.jsx("span",{children:C(s.path)?"Unpin":"Pin"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path,v=l.split("/"),N=v.pop()||"",x=v.join("/");t(null),c(""),p({type:"file",oldPath:l,parentDir:x,newName:N})},children:[e.jsx(O,{icon:rt}),e.jsx("span",{children:"Rename"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path,v=l.split("/"),N=v.pop()||"",x=v.join("/");t(null),b(""),r({type:"file",oldPath:l,name:N,destFolder:x})},children:[e.jsx(O,{icon:as}),e.jsx("span",{children:"Move"})]}),e.jsxs("button",{className:"more-item",onClick:()=>{var l;(l=navigator.clipboard)==null||l.writeText(s.path),t(null)},children:[e.jsx(O,{icon:ns}),e.jsx("span",{children:"Copy path"})]}),s.path.endsWith(".md")&&e.jsxs("button",{className:"more-item",onClick:()=>{var l;(l=navigator.clipboard)==null||l.writeText(`[[${s.path.replace(/\.md$/i,"")}]]`),t(null)},children:[e.jsx(O,{icon:Ca}),e.jsx("span",{children:"Copy [[wikilink]]"})]}),k.some(l=>l.path===s.path)&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"more-item",onClick:()=>{const l=s.path;t(null),setViewMode("diff"),openFile(l),j(l)},children:[e.jsx(O,{icon:Ns}),e.jsx("span",{children:"View Diff"})]}),e.jsxs("button",{className:"more-item",style:{color:"var(--amber)"},onClick:()=>{const l=s.path;t(null),f({path:l})},children:[e.jsx(O,{icon:$a}),e.jsx("span",{children:"Discard changes"})]})]}),e.jsxs("button",{className:"more-item",style:{color:"#f87171",borderTop:"1px solid var(--border)",marginTop:2,paddingTop:8},onClick:()=>{const l=s.path;t(null),E(""),$(l)},children:[e.jsx(O,{icon:Ea}),e.jsx("span",{children:"Delete"})]})]})})}):null}function Vs({value:s,onChange:t,allFolders:o,excludePrefix:i="",allowCreate:a=!1,defaultExpanded:c=!1,onEnter:p}){const[b,r]=u.useState(c),[d,k]=u.useState(""),j=u.useMemo(()=>{const v=i.trim().replace(/^\/+|\/+$/g,"");return o.filter(N=>v?N!==v&&!N.startsWith(`${v}/`):!0)},[o,i]),f=d.trim().replace(/^\/+|\/+$/g,""),E=f.toLowerCase(),$=u.useMemo(()=>E?j.filter(v=>(v||"/ (vault root)").toLowerCase().includes(E)):j,[j,E]),C=(s||"").trim().replace(/^\/+|\/+$/g,""),g=a&&f&&!j.some(v=>v.toLowerCase()===E);function l(v){t(v),k(""),r(!1)}return e.jsxs("div",{className:"folder-picker-wrap",children:[e.jsxs("button",{type:"button",className:"folder-picker-toggle","aria-expanded":b,onClick:()=>r(v=>!v),children:[e.jsx("span",{className:"folder-picker-value",children:C||"/ (vault root)"}),e.jsx("span",{className:"folder-picker-caret",children:b?"▴":"▾"})]}),b&&e.jsxs("div",{className:"folder-picker-panel",children:[e.jsx("input",{type:"text",placeholder:a?"Filter or type new folder...":"Filter folders...",value:d,onChange:v=>k(v.target.value),onKeyDown:v=>v.key==="Enter"&&(p==null?void 0:p())}),e.jsxs("div",{className:"folder-picker",children:[$.map(v=>{const N=C===v;return e.jsx("button",{type:"button",className:`folder-pick-item${N?" active":""}`,onClick:()=>l(v),children:v||"/ (vault root)"},v||"__root__")}),g&&e.jsxs("button",{type:"button",className:"folder-pick-item",onClick:()=>l(f),children:['+ Use "',f,'"']}),$.length===0&&!g&&e.jsx("div",{style:{padding:"8px 10px",fontSize:12,color:"var(--muted)"},children:"No matching folders"})]})]})]})}function Pa({newNoteOpen:s,setNewNoteOpen:t,newNoteTitle:o,setNewNoteTitle:i,newNoteFolder:a,setNewNoteFolder:c,allFolders:p,newNoteError:b,confirmNewNote:r}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:460},onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"New note"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Title"}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:"My note title",value:o,onChange:d=>i(d.target.value),onKeyDown:d=>d.key==="Enter"&&r()})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Folder"}),e.jsx(Vs,{value:a,onChange:c,allFolders:p,allowCreate:!0,defaultExpanded:!1,onEnter:r})]}),it(o,a)&&e.jsxs("div",{style:{fontSize:12,color:"var(--muted)",fontFamily:"var(--font-mono)"},children:["Path: ",it(o,a)]}),b&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:b})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:r,children:"Create note"})]})]})}):null}function Ba({renameTarget:s,setRenameTarget:t,renameError:o,confirmRenameFile:i}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:440},onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:s.type==="dir"?"Rename folder":"Rename file"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{style:{fontSize:12,color:"var(--muted)",fontFamily:"var(--font-mono)"},children:["Folder: ",s.parentDir?`${s.parentDir}/`:"/"]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"New name"}),e.jsx("input",{type:"text",autoFocus:!0,value:s.newName,onChange:a=>t(c=>({...c,newName:a.target.value})),onKeyDown:a=>a.key==="Enter"&&i()})]}),o&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:o})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:i,children:"Rename"})]})]})}):null}function Ua({moveTarget:s,setMoveTarget:t,allFolders:o,moveError:i,confirmMoveItem:a}){if(!s)return null;const c=(s.destFolder||"").trim().replace(/^\/+|\/+$/g,""),p=c?`${c}/${s.name}`:s.name;return e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:460},onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:s.type==="dir"?"Move folder":"Move file"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{style:{fontSize:12,color:"var(--muted)",fontFamily:"var(--font-mono)"},children:["From: ",s.oldPath]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Destination folder"}),e.jsx(Vs,{value:s.destFolder,onChange:b=>t(r=>({...r,destFolder:b})),allFolders:o,excludePrefix:s.type==="dir"?s.oldPath:"",defaultExpanded:!0,onEnter:a})]}),e.jsxs("div",{style:{fontSize:12,color:"var(--muted)",fontFamily:"var(--font-mono)"},children:["To: ",p]}),i&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:i})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:a,children:"Move"})]})]})})}function qa({deleteTarget:s,setDeleteTarget:t,deleteError:o,confirmDeleteFile:i}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:420},onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Delete file?"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{style:{fontSize:13,color:"var(--muted)"},children:["This will permanently remove ",e.jsx("strong",{style:{color:"var(--text)"},children:s})," from disk."]}),o&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:o})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn",style:{background:"#ef4444",borderColor:"#ef4444",color:"#ffffff",fontWeight:600},onClick:i,children:"Delete"})]})]})}):null}function Oa({discardTarget:s,setDiscardTarget:t,discardError:o,confirmDiscard:i}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:440},onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:s.hunkIndex===void 0?"Discard file changes?":s.lineIndex===void 0?"Discard hunk?":"Discard line?"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsx("div",{style:{fontSize:13,color:"var(--muted)",marginBottom:10},children:s.path}),s.previewText&&e.jsx("div",{className:"git-output",style:{marginTop:0},children:s.previewText}),o&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:o})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn",style:{background:"#ef4444",borderColor:"#ef4444",color:"#ffffff",fontWeight:600},onClick:i,children:"Discard"})]})]})}):null}function Va({commitOpen:s,setCommitOpen:t,commitSelected:o,setCommitSelected:i,gitChanges:a,commitMessage:c,setCommitMessage:p,commitPush:b,setCommitPush:r,commitStatus:d,commitBusy:k,handleCommitSubmit:j}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Commit & Push"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Files (",o.size," selected)"]}),e.jsx("div",{className:"commit-files",children:a.map(f=>e.jsxs("label",{className:"commit-file-row",children:[e.jsx("input",{type:"checkbox",checked:o.has(f.path),onChange:E=>{i($=>{const C=new Set($);return E.target.checked?C.add(f.path):C.delete(f.path),C})}}),e.jsx("span",{className:`git-badge git-${f.status}`,children:f.status}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.path})]},f.path))})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Commit message"}),e.jsx("input",{type:"text",placeholder:"docs: update vault notes",value:c,onChange:f=>p(f.target.value)})]}),e.jsxs("label",{className:"toggle-row",children:[e.jsx("span",{children:"Push to remote after commit"}),e.jsx("input",{type:"checkbox",checked:b,onChange:f=>r(f.target.checked)})]}),d&&e.jsx("div",{className:"git-output",style:{color:d.ok?"var(--green)":"#f87171"},children:d.text})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Cancel"}),e.jsx("button",{className:"btn primary",disabled:k||!c.trim()||o.size===0,onClick:j,children:k?"Running...":b?"Commit & Push":"Commit"})]})]})}):null}function rs(s){return s.split(",").map(t=>t.trim().replace(/^\/+|\/+$/g,"")).filter(Boolean)}function Xa({settingsOpen:s,setSettingsOpen:t,settingsTab:o,setSettingsTab:i,settings:a,setSettings:c,setCollapsed:p}){const[b,r]=u.useState(()=>a.autoCollapsed.join(", ")),[d,k]=u.useState(()=>a.hiddenFolders.join(", "));return u.useEffect(()=>{s&&(r(a.autoCollapsed.join(", ")),k(a.hiddenFolders.join(", ")))},[s]),s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",onClick:j=>j.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Settings"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsx("div",{className:"settings-tabs",children:[["general","General"],["appearance","Appearance"],["files","Files & Search"],["endpoints","API & MCP"]].map(([j,f])=>e.jsx("button",{className:`settings-tab${o===j?" active":""}`,onClick:()=>i(j),children:f},j))}),e.jsxs("div",{className:"modal-body",children:[o==="general"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"On startup / first open"}),e.jsxs("select",{value:a.startupMode,onChange:j=>c(f=>({...f,startupMode:j.target.value})),children:[e.jsx("option",{value:"readme",children:"README.md"}),e.jsx("option",{value:"last",children:"Last opened note"}),e.jsx("option",{value:"newtab",children:"New tab launcher"}),e.jsx("option",{value:"custom",children:"Custom note path"})]}),e.jsx("div",{className:"field-hint",children:"Used when opening the vault without a specific #note in the URL."})]}),a.startupMode==="custom"&&e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Custom startup note path"}),e.jsx("input",{type:"text",placeholder:"core/README.md",value:a.startupPath,onChange:j=>c(f=>({...f,startupPath:j.target.value}))})]})]}),o==="appearance"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Theme"}),e.jsxs("select",{value:a.theme,onChange:j=>c(f=>({...f,theme:j.target.value})),children:[e.jsx("option",{value:"dark",children:"Dark"}),e.jsx("option",{value:"light",children:"Light"})]})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Outline & Backlinks panel"}),e.jsxs("select",{value:a.outlinePosition,onChange:j=>c(f=>({...f,outlinePosition:j.target.value})),children:[e.jsx("option",{value:"right",children:"Right sidebar"}),e.jsx("option",{value:"bottom",children:"Bottom panel"}),e.jsx("option",{value:"hidden",children:"Hidden"})]})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Reader font size: ",a.fontSize,"px"]}),e.jsx("input",{type:"range",min:"13",max:"20",value:a.fontSize,onChange:j=>c(f=>({...f,fontSize:Number(j.target.value)}))})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Line height: ",a.lineHeight]}),e.jsx("input",{type:"range",min:"1.35",max:"2.0",step:"0.05",value:a.lineHeight,onChange:j=>c(f=>({...f,lineHeight:Number(j.target.value)}))})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Max reading width: ",a.maxWidth,"px"]}),e.jsx("input",{type:"range",min:"580",max:"980",step:"20",value:a.maxWidth,onChange:j=>c(f=>({...f,maxWidth:Number(j.target.value)}))})]})]}),o==="files"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Auto-collapsed folders (comma-separated)"}),e.jsx("input",{type:"text",placeholder:"apps, templates",value:b,onChange:j=>{const f=j.target.value;r(f);const E=rs(f);c($=>({...$,autoCollapsed:E})),p(new Set(E))},onBlur:()=>r(a.autoCollapsed.join(", "))})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Hidden folders (hide from sidebar & search)"}),e.jsx("input",{type:"text",placeholder:"ideas, templates",value:d,onChange:j=>{const f=j.target.value;k(f);const E=rs(f);c($=>({...$,hiddenFolders:E}))},onBlur:()=>k(a.hiddenFolders.join(", "))})]})]}),o==="endpoints"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"REST API (v1)"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/health"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/tree"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/file?path=README.md"}),e.jsxs("div",{className:"endpoint-box",children:["PUT / POST / PATCH /api/v1/file — ","{ path, content, append? } or { path, target, replacement, replaceAll? }"]}),e.jsx("div",{className:"endpoint-box",children:"DELETE /api/v1/file?path=..."}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/search?q=python"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/events (SSE)"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"MCP Endpoint (Streamable HTTP)"}),e.jsx("div",{className:"endpoint-box",children:"POST /mcp — tools: list_vault, read_note, search_vault, write_note, delete_note"})]})]})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>{c(he),p(new Set(he.autoCollapsed)),r(he.autoCollapsed.join(", ")),k(he.hiddenFolders.join(", "))},children:"Reset defaults"}),e.jsx("button",{className:"btn primary",onClick:()=>t(!1),children:"Done"})]})]})}):null}function Ga(){const[s,t]=u.useState([]),[o,i]=u.useState([]),[a,c]=u.useState([]),[p,b]=u.useState(0),[r,d]=u.useState({}),[k,j]=u.useState(Qn),[f,E]=u.useState("general"),$=Zn(k),[C,g]=u.useState(()=>[{id:"tab-1",path:$,title:ge($),preview:""}]),[l,v]=u.useState("tab-1"),N=C.find(n=>n.id===l)||C[0],x=(N==null?void 0:N.path)||"",[z,y]=u.useState(!1),[A,M]=u.useState(""),[U,Y]=u.useState("preview"),[be,ue]=u.useState(null),[G,D]=u.useState(null),[q,K]=u.useState(""),[ie,oe]=u.useState(null),[Se,P]=u.useState(""),[ee,X]=u.useState(null),[F,$e]=u.useState(null),[Xs,we]=u.useState(""),[Q,Ee]=u.useState(null),[Gs,Ve]=u.useState(""),[pt,Xe]=u.useState(!1),[Ge,mt]=u.useState(""),[ft,xt]=u.useState(""),[Ks,Ne]=u.useState(""),jt=u.useRef(null),vt=u.useRef(""),[Js,Ys]=u.useState(!1),[Ka,pe]=u.useState(""),[Qs,le]=u.useState(!1),[Zs,kt]=u.useState(!1),[en,tn]=u.useState("files"),[me,gt]=u.useState([]),[ze,sn]=u.useState("path"),[bt,wt]=u.useState(!1),[Ke,Nt]=u.useState(""),[yt,nn]=u.useState(!1),[Ct,St]=u.useState(()=>new Set),[an,$t]=u.useState(!1),[on,ye]=u.useState(null),[De,ln]=u.useState(""),[rn,Et]=u.useState(()=>new Set(k.autoCollapsed)),[cn,zt]=u.useState(!0),[Le,te]=u.useState(!1),[Te,fe]=u.useState(!1),[Dt,Lt]=u.useState(!1),[Tt,Je]=u.useState(!1),[se,Ye]=u.useState(!1),[xe,dn]=u.useState("recent"),[ne,Wt]=u.useState(""),[hn,Rt]=u.useState(0),[Mt,We]=u.useState([]),[Re,Me]=u.useState({items:[],hasMore:!1}),[un,pn]=u.useState(0),[Ae,Qe]=u.useState(()=>{try{const n=JSON.parse(localStorage.getItem("pagedex-pinned")||"[]");return Array.isArray(n)?n.filter(h=>h&&typeof h.path=="string"&&(h.type==="file"||h.type==="dir")):[]}catch{return[]}}),mn=u.useRef(null),At=u.useRef(null),re=u.useRef(null),_e=u.useRef(x),Ie=u.useRef((N==null?void 0:N.id)||l);_e.current=x,Ie.current=(N==null?void 0:N.id)||l,u.useEffect(()=>{document.documentElement.setAttribute("data-theme",k.theme),localStorage.setItem("vault-settings",JSON.stringify(k))},[k]),u.useEffect(()=>{try{localStorage.setItem("pagedex-pinned",JSON.stringify(Ae))}catch{}},[Ae]);function fn(n){return Ae.some(h=>h.path===n)}function xn(n,h){Qe(m=>m.some(w=>w.path===n)?m.filter(w=>w.path!==n):[...m,{path:n,type:h}])}u.useEffect(()=>{const n=h=>{var m;if((h.metaKey||h.ctrlKey)&&h.key.toLowerCase()==="k"){h.preventDefault(),He();return}h.key==="/"&&((m=document.activeElement)==null?void 0:m.tagName)!=="INPUT"&&(h.preventDefault(),He()),h.key==="Escape"&&se&&Ye(!1)};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[se]);function He(){Wt(""),Rt(0),We([]),Ye(!0),setTimeout(()=>{var n;return(n=At.current)==null?void 0:n.focus()},40)}u.useEffect(()=>{if(!se)return;const n=ne.trim();if(!n){We([]);return}const h=setTimeout(async()=>{try{const w=await(await fetch(`/api/v1/search?q=${encodeURIComponent(n)}`)).json();We(w.results||[])}catch{We([])}},150);return()=>clearTimeout(h)},[ne,se]);const Fe=u.useMemo(()=>new Set(k.hiddenFolders.map(n=>n.toLowerCase())),[k.hiddenFolders]),_t=u.useMemo(()=>{const n=[""],h=m=>{for(const w of m)if(w.type==="dir"){if(Fe.has(w.path.toLowerCase())||Fe.has(w.name.toLowerCase()))continue;n.push(w.path),h(w.children||[])}};return h(s),n},[s,Fe]),je=p>a.length;u.useEffect(()=>{if(!se||!je){Me({items:[],hasMore:!1});return}const n=xe==="alpha"?"name":"mtime",h=ne.trim(),m=setTimeout(async()=>{try{const S=await(await fetch(`/api/v1/files?sort=${n}&offset=0&limit=100&q=${encodeURIComponent(h)}`)).json();Me({items:S.items||[],hasMore:!!S.hasMore})}catch{Me({items:[],hasMore:!1})}},100);return()=>clearTimeout(m)},[se,je,xe,ne]);async function jn(){const n=xe==="alpha"?"name":"mtime",h=ne.trim(),m=Re.items.length,S=await(await fetch(`/api/v1/files?sort=${n}&offset=${m}&limit=100&q=${encodeURIComponent(h)}`)).json();Me(L=>({items:[...L.items,...S.items||[]],hasMore:!!S.hasMore}))}const It=u.useMemo(()=>{const n=ne.trim().toLowerCase(),h=T=>{const H=T.toLowerCase();return k.hiddenFolders.some(_=>H.startsWith(_.toLowerCase()+"/"))},m=je?Re.items:a.length>0?a:o.map(T=>({path:T,mtimeMs:0})),w=new Map(m.map(T=>[T.path,T.mtimeMs||0]));let S;if(!n)S=m.filter(T=>!h(T.path)).map(T=>({path:T.path,mtimeMs:T.mtimeMs||0,snippet:""}));else{const T=m.filter(_=>!h(_.path)&&_.path.toLowerCase().includes(n)).map(_=>({path:_.path,mtimeMs:_.mtimeMs||0,snippet:""})),H=new Set(T.map(_=>_.path));for(const _ of Mt)!h(_.path)&&!H.has(_.path)&&(H.add(_.path),T.push({path:_.path,mtimeMs:_.mtimeMs??w.get(_.path)??0,snippet:_.snippet||""}));S=T}const L=je?S.length:100;if(xe==="alpha"){const T=[...S].sort((H,_)=>{const Un=H.path.split("/").pop().toLowerCase(),qn=_.path.split("/").pop().toLowerCase();return Un.localeCompare(qn)||H.path.localeCompare(_.path)}).slice(0,L);return{groups:[{label:null,items:T}],items:T}}const J=[...S].sort((T,H)=>(H.mtimeMs||0)-(T.mtimeMs||0)).slice(0,L),V=Date.now(),B=new Date(V);B.setHours(0,0,0,0);const W=B.getTime(),Z=864e5,ke=new Map([["Today",[]],["Yesterday",[]],["Last 7 days",[]],["Last 30 days",[]],["Older",[]]]);for(const T of J){const H=T.mtimeMs||0;H>=W?ke.get("Today").push(T):H>=W-Z?ke.get("Yesterday").push(T):H>=W-7*Z?ke.get("Last 7 days").push(T):H>=W-30*Z?ke.get("Last 30 days").push(T):ke.get("Older").push(T)}const Jt=[],Yt=[];for(const[T,H]of ke)H.length>0&&(Jt.push({label:T,items:H}),Yt.push(...H));return{groups:Jt,items:Yt}},[ne,xe,je,Re.items,a,o,Mt,k.hiddenFolders]),vn=It.items;async function ae(){var w;const[n,h]=await Promise.all([fetch("/api/v1/tree?limit=10000"),fetch("/api/v1/changes")]),m=await n.json();if(t(m.tree),i(m.flatFiles),c(m.fileStats||[]),b(m.totalFiles??((w=m.flatFiles)==null?void 0:w.length)??0),d(m.backlinks),h.ok){const S=await h.json();gt(S.changes||[])}}async function Ht(n,h="preview"){const m=`tab-${Date.now()}`;_e.current=n,Ie.current=m,g(w=>w.length===1&&!w[0].path?[{id:m,path:n,title:ge(n),preview:""}]:[...w,{id:m,path:n,title:ge(n),preview:""}]),v(m),await I(n,!1,m),Y(h)}function Ft(){const n=`tab-${Date.now()}`;g(h=>[...h,{id:n,path:null,title:"New tab",preview:""}]),v(n),M(""),y(!1),te(!1),Lt(!1)}function Pt(n,h){h==null||h.stopPropagation();const m=C.filter(w=>w.id!==n);if(m.length===0){const w={id:`tab-${Date.now()}`,path:null,title:"New tab",preview:""};g([w]),v(w.id),M(""),location.hash="";return}if(g(m),n===((N==null?void 0:N.id)||l)){const w=m[m.length-1];v(w.id),w.path?I(w.path,!1,w.id):(M(""),location.hash="")}}function Bt(n){v(n.id),y(!1),n.path?I(n.path,!1,n.id):(M(""),location.hash="")}async function I(n,h=!1,m=(N==null?void 0:N.id)||l){var J;if(!n){M("");return}const w=((J=re.current)==null?void 0:J.scrollTop)??0;let S="";if(Pe(n)&&!Zt(n)||et(n)||tt(n)||st(n)||nt(n)){if(!(await fetch(`/api/v1/file?path=${encodeURIComponent(n)}`,{method:"HEAD"})).ok){M(""),pe(""),le(!1),g(B=>B.map(W=>W.id===m?{...W,path:null,title:"New tab",preview:""}:W));return}M(""),pe(""),le(!1),Pe(n)?S="[Image preview]":et(n)?S="[PDF document]":tt(n)?S="[Audio]":st(n)?S="[Video]":S="[Binary file — download]"}else{const V=await fetch(`/api/v1/file?path=${encodeURIComponent(n)}`);if(!V.ok){M(""),pe(""),le(!1),g(W=>W.map(Z=>Z.id===m?{...Z,path:null,title:"New tab",preview:""}:Z));return}const B=await V.text();M(B),pe(B),le(!1),S=B.replace(/^#+\s*/gm,"").slice(0,260)}location.hash=encodeURIComponent(n),localStorage.setItem("vault-last-path",n),g(V=>V.map(B=>B.id===m?{...B,path:n,title:ge(n),preview:S}:B)),h?requestAnimationFrame(()=>{re.current&&(re.current.scrollTop=w)}):(te(!1),requestAnimationFrame(()=>{re.current&&(re.current.scrollTop=0)})),U==="diff"&&ve(n)}async function ve(n=x){if(!n)return;const h=await fetch(`/api/v1/git/diff?path=${encodeURIComponent(n)}`);h.ok?ue(await h.json()):ue(null)}function Ut({path:n=x,hunkIndex:h,lineIndex:m,previewText:w}={}){n&&(K(""),D({path:n,hunkIndex:h,lineIndex:m,previewText:w}))}async function kn(){if(!(G!=null&&G.path))return;const{path:n,hunkIndex:h,lineIndex:m}=G,w=await fetch("/api/v1/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n,hunkIndex:h,lineIndex:m})}),S=await w.json().catch(()=>({}));w.ok?(D(null),K(""),await ae(),n===x&&(await I(x,!0),await ve(x))):K(S.error||"Failed to discard")}async function gn(){if(!ie)return;P("");const n=await fetch(`/api/v1/file?path=${encodeURIComponent(ie)}`,{method:"DELETE"}),h=await n.json().catch(()=>({}));if(n.ok){const m=ie;oe(null),localStorage.getItem("vault-last-path")===m&&localStorage.removeItem("vault-last-path");const w=S=>S.filter(L=>!(L.type==="file"&&L.path===m)).map(L=>L.type==="dir"?{...L,children:w(L.children||[])}:L);if(t(S=>w(S)),i(S=>S.filter(L=>L!==m)),c(S=>S.filter(L=>L.path!==m)),gt(S=>S.filter(L=>L.path!==m)),Qe(S=>S.filter(L=>L.path!==m&&!L.path.startsWith(`${m}/`))),m===x){Y("preview");const S=C.filter(L=>L.path!==m);if(S.length>0){const L=S[S.length-1];g(S),v(L.id),L.path?await I(L.path,!1,L.id):(M(""),location.hash="")}else{const L={id:`tab-${Date.now()}`,path:null,title:"New tab",preview:""};g([L]),v(L.id),M(""),le(!1),location.hash=""}}else g(S=>S.filter(L=>L.path!==m));await ae()}else P(h.error||"Failed to delete file")}async function bn(n){var J;const h=Array.from(n||[]);if(!h.length)return;const m=vt.current||"",w=new FormData;w.append("dir",m);for(const V of h)w.append("files",V);const S=await fetch("/api/v1/file/upload",{method:"POST",body:w}),L=await S.json().catch(()=>({}));if(S.ok&&(await ae(),((J=L.uploaded)==null?void 0:J.length)===1)){const V=L.uploaded[0].path;/\.(md|markdown|txt|png|jpe?g|gif|webp|svg|ico)$/i.test(V)&&I(V)}}async function qt(n,h,m,w){const S=n==="dir",J=await fetch(S?"/api/v1/dir/rename":"/api/v1/file/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:h,newPath:m})}),V=await J.json().catch(()=>({}));return J.ok?(await ae(),g(B=>B.map(W=>{if(!W.path)return W;if(S&&W.path.startsWith(`${h}/`)){const Z=`${m}${W.path.slice(h.length)}`;return{...W,path:Z,title:ge(Z)}}return!S&&W.path===h?{...W,path:m,title:ge(m)}:W})),Qe(B=>B.map(W=>{if(S){if(W.path===h)return{...W,path:m};if(W.path.startsWith(`${h}/`))return{...W,path:`${m}${W.path.slice(h.length)}`}}else if(W.path===h)return{...W,path:m};return W})),S?x.startsWith(`${h}/`)&&I(`${m}${x.slice(h.length)}`):h===x&&I(m),!0):(w(V.error||"Operation failed"),!1)}async function wn(){if(!(F!=null&&F.oldPath))return;const n=F.newName.trim();if(!n){we("Please enter a name");return}if(n.includes("/")){we("Name cannot contain / (use Move to change folder)");return}we("");const h=F.parentDir?`${F.parentDir}/${n}`:n;if(h===F.oldPath){$e(null);return}await qt(F.type,F.oldPath,h,we)&&$e(null)}async function Nn(){if(!(Q!=null&&Q.oldPath))return;Ve("");const n=(Q.destFolder||"").trim().replace(/^\/+|\/+$/g,""),h=n?`${n}/${Q.name}`:Q.name;if(h===Q.oldPath){Ee(null);return}await qt(Q.type,Q.oldPath,h,Ve)&&Ee(null)}function yn(n,h,m="file"){const w=window.innerWidth<=768?215:175,S=window.innerWidth<=768?360:300,L=Math.min(h.right-w,window.innerWidth-(w+12)),J=Math.min(h.bottom+4,window.innerHeight-S);X({type:m,path:n,x:Math.max(8,L),y:Math.max(8,J)})}function Ot(n=null){const h=x.includes("/")?x.split("/").slice(0,-1).join("/"):"",m=typeof n=="string"?n:h;mt(""),xt(m.replace(/^\/+|\/+$/g,"")),Ne(""),Xe(!0)}async function Cn(){const n=it(Ge,ft);if(!n){Ne("Please enter a note title");return}if(o.includes(n)){Ne(`Already exists: ${n}`);return}Ne("");const h=Ge.trim().replace(/\.md$/i,""),m=await fetch("/api/v1/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n,content:`# ${h}
184
+
185
+ `})}),w=await m.json().catch(()=>({}));if(!m.ok||w.error){Ne(w.error||"Failed to create note");return}Xe(!1),await ae(),await Ht(n,"preview")}u.useEffect(()=>{ae(),I(x)},[]),u.useEffect(()=>{const n=()=>{const h=decodeURIComponent(location.hash.slice(1)||"");h&&h!==_e.current&&I(h,!1,Ie.current)};return window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[]),u.useEffect(()=>{const n=new EventSource("/api/v1/events");return n.onopen=()=>zt(!0),n.onmessage=async h=>{if(JSON.parse(h.data).type==="reload"){await ae(),pn(S=>S+1);const w=_e.current;w&&await I(w,!0,Ie.current)}},n.onerror=()=>zt(!1),()=>n.close()},[]);async function Sn(n){if(x){kt(!0);try{(await fetch("/api/v1/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:x,content:n})})).ok&&(M(n),pe(n),le(!1))}finally{kt(!1)}}}const{renderedHtml:$n,headings:En}=u.useMemo(()=>!Ze(x)||U!=="preview"||Pe(x)||nt(x)?{renderedHtml:"",headings:[]}:na(A,x,o),[A,x,U,o]),zn=u.useMemo(()=>!A||U!=="raw"&&Ze(x)?"":aa(A,x),[A,x,U]);function Dn(n){const h=n.target.closest("a.wikilink");if(h){n.preventDefault(),I(h.dataset.path);return}const m=n.target.closest("a.md-rel-link");if(m){n.preventDefault();const w=cs(x,m.dataset.href);o.includes(w)&&I(w)}}function Ln(n){Et(h=>{const m=new Set(h);return m.has(n)?m.delete(n):m.add(n),m})}const Tn=u.useMemo(()=>{const h=[...me.filter(m=>!De||m.path.toLowerCase().includes(De))];return ze==="recent"?h.sort((m,w)=>(w.mtimeMs||0)-(m.mtimeMs||0)||m.path.localeCompare(w.path)):ze==="status"?h.sort((m,w)=>m.status.localeCompare(w.status)||m.path.localeCompare(w.path)):h.sort((m,w)=>m.path.localeCompare(w.path)),h},[me,De,ze]);function Wn(){St(new Set(me.map(n=>n.path))),Nt(""),ye(null),wt(!0)}async function Rn(){if(Ke.trim()){$t(!0),ye(null);try{const n=await fetch("/api/v1/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:Ke.trim(),files:Array.from(Ct),push:yt})}),h=await n.json();!n.ok||h.error?ye({ok:!1,text:h.error||"Commit failed"}):(ye({ok:!0,text:h.output||"Committed successfully"}),await ae())}catch(n){ye({ok:!1,text:n.message})}finally{$t(!1)}}}const Mn=r[x]||[],Vt=Pe(x),An=Zt(x),_n=Ze(x),In=et(x),Hn=tt(x),Fn=st(x),Pn=ea(x),Bn=ta(x),Xt=nt(x),ce=k.outlinePosition||"right",Ce=n=>j(h=>({...h,outlinePosition:n})),Gt=()=>{Ce("right"),window.innerWidth<=960&&(te(!1),fe(!0))},Kt=()=>{window.innerWidth<=960?ce==="bottom"?(Ce("hidden"),fe(!1)):(ce==="hidden"&&Ce("right"),te(!1),fe(n=>!n)):Ce(ce==="hidden"?"right":"hidden")};return ra({drawerOpen:Le,outlineDrawerOpen:Te,outlinePosition:ce,setDrawerOpen:te,onOpenOutline:Gt,setOutlineDrawerOpen:fe,disabled:!!(se||Tt||z||bt||Dt||pt||F||Q||ie||G)}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`backdrop${Le||Te?" open":""}`,onClick:()=>{te(!1),fe(!1)}}),e.jsxs("div",{className:"app",children:[e.jsx(La,{drawerOpen:Le,live:cn,settings:k,setSettings:j,sidebarTab:en,setSidebarTab:tn,gitChanges:me,searchRef:mn,filter:De,setFilter:ln,tree:s,pinned:Ae,activePath:x,collapsed:rn,hiddenSet:Fe,toggleDir:Ln,setViewMode:Y,openFile:I,openRowMenu:yn,changesSort:ze,setChangesSort:sn,openCommitDialog:Wn,sortedChanges:Tn,loadDiff:ve}),e.jsxs("main",{className:"main",children:[e.jsx(Ta,{tabs:C,activeTabId:l,switchTab:Bt,closeTab:Pt,createNewTab:Ft}),e.jsxs("div",{className:`workspace-body outline-${ce}`,children:[e.jsxs("div",{className:"note-pane",children:[e.jsx(Wa,{setDrawerOpen:te,activePath:x,moreMenuOpen:Js,setMoreMenuOpen:Ys,viewMode:U,setViewMode:Y,loadDiff:ve,setDeleteError:P,setDeleteTarget:oe,outlinePosition:ce,outlineDrawerOpen:Te,onToggleOutline:Kt,onOpenOutline:Gt}),e.jsx(Aa,{scrollRef:re,activePath:x,openNewNoteDialog:Ot,openFile:I,openSwitcher:He,setDrawerOpen:te,setSettingsOpen:Je,isImg:Vt,isSvg:An,isMarkdown:_n,isPdf:In,isAudio:Hn,isVideo:Fn,isHtml:Pn,isCsv:Bn,reloadTick:un,isBinaryDownload:Xt,viewMode:U,settings:k,diffData:be,requestDiscard:Ut,content:A,saving:Zs,dirty:Qs,setDraftContent:pe,setDirty:le,saveActiveNote:Sn,highlightedRawHtml:zn,handleDocClick:Dn,renderedHtml:$n})]}),e.jsx(_a,{headings:En,isImg:Vt,isBinaryDownload:Xt,viewMode:U,currentBacklinks:Mn,openFile:I,position:ce,onChangePosition:Ce,mobileOpen:Te,onCloseMobile:()=>fe(!1)})]})]})]}),e.jsx(Ia,{fabOpen:Dt,setFabOpen:Lt,openSwitcher:He,drawerOpen:Le,setDrawerOpen:te,onToggleOutline:Kt,openFile:I,viewMode:U,setViewMode:Y,settings:k,setSettings:j,setSettingsOpen:Je,scrollRef:re,loadDiff:ve,activePath:x,createNewTab:Ft,tabsOpen:z,setTabsOpen:y,tabs:C,activeTabId:l,switchTab:Bt,closeTab:Pt}),e.jsx(Ha,{switcherOpen:se,setSwitcherOpen:Ye,switcherTab:xe,setSwitcherTab:dn,switcherIdx:hn,setSwitcherIdx:Rt,switcherInputRef:At,totalFiles:p,fileStats:a,switcherItems:vn,switcherData:It,openFile:I,isLargeVault:je,pagedFiles:Re,loadMorePagedFiles:jn,switcherQuery:ne,setSwitcherQuery:Wt}),e.jsx("input",{ref:jt,type:"file",multiple:!0,style:{display:"none"},onChange:n=>{bn(n.target.files),n.target.value=""}}),e.jsx(Fa,{fileMenu:ee,setFileMenu:X,openNewNoteDialog:Ot,uploadDirRef:vt,uploadInputRef:jt,setRenameError:we,setRenameTarget:$e,setMoveError:Ve,setMoveTarget:Ee,openInNewTab:Ht,gitChanges:me,loadDiff:ve,requestDiscard:Ut,setDeleteError:P,setDeleteTarget:oe,isPinned:fn,togglePin:xn}),e.jsx(Pa,{newNoteOpen:pt,setNewNoteOpen:Xe,newNoteTitle:Ge,setNewNoteTitle:mt,newNoteFolder:ft,setNewNoteFolder:xt,allFolders:_t,newNoteError:Ks,confirmNewNote:Cn}),e.jsx(Ba,{renameTarget:F,setRenameTarget:$e,renameError:Xs,confirmRenameFile:wn}),e.jsx(Ua,{moveTarget:Q,setMoveTarget:Ee,allFolders:_t,moveError:Gs,confirmMoveItem:Nn}),e.jsx(qa,{deleteTarget:ie,setDeleteTarget:oe,deleteError:Se,confirmDeleteFile:gn}),e.jsx(Oa,{discardTarget:G,setDiscardTarget:D,discardError:q,confirmDiscard:kn}),e.jsx(Va,{commitOpen:bt,setCommitOpen:wt,commitSelected:Ct,setCommitSelected:St,gitChanges:me,commitMessage:Ke,setCommitMessage:Nt,commitPush:yt,setCommitPush:nn,commitStatus:on,commitBusy:an,handleCommitSubmit:Rn}),e.jsx(Xa,{settingsOpen:Tt,setSettingsOpen:Je,settingsTab:f,setSettingsTab:E,settings:k,setSettings:j,setCollapsed:Et})]})}Vn.createRoot(document.getElementById("root")).render(e.jsx(Ga,{}));
package/dist/index.html CHANGED
@@ -10,11 +10,12 @@
10
10
  <link rel="icon" href="/favicon.ico" sizes="any" />
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
12
12
  <title>Vault</title>
13
- <script type="module" crossorigin src="/assets/index-ZVjt99Mq.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-vKzhpzX9.js"></script>
14
14
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-E4kvVwMA.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/vendor-markdown-C94ubdL7.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/vendor-hljs-B8we2J8a.js">
17
- <link rel="stylesheet" crossorigin href="/assets/index-BXGU3AiE.css">
17
+ <link rel="modulepreload" crossorigin href="/assets/vendor-tiptap-ChgD7Piv.js">
18
+ <link rel="stylesheet" crossorigin href="/assets/index-A_l6j1w5.css">
18
19
  </head>
19
20
  <body>
20
21
  <div id="root"></div>
package/docs/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # pagedex Documentation
2
+
3
+ User, integration, and developer guides for **pagedex**.
4
+
5
+ - [Getting Started](./getting-started.md) — CLI flags, environment variables, UI features, wikilinks, Git sync, and mobile gestures.
6
+ - [Supported File Types](./supported-files.md) — Markdown/MDX, sandboxed HTML + sibling assets, PDF, audio/video, CSV/TSV, SVG, code, and binaries.
7
+ - [MCP & REST API](./mcp-and-api.md) — Connecting AI clients to `/mcp`, the 5 vault tools, REST endpoints, `/raw/*`, and SSE live reload.
8
+ - [Security Model](./security.md) — Sandboxed HTML iframes, CSP/CORS behavior, `Origin: null` guard, and path protection.
9
+ - [Development & Release](./development.md) — Running `pnpm dev`, unit & smoke tests, and npm packaging.
@@ -0,0 +1,34 @@
1
+ # Development & Release
2
+
3
+ ## Running in Development
4
+
5
+ Start both the Hono API/MCP/Raw server (`:4321`) and Vite HMR dev server (`:5173`):
6
+
7
+ ```bash
8
+ pnpm install
9
+ PAGEDEX_ROOT=~/vault HOST=0.0.0.0 pnpm dev
10
+ ```
11
+
12
+ - **Dev UI:** `http://<host>:5173` (Vite proxies `/api/v1`, `/raw`, and `/mcp` with `xfwd: true` to `127.0.0.1:4321`)
13
+ - **API / Production UI:** `http://<host>:4321`
14
+
15
+ ## Build & Test
16
+
17
+ ```bash
18
+ pnpm build # Build production React bundle into dist/
19
+ pnpm test # Run node:test suite (test/api-mcp.test.js)
20
+ pnpm smoke # Run REST + multi-era MCP smoke checks against :4321
21
+ ```
22
+
23
+ ## npm Package Contents
24
+
25
+ `package.json` restricts the published tarball via `"files"` and runs `prepublishOnly: "vite build"`:
26
+
27
+ - **Included:** `package.json`, `README.md`, `docs/**`, `bin/pagedex.js`, `src/server/**`, and compiled `dist/**`.
28
+ - **Excluded:** `src/client/**`, `.agents/`, `AGENTS.md`, `test/`, `vite.config.js`, `.github/`.
29
+
30
+ Verify exact tarball contents before publishing with:
31
+
32
+ ```bash
33
+ npm pack --dry-run
34
+ ```
@@ -0,0 +1,52 @@
1
+ # Getting Started
2
+
3
+ `pagedex` turns any local folder of notes, code, media, and HTML into a fast web catalog with full-text search, backlinks, Git sync, and an MCP server on a single port.
4
+
5
+ ## Requirements
6
+
7
+ - **Node.js `>= 22.5.0`** (uses built-in `node:sqlite` for FTS5 trigram search)
8
+
9
+ ## Running with `npx`
10
+
11
+ ```bash
12
+ # Serve the current directory on http://127.0.0.1:4321
13
+ npx pagedex
14
+
15
+ # Serve a specific folder and open it in your browser
16
+ npx pagedex ~/vault --open
17
+
18
+ # Expose on your LAN / Tailscale IP
19
+ npx pagedex ~/vault --host 0.0.0.0 --port 4321
20
+ ```
21
+
22
+ ### CLI Options
23
+
24
+ | Flag | Env Var | Default | Description |
25
+ |---|---|---|---|
26
+ | `[dir]` | `PAGEDEX_ROOT` / `VAULT_ROOT` | `process.cwd()` | Root directory to serve |
27
+ | `-p, --port <port>` | `PORT` | `4321` | HTTP port |
28
+ | `-H, --host <host>` | `HOST` | `127.0.0.1` | Bind address (`0.0.0.0` for LAN/Tailscale) |
29
+ | `-o, --open` | — | `false` | Open browser on startup |
30
+ | `-v, --version` | — | — | Print version |
31
+ | `-h, --help` | — | — | Print CLI help |
32
+
33
+ ### Search Index Cache
34
+
35
+ The SQLite FTS5 trigram index is stored **outside** your target folder at `~/.cache/pagedex/<sha256>.db`, so running `pagedex` never creates untracked files in your Git repository.
36
+
37
+ Override the cache location with:
38
+ - `PAGEDEX_INDEX_DIR` — directory for `<hash>.db` files
39
+ - `PAGEDEX_INDEX_PATH` — exact `.db` file path
40
+
41
+ ## Web UI Highlights
42
+
43
+ - **View Modes (top-right `⋮` menu):**
44
+ - **Download** — downloads any open file via `/api/v1/file?path=...&download=1`
45
+ - **Preview** — rendered Markdown, sandboxed HTML, PDF, audio/video, CSV/TSV tables, or images
46
+ - **Edit** — lazy-loaded Tiptap WYSIWYG editor for Markdown (`.md`, `.markdown`, `.mdx`)
47
+ - **Diff** — line-by-line Git diff with per-line, per-hunk, and per-file discard
48
+ - **Raw** — syntax-highlighted source (including SVG XML, HTML, CSV, and code)
49
+ - **Wikilinks & Backlinks:** `[[note]]` and relative links resolve across the folder, and the outline panel lists incoming backlinks.
50
+ - **Git Integration:** Browse changed files in the Changes tab, inspect hunks, discard changes, or commit & push directly from the UI.
51
+ - **Live Reload (SSE):** External edits on disk (e.g. from your editor or an AI agent via MCP) refresh open files and the sidebar tree automatically via `/api/v1/events`.
52
+ - **Mobile Friendly:** Edge-swipe gestures open the left file drawer and right outline drawer, with long-press context actions in the tree.
@@ -0,0 +1,58 @@
1
+ # MCP & REST API
2
+
3
+ `pagedex` exposes both a multi-era **Model Context Protocol (MCP)** server and a **REST API** on the same port (`4321` by default).
4
+
5
+ ## MCP Server (`/mcp`)
6
+
7
+ The `/mcp` endpoint supports three MCP protocol eras simultaneously:
8
+ - **`2026-07-28`** (`server/discover` + Streamable HTTP)
9
+ - **`2025-11-25`** (legacy Streamable HTTP `initialize`)
10
+ - **`2024-11-05`** (legacy HTTP+SSE)
11
+
12
+ ### Example Client Config
13
+
14
+ Point any HTTP-capable MCP client (Claude Code, Cursor, VS Code, etc.) at:
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "pagedex": {
20
+ "url": "http://127.0.0.1:4321/mcp"
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ ### Exposed MCP Tools
27
+
28
+ | Tool | Purpose |
29
+ |---|---|
30
+ | `list_vault` | List files/folders and metadata in the served root |
31
+ | `read_note` | Read file contents and backlinks |
32
+ | `search_vault` | Run SQLite FTS5 trigram full-text search |
33
+ | `write_note` | Create, overwrite, append, or patch (`target` → `replacement`) files |
34
+ | `delete_note` | Delete a file from disk and update the search index |
35
+
36
+ ## REST API (`/api/v1/*`)
37
+
38
+ | Method & Path | Description |
39
+ |---|---|
40
+ | `GET /api/v1/health` | Health check and resolved `root` path |
41
+ | `GET /api/v1/tree` | Full directory tree, `flatFiles`, `fileStats`, `backlinks` (`?sort=mtime\|name`, `?limit=`) |
42
+ | `GET /api/v1/files` | Paginated file listing (`?sort=`, `?offset=`, `?limit=`, `?q=`) |
43
+ | `GET /api/v1/search` | Full-text search (`?q=`, `?limit=`) |
44
+ | `GET /api/v1/file` | Read/stream a file (`?path=`, optional `?download=1`, supports HTTP `Range`) |
45
+ | `PUT / POST / PATCH /api/v1/file` | Create, append (`append: true`), or partial-edit (`target`, `replacement`) |
46
+ | `DELETE /api/v1/file` | Delete file (`?path=`) |
47
+ | `POST /api/v1/file/upload` | Multipart file upload into a target folder |
48
+ | `POST /api/v1/file/rename` | Rename/move a file |
49
+ | `POST /api/v1/dir/rename` | Rename/move a directory |
50
+ | `GET /api/v1/changes` | Git working-tree changes |
51
+ | `GET /api/v1/git/diff` | Parsed diff hunks for a file (`?path=`) |
52
+ | `POST /api/v1/git/discard` | Discard line, hunk, or entire file changes |
53
+ | `POST /api/v1/git/commit` | Commit selected files (and optional push) |
54
+ | `GET /api/v1/events` | Server-Sent Events stream for live filesystem changes |
55
+
56
+ ## Static / Raw Route (`/raw/*`)
57
+
58
+ `GET /raw/<relPath>` serves files by URL path rather than query string so HTML previews can load sibling assets (`style.css`, `app.js`, `data.json`) with relative URLs. See [Security Model](./security.md) for isolation details.
@@ -0,0 +1,25 @@
1
+ # Security Model
2
+
3
+ ## Sandboxed HTML Previews
4
+
5
+ When previewing `.html` / `.htm` files:
6
+
7
+ 1. **Iframe isolation (`sandbox="allow-scripts"`):**
8
+ - `allow-same-origin` is intentionally omitted.
9
+ - The iframe runs with an opaque (`null`) origin, so scripts inside vault HTML cannot access `window.parent`, `localStorage`, cookies, or pagedex's DOM.
10
+ - Top-level navigation, popups, and form submissions are disabled.
11
+
12
+ 2. **`Origin: null` API guard (`src/server/index.js`):**
13
+ - Mutating requests (`POST`, `PUT`, `PATCH`, `DELETE`) to `/api/v1/*` with `Origin: null` are rejected with `403 Forbidden`, preventing CORS simple-request CSRF from sandboxed iframes.
14
+
15
+ 3. **Origin-scoped Content-Security-Policy (`src/server/routes/files.js`):**
16
+ - Responses for `/raw/*.html` and `/raw/*.htm` include a `Content-Security-Policy` header scoped to the request's origin (`x-forwarded-host` / `host` / `referer`), plus `'unsafe-inline' 'unsafe-eval' data: blob:`.
17
+ - This allows local sibling assets (`style.css`, `app.js`, `data.json`, images) while blocking outbound requests to external domains.
18
+
19
+ 4. **Path Guards (`src/server/paths.js`, `src/server/routes/files.js`):**
20
+ - All file access passes through `resolveSafe()` (prevents `..` traversal outside `VAULT_ROOT`).
21
+ - `/raw/*` blocks protected segments (`.git`, `node_modules`, `dist`) and `.env*` files.
22
+
23
+ ## Notes on LAN / Tailscale Hosting
24
+
25
+ `pagedex` has no built-in user authentication. Bind to `127.0.0.1` (default) for local-only use, or use `--host 0.0.0.0` only on trusted private networks / Tailscale.
@@ -0,0 +1,33 @@
1
+ # Supported File Types
2
+
3
+ `pagedex` selects the viewer and search behavior by file extension and active view mode (`Preview`, `Edit`, `Diff`, `Raw`, plus `Download` in the top-right `⋮` menu).
4
+
5
+ | Type | Extensions | Preview Mode | Raw / Edit | Search Indexed |
6
+ |---|---|---|---|---|
7
+ | **Markdown** | `.md`, `.markdown`, `.mdx` | Rendered HTML, wikilinks, backlinks, outline | WYSIWYG (`TiptapEditor`), Raw, Diff | Yes (FTS5) |
8
+ | **HTML** | `.html`, `.htm` | Sandboxed `<iframe src="/raw/...">` | Syntax-highlighted XML/HTML | Yes |
9
+ | **PDF** | `.pdf` | Built-in browser PDF `<iframe>` + Download | — | No |
10
+ | **Audio** | `.mp3`, `.wav`, `.m4a`, `.ogg` | `<audio controls>` with HTTP `Range` seeking | — | No |
11
+ | **Video** | `.mp4`, `.webm`, `.mov` | `<video controls>` with HTTP `Range` seeking | — | No |
12
+ | **Tables** | `.csv`, `.tsv` | Styled HTML `<table>` | Raw text | Yes |
13
+ | **Images** | `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.ico` | Inline `<img>` | — | No |
14
+ | **SVG** | `.svg` | Inline `<img>` | Raw XML toggle | No |
15
+ | **Text / Code** | `.txt`, `.js`, `.ts`, `.py`, `.json`, `.yaml`, etc. | Syntax-highlighted raw view | Raw / Diff | Yes (≤ 2 MB) |
16
+ | **Other Binaries** | `.epub`, `.zip`, `.docx`, `.sqlite`, `.db`, etc. | Download card | — | No |
17
+
18
+ ## HTML + Sibling Files (`style.css`, `data.json`, `app.js`)
19
+
20
+ HTML files in Preview mode are loaded from `/raw/<path>` rather than `srcDoc`, so relative paths inside your HTML resolve naturally against the same folder:
21
+
22
+ ```html
23
+ <link rel="stylesheet" href="style.css" />
24
+ <script src="app.js"></script>
25
+ ```
26
+
27
+ ```js
28
+ fetch('data.json').then((r) => r.json())
29
+ ```
30
+
31
+ ## Audio & Video Seeking
32
+
33
+ `/api/v1/file` and `/raw/*` support HTTP `Range` (`206 Partial Content` / `Accept-Ranges: bytes`), allowing smooth scrubbing in `<audio>` and `<video>` players without buffering the entire file up front.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pagedex",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Local-first Markdown knowledge viewer, editor, Git bridge, and MCP v2 server for any directory.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,6 +18,7 @@
18
18
  "bin/",
19
19
  "src/server/",
20
20
  "dist/",
21
+ "docs/",
21
22
  "README.md"
22
23
  ],
23
24
  "scripts": {
@@ -28,6 +29,7 @@
28
29
  "start": "node --no-warnings src/server/index.js",
29
30
  "prepublishOnly": "vite build",
30
31
  "test": "node --no-warnings --test test/*.test.js",
32
+ "test:playwright": "node --no-warnings --test test/playwright/*.spec.js",
31
33
  "smoke": "node --no-warnings test/smoke.js all",
32
34
  "smoke:api": "node --no-warnings test/smoke.js api",
33
35
  "smoke:mcp": "node --no-warnings test/smoke.js mcp"
@@ -41,6 +43,7 @@
41
43
  "@tiptap/starter-kit": "^3.34.0",
42
44
  "highlight.js": "^11.12.0",
43
45
  "hono": "^4.7.0",
46
+ "lucide-react": "^1.73.0",
44
47
  "marked": "^15.0.0",
45
48
  "react": "^19.1.0",
46
49
  "react-dom": "^19.1.0",
@@ -49,6 +52,7 @@
49
52
  },
50
53
  "devDependencies": {
51
54
  "@vitejs/plugin-react": "^4.4.0",
55
+ "playwright-core": "^1.64.1",
52
56
  "vite": "^6.3.0"
53
57
  }
54
58
  }
@@ -1 +0,0 @@
1
- import{a as d,j as e}from"./vendor-react-E4kvVwMA.js";import{u as p,E as b,s as h,M as x}from"./vendor-tiptap-ChgD7Piv.js";import"./vendor-markdown-C94ubdL7.js";function N({content:n,fileKey:u,fontSize:m,lineHeight:f,maxWidth:g,saving:c,dirty:o,onChange:l,onSave:v}){const t=p({extensions:[h,x],content:n});return d.useEffect(()=>{var s,i;if(!t)return;(((i=(s=t.storage.markdown)==null?void 0:s.getMarkdown)==null?void 0:i.call(s))??"")!==n&&!o&&t.commands.setContent(n)},[u,n,t,o]),d.useEffect(()=>{if(!t)return;const a=()=>{var i,r;const s=((r=(i=t.storage.markdown)==null?void 0:i.getMarkdown)==null?void 0:r.call(i))??"";l(s)};return t.on("update",a),()=>t.off("update",a)},[t,l]),t?e.jsxs("div",{className:"tiptap-wrap",style:{maxWidth:`${g}px`},children:[e.jsxs("div",{className:"tiptap-toolbar",children:[e.jsx("button",{className:`btn${t.isActive("bold")?" active":""}`,onClick:()=>t.chain().focus().toggleBold().run(),children:"B"}),e.jsx("button",{className:`btn${t.isActive("italic")?" active":""}`,onClick:()=>t.chain().focus().toggleItalic().run(),children:"I"}),e.jsx("button",{className:`btn${t.isActive("heading",{level:1})?" active":""}`,onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),children:"H1"}),e.jsx("button",{className:`btn${t.isActive("heading",{level:2})?" active":""}`,onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),children:"H2"}),e.jsx("button",{className:`btn${t.isActive("bulletList")?" active":""}`,onClick:()=>t.chain().focus().toggleBulletList().run(),children:"List"}),e.jsx("button",{className:`btn${t.isActive("codeBlock")?" active":""}`,onClick:()=>t.chain().focus().toggleCodeBlock().run(),children:"Code"}),e.jsx("button",{className:`btn${o?" primary":""}`,style:{marginLeft:"auto"},disabled:c,onClick:()=>{var a,s;return v(((s=(a=t.storage.markdown)==null?void 0:a.getMarkdown)==null?void 0:s.call(a))??"")},children:c?"Saving...":o?"Save *":"Saved"})]}),e.jsx("div",{className:"doc tiptap-body",style:{fontSize:`${m}px`,lineHeight:f},children:e.jsx(b,{editor:t})})]}):null}export{N as default};
@@ -1 +0,0 @@
1
- :root{color-scheme:dark;--bg: #111216;--bg-alt: #181a20;--bg-hover: rgba(255, 255, 255, .06);--border: rgba(255, 255, 255, .09);--text: #eceef2;--muted: #9499a6;--accent: #8b5cf6;--accent-hover: #7c3aed;--accent-soft: rgba(139, 92, 246, .16);--green: #4ade80;--amber: #fbbf24;--code-bg: #16181f;--glass: rgba(24, 26, 32, .88);--font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace}[data-theme=light]{color-scheme:light;--bg: #ffffff;--bg-alt: #f7f7f9;--bg-hover: rgba(0, 0, 0, .05);--border: rgba(0, 0, 0, .09);--text: #18181b;--muted: #6b7280;--accent: #6d28d9;--accent-hover: #5b21b6;--accent-soft: rgba(109, 40, 217, .1);--green: #16a34a;--amber: #d97706;--code-bg: #f3f4f6;--glass: rgba(247, 247, 249, .9)}*{box-sizing:border-box}html,body,#root{margin:0;height:100%;background:var(--bg);color:var(--text);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;overscroll-behavior-x:none;overflow-x:hidden}.app{display:grid;grid-template-columns:270px 1fr;height:100vh}.sidebar,.rightbar{background:var(--bg-alt);border-right:1px solid var(--border);display:flex;flex-direction:column;min-height:0}.workspace-body{flex:1;display:flex;min-height:0;min-width:0}.workspace-body.outline-right,.workspace-body.outline-hidden{flex-direction:row}.workspace-body.outline-bottom{flex-direction:column}.note-pane{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0}.workspace-body.outline-bottom .note-pane{flex:7 1 0%}.rightbar{border-right:0;border-left:1px solid var(--border);padding:0;width:240px;flex-shrink:0;overflow:hidden}.workspace-body.outline-bottom .rightbar{flex:3 1 0%;width:100%;max-height:none;min-height:0;border-left:0;border-top:1px solid var(--border)}.rightbar-head{height:44px;padding:0 12px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}.rightbar-body{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:18px}.workspace-body.outline-bottom .rightbar-body{display:grid;grid-template-columns:1fr 1fr;gap:16px;padding:10px 20px 14px}.rightbar-sec{min-width:0}.panel-subtitle{display:none}.workspace-body.outline-bottom .panel-subtitle{display:block;font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin:2px 0 4px}.backlinks-title{margin-top:0}.workspace-body.outline-bottom .backlinks-title{font-size:10.5px;margin:2px 0 4px}.brand{height:44px;padding:0 12px 0 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}.brand-title{font-weight:700;font-size:14px;display:flex;align-items:center;gap:8px}.brand-logo{display:block;flex-shrink:0;border-radius:5px}.pill{font-size:11px;padding:2px 7px;border-radius:999px;background:var(--accent-soft);color:var(--green);font-weight:600}.pill.off{color:var(--amber)}.sidebar-tabs{display:grid;grid-template-columns:1fr 1fr;gap:2px;margin:10px 12px 0;padding:3px;border-radius:8px;background:var(--bg);border:1px solid var(--border)}.sidebar-tab{background:transparent;border:0;color:var(--muted);font-size:12px;font-weight:600;padding:5px 8px;border-radius:6px;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:center;gap:6px}.sidebar-tab:hover{color:var(--text)}.sidebar-tab.active{background:var(--bg-alt);color:var(--text);box-shadow:0 1px 2px #00000040}.search-wrap{padding:8px 12px 10px;border-bottom:1px solid var(--border)}.search{width:100%;padding:7px 10px;border-radius:6px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px;outline:none}.search:focus{border-color:var(--accent)}.git-badge{font-size:10.5px;font-weight:700;min-width:18px;text-align:center;padding:1px 5px;border-radius:4px;font-family:var(--font-mono);flex-shrink:0}.git-M{color:var(--amber);background:#fbbf2424}.git-U,.git-A{color:var(--green);background:#4ade8024}.git-D{color:#f87171;background:#f8717124}.changes-bar{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:6px 8px 8px;border-bottom:1px solid var(--border);margin-bottom:6px}.changes-select{background:var(--bg);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:4px 8px;font-size:12px;outline:none}.commit-files{max-height:220px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;background:var(--bg);padding:6px;margin-bottom:12px}.commit-file-row{display:flex;align-items:center;gap:8px;padding:5px 6px;font-size:12.5px;cursor:pointer;border-radius:6px}.commit-file-row:hover{background:var(--bg-hover)}.git-output{background:var(--code-bg);border:1px solid var(--border);border-radius:8px;padding:10px;font-family:var(--font-mono);font-size:11.5px;white-space:pre-wrap;max-height:140px;overflow-y:auto;margin-top:8px}.diff-wrap{margin:0 auto}.diff-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;flex-wrap:wrap}.diff-hunk{border:1px solid var(--border);border-radius:10px;overflow:hidden;margin-bottom:14px;background:var(--code-bg)}.diff-hunk-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;background:var(--bg-alt);border-bottom:1px solid var(--border);font-family:var(--font-mono);font-size:11.5px;color:var(--muted)}.diff-line{display:grid;grid-template-columns:36px 20px 1fr 28px;align-items:start;font-family:var(--font-mono);font-size:12.5px;line-height:1.5;padding:1px 6px}.diff-line.add{background:#4ade801f}.diff-line.del{background:#f8717121}.diff-ln{color:var(--muted);font-size:11px;-webkit-user-select:none;user-select:none;text-align:right;padding-right:8px}.diff-sig{-webkit-user-select:none;user-select:none;font-weight:700}.diff-line.add .diff-sig{color:var(--green)}.diff-line.del .diff-sig{color:#f87171}.diff-txt{white-space:pre-wrap;word-break:break-word}.diff-discard-btn{background:none;border:0;color:var(--muted);cursor:pointer;font-size:13px;padding:0 4px;border-radius:4px;line-height:1.4}.diff-discard-btn:hover{color:#f87171;background:#f8717129}.tree{flex:1;overflow-y:auto;padding:8px;font-size:13px}.tree-dir-btn,.tree-file{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:5px 8px;border-radius:5px;cursor:pointer;display:flex;align-items:center;gap:6px;font-size:13px;font-family:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.tree-dir-btn{color:var(--muted);font-weight:600}.tree-dir-btn:hover,.tree-file-row:hover{background:var(--bg-hover)}.tree-file-row{display:flex;align-items:center;border-radius:5px;gap:2px}.tree-file-row.active{background:var(--accent-soft)}.tree-file-row .tree-file,.tree-file-row .tree-dir-btn{flex:1;min-width:0}.tree-file-row .tree-file:hover,.tree-file-row .tree-dir-btn:hover{background:none}.tree-file.active{background:none;color:var(--accent);font-weight:600}.tree-row-more{background:none;border:0;color:var(--muted);cursor:pointer;padding:4px 6px;border-radius:4px;font-size:13px;line-height:1;opacity:0;flex-shrink:0}.tree-file-row:hover .tree-row-more,.tree-file-row.active .tree-row-more{opacity:1}.tree-row-more:hover{color:var(--text);background:var(--bg-hover)}@media(hover:none),(max-width:768px){.tree-row-more{opacity:.75}}.file-ctx-menu{position:fixed;z-index:60;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:10px;padding:5px;min-width:170px;display:flex;flex-direction:column;gap:2px;box-shadow:0 12px 32px #00000080}.tree-children{padding-left:14px}.main{display:flex;flex-direction:column;min-width:0;min-height:0}.topbar{height:44px;padding:0 14px 0 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}.topbar-left{display:flex;align-items:center;gap:8px;min-width:0}.crumbs{font-family:var(--font-mono);font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;gap:6px;align-items:center;position:relative}.icon-btn{width:30px;height:30px;padding:0;border-radius:7px;border:0;background:transparent;color:var(--muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .12s,color .12s}.icon-btn:hover,.icon-btn:active{background:var(--bg-hover);color:var(--text)}.icon-btn.active{color:var(--accent);background:var(--accent-soft)}@media(max-width:960px){.outline-toggle-btn.active{color:var(--muted);background:transparent}}.more-menu{position:absolute;top:calc(100% + 6px);right:0;z-index:35;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:12px;padding:5px;min-width:155px;display:flex;flex-direction:column;gap:2px;box-shadow:0 12px 32px #00000073}.more-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:8px 10px;border-radius:8px;font-size:13px;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:space-between}.more-item:hover{background:var(--bg-hover)}.more-item.active{color:var(--accent);font-weight:600}.outline-menu-trigger{display:none}.outline-menu-trigger.show-desktop{display:flex}.tiptap-wrap{margin:0 auto}.tiptap-toolbar{display:flex;gap:4px;align-items:center;overflow-x:auto;padding:6px 8px;margin-bottom:16px;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:12px;position:sticky;top:0;z-index:5}.tiptap-toolbar .btn{border-color:transparent;background:transparent;padding:5px 9px;border-radius:7px}.tiptap-toolbar .btn:hover{background:var(--bg-hover)}.tiptap-toolbar .btn.active{background:var(--accent-soft);color:var(--accent)}.tiptap-toolbar .btn.primary{background:var(--accent);color:#fff;padding:5px 12px;border-radius:8px}.tiptap-body .ProseMirror{outline:none;min-height:55vh;overflow-wrap:anywhere;word-break:break-word}.tiptap-body .ProseMirror>:first-child{margin-top:0}.btn{background:var(--bg-alt);border:1px solid var(--border);color:var(--text);border-radius:8px;padding:5px 11px;font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;flex-shrink:0;transition:background .12s,border-color .12s}.btn:hover{background:var(--bg-hover)}.btn.active{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}.btn.primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}.menu-btn{display:none;gap:5px}.backdrop{display:none}.content-scroll{flex:1;overflow-y:auto;overflow-x:hidden;min-width:0;padding:28px 36px 80px}.doc{max-width:780px;width:100%;margin:0 auto;line-height:1.65;font-size:15px;overflow-wrap:anywhere;word-break:break-word}.doc h1,.doc h2,.doc h3,.doc h4{margin-top:1.5em;margin-bottom:.5em;line-height:1.25}.doc h1{font-size:1.85em;border-bottom:1px solid var(--border);padding-bottom:.3em;margin-top:0}.doc h2{font-size:1.35em}.doc h3{font-size:1.12em}.doc p{margin:.8em 0}.doc a,.wikilink{color:var(--accent);text-decoration:none;cursor:pointer}.doc a:hover,.wikilink:hover{text-decoration:underline}.wikilink.broken{color:var(--amber);border-bottom:1px dashed var(--amber)}.doc code{font-family:var(--font-mono);font-size:.88em;background:var(--code-bg);padding:2px 5px;border-radius:4px;overflow-wrap:anywhere}.doc pre{background:var(--code-bg);border:1px solid var(--border);padding:14px 16px;border-radius:8px;max-width:100%;overflow-x:auto;font-size:13px;line-height:1.5}.doc pre code{background:none;padding:0}.doc blockquote{margin:1em 0;padding:8px 14px;border-left:3px solid var(--accent);background:var(--accent-soft);border-radius:0 6px 6px 0}.doc blockquote p{margin:.3em 0}.doc ul,.doc ol{padding-left:1.5em}.doc li{margin:.3em 0}.doc hr{border:0;border-top:1px solid var(--border);margin:1.8em 0}.doc table{display:block;max-width:100%;overflow-x:auto;border-collapse:collapse;margin:1em 0;font-size:14px}.doc th,.doc td{border:1px solid var(--border);padding:7px 10px;text-align:left}.doc th{background:var(--bg-alt)}.doc img{max-width:100%;height:auto;border-radius:8px;border:1px solid var(--border)}.raw-view{max-width:860px;width:100%;margin:0 auto;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font-family:var(--font-mono);font-size:13px;line-height:1.55;background:var(--code-bg);border:1px solid var(--border);padding:18px;border-radius:8px}.hljs{color:var(--text);background:transparent}.hljs-comment,.hljs-quote{color:#7f849c;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst,.hljs-section{color:#c084fc}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#f59e0b}.hljs-string,.hljs-doctag,.hljs-regexp{color:#4ade80}.hljs-title,.hljs-title.function_,.hljs-title.class_{color:#60a5fa}.hljs-type,.hljs-built_in,.hljs-class .hljs-title{color:#38bdf8}.hljs-attr,.hljs-attribute,.hljs-symbol,.hljs-bullet,.hljs-link{color:#f472b6}.hljs-addition{color:#4ade80;background:#4ade801f}.hljs-deletion{color:#f87171;background:#f871711f}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}[data-theme=light] .hljs-comment,[data-theme=light] .hljs-quote{color:#6b7280}[data-theme=light] .hljs-keyword,[data-theme=light] .hljs-selector-tag,[data-theme=light] .hljs-subst,[data-theme=light] .hljs-section{color:#7c3aed}[data-theme=light] .hljs-number,[data-theme=light] .hljs-literal,[data-theme=light] .hljs-variable,[data-theme=light] .hljs-template-variable,[data-theme=light] .hljs-tag .hljs-attr{color:#b45309}[data-theme=light] .hljs-string,[data-theme=light] .hljs-doctag,[data-theme=light] .hljs-regexp{color:#15803d}[data-theme=light] .hljs-title,[data-theme=light] .hljs-title.function_,[data-theme=light] .hljs-title.class_{color:#2563eb}[data-theme=light] .hljs-type,[data-theme=light] .hljs-built_in,[data-theme=light] .hljs-class .hljs-title{color:#0369a1}[data-theme=light] .hljs-attr,[data-theme=light] .hljs-attribute,[data-theme=light] .hljs-symbol,[data-theme=light] .hljs-bullet,[data-theme=light] .hljs-link{color:#be185d}.img-wrap{text-align:center}.img-wrap img{max-width:100%;max-height:80vh}.binary-card{max-width:460px;margin:40px auto;padding:28px 24px;border:1px solid var(--border);border-radius:12px;background:var(--bg-alt);text-align:center}.binary-card-name{font-size:16px;font-weight:700;margin-bottom:6px}.binary-card-path{font-size:12.5px;color:var(--muted);font-family:var(--font-mono);margin-bottom:18px}.panel-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:8px 0}.toc-item,.backlink-item{display:block;padding:4px 6px;border-radius:4px;font-size:12.5px;color:var(--text);text-decoration:none;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.toc-item:hover,.backlink-item:hover{background:var(--bg-hover);color:var(--accent)}.toc-h2{padding-left:14px;color:var(--muted)}.toc-h3{padding-left:24px;color:var(--muted);font-size:12px}.empty-note{font-size:12px;color:var(--muted);padding:4px 6px}.fab-wrap{position:fixed;right:18px;bottom:18px;z-index:25;display:flex;flex-direction:column;align-items:flex-end;gap:8px}.fab-btn{width:48px;height:48px;border-radius:999px;border:0;background:var(--accent);color:#fff;font-size:20px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px #00000059}.fab-menu{background:var(--bg-alt);border:1px solid var(--border);border-radius:10px;padding:6px;min-width:170px;display:flex;flex-direction:column;gap:2px;box-shadow:0 10px 28px #0006}.fab-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:8px 10px;border-radius:6px;font-size:13px;cursor:pointer;display:flex;align-items:center;gap:8px;font-family:inherit}.fab-item:hover{background:var(--bg-hover);color:var(--accent)}.mobile-bar,.sheet-backdrop,.bottom-sheet{display:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#000000a6;z-index:50;display:flex;align-items:center;justify-content:center;padding:12px}.modal{width:min(96vw,760px);height:min(90vh,660px);background:var(--bg-alt);border:1px solid var(--border);border-radius:14px;box-shadow:0 18px 48px #0000008c;display:flex;flex-direction:column;overflow:hidden}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);flex-shrink:0}.modal-head h2{margin:0;font-size:16px}.settings-tabs{display:flex;gap:6px;padding:10px 16px;border-bottom:1px solid var(--border);overflow-x:auto;flex-shrink:0;background:var(--bg)}.settings-tab{background:none;border:1px solid transparent;color:var(--muted);padding:6px 12px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap;font-family:inherit}.settings-tab:hover{color:var(--text);background:var(--bg-hover)}.settings-tab.active{color:var(--accent);background:var(--accent-soft);border-color:var(--accent)}.modal-body{flex:1;overflow-y:auto;padding:18px}.field{margin-bottom:16px}.field label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px;font-weight:600}.field-hint{font-size:11.5px;color:var(--muted);margin-top:4px}.field input[type=text],.field select{width:100%;padding:9px 11px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px;outline:none}.field input[type=range]{width:100%}.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-radius:8px;background:var(--bg);border:1px solid var(--border);margin-bottom:12px;font-size:13px;cursor:pointer}.endpoint-box{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:10px 12px;font-family:var(--font-mono);font-size:12px;margin-bottom:8px;word-break:break-all}.modal-foot{display:flex;justify-content:space-between;gap:8px;padding:12px 18px;border-top:1px solid var(--border);flex-shrink:0}.switcher-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#0000008c;z-index:45;display:flex;align-items:flex-end;justify-content:center;padding:14px}@media(min-width:769px){.switcher-backdrop{align-items:center}}.switcher{width:100%;max-width:520px;max-height:70vh;background:var(--bg-alt);border:1px solid var(--border);border-radius:16px;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 18px 48px #0000008c}.switcher-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-bottom:1px solid var(--border)}.switcher-tabs{display:flex;gap:4px}.switcher-tab{background:none;border:0;color:var(--muted);font-size:12px;font-weight:600;padding:5px 10px;border-radius:7px;cursor:pointer;font-family:inherit}.switcher-tab:hover{color:var(--text);background:var(--bg-hover)}.switcher-tab.active{background:var(--accent-soft);color:var(--accent)}.switcher-cap{font-size:11px;color:var(--muted);font-family:var(--font-mono)}.switcher-group-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);padding:8px 10px 4px}.switcher-row-top{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%}.switcher-time{font-size:11px;color:var(--muted);font-family:var(--font-mono);flex-shrink:0}.switcher-list{flex:1;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:2px}.switcher-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:10px 12px;border-radius:10px;cursor:pointer;font-family:inherit;display:flex;flex-direction:column;gap:2px}.switcher-item:hover,.switcher-item.selected{background:var(--accent-soft);color:var(--accent)}.switcher-path{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.switcher-snippet{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.switcher-input-wrap{padding:10px 12px;border-top:1px solid var(--border);display:flex;align-items:center;gap:8px;background:var(--bg-alt)}.switcher-input{flex:1;padding:10px 14px;border-radius:999px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:14px;outline:none}.switcher-input:focus{border-color:var(--accent)}.switcher-clear{width:30px;height:30px;border-radius:999px;border:0;background:var(--bg-hover);color:var(--text);font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}.folder-picker{margin-top:6px;max-height:170px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;background:var(--bg);padding:4px;display:flex;flex-direction:column;gap:2px}.folder-pick-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:6px 8px;border-radius:6px;cursor:pointer;font-size:12.5px;font-family:var(--font-mono)}.folder-pick-item:hover{background:var(--bg-hover)}.folder-pick-item.active{background:var(--accent-soft);color:var(--accent);font-weight:600}.desktop-tabs{display:flex;align-items:center;gap:4px;padding:6px 14px 0;background:var(--bg-alt);border-bottom:1px solid var(--border);overflow-x:auto}.desktop-tab{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:8px 8px 0 0;border:1px solid transparent;border-bottom:0;background:none;color:var(--muted);font-size:12px;cursor:pointer;font-family:inherit;white-space:nowrap;max-width:180px}.desktop-tab:hover{background:var(--bg-hover);color:var(--text)}.desktop-tab.active{background:var(--bg);color:var(--text);border-color:var(--border);font-weight:600}.desktop-tab-title{overflow:hidden;text-overflow:ellipsis}.desktop-tab-close{border:0;background:none;color:var(--muted);cursor:pointer;padding:0 2px;font-size:13px;line-height:1}.desktop-tab-close:hover{color:var(--text)}.desktop-tab-add{border:0;background:none;color:var(--muted);cursor:pointer;padding:4px 8px;font-size:16px;border-radius:6px}.desktop-tab-add:hover{background:var(--bg-hover);color:var(--text)}.new-tab-view{min-height:60vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}.new-tab-btn{width:210px;padding:12px 18px;border-radius:999px;border:1px solid var(--border);background:var(--bg-alt);color:var(--text);font-size:14px;font-family:inherit;cursor:pointer;display:flex;align-items:center;gap:12px}.new-tab-btn:hover,.new-tab-btn:active{background:var(--bg-hover);border-color:var(--accent);color:var(--accent)}.new-tab-btn svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}.tabs-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0a0c12f0;z-index:42;display:flex;flex-direction:column;justify-content:flex-end}.tabs-grid{overflow-y:auto;padding:20px 14px 12px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;max-width:680px;width:100%;margin:0 auto}.tab-card-wrap{display:flex;flex-direction:column;align-items:center;gap:6px}.tab-card{width:100%;height:190px;background:var(--bg-alt);border:1.5px solid var(--border);border-radius:16px;padding:12px;position:relative;cursor:pointer;overflow:hidden;text-align:left;color:var(--text);font-family:inherit;display:flex;flex-direction:column;gap:6px}.tab-card.active{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}.tab-card-close{position:absolute;top:8px;right:8px;width:24px;height:24px;border-radius:999px;border:0;background:var(--bg-hover);color:var(--text);font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center}.tab-card-title{font-size:13px;font-weight:700;color:var(--accent);padding-right:26px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tab-card-preview{font-size:11px;line-height:1.45;color:var(--muted);overflow:hidden;white-space:pre-wrap}.tab-card-label{font-size:12px;font-weight:600;color:var(--text);max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabs-footer{display:flex;align-items:center;justify-content:space-between;padding:12px 18px calc(14px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--border);background:var(--bg-alt)}.tabs-footer-btn{background:none;border:0;color:var(--text);font-size:15px;font-weight:600;cursor:pointer;padding:4px 8px;font-family:inherit}.tabs-count-badge{width:21px;height:21px;border:1.7px solid currentColor;border-radius:5px;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center}@media(max-width:960px){.app{grid-template-columns:230px 1fr}.outline-menu-trigger{display:flex}.backdrop.open{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:20}.workspace-body:not(.outline-bottom) .rightbar{position:fixed;inset:0 0 0 auto;width:min(84vw,300px);z-index:30;transform:translate(100%);transition:transform .18s ease}.workspace-body:not(.outline-bottom) .rightbar.mobile-open{transform:translate(0)}}@media(max-width:768px){.app{grid-template-columns:1fr}.workspace-body.outline-bottom .rightbar-body{grid-template-columns:1fr;gap:10px;padding:10px 14px calc(74px + env(safe-area-inset-bottom,0px))}.menu-btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0}.menu-btn svg{width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.icon-btn{width:34px;height:34px}.desktop-tabs,.fab-wrap{display:none}.sheet-backdrop,.bottom-sheet{display:block}.sidebar{position:fixed;inset:0 auto 0 0;width:min(84vw,310px);z-index:30;transform:translate(-100%);transition:transform .18s ease}.sidebar.open{transform:translate(0)}.backdrop.open{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:20}.brand{height:48px;padding:0 12px 0 14px}.brand-title{font-size:15px;gap:8px}.sidebar-tabs{margin:10px 12px 0;padding:3px;gap:2px}.sidebar-tab{font-size:13px;padding:6px 8px;border-radius:6px}.search-wrap{padding:8px 12px 10px}.search{font-size:16px;padding:8px 11px;border-radius:7px}.tree{padding:8px 10px;font-size:14px}.tree-dir-btn,.tree-file{padding:8px 9px;font-size:14px;border-radius:6px}.tree-row-more{min-width:32px;min-height:32px;padding:4px 6px;font-size:15px;display:inline-flex;align-items:center;justify-content:center}.changes-bar{padding:6px 8px 8px}.changes-select{font-size:13.5px;padding:6px 9px}.topbar{height:48px;padding:0 12px}.rightbar-head{height:44px;padding:0 12px}.crumbs{font-size:13px}.btn{padding:8px 13px;font-size:13.5px;border-radius:8px}.more-menu,.file-ctx-menu{min-width:200px;padding:5px;border-radius:12px}.more-item{padding:10px 12px;font-size:14px;border-radius:8px}.new-tab-view{gap:12px}.new-tab-btn{width:min(84vw,270px);padding:14px 20px;font-size:15.5px}.new-tab-btn svg{width:19px;height:19px}.switcher-tab{font-size:13.5px;padding:7px 12px}.switcher-item{padding:12px 14px}.switcher-path{font-size:15px}.switcher-snippet{font-size:13px}.switcher-input{font-size:16px;padding:11px 16px}.switcher-clear{width:34px;height:34px;font-size:17px}.field label{font-size:13px}.field input[type=text],.field select{font-size:16px;padding:11px 12px;border-radius:9px}.folder-picker{max-height:200px;padding:6px}.folder-pick-item{padding:10px 12px;font-size:14px;border-radius:7px}.toggle-row{padding:12px 14px;font-size:14px}.commit-file-row{padding:8px 10px;font-size:14px}.content-scroll{padding:18px 16px calc(86px + env(safe-area-inset-bottom,0px))}.mobile-bar{position:fixed;left:50%;transform:translate(-50%);bottom:calc(14px + env(safe-area-inset-bottom,0px));z-index:25;display:flex;align-items:center;gap:6px;background:var(--glass);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border:1px solid var(--border);border-radius:999px;padding:7px 12px;box-shadow:0 10px 30px #00000073}.mobile-bar-btn{background:none;border:0;color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;width:42px;height:40px;border-radius:999px}.mobile-bar-btn svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.mobile-bar-btn.active,.mobile-bar-btn:active{color:var(--accent);background:var(--accent-soft)}.tabs-count-badge{width:23px;height:23px;font-size:12px}.sheet-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:35}.bottom-sheet{position:fixed;left:0;right:0;bottom:0;z-index:36;background:var(--bg-alt);border-top:1px solid var(--border);border-radius:18px 18px 0 0;padding:10px 14px calc(18px + env(safe-area-inset-bottom,0px));box-shadow:0 -12px 36px #00000080}.sheet-handle{width:38px;height:4px;border-radius:999px;background:var(--border);margin:0 auto 12px}.sheet-list{background:var(--bg);border:1px solid var(--border);border-radius:12px;overflow:hidden}.sheet-item{width:100%;background:none;border:0;border-bottom:1px solid var(--border);color:var(--text);padding:14px 16px;font-size:15px;font-family:inherit;display:flex;align-items:center;gap:12px;cursor:pointer;text-align:left}.sheet-item:last-child{border-bottom:0}.sheet-item:active,.sheet-item:hover{background:var(--bg-hover);color:var(--accent)}.sheet-item svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;color:var(--muted)}}.media-viewer{display:flex;flex-direction:column;height:100%;min-height:480px}.media-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid var(--border);background:var(--bg-alt);font-size:13px;color:var(--muted)}.pdf-frame,.html-frame{flex:1;width:100%;height:100%;min-height:600px;border:0;background:#fff}.video-player{width:100%;max-width:960px;max-height:calc(100vh - 180px);margin:24px auto;border-radius:10px;background:#000}.csv-scroll{overflow-x:auto}
@@ -1,6 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TiptapEditor-OFHNcjy3.js","assets/vendor-react-E4kvVwMA.js","assets/vendor-tiptap-ChgD7Piv.js","assets/vendor-markdown-C94ubdL7.js"])))=>i.map(i=>d[i]);
2
- import{a as u,j as e,R as Is,c as Ws}from"./vendor-react-E4kvVwMA.js";import{m as Dt}from"./vendor-markdown-C94ubdL7.js";import{H as De,d as zs}from"./vendor-hljs-B8we2J8a.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))c(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&c(d)}).observe(document,{childList:!0,subtree:!0});function i(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function c(n){if(n.ep)return;n.ep=!0;const o=i(n);fetch(n.href,o)}})();const ne={theme:"dark",fontSize:15,lineHeight:1.65,maxWidth:780,outlinePosition:"right",startupMode:"readme",startupPath:"README.md",autoCollapsed:["apps"],hiddenFolders:[],hideCollapsedInSearch:!0};function _s(){try{const s=localStorage.getItem("vault-settings");if(!s)return ne;const t=JSON.parse(s);return{...ne,...t,theme:t.theme==="light"?"light":"dark",fontSize:Number(t.fontSize)>=12&&Number(t.fontSize)<=22?Number(t.fontSize):15,lineHeight:Number(t.lineHeight)>=1.3&&Number(t.lineHeight)<=2.1?Number(t.lineHeight):1.65,maxWidth:Number(t.maxWidth)>=560&&Number(t.maxWidth)<=1040?Number(t.maxWidth):780,outlinePosition:["right","bottom","hidden"].includes(t.outlinePosition)?t.outlinePosition:"right",autoCollapsed:Array.isArray(t.autoCollapsed)?t.autoCollapsed:["apps"],hiddenFolders:Array.isArray(t.hiddenFolders)?t.hiddenFolders:[]}}catch{return ne}}function Us(s){const t=decodeURIComponent(location.hash.slice(1)||"");return t||(s.startupMode==="newtab"?null:s.startupMode==="last"?localStorage.getItem("vault-last-path")||"README.md":s.startupMode==="custom"&&s.startupPath.trim()||"README.md")}function Ve(s){return s?s.split("/").pop().replace(/\.md$/i,""):"New tab"}function Fe(s){return/\.(md|markdown|mdx)$/i.test(s)}function $e(s){return/\.(png|jpe?g|gif|webp|svg|ico)$/i.test(s)}function Mt(s){return/\.svg$/i.test(s)}function Oe(s){return/\.pdf$/i.test(s)}function qe(s){return/\.(mp3|wav|m4a|ogg)$/i.test(s)}function Xe(s){return/\.(mp4|webm|mov)$/i.test(s)}function Fs(s){return/\.html?$/i.test(s)}function Os(s){return/\.(csv|tsv)$/i.test(s)}function Ge(s){return/\.(epub|zip|tar|gz|tgz|7z|rar|docx?|xlsx?|pptx?|odt|ods|odp|mkv|avi|dmg|exe|bin|whl|sqlite|db)$/i.test(s)}function _t(s,t){const i=t.split("#")[0],c=s.includes("/")?s.split("/").slice(0,-1).join("/"):"",n=(c?`${c}/`:"")+i,o=[];for(const d of n.split("/"))d==="."||d===""||(d===".."?o.pop():o.push(d));return o.join("/")}function qs(s,t){const i=s.split("|")[0].split("#")[0].trim().replace(/\.md$/i,"").replace(/^\/+/,"").toLowerCase();if(!i)return null;const c=t.filter(d=>d.endsWith(".md")),n=c.find(d=>d.slice(0,-3).toLowerCase()===i);if(n)return n;const o=i.split("/").pop();return c.find(d=>d.slice(0,-3).split("/").pop().toLowerCase()===o)||null}function Ke(s,t){const i=(s||"").trim().replace(/^\/+|\/+$/g,"");if(!i)return"";const c=/\.[a-z0-9]+$/i.test(i)?i:`${i}.md`,n=(t||"").trim().replace(/^\/+|\/+$/g,"");return n?`${n}/${c}`:c}De.registerLanguage("dockerfile",zs);const At={js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",py:"python",pyw:"python",sh:"bash",bash:"bash",zsh:"bash",json:"json",jsonc:"json",yml:"yaml",yaml:"yaml",css:"css",scss:"scss",less:"less",html:"xml",htm:"xml",xml:"xml",svg:"xml",md:"markdown",markdown:"markdown",sql:"sql",rs:"rust",go:"go",java:"java",kt:"kotlin",c:"c",h:"c",cpp:"cpp",hpp:"cpp",cc:"cpp",toml:"ini",ini:"ini",conf:"ini",env:"ini",diff:"diff",patch:"diff",rb:"ruby",php:"php",swift:"swift",makefile:"makefile",dockerfile:"dockerfile"};function Ut(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ft(s,t){const i=String(s??"");try{const c=(t||"").trim().toLowerCase();if(c&&De.getLanguage(c))return De.highlight(i,{language:c,ignoreIllegals:!0}).value;if(i.length<=15e4)return De.highlightAuto(i).value}catch{}return Ut(i)}function Xs(s,t,i){const c=[],o=s.split(/(```[\s\S]*?```)/g).map((l,r)=>r%2===1?l:l.replace(/\[\[([^\]]+)\]\]/g,(x,p)=>{const[m,$]=p.split("|"),R=($||m).trim(),C=qs(p,i);return C?`<a class="wikilink" data-path="${C.replace(/"/g,"&quot;")}">${R}</a>`:`<span class="wikilink broken" title="Note not created yet">${R}</span>`})).join(""),d=new Dt.Renderer;return d.heading=({tokens:l,depth:r})=>{const x=d.parser.parseInline(l),p=x.replace(/<[^>]+>/g,""),m=p.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return c.push({level:r,text:p,id:m}),`<h${r} id="${m}">${x}</h${r}>`},d.image=({href:l,title:r,text:x})=>`<img src="${/^https?:\/\//.test(l)?l:`/api/v1/file?path=${encodeURIComponent(_t(t,l))}`}" alt="${x||""}"${r?` title="${r}"`:""} />`,d.link=({href:l,title:r,tokens:x})=>{const p=d.parser.parseInline(x);return/^https?:\/\//.test(l)?`<a href="${l}" target="_blank" rel="noreferrer"${r?` title="${r}"`:""}>${p}</a>`:`<a class="md-rel-link" data-href="${l.replace(/"/g,"&quot;")}">${p}</a>`},d.code=({text:l,lang:r})=>{const x=Ft(l,r);return`<pre><code class="${r?`hljs language-${Ut(r.trim())}`:"hljs"}">${x}</code></pre>`},{renderedHtml:Dt.parse(o,{renderer:d,gfm:!0,breaks:!1}),headings:c}}function Gs(s,t){if(!s)return"";const i=t.split("/").pop().toLowerCase(),c=i.includes(".")?i.split(".").pop():i,n=At[c]||At[i]||"";return Ft(s,n)}const Vs=120,Ks=.28,Bt=6,Te=.25,Le=.28,Re=18;function Js(s){let t=s;for(;t&&t!==document.body;){const i=t.tagName;if(i==="PRE"||i==="TABLE"||i==="INPUT"||i==="TEXTAREA"||i==="SELECT"||t.isContentEditable)return!0;if(t.scrollWidth>t.clientWidth+2){const c=getComputedStyle(t).overflowX;if(c==="auto"||c==="scroll")return!0}t=t.parentElement}return!1}function Pt(s,t){if(s)for(const i of t)s.style[i]=""}function Ys({drawerOpen:s,outlineDrawerOpen:t,outlinePosition:i="right",setDrawerOpen:c,onOpenOutline:n,setOutlineDrawerOpen:o,disabled:d=!1}){const b=u.useRef({drawerOpen:s,outlineDrawerOpen:t,outlinePosition:i,setDrawerOpen:c,onOpenOutline:n,setOutlineDrawerOpen:o,disabled:d});b.current={drawerOpen:s,outlineDrawerOpen:t,outlinePosition:i,setDrawerOpen:c,onOpenOutline:n,setOutlineDrawerOpen:o,disabled:d},u.useEffect(()=>{let l=null;const r=C=>{C&&(Pt(C.panelEl,["transform","transition"]),Pt(C.backdropEl,["display","position","inset","zIndex","background","opacity","transition"]))},x=C=>{const h=b.current;if(h.disabled||C.touches.length!==1)return;const v=C.touches[0],S=v.clientX,L=v.clientY,f=document.documentElement.clientWidth||window.innerWidth,y=Math.min(Vs,Math.round(f*Ks));let w=null,E=null;if(h.drawerOpen&&f<=768?(w="left",E="close"):h.outlineDrawerOpen&&f<=960&&h.outlinePosition!=="bottom"?(w="right",E="close"):!h.drawerOpen&&!h.outlineDrawerOpen&&!Js(C.target)&&(S<=y&&f<=768?(w="left",E="open"):S>=f-y&&f<=960&&h.outlinePosition!=="bottom"&&(w="right",E="open")),!w)return;const B=document.querySelector(w==="left"?".sidebar":".rightbar"),W=document.querySelector(".backdrop"),U=(B==null?void 0:B.offsetWidth)||(w==="left"?310:300);l={side:w,action:E,startX:S,startY:L,lastX:S,startTime:performance.now(),lastTime:performance.now(),locked:null,panelEl:B,backdropEl:W,width:U}},p=C=>{if(!l||C.touches.length!==1)return;const h=C.touches[0],v=h.clientX-l.startX,S=h.clientY-l.startY;if(l.lastX=h.clientX,l.lastTime=performance.now(),!l.locked){if(Math.abs(S)>=Bt&&Math.abs(S)>=Math.abs(v)){l.locked="vertical",l=null;return}if(Math.abs(v)>=Bt&&Math.abs(v)>Math.abs(S)){if(!(l.side==="left"&&l.action==="open"&&v>0||l.side==="left"&&l.action==="close"&&v<0||l.side==="right"&&l.action==="open"&&v<0||l.side==="right"&&l.action==="close"&&v>0)){l=null;return}l.locked="horizontal",l.panelEl&&(l.panelEl.style.transition="none"),l.backdropEl&&(l.backdropEl.style.display="block",l.backdropEl.style.position="fixed",l.backdropEl.style.inset="0",l.backdropEl.style.zIndex="20",l.backdropEl.style.background="rgba(0, 0, 0, 0.5)",l.backdropEl.style.transition="none")}else return}l.locked==="horizontal"&&C.cancelable&&C.preventDefault();const L=l.width;let f;if(l.side==="left"?f=l.action==="open"?v/L:1+v/L:f=l.action==="open"?-v/L:1-v/L,f=Math.max(0,Math.min(1,f)),l.panelEl){const y=l.side==="left"?(f-1)*100:(1-f)*100;l.panelEl.style.transform=`translateX(${y}%)`}l.backdropEl&&(l.backdropEl.style.opacity=String(f))},m=C=>{if(!l)return;const h=l;if(l=null,h.locked!=="horizontal"){r(h);return}const v=h.lastX-h.startX,S=Math.max(1,h.lastTime-h.startTime),L=v/S;let f=!1;if(C||(h.side==="left"&&h.action==="open"?f=v>=h.width*Te||v>=Re&&L>=Le:h.side==="left"&&h.action==="close"||h.side==="right"&&h.action==="open"?f=-v>=h.width*Te||-v>=Re&&-L>=Le:h.side==="right"&&h.action==="close"&&(f=v>=h.width*Te||v>=Re&&L>=Le)),r(h),!f)return;const y=b.current;h.side==="left"?h.action==="open"?(y.setOutlineDrawerOpen(!1),y.setDrawerOpen(!0)):y.setDrawerOpen(!1):h.action==="open"?y.onOpenOutline():y.setOutlineDrawerOpen(!1)},$=()=>m(!1),R=()=>m(!0);return window.addEventListener("touchstart",x,{passive:!0}),window.addEventListener("touchmove",p,{passive:!1}),window.addEventListener("touchend",$,{passive:!0}),window.addEventListener("touchcancel",R,{passive:!0}),()=>{window.removeEventListener("touchstart",x),window.removeEventListener("touchmove",p),window.removeEventListener("touchend",$),window.removeEventListener("touchcancel",R)}},[])}const Qs=450,Ht=8;function It(s){const t=u.useRef(null),i=u.useRef(null),c=u.useRef(!1),n=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return{onTouchStart:o=>{if(o.touches.length!==1)return;const d=o.touches[0],b=o.currentTarget.closest(".tree-file-row")||o.currentTarget;i.current={x:d.clientX,y:d.clientY},c.current=!1,n(),t.current=setTimeout(()=>{var l;t.current=null,c.current=!0,(l=navigator.vibrate)==null||l.call(navigator,10),s(b.getBoundingClientRect())},Qs)},onTouchMove:o=>{if(!t.current||!i.current||o.touches.length!==1)return;const d=o.touches[0];(Math.abs(d.clientX-i.current.x)>Ht||Math.abs(d.clientY-i.current.y)>Ht)&&n()},onTouchEnd:()=>n(),onTouchCancel:()=>n(),onContextMenu:o=>{o.preventDefault();const d=o.currentTarget.closest(".tree-file-row")||o.currentTarget;s(d.getBoundingClientRect())},consumeClick:o=>c.current?(c.current=!1,o.preventDefault(),o.stopPropagation(),!0):!1}}function Ot({node:s,activePath:t,filter:i,collapsed:c,hiddenSet:n,onToggleDir:o,onSelectFile:d,onOpenMenu:b}){const l=It(x=>b(s.path,x,"dir")),r=It(x=>b(s.path,x,"file"));if(s.type==="dir"){if(n.has(s.path.toLowerCase())||n.has(s.name.toLowerCase()))return null;const x=m=>m.type==="file"?m.path.toLowerCase().includes(i):m.children.some(x);if(i&&!x(s))return null;const p=!i&&c.has(s.path);return e.jsxs("div",{children:[e.jsxs("div",{className:"tree-file-row",children:[e.jsxs("button",{className:"tree-dir-btn",title:s.path,onTouchStart:l.onTouchStart,onTouchMove:l.onTouchMove,onTouchEnd:l.onTouchEnd,onTouchCancel:l.onTouchCancel,onContextMenu:l.onContextMenu,onClick:m=>{l.consumeClick(m)||o(s.path)},children:[p?"▸ ":"▾ ",s.name]}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for folder ${s.name}`,onClick:m=>{m.stopPropagation(),b(s.path,m.currentTarget.getBoundingClientRect(),"dir")},children:"⋯"})]}),!p&&e.jsx("div",{className:"tree-children",children:s.children.map(m=>e.jsx(Ot,{node:m,activePath:t,filter:i,collapsed:c,hiddenSet:n,onToggleDir:o,onSelectFile:d,onOpenMenu:b},m.path))})]})}return i&&!s.path.toLowerCase().includes(i)?null:e.jsxs("div",{className:`tree-file-row${s.path===t?" active":""}`,children:[e.jsx("button",{className:`tree-file${s.path===t?" active":""}`,title:s.path,onTouchStart:r.onTouchStart,onTouchMove:r.onTouchMove,onTouchEnd:r.onTouchEnd,onTouchCancel:r.onTouchCancel,onContextMenu:r.onContextMenu,onClick:x=>{r.consumeClick(x)||d(s.path)},children:s.name}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for ${s.name}`,onClick:x=>{x.stopPropagation(),b(s.path,x.currentTarget.getBoundingClientRect())},children:"⋯"})]})}function Zs({drawerOpen:s,live:t,settings:i,setSettings:c,sidebarTab:n,setSidebarTab:o,gitChanges:d,searchRef:b,filter:l,setFilter:r,tree:x,activePath:p,collapsed:m,hiddenSet:$,toggleDir:R,setViewMode:C,openFile:h,openRowMenu:v,changesSort:S,setChangesSort:L,openCommitDialog:f,sortedChanges:y,loadDiff:w}){return e.jsxs("aside",{className:`sidebar${s?" open":""}`,children:[e.jsxs("div",{className:"brand",children:[e.jsxs("div",{className:"brand-title",children:[e.jsx("img",{src:"/vault-logo.svg",alt:"",width:"20",height:"20",className:"brand-logo"}),e.jsx("span",{children:"Vault"}),e.jsx("span",{className:`pill${t?"":" off"}`,children:t?"Live":"Reconnecting"})]}),e.jsx("button",{className:"icon-btn","aria-label":i.theme==="dark"?"Switch to light theme":"Switch to dark theme",title:i.theme==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>c(E=>({...E,theme:E.theme==="dark"?"light":"dark"})),children:i.theme==="dark"?e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}):e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]}),e.jsxs("div",{className:"sidebar-tabs",children:[e.jsx("button",{className:`sidebar-tab${n==="files"?" active":""}`,onClick:()=>o("files"),children:"Files"}),e.jsxs("button",{className:`sidebar-tab${n==="changes"?" active":""}`,onClick:()=>o("changes"),children:[e.jsx("span",{children:"Changes"}),d.length>0&&e.jsx("span",{className:"pill",children:d.length})]})]}),e.jsx("div",{className:"search-wrap",children:e.jsx("input",{ref:b,className:"search",type:"search",placeholder:n==="files"?"Filter files... (/)":"Filter changes...",value:l,onChange:E=>r(E.target.value.trim().toLowerCase())})}),e.jsx("div",{className:"tree",children:n==="files"?x.map(E=>e.jsx(Ot,{node:E,activePath:p,filter:l,collapsed:m,hiddenSet:$,onToggleDir:R,onSelectFile:B=>{C("preview"),h(B)},onOpenMenu:v},E.path)):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"changes-bar",children:[e.jsxs("select",{className:"changes-select","aria-label":"Sort changes",value:S,onChange:E=>L(E.target.value),children:[e.jsx("option",{value:"path",children:"Sort: Path"}),e.jsx("option",{value:"recent",children:"Sort: Recent"}),e.jsx("option",{value:"status",children:"Sort: Status"})]}),d.length>0&&e.jsx("button",{className:"btn primary",onClick:f,children:"Commit"})]}),y.length===0?e.jsx("div",{className:"empty-note",style:{padding:"10px 8px"},children:"Working tree clean"}):y.map(E=>e.jsxs("div",{className:`tree-file-row${E.path===p?" active":""}`,children:[e.jsxs("button",{className:`tree-file${E.path===p?" active":""}`,title:E.path,onClick:()=>{E.status!=="D"&&(C("diff"),h(E.path),w(E.path))},children:[e.jsx("span",{className:`git-badge git-${E.status}`,children:E.status}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:E.path})]}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for ${E.path}`,onClick:B=>{B.stopPropagation(),v(E.path,B.currentTarget.getBoundingClientRect())},children:"⋯"})]},E.path))]})})]})}function en({tabs:s,activeTabId:t,switchTab:i,closeTab:c,createNewTab:n}){return e.jsxs("div",{className:"desktop-tabs",children:[s.map(o=>e.jsxs("div",{className:`desktop-tab${o.id===t?" active":""}`,onClick:()=>i(o),children:[e.jsx("span",{className:"desktop-tab-title",children:o.title}),e.jsx("button",{className:"desktop-tab-close",onClick:d=>c(o.id,d),children:"×"})]},o.id)),e.jsx("button",{className:"desktop-tab-add",title:"New tab",onClick:n,children:"+"})]})}function tn({setDrawerOpen:s,activePath:t,moreMenuOpen:i,setMoreMenuOpen:c,viewMode:n,setViewMode:o,loadDiff:d,setDeleteError:b,setDeleteTarget:l,outlinePosition:r,outlineDrawerOpen:x,onToggleOutline:p,onOpenOutline:m}){const $=x||r!=="hidden";return e.jsxs("div",{className:"topbar",children:[e.jsxs("div",{className:"topbar-left",children:[e.jsx("button",{className:"icon-btn menu-btn","aria-label":"Toggle files",onClick:()=>s(R=>!R),children:e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M9 3v18"})]})}),e.jsx("div",{className:"crumbs",children:t||"New tab"})]}),e.jsxs("div",{className:"actions",children:[e.jsx("button",{className:`icon-btn outline-toggle-btn${$?" active":""}`,"aria-label":"Toggle outline",title:"Toggle outline & backlinks",onClick:p,children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M15 3v18"})]})}),e.jsx("button",{className:"icon-btn","aria-label":"Note options",title:"Note options",onClick:()=>c(R=>!R),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[e.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}),i&&e.jsxs("div",{className:"more-menu",onMouseLeave:()=>c(!1),children:[t&&e.jsx("a",{className:"more-item",href:`/api/v1/file?path=${encodeURIComponent(t)}&download=1`,download:t.split("/").pop(),style:{textDecoration:"none",borderBottom:"1px solid var(--border)",marginBottom:3,paddingBottom:9},onClick:()=>c(!1),children:e.jsx("span",{children:"Download"})}),e.jsxs("button",{className:`more-item${n==="preview"?" active":""}`,onClick:()=>{o("preview"),c(!1)},children:[e.jsx("span",{children:"Preview"}),n==="preview"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${n==="edit"?" active":""}`,onClick:()=>{o("edit"),c(!1)},children:[e.jsx("span",{children:"Edit"}),n==="edit"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${n==="diff"?" active":""}`,onClick:()=>{o("diff"),c(!1),d(t)},children:[e.jsx("span",{children:"Diff"}),n==="diff"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${n==="raw"?" active":""}`,onClick:()=>{o("raw"),c(!1)},children:[e.jsx("span",{children:"Raw"}),n==="raw"&&e.jsx("span",{children:"✓"})]}),e.jsx("button",{className:`more-item outline-menu-trigger${r==="hidden"?" show-desktop":""}`,style:{borderTop:"1px solid var(--border)",marginTop:3,paddingTop:9},onClick:()=>{c(!1),m()},children:e.jsx("span",{children:"Outline"})}),t&&e.jsx("button",{className:"more-item",style:{color:"#f87171",borderTop:"1px solid var(--border)",marginTop:3,paddingTop:9},onClick:()=>{c(!1),b(""),l(t)},children:e.jsx("span",{children:"Delete"})})]})]})]})}const sn="modulepreload",nn=function(s){return"/"+s},Wt={},an=function(t,i,c){let n=Promise.resolve();if(i&&i.length>0){let d=function(r){return Promise.all(r.map(x=>Promise.resolve(x).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),l=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));n=d(i.map(r=>{if(r=nn(r),r in Wt)return;Wt[r]=!0;const x=r.endsWith(".css"),p=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${p}`))return;const m=document.createElement("link");if(m.rel=x?"stylesheet":sn,x||(m.as="script"),m.crossOrigin="",m.href=r,l&&m.setAttribute("nonce",l),document.head.appendChild(m),x)return new Promise(($,R)=>{m.addEventListener("load",$),m.addEventListener("error",()=>R(new Error(`Unable to preload CSS for ${r}`)))})}))}function o(d){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=d,window.dispatchEvent(b),!b.defaultPrevented)throw d}return n.then(d=>{for(const b of d||[])b.status==="rejected"&&o(b.reason);return t().catch(o)})};function ln(s,t=","){const i=[];let c=[],n="",o=!1;for(let d=0;d<s.length;d+=1){const b=s[d];if(o){b==='"'?s[d+1]==='"'?(n+='"',d+=1):o=!1:n+=b;continue}b==='"'?o=!0:b===t?(c.push(n),n=""):b==="\r"?(s[d+1]===`
3
- `&&(d+=1),c.push(n),i.push(c),c=[],n=""):b===`
4
- `?(c.push(n),i.push(c),c=[],n=""):n+=b}return(n.length>0||c.length>0)&&(c.push(n),i.push(c)),i}const on=u.lazy(()=>an(()=>import("./TiptapEditor-OFHNcjy3.js"),__vite__mapDeps([0,1,2,3])));function rn({scrollRef:s,activePath:t,openNewNoteDialog:i,openFile:c,openSwitcher:n,setDrawerOpen:o,setSettingsOpen:d,isImg:b,isSvg:l,isMarkdown:r,isPdf:x,isAudio:p,isVideo:m,isHtml:$,isCsv:R,reloadTick:C,isBinaryDownload:h,viewMode:v,settings:S,diffData:L,requestDiscard:f,content:y,saving:w,dirty:E,setDraftContent:B,setDirty:W,saveActiveNote:U,highlightedRawHtml:Me,handleDocClick:pe,renderedHtml:G}){var ee,fe;const V=u.useMemo(()=>{if(!R||v!=="preview"||!y)return[];const I=t.toLowerCase().endsWith(".tsv")?" ":",";return ln(y,I)},[R,v,y,t]),ae=t?`/api/v1/file?path=${encodeURIComponent(t)}&t=${C}`:"",Q=t?`/api/v1/file?path=${encodeURIComponent(t)}&download=1`:"",Z=t?`/raw/${t.split("/").map(encodeURIComponent).join("/")}?t=${C}`:"";return e.jsx("div",{ref:s,className:"content-scroll",children:t?b&&!(l&&v==="raw")?e.jsx("div",{className:"doc img-wrap",children:e.jsx("img",{src:ae,alt:t})}):x?e.jsxs("div",{className:"media-viewer pdf-viewer",children:[e.jsxs("div",{className:"media-bar",children:[e.jsx("span",{children:t.split("/").pop()}),e.jsx("a",{className:"btn",href:Q,download:t.split("/").pop(),children:"Download PDF"})]}),e.jsx("iframe",{className:"pdf-frame",src:ae,title:t})]}):p?e.jsxs("div",{className:"doc binary-card audio-viewer",children:[e.jsx("div",{className:"binary-card-name",children:t.split("/").pop()}),e.jsx("div",{className:"binary-card-path",children:t}),e.jsx("audio",{controls:!0,src:ae,style:{width:"100%",maxWidth:460}}),e.jsx("a",{className:"btn",href:Q,download:t.split("/").pop(),style:{textDecoration:"none",display:"inline-flex",alignItems:"center",gap:6,marginTop:12},children:"Download audio"})]}):m?e.jsxs("div",{className:"media-viewer video-viewer",children:[e.jsxs("div",{className:"media-bar",children:[e.jsx("span",{children:t.split("/").pop()}),e.jsx("a",{className:"btn",href:Q,download:t.split("/").pop(),children:"Download video"})]}),e.jsx("video",{controls:!0,src:ae,className:"video-player"})]}):h?e.jsxs("div",{className:"doc binary-card",children:[e.jsx("div",{className:"binary-card-name",children:t.split("/").pop()}),e.jsx("div",{className:"binary-card-path",children:t}),e.jsx("a",{className:"btn primary",href:`/api/v1/file?path=${encodeURIComponent(t)}&download=1`,download:t.split("/").pop(),style:{textDecoration:"none",display:"inline-flex",alignItems:"center",gap:6},children:"Download file"})]}):v==="diff"?e.jsxs("div",{className:"diff-wrap",style:{maxWidth:`${S.maxWidth+80}px`},children:[e.jsxs("div",{className:"diff-head",children:[e.jsx("span",{style:{fontSize:13,color:"var(--muted)"},children:L!=null&&L.untracked?"Untracked file":`${((ee=L==null?void 0:L.hunks)==null?void 0:ee.length)||0} hunk(s)`}),((fe=L==null?void 0:L.hunks)==null?void 0:fe.length)>0&&e.jsx("button",{className:"btn",style:{color:"#f87171"},onClick:()=>f(),children:"Discard file"})]}),!L||L.hunks.length===0?e.jsx("div",{className:"empty-note",children:"No uncommitted changes for this file."}):L.hunks.map((I,O)=>e.jsxs("div",{className:"diff-hunk",children:[e.jsxs("div",{className:"diff-hunk-bar",children:[e.jsx("span",{children:I.header}),!L.untracked&&e.jsx("button",{className:"btn",onClick:()=>f({hunkIndex:O}),children:"Discard hunk"})]}),I.lines.map((z,H)=>e.jsxs("div",{className:`diff-line ${z.type}`,children:[e.jsx("span",{className:"diff-ln",children:z.newLine??z.oldLine??""}),e.jsx("span",{className:"diff-sig",children:z.type==="add"?"+":z.type==="del"?"-":" "}),e.jsx("span",{className:"diff-txt",children:z.text||" "}),!L.untracked&&z.type!=="context"?e.jsx("button",{className:"diff-discard-btn",title:"Discard line",onClick:()=>f({hunkIndex:O,lineIndex:H,previewText:`${z.type==="add"?"+":"-"} ${z.text}`}),children:"↺"}):e.jsx("span",{})]},H))]},O))]}):v==="edit"&&r?e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"empty-note",style:{padding:"24px"},children:"Loading editor..."}),children:e.jsx(on,{fileKey:t,content:y,fontSize:S.fontSize,lineHeight:S.lineHeight,maxWidth:S.maxWidth,saving:w,dirty:E,onChange:I=>{B(I),W(I!==y)},onSave:U})}):$&&v==="preview"?e.jsx("div",{className:"media-viewer html-viewer",children:e.jsx("iframe",{className:"html-frame",src:Z,sandbox:"allow-scripts",title:t})}):R&&v==="preview"?e.jsx("div",{className:"doc csv-wrap",style:{fontSize:`${Math.max(12,S.fontSize-1)}px`,maxWidth:`${S.maxWidth+160}px`},children:V.length===0?e.jsx("div",{className:"empty-note",children:"Empty table."}):e.jsx("div",{className:"csv-scroll",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsx("tr",{children:V[0].map((I,O)=>e.jsx("th",{children:I},O))})}),e.jsx("tbody",{children:V.slice(1).map((I,O)=>e.jsx("tr",{children:V[0].map((z,H)=>e.jsx("td",{children:I[H]??""},H))},O))})]})})}):v==="raw"||!r?e.jsx("pre",{className:"raw-view",style:{fontSize:`${Math.max(12,S.fontSize-2)}px`,maxWidth:`${S.maxWidth+80}px`},children:e.jsx("code",{className:"hljs",dangerouslySetInnerHTML:{__html:Me}})}):e.jsx("div",{className:"doc",style:{fontSize:`${S.fontSize}px`,lineHeight:S.lineHeight,maxWidth:`${S.maxWidth}px`},onClick:pe,dangerouslySetInnerHTML:{__html:G}}):e.jsxs("div",{className:"new-tab-view",children:[e.jsxs("button",{className:"new-tab-btn",onClick:()=>i(""),children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{children:"Create new note"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>c("README.md"),children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"})}),e.jsx("span",{children:"Go to README"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:n,children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]}),e.jsx("span",{children:"Go to file"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>o(!0),children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}),e.jsx("span",{children:"Browse files"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>d(!0),children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:"Settings"})]})]})})}function cn({headings:s,isImg:t,isBinaryDownload:i,viewMode:c,currentBacklinks:n,openFile:o,position:d="right",onChangePosition:b,mobileOpen:l=!1,onCloseMobile:r}){const[x,p]=u.useState(!1);if(d==="hidden"&&!l&&window.innerWidth>960)return null;const m=t?"Image preview":i?"Binary file":c==="raw"?"Raw view":c==="edit"?"Edit mode":c==="diff"?"Diff mode":"No headings";return e.jsxs("aside",{className:`rightbar${l?" mobile-open":""}`,children:[e.jsxs("div",{className:"rightbar-head",children:[e.jsx("div",{className:"panel-title",style:{margin:0},children:d==="bottom"?"Outline & Backlinks":"Outline"}),e.jsxs("div",{className:"actions",children:[e.jsx("button",{className:"icon-btn","aria-label":"Outline panel options",title:"Outline panel options",onClick:()=>p($=>!$),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[e.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}),x&&e.jsxs("div",{className:"more-menu",onMouseLeave:()=>p(!1),children:[e.jsxs("button",{className:`more-item${d==="right"?" active":""}`,onClick:()=>{b("right"),p(!1)},children:[e.jsx("span",{children:"Position: Right"}),d==="right"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${d==="bottom"?" active":""}`,onClick:()=>{b("bottom"),r==null||r(),p(!1)},children:[e.jsx("span",{children:"Position: Bottom"}),d==="bottom"&&e.jsx("span",{children:"✓"})]}),e.jsx("button",{className:"more-item",style:{borderTop:"1px solid var(--border)",marginTop:2,paddingTop:8},onClick:()=>{window.innerWidth<=960&&l?r==null||r():b("hidden"),p(!1)},children:e.jsx("span",{children:"Hide panel"})})]})]})]}),e.jsxs("div",{className:"rightbar-body",children:[e.jsxs("div",{className:"rightbar-sec",children:[e.jsx("div",{className:"panel-subtitle",children:"Outline"}),s.length===0?e.jsx("div",{className:"empty-note",children:m}):s.map(($,R)=>e.jsx("a",{className:`toc-item toc-h${$.level}`,onClick:()=>{var C;(C=document.getElementById($.id))==null||C.scrollIntoView({behavior:"smooth"}),r==null||r()},children:$.text},`${$.id}-${R}`))]}),e.jsxs("div",{className:"rightbar-sec",children:[e.jsx("div",{className:"panel-title backlinks-title",children:"Backlinks"}),n.length===0?e.jsx("div",{className:"empty-note",children:"No backlinks yet"}):n.map($=>e.jsx("a",{className:"backlink-item",onClick:()=>{o($),r==null||r()},children:$},$))]})]})]})}function dn({fabOpen:s,setFabOpen:t,openSwitcher:i,drawerOpen:c,setDrawerOpen:n,openFile:o,viewMode:d,setViewMode:b,settings:l,setSettings:r,setSettingsOpen:x,scrollRef:p,loadDiff:m,activePath:$,createNewTab:R,tabsOpen:C,setTabsOpen:h,tabs:v,activeTabId:S,switchTab:L,closeTab:f,onToggleOutline:y}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"fab-wrap",children:[s&&e.jsxs("div",{className:"fab-menu",children:[e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),i()},children:"🔍 Quick switcher"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),n(w=>!w)},children:"📁 Toggle files"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),y==null||y()},children:"📑 Toggle outline"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),o("README.md")},children:"🏠 Home (README)"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),b(w=>w==="raw"?"preview":"raw")},children:d==="raw"?"📄 Preview mode":"🧾 Raw view"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),r(w=>({...w,theme:w.theme==="dark"?"light":"dark"}))},children:l.theme==="dark"?"☀️ Light theme":"🌙 Dark theme"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),x(!0)},children:"⚙️ Settings"}),e.jsx("button",{className:"fab-item",onClick:()=>{var w;t(!1),(w=p.current)==null||w.scrollTo({top:0,behavior:"smooth"})},children:"⬆️ Scroll to top"})]}),e.jsx("button",{className:"fab-btn","aria-label":"Quick actions",onClick:()=>t(w=>!w),children:s?"×":"+"})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sheet-backdrop",onClick:()=>t(!1)}),e.jsxs("div",{className:"bottom-sheet",role:"dialog","aria-label":"Quick actions",children:[e.jsx("div",{className:"sheet-handle"}),e.jsxs("div",{className:"sheet-list",children:[e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),i()},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]}),e.jsx("span",{children:"Open quick switcher"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),n(w=>!w)},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M9 3v18"})]}),e.jsx("span",{children:"Toggle files sidebar"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),y==null||y()},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M15 3v18"})]}),e.jsx("span",{children:"Toggle outline sidebar"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),o("README.md")},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"})}),e.jsx("span",{children:"Go to Home (README)"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b(w=>w==="edit"?"preview":"edit")},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 20h9M16.5 3.5a2.12 2.12 0 1 1 3 3L7 19l-4 1 1-4Z"})}),e.jsx("span",{children:d==="edit"?"Switch to Preview mode":"Switch to Edit mode"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b("diff"),m($)},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 3v18M3 12h18"})}),e.jsx("span",{children:"View Git Diff"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b(w=>w==="raw"?"preview":"raw")},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"})}),e.jsx("span",{children:d==="raw"?"Switch to Preview mode":"Switch to Raw view"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{var w;t(!1),(w=p.current)==null||w.scrollTo({top:0,behavior:"smooth"})},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),e.jsx("span",{children:"Scroll to top"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),r(w=>({...w,theme:w.theme==="dark"?"light":"dark"}))},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}),e.jsx("span",{children:l.theme==="dark"?"Switch to Light theme":"Switch to Dark theme"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),x(!0)},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:"Settings"})]})]})]})]}),e.jsxs("nav",{className:"mobile-bar","aria-label":"Mobile quick actions",children:[e.jsx("button",{className:`mobile-bar-btn${c?" active":""}`,"aria-label":"Files",onClick:()=>{t(!1),n(w=>!w)},children:e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M9 3v18"})]})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Back",onClick:()=>window.history.back(),children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Forward",onClick:()=>window.history.forward(),children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Search",onClick:()=>{t(!1),i()},children:e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"New tab",onClick:R,children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})}),e.jsx("button",{className:`mobile-bar-btn${C?" active":""}`,"aria-label":"Open tabs",onClick:()=>{t(!1),h(!0)},children:e.jsx("span",{className:"tabs-count-badge",children:v.length})}),e.jsx("button",{className:`mobile-bar-btn${s?" active":""}`,"aria-label":"Menu",onClick:()=>t(w=>!w),children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})})]}),C&&e.jsxs("div",{className:"tabs-overlay",onClick:()=>h(!1),children:[e.jsx("div",{className:"tabs-grid",onClick:w=>w.stopPropagation(),children:v.map(w=>e.jsxs("div",{className:"tab-card-wrap",children:[e.jsxs("div",{className:`tab-card${w.id===S?" active":""}`,onClick:()=>L(w),children:[e.jsx("button",{className:"tab-card-close","aria-label":"Close tab",onClick:E=>f(w.id,E),children:"×"}),e.jsx("div",{className:"tab-card-title",children:w.title}),e.jsx("div",{className:"tab-card-preview",children:w.preview||(w.path?w.path:"Empty tab")})]}),e.jsx("div",{className:"tab-card-label",children:w.title})]},w.id))}),e.jsxs("div",{className:"tabs-footer",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{className:"tabs-footer-btn","aria-label":"New tab",onClick:R,children:"+"}),e.jsxs("span",{style:{fontSize:14,fontWeight:600},children:[v.length," ",v.length===1?"tab":"tabs"]}),e.jsx("button",{className:"tabs-footer-btn",onClick:()=>h(!1),children:"Done"})]})]})]})}function hn({switcherOpen:s,setSwitcherOpen:t,switcherTab:i,setSwitcherTab:c,switcherIdx:n,setSwitcherIdx:o,switcherInputRef:d,totalFiles:b,fileStats:l,switcherItems:r,switcherData:x,openFile:p,isLargeVault:m,pagedFiles:$,loadMorePagedFiles:R,switcherQuery:C,setSwitcherQuery:h}){return s?e.jsx("div",{className:"switcher-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"switcher",onClick:v=>v.stopPropagation(),children:[e.jsxs("div",{className:"switcher-head",children:[e.jsxs("div",{className:"switcher-tabs",children:[e.jsx("button",{className:`switcher-tab${i==="recent"?" active":""}`,onClick:()=>{var v;c("recent"),o(0),(v=d.current)==null||v.focus()},children:"Recent"}),e.jsx("button",{className:`switcher-tab${i==="alpha"?" active":""}`,onClick:()=>{var v;c("alpha"),o(0),(v=d.current)==null||v.focus()},children:"A–Z"})]}),b>l.length&&e.jsxs("span",{className:"switcher-cap",children:[l.length.toLocaleString()," / ",b.toLocaleString()," indexed"]})]}),e.jsxs("div",{className:"switcher-list",children:[r.length===0?e.jsx("div",{className:"empty-note",style:{padding:"12px"},children:"No matching notes"}):(()=>{let v=0;const S=Date.now(),L=f=>{if(!f)return"";const y=Math.max(0,S-f);return y<6e4?"now":y<36e5?`${Math.floor(y/6e4)}m`:y<864e5?`${Math.floor(y/36e5)}h`:y<7*864e5?`${Math.floor(y/864e5)}d`:new Date(f).toLocaleDateString(void 0,{month:"short",day:"numeric"})};return x.groups.map(f=>e.jsxs(Is.Fragment,{children:[f.label&&e.jsx("div",{className:"switcher-group-title",children:f.label}),f.items.map(y=>{const w=v++;return e.jsxs("button",{className:`switcher-item${w===n?" selected":""}`,onClick:()=>{t(!1),p(y.path)},children:[e.jsxs("div",{className:"switcher-row-top",children:[e.jsx("span",{className:"switcher-path",children:y.path}),y.mtimeMs>0&&e.jsx("span",{className:"switcher-time",children:L(y.mtimeMs)})]}),y.snippet&&e.jsx("span",{className:"switcher-snippet",children:y.snippet})]},y.path)})]},f.label||"all"))})(),m&&$.hasMore&&e.jsx("button",{className:"btn",style:{margin:"8px auto",display:"block"},onClick:R,children:"Load more"})]}),e.jsxs("div",{className:"switcher-input-wrap",children:[e.jsx("input",{ref:d,className:"switcher-input",type:"text",placeholder:"Find a note...",value:C,onChange:v=>{h(v.target.value),o(0)},onKeyDown:v=>{v.key==="ArrowDown"?(v.preventDefault(),o(S=>Math.min(S+1,Math.max(0,r.length-1)))):v.key==="ArrowUp"?(v.preventDefault(),o(S=>Math.max(S-1,0))):v.key==="Enter"&&r[n]&&(v.preventDefault(),t(!1),p(r[n].path))}}),e.jsx("button",{className:"switcher-clear","aria-label":"Clear or close",onClick:()=>C?h(""):t(!1),children:"×"})]})]})}):null}function mn({fileMenu:s,setFileMenu:t,openNewNoteDialog:i,uploadDirRef:c,uploadInputRef:n,setRenameError:o,setRenameTarget:d,setTabs:b,setActiveTabId:l,setViewMode:r,openFile:x,gitChanges:p,loadDiff:m,requestDiscard:$,setDeleteError:R,setDeleteTarget:C}){return s?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>t(null),children:e.jsx("div",{className:"file-ctx-menu",style:{left:s.x,top:s.y},onClick:h=>h.stopPropagation(),children:s.type==="dir"?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),i(h)},children:e.jsx("span",{children:"New note here"})}),e.jsx("button",{className:"more-item",onClick:()=>{var h;c.current=s.path,t(null),(h=n.current)==null||h.click()},children:e.jsx("span",{children:"Upload file..."})}),e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),o(""),d({type:"dir",oldPath:h,newPath:h})},children:e.jsx("span",{children:"Rename / Move"})}),e.jsx("button",{className:"more-item",onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(s.path),t(null)},children:e.jsx("span",{children:"Copy path"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path,v=`tab-${Date.now()}`;t(null),b(S=>[...S,{id:v,path:h,title:Ve(h),preview:""}]),l(v),r("preview"),x(h,!1,v)},children:e.jsx("span",{children:"Open in new tab"})}),e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),o(""),d({type:"file",oldPath:h,newPath:h})},children:e.jsx("span",{children:"Rename / Move"})}),e.jsx("button",{className:"more-item",onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(s.path),t(null)},children:e.jsx("span",{children:"Copy path"})}),s.path.endsWith(".md")&&e.jsx("button",{className:"more-item",onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(`[[${s.path.replace(/\.md$/i,"")}]]`),t(null)},children:e.jsx("span",{children:"Copy [[wikilink]]"})}),p.some(h=>h.path===s.path)&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),r("diff"),x(h),m(h)},children:e.jsx("span",{children:"View Diff"})}),e.jsx("button",{className:"more-item",style:{color:"var(--amber)"},onClick:()=>{const h=s.path;t(null),$({path:h})},children:e.jsx("span",{children:"Discard changes"})})]}),e.jsx("button",{className:"more-item",style:{color:"#f87171",borderTop:"1px solid var(--border)",marginTop:2,paddingTop:8},onClick:()=>{const h=s.path;t(null),R(""),C(h)},children:e.jsx("span",{children:"Delete"})})]})})}):null}function un({newNoteOpen:s,setNewNoteOpen:t,newNoteTitle:i,setNewNoteTitle:c,newNoteFolder:n,setNewNoteFolder:o,allFolders:d,newNoteError:b,confirmNewNote:l}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:460},onClick:r=>r.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"New note"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Title"}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:"My note title",value:i,onChange:r=>c(r.target.value),onKeyDown:r=>r.key==="Enter"&&l()})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Folder"}),e.jsx("input",{type:"text",placeholder:"(vault root) or type/select folder",value:n,onChange:r=>o(r.target.value),onKeyDown:r=>r.key==="Enter"&&l()}),e.jsx("div",{className:"folder-picker",children:d.map(r=>{const x=n.trim().replace(/^\/+|\/+$/g,"")===r;return e.jsx("button",{type:"button",className:`folder-pick-item${x?" active":""}`,onClick:()=>o(r),children:r||"/ (vault root)"},r||"__root__")})})]}),Ke(i,n)&&e.jsxs("div",{style:{fontSize:12,color:"var(--muted)",fontFamily:"var(--font-mono)"},children:["Path: ",Ke(i,n)]}),b&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:b})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:l,children:"Create note"})]})]})}):null}function pn({renameTarget:s,setRenameTarget:t,renameError:i,confirmRenameFile:c}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:440},onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Rename / Move"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"New path"}),e.jsx("input",{type:"text",value:s.newPath,onChange:n=>t(o=>({...o,newPath:n.target.value})),onKeyDown:n=>n.key==="Enter"&&c()})]}),i&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:i})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:c,children:"Rename"})]})]})}):null}function fn({deleteTarget:s,setDeleteTarget:t,deleteError:i,confirmDeleteFile:c}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:420},onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Delete file?"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{style:{fontSize:13,color:"var(--muted)"},children:["This will permanently remove ",e.jsx("strong",{style:{color:"var(--text)"},children:s})," from disk."]}),i&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:i})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn",style:{background:"#ef4444",borderColor:"#ef4444",color:"#ffffff",fontWeight:600},onClick:c,children:"Delete"})]})]})}):null}function xn({discardTarget:s,setDiscardTarget:t,discardError:i,confirmDiscard:c}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:440},onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:s.hunkIndex===void 0?"Discard file changes?":s.lineIndex===void 0?"Discard hunk?":"Discard line?"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsx("div",{style:{fontSize:13,color:"var(--muted)",marginBottom:10},children:s.path}),s.previewText&&e.jsx("div",{className:"git-output",style:{marginTop:0},children:s.previewText}),i&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:i})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn",style:{background:"#ef4444",borderColor:"#ef4444",color:"#ffffff",fontWeight:600},onClick:c,children:"Discard"})]})]})}):null}function jn({commitOpen:s,setCommitOpen:t,commitSelected:i,setCommitSelected:c,gitChanges:n,commitMessage:o,setCommitMessage:d,commitPush:b,setCommitPush:l,commitStatus:r,commitBusy:x,handleCommitSubmit:p}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Commit & Push"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Files (",i.size," selected)"]}),e.jsx("div",{className:"commit-files",children:n.map(m=>e.jsxs("label",{className:"commit-file-row",children:[e.jsx("input",{type:"checkbox",checked:i.has(m.path),onChange:$=>{c(R=>{const C=new Set(R);return $.target.checked?C.add(m.path):C.delete(m.path),C})}}),e.jsx("span",{className:`git-badge git-${m.status}`,children:m.status}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.path})]},m.path))})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Commit message"}),e.jsx("input",{type:"text",placeholder:"docs: update vault notes",value:o,onChange:m=>d(m.target.value)})]}),e.jsxs("label",{className:"toggle-row",children:[e.jsx("span",{children:"Push to remote after commit"}),e.jsx("input",{type:"checkbox",checked:b,onChange:m=>l(m.target.checked)})]}),r&&e.jsx("div",{className:"git-output",style:{color:r.ok?"var(--green)":"#f87171"},children:r.text})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Cancel"}),e.jsx("button",{className:"btn primary",disabled:x||!o.trim()||i.size===0,onClick:p,children:x?"Running...":b?"Commit & Push":"Commit"})]})]})}):null}function zt(s){return s.split(",").map(t=>t.trim().replace(/^\/+|\/+$/g,"")).filter(Boolean)}function vn({settingsOpen:s,setSettingsOpen:t,settingsTab:i,setSettingsTab:c,settings:n,setSettings:o,setCollapsed:d}){const[b,l]=u.useState(()=>n.autoCollapsed.join(", ")),[r,x]=u.useState(()=>n.hiddenFolders.join(", "));return u.useEffect(()=>{s&&(l(n.autoCollapsed.join(", ")),x(n.hiddenFolders.join(", ")))},[s]),s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",onClick:p=>p.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Settings"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsx("div",{className:"settings-tabs",children:[["general","General"],["appearance","Appearance"],["files","Files & Search"],["endpoints","API & MCP"]].map(([p,m])=>e.jsx("button",{className:`settings-tab${i===p?" active":""}`,onClick:()=>c(p),children:m},p))}),e.jsxs("div",{className:"modal-body",children:[i==="general"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"On startup / first open"}),e.jsxs("select",{value:n.startupMode,onChange:p=>o(m=>({...m,startupMode:p.target.value})),children:[e.jsx("option",{value:"readme",children:"README.md"}),e.jsx("option",{value:"last",children:"Last opened note"}),e.jsx("option",{value:"newtab",children:"New tab launcher"}),e.jsx("option",{value:"custom",children:"Custom note path"})]}),e.jsx("div",{className:"field-hint",children:"Used when opening the vault without a specific #note in the URL."})]}),n.startupMode==="custom"&&e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Custom startup note path"}),e.jsx("input",{type:"text",placeholder:"core/README.md",value:n.startupPath,onChange:p=>o(m=>({...m,startupPath:p.target.value}))})]})]}),i==="appearance"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Theme"}),e.jsxs("select",{value:n.theme,onChange:p=>o(m=>({...m,theme:p.target.value})),children:[e.jsx("option",{value:"dark",children:"Dark"}),e.jsx("option",{value:"light",children:"Light"})]})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Outline & Backlinks panel"}),e.jsxs("select",{value:n.outlinePosition,onChange:p=>o(m=>({...m,outlinePosition:p.target.value})),children:[e.jsx("option",{value:"right",children:"Right sidebar"}),e.jsx("option",{value:"bottom",children:"Bottom panel"}),e.jsx("option",{value:"hidden",children:"Hidden"})]})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Reader font size: ",n.fontSize,"px"]}),e.jsx("input",{type:"range",min:"13",max:"20",value:n.fontSize,onChange:p=>o(m=>({...m,fontSize:Number(p.target.value)}))})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Line height: ",n.lineHeight]}),e.jsx("input",{type:"range",min:"1.35",max:"2.0",step:"0.05",value:n.lineHeight,onChange:p=>o(m=>({...m,lineHeight:Number(p.target.value)}))})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Max reading width: ",n.maxWidth,"px"]}),e.jsx("input",{type:"range",min:"580",max:"980",step:"20",value:n.maxWidth,onChange:p=>o(m=>({...m,maxWidth:Number(p.target.value)}))})]})]}),i==="files"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Auto-collapsed folders (comma-separated)"}),e.jsx("input",{type:"text",placeholder:"apps, templates",value:b,onChange:p=>{const m=p.target.value;l(m);const $=zt(m);o(R=>({...R,autoCollapsed:$})),d(new Set($))},onBlur:()=>l(n.autoCollapsed.join(", "))})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Hidden folders (hide from sidebar & search)"}),e.jsx("input",{type:"text",placeholder:"ideas, templates",value:r,onChange:p=>{const m=p.target.value;x(m);const $=zt(m);o(R=>({...R,hiddenFolders:$}))},onBlur:()=>x(n.hiddenFolders.join(", "))})]}),e.jsxs("label",{className:"toggle-row",children:[e.jsx("span",{children:"Hide auto-collapsed folders from Quick Switcher"}),e.jsx("input",{type:"checkbox",checked:n.hideCollapsedInSearch,onChange:p=>o(m=>({...m,hideCollapsedInSearch:p.target.checked}))})]})]}),i==="endpoints"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"REST API (v1)"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/health"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/tree"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/file?path=README.md"}),e.jsxs("div",{className:"endpoint-box",children:["PUT / POST / PATCH /api/v1/file — ","{ path, content, append? } or { path, target, replacement, replaceAll? }"]}),e.jsx("div",{className:"endpoint-box",children:"DELETE /api/v1/file?path=..."}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/search?q=python"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/events (SSE)"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"MCP Endpoint (Streamable HTTP)"}),e.jsx("div",{className:"endpoint-box",children:"POST /mcp — tools: list_vault, read_note, search_vault, write_note, delete_note"})]})]})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>{o(ne),d(new Set(ne.autoCollapsed)),l(ne.autoCollapsed.join(", ")),x(ne.hiddenFolders.join(", "))},children:"Reset defaults"}),e.jsx("button",{className:"btn primary",onClick:()=>t(!1),children:"Done"})]})]})}):null}function gn(){const[s,t]=u.useState([]),[i,c]=u.useState([]),[n,o]=u.useState([]),[d,b]=u.useState(0),[l,r]=u.useState({}),[x,p]=u.useState(_s),[m,$]=u.useState("general"),R=Us(x),[C,h]=u.useState(()=>[{id:"tab-1",path:R,title:Ve(R),preview:""}]),[v,S]=u.useState("tab-1"),L=C.find(a=>a.id===v)||C[0],f=(L==null?void 0:L.path)||"",[y,w]=u.useState(!1),[E,B]=u.useState(""),[W,U]=u.useState("preview"),[Me,pe]=u.useState(null),[G,V]=u.useState(null),[ae,Q]=u.useState(""),[Z,ee]=u.useState(null),[fe,I]=u.useState(""),[O,z]=u.useState(null),[H,Ae]=u.useState(null),[qt,Be]=u.useState(""),[Je,Pe]=u.useState(!1),[He,Ye]=u.useState(""),[Qe,Ze]=u.useState(""),[Xt,he]=u.useState(""),et=u.useRef(null),tt=u.useRef(""),[Gt,Vt]=u.useState(!1),[bn,xe]=u.useState(""),[Kt,je]=u.useState(!1),[Jt,st]=u.useState(!1),[Yt,Qt]=u.useState("files"),[ie,nt]=u.useState([]),[ve,Zt]=u.useState("path"),[at,it]=u.useState(!1),[Ie,lt]=u.useState(""),[ot,es]=u.useState(!1),[rt,ct]=u.useState(()=>new Set),[ts,dt]=u.useState(!1),[ss,me]=u.useState(null),[ge,ns]=u.useState(""),[as,ht]=u.useState(()=>new Set(x.autoCollapsed)),[is,mt]=u.useState(!0),[be,q]=u.useState(!1),[we,le]=u.useState(!1),[ut,pt]=u.useState(!1),[ft,We]=u.useState(!1),[K,ze]=u.useState(!1),[oe,ls]=u.useState("recent"),[J,xt]=u.useState(""),[os,jt]=u.useState(0),[vt,Ne]=u.useState([]),[ke,ye]=u.useState({items:[],hasMore:!1}),[rs,cs]=u.useState(0),ds=u.useRef(null),gt=u.useRef(null),te=u.useRef(null);u.useEffect(()=>{document.documentElement.setAttribute("data-theme",x.theme),localStorage.setItem("vault-settings",JSON.stringify(x))},[x]),u.useEffect(()=>{const a=j=>{var g;if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),Ce();return}j.key==="/"&&((g=document.activeElement)==null?void 0:g.tagName)!=="INPUT"&&(j.preventDefault(),Ce()),j.key==="Escape"&&K&&ze(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[K]);function Ce(){xt(""),jt(0),Ne([]),ze(!0),setTimeout(()=>{var a;return(a=gt.current)==null?void 0:a.focus()},40)}u.useEffect(()=>{if(!K)return;const a=J.trim();if(!a){Ne([]);return}const j=setTimeout(async()=>{try{const k=await(await fetch(`/api/v1/search?q=${encodeURIComponent(a)}`)).json();Ne(k.results||[])}catch{Ne([])}},150);return()=>clearTimeout(j)},[J,K]);const Se=u.useMemo(()=>new Set(x.hiddenFolders.map(a=>a.toLowerCase())),[x.hiddenFolders]),hs=u.useMemo(()=>{const a=[""],j=g=>{for(const k of g)if(k.type==="dir"){if(Se.has(k.path.toLowerCase())||Se.has(k.name.toLowerCase()))continue;a.push(k.path),j(k.children||[])}};return j(s),a},[s,Se]),re=d>n.length;u.useEffect(()=>{if(!K||!re){ye({items:[],hasMore:!1});return}const a=oe==="alpha"?"name":"mtime",j=J.trim(),g=setTimeout(async()=>{try{const N=await(await fetch(`/api/v1/files?sort=${a}&offset=0&limit=100&q=${encodeURIComponent(j)}`)).json();ye({items:N.items||[],hasMore:!!N.hasMore})}catch{ye({items:[],hasMore:!1})}},100);return()=>clearTimeout(g)},[K,re,oe,J]);async function ms(){const a=oe==="alpha"?"name":"mtime",j=J.trim(),g=ke.items.length,N=await(await fetch(`/api/v1/files?sort=${a}&offset=${g}&limit=100&q=${encodeURIComponent(j)}`)).json();ye(T=>({items:[...T.items,...N.items||[]],hasMore:!!N.hasMore}))}const bt=u.useMemo(()=>{const a=J.trim().toLowerCase(),j=D=>{const P=D.toLowerCase();return x.hiddenFolders.some(M=>P.startsWith(M.toLowerCase()+"/"))?!0:x.hideCollapsedInSearch?x.autoCollapsed.some(M=>{const Ue=M.toLowerCase()+"/";return P.startsWith(Ue)&&!a.includes(M.toLowerCase())}):!1},g=re?ke.items:n.length>0?n:i.map(D=>({path:D,mtimeMs:0})),k=new Map(g.map(D=>[D.path,D.mtimeMs||0]));let N;if(!a)N=g.filter(D=>!j(D.path)).map(D=>({path:D.path,mtimeMs:D.mtimeMs||0,snippet:""}));else{const D=g.filter(M=>!j(M.path)&&M.path.toLowerCase().includes(a)).map(M=>({path:M.path,mtimeMs:M.mtimeMs||0,snippet:""})),P=new Set(D.map(M=>M.path));for(const M of vt)!j(M.path)&&!P.has(M.path)&&(P.add(M.path),D.push({path:M.path,mtimeMs:M.mtimeMs??k.get(M.path)??0,snippet:M.snippet||""}));N=D}const T=re?N.length:100;if(oe==="alpha"){const D=[...N].sort((P,M)=>{const Ue=P.path.split("/").pop().toLowerCase(),Hs=M.path.split("/").pop().toLowerCase();return Ue.localeCompare(Hs)||P.path.localeCompare(M.path)}).slice(0,T);return{groups:[{label:null,items:D}],items:D}}const X=[...N].sort((D,P)=>(P.mtimeMs||0)-(D.mtimeMs||0)).slice(0,T),_=Date.now(),F=new Date(_);F.setHours(0,0,0,0);const Ee=F.getTime(),_e=864e5,de=new Map([["Today",[]],["Yesterday",[]],["Last 7 days",[]],["Last 30 days",[]],["Older",[]]]);for(const D of X){const P=D.mtimeMs||0;P>=Ee?de.get("Today").push(D):P>=Ee-_e?de.get("Yesterday").push(D):P>=Ee-7*_e?de.get("Last 7 days").push(D):P>=Ee-30*_e?de.get("Last 30 days").push(D):de.get("Older").push(D)}const Lt=[],Rt=[];for(const[D,P]of de)P.length>0&&(Lt.push({label:D,items:P}),Rt.push(...P));return{groups:Lt,items:Rt}},[J,oe,re,ke.items,n,i,vt,x.autoCollapsed,x.hiddenFolders,x.hideCollapsedInSearch]),us=bt.items;async function Y(){var k;const[a,j]=await Promise.all([fetch("/api/v1/tree?limit=10000"),fetch("/api/v1/changes")]),g=await a.json();if(t(g.tree),c(g.flatFiles),o(g.fileStats||[]),b(g.totalFiles??((k=g.flatFiles)==null?void 0:k.length)??0),r(g.backlinks),j.ok){const N=await j.json();nt(N.changes||[])}}function wt(){const a=`tab-${Date.now()}`;h(j=>[...j,{id:a,path:null,title:"New tab",preview:""}]),S(a),B(""),w(!1),q(!1),pt(!1)}function Nt(a,j){j==null||j.stopPropagation(),h(g=>{const k=g.filter(N=>N.id!==a);if(k.length===0){const N={id:`tab-${Date.now()}`,path:null,title:"New tab",preview:""};return S(N.id),B(""),[N]}if(a===v){const N=k[k.length-1];S(N.id),N.path?A(N.path,!1,N.id):B("")}return k})}function kt(a){S(a.id),w(!1),a.path?A(a.path,!1,a.id):(B(""),location.hash="")}async function A(a,j=!1,g=v){var X;if(!a){B("");return}const k=((X=te.current)==null?void 0:X.scrollTop)??0;let N="";if($e(a)&&!Mt(a)||Oe(a)||qe(a)||Xe(a)||Ge(a)){if(!(await fetch(`/api/v1/file?path=${encodeURIComponent(a)}`,{method:"HEAD"})).ok)return a!=="README.md"?A("README.md",!1,g):void 0;B(""),xe(""),je(!1),$e(a)?N="[Image preview]":Oe(a)?N="[PDF document]":qe(a)?N="[Audio]":Xe(a)?N="[Video]":N="[Binary file — download]"}else{const _=await fetch(`/api/v1/file?path=${encodeURIComponent(a)}`);if(!_.ok)return a!=="README.md"?A("README.md",!1,g):void 0;const F=await _.text();B(F),xe(F),je(!1),N=F.replace(/^#+\s*/gm,"").slice(0,260)}location.hash=encodeURIComponent(a),localStorage.setItem("vault-last-path",a),h(_=>_.map(F=>F.id===g?{...F,path:a,title:Ve(a),preview:N}:F)),j?requestAnimationFrame(()=>{te.current&&(te.current.scrollTop=k)}):(q(!1),requestAnimationFrame(()=>{te.current&&(te.current.scrollTop=0)})),W==="diff"&&ce(a)}async function ce(a=f){if(!a)return;const j=await fetch(`/api/v1/git/diff?path=${encodeURIComponent(a)}`);j.ok?pe(await j.json()):pe(null)}function yt({path:a=f,hunkIndex:j,lineIndex:g,previewText:k}={}){a&&(Q(""),V({path:a,hunkIndex:j,lineIndex:g,previewText:k}))}async function ps(){if(!(G!=null&&G.path))return;const{path:a,hunkIndex:j,lineIndex:g}=G,k=await fetch("/api/v1/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,hunkIndex:j,lineIndex:g})}),N=await k.json().catch(()=>({}));k.ok?(V(null),Q(""),await Y(),a===f&&(await A(f,!0),await ce(f))):Q(N.error||"Failed to discard")}async function fs(){if(!Z)return;I("");const a=await fetch(`/api/v1/file?path=${encodeURIComponent(Z)}`,{method:"DELETE"}),j=await a.json().catch(()=>({}));if(a.ok){const g=Z;ee(null),localStorage.getItem("vault-last-path")===g&&localStorage.removeItem("vault-last-path");const k=N=>N.filter(T=>!(T.type==="file"&&T.path===g)).map(T=>T.type==="dir"?{...T,children:k(T.children||[])}:T);if(t(N=>k(N)),c(N=>N.filter(T=>T!==g)),o(N=>N.filter(T=>T.path!==g)),nt(N=>N.filter(T=>T.path!==g)),g===f){U("preview");const N=C.filter(T=>T.path!==g);if(N.length>0){const T=N[N.length-1];h(N),S(T.id),T.path?await A(T.path,!1,T.id):(B(""),location.hash="")}else await A("README.md",!1,v)}else h(N=>N.filter(T=>T.path!==g));await Y()}else I(j.error||"Failed to delete file")}async function xs(a){var X;const j=Array.from(a||[]);if(!j.length)return;const g=tt.current||"",k=new FormData;k.append("dir",g);for(const _ of j)k.append("files",_);const N=await fetch("/api/v1/file/upload",{method:"POST",body:k}),T=await N.json().catch(()=>({}));if(N.ok&&(await Y(),((X=T.uploaded)==null?void 0:X.length)===1)){const _=T.uploaded[0].path;/\.(md|markdown|txt|png|jpe?g|gif|webp|svg|ico)$/i.test(_)&&A(_)}}async function js(){if(!(H!=null&&H.oldPath)||!(H!=null&&H.newPath.trim()))return;Be("");const a=H.type==="dir",j=a?"/api/v1/dir/rename":"/api/v1/file/rename",g=H.newPath.trim().replace(/^\/+|\/+$/g,""),k=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:H.oldPath,newPath:g})}),N=await k.json().catch(()=>({}));if(k.ok){const{oldPath:T}=H;Ae(null),await Y(),a?f.startsWith(`${T}/`)&&A(`${g}${f.slice(T.length)}`):T===f&&A(g)}else Be(N.error||"Failed to rename")}function vs(a,j,g="file"){const k=window.innerWidth<=768?215:175,N=window.innerWidth<=768?310:250,T=Math.min(j.right-k,window.innerWidth-(k+12)),X=Math.min(j.bottom+4,window.innerHeight-N);z({type:g,path:a,x:Math.max(8,T),y:Math.max(8,X)})}function Ct(a=""){Ye(""),Ze(a.replace(/^\/+|\/+$/g,"")),he(""),Pe(!0)}async function gs(){const a=Ke(He,Qe);if(!a){he("Please enter a note title");return}if(i.includes(a)){he(`Already exists: ${a}`);return}he("");const j=He.trim().replace(/\.md$/i,""),g=await fetch("/api/v1/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,content:`# ${j}
5
-
6
- `})}),k=await g.json().catch(()=>({}));if(!g.ok||k.error){he(k.error||"Failed to create note");return}Pe(!1),await Y(),U("edit"),A(a)}u.useEffect(()=>{Y(),A(f)},[]),u.useEffect(()=>{const a=()=>{const j=decodeURIComponent(location.hash.slice(1)||"");j&&j!==f&&A(j)};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[f]),u.useEffect(()=>{const a=new EventSource("/api/v1/events");return a.onopen=()=>mt(!0),a.onmessage=async j=>{JSON.parse(j.data).type==="reload"&&(await Y(),cs(k=>k+1),await A(f,!0))},a.onerror=()=>mt(!1),()=>a.close()},[f]);async function bs(a){if(f){st(!0);try{(await fetch("/api/v1/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:f,content:a})})).ok&&(B(a),xe(a),je(!1))}finally{st(!1)}}}const{renderedHtml:ws,headings:Ns}=u.useMemo(()=>!Fe(f)||W!=="preview"||$e(f)||Ge(f)?{renderedHtml:"",headings:[]}:Xs(E,f,i),[E,f,W,i]),ks=u.useMemo(()=>!E||W!=="raw"&&Fe(f)?"":Gs(E,f),[E,f,W]);function ys(a){const j=a.target.closest("a.wikilink");if(j){a.preventDefault(),A(j.dataset.path);return}const g=a.target.closest("a.md-rel-link");if(g){a.preventDefault();const k=_t(f,g.dataset.href);i.includes(k)&&A(k)}}function Cs(a){ht(j=>{const g=new Set(j);return g.has(a)?g.delete(a):g.add(a),g})}const Ss=u.useMemo(()=>{const j=[...ie.filter(g=>!ge||g.path.toLowerCase().includes(ge))];return ve==="recent"?j.sort((g,k)=>(k.mtimeMs||0)-(g.mtimeMs||0)||g.path.localeCompare(k.path)):ve==="status"?j.sort((g,k)=>g.status.localeCompare(k.status)||g.path.localeCompare(k.path)):j.sort((g,k)=>g.path.localeCompare(k.path)),j},[ie,ge,ve]);function Es(){ct(new Set(ie.map(a=>a.path))),lt(""),me(null),it(!0)}async function $s(){if(Ie.trim()){dt(!0),me(null);try{const a=await fetch("/api/v1/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:Ie.trim(),files:Array.from(rt),push:ot})}),j=await a.json();!a.ok||j.error?me({ok:!1,text:j.error||"Commit failed"}):(me({ok:!0,text:j.output||"Committed successfully"}),await Y())}catch(a){me({ok:!1,text:a.message})}finally{dt(!1)}}}const Ts=l[f]||[],St=$e(f),Ls=Mt(f),Rs=Fe(f),Ds=Oe(f),Ms=qe(f),As=Xe(f),Bs=Fs(f),Ps=Os(f),Et=Ge(f),se=x.outlinePosition||"right",ue=a=>p(j=>({...j,outlinePosition:a})),$t=()=>{ue("right"),window.innerWidth<=960&&(q(!1),le(!0))},Tt=()=>{window.innerWidth<=960?se==="bottom"?(ue("hidden"),le(!1)):(se==="hidden"&&ue("right"),q(!1),le(a=>!a)):ue(se==="hidden"?"right":"hidden")};return Ys({drawerOpen:be,outlineDrawerOpen:we,outlinePosition:se,setDrawerOpen:q,onOpenOutline:$t,setOutlineDrawerOpen:le,disabled:!!(K||ft||y||at||ut||Je||H||Z||G)}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`backdrop${be||we?" open":""}`,onClick:()=>{q(!1),le(!1)}}),e.jsxs("div",{className:"app",children:[e.jsx(Zs,{drawerOpen:be,live:is,settings:x,setSettings:p,sidebarTab:Yt,setSidebarTab:Qt,gitChanges:ie,searchRef:ds,filter:ge,setFilter:ns,tree:s,activePath:f,collapsed:as,hiddenSet:Se,toggleDir:Cs,setViewMode:U,openFile:A,openRowMenu:vs,changesSort:ve,setChangesSort:Zt,openCommitDialog:Es,sortedChanges:Ss,loadDiff:ce}),e.jsxs("main",{className:"main",children:[e.jsx(en,{tabs:C,activeTabId:v,switchTab:kt,closeTab:Nt,createNewTab:wt}),e.jsxs("div",{className:`workspace-body outline-${se}`,children:[e.jsxs("div",{className:"note-pane",children:[e.jsx(tn,{setDrawerOpen:q,activePath:f,moreMenuOpen:Gt,setMoreMenuOpen:Vt,viewMode:W,setViewMode:U,loadDiff:ce,setDeleteError:I,setDeleteTarget:ee,outlinePosition:se,outlineDrawerOpen:we,onToggleOutline:Tt,onOpenOutline:$t}),e.jsx(rn,{scrollRef:te,activePath:f,openNewNoteDialog:Ct,openFile:A,openSwitcher:Ce,setDrawerOpen:q,setSettingsOpen:We,isImg:St,isSvg:Ls,isMarkdown:Rs,isPdf:Ds,isAudio:Ms,isVideo:As,isHtml:Bs,isCsv:Ps,reloadTick:rs,isBinaryDownload:Et,viewMode:W,settings:x,diffData:Me,requestDiscard:yt,content:E,saving:Jt,dirty:Kt,setDraftContent:xe,setDirty:je,saveActiveNote:bs,highlightedRawHtml:ks,handleDocClick:ys,renderedHtml:ws})]}),e.jsx(cn,{headings:Ns,isImg:St,isBinaryDownload:Et,viewMode:W,currentBacklinks:Ts,openFile:A,position:se,onChangePosition:ue,mobileOpen:we,onCloseMobile:()=>le(!1)})]})]})]}),e.jsx(dn,{fabOpen:ut,setFabOpen:pt,openSwitcher:Ce,drawerOpen:be,setDrawerOpen:q,onToggleOutline:Tt,openFile:A,viewMode:W,setViewMode:U,settings:x,setSettings:p,setSettingsOpen:We,scrollRef:te,loadDiff:ce,activePath:f,createNewTab:wt,tabsOpen:y,setTabsOpen:w,tabs:C,activeTabId:v,switchTab:kt,closeTab:Nt}),e.jsx(hn,{switcherOpen:K,setSwitcherOpen:ze,switcherTab:oe,setSwitcherTab:ls,switcherIdx:os,setSwitcherIdx:jt,switcherInputRef:gt,totalFiles:d,fileStats:n,switcherItems:us,switcherData:bt,openFile:A,isLargeVault:re,pagedFiles:ke,loadMorePagedFiles:ms,switcherQuery:J,setSwitcherQuery:xt}),e.jsx("input",{ref:et,type:"file",multiple:!0,style:{display:"none"},onChange:a=>{xs(a.target.files),a.target.value=""}}),e.jsx(mn,{fileMenu:O,setFileMenu:z,openNewNoteDialog:Ct,uploadDirRef:tt,uploadInputRef:et,setRenameError:Be,setRenameTarget:Ae,setTabs:h,setActiveTabId:S,setViewMode:U,openFile:A,gitChanges:ie,loadDiff:ce,requestDiscard:yt,setDeleteError:I,setDeleteTarget:ee}),e.jsx(un,{newNoteOpen:Je,setNewNoteOpen:Pe,newNoteTitle:He,setNewNoteTitle:Ye,newNoteFolder:Qe,setNewNoteFolder:Ze,allFolders:hs,newNoteError:Xt,confirmNewNote:gs}),e.jsx(pn,{renameTarget:H,setRenameTarget:Ae,renameError:qt,confirmRenameFile:js}),e.jsx(fn,{deleteTarget:Z,setDeleteTarget:ee,deleteError:fe,confirmDeleteFile:fs}),e.jsx(xn,{discardTarget:G,setDiscardTarget:V,discardError:ae,confirmDiscard:ps}),e.jsx(jn,{commitOpen:at,setCommitOpen:it,commitSelected:rt,setCommitSelected:ct,gitChanges:ie,commitMessage:Ie,setCommitMessage:lt,commitPush:ot,setCommitPush:es,commitStatus:ss,commitBusy:ts,handleCommitSubmit:$s}),e.jsx(vn,{settingsOpen:ft,setSettingsOpen:We,settingsTab:m,setSettingsTab:$,settings:x,setSettings:p,setCollapsed:ht})]})}Ws.createRoot(document.getElementById("root")).render(e.jsx(gn,{}));