---
title: "Notes & Docs"
description: "Application scaffold: a Notion-style workspace - a page tree, a block editor with a slash menu of text and component blocks (hints, images, tables, milestones, roadmap databases), page templates, markdown shortcuts, a floating format bar and drag to move, covers and icons, sharing, favorites and trash, and a roadmap database with table, board and gallery views, kept in the browser with defuss-storage (OPFS), searched by keywords and meaning with defuss-search and backed up into one file - built only from the shipped components."
slug: "scaffold-notes"
---

import { DocPage, PageHeader, DocText, DocLink } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="scaffold-notes" title="Notes & Docs" introStyle="max-width:44rem;">
  A Notion-style workspace as a clickdummy - "Folio". Click into any page and write: <kbd class="kbd">/</kbd> inserts a block, <kbd class="kbd">#</kbd>, <kbd class="kbd">-</kbd> or <kbd class="kbd">[]</kbd> and a space turn the line into a heading, a bullet or a to-do, selecting text shows a format bar, and the ⋮⋮ handle drags a block. Open the Product Roadmap for a database with table, board and gallery views. Every edit is kept in your browser, <kbd class="kbd">⌘K</kbd> finds a section by its words and by its meaning, and the workspace menu backs everything up into one file and imports it again. Every control is a shipped component. Part of the <DocLink href="application-scaffolds.html">Application Scaffolds</DocLink>.
</PageHeader>

<div class="flex flex-wrap items-center gap-2 mb-6">
  <a class="btn" href="app-notes.html" target="_blank" rel="noopener"><i data-lucide="maximize-2"></i> Open full screen</a>
  <a class="btn" data-variant="outline" href="#how-it-works">How it works</a>
</div>

```html example label="Notes and docs" schema="none" height="50" mode="desktop" sandbox="downloads" hint="The whole workspace in one source. Pages are routes (#/pages/roadmap…) of defuss-dom-router; the language switch in the sidebar translates the shell with defuss-i18n; the database views and the toggles are CSS state; blocks are contenteditable elements with a data-type, so turning a line into a heading or a to-do is one attribute and a prefix element. Every edit is saved with defuss-storage (OPFS - full screen keeps it across reloads, this preview has no storage), ⌘K searches every section with defuss-search: keywords at once, by meaning once the two models are loaded (Settings). The workspace menu backs the pages and the search index up into one file and imports it again." previewStyle="align-items:stretch;padding:0;"
<!-- the modules of the search's models import packages by name - this map names their pinned builds -->
<script type="importmap">
  {
    "imports": {
      "defuss-db": "https://cdn.jsdelivr.net/npm/defuss-db@2.0.2/dist/index.mjs",
      "defuss-db/client.js": "https://cdn.jsdelivr.net/npm/defuss-db@2.0.2/dist/client.mjs",
      "@huggingface/tokenizers": "https://cdn.jsdelivr.net/npm/@huggingface/tokenizers@0.2.0/dist/tokenizers.min.mjs",
      "onnxruntime-web/webgpu": "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.30.0/dist/ort.wasm.bundle.min.mjs",
      "defuss-vectorsearch/turboquant.js": "https://cdn.jsdelivr.net/npm/defuss-vectorsearch@0.4.0/dist/turboquant.mjs",
      "defuss-lexicalsearch": "https://cdn.jsdelivr.net/npm/defuss-lexicalsearch@0.4.0/dist/index.js"
    }
  }
</script>
<style>
  /* Folio: the scaffold's own glue - layout and the editor look. Every control
     is a shipped component (Sidebar, Tree View, Toolbar, Context Menu, Command,
     Dropdown, Popover, Sheet, Table, Select, Switch, Badge, Avatar, Kbd,
     Toast); the editor itself is contenteditable blocks */
  .nt {
    --nt-blue: oklch(0.6 0.15 245);
    container: nt / inline-size;
    position: relative;
    display: flex;
    width: 100%;
    height: var(--scaffold-height, 50rem);
    overflow: hidden;
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
  }

  /* sidebar */
  .nt .app-sidebar {
    position: relative;
    height: 100%;
    flex: none;
  }
  .nt-sb-head {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }
  .nt-ws {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.3125rem 0.375rem;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    &:hover {
      background: var(--sidebar-accent);
    }
    &:focus-visible {
      outline: 2px solid var(--sidebar-ring);
      outline-offset: -2px;
    }
    & > svg {
      width: 0.875rem;
      height: 0.875rem;
      color: var(--muted-foreground);
    }
  }
  .nt-locale {
    margin-block-end: 0.375rem;
  }
  .nt-sidebar[data-state='collapsed'] :is(.nt-locale, .nt-saved) {
    display: none;
  }
  .nt-ws-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nt-logo {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 0.375rem;
    background: var(--foreground);
    color: var(--background);
  }
  .nt .sidebar-link {
    width: 100%;
    border: 0;
    background: none;
    font: inherit;
    text-align: start;
    cursor: pointer;
  }
  .nt-kbd {
    margin-inline-start: auto;
  }
  .nt-tree {
    margin: 0;
    padding: 0;
    & .tree-leaf,
    & .tree-branch-trigger {
      gap: 0.375rem;
      color: inherit;
      text-decoration: none;
    }
  }
  .nt-tree-icon {
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    flex: none;
    font-size: 0.9375rem;
  }
  .nt-add-page {
    color: var(--muted-foreground);
  }
  .nt-expand {
    position: absolute;
    top: 0.625rem;
    left: 0.5rem;
    z-index: 2;
    display: none;
  }
  .nt:has(#nt-sidebar[data-state='collapsed']) {
    & #nt-sidebar {
      display: none;
    }
    & .nt-expand {
      display: inline-flex;
    }
    & .nt-top {
      padding-inline-start: 3rem;
    }
  }

  /* pages: the route's page is shown, the others are hidden */
  .nt-main {
    flex: 1;
    min-width: 0;
  }
  .nt-pages {
    height: 100%;
  }
  .nt-page {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .nt-page:not([hidden]) {
    display: flex;
    animation: nt-in 180ms ease both;
  }
  @keyframes nt-in {
    from {
      opacity: 0;
    }
  }
  .nt-top {
    display: flex;
    flex: none;
    align-items: center;
    gap: 0.25rem;
    height: 2.75rem;
    padding-inline: 0.75rem;
  }
  .nt-top .breadcrumb {
    min-width: 0;
    overflow: hidden;
  }
  .nt-top .breadcrumb-list {
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .nt-spacer {
    flex: 1;
  }
  /* filtered, trashed: hidden wins over any display the parts set */
  .nt [hidden] {
    display: none !important;
  }
  .nt-muted,
  .nt-edited {
    color: var(--muted-foreground);
  }
  .nt-edited {
    margin-inline-end: 0.25rem;
    font-size: 0.8125rem;
    white-space: nowrap;
  }
  .nt-mobile-trigger {
    display: none;
  }
  .nt-star[aria-pressed='true'] {
    color: oklch(0.78 0.16 80);
    & svg {
      fill: currentColor;
    }
  }
  .nt-danger {
    color: var(--destructive);
  }
  .nt-trashed {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: color-mix(in oklab, var(--destructive) 85%, black);
    color: #fff;
    font-size: 0.8125rem;
    & svg {
      width: 1rem;
      height: 1rem;
    }
  }
  .nt-page[data-trashed] .nt-trashed {
    display: flex;
  }
  .nt-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .nt-cover {
    position: relative;
    height: clamp(8rem, 28cqi, 15rem);
    & img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .nt-cover-actions {
    position: absolute;
    right: clamp(1rem, 8cqi, 6rem);
    bottom: 0.75rem;
    opacity: 0;
    transition: opacity 150ms ease;
  }
  .nt-cover:hover .nt-cover-actions,
  .nt-cover:focus-within .nt-cover-actions {
    opacity: 1;
  }
  .nt-doc {
    --nt-w: 44rem;
    position: relative;
    width: min(var(--nt-w), 100% - 2 * clamp(1.5rem, 8cqi, 6rem));
    margin-inline: auto;
    padding-block: 1.5rem 30vh;
  }
  .nt-page[data-full] .nt-doc {
    --nt-w: 100%;
  }
  .nt-page[data-small] .nt-doc {
    font-size: 0.8125rem;
  }
  .nt-page[data-font='serif'] .nt-doc {
    font-family: var(--font-serif);
  }
  .nt-page[data-font='mono'] .nt-doc {
    font-family: var(--font-mono);
  }
  .nt-cover + .nt-doc {
    padding-block-start: 0;
  }
  .nt-doc-actions {
    display: flex;
    gap: 0.25rem;
    min-height: 2rem;
    margin-block-end: 0.25rem;
    opacity: 0;
    transition: opacity 150ms ease;
    & .btn {
      color: var(--muted-foreground);
    }
  }
  .nt-doc:hover .nt-doc-actions,
  .nt-doc-actions:focus-within {
    opacity: 1;
  }
  .nt-cover + .nt-doc .nt-doc-actions {
    position: absolute;
    top: 0.5rem;
    left: 6rem;
  }
  .nt-icon {
    display: block;
    margin-block-end: 0.5rem;
    padding: 0.25rem;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    font-size: 4.25rem;
    line-height: 1;
    cursor: pointer;
    &:hover {
      background: var(--muted);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
    }
  }
  .nt-cover + .nt-doc .nt-icon {
    margin-block-start: -2.75rem;
    position: relative;
  }
  .nt-title {
    margin: 0 0 0.75rem;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    outline: none;
  }
  .nt-page[data-small] .nt-title {
    font-size: 2rem;
  }
  [contenteditable][data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: color-mix(in oklch, var(--muted-foreground) 60%, transparent);
    pointer-events: none;
  }
  .nt-starter {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.125rem;
    margin-block-end: 1rem;
    color: var(--muted-foreground);
    & p {
      margin: 0 0 0.5rem;
      grid-column: 1 / -1;
    }
    & button {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.375rem 0.5rem;
      border: 0;
      border-radius: var(--radius-md);
      background: none;
      color: inherit;
      font: inherit;
      cursor: pointer;
    }
    & button:hover,
    & button:focus-visible {
      background: var(--muted);
      color: var(--foreground);
      outline: none;
    }
    & svg {
      width: 1rem;
      height: 1rem;
    }
  }

  /* blocks */
  .nt-blocks {
    counter-reset: nt-n;
  }
  .nt-block {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.375rem;
    margin-block: 1px;
    padding: 0.1875rem 0.125rem;
    border-radius: var(--radius-sm);
  }
  .nt-text {
    flex: 1;
    min-width: 0;
    min-height: 1.5em;
    line-height: 1.6;
    outline: none;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    & code {
      padding: 0.0625rem 0.3125rem;
      border-radius: 0.25rem;
      background: color-mix(in oklch, var(--muted) 90%, var(--foreground) 4%);
      color: oklch(0.6 0.19 25);
      font-family: var(--font-mono);
      font-size: 0.85em;
    }
    & mark {
      padding: 0 0.125rem;
      border-radius: 0.1875rem;
      background: oklch(0.92 0.12 95);
      color: inherit;
    }
    & a {
      color: inherit;
    }
  }
  .dark .nt-text mark {
    background: oklch(0.45 0.09 95);
  }
  .nt-text[data-placeholder]:empty::before {
    content: none;
  }
  .nt-text:focus:empty::before,
  .nt-block:is(
      [data-type='h1'],
      [data-type='h2'],
      [data-type='h3'],
      [data-type='toggle'],
      [data-type='todo'],
      [data-type='bullet'],
      [data-type='number'],
      [data-type='quote'],
      [data-type='callout'],
      [data-type='code']
    )
    > .nt-text:empty::before {
    content: attr(data-placeholder);
    color: color-mix(in oklch, var(--muted-foreground) 60%, transparent);
  }
  .nt-block[data-type='h1'] {
    margin-block-start: 1.5rem;
    & > .nt-text {
      font-size: 1.875em;
      font-weight: 700;
      line-height: 1.3;
    }
  }
  .nt-block[data-type='h2'] {
    margin-block-start: 1.25rem;
    & > .nt-text {
      font-size: 1.5em;
      font-weight: 650;
      line-height: 1.3;
    }
  }
  .nt-block[data-type='h3'] {
    margin-block-start: 0.75rem;
    & > .nt-text {
      font-size: 1.25em;
      font-weight: 600;
      line-height: 1.3;
    }
  }
  .nt-check {
    margin-block-start: 0.25em;
  }
  .nt-block[data-type='todo']:has(> .nt-check:checked) > .nt-text {
    color: var(--muted-foreground);
    text-decoration: line-through;
  }
  .nt-block[data-type='bullet']::before {
    content: '•';
    width: 1.25rem;
    flex: none;
    text-align: center;
    font-size: 1.25em;
    line-height: 1.3;
  }
  .nt-block[data-type='number'] {
    counter-increment: nt-n;
  }
  :not(.nt-block[data-type='number']) + .nt-block[data-type='number'],
  .nt-block[data-type='number']:first-child {
    counter-reset: nt-n;
    counter-increment: nt-n;
  }
  .nt-block[data-type='number']::before {
    content: counter(nt-n) '.';
    min-width: 1.25rem;
    flex: none;
    text-align: end;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
  }
  .nt-arrow {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.375rem;
    height: 1.375rem;
    margin-block-start: 0.0625rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: inherit;
    cursor: pointer;
    &::before {
      content: '';
      width: 0.75rem;
      height: 0.75rem;
      background: currentColor;
      mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E")
        center / contain no-repeat;
      transition: rotate 150ms ease;
    }
    &[aria-expanded='true']::before {
      rotate: 90deg;
    }
    &:hover {
      background: var(--muted);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
    }
  }
  .nt-children {
    flex-basis: 100%;
    padding-inline-start: 1.625rem;
  }
  .nt-block[data-type='toggle']:not([data-open]) > .nt-children {
    display: none;
  }
  .nt-block[data-type='quote'] > .nt-text {
    padding-inline-start: 0.875rem;
    border-inline-start: 3px solid currentColor;
    font-size: 1.1em;
  }
  .nt-block[data-type='callout'] {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: color-mix(in oklch, var(--muted) 75%, transparent);
  }
  .nt-emoji {
    font-size: 1.25rem;
    line-height: 1.2;
  }
  .nt-block[data-type='divider'] {
    padding-block: 0.625rem;
    & > .nt-text {
      display: none;
    }
    &::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border);
    }
  }
  .nt-block[data-type='code'] > .nt-text {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    background: color-mix(in oklch, var(--muted) 80%, transparent);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    tab-size: 2;
  }
  .nt-figure {
    flex: 1;
    margin: 0.25rem 0;
    & img {
      display: block;
      width: 100%;
      border-radius: var(--radius-md);
    }
    & figcaption {
      margin-block-start: 0.375rem;
      color: var(--muted-foreground);
      font-size: 0.8125rem;
    }
  }
  /* the component blocks: a hint (Alert), an image, a table (Table), milestones (Timeline), a roadmap database */
  .nt-figure {
    position: relative;
  }
  .nt-image-empty {
    display: grid;
    place-items: center;
    min-height: 7rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in oklch, var(--muted) 50%, transparent);
  }
  .nt-image-actions {
    position: absolute;
    inset-block-start: 0.5rem;
    inset-inline-end: 0.5rem;
    opacity: 0;
    transition: opacity 0.15s;
  }
  .nt-figure:is(:hover, :focus-within) .nt-image-actions {
    opacity: 1;
  }
  .nt-image-pick {
    width: 21rem;
    padding: 0.5rem;
    & .nt-menu-heading {
      margin: 0.25rem 0.25rem 0.375rem;
    }
    & form {
      display: flex;
      gap: 0.375rem;
      margin-block-end: 0.5rem;
    }
  }
  .nt-image-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.375rem;
    & button {
      padding: 0;
      border: 0;
      border-radius: var(--radius-sm);
      background: none;
      cursor: pointer;
      overflow: hidden;
    }
    & img {
      display: block;
      width: 100%;
      aspect-ratio: 16 / 10;
      object-fit: cover;
    }
    & button:hover img,
    & button:focus-visible img {
      outline: 2px solid var(--ring);
      outline-offset: -2px;
    }
  }
  .nt-upload {
    position: relative;
    margin-block-end: 0.5rem;
    cursor: pointer;
    & input {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
    }
    &:has(input:focus-visible) {
      outline: 2px solid var(--ring);
    }
  }
  .nt-block[data-type='hint'] > .nt-hint {
    flex: 1;
    min-width: 0;
    margin-block: 0.25rem;
    & .alert-description {
      margin-block-start: 0.125rem;
      color: var(--foreground);
      font-size: 0.875rem;
    }
  }
  .nt-hint[data-tone='note'] {
    border-color: color-mix(in oklab, var(--nt-blue) 45%, var(--border));
    background: color-mix(in oklab, var(--nt-blue) 6%, var(--background));
    & :is(.alert-icon, .alert-title) {
      color: var(--nt-blue);
    }
  }
  /* literal greens and ambers (the theme has no success or warning token), mixed in oklab: an oklch mix with a
     white background turned the green pink */
  .nt-hint[data-tone='tip'] {
    border-color: color-mix(in oklab, oklch(0.6 0.15 150) 45%, var(--border));
    background: color-mix(in oklab, oklch(0.6 0.15 150) 6%, var(--background));
    & :is(.alert-icon, .alert-title) {
      color: oklch(0.55 0.15 150);
    }
  }
  .nt-hint[data-tone='warning'] {
    border-color: color-mix(in oklab, oklch(0.75 0.16 75) 60%, var(--border));
    background: color-mix(in oklab, oklch(0.75 0.16 75) 8%, var(--background));
    & :is(.alert-icon, .alert-title) {
      color: oklch(0.58 0.14 65);
    }
  }
  .dark .nt-hint[data-tone='tip'] :is(.alert-icon, .alert-title) {
    color: oklch(0.75 0.15 150);
  }
  .dark .nt-hint[data-tone='warning'] :is(.alert-icon, .alert-title) {
    color: oklch(0.8 0.15 75);
  }
  .nt-hint[data-tone='caution'] {
    background: color-mix(in oklab, var(--destructive) 6%, var(--background));
    & .alert-description {
      opacity: 1;
      color: var(--foreground);
    }
  }
  .nt-part {
    flex: 1;
    min-width: 0;
    margin-block: 0.25rem;
  }
  .nt-part-actions {
    display: flex;
    gap: 0.25rem;
    margin-block-start: 0.25rem;
    opacity: 0.6;
    &:is(:hover, :focus-within) {
      opacity: 1;
    }
  }
  .nt-table .table-container {
    overflow-x: auto;
  }
  .nt-table :is(.table-head, .table-cell) {
    min-width: 7rem;
    border-inline-end: 1px solid var(--border);
    vertical-align: top;
    &:last-child {
      border-inline-end: 0;
    }
    &:focus {
      outline: 2px solid var(--ring);
      outline-offset: -2px;
    }
  }
  .nt-milestones .timeline {
    padding-block: 0.25rem;
  }
  .nt-milestones .timeline-dot {
    padding: 0;
    border: 0;
    cursor: pointer;
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
  }
  .nt-milestones :is(.timeline-title, .timeline-time) {
    min-height: 1lh;
    outline: none;
  }
  .nt-block[data-type='db'] > .nt-db {
    flex: 1;
    min-width: 0;
  }
  .nt-block-menu[data-kind='part'] :is([data-turn], .nt-turn) {
    display: none;
  }
  .nt-block-menu[data-kind='db'] :is([data-turn], .nt-turn, [data-act='dup']) {
    display: none;
  }
  .nt-pagelink {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    color: inherit;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: color-mix(in oklch, currentColor 30%, transparent);
    text-underline-offset: 3px;
    &:hover {
      background: var(--muted);
    }
  }
  .nt-grip-hint {
    color: var(--muted-foreground);
    letter-spacing: -0.15em;
  }

  /* the gutter: + and ⋮⋮ appear on hover */
  .nt-gutter {
    position: absolute;
    top: 0.25rem;
    right: 100%;
    display: flex;
    gap: 0.0625rem;
    padding-inline-end: 0.25rem;
    opacity: 0;
    transition: opacity 120ms ease;
  }
  .nt-block:hover:not(:has(.nt-block:hover)) > .nt-gutter,
  .nt-gutter:focus-within {
    opacity: 1;
  }
  .nt-block:is([data-type='h1'], [data-type='h2']) > .nt-gutter {
    top: 0.5rem;
  }
  .nt-add,
  .nt-grip {
    display: grid;
    place-items: center;
    width: 1.375rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    &::before {
      content: '';
      width: 1rem;
      height: 1rem;
      background: currentColor;
      mask: var(--nt-glyph) center / contain no-repeat;
    }
    &:hover {
      background: var(--muted);
      color: var(--foreground);
    }
  }
  .nt-add {
    --nt-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  }
  .nt-grip {
    --nt-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Cg fill='black'%3E%3Ccircle cx='3' cy='3' r='1.4'/%3E%3Ccircle cx='7' cy='3' r='1.4'/%3E%3Ccircle cx='3' cy='8' r='1.4'/%3E%3Ccircle cx='7' cy='8' r='1.4'/%3E%3Ccircle cx='3' cy='13' r='1.4'/%3E%3Ccircle cx='7' cy='13' r='1.4'/%3E%3C/g%3E%3C/svg%3E");
    width: 1.125rem;
    cursor: grab;
    &::before {
      width: 0.625rem;
    }
  }
  .nt-block[data-drop='before'] {
    box-shadow: 0 -2px 0 color-mix(in oklch, var(--nt-blue) 70%, transparent);
  }
  .nt-block[data-drop='after'] {
    box-shadow: 0 2px 0 color-mix(in oklch, var(--nt-blue) 70%, transparent);
  }
  .nt-block[data-dragging] {
    opacity: 0.4;
  }
  .nt-block[data-selected] {
    background: color-mix(in oklch, var(--nt-blue) 14%, transparent);
  }

  /* floating format bar + menus */
  .nt-format {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    overflow: visible;
    & .toolbar {
      box-shadow: var(--shadow-lg);
    }
  }
  .nt-slash,
  .nt-block-menu {
    width: 18rem;
    max-height: min(22rem, 70vh);
    overflow-y: auto;
  }
  .nt-block-menu {
    width: 13rem;
    & .context-menu-item {
      gap: 0.625rem;
    }
    & svg {
      width: 0.875rem;
      height: 0.875rem;
    }
  }
  .nt-menu-heading {
    margin: 0.375rem 0.5rem 0.25rem;
    color: var(--muted-foreground);
    font-size: 0.6875rem;
    font-weight: 600;
  }
  .nt-slash-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    & > span:last-child {
      display: grid;
      text-align: start;
    }
    & strong {
      font-weight: 500;
    }
    & small {
      color: var(--muted-foreground);
      font-size: 0.6875rem;
    }
    &[hidden] {
      display: none;
    }
    &[data-active] {
      background: var(--accent);
      color: var(--accent-foreground);
    }
  }
  .nt-slash-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
    & svg {
      width: 1.125rem;
      height: 1.125rem;
    }
  }
  .nt-slash-empty {
    display: none;
    margin: 0.5rem;
    color: var(--muted-foreground);
  }
  .nt-slash:not(:has(.nt-slash-item:not([hidden]))) .nt-slash-empty {
    display: block;
  }

  .nt-share {
    width: 24rem;
    padding: 0.75rem;
    gap: 0.75rem;
    /* only while open: a display on the closed popover beats the browser's hiding, and the closed (transparent)
       panel took the clicks at the top right of every page */
    &:popover-open {
      display: grid;
    }
  }
  .nt-share-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    & .nt-muted {
      font-size: 0.75rem;
    }
  }
  .nt-share-invite {
    display: flex;
    gap: 0.5rem;
    & .input {
      flex: 1;
      height: 2rem;
    }
  }
  .nt-share-people {
    margin: 0;
    padding: 0;
    list-style: none;
    & li {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      align-items: center;
      gap: 0.625rem;
      font-size: 0.8125rem;
    }
    & li > span:nth-child(2) {
      display: grid;
    }
    & small {
      color: var(--muted-foreground);
    }
  }
  .nt-share-web {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-block-start: 0.75rem;
    border-block-start: 1px solid var(--border);
    cursor: pointer;
    & > span {
      display: flex;
      align-items: center;
      gap: 0.625rem;
    }
    & > span > span {
      display: grid;
    }
    & svg {
      width: 1.125rem;
      height: 1.125rem;
      color: var(--muted-foreground);
    }
    & small {
      color: var(--muted-foreground);
      font-size: 0.75rem;
    }
  }
  .nt-share-foot {
    display: flex;
    justify-content: flex-end;
  }
  .nt-blue {
    background: var(--nt-blue);
    color: #fff;
    &:hover {
      background: color-mix(in oklab, var(--nt-blue) 85%, black);
    }
  }
  .nt-emojis {
    width: 17rem;
    padding: 0.5rem;
  }
  .nt-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.125rem;
    & button {
      display: grid;
      place-items: center;
      aspect-ratio: 1;
      padding: 0;
      border: 0;
      border-radius: var(--radius-md);
      background: none;
      font-size: 1.25rem;
      cursor: pointer;
    }
    & button:hover,
    & button:focus-visible {
      background: var(--accent);
      outline: none;
    }
  }
  .nt-trash {
    width: 18rem;
    padding: 0.5rem;
    & ul {
      display: grid;
      gap: 0.125rem;
      margin: 0;
      padding: 0;
      list-style: none;
    }
    & li {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.25rem 0.375rem;
      border-radius: var(--radius-md);
    }
    & li:hover {
      background: var(--muted);
    }
    & li > span {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  .nt-trash-empty {
    margin: 0.5rem;
    color: var(--muted-foreground);
    font-size: 0.8125rem;
  }
  .nt-trash:has(li) .nt-trash-empty {
    display: none;
  }

  /* the database */
  .nt-db-block {
    display: block;
    padding: 0;
  }
  .nt-db {
    display: grid;
    gap: 0.5rem;
    margin-block: 0.75rem;
  }
  .nt-db-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding-block-end: 0.5rem;
    border-block-end: 1px solid var(--border);
  }
  .nt-db-views {
    display: flex;
    gap: 0.125rem;
    & label {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 0.375rem;
      padding: 0.3125rem 0.5rem;
      border-radius: var(--radius-md);
      color: var(--muted-foreground);
      font-weight: 500;
      cursor: pointer;
    }
    & input {
      position: absolute;
      inset: 0;
      margin: 0;
      opacity: 0;
      cursor: pointer;
    }
    & svg {
      width: 0.9375rem;
      height: 0.9375rem;
    }
    & label:hover {
      background: var(--muted);
    }
    & label:has(:checked) {
      color: var(--foreground);
      box-shadow: inset 0 -2px 0 var(--foreground);
      border-radius: 0;
    }
    & label:has(:focus-visible) {
      outline: 2px solid var(--ring);
    }
  }
  .nt-db-search {
    position: relative;
    & svg {
      position: absolute;
      inset-inline-start: 0.5rem;
      top: 50%;
      translate: 0 -50%;
      width: 0.875rem;
      height: 0.875rem;
      color: var(--muted-foreground);
      pointer-events: none;
    }
    & .input {
      width: 11rem;
      height: 1.875rem;
      padding-inline-start: 1.75rem;
      font-size: 0.8125rem;
    }
  }
  .nt-db-board,
  .nt-db-gallery {
    display: none;
  }
  .nt-db:has(input[value='board']:checked) {
    & .nt-db-table {
      display: none;
    }
    & .nt-db-board {
      display: grid;
    }
  }
  .nt-db:has(input[value='gallery']:checked) {
    & .nt-db-table {
      display: none;
    }
    & .nt-db-gallery {
      display: grid;
    }
  }
  .nt-db-table .table {
    font-size: 0.8125rem;
  }
  .nt-db-table :is(th, td) {
    white-space: nowrap;
    text-align: start;
  }
  .nt-db-table thead th {
    color: var(--muted-foreground);
    font-weight: 500;
    & svg {
      width: 0.875rem;
      height: 0.875rem;
      margin-inline-end: 0.375rem;
      vertical-align: -0.125rem;
    }
  }
  .nt-db-open {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    & > svg {
      width: 1rem;
      height: 1rem;
      color: var(--muted-foreground);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
      border-radius: 0.25rem;
    }
  }
  .nt-open-hint {
    padding: 0.0625rem 0.375rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--muted-foreground);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0;
  }
  tr:hover .nt-open-hint,
  .nt-db-open:focus-visible .nt-open-hint {
    opacity: 1;
  }
  .nt-person {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
    & .avatar {
      width: 1.25rem;
      height: 1.25rem;
    }
  }
  .nt-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .nt-tag {
    border-radius: 0.25rem;
    font-weight: 500;
    background: var(--nt-tag, var(--muted));
    color: var(--foreground);
  }
  [data-tag='editor'] {
    --nt-tag: oklch(0.9 0.05 245);
  }
  [data-tag='sync'] {
    --nt-tag: oklch(0.9 0.06 300);
  }
  [data-tag='api'] {
    --nt-tag: oklch(0.9 0.07 150);
  }
  [data-tag='mobile'] {
    --nt-tag: oklch(0.92 0.07 75);
  }
  [data-tag='ai'] {
    --nt-tag: oklch(0.9 0.07 20);
  }
  .dark [data-tag] {
    --nt-tag: color-mix(in oklab, var(--muted) 70%, var(--nt-tag-dark, var(--muted-foreground)));
  }
  /* statuses: grey, blue, green */
  [data-status='todo'],
  [data-s='todo'] {
    --nt-s: oklch(0.6 0.01 260);
  }
  [data-status='doing'],
  [data-s='doing'] {
    --nt-s: oklch(0.6 0.15 245);
  }
  [data-status='done'],
  [data-s='done'] {
    --nt-s: oklch(0.62 0.15 150);
  }
  .nt-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--nt-s, var(--muted-foreground)) 16%, transparent);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    &::before {
      content: '';
      width: 0.4375rem;
      height: 0.4375rem;
      border-radius: 50%;
      background: var(--nt-s, var(--muted-foreground));
    }
  }
  .nt-status {
    width: auto;
    height: 1.625rem;
    padding-block: 0;
    border-color: transparent;
    border-radius: 999px;
    background-color: color-mix(in oklab, var(--nt-s) 16%, transparent);
    box-shadow: none;
    font-size: 0.75rem;
    font-weight: 500;
  }
  .nt-db-add {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.4375rem 0.5rem;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: var(--muted-foreground);
    font: inherit;
    font-size: 0.8125rem;
    text-align: start;
    cursor: pointer;
    & svg {
      width: 0.875rem;
      height: 0.875rem;
    }
    &:hover {
      background: var(--muted);
      color: var(--foreground);
    }
  }
  .nt-db-board {
    grid-template-columns: repeat(3, minmax(14rem, 1fr));
    gap: 0.75rem;
    overflow-x: auto;
  }
  .nt-col {
    display: grid;
    align-content: start;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    background: color-mix(in oklab, var(--nt-s) 6%, transparent);
    transition: box-shadow 150ms ease;
    & header {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.125rem 0.25rem;
    }
    &[data-over] {
      box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--nt-s) 60%, transparent);
    }
  }
  .nt-count {
    color: var(--muted-foreground);
    font-size: 0.75rem;
  }
  .nt-cards {
    display: grid;
    gap: 0.5rem;
    min-height: 2.5rem;
  }
  .nt-card,
  .nt-gcard {
    display: grid;
    gap: 0.5rem;
    justify-items: start;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--card-foreground);
    box-shadow: var(--shadow-2xs);
    font: inherit;
    text-align: start;
    cursor: pointer;
    &:hover {
      background: color-mix(in oklch, var(--muted) 40%, var(--card));
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 1px;
    }
    &[data-dragging] {
      opacity: 0.45;
    }
  }
  .nt-card {
    cursor: grab;
  }
  .nt-card-name {
    font-weight: 600;
  }
  .nt-db-gallery {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.75rem;
  }
  .nt-gcard {
    padding: 0;
    overflow: hidden;
    & img {
      width: 100%;
      height: 7.5rem;
      object-fit: cover;
    }
  }
  .nt-gcard-body {
    display: grid;
    justify-items: start;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem 0.75rem;
  }

  /* the peek */
  .nt-peek {
    width: min(36rem, 100%);
  }
  .nt-peek-body {
    display: grid;
    align-content: start;
    gap: 1rem;
    padding: 2.5rem 2rem;
  }
  .nt-peek-title {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
    outline: none;
  }
  .nt-props {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    & > div {
      display: grid;
      grid-template-columns: 8rem minmax(0, 1fr);
      align-items: center;
      min-height: 2.125rem;
    }
    & dt {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      color: var(--muted-foreground);
      font-size: 0.8125rem;
      & svg {
        width: 0.9375rem;
        height: 0.9375rem;
      }
    }
    & dd {
      margin: 0;
    }
    & .select:not(.nt-status),
    & .input {
      width: auto;
      height: 1.875rem;
      border-color: transparent;
      background-color: transparent;
      box-shadow: none;
      font-size: 0.8125rem;
    }
    & .select:not(.nt-status):hover,
    & .input:hover {
      border-color: var(--border);
    }
  }
  .nt-peek-text {
    min-height: 6rem;
    padding-block-start: 1rem;
    border-block-start: 1px solid var(--border);
    line-height: 1.65;
    outline: none;
  }

  @container nt (max-width: 44rem) {
    .nt .app-sidebar,
    .nt .nt-expand {
      display: none;
    }
    .nt-mobile-trigger {
      display: inline-flex;
    }
    .nt-edited,
    .nt-doc-actions {
      display: none;
    }
    .nt-doc {
      width: calc(100% - 2.5rem);
    }
    .nt-title {
      font-size: 2rem;
    }
    .nt-gutter {
      display: none;
    }
    .nt-db-board {
      grid-template-columns: repeat(3, 15rem);
    }
    .nt-db-search .input {
      width: 8rem;
    }
  }
  /* storage: the stored workspace replaces the sample before anyone sees it - at most 3 s, then the sample shows */
  .nt[data-nt-store='loading'] .nt-pages {
    visibility: hidden;
    animation: nt-reveal 0s 3s forwards;
  }
  @keyframes nt-reveal {
    to {
      visibility: visible;
    }
  }
  .nt-saved {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0 0 0.375rem;
    padding-inline: 0.5rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    &::before {
      content: '';
      flex: none;
      width: 0.4375rem;
      height: 0.4375rem;
      border-radius: 50%;
      background: oklch(0.65 0.15 150);
    }
    &[data-state='saving']::before {
      background: var(--muted-foreground);
    }
    &:is([data-state='memory'], [data-state='error'])::before {
      background: oklch(0.75 0.16 70);
    }
    &:empty {
      display: none;
    }
  }

  /* search: hits ranked by defuss-search - the page, the section, a snippet and how each was found */
  .nt .nt-hit {
    align-items: flex-start;
    & > .nt-hit-icon {
      flex: none;
      width: 1.25rem;
      text-align: center;
    }
  }
  .nt-hit-main {
    display: grid;
    flex: 1;
    gap: 0.125rem;
    min-width: 0;
  }
  .nt-hit-title {
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
    & small {
      color: var(--muted-foreground);
      font-weight: 400;
    }
  }
  .nt-hit-snippet {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    & mark {
      border-radius: 2px;
      background: oklch(0.9 0.13 95 / 0.65);
      color: inherit;
    }
  }
  .dark .nt-hit-snippet mark {
    background: oklch(0.55 0.11 95 / 0.55);
  }
  .nt-hit-via {
    display: flex;
    flex: none;
    gap: 0.25rem;
  }
  .nt-find-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    padding: 0.5rem 0.75rem;
    border-block-start: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 0.75rem;
    &:has(> span:empty):has(> button[hidden]) {
      display: none;
    }
  }
  .nt .nt-flash {
    animation: nt-flash 1.6s ease-out;
  }
  @keyframes nt-flash {
    from {
      background: oklch(0.9 0.13 95 / 0.65);
    }
  }

  /* Settings */
  .nt-set {
    display: grid;
    gap: 1.25rem;
    & section {
      display: grid;
      gap: 0.5rem;
    }
    & h3 {
      margin: 0;
      font-size: 0.875rem;
      font-weight: 600;
    }
    & p {
      margin: 0;
      color: var(--muted-foreground);
      font-size: 0.8125rem;
      &:empty {
        display: none;
      }
    }
  }
  .nt-set-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  @media (prefers-reduced-motion: reduce) {
    .nt .nt-flash {
      animation: none;
      outline: 2px solid var(--ring);
    }
    .nt-page:not([hidden]) {
      animation: none;
    }
    .nt-arrow::before,
    .nt-gutter,
    .nt-cover-actions,
    .nt-doc-actions {
      transition: none;
    }
  }
  @media (forced-colors: active) {
    .nt-add::before,
    .nt-grip::before,
    .nt-arrow::before {
      background: ButtonText;
    }
    .nt-block[data-drop] {
      outline: 2px solid Highlight;
    }
  }
</style>
<div class="nt" data-nt data-i18n-component data-nt-store="loading">
  <aside
    class="app-sidebar nt-sidebar"
    id="nt-sidebar"
    data-state="expanded"
    aria-label="Workspace"
    data-i18n-aria-label-en="Workspace"
    data-i18n-aria-label-de="Arbeitsbereich"
  >
    <div class="sidebar-header nt-sb-head">
      <button
        class="nt-ws"
        type="button"
        aria-haspopup="menu"
        aria-expanded="false"
        aria-controls="nt-ws-menu"
        data-dropdown-trigger="nt-ws-menu"
      >
        <span class="nt-logo"
          ><svg
            viewBox="0 0 24 24"
            width="14"
            height="14"
            fill="none"
            stroke="currentColor"
            stroke-width="2.4"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="M5 4h11l3 3v13H5z" />
            <path d="M9 10h6M9 14h6" /></svg></span
        ><span class="nt-ws-name">Aron's Folio</span><i data-lucide="chevrons-up-down"></i>
      </button>
      <div
        id="nt-ws-menu"
        role="menu"
        popover
        class="dropdown-content"
        aria-label="Workspace"
        data-i18n-aria-label-en="Workspace"
        data-i18n-aria-label-de="Arbeitsbereich"
      >
        <button role="menuitem" class="dropdown-item" tabindex="-1" data-nt-settings
          ><i data-lucide="settings"></i> <span data-i18n-target="ws-settings">Settings</span></button
        >
        <button role="menuitem" class="dropdown-item" tabindex="-1" data-nt-backup
          ><i data-lucide="download"></i> <span data-i18n-target="ws-backup">Back up workspace</span></button
        >
        <button role="menuitem" class="dropdown-item" tabindex="-1" data-nt-import
          ><i data-lucide="upload"></i> <span data-i18n-target="ws-import">Import backup…</span></button
        >
        <button role="menuitem" class="dropdown-item" tabindex="-1" data-toast="Invite link copied"
          ><i data-lucide="user-plus"></i> <span data-i18n-target="ws-invite">Invite members</span></button
        >
        <button role="menuitem" class="dropdown-item" tabindex="-1" data-nt-theme
          ><i data-lucide="moon"></i> <span data-i18n-target="ws-theme">Toggle theme</span></button
        >
        <div class="dropdown-separator" role="separator"></div>
        <button
          role="menuitem"
          class="dropdown-item"
          tabindex="-1"
          data-toast="Logged out"
          data-toast-desc="This is a clickdummy - you are still here."
          ><i data-lucide="log-out"></i> <span data-i18n-target="ws-logout">Log out</span></button
        >
      </div>
      <button
        class="sidebar-trigger"
        type="button"
        data-sidebar-trigger="nt-sidebar"
        aria-label="Collapse sidebar"
        data-i18n-aria-label-en="Collapse sidebar"
        data-i18n-aria-label-de="Seitenleiste einklappen"
        ><i data-lucide="chevrons-left"></i
      ></button>
    </div>
    <div class="sidebar-content">
      <nav
        class="sidebar-nav"
        aria-label="Quick actions"
        data-i18n-aria-label-en="Quick actions"
        data-i18n-aria-label-de="Schnellaktionen"
      >
        <button class="sidebar-link" type="button" data-command-trigger="nt-cmd"
          ><i data-lucide="search"></i><span data-i18n-target="nav-search-d">Search</span
          ><kbd class="kbd nt-kbd">⌘K</kbd></button
        >
        <button class="sidebar-link" type="button" data-nt-new
          ><i data-lucide="square-pen"></i><span data-i18n-target="nav-new-d">New page</span></button
        >
      </nav>
      <details class="sidebar-group" open>
        <summary><span data-i18n-target="nav-favorites-d">Favorites</span><i data-lucide="chevron-right"></i></summary>
        <ul
          class="tree nt-tree"
          role="tree"
          aria-label="Favorites"
          data-i18n-aria-label-en="Favorites"
          data-i18n-aria-label-de="Favoriten"
          data-selectable
          data-nt-favs
          data-prefix="d"
        >
          <li class="tree-item" role="treeitem" data-page="getting-started" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/getting-started" data-router-link
              ><span class="nt-tree-icon" data-icon-of="getting-started">👋</span
              ><span data-title-of="getting-started">Getting started</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="roadmap" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/roadmap" data-router-link
              ><span class="nt-tree-icon" data-icon-of="roadmap">🗺️</span
              ><span data-title-of="roadmap">Product Roadmap</span></a
            ></li
          >
        </ul>
      </details>
      <details class="sidebar-group" open>
        <summary><span data-i18n-target="nav-private-d">Private</span><i data-lucide="chevron-right"></i></summary>
        <ul
          class="tree nt-tree"
          role="tree"
          aria-label="Private pages"
          data-i18n-aria-label-en="Private pages"
          data-i18n-aria-label-de="Private Seiten"
          data-selectable
          data-nt-private
        >
          <li class="tree-item" role="treeitem" data-page="getting-started" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/getting-started" data-router-link
              ><span class="nt-tree-icon" data-icon-of="getting-started">👋</span
              ><span data-title-of="getting-started">Getting started</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="wiki" aria-expanded="false" aria-selected="false">
            <details class="tree-branch">
              <summary class="tree-branch-trigger"
                ><i data-lucide="chevron-right"></i><span class="nt-tree-icon" data-icon-of="wiki">📚</span
                ><span data-title-of="wiki">Engineering Wiki</span></summary
              >
              <ul class="tree-group" role="group"
                ><li class="tree-item" role="treeitem" data-page="onboarding" aria-selected="false"
                  ><a class="tree-leaf" href="#/pages/onboarding" data-router-link
                    ><span class="nt-tree-icon" data-icon-of="onboarding">🚀</span
                    ><span data-title-of="onboarding">Onboarding</span></a
                  ></li
                ><li class="tree-item" role="treeitem" data-page="code-review" aria-selected="false"
                  ><a class="tree-leaf" href="#/pages/code-review" data-router-link
                    ><span class="nt-tree-icon" data-icon-of="code-review">🔍</span
                    ><span data-title-of="code-review">Code review guidelines</span></a
                  ></li
                ></ul
              >
            </details>
          </li>
          <li class="tree-item" role="treeitem" data-page="roadmap" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/roadmap" data-router-link
              ><span class="nt-tree-icon" data-icon-of="roadmap">🗺️</span
              ><span data-title-of="roadmap">Product Roadmap</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="meetings" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/meetings" data-router-link
              ><span class="nt-tree-icon" data-icon-of="meetings">📝</span
              ><span data-title-of="meetings">Meeting notes</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="journal" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/journal" data-router-link
              ><span class="nt-tree-icon" data-icon-of="journal">✏️</span
              ><span data-title-of="journal">Journal</span></a
            ></li
          >
        </ul>
        <button class="sidebar-link nt-add-page" type="button" data-nt-new
          ><i data-lucide="plus"></i><span data-i18n-target="nav-add-d">Add a page</span></button
        >
      </details>
    </div>
    <div class="sidebar-footer">
      <p class="nt-saved" data-nt-saved role="status"></p>
      <div
        class="language-switcher nt-locale"
        id="nt-lang"
        data-app-locale
        role="group"
        aria-label="Language"
        data-i18n-aria-label-en="Language"
        data-i18n-aria-label-de="Sprache"
        data-languages="en de"
        data-value="en"
        data-size="sm"
        data-flag-shape="rounded"
      ></div>
      <button class="sidebar-link" type="button" popovertarget="nt-trash"
        ><i data-lucide="trash-2"></i><span data-i18n-target="nav-trash">Trash</span></button
      >
      <button
        class="sidebar-link"
        type="button"
        data-toast="Help center"
        data-toast-desc="⌘K search · / blocks · ⌘B bold · ⌘I italic · drag ⋮⋮ to move"
        ><i data-lucide="circle-question-mark"></i><span data-i18n-target="nav-help">Help</span></button
      >
    </div>
  </aside>
  <button
    class="sidebar-trigger nt-expand"
    type="button"
    data-sidebar-trigger="nt-sidebar"
    aria-label="Expand sidebar"
    data-i18n-aria-label-en="Expand sidebar"
    data-i18n-aria-label-de="Seitenleiste ausklappen"
    ><i data-lucide="chevrons-right"></i
  ></button>

  <dialog
    class="sidebar-mobile"
    id="nt-mobile-nav"
    aria-label="Navigation"
    data-i18n-aria-label-en="Navigation"
    data-i18n-aria-label-de="Navigation"
  >
    <button
      class="sidebar-mobile-close"
      aria-label="Close navigation"
      data-i18n-aria-label-en="Close navigation"
      data-i18n-aria-label-de="Navigation schließen"
      ><i data-lucide="x"></i
    ></button>
    <div class="sidebar-content">
      <nav
        class="sidebar-nav"
        aria-label="Quick actions"
        data-i18n-aria-label-en="Quick actions"
        data-i18n-aria-label-de="Schnellaktionen"
      >
        <button class="sidebar-link" type="button" data-command-trigger="nt-cmd"
          ><i data-lucide="search"></i><span data-i18n-target="nav-search-m">Search</span
          ><kbd class="kbd nt-kbd">⌘K</kbd></button
        >
        <button class="sidebar-link" type="button" data-nt-new
          ><i data-lucide="square-pen"></i><span data-i18n-target="nav-new-m">New page</span></button
        >
      </nav>
      <details class="sidebar-group" open>
        <summary><span data-i18n-target="nav-favorites-m">Favorites</span><i data-lucide="chevron-right"></i></summary>
        <ul
          class="tree nt-tree"
          role="tree"
          aria-label="Favorites"
          data-i18n-aria-label-en="Favorites"
          data-i18n-aria-label-de="Favoriten"
          data-selectable
          data-nt-favs
          data-prefix="m"
        >
          <li class="tree-item" role="treeitem" data-page="getting-started" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/getting-started" data-router-link
              ><span class="nt-tree-icon" data-icon-of="getting-started">👋</span
              ><span data-title-of="getting-started">Getting started</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="roadmap" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/roadmap" data-router-link
              ><span class="nt-tree-icon" data-icon-of="roadmap">🗺️</span
              ><span data-title-of="roadmap">Product Roadmap</span></a
            ></li
          >
        </ul>
      </details>
      <details class="sidebar-group" open>
        <summary><span data-i18n-target="nav-private-m">Private</span><i data-lucide="chevron-right"></i></summary>
        <ul
          class="tree nt-tree"
          role="tree"
          aria-label="Private pages"
          data-i18n-aria-label-en="Private pages"
          data-i18n-aria-label-de="Private Seiten"
          data-selectable
          data-nt-private
        >
          <li class="tree-item" role="treeitem" data-page="getting-started" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/getting-started" data-router-link
              ><span class="nt-tree-icon" data-icon-of="getting-started">👋</span
              ><span data-title-of="getting-started">Getting started</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="wiki" aria-expanded="false" aria-selected="false">
            <details class="tree-branch">
              <summary class="tree-branch-trigger"
                ><i data-lucide="chevron-right"></i><span class="nt-tree-icon" data-icon-of="wiki">📚</span
                ><span data-title-of="wiki">Engineering Wiki</span></summary
              >
              <ul class="tree-group" role="group"
                ><li class="tree-item" role="treeitem" data-page="onboarding" aria-selected="false"
                  ><a class="tree-leaf" href="#/pages/onboarding" data-router-link
                    ><span class="nt-tree-icon" data-icon-of="onboarding">🚀</span
                    ><span data-title-of="onboarding">Onboarding</span></a
                  ></li
                ><li class="tree-item" role="treeitem" data-page="code-review" aria-selected="false"
                  ><a class="tree-leaf" href="#/pages/code-review" data-router-link
                    ><span class="nt-tree-icon" data-icon-of="code-review">🔍</span
                    ><span data-title-of="code-review">Code review guidelines</span></a
                  ></li
                ></ul
              >
            </details>
          </li>
          <li class="tree-item" role="treeitem" data-page="roadmap" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/roadmap" data-router-link
              ><span class="nt-tree-icon" data-icon-of="roadmap">🗺️</span
              ><span data-title-of="roadmap">Product Roadmap</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="meetings" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/meetings" data-router-link
              ><span class="nt-tree-icon" data-icon-of="meetings">📝</span
              ><span data-title-of="meetings">Meeting notes</span></a
            ></li
          >
          <li class="tree-item" role="treeitem" data-page="journal" aria-selected="false"
            ><a class="tree-leaf" href="#/pages/journal" data-router-link
              ><span class="nt-tree-icon" data-icon-of="journal">✏️</span
              ><span data-title-of="journal">Journal</span></a
            ></li
          >
        </ul>
        <button class="sidebar-link nt-add-page" type="button" data-nt-new
          ><i data-lucide="plus"></i><span data-i18n-target="nav-add-m">Add a page</span></button
        >
      </details>
    </div>
    <div class="sidebar-footer">
      <p class="nt-saved" data-nt-saved role="status"></p>
      <div
        class="language-switcher nt-locale"
        id="nt-lang-m"
        data-app-locale
        role="group"
        aria-label="Language"
        data-i18n-aria-label-en="Language"
        data-i18n-aria-label-de="Sprache"
        data-languages="en de"
        data-value="en"
        data-size="sm"
        data-display="icon"
        data-flag-shape="circle"
      ></div>
    </div>
  </dialog>

  <main class="nt-main">
    <div class="nt-pages">
      <article
        class="nt-page"
        id="p-getting-started"
        data-page="getting-started"
        data-default
        aria-labelledby="t-getting-started"
      >
        <header class="nt-top">
          <button
            class="sidebar-trigger nt-mobile-trigger"
            type="button"
            data-sidebar-mobile="nt-mobile-nav"
            aria-label="Open navigation"
            data-i18n-aria-label-en="Open navigation"
            data-i18n-aria-label-de="Navigation öffnen"
            ><i data-lucide="menu"></i
          ></button>
          <nav
            class="breadcrumb"
            aria-label="Breadcrumb"
            data-i18n-aria-label-en="Breadcrumb"
            data-i18n-aria-label-de="Pfad"
            ><ol class="breadcrumb-list">
              <li class="breadcrumb-item"
                ><span class="breadcrumb-page" aria-current="page"
                  ><span data-icon-of="getting-started">👋</span>
                  <span data-title-of="getting-started">Getting started</span></span
                ></li
              >
            </ol></nav
          >
          <span class="nt-spacer"></span>
          <span class="nt-edited" data-edited>Edited 2m ago</span>
          <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
          <button
            class="btn nt-star"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-pressed="true"
            data-nt-fav
            aria-label="Favorite"
            data-i18n-aria-label-en="Favorite"
            data-i18n-aria-label-de="Favorit"
            ><i data-lucide="star"></i
          ></button>
          <button
            class="btn"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-haspopup="menu"
            aria-expanded="false"
            aria-controls="nt-more-getting-started"
            data-dropdown-trigger="nt-more-getting-started"
            aria-label="Page options"
            ><i data-lucide="ellipsis"></i
          ></button>
          <div
            id="nt-more-getting-started"
            role="menu"
            popover
            class="dropdown-content nt-more"
            aria-label="Page options"
          >
            <div role="group" aria-label="Font" class="nt-fonts">
              <button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="true"
                tabindex="-1"
                data-value="default"
                data-nt-font
                >Default</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="serif"
                data-nt-font
                >Serif</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="mono"
                data-nt-font
                >Mono</button
              >
            </div>
            <div class="dropdown-separator" role="separator"></div>
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="small"
              >Small text</button
            >
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="full"
              >Full width</button
            >
            <div class="dropdown-separator" role="separator"></div>
            <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
              ><i data-lucide="link"></i> Copy link</button
            >
            <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
              ><i data-lucide="trash-2"></i> Move to trash</button
            >
          </div>
        </header>
        <div class="nt-trashed" role="status"
          ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
          ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="getting-started"
            >Restore page</button
          ></div
        >
        <div class="nt-scroll">
          <div class="nt-cover"
            ><img src="images/photos/s-nt-cover-lake-1600x400.webp" alt="" data-nt-cover-img /><span
              class="nt-cover-actions"
              ><button class="btn" data-variant="secondary" data-size="sm" type="button" data-nt-cover
                >Change cover</button
              ></span
            ></div
          >
          <div class="nt-doc">
            <div class="nt-doc-actions">
              <button
                class="btn"
                data-variant="ghost"
                data-size="sm"
                type="button"
                data-toast="Comments are part of the full product"
                ><i data-lucide="message-square"></i> Add comment</button
              >
            </div>
            <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
              ><span data-icon-of="getting-started">👋</span></button
            >
            <h1 class="nt-title" id="t-getting-started" contenteditable="true" data-placeholder="Untitled" data-nt-title
              >Getting started</h1
            >

            <div class="nt-blocks">
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                  >Welcome to <strong>Folio</strong> - a home for your notes, docs and projects. Click anywhere and
                  start typing.</div
                ></div
              >
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >The basics</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" checked aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Click anywhere and just start typing</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Hit <code>/</code> to see all the kinds of blocks you can add - headings, lists, toggles, callouts,
                  code</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Select any text and use the menu that pops up to style it</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Drag the <span class="nt-grip-hint" aria-hidden="true">⋮⋮</span> handle on the left of a block to
                  move it</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Type <code>#</code>, <code>-</code>, <code>[]</code> or <code>&gt;</code> and a space for a heading,
                  a bullet, a to-do or a quote</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Add a page with the pen button at the top of the sidebar</div
                ></div
              >
              <div class="nt-block" data-type="toggle"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><button class="nt-arrow" type="button" aria-expanded="false" aria-label="Expand"></button
                ><div class="nt-text" contenteditable="true" data-placeholder="Toggle"
                  >Want to know more? Open this toggle</div
                ><div class="nt-children"
                  ><div class="nt-block" data-type="p"
                    ><div class="nt-gutter"
                      ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                      ><button
                        class="nt-grip"
                        type="button"
                        tabindex="-1"
                        draggable="true"
                        aria-label="Drag to move, click for options"
                      ></button></div
                    ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                      >Toggles keep details out of the way until you need them. Press <kbd class="kbd">⌘K</kbd> to jump
                      between pages, or open
                      <a class="nt-pagelink" href="#/pages/roadmap" data-router-link contenteditable="false"
                        ><span data-icon-of="roadmap">🗺️</span><span data-title-of="roadmap">Product Roadmap</span></a
                      >
                      for a database with table, board and gallery views.</div
                    ></div
                  ><div class="nt-block" data-type="p"
                    ><div class="nt-gutter"
                      ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                      ><button
                        class="nt-grip"
                        type="button"
                        tabindex="-1"
                        draggable="true"
                        aria-label="Drag to move, click for options"
                      ></button></div
                    ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                      >Everything stays in the page: press Enter for a new block, Backspace on an empty one to remove
                      it.</div
                    ></div
                  ></div
                ></div
              >
              <div class="nt-block" data-type="callout"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><span class="nt-emoji" aria-hidden="true">💡</span
                ><div class="nt-text" contenteditable="true" data-placeholder="Type something…"
                  >Every page here is plain HTML - the whole app is one source you can read on the docs page.</div
                ></div
              >
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >Keyboard</div
                ></div
              >
              <div class="nt-block" data-type="bullet"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  ><kbd class="kbd">⌘K</kbd> search and jump to any page</div
                ></div
              >
              <div class="nt-block" data-type="bullet"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  ><kbd class="kbd">/</kbd> insert any kind of block</div
                ></div
              >
              <div class="nt-block" data-type="bullet"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  ><kbd class="kbd">⌘B</kbd> <kbd class="kbd">⌘I</kbd> bold and italic, or use the floating menu</div
                ></div
              >
            </div>
          </div>
        </div>
      </article>
      <article class="nt-page" id="p-wiki" hidden data-page="wiki" aria-labelledby="t-wiki">
        <header class="nt-top">
          <button
            class="sidebar-trigger nt-mobile-trigger"
            type="button"
            data-sidebar-mobile="nt-mobile-nav"
            aria-label="Open navigation"
            data-i18n-aria-label-en="Open navigation"
            data-i18n-aria-label-de="Navigation öffnen"
            ><i data-lucide="menu"></i
          ></button>
          <nav
            class="breadcrumb"
            aria-label="Breadcrumb"
            data-i18n-aria-label-en="Breadcrumb"
            data-i18n-aria-label-de="Pfad"
            ><ol class="breadcrumb-list">
              <li class="breadcrumb-item"
                ><span class="breadcrumb-page" aria-current="page"
                  ><span data-icon-of="wiki">📚</span> <span data-title-of="wiki">Engineering Wiki</span></span
                ></li
              >
            </ol></nav
          >
          <span class="nt-spacer"></span>
          <span class="nt-edited" data-edited>Edited yesterday</span>
          <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
          <button
            class="btn nt-star"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-pressed="false"
            data-nt-fav
            aria-label="Favorite"
            data-i18n-aria-label-en="Favorite"
            data-i18n-aria-label-de="Favorit"
            ><i data-lucide="star"></i
          ></button>
          <button
            class="btn"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-haspopup="menu"
            aria-expanded="false"
            aria-controls="nt-more-wiki"
            data-dropdown-trigger="nt-more-wiki"
            aria-label="Page options"
            ><i data-lucide="ellipsis"></i
          ></button>
          <div id="nt-more-wiki" role="menu" popover class="dropdown-content nt-more" aria-label="Page options">
            <div role="group" aria-label="Font" class="nt-fonts">
              <button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="true"
                tabindex="-1"
                data-value="default"
                data-nt-font
                >Default</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="serif"
                data-nt-font
                >Serif</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="mono"
                data-nt-font
                >Mono</button
              >
            </div>
            <div class="dropdown-separator" role="separator"></div>
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="small"
              >Small text</button
            >
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="full"
              >Full width</button
            >
            <div class="dropdown-separator" role="separator"></div>
            <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
              ><i data-lucide="link"></i> Copy link</button
            >
            <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
              ><i data-lucide="trash-2"></i> Move to trash</button
            >
          </div>
        </header>
        <div class="nt-trashed" role="status"
          ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
          ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="wiki"
            >Restore page</button
          ></div
        >
        <div class="nt-scroll">
          <div class="nt-cover"
            ><img src="images/photos/s-nt-cover-library-1600x400.webp" alt="" data-nt-cover-img /><span
              class="nt-cover-actions"
              ><button class="btn" data-variant="secondary" data-size="sm" type="button" data-nt-cover
                >Change cover</button
              ></span
            ></div
          >
          <div class="nt-doc">
            <div class="nt-doc-actions">
              <button
                class="btn"
                data-variant="ghost"
                data-size="sm"
                type="button"
                data-toast="Comments are part of the full product"
                ><i data-lucide="message-square"></i> Add comment</button
              >
            </div>
            <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
              ><span data-icon-of="wiki">📚</span></button
            >
            <h1 class="nt-title" id="t-wiki" contenteditable="true" data-placeholder="Untitled" data-nt-title
              >Engineering Wiki</h1
            >

            <div class="nt-blocks">
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                  >How we build, review and ship. Start with the pages below, and add what you wish you had known on day
                  one.</div
                ></div
              >
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >Start here</div
                ></div
              >
              <div class="nt-block" data-type="bullet"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  ><a class="nt-pagelink" href="#/pages/onboarding" data-router-link contenteditable="false"
                    ><span data-icon-of="onboarding">🚀</span><span data-title-of="onboarding">Onboarding</span></a
                  >
                  - your first week, accounts and the local setup</div
                ></div
              >
              <div class="nt-block" data-type="bullet"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  ><a class="nt-pagelink" href="#/pages/code-review" data-router-link contenteditable="false"
                    ><span data-icon-of="code-review">🔍</span
                    ><span data-title-of="code-review">Code review guidelines</span></a
                  >
                  - what we look for and how we leave comments</div
                ></div
              >
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >Principles</div
                ></div
              >
              <div class="nt-block" data-type="number"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Prefer the platform: if the browser can do it, we don't ship code for it</div
                ></div
              >
              <div class="nt-block" data-type="number"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Small pull requests, reviewed within a day</div
                ></div
              >
              <div class="nt-block" data-type="number"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Every change is verified - green checks or it doesn't merge</div
                ></div
              >
              <div class="nt-block" data-type="quote"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Empty quote"
                  >Make it work, make it right, make it fast - in that order.</div
                ></div
              >
            </div>
          </div>
        </div>
      </article>
      <article class="nt-page" id="p-onboarding" hidden data-page="onboarding" aria-labelledby="t-onboarding">
        <header class="nt-top">
          <button
            class="sidebar-trigger nt-mobile-trigger"
            type="button"
            data-sidebar-mobile="nt-mobile-nav"
            aria-label="Open navigation"
            data-i18n-aria-label-en="Open navigation"
            data-i18n-aria-label-de="Navigation öffnen"
            ><i data-lucide="menu"></i
          ></button>
          <nav
            class="breadcrumb"
            aria-label="Breadcrumb"
            data-i18n-aria-label-en="Breadcrumb"
            data-i18n-aria-label-de="Pfad"
            ><ol class="breadcrumb-list">
              <li class="breadcrumb-item"
                ><a class="breadcrumb-link" href="#/pages/wiki" data-router-link
                  ><span data-icon-of="wiki">📚</span> <span data-title-of="wiki">Engineering Wiki</span></a
                ></li
              ><li class="breadcrumb-separator" aria-hidden="true">/</li
              ><li class="breadcrumb-item"
                ><span class="breadcrumb-page" aria-current="page"
                  ><span data-icon-of="onboarding">🚀</span> <span data-title-of="onboarding">Onboarding</span></span
                ></li
              >
            </ol></nav
          >
          <span class="nt-spacer"></span>
          <span class="nt-edited" data-edited>Edited 3 days ago</span>
          <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
          <button
            class="btn nt-star"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-pressed="false"
            data-nt-fav
            aria-label="Favorite"
            data-i18n-aria-label-en="Favorite"
            data-i18n-aria-label-de="Favorit"
            ><i data-lucide="star"></i
          ></button>
          <button
            class="btn"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-haspopup="menu"
            aria-expanded="false"
            aria-controls="nt-more-onboarding"
            data-dropdown-trigger="nt-more-onboarding"
            aria-label="Page options"
            ><i data-lucide="ellipsis"></i
          ></button>
          <div id="nt-more-onboarding" role="menu" popover class="dropdown-content nt-more" aria-label="Page options">
            <div role="group" aria-label="Font" class="nt-fonts">
              <button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="true"
                tabindex="-1"
                data-value="default"
                data-nt-font
                >Default</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="serif"
                data-nt-font
                >Serif</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="mono"
                data-nt-font
                >Mono</button
              >
            </div>
            <div class="dropdown-separator" role="separator"></div>
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="small"
              >Small text</button
            >
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="full"
              >Full width</button
            >
            <div class="dropdown-separator" role="separator"></div>
            <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
              ><i data-lucide="link"></i> Copy link</button
            >
            <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
              ><i data-lucide="trash-2"></i> Move to trash</button
            >
          </div>
        </header>
        <div class="nt-trashed" role="status"
          ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
          ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="onboarding"
            >Restore page</button
          ></div
        >
        <div class="nt-scroll">
          <div class="nt-doc">
            <div class="nt-doc-actions">
              <button class="btn" data-variant="ghost" data-size="sm" type="button" data-nt-add-cover
                ><i data-lucide="image"></i> Add cover</button
              >
              <button
                class="btn"
                data-variant="ghost"
                data-size="sm"
                type="button"
                data-toast="Comments are part of the full product"
                ><i data-lucide="message-square"></i> Add comment</button
              >
            </div>
            <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
              ><span data-icon-of="onboarding">🚀</span></button
            >
            <h1 class="nt-title" id="t-onboarding" contenteditable="true" data-placeholder="Untitled" data-nt-title
              >Onboarding</h1
            >

            <div class="nt-blocks">
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                  >Welcome aboard! This page gets you from a fresh laptop to your first merged change.</div
                ></div
              >
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >Week one</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" checked aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Meet your onboarding buddy</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Set up the development environment</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Ship a small fix to production</div
                ></div
              >
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >Local setup</div
                ></div
              >
              <div class="nt-block" data-type="code"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" spellcheck="false" data-placeholder="Code"
                  >git clone git@example.com:folio/app.git cd app bun install bun dev</div
                ></div
              >
              <div class="nt-block" data-type="callout"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><span class="nt-emoji" aria-hidden="true">🙋</span
                ><div class="nt-text" contenteditable="true" data-placeholder="Type something…"
                  >Stuck for more than 30 minutes? Ask in #help - nobody expects you to know everything yet.</div
                ></div
              >
            </div>
          </div>
        </div>
      </article>
      <article class="nt-page" id="p-code-review" hidden data-page="code-review" aria-labelledby="t-code-review">
        <header class="nt-top">
          <button
            class="sidebar-trigger nt-mobile-trigger"
            type="button"
            data-sidebar-mobile="nt-mobile-nav"
            aria-label="Open navigation"
            data-i18n-aria-label-en="Open navigation"
            data-i18n-aria-label-de="Navigation öffnen"
            ><i data-lucide="menu"></i
          ></button>
          <nav
            class="breadcrumb"
            aria-label="Breadcrumb"
            data-i18n-aria-label-en="Breadcrumb"
            data-i18n-aria-label-de="Pfad"
            ><ol class="breadcrumb-list">
              <li class="breadcrumb-item"
                ><a class="breadcrumb-link" href="#/pages/wiki" data-router-link
                  ><span data-icon-of="wiki">📚</span> <span data-title-of="wiki">Engineering Wiki</span></a
                ></li
              ><li class="breadcrumb-separator" aria-hidden="true">/</li
              ><li class="breadcrumb-item"
                ><span class="breadcrumb-page" aria-current="page"
                  ><span data-icon-of="code-review">🔍</span>
                  <span data-title-of="code-review">Code review guidelines</span></span
                ></li
              >
            </ol></nav
          >
          <span class="nt-spacer"></span>
          <span class="nt-edited" data-edited>Edited last week</span>
          <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
          <button
            class="btn nt-star"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-pressed="false"
            data-nt-fav
            aria-label="Favorite"
            data-i18n-aria-label-en="Favorite"
            data-i18n-aria-label-de="Favorit"
            ><i data-lucide="star"></i
          ></button>
          <button
            class="btn"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-haspopup="menu"
            aria-expanded="false"
            aria-controls="nt-more-code-review"
            data-dropdown-trigger="nt-more-code-review"
            aria-label="Page options"
            ><i data-lucide="ellipsis"></i
          ></button>
          <div id="nt-more-code-review" role="menu" popover class="dropdown-content nt-more" aria-label="Page options">
            <div role="group" aria-label="Font" class="nt-fonts">
              <button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="true"
                tabindex="-1"
                data-value="default"
                data-nt-font
                >Default</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="serif"
                data-nt-font
                >Serif</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="mono"
                data-nt-font
                >Mono</button
              >
            </div>
            <div class="dropdown-separator" role="separator"></div>
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="small"
              >Small text</button
            >
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="full"
              >Full width</button
            >
            <div class="dropdown-separator" role="separator"></div>
            <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
              ><i data-lucide="link"></i> Copy link</button
            >
            <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
              ><i data-lucide="trash-2"></i> Move to trash</button
            >
          </div>
        </header>
        <div class="nt-trashed" role="status"
          ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
          ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="code-review"
            >Restore page</button
          ></div
        >
        <div class="nt-scroll">
          <div class="nt-doc">
            <div class="nt-doc-actions">
              <button class="btn" data-variant="ghost" data-size="sm" type="button" data-nt-add-cover
                ><i data-lucide="image"></i> Add cover</button
              >
              <button
                class="btn"
                data-variant="ghost"
                data-size="sm"
                type="button"
                data-toast="Comments are part of the full product"
                ><i data-lucide="message-square"></i> Add comment</button
              >
            </div>
            <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
              ><span data-icon-of="code-review">🔍</span></button
            >
            <h1 class="nt-title" id="t-code-review" contenteditable="true" data-placeholder="Untitled" data-nt-title
              >Code review guidelines</h1
            >

            <div class="nt-blocks">
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                  >Reviews are a conversation, not a gate. Be kind, be specific, and say what would make you
                  approve.</div
                ></div
              >
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >What we look for</div
                ></div
              >
              <div class="nt-block" data-type="number"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Does it do what the description says?</div
                ></div
              >
              <div class="nt-block" data-type="number"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Is it covered by a test that would fail without it?</div
                ></div
              >
              <div class="nt-block" data-type="number"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Would the next person understand it without you?</div
                ></div
              >
              <div class="nt-block" data-type="callout"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><span class="nt-emoji" aria-hidden="true">⚠️</span
                ><div class="nt-text" contenteditable="true" data-placeholder="Type something…"
                  >Prefix nits with "nit:" - the author may ignore them.</div
                ></div
              >
              <div class="nt-block" data-type="toggle"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><button class="nt-arrow" type="button" aria-expanded="false" aria-label="Expand"></button
                ><div class="nt-text" contenteditable="true" data-placeholder="Toggle">How fast should I review?</div
                ><div class="nt-children"
                  ><div class="nt-block" data-type="p"
                    ><div class="nt-gutter"
                      ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                      ><button
                        class="nt-grip"
                        type="button"
                        tabindex="-1"
                        draggable="true"
                        aria-label="Drag to move, click for options"
                      ></button></div
                    ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                      >Within one working day. If you can't, say so and suggest someone who can.</div
                    ></div
                  ></div
                ></div
              >
            </div>
          </div>
        </div>
      </article>
      <article class="nt-page" id="p-roadmap" hidden data-page="roadmap" data-full aria-labelledby="t-roadmap">
        <header class="nt-top">
          <button
            class="sidebar-trigger nt-mobile-trigger"
            type="button"
            data-sidebar-mobile="nt-mobile-nav"
            aria-label="Open navigation"
            data-i18n-aria-label-en="Open navigation"
            data-i18n-aria-label-de="Navigation öffnen"
            ><i data-lucide="menu"></i
          ></button>
          <nav
            class="breadcrumb"
            aria-label="Breadcrumb"
            data-i18n-aria-label-en="Breadcrumb"
            data-i18n-aria-label-de="Pfad"
            ><ol class="breadcrumb-list">
              <li class="breadcrumb-item"
                ><span class="breadcrumb-page" aria-current="page"
                  ><span data-icon-of="roadmap">🗺️</span> <span data-title-of="roadmap">Product Roadmap</span></span
                ></li
              >
            </ol></nav
          >
          <span class="nt-spacer"></span>
          <span class="nt-edited" data-edited>Edited 5m ago</span>
          <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
          <button
            class="btn nt-star"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-pressed="true"
            data-nt-fav
            aria-label="Favorite"
            data-i18n-aria-label-en="Favorite"
            data-i18n-aria-label-de="Favorit"
            ><i data-lucide="star"></i
          ></button>
          <button
            class="btn"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-haspopup="menu"
            aria-expanded="false"
            aria-controls="nt-more-roadmap"
            data-dropdown-trigger="nt-more-roadmap"
            aria-label="Page options"
            ><i data-lucide="ellipsis"></i
          ></button>
          <div id="nt-more-roadmap" role="menu" popover class="dropdown-content nt-more" aria-label="Page options">
            <div role="group" aria-label="Font" class="nt-fonts">
              <button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="true"
                tabindex="-1"
                data-value="default"
                data-nt-font
                >Default</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="serif"
                data-nt-font
                >Serif</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="mono"
                data-nt-font
                >Mono</button
              >
            </div>
            <div class="dropdown-separator" role="separator"></div>
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="small"
              >Small text</button
            >
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="true"
              tabindex="-1"
              data-nt-opt="full"
              >Full width</button
            >
            <div class="dropdown-separator" role="separator"></div>
            <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
              ><i data-lucide="link"></i> Copy link</button
            >
            <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
              ><i data-lucide="trash-2"></i> Move to trash</button
            >
          </div>
        </header>
        <div class="nt-trashed" role="status"
          ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
          ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="roadmap"
            >Restore page</button
          ></div
        >
        <div class="nt-scroll">
          <div class="nt-cover"
            ><img src="images/photos/s-nt-cover-mountains-1600x400.webp" alt="" data-nt-cover-img /><span
              class="nt-cover-actions"
              ><button class="btn" data-variant="secondary" data-size="sm" type="button" data-nt-cover
                >Change cover</button
              ></span
            ></div
          >
          <div class="nt-doc">
            <div class="nt-doc-actions">
              <button
                class="btn"
                data-variant="ghost"
                data-size="sm"
                type="button"
                data-toast="Comments are part of the full product"
                ><i data-lucide="message-square"></i> Add comment</button
              >
            </div>
            <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
              ><span data-icon-of="roadmap">🗺️</span></button
            >
            <h1 class="nt-title" id="t-roadmap" contenteditable="true" data-placeholder="Untitled" data-nt-title
              >Product Roadmap</h1
            >

            <div class="nt-blocks">
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                  >What we are building this quarter. Switch views, drag cards between columns, or open an item to edit
                  it.</div
                ></div
              >
              <div class="nt-block nt-db-block" data-type="db">
                <div class="nt-db" data-nt-db>
                  <div class="nt-db-bar">
                    <div class="nt-db-views" role="radiogroup" aria-label="Database view">
                      <label
                        ><input type="radio" name="nt-db-view" value="table" checked /><i data-lucide="table"></i
                        >Table</label
                      >
                      <label
                        ><input type="radio" name="nt-db-view" value="board" /><i data-lucide="square-kanban"></i
                        >Board</label
                      >
                      <label
                        ><input type="radio" name="nt-db-view" value="gallery" /><i data-lucide="layout-grid"></i
                        >Gallery</label
                      >
                    </div>
                    <span class="nt-spacer"></span>
                    <label class="nt-db-search"
                      ><i data-lucide="search"></i><span class="sr-only">Search the roadmap</span
                      ><input class="input" type="search" placeholder="Search" data-nt-db-filter autocomplete="off"
                    /></label>
                    <button class="btn nt-blue" data-size="sm" type="button" data-nt-db-new>New</button>
                  </div>
                  <div class="nt-db-table">
                    <div class="table-container">
                      <table class="table">
                        <thead
                          ><tr class="table-row"
                            ><th class="table-head" scope="col"><i data-lucide="type"></i>Name</th
                            ><th class="table-head" scope="col"><i data-lucide="circle-dot"></i>Status</th
                            ><th class="table-head" scope="col"><i data-lucide="user-round"></i>Owner</th
                            ><th class="table-head" scope="col"><i data-lucide="tag"></i>Tags</th
                            ><th class="table-head" scope="col"><i data-lucide="calendar"></i>Due</th></tr
                          ></thead
                        >
                        <tbody data-nt-rows>
                          <tr
                            class="table-row"
                            data-item="r1"
                            data-status="doing"
                            data-owner="marco"
                            data-due="2026-10-18"
                          >
                            <th class="table-cell" scope="row"
                              ><button class="nt-db-open" type="button" data-nt-open="r1"
                                ><i data-lucide="file-text"></i><span data-f="name">Real-time cursors</span
                                ><span class="nt-open-hint">Open</span></button
                              ></th
                            >
                            <td class="table-cell"
                              ><select class="select nt-status" data-field="status" data-s="doing" aria-label="Status"
                                ><option value="todo">Not started</option
                                ><option value="doing" selected>In progress</option
                                ><option value="done">Done</option></select
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-person" data-f="owner"
                                ><span class="avatar" data-size="sm"
                                  ><img class="avatar-image" src="images/avatars/68-96.webp" alt="" /></span
                                ><span>Marco Rossi</span></span
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-tags" data-f="tags"
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="editor">Editor</span
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="sync">Sync</span></span
                              ></td
                            >
                            <td class="table-cell nt-muted" data-f="due">Oct 18, 2026</td>
                          </tr>
                          <tr
                            class="table-row"
                            data-item="r2"
                            data-status="doing"
                            data-owner="priya"
                            data-due="2026-11-02"
                          >
                            <th class="table-cell" scope="row"
                              ><button class="nt-db-open" type="button" data-nt-open="r2"
                                ><i data-lucide="file-text"></i><span data-f="name">Offline sync</span
                                ><span class="nt-open-hint">Open</span></button
                              ></th
                            >
                            <td class="table-cell"
                              ><select class="select nt-status" data-field="status" data-s="doing" aria-label="Status"
                                ><option value="todo">Not started</option
                                ><option value="doing" selected>In progress</option
                                ><option value="done">Done</option></select
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-person" data-f="owner"
                                ><span class="avatar" data-size="sm"
                                  ><img class="avatar-image" src="images/avatars/16-96.webp" alt="" /></span
                                ><span>Priya Natarajan</span></span
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-tags" data-f="tags"
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="sync">Sync</span></span
                              ></td
                            >
                            <td class="table-cell nt-muted" data-f="due">Nov 2, 2026</td>
                          </tr>
                          <tr
                            class="table-row"
                            data-item="r3"
                            data-status="todo"
                            data-owner="anna"
                            data-due="2026-11-20"
                          >
                            <th class="table-cell" scope="row"
                              ><button class="nt-db-open" type="button" data-nt-open="r3"
                                ><i data-lucide="file-text"></i><span data-f="name">Public API v2</span
                                ><span class="nt-open-hint">Open</span></button
                              ></th
                            >
                            <td class="table-cell"
                              ><select class="select nt-status" data-field="status" data-s="todo" aria-label="Status"
                                ><option value="todo" selected>Not started</option
                                ><option value="doing">In progress</option
                                ><option value="done">Done</option></select
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-person" data-f="owner"
                                ><span class="avatar" data-size="sm"
                                  ><img class="avatar-image" src="images/avatars/47-96.webp" alt="" /></span
                                ><span>Anna Silva</span></span
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-tags" data-f="tags"
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="api">API</span></span
                              ></td
                            >
                            <td class="table-cell nt-muted" data-f="due">Nov 20, 2026</td>
                          </tr>
                          <tr
                            class="table-row"
                            data-item="r4"
                            data-status="done"
                            data-owner="sophie"
                            data-due="2026-09-26"
                          >
                            <th class="table-cell" scope="row"
                              ><button class="nt-db-open" type="button" data-nt-open="r4"
                                ><i data-lucide="file-text"></i><span data-f="name">Templates gallery</span
                                ><span class="nt-open-hint">Open</span></button
                              ></th
                            >
                            <td class="table-cell"
                              ><select class="select nt-status" data-field="status" data-s="done" aria-label="Status"
                                ><option value="todo">Not started</option
                                ><option value="doing">In progress</option
                                ><option value="done" selected>Done</option></select
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-person" data-f="owner"
                                ><span class="avatar" data-size="sm"
                                  ><img class="avatar-image" src="images/avatars/25-96.webp" alt="" /></span
                                ><span>Sophie Tan</span></span
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-tags" data-f="tags"
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="editor"
                                  >Editor</span
                                ></span
                              ></td
                            >
                            <td class="table-cell nt-muted" data-f="due">Sep 26, 2026</td>
                          </tr>
                          <tr
                            class="table-row"
                            data-item="r5"
                            data-status="todo"
                            data-owner="aron"
                            data-due="2026-12-04"
                          >
                            <th class="table-cell" scope="row"
                              ><button class="nt-db-open" type="button" data-nt-open="r5"
                                ><i data-lucide="file-text"></i><span data-f="name">Home screen widgets</span
                                ><span class="nt-open-hint">Open</span></button
                              ></th
                            >
                            <td class="table-cell"
                              ><select class="select nt-status" data-field="status" data-s="todo" aria-label="Status"
                                ><option value="todo" selected>Not started</option
                                ><option value="doing">In progress</option
                                ><option value="done">Done</option></select
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-person" data-f="owner"
                                ><span class="avatar" data-size="sm"
                                  ><img class="avatar-image" src="https://github.com/kyr0.png" alt="" /></span
                                ><span>Aron Homberg</span></span
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-tags" data-f="tags"
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="mobile"
                                  >Mobile</span
                                ></span
                              ></td
                            >
                            <td class="table-cell nt-muted" data-f="due">Dec 4, 2026</td>
                          </tr>
                          <tr
                            class="table-row"
                            data-item="r6"
                            data-status="todo"
                            data-owner="marco"
                            data-due="2026-12-15"
                          >
                            <th class="table-cell" scope="row"
                              ><button class="nt-db-open" type="button" data-nt-open="r6"
                                ><i data-lucide="file-text"></i><span data-f="name">AI page summaries</span
                                ><span class="nt-open-hint">Open</span></button
                              ></th
                            >
                            <td class="table-cell"
                              ><select class="select nt-status" data-field="status" data-s="todo" aria-label="Status"
                                ><option value="todo" selected>Not started</option
                                ><option value="doing">In progress</option
                                ><option value="done">Done</option></select
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-person" data-f="owner"
                                ><span class="avatar" data-size="sm"
                                  ><img class="avatar-image" src="images/avatars/68-96.webp" alt="" /></span
                                ><span>Marco Rossi</span></span
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-tags" data-f="tags"
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="ai">AI</span
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="editor"
                                  >Editor</span
                                ></span
                              ></td
                            >
                            <td class="table-cell nt-muted" data-f="due">Dec 15, 2026</td>
                          </tr>
                          <tr
                            class="table-row"
                            data-item="r7"
                            data-status="done"
                            data-owner="aron"
                            data-due="2026-09-19"
                          >
                            <th class="table-cell" scope="row"
                              ><button class="nt-db-open" type="button" data-nt-open="r7"
                                ><i data-lucide="file-text"></i><span data-f="name">Slash menu search</span
                                ><span class="nt-open-hint">Open</span></button
                              ></th
                            >
                            <td class="table-cell"
                              ><select class="select nt-status" data-field="status" data-s="done" aria-label="Status"
                                ><option value="todo">Not started</option
                                ><option value="doing">In progress</option
                                ><option value="done" selected>Done</option></select
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-person" data-f="owner"
                                ><span class="avatar" data-size="sm"
                                  ><img class="avatar-image" src="https://github.com/kyr0.png" alt="" /></span
                                ><span>Aron Homberg</span></span
                              ></td
                            >
                            <td class="table-cell"
                              ><span class="nt-tags" data-f="tags"
                                ><span class="badge nt-tag" data-variant="secondary" data-tag="editor"
                                  >Editor</span
                                ></span
                              ></td
                            >
                            <td class="table-cell nt-muted" data-f="due">Sep 19, 2026</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                    <button class="nt-db-add" type="button" data-nt-db-new><i data-lucide="plus"></i> New</button>
                  </div>
                  <div class="nt-db-board">
                    <section class="nt-col" data-status="todo" aria-label="Not started">
                      <header><span class="nt-pill">Not started</span><span class="nt-count">3</span></header>
                      <div class="nt-cards"
                        ><button
                          class="nt-card"
                          type="button"
                          draggable="true"
                          data-item="r3"
                          data-status="todo"
                          data-owner="anna"
                          data-due="2026-11-20"
                          data-nt-open="r3"
                          ><span class="nt-card-name" data-f="name">Public API v2</span
                          ><span class="nt-tags" data-f="tags"
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="api">API</span></span
                          ><span class="nt-person" data-f="owner"
                            ><span class="avatar" data-size="sm"
                              ><img class="avatar-image" src="images/avatars/47-96.webp" alt="" /></span
                            ><span>Anna Silva</span></span
                          ></button
                        ><button
                          class="nt-card"
                          type="button"
                          draggable="true"
                          data-item="r5"
                          data-status="todo"
                          data-owner="aron"
                          data-due="2026-12-04"
                          data-nt-open="r5"
                          ><span class="nt-card-name" data-f="name">Home screen widgets</span
                          ><span class="nt-tags" data-f="tags"
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="mobile">Mobile</span></span
                          ><span class="nt-person" data-f="owner"
                            ><span class="avatar" data-size="sm"
                              ><img class="avatar-image" src="https://github.com/kyr0.png" alt="" /></span
                            ><span>Aron Homberg</span></span
                          ></button
                        ><button
                          class="nt-card"
                          type="button"
                          draggable="true"
                          data-item="r6"
                          data-status="todo"
                          data-owner="marco"
                          data-due="2026-12-15"
                          data-nt-open="r6"
                          ><span class="nt-card-name" data-f="name">AI page summaries</span
                          ><span class="nt-tags" data-f="tags"
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="ai">AI</span
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="editor">Editor</span></span
                          ><span class="nt-person" data-f="owner"
                            ><span class="avatar" data-size="sm"
                              ><img class="avatar-image" src="images/avatars/68-96.webp" alt="" /></span
                            ><span>Marco Rossi</span></span
                          ></button
                        ></div
                      >
                      <button class="nt-db-add" type="button" data-nt-db-new data-status="todo"
                        ><i data-lucide="plus"></i> New</button
                      >
                    </section>
                    <section class="nt-col" data-status="doing" aria-label="In progress">
                      <header><span class="nt-pill">In progress</span><span class="nt-count">2</span></header>
                      <div class="nt-cards"
                        ><button
                          class="nt-card"
                          type="button"
                          draggable="true"
                          data-item="r1"
                          data-status="doing"
                          data-owner="marco"
                          data-due="2026-10-18"
                          data-nt-open="r1"
                          ><span class="nt-card-name" data-f="name">Real-time cursors</span
                          ><span class="nt-tags" data-f="tags"
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="editor">Editor</span
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="sync">Sync</span></span
                          ><span class="nt-person" data-f="owner"
                            ><span class="avatar" data-size="sm"
                              ><img class="avatar-image" src="images/avatars/68-96.webp" alt="" /></span
                            ><span>Marco Rossi</span></span
                          ></button
                        ><button
                          class="nt-card"
                          type="button"
                          draggable="true"
                          data-item="r2"
                          data-status="doing"
                          data-owner="priya"
                          data-due="2026-11-02"
                          data-nt-open="r2"
                          ><span class="nt-card-name" data-f="name">Offline sync</span
                          ><span class="nt-tags" data-f="tags"
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="sync">Sync</span></span
                          ><span class="nt-person" data-f="owner"
                            ><span class="avatar" data-size="sm"
                              ><img class="avatar-image" src="images/avatars/16-96.webp" alt="" /></span
                            ><span>Priya Natarajan</span></span
                          ></button
                        ></div
                      >
                      <button class="nt-db-add" type="button" data-nt-db-new data-status="doing"
                        ><i data-lucide="plus"></i> New</button
                      >
                    </section>
                    <section class="nt-col" data-status="done" aria-label="Done">
                      <header><span class="nt-pill">Done</span><span class="nt-count">2</span></header>
                      <div class="nt-cards"
                        ><button
                          class="nt-card"
                          type="button"
                          draggable="true"
                          data-item="r4"
                          data-status="done"
                          data-owner="sophie"
                          data-due="2026-09-26"
                          data-nt-open="r4"
                          ><span class="nt-card-name" data-f="name">Templates gallery</span
                          ><span class="nt-tags" data-f="tags"
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="editor">Editor</span></span
                          ><span class="nt-person" data-f="owner"
                            ><span class="avatar" data-size="sm"
                              ><img class="avatar-image" src="images/avatars/25-96.webp" alt="" /></span
                            ><span>Sophie Tan</span></span
                          ></button
                        ><button
                          class="nt-card"
                          type="button"
                          draggable="true"
                          data-item="r7"
                          data-status="done"
                          data-owner="aron"
                          data-due="2026-09-19"
                          data-nt-open="r7"
                          ><span class="nt-card-name" data-f="name">Slash menu search</span
                          ><span class="nt-tags" data-f="tags"
                            ><span class="badge nt-tag" data-variant="secondary" data-tag="editor">Editor</span></span
                          ><span class="nt-person" data-f="owner"
                            ><span class="avatar" data-size="sm"
                              ><img class="avatar-image" src="https://github.com/kyr0.png" alt="" /></span
                            ><span>Aron Homberg</span></span
                          ></button
                        ></div
                      >
                      <button class="nt-db-add" type="button" data-nt-db-new data-status="done"
                        ><i data-lucide="plus"></i> New</button
                      >
                    </section>
                  </div>
                  <div class="nt-db-gallery">
                    <button
                      class="nt-gcard"
                      type="button"
                      data-item="r1"
                      data-status="doing"
                      data-owner="marco"
                      data-due="2026-10-18"
                      data-nt-open="r1"
                      ><img src="images/photos/s-nt-r1-480x260.webp" alt="" loading="lazy" /><span class="nt-gcard-body"
                        ><span class="nt-card-name" data-f="name">Real-time cursors</span
                        ><span class="nt-pill" data-f="status">In progress</span></span
                      ></button
                    >
                    <button
                      class="nt-gcard"
                      type="button"
                      data-item="r2"
                      data-status="doing"
                      data-owner="priya"
                      data-due="2026-11-02"
                      data-nt-open="r2"
                      ><img src="images/photos/s-nt-r2-480x260.webp" alt="" loading="lazy" /><span class="nt-gcard-body"
                        ><span class="nt-card-name" data-f="name">Offline sync</span
                        ><span class="nt-pill" data-f="status">In progress</span></span
                      ></button
                    >
                    <button
                      class="nt-gcard"
                      type="button"
                      data-item="r3"
                      data-status="todo"
                      data-owner="anna"
                      data-due="2026-11-20"
                      data-nt-open="r3"
                      ><img src="images/photos/s-nt-r3-480x260.webp" alt="" loading="lazy" /><span class="nt-gcard-body"
                        ><span class="nt-card-name" data-f="name">Public API v2</span
                        ><span class="nt-pill" data-f="status">Not started</span></span
                      ></button
                    >
                    <button
                      class="nt-gcard"
                      type="button"
                      data-item="r4"
                      data-status="done"
                      data-owner="sophie"
                      data-due="2026-09-26"
                      data-nt-open="r4"
                      ><img src="images/photos/s-nt-r4-480x260.webp" alt="" loading="lazy" /><span class="nt-gcard-body"
                        ><span class="nt-card-name" data-f="name">Templates gallery</span
                        ><span class="nt-pill" data-f="status">Done</span></span
                      ></button
                    >
                    <button
                      class="nt-gcard"
                      type="button"
                      data-item="r5"
                      data-status="todo"
                      data-owner="aron"
                      data-due="2026-12-04"
                      data-nt-open="r5"
                      ><img src="images/photos/s-nt-r5-480x260.webp" alt="" loading="lazy" /><span class="nt-gcard-body"
                        ><span class="nt-card-name" data-f="name">Home screen widgets</span
                        ><span class="nt-pill" data-f="status">Not started</span></span
                      ></button
                    >
                    <button
                      class="nt-gcard"
                      type="button"
                      data-item="r6"
                      data-status="todo"
                      data-owner="marco"
                      data-due="2026-12-15"
                      data-nt-open="r6"
                      ><img src="images/photos/s-nt-r6-480x260.webp" alt="" loading="lazy" /><span class="nt-gcard-body"
                        ><span class="nt-card-name" data-f="name">AI page summaries</span
                        ><span class="nt-pill" data-f="status">Not started</span></span
                      ></button
                    >
                    <button
                      class="nt-gcard"
                      type="button"
                      data-item="r7"
                      data-status="done"
                      data-owner="aron"
                      data-due="2026-09-19"
                      data-nt-open="r7"
                      ><img src="images/photos/s-nt-r7-480x260.webp" alt="" loading="lazy" /><span class="nt-gcard-body"
                        ><span class="nt-card-name" data-f="name">Slash menu search</span
                        ><span class="nt-pill" data-f="status">Done</span></span
                      ></button
                    >
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </article>
      <article class="nt-page" id="p-meetings" hidden data-page="meetings" aria-labelledby="t-meetings">
        <header class="nt-top">
          <button
            class="sidebar-trigger nt-mobile-trigger"
            type="button"
            data-sidebar-mobile="nt-mobile-nav"
            aria-label="Open navigation"
            data-i18n-aria-label-en="Open navigation"
            data-i18n-aria-label-de="Navigation öffnen"
            ><i data-lucide="menu"></i
          ></button>
          <nav
            class="breadcrumb"
            aria-label="Breadcrumb"
            data-i18n-aria-label-en="Breadcrumb"
            data-i18n-aria-label-de="Pfad"
            ><ol class="breadcrumb-list">
              <li class="breadcrumb-item"
                ><span class="breadcrumb-page" aria-current="page"
                  ><span data-icon-of="meetings">📝</span> <span data-title-of="meetings">Meeting notes</span></span
                ></li
              >
            </ol></nav
          >
          <span class="nt-spacer"></span>
          <span class="nt-edited" data-edited>Edited 1h ago</span>
          <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
          <button
            class="btn nt-star"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-pressed="false"
            data-nt-fav
            aria-label="Favorite"
            data-i18n-aria-label-en="Favorite"
            data-i18n-aria-label-de="Favorit"
            ><i data-lucide="star"></i
          ></button>
          <button
            class="btn"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-haspopup="menu"
            aria-expanded="false"
            aria-controls="nt-more-meetings"
            data-dropdown-trigger="nt-more-meetings"
            aria-label="Page options"
            ><i data-lucide="ellipsis"></i
          ></button>
          <div id="nt-more-meetings" role="menu" popover class="dropdown-content nt-more" aria-label="Page options">
            <div role="group" aria-label="Font" class="nt-fonts">
              <button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="true"
                tabindex="-1"
                data-value="default"
                data-nt-font
                >Default</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="serif"
                data-nt-font
                >Serif</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="mono"
                data-nt-font
                >Mono</button
              >
            </div>
            <div class="dropdown-separator" role="separator"></div>
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="small"
              >Small text</button
            >
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="full"
              >Full width</button
            >
            <div class="dropdown-separator" role="separator"></div>
            <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
              ><i data-lucide="link"></i> Copy link</button
            >
            <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
              ><i data-lucide="trash-2"></i> Move to trash</button
            >
          </div>
        </header>
        <div class="nt-trashed" role="status"
          ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
          ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="meetings"
            >Restore page</button
          ></div
        >
        <div class="nt-scroll">
          <div class="nt-doc">
            <div class="nt-doc-actions">
              <button class="btn" data-variant="ghost" data-size="sm" type="button" data-nt-add-cover
                ><i data-lucide="image"></i> Add cover</button
              >
              <button
                class="btn"
                data-variant="ghost"
                data-size="sm"
                type="button"
                data-toast="Comments are part of the full product"
                ><i data-lucide="message-square"></i> Add comment</button
              >
            </div>
            <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
              ><span data-icon-of="meetings">📝</span></button
            >
            <h1 class="nt-title" id="t-meetings" contenteditable="true" data-placeholder="Untitled" data-nt-title
              >Meeting notes</h1
            >

            <div class="nt-blocks">
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >Weekly sync · Oct 2</div
                ></div
              >
              <div class="nt-block" data-type="bullet"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Real-time cursors are behind a flag on staging</div
                ></div
              >
              <div class="nt-block" data-type="bullet"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="List"
                  >Offline sync needs another week - conflict UI still open</div
                ></div
              >
              <div class="nt-block" data-type="h3"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="4" data-placeholder="Heading 3"
                  >Action items</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Marco: record a demo of the cursors</div
                ></div
              >
              <div class="nt-block" data-type="todo"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><input class="checkbox nt-check" type="checkbox" checked aria-label="Done" /><div
                  class="nt-text"
                  contenteditable="true"
                  data-placeholder="To-do"
                  >Priya: write up the conflict cases</div
                ></div
              >
              <div class="nt-block" data-type="divider"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="false" data-placeholder=""></div
              ></div>
              <div class="nt-block" data-type="h2"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" role="heading" aria-level="3" data-placeholder="Heading 2"
                  >Design review · Sep 25</div
                ></div
              >
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                  >We agreed on the slash menu: icons on the left, a one-line description, type to filter.</div
                ></div
              >
            </div>
          </div>
        </div>
      </article>
      <article class="nt-page" id="p-journal" hidden data-page="journal" aria-labelledby="t-journal">
        <header class="nt-top">
          <button
            class="sidebar-trigger nt-mobile-trigger"
            type="button"
            data-sidebar-mobile="nt-mobile-nav"
            aria-label="Open navigation"
            data-i18n-aria-label-en="Open navigation"
            data-i18n-aria-label-de="Navigation öffnen"
            ><i data-lucide="menu"></i
          ></button>
          <nav
            class="breadcrumb"
            aria-label="Breadcrumb"
            data-i18n-aria-label-en="Breadcrumb"
            data-i18n-aria-label-de="Pfad"
            ><ol class="breadcrumb-list">
              <li class="breadcrumb-item"
                ><span class="breadcrumb-page" aria-current="page"
                  ><span data-icon-of="journal">✏️</span> <span data-title-of="journal">Journal</span></span
                ></li
              >
            </ol></nav
          >
          <span class="nt-spacer"></span>
          <span class="nt-edited" data-edited>Edited Monday</span>
          <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
          <button
            class="btn nt-star"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-pressed="false"
            data-nt-fav
            aria-label="Favorite"
            data-i18n-aria-label-en="Favorite"
            data-i18n-aria-label-de="Favorit"
            ><i data-lucide="star"></i
          ></button>
          <button
            class="btn"
            data-variant="ghost"
            data-size="icon-sm"
            type="button"
            aria-haspopup="menu"
            aria-expanded="false"
            aria-controls="nt-more-journal"
            data-dropdown-trigger="nt-more-journal"
            aria-label="Page options"
            ><i data-lucide="ellipsis"></i
          ></button>
          <div id="nt-more-journal" role="menu" popover class="dropdown-content nt-more" aria-label="Page options">
            <div role="group" aria-label="Font" class="nt-fonts">
              <button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="true"
                tabindex="-1"
                data-value="default"
                data-nt-font
                >Default</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="serif"
                data-nt-font
                >Serif</button
              ><button
                class="dropdown-item dropdown-radio"
                role="menuitemradio"
                aria-checked="false"
                tabindex="-1"
                data-value="mono"
                data-nt-font
                >Mono</button
              >
            </div>
            <div class="dropdown-separator" role="separator"></div>
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="small"
              >Small text</button
            >
            <button
              class="dropdown-item dropdown-check"
              role="menuitemcheckbox"
              aria-checked="false"
              tabindex="-1"
              data-nt-opt="full"
              >Full width</button
            >
            <div class="dropdown-separator" role="separator"></div>
            <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
              ><i data-lucide="link"></i> Copy link</button
            >
            <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
              ><i data-lucide="trash-2"></i> Move to trash</button
            >
          </div>
        </header>
        <div class="nt-trashed" role="status"
          ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
          ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="journal"
            >Restore page</button
          ></div
        >
        <div class="nt-scroll">
          <div class="nt-cover"
            ><img src="images/photos/s-nt-cover-desk-1600x400.webp" alt="" data-nt-cover-img /><span
              class="nt-cover-actions"
              ><button class="btn" data-variant="secondary" data-size="sm" type="button" data-nt-cover
                >Change cover</button
              ></span
            ></div
          >
          <div class="nt-doc">
            <div class="nt-doc-actions">
              <button
                class="btn"
                data-variant="ghost"
                data-size="sm"
                type="button"
                data-toast="Comments are part of the full product"
                ><i data-lucide="message-square"></i> Add comment</button
              >
            </div>
            <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
              ><span data-icon-of="journal">✏️</span></button
            >
            <h1 class="nt-title" id="t-journal" contenteditable="true" data-placeholder="Untitled" data-nt-title
              >Journal</h1
            >

            <div class="nt-blocks">
              <div class="nt-block" data-type="quote"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Empty quote"
                  >The best way to have a good idea is to have a lot of ideas.</div
                ></div
              >
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"
                  >Walked to the harbour before work. Wrote down three ideas for the onboarding checklist on the way
                  back.</div
                ></div
              >
              <div class="nt-block" data-type="image"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><figure class="nt-figure"
                  ><img
                    src="images/photos/s-nt-harbour-1200x600.webp"
                    alt="Morning at the harbour"
                    loading="lazy"
                  /><figcaption class="nt-text" contenteditable="true" data-placeholder="Write a caption…"
                    >Morning at the harbour</figcaption
                  ></figure
                ></div
              >
              <div class="nt-block" data-type="p"
                ><div class="nt-gutter"
                  ><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button
                  ><button
                    class="nt-grip"
                    type="button"
                    tabindex="-1"
                    draggable="true"
                    aria-label="Drag to move, click for options"
                  ></button></div
                ><div class="nt-text" contenteditable="true" data-placeholder="Type '/' for commands"></div
              ></div>
            </div>
          </div>
        </div>
      </article>
    </div>
  </main>

  <!-- floating: the format bar on a selection, the slash menu, the block menu -->
  <div class="nt-format" id="nt-format" popover="manual">
    <div class="toolbar" role="toolbar" aria-label="Format text" data-size="sm">
      <button class="toggle" type="button" aria-pressed="false" data-cmd="bold" aria-label="Bold"
        ><i data-lucide="bold"></i
      ></button>
      <button class="toggle" type="button" aria-pressed="false" data-cmd="italic" aria-label="Italic"
        ><i data-lucide="italic"></i
      ></button>
      <button class="toggle" type="button" aria-pressed="false" data-cmd="underline" aria-label="Underline"
        ><i data-lucide="underline"></i
      ></button>
      <button class="toggle" type="button" aria-pressed="false" data-cmd="strikeThrough" aria-label="Strikethrough"
        ><i data-lucide="strikethrough"></i
      ></button>
      <button class="toggle" type="button" aria-pressed="false" data-cmd="code" aria-label="Inline code"
        ><i data-lucide="code"></i
      ></button>
      <div class="separator" data-orientation="vertical" role="separator"></div>
      <button class="toggle" type="button" aria-pressed="false" data-cmd="mark" aria-label="Highlight"
        ><i data-lucide="highlighter"></i
      ></button>
    </div>
  </div>
  <div class="context-menu nt-slash" id="nt-slash" popover aria-label="Insert a block">
    <p class="nt-menu-heading">Basic blocks</p>
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="p"
      ><span class="nt-slash-icon"><i data-lucide="type"></i></span
      ><span><strong>Text</strong><small>Just start writing with plain text.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="h1"
      ><span class="nt-slash-icon"><i data-lucide="heading-1"></i></span
      ><span><strong>Heading 1</strong><small>Big section heading.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="h2"
      ><span class="nt-slash-icon"><i data-lucide="heading-2"></i></span
      ><span><strong>Heading 2</strong><small>Medium section heading.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="h3"
      ><span class="nt-slash-icon"><i data-lucide="heading-3"></i></span
      ><span><strong>Heading 3</strong><small>Small section heading.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="todo"
      ><span class="nt-slash-icon"><i data-lucide="square-check"></i></span
      ><span><strong>To-do list</strong><small>Track tasks with a to-do list.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="bullet"
      ><span class="nt-slash-icon"><i data-lucide="list"></i></span
      ><span><strong>Bulleted list</strong><small>Create a simple bulleted list.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="number"
      ><span class="nt-slash-icon"><i data-lucide="list-ordered"></i></span
      ><span><strong>Numbered list</strong><small>Create a list with numbering.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="toggle"
      ><span class="nt-slash-icon"><i data-lucide="list-collapse"></i></span
      ><span><strong>Toggle list</strong><small>Toggles can hide and show content inside.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="quote"
      ><span class="nt-slash-icon"><i data-lucide="text-quote"></i></span
      ><span><strong>Quote</strong><small>Capture a quote.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="callout"
      ><span class="nt-slash-icon"><i data-lucide="lightbulb"></i></span
      ><span><strong>Callout</strong><small>Make writing stand out.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="divider"
      ><span class="nt-slash-icon"><i data-lucide="minus"></i></span
      ><span><strong>Divider</strong><small>Visually divide blocks.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="code"
      ><span class="nt-slash-icon"><i data-lucide="code"></i></span
      ><span><strong>Code</strong><small>Capture a code snippet.</small></span></button
    >
    <p class="nt-menu-heading">Hints</p>
    <button
      class="context-menu-item nt-slash-item"
      role="menuitem"
      tabindex="-1"
      type="button"
      data-block="hint"
      data-tone="note"
      ><span class="nt-slash-icon"><i data-lucide="info"></i></span
      ><span><strong>Note</strong><small>Something readers should know.</small></span></button
    >
    <button
      class="context-menu-item nt-slash-item"
      role="menuitem"
      tabindex="-1"
      type="button"
      data-block="hint"
      data-tone="tip"
      ><span class="nt-slash-icon"><i data-lucide="lightbulb"></i></span
      ><span><strong>Tip</strong><small>A better way to do it.</small></span></button
    >
    <button
      class="context-menu-item nt-slash-item"
      role="menuitem"
      tabindex="-1"
      type="button"
      data-block="hint"
      data-tone="warning"
      ><span class="nt-slash-icon"><i data-lucide="triangle-alert"></i></span
      ><span><strong>Warning</strong><small>Needs attention before going on.</small></span></button
    >
    <button
      class="context-menu-item nt-slash-item"
      role="menuitem"
      tabindex="-1"
      type="button"
      data-block="hint"
      data-tone="caution"
      ><span class="nt-slash-icon"><i data-lucide="octagon-alert"></i></span
      ><span><strong>Caution</strong><small>Something that can go wrong for good.</small></span></button
    >
    <p class="nt-menu-heading">Media and data</p>
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="image"
      ><span class="nt-slash-icon"><i data-lucide="image"></i></span
      ><span><strong>Image</strong><small>Upload a picture, embed a link or pick a photo.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="table"
      ><span class="nt-slash-icon"><i data-lucide="sheet"></i></span
      ><span><strong>Table</strong><small>Rows and columns to fill in.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="milestones"
      ><span class="nt-slash-icon"><i data-lucide="milestone"></i></span
      ><span><strong>Milestones</strong><small>Dates on a line; click a dot when one is reached.</small></span></button
    >
    <button class="context-menu-item nt-slash-item" role="menuitem" tabindex="-1" type="button" data-block="db"
      ><span class="nt-slash-icon"><i data-lucide="square-kanban"></i></span
      ><span><strong>Roadmap</strong><small>A database with table, board and gallery views.</small></span></button
    >
    <p class="nt-slash-empty">No results</p>
  </div>
  <div class="context-menu nt-block-menu" id="nt-block-menu" popover aria-label="Block options">
    <p class="nt-menu-heading nt-turn">Turn into</p>
    <button class="context-menu-item" role="menuitem" type="button" data-turn="p"
      ><i data-lucide="type"></i> Text</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="h1"
      ><i data-lucide="heading-1"></i> Heading 1</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="h2"
      ><i data-lucide="heading-2"></i> Heading 2</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="h3"
      ><i data-lucide="heading-3"></i> Heading 3</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="todo"
      ><i data-lucide="square-check"></i> To-do list</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="bullet"
      ><i data-lucide="list"></i> Bulleted list</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="number"
      ><i data-lucide="list-ordered"></i> Numbered list</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="toggle"
      ><i data-lucide="list-collapse"></i> Toggle list</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="quote"
      ><i data-lucide="text-quote"></i> Quote</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="callout"
      ><i data-lucide="lightbulb"></i> Callout</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="code"
      ><i data-lucide="code"></i> Code</button
    >
    <button class="context-menu-item" role="menuitem" type="button" data-turn="hint"
      ><i data-lucide="info"></i> Hint</button
    >
    <div class="context-menu-separator nt-turn" role="separator"></div>
    <button class="context-menu-item" role="menuitem" type="button" data-act="dup"
      ><i data-lucide="copy"></i> Duplicate</button
    >
    <button class="context-menu-item nt-danger" role="menuitem" type="button" data-act="del"
      ><i data-lucide="trash-2"></i> Delete</button
    >
  </div>

  <!-- popovers: an image block's picture, share, icons, trash -->
  <div class="popover nt-image-pick" id="nt-image-pick" popover aria-label="Add an image">
    <p class="nt-menu-heading">Upload</p>
    <label class="btn nt-upload" data-variant="outline" data-size="sm"
      ><i data-lucide="upload"></i> Choose a file<input
        type="file"
        accept="image/png, image/jpeg, image/gif, image/webp"
        data-nt-image-file
    /></label>
    <p class="nt-menu-heading">Embed a link</p>
    <form data-nt-image-link
      ><label class="sr-only" for="nt-image-url">Image link</label
      ><input class="input" id="nt-image-url" type="url" placeholder="https://..." required /><button
        class="btn"
        data-size="sm"
        type="submit"
        >Embed</button
      ></form
    >
    <p class="nt-menu-heading">Photos</p>
    <div class="nt-image-photos"
      ><button type="button" data-nt-photo aria-label="Harbour"
        ><img src="images/photos/s-nt-harbour-1200x600.webp" alt="Morning at the harbour" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Lake"
        ><img src="images/photos/s-nt-cover-lake-1600x400.webp" alt="A lake" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Library"
        ><img src="images/photos/s-nt-cover-library-1600x400.webp" alt="A library" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Mountains"
        ><img src="images/photos/s-nt-cover-mountains-1600x400.webp" alt="Mountains" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Desk"
        ><img src="images/photos/s-nt-cover-desk-1600x400.webp" alt="A desk" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Photo 1"
        ><img src="images/photos/s-nt-r1-480x260.webp" alt="" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Photo 2"
        ><img src="images/photos/s-nt-r2-480x260.webp" alt="" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Photo 3"
        ><img src="images/photos/s-nt-r3-480x260.webp" alt="" loading="lazy" /></button
      ><button type="button" data-nt-photo aria-label="Photo 4"
        ><img src="images/photos/s-nt-r4-480x260.webp" alt="" loading="lazy" /></button
    ></div>
  </div>
  <div class="popover nt-share" id="nt-share" popover>
    <div class="nt-share-head"><strong>Share</strong><span class="nt-muted">Only you have access</span></div>
    <form class="nt-share-invite" data-nt-invite
      ><label class="sr-only" for="nt-invite">Email</label
      ><input class="input" id="nt-invite" type="email" placeholder="Add people, emails…" required /><button
        class="btn nt-blue"
        data-size="sm"
        type="submit"
        >Invite</button
      ></form
    >
    <ul class="nt-share-people">
      <li
        ><span class="avatar" data-size="sm"><img class="avatar-image" src="https://github.com/kyr0.png" alt="" /></span
        ><span><strong>Aron Homberg</strong> (You)<small>aron@folio.app</small></span
        ><span class="nt-muted">Full access</span></li
      >
    </ul>
    <label class="nt-share-web" for="nt-web"
      ><span
        ><i data-lucide="globe"></i
        ><span><strong>Publish to web</strong><small>Anyone with the link can view</small></span></span
      ><input class="switch" type="checkbox" role="switch" id="nt-web" data-nt-web
    /></label>
    <div class="nt-share-foot"
      ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-copy
        ><i data-lucide="link"></i> Copy link</button
      ></div
    >
  </div>
  <div class="popover nt-emojis" id="nt-emoji" popover>
    <div class="nt-emoji-grid"
      ><button type="button" data-emoji="📄" aria-label="Use 📄">📄</button
      ><button type="button" data-emoji="📝" aria-label="Use 📝">📝</button
      ><button type="button" data-emoji="📚" aria-label="Use 📚">📚</button
      ><button type="button" data-emoji="🚀" aria-label="Use 🚀">🚀</button
      ><button type="button" data-emoji="🔍" aria-label="Use 🔍">🔍</button
      ><button type="button" data-emoji="🗺️" aria-label="Use 🗺️">🗺️</button
      ><button type="button" data-emoji="✏️" aria-label="Use ✏️">✏️</button
      ><button type="button" data-emoji="👋" aria-label="Use 👋">👋</button
      ><button type="button" data-emoji="💡" aria-label="Use 💡">💡</button
      ><button type="button" data-emoji="🎯" aria-label="Use 🎯">🎯</button
      ><button type="button" data-emoji="📌" aria-label="Use 📌">📌</button
      ><button type="button" data-emoji="✅" aria-label="Use ✅">✅</button
      ><button type="button" data-emoji="🧠" aria-label="Use 🧠">🧠</button
      ><button type="button" data-emoji="🛠️" aria-label="Use 🛠️">🛠️</button
      ><button type="button" data-emoji="📊" aria-label="Use 📊">📊</button
      ><button type="button" data-emoji="🎨" aria-label="Use 🎨">🎨</button
      ><button type="button" data-emoji="🌱" aria-label="Use 🌱">🌱</button
      ><button type="button" data-emoji="🔥" aria-label="Use 🔥">🔥</button
      ><button type="button" data-emoji="⭐" aria-label="Use ⭐">⭐</button
      ><button type="button" data-emoji="🗂️" aria-label="Use 🗂️">🗂️</button
      ><button type="button" data-emoji="📅" aria-label="Use 📅">📅</button
      ><button type="button" data-emoji="💬" aria-label="Use 💬">💬</button
      ><button type="button" data-emoji="🎉" aria-label="Use 🎉">🎉</button
      ><button type="button" data-emoji="🧪" aria-label="Use 🧪">🧪</button></div
    >
  </div>
  <div class="popover nt-trash" id="nt-trash" popover>
    <p class="nt-menu-heading" data-i18n-target="trash-title">Trash</p>
    <ul data-nt-trash-list></ul>
    <p class="nt-trash-empty" data-i18n-target="trash-empty">No pages in Trash</p>
  </div>

  <!-- ⌘K -->
  <dialog
    id="nt-cmd"
    class="command"
    data-filter="none"
    role="dialog"
    aria-modal="true"
    aria-label="Search"
    data-i18n-aria-label-en="Search"
    data-i18n-aria-label-de="Suchen"
  >
    <div class="command-content">
      <div class="command-input-wrapper"
        ><i data-lucide="search"></i
        ><input
          class="command-input"
          type="text"
          placeholder="Search or jump to a page…"
          data-i18n-placeholder-en="Search or jump to a page…"
          data-i18n-placeholder-de="Suchen oder zu einer Seite springen…"
          autocomplete="off"
          spellcheck="false"
      /></div>
      <div class="command-list">
        <div class="command-group" data-nt-hits></div>
        <div class="command-group" data-nt-cmd-pages>
          <p class="command-group-heading" data-i18n-target="cmd-pages">Pages</p>
          <button class="command-item" data-go="/pages/getting-started" data-page="getting-started"
            ><span data-icon-of="getting-started">👋</span>
            <span data-title-of="getting-started">Getting started</span></button
          >
          <button class="command-item" data-go="/pages/wiki" data-page="wiki"
            ><span data-icon-of="wiki">📚</span> <span data-title-of="wiki">Engineering Wiki</span></button
          >
          <button class="command-item" data-go="/pages/onboarding" data-page="onboarding"
            ><span data-icon-of="onboarding">🚀</span> <span data-title-of="onboarding">Onboarding</span></button
          >
          <button class="command-item" data-go="/pages/code-review" data-page="code-review"
            ><span data-icon-of="code-review">🔍</span>
            <span data-title-of="code-review">Code review guidelines</span></button
          >
          <button class="command-item" data-go="/pages/roadmap" data-page="roadmap"
            ><span data-icon-of="roadmap">🗺️</span> <span data-title-of="roadmap">Product Roadmap</span></button
          >
          <button class="command-item" data-go="/pages/meetings" data-page="meetings"
            ><span data-icon-of="meetings">📝</span> <span data-title-of="meetings">Meeting notes</span></button
          >
          <button class="command-item" data-go="/pages/journal" data-page="journal"
            ><span data-icon-of="journal">✏️</span> <span data-title-of="journal">Journal</span></button
          >
        </div>
        <div class="command-separator"></div>
        <div class="command-group">
          <p class="command-group-heading" data-i18n-target="cmd-actions">Actions</p>
          <button class="command-item" data-nt-new
            ><i data-lucide="square-pen"></i> <span data-i18n-target="cmd-new">New page</span></button
          >
          <button class="command-item" data-nt-theme
            ><i data-lucide="moon"></i> <span data-i18n-target="cmd-dark">Toggle dark mode</span></button
          >
        </div>
        <div class="command-separator"></div>
        <div class="command-group">
          <p class="command-group-heading" data-i18n-target="cmd-templates">New from a template</p>
          <button class="command-item" data-nt-new="roadmap"
            ><i data-lucide="square-kanban"></i> <span data-i18n-target="tpl-roadmap">Roadmap</span></button
          >
          <button class="command-item" data-nt-new="meeting"
            ><i data-lucide="users"></i> <span data-i18n-target="tpl-meeting">Meeting notes</span></button
          >
          <button class="command-item" data-nt-new="wiki"
            ><i data-lucide="book-open"></i> <span data-i18n-target="tpl-wiki">Wiki page</span></button
          >
          <button class="command-item" data-nt-new="journal"
            ><i data-lucide="notebook-pen"></i> <span data-i18n-target="tpl-journal">Journal entry</span></button
          >
          <button class="command-item" data-nt-new="onboarding"
            ><i data-lucide="rocket"></i> <span data-i18n-target="tpl-onboarding">Onboarding</span></button
          >
          <button class="command-item" data-nt-new="project"
            ><i data-lucide="target"></i> <span data-i18n-target="tpl-project">Project brief</span></button
          >
          <button class="command-item" data-nt-new="todo"
            ><i data-lucide="square-check"></i> <span data-i18n-target="tpl-todo">To-do list</span></button
          >
        </div>
      </div>
      <div class="command-empty" hidden data-i18n-target="cmd-empty">No results found.</div>
      <div class="nt-find-status"
        ><span data-nt-find-status></span
        ><button class="btn" data-variant="ghost" data-size="xs" type="button" data-nt-semantic hidden></button
      ></div>
    </div>
  </dialog>

  <!-- a roadmap item, opened from any view -->
  <dialog
    class="sheet nt-peek"
    id="nt-peek"
    data-side="right"
    role="dialog"
    aria-modal="true"
    aria-labelledby="nt-peek-title"
  >
    <div class="sheet-content">
      <div class="sheet-body nt-peek-body">
        <h2
          class="nt-peek-title"
          id="nt-peek-title"
          contenteditable="true"
          data-placeholder="Untitled"
          data-peek="name"
        ></h2>
        <dl class="nt-props">
          <div
            ><dt><i data-lucide="circle-dot"></i>Status</dt
            ><dd
              ><select class="select nt-status" data-peek="status" aria-label="Status"
                ><option value="todo">Not started</option
                ><option value="doing">In progress</option
                ><option value="done">Done</option></select
              ></dd
            ></div
          >
          <div
            ><dt><i data-lucide="user-round"></i>Owner</dt
            ><dd
              ><select class="select" data-peek="owner" aria-label="Owner"
                ><option value="aron">Aron Homberg</option
                ><option value="anna">Anna Silva</option
                ><option value="marco">Marco Rossi</option
                ><option value="priya">Priya Natarajan</option
                ><option value="sophie">Sophie Tan</option></select
              ></dd
            ></div
          >
          <div
            ><dt><i data-lucide="calendar"></i>Due</dt
            ><dd><input class="input" type="date" data-peek="due" aria-label="Due date" /></dd
          ></div>
          <div
            ><dt><i data-lucide="tag"></i>Tags</dt><dd class="nt-tags" data-peek="tags"></dd
          ></div>
        </dl>
        <div class="nt-peek-text" contenteditable="true" data-placeholder="Add a description…" data-peek="body"></div>
      </div>
    </div>
    <button class="sheet-close-x" data-sheet-close aria-label="Close"><i data-lucide="x"></i></button>
  </dialog>

  <!-- Settings: where the workspace is kept, the search and its models, backups (the module writes the status lines) -->
  <dialog
    id="nt-settings"
    class="dialog nt-settings"
    role="dialog"
    aria-modal="true"
    aria-labelledby="nt-settings-title"
    aria-describedby="nt-settings-desc"
  >
    <div class="dialog-content">
      <div class="dialog-header">
        <h2 class="dialog-title" id="nt-settings-title" data-i18n-target="set-title">Settings</h2>
        <p class="dialog-description" id="nt-settings-desc" data-i18n-target="set-desc"
          >Your pages stay in this browser. A backup takes them and the search index anywhere.</p
        >
      </div>
      <div class="dialog-body nt-set">
        <section aria-labelledby="nt-set-storage">
          <h3 id="nt-set-storage" data-i18n-target="set-storage">Storage</h3>
          <p data-nt-set="storage"></p>
          <div class="nt-set-actions">
            <button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-backup
              ><i data-lucide="download"></i> <span data-i18n-target="set-backup">Back up</span></button
            >
            <button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-import
              ><i data-lucide="upload"></i> <span data-i18n-target="set-import">Import…</span></button
            >
            <button class="btn" data-variant="ghost" data-size="sm" type="button" data-nt-reset
              ><i data-lucide="rotate-ccw"></i> <span data-i18n-target="set-reset">Reset to the sample</span></button
            >
          </div>
        </section>
        <section aria-labelledby="nt-set-search">
          <h3 id="nt-set-search" data-i18n-target="set-search">Search</h3>
          <p data-nt-set="lexical"></p>
          <p data-nt-set="semantic"></p>
          <progress
            class="progress"
            data-nt-set="progress"
            max="1"
            value="0"
            hidden
            aria-label="Model download"
            data-i18n-aria-label-en="Model download"
            data-i18n-aria-label-de="Modell-Download"
          ></progress>
          <div class="nt-set-actions">
            <button class="btn" data-size="sm" type="button" data-nt-semantic hidden></button>
            <button class="btn" data-variant="ghost" data-size="sm" type="button" data-nt-forget hidden
              ><i data-lucide="trash-2"></i> <span data-i18n-target="set-forget">Remove the models</span></button
            >
          </div>
        </section>
      </div>
      <div class="dialog-footer">
        <button class="btn" data-variant="outline" type="button" data-dialog-close data-i18n-target="set-close"
          >Close</button
        >
      </div>
    </div>
  </dialog>
  <input
    type="file"
    accept=".br,.json,application/json"
    hidden
    data-nt-import-file
    aria-label="Backup file"
    data-i18n-aria-label-en="Backup file"
    data-i18n-aria-label-de="Sicherungsdatei"
  />
  <!-- asks before a backup or the sample replaces the workspace (the module writes the question) -->
  <dialog
    id="nt-confirm"
    class="alert-dialog"
    role="alertdialog"
    aria-modal="true"
    aria-labelledby="nt-confirm-title"
    aria-describedby="nt-confirm-desc"
  >
    <div class="alert-dialog-content">
      <div class="alert-dialog-header">
        <h2 class="alert-dialog-title" id="nt-confirm-title"></h2>
        <p class="alert-dialog-description" id="nt-confirm-desc"></p>
      </div>
      <div class="alert-dialog-footer">
        <button
          class="btn"
          data-variant="outline"
          type="button"
          data-alert-dialog-close
          data-i18n-target="confirm-cancel"
          >Cancel</button
        >
        <button
          class="btn"
          data-variant="destructive"
          type="button"
          data-alert-dialog-close
          data-nt-confirm-ok
        ></button>
      </div>
    </div>
  </dialog>

  <!-- what the script stamps out -->
  <template id="nt-tpl-page"
    ><article class="nt-page" id="p-__PAGE__" hidden data-page="__PAGE__" aria-labelledby="t-__PAGE__">
      <header class="nt-top">
        <button
          class="sidebar-trigger nt-mobile-trigger"
          type="button"
          data-sidebar-mobile="nt-mobile-nav"
          aria-label="Open navigation"
          data-i18n-aria-label-en="Open navigation"
          data-i18n-aria-label-de="Navigation öffnen"
          ><i data-lucide="menu"></i
        ></button>
        <nav
          class="breadcrumb"
          aria-label="Breadcrumb"
          data-i18n-aria-label-en="Breadcrumb"
          data-i18n-aria-label-de="Pfad"
          ><ol class="breadcrumb-list">
            <li class="breadcrumb-item"
              ><span class="breadcrumb-page" aria-current="page"
                ><span data-icon-of="__PAGE__">📄</span> <span data-title-of="__PAGE__">Untitled</span></span
              ></li
            >
          </ol></nav
        >
        <span class="nt-spacer"></span>
        <span class="nt-edited" data-edited>Edited just now</span>
        <button class="btn" data-variant="ghost" data-size="sm" type="button" popovertarget="nt-share">Share</button>
        <button
          class="btn nt-star"
          data-variant="ghost"
          data-size="icon-sm"
          type="button"
          aria-pressed="false"
          data-nt-fav
          aria-label="Favorite"
          data-i18n-aria-label-en="Favorite"
          data-i18n-aria-label-de="Favorit"
          ><i data-lucide="star"></i
        ></button>
        <button
          class="btn"
          data-variant="ghost"
          data-size="icon-sm"
          type="button"
          aria-haspopup="menu"
          aria-expanded="false"
          aria-controls="nt-more-__PAGE__"
          data-dropdown-trigger="nt-more-__PAGE__"
          aria-label="Page options"
          ><i data-lucide="ellipsis"></i
        ></button>
        <div id="nt-more-__PAGE__" role="menu" popover class="dropdown-content nt-more" aria-label="Page options">
          <div role="group" aria-label="Font" class="nt-fonts">
            <button
              class="dropdown-item dropdown-radio"
              role="menuitemradio"
              aria-checked="true"
              tabindex="-1"
              data-value="default"
              data-nt-font
              >Default</button
            ><button
              class="dropdown-item dropdown-radio"
              role="menuitemradio"
              aria-checked="false"
              tabindex="-1"
              data-value="serif"
              data-nt-font
              >Serif</button
            ><button
              class="dropdown-item dropdown-radio"
              role="menuitemradio"
              aria-checked="false"
              tabindex="-1"
              data-value="mono"
              data-nt-font
              >Mono</button
            >
          </div>
          <div class="dropdown-separator" role="separator"></div>
          <button
            class="dropdown-item dropdown-check"
            role="menuitemcheckbox"
            aria-checked="false"
            tabindex="-1"
            data-nt-opt="small"
            >Small text</button
          >
          <button
            class="dropdown-item dropdown-check"
            role="menuitemcheckbox"
            aria-checked="false"
            tabindex="-1"
            data-nt-opt="full"
            >Full width</button
          >
          <div class="dropdown-separator" role="separator"></div>
          <button class="dropdown-item" role="menuitem" tabindex="-1" data-nt-copy
            ><i data-lucide="link"></i> Copy link</button
          >
          <button class="dropdown-item nt-danger" role="menuitem" tabindex="-1" data-nt-trash
            ><i data-lucide="trash-2"></i> Move to trash</button
          >
        </div>
      </header>
      <div class="nt-trashed" role="status"
        ><i data-lucide="trash-2"></i><span>This page is in Trash.</span
        ><button class="btn" data-variant="outline" data-size="sm" type="button" data-nt-restore="__PAGE__"
          >Restore page</button
        ></div
      >
      <div class="nt-scroll">
        <div class="nt-doc">
          <div class="nt-doc-actions">
            <button class="btn" data-variant="ghost" data-size="sm" type="button" data-nt-add-cover
              ><i data-lucide="image"></i> Add cover</button
            >
            <button
              class="btn"
              data-variant="ghost"
              data-size="sm"
              type="button"
              data-toast="Comments are part of the full product"
              ><i data-lucide="message-square"></i> Add comment</button
            >
          </div>
          <button class="nt-icon" type="button" popovertarget="nt-emoji" data-nt-icon aria-label="Change icon"
            ><span data-icon-of="__PAGE__">📄</span></button
          >
          <h1 class="nt-title" id="t-__PAGE__" contenteditable="true" data-placeholder="Untitled" data-nt-title></h1>
          <div class="nt-starter" data-nt-starter>
            <p>Press <kbd class="kbd">Enter</kbd> to start writing, or pick a template</p>
            <button type="button" data-starter="empty"><i data-lucide="file-text"></i> Empty page</button>
            <button type="button" data-starter="todo"><i data-lucide="square-check"></i> To-do list</button>
            <button type="button" data-starter="meeting"><i data-lucide="users"></i> Meeting notes</button>
            <button type="button" data-starter="roadmap"><i data-lucide="square-kanban"></i> Roadmap</button>
            <button type="button" data-starter="wiki"><i data-lucide="book-open"></i> Wiki page</button>
            <button type="button" data-starter="journal"><i data-lucide="notebook-pen"></i> Journal entry</button>
            <button type="button" data-starter="onboarding"><i data-lucide="rocket"></i> Onboarding</button>
            <button type="button" data-starter="project"><i data-lucide="target"></i> Project brief</button>
          </div>
          <div class="nt-blocks"> </div>
        </div>
      </div> </article
  ></template>
  <template id="nt-tpl-leaf"
    ><li class="tree-item" role="treeitem" data-page="__PAGE__" aria-selected="false"
      ><a class="tree-leaf" href="#/pages/__PAGE__" data-router-link
        ><span class="nt-tree-icon" data-icon-of="__PAGE__">📄</span><span data-title-of="__PAGE__">Untitled</span></a
      ></li
    ></template
  >
  <!-- the translations: one template per target and language (defuss-i18n) -->
  <template data-i18n-for="nav-search-d" data-i18n-locale="en">Search</template>
  <template data-i18n-for="nav-search-d" data-i18n-locale="de">Suchen</template>
  <template data-i18n-for="nav-new-d" data-i18n-locale="en">New page</template>
  <template data-i18n-for="nav-new-d" data-i18n-locale="de">Neue Seite</template>
  <template data-i18n-for="nav-favorites-d" data-i18n-locale="en">Favorites</template>
  <template data-i18n-for="nav-favorites-d" data-i18n-locale="de">Favoriten</template>
  <template data-i18n-for="nav-private-d" data-i18n-locale="en">Private</template>
  <template data-i18n-for="nav-private-d" data-i18n-locale="de">Privat</template>
  <template data-i18n-for="nav-add-d" data-i18n-locale="en">Add a page</template>
  <template data-i18n-for="nav-add-d" data-i18n-locale="de">Seite hinzufügen</template>
  <template data-i18n-for="ws-settings" data-i18n-locale="en">Settings</template>
  <template data-i18n-for="ws-settings" data-i18n-locale="de">Einstellungen</template>
  <template data-i18n-for="ws-backup" data-i18n-locale="en">Back up workspace</template>
  <template data-i18n-for="ws-backup" data-i18n-locale="de">Arbeitsbereich sichern</template>
  <template data-i18n-for="ws-import" data-i18n-locale="en">Import backup…</template>
  <template data-i18n-for="ws-import" data-i18n-locale="de">Sicherung importieren…</template>
  <template data-i18n-for="set-title" data-i18n-locale="en">Settings</template>
  <template data-i18n-for="set-title" data-i18n-locale="de">Einstellungen</template>
  <template data-i18n-for="set-desc" data-i18n-locale="en"
    >Your pages stay in this browser. A backup takes them and the search index anywhere.</template
  >
  <template data-i18n-for="set-desc" data-i18n-locale="de"
    >Deine Seiten bleiben in diesem Browser. Eine Sicherung nimmt sie und den Suchindex überallhin mit.</template
  >
  <template data-i18n-for="set-storage" data-i18n-locale="en">Storage</template>
  <template data-i18n-for="set-storage" data-i18n-locale="de">Speicher</template>
  <template data-i18n-for="set-backup" data-i18n-locale="en">Back up</template>
  <template data-i18n-for="set-backup" data-i18n-locale="de">Sichern</template>
  <template data-i18n-for="set-import" data-i18n-locale="en">Import…</template>
  <template data-i18n-for="set-import" data-i18n-locale="de">Importieren…</template>
  <template data-i18n-for="set-reset" data-i18n-locale="en">Reset to the sample</template>
  <template data-i18n-for="set-reset" data-i18n-locale="de">Auf das Beispiel zurücksetzen</template>
  <template data-i18n-for="set-search" data-i18n-locale="en">Search</template>
  <template data-i18n-for="set-search" data-i18n-locale="de">Suche</template>
  <template data-i18n-for="set-forget" data-i18n-locale="en">Remove the models</template>
  <template data-i18n-for="set-forget" data-i18n-locale="de">Modelle entfernen</template>
  <template data-i18n-for="set-close" data-i18n-locale="en">Close</template>
  <template data-i18n-for="set-close" data-i18n-locale="de">Schließen</template>
  <template data-i18n-for="confirm-cancel" data-i18n-locale="en">Cancel</template>
  <template data-i18n-for="confirm-cancel" data-i18n-locale="de">Abbrechen</template>
  <template data-i18n-for="ws-invite" data-i18n-locale="en">Invite members</template>
  <template data-i18n-for="ws-invite" data-i18n-locale="de">Mitglieder einladen</template>
  <template data-i18n-for="ws-theme" data-i18n-locale="en">Toggle theme</template>
  <template data-i18n-for="ws-theme" data-i18n-locale="de">Design umschalten</template>
  <template data-i18n-for="ws-logout" data-i18n-locale="en">Log out</template>
  <template data-i18n-for="ws-logout" data-i18n-locale="de">Abmelden</template>
  <template data-i18n-for="nav-trash" data-i18n-locale="en">Trash</template>
  <template data-i18n-for="nav-trash" data-i18n-locale="de">Papierkorb</template>
  <template data-i18n-for="nav-help" data-i18n-locale="en">Help</template>
  <template data-i18n-for="nav-help" data-i18n-locale="de">Hilfe</template>
  <template data-i18n-for="nav-search-m" data-i18n-locale="en">Search</template>
  <template data-i18n-for="nav-search-m" data-i18n-locale="de">Suchen</template>
  <template data-i18n-for="nav-new-m" data-i18n-locale="en">New page</template>
  <template data-i18n-for="nav-new-m" data-i18n-locale="de">Neue Seite</template>
  <template data-i18n-for="nav-favorites-m" data-i18n-locale="en">Favorites</template>
  <template data-i18n-for="nav-favorites-m" data-i18n-locale="de">Favoriten</template>
  <template data-i18n-for="nav-private-m" data-i18n-locale="en">Private</template>
  <template data-i18n-for="nav-private-m" data-i18n-locale="de">Privat</template>
  <template data-i18n-for="nav-add-m" data-i18n-locale="en">Add a page</template>
  <template data-i18n-for="nav-add-m" data-i18n-locale="de">Seite hinzufügen</template>
  <template data-i18n-for="cmd-pages" data-i18n-locale="en">Pages</template>
  <template data-i18n-for="cmd-pages" data-i18n-locale="de">Seiten</template>
  <template data-i18n-for="cmd-actions" data-i18n-locale="en">Actions</template>
  <template data-i18n-for="cmd-actions" data-i18n-locale="de">Aktionen</template>
  <template data-i18n-for="cmd-new" data-i18n-locale="en">New page</template>
  <template data-i18n-for="cmd-new" data-i18n-locale="de">Neue Seite</template>
  <template data-i18n-for="cmd-dark" data-i18n-locale="en">Toggle dark mode</template>
  <template data-i18n-for="cmd-dark" data-i18n-locale="de">Dunkelmodus umschalten</template>
  <template data-i18n-for="cmd-templates" data-i18n-locale="en">New from a template</template>
  <template data-i18n-for="cmd-templates" data-i18n-locale="de">Neu aus einer Vorlage</template>
  <template data-i18n-for="tpl-roadmap" data-i18n-locale="en">Roadmap</template>
  <template data-i18n-for="tpl-roadmap" data-i18n-locale="de">Roadmap</template>
  <template data-i18n-for="tpl-meeting" data-i18n-locale="en">Meeting notes</template>
  <template data-i18n-for="tpl-meeting" data-i18n-locale="de">Besprechungsnotizen</template>
  <template data-i18n-for="tpl-wiki" data-i18n-locale="en">Wiki page</template>
  <template data-i18n-for="tpl-wiki" data-i18n-locale="de">Wiki-Seite</template>
  <template data-i18n-for="tpl-journal" data-i18n-locale="en">Journal entry</template>
  <template data-i18n-for="tpl-journal" data-i18n-locale="de">Tagebucheintrag</template>
  <template data-i18n-for="tpl-onboarding" data-i18n-locale="en">Onboarding</template>
  <template data-i18n-for="tpl-onboarding" data-i18n-locale="de">Einarbeitung</template>
  <template data-i18n-for="tpl-project" data-i18n-locale="en">Project brief</template>
  <template data-i18n-for="tpl-project" data-i18n-locale="de">Projektsteckbrief</template>
  <template data-i18n-for="tpl-todo" data-i18n-locale="en">To-do list</template>
  <template data-i18n-for="tpl-todo" data-i18n-locale="de">Aufgabenliste</template>
  <template data-i18n-for="cmd-empty" data-i18n-locale="en">No results found.</template>
  <template data-i18n-for="cmd-empty" data-i18n-locale="de">Keine Ergebnisse.</template>
  <template data-i18n-for="trash-title" data-i18n-locale="en">Trash</template>
  <template data-i18n-for="trash-title" data-i18n-locale="de">Papierkorb</template>
  <template data-i18n-for="trash-empty" data-i18n-locale="en">No pages in Trash</template>
  <template data-i18n-for="trash-empty" data-i18n-locale="de">Keine Seiten im Papierkorb</template>
</div>
<script>
  // Folio's wiring: the block editor (Enter, Backspace, arrows, markdown
  // shortcuts, the slash menu, the format bar, drag to move), pages (title
  // and icon everywhere, new pages, favorites, trash, page options) and the
  // roadmap database (views, drag between columns, the peek, new items)
  (() => {
    const app = document.querySelector('[data-nt]');
    // the authored blocks as a reader would have typed them: .nt-text keeps every space (pre-wrap, so typed spaces
    // stay), and the example's source wraps long lines - a wrap and its indent showed as a line break and a gap
    // ("Click anywhere and / start typing"). Before anything reads the page; a stored workspace is left as it is
    app.querySelectorAll('.nt-text').forEach((t) => {
      const walk = document.createTreeWalker(t, NodeFilter.SHOW_TEXT);
      for (let n = walk.nextNode(); n; n = walk.nextNode())
        if (n.data.includes('\n')) n.data = n.data.replace(/\s*\n\s*/g, ' ');
    });
    const PREFIX = {
      todo: '<input class="checkbox nt-check" type="checkbox" aria-label="Done">',
      toggle: '<button class="nt-arrow" type="button" aria-expanded="false" aria-label="Expand"></button>',
      callout: '<span class="nt-emoji" aria-hidden="true">💡</span>',
    };
    const PH = {
      p: "Type '/' for commands",
      h1: 'Heading 1',
      h2: 'Heading 2',
      h3: 'Heading 3',
      todo: 'To-do',
      bullet: 'List',
      number: 'List',
      toggle: 'Toggle',
      quote: 'Empty quote',
      callout: 'Type something…',
      hint: 'Type a hint...',
      code: 'Code',
    };
    const LEVEL = { h1: 2, h2: 3, h3: 4 };
    const GUTTER =
      '<div class="nt-gutter"><button class="nt-add" type="button" tabindex="-1" aria-label="Add a block below"></button><button class="nt-grip" type="button" tabindex="-1" draggable="true" aria-label="Drag to move, click for options"></button></div>';
    const STATUS = { todo: 'Not started', doing: 'In progress', done: 'Done' };
    const PEOPLE = {
      aron: { name: 'Aron Homberg', face: 0, src: 'https://github.com/kyr0.png' },
      anna: { name: 'Anna Silva', face: 47 },
      marco: { name: 'Marco Rossi', face: 68 },
      priya: { name: 'Priya Natarajan', face: 16 },
      sophie: { name: 'Sophie Tan', face: 25 },
    };
    const TAGS = { editor: 'Editor', sync: 'Sync', api: 'API', mobile: 'Mobile', ai: 'AI' };
    const COVERS = ['nt-cover-lake', 'nt-cover-library', 'nt-cover-mountains', 'nt-cover-desk'];
    const toast = (title, description) => df$.shadcn.toast.show(description ? { title, description } : { title });
    // the page the router module shows; a script navigates by changing the hash, which the router follows
    const page = () => app.querySelector('.nt-page:not([hidden])');
    const textOf = (b) => b.querySelector(':scope > .nt-text, :scope > figure > .nt-text, :scope > .nt-hint .nt-text');
    const blockOf = (el) => el.closest('.nt-block');
    const edited = (p) => {
      const e = (p || page()).querySelector('[data-edited]');
      if (e) e.textContent = 'Edited just now';
    };
    const lucide = () => globalThis.lucide && globalThis.lucide.createIcons();

    // -- navigation: the tree shows the current page --------------------------------------
    const sync = () => {
      const slug = page().dataset.page;
      app
        .querySelectorAll('.nt-tree .tree-item[data-page]')
        .forEach((li) => li.setAttribute('aria-selected', li.dataset.page === slug ? 'true' : 'false'));
      app.querySelectorAll('.nt-tree [data-page="' + slug + '"]').forEach((li) => {
        for (
          let d = li.parentElement.closest('details.tree-branch');
          d;
          d = d.parentElement.closest('details.tree-branch')
        )
          d.open = true;
      });
      const m = document.getElementById('nt-mobile-nav');
      if (m && m.open) m.close();
      hideFormat();
    };
    app.addEventListener('nt-route', sync);
    // a branch row (a page with sub-pages) navigates too - a leaf is a router link, the router takes its click
    app.addEventListener('tree-select', (e) => {
      const slug = e.detail.item.dataset.page;
      if (e.detail.item.querySelector(':scope > a[data-router-link]')) return;
      if (slug && location.hash !== '#/pages/' + slug) location.hash = '/pages/' + slug;
    });

    // -- blocks -----------------------------------------------------------------------------
    const clean = (t) => {
      if (t.textContent === '' && !t.querySelector('img, kbd, a')) t.replaceChildren();
    };
    // a hint is a text block inside the shipped Alert: its tone names the icon, the title and the colour
    const HINTS = {
      note: ['info', 'Note'],
      tip: ['lightbulb', 'Tip'],
      warning: ['triangle-alert', 'Warning'],
      caution: ['octagon-alert', 'Caution'],
    };
    const setType = (b, type, tone) => {
      b.querySelectorAll(':scope > :is(.nt-check, .nt-arrow, .nt-emoji)').forEach((x) => x.remove());
      const t = textOf(b);
      const box = b.querySelector(':scope > .nt-hint');
      if (box) {
        t.classList.remove('alert-description');
        box.replaceWith(t);
        b.removeAttribute('data-tone');
      }
      if (type === 'hint') {
        tone = HINTS[tone] ? tone : 'note';
        b.dataset.tone = tone;
        const a = document.createElement('div');
        a.className = 'alert nt-hint';
        a.setAttribute('role', 'note');
        a.dataset.tone = tone;
        if (tone === 'caution') a.dataset.variant = 'destructive';
        a.innerHTML =
          '<i class="alert-icon" data-lucide="' +
          HINTS[tone][0] +
          '" aria-hidden="true"></i><div class="alert-content"><p class="alert-title">' +
          HINTS[tone][1] +
          '</p></div>';
        t.before(a);
        t.classList.add('alert-description');
        a.lastElementChild.append(t);
        lucide();
      }
      b.dataset.type = type;
      if (PREFIX[type]) t.insertAdjacentHTML('beforebegin', PREFIX[type]);
      t.dataset.placeholder = PH[type] || '';
      t.contentEditable = type === 'divider' ? 'false' : 'true';
      if (LEVEL[type]) {
        t.setAttribute('role', 'heading');
        t.setAttribute('aria-level', LEVEL[type]);
      } else {
        t.removeAttribute('role');
        t.removeAttribute('aria-level');
      }
      t.spellcheck = type !== 'code';
      const kids = b.querySelector(':scope > .nt-children');
      if (type === 'toggle' && !kids) {
        const c = document.createElement('div');
        c.className = 'nt-children';
        c.append(make('p'));
        b.append(c);
      }
      if (type !== 'toggle' && kids) {
        b.after(...kids.children);
        kids.remove();
        b.removeAttribute('data-open');
      }
    };
    const make = (type, html, tone) => {
      const b = document.createElement('div');
      b.className = 'nt-block';
      b.innerHTML = GUTTER + '<div class="nt-text" contenteditable="true"></div>';
      setType(b, type || 'p', tone);
      if (html) textOf(b).innerHTML = html;
      return b;
    };
    // the component blocks hold markup of their own instead of one text: an image (a caption is its text), a
    // table (the shipped Table), milestones (a Timeline) and a roadmap database
    const PARTS = ['image', 'table', 'milestones', 'db'];
    const esc = (s) =>
      String(s ?? '').replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' })[c]);
    const part = (type, html) => {
      const b = document.createElement('div');
      b.className = 'nt-block';
      b.dataset.type = type;
      b.innerHTML = GUTTER + html;
      return b;
    };
    const adds = (list) =>
      '<div class="nt-part-actions">' +
      list
        .map(
          ([k, label]) =>
            '<button class="btn" data-variant="ghost" data-size="xs" type="button" data-nt-part="' +
            k +
            '"><i data-lucide="plus"></i> ' +
            label +
            '</button>',
        )
        .join('') +
      '</div>';
    const IMAGE_ACTIONS =
      '<span class="nt-image-actions"><button class="btn" data-variant="secondary" data-size="sm" type="button" popovertarget="nt-image-pick" data-nt-image>Replace</button></span>';
    const imageBlock = (src, caption) =>
      part(
        'image',
        '<figure class="nt-figure">' +
          (src
            ? '<img src="' + esc(src) + '" alt="' + esc(caption) + '">' + IMAGE_ACTIONS
            : '<div class="nt-image-empty"><button class="btn" data-variant="outline" data-size="sm" type="button" popovertarget="nt-image-pick" data-nt-image><i data-lucide="image-plus"></i> Add an image</button></div>') +
          '<figcaption class="nt-text" contenteditable="true" data-placeholder="Write a caption...">' +
          esc(caption) +
          '</figcaption></figure>',
      );
    const cell = (head, text) =>
      head
        ? '<th class="table-head nt-cell" scope="col" contenteditable="true">' + esc(text) + '</th>'
        : '<td class="table-cell nt-cell" contenteditable="true">' + esc(text) + '</td>';
    const tableBlock = (rows) => {
      const [head, ...body] = rows?.length
        ? rows
        : [
            ['Name', 'Notes', 'Status'],
            ['', '', ''],
            ['', '', ''],
          ];
      return part(
        'table',
        '<div class="nt-part nt-table"><div class="table-container"><table class="table"><thead><tr class="table-row">' +
          head.map((x) => cell(true, x)).join('') +
          '</tr></thead><tbody>' +
          body.map((r) => '<tr class="table-row">' + r.map((x) => cell(false, x)).join('') + '</tr>').join('') +
          '</tbody></table></div>' +
          adds([
            ['row', 'Row'],
            ['col', 'Column'],
          ]) +
          '</div>',
      );
    };
    const milestone = (title, when, reached) =>
      '<li class="timeline-item"><button class="timeline-dot" type="button" data-variant="' +
      (reached ? 'active' : 'outline') +
      '" aria-pressed="' +
      !!reached +
      '" aria-label="Reached"></button><div class="timeline-content"><p class="timeline-title nt-cell" contenteditable="true" data-placeholder="Milestone">' +
      esc(title) +
      '</p><time class="timeline-time nt-cell" contenteditable="true" data-placeholder="When">' +
      esc(when) +
      '</time></div></li>';
    const milestonesBlock = (list) =>
      part(
        'milestones',
        '<div class="nt-part nt-milestones"><ol class="timeline" data-orientation="horizontal">' +
          (list?.length
            ? list
            : [
                ['Kick-off', 'Week 1', true],
                ['First version', 'Week 4'],
                ['Launch', 'Week 8'],
              ]
          )
            .map((m) => milestone(...m))
            .join('') +
          '</ol>' +
          adds([['milestone', 'Milestone']]) +
          '</div>',
      );
    // one spec per block: [type, text or rows, tone]
    const build = ([type, a, b]) => {
      if (type === 'image') return imageBlock(a, b);
      if (type === 'table') return tableBlock(a);
      if (type === 'milestones') return milestonesBlock(a);
      if (type === 'db') return dbBlock(a);
      return make(type, a, b);
    };
    const caret = (el, atStart) => {
      el.focus();
      const r = document.createRange();
      r.selectNodeContents(el);
      r.collapse(!!atStart);
      const s = getSelection();
      s.removeAllRanges();
      s.addRange(r);
    };
    const before = (el) => {
      const s = getSelection();
      if (!s.rangeCount) return '';
      const r = s.getRangeAt(0).cloneRange();
      r.setStart(el, 0);
      return r.toString();
    };
    const after = (el) => {
      const s = getSelection();
      if (!s.rangeCount) return '';
      const r = s.getRangeAt(0).cloneRange();
      r.setEnd(el, el.childNodes.length);
      return r.toString();
    };
    const texts = () =>
      [
        ...page().querySelectorAll(
          '.nt-blocks .nt-block > .nt-text, .nt-blocks .nt-figure > .nt-text, .nt-blocks .nt-hint .nt-text',
        ),
      ].filter((t) => t.checkVisibility() && t.isContentEditable);
    const pos = (el, n) => {
      const w = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
      for (let x = w.nextNode(); x; x = w.nextNode()) {
        if (n <= x.length) return [x, n];
        n -= x.length;
      }
      return [el, el.childNodes.length];
    };
    const LISTS = ['todo', 'bullet', 'number'];
    const SHORT = {
      '#': 'h1',
      '##': 'h2',
      '###': 'h3',
      '-': 'bullet',
      '*': 'bullet',
      '1.': 'number',
      '[]': 'todo',
      '>': 'quote',
      '"': 'quote',
      '```': 'code',
    };

    app.addEventListener('keydown', (e) => {
      const title = e.target.closest('[data-nt-title]');
      if (title && e.key === 'Enter') {
        e.preventDefault();
        const p = title.closest('.nt-page');
        const starter = p.querySelector('[data-nt-starter]');
        if (starter) return start(p, 'empty');
        const first = p.querySelector('.nt-blocks .nt-text');
        if (first) caret(first, true);
        return;
      }
      // a table cell: Enter goes one row down (a new row after the last); a milestone's fields are one line each
      const c = e.target.closest('.nt-blocks .nt-cell');
      if (c && e.key === 'Enter' && !e.shiftKey && !e.isComposing) {
        e.preventDefault();
        const tr = c.closest('tr');
        if (!tr) return c.blur();
        const col = [...tr.children].indexOf(c);
        let next =
          tr.parentElement.tagName === 'THEAD' ? c.closest('table').tBodies[0]?.rows[0] : tr.nextElementSibling;
        if (!next) next = addRow(c.closest('table'));
        caret(next.children[col], false);
        edited();
        return;
      }
      const t = e.target.closest('.nt-blocks .nt-text');
      if (!t || e.isComposing) return;
      const b = blockOf(t);
      if (slash.open) {
        if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
          e.preventDefault();
          slashMove(e.key === 'ArrowDown' ? 1 : -1);
          return;
        }
        if (e.key === 'Enter' || e.key === 'Tab') {
          e.preventDefault();
          const a = slashMenu.querySelector('[data-active]');
          if (a) pick(a.dataset.block, a.dataset.tone);
          else closeSlash();
          return;
        }
        if (e.key === 'Escape') {
          e.preventDefault();
          closeSlash();
          return;
        }
      }
      if (e.key === 'Enter' && !e.shiftKey) {
        e.preventDefault();
        if (b.dataset.type === 'code') {
          document.execCommand('insertText', false, '\n');
          return;
        }
        const type = b.dataset.type;
        if ((LISTS.includes(type) || ['toggle', 'quote', 'callout', 'hint'].includes(type)) && t.textContent === '') {
          setType(b, 'p');
          return;
        }
        const r = getSelection().getRangeAt(0);
        r.deleteContents();
        const tail = r.cloneRange();
        tail.setEnd(t, t.childNodes.length);
        const nb = make(LISTS.includes(type) ? type : 'p');
        textOf(nb).append(tail.extractContents());
        clean(t);
        clean(textOf(nb));
        if (type === 'toggle' && b.hasAttribute('data-open')) b.querySelector(':scope > .nt-children').prepend(nb);
        else b.after(nb);
        caret(textOf(nb), true);
        edited();
        return;
      }
      if (e.key === 'Backspace' && getSelection().isCollapsed && before(t) === '' && !t.closest('figure')) {
        if (b.dataset.type !== 'p') {
          e.preventDefault();
          setType(b, 'p');
          edited();
          return;
        }
        const prevBlock = b.previousElementSibling;
        if (prevBlock && prevBlock.dataset.type === 'divider') {
          e.preventDefault();
          prevBlock.remove();
          edited();
          return;
        }
        const all = texts();
        const prev = all[all.indexOf(t) - 1];
        if (!prev || blockOf(prev).dataset.type === 'image') return;
        e.preventDefault();
        prev.focus();
        const r = document.createRange();
        r.selectNodeContents(prev);
        r.collapse(false);
        prev.append(...t.childNodes);
        const s = getSelection();
        s.removeAllRanges();
        s.addRange(r);
        const kids = b.querySelector(':scope > .nt-children');
        if (kids) b.after(...kids.children);
        b.remove();
        edited();
        return;
      }
      if ((e.key === 'ArrowUp' && before(t) === '') || (e.key === 'ArrowDown' && after(t) === '')) {
        const all = texts();
        const next = all[all.indexOf(t) + (e.key === 'ArrowDown' ? 1 : -1)];
        if (next) {
          e.preventDefault();
          caret(next, e.key === 'ArrowDown');
        }
      }
    });

    app.addEventListener('input', (e) => {
      const title = e.target.closest('[data-nt-title]');
      if (title) {
        const slug = title.closest('.nt-page').dataset.page;
        const name = title.textContent.trim() || 'Untitled';
        app.querySelectorAll('[data-title-of="' + slug + '"]').forEach((x) => {
          x.textContent = name;
        });
        if (!title.textContent) title.replaceChildren();
        edited();
        return;
      }
      const t = e.target.closest('.nt-blocks .nt-text');
      if (!t) {
        if (e.target.closest('.nt-blocks .nt-cell')) edited();
        return;
      }
      const b = blockOf(t);
      edited();
      clean(t);
      const im = t.matches('figcaption') && t.parentElement.querySelector('img');
      if (im) im.alt = t.textContent.trim();
      // markdown shortcuts: "# " "- " "[] " "> " … at the start of a text block
      if (b.dataset.type === 'p' && e.inputType === 'insertText' && e.data === ' ') {
        const head = before(t).replace(/\u00a0/g, ' ');
        const type = SHORT[head.slice(0, -1)];
        if (type && head.endsWith(' ')) {
          const r = document.createRange();
          r.setStart(...pos(t, 0));
          r.setEnd(...pos(t, head.length));
          r.deleteContents();
          setType(b, type);
          caret(textOf(b), true);
          if (type === 'code') clean(textOf(b));
          return;
        }
      }
      if (e.inputType === 'insertText' && e.data === '/') {
        const head = before(t);
        if (head.length === 1 || /\s/.test(head.at(-2))) return openSlash(t, head.length - 1);
      }
      if (slash.open) {
        const head = before(t);
        if (slash.t !== t || head.length <= slash.from || head[slash.from] !== '/') return closeSlash();
        filterSlash(head.slice(slash.from + 1));
      }
    });

    // to-dos, toggles
    app.addEventListener('change', (e) => {
      if (e.target.matches('.nt-check')) edited();
    });
    const toggleOpen = (arrow) => {
      const b = blockOf(arrow);
      const open = !b.hasAttribute('data-open');
      b.toggleAttribute('data-open', open);
      arrow.setAttribute('aria-expanded', open);
      arrow.setAttribute('aria-label', open ? 'Collapse' : 'Expand');
    };

    // -- the slash menu (the shipped Context Menu, opened at the caret) ----------------------
    const slashMenu = app.querySelector('#nt-slash');
    const slash = { open: false, shown: false, t: null, from: 0 };
    const menuApi = (m, name, cfg) => df$.shadcn.contextMenuApi.setState(m, name, cfg);
    const caretRect = (t) => {
      const s = getSelection();
      const r = s.rangeCount ? s.getRangeAt(0).getBoundingClientRect() : null;
      return r && (r.width || r.height) ? r : t.getBoundingClientRect();
    };
    const place = (m, r) => {
      const h = m.offsetHeight,
        w = m.offsetWidth;
      m.style.top = (r.bottom + 6 + h > innerHeight ? Math.max(8, r.top - h - 6) : r.bottom + 6) + 'px';
      m.style.left = Math.max(8, Math.min(r.left, innerWidth - w - 8)) + 'px';
    };
    const openSlash = (t, from) => {
      Object.assign(slash, { open: true, shown: slashMenu.matches(':popover-open'), t, from });
      filterSlash('');
      const r = caretRect(t);
      slashMenu._at = r;
      menuApi(slashMenu, 'open', { x: r.left, y: r.bottom + 6 });
    };
    // the menus show deferred; once open, keep them inside the viewport
    [slashMenu, app.querySelector('#nt-block-menu')].forEach((m) =>
      m.addEventListener('toggle', (e) => {
        if (e.newState === 'open' && m._at) place(m, m._at);
      }),
    );
    const closeSlash = () => {
      slash.open = false;
      slash.shown = false;
      if (slashMenu.matches(':popover-open')) menuApi(slashMenu, 'default');
    };
    // the menu closes by itself too (Escape, a click outside). A close counts only for a menu that showed: the
    // toggle event of the last close arrives after its exit transition (150 ms), and a "/" typed meanwhile had
    // opened the menu again - Enter then split the line instead of picking (VERIFIED: tmp/notes/probe-slash.ts)
    slashMenu.addEventListener('toggle', (e) => {
      if (e.newState === 'open') slash.shown = true;
      else if (slash.shown) slash.open = slash.shown = false;
    });
    const filterSlash = (q) => {
      q = q.toLowerCase().trim();
      const items = [...slashMenu.querySelectorAll('.nt-slash-item')];
      items.forEach((i) => {
        i.hidden = !!q && !i.textContent.toLowerCase().includes(q) && !i.dataset.block.startsWith(q);
        i.removeAttribute('data-active');
      });
      const first = items.find((i) => !i.hidden);
      if (first) first.setAttribute('data-active', '');
      if (!first && q.length > 3) closeSlash();
    };
    const slashMove = (d) => {
      const items = [...slashMenu.querySelectorAll('.nt-slash-item:not([hidden])')];
      const at = items.findIndex((i) => i.hasAttribute('data-active'));
      items.forEach((i) => i.removeAttribute('data-active'));
      const next = items[(at + d + items.length) % items.length];
      if (next) {
        next.setAttribute('data-active', '');
        next.scrollIntoView({ block: 'nearest' });
      }
    };
    const pick = (type, tone) => {
      const t = slash.t;
      const end = before(t).length;
      const r = document.createRange();
      r.setStart(...pos(t, slash.from));
      r.setEnd(...pos(t, end));
      r.deleteContents();
      clean(t);
      closeSlash();
      let b = blockOf(t);
      // a component block takes the place of an empty text block (or goes after a written one), a text block follows
      if (PARTS.includes(type) || b.dataset.type === 'image') {
        const nb = build([type, undefined, tone]);
        if (t.textContent.trim() === '' && b.dataset.type !== 'image') b.replaceWith(nb);
        else b.after(nb);
        const after = PARTS.includes(type) || type === 'divider' ? make('p') : null;
        if (after) nb.after(after);
        lucide();
        fill(nb);
        const first = type === 'divider' ? textOf(after) : nb.querySelector('.nt-cell, .nt-text');
        nb.scrollIntoView({ block: 'nearest' });
        if (type === 'image') nb.querySelector('[data-nt-image]').click();
        else if (first) caret(first, false);
        edited();
        return;
      }
      if (t.textContent.trim() !== '') {
        const nb = make(type, '', tone);
        b.after(nb);
        b = nb;
      } else setType(b, type, tone);
      if (type === 'divider') {
        const nb = make('p');
        b.after(nb);
        caret(textOf(nb), true);
      } else caret(textOf(b), false);
      edited();
    };
    slashMenu.addEventListener('mousedown', (e) => e.preventDefault());
    slashMenu.addEventListener('click', (e) => {
      const i = e.target.closest('.nt-slash-item');
      if (i && slash.t) pick(i.dataset.block, i.dataset.tone);
    });

    // -- the block gutter: + inserts below and opens the slash menu, ⋮⋮ opens block options --
    const blockMenu = app.querySelector('#nt-block-menu');
    let menuBlock = null;
    app.addEventListener('click', (e) => {
      const add = e.target.closest('.nt-add');
      if (add) {
        const nb = make('p');
        blockOf(add).after(nb);
        caret(textOf(nb), true);
        document.execCommand('insertText', false, '/');
        return;
      }
      const grip = e.target.closest('.nt-grip');
      if (grip) {
        menuBlock = blockOf(grip);
        app.querySelectorAll('.nt-block[data-selected]').forEach((x) => x.removeAttribute('data-selected'));
        menuBlock.setAttribute('data-selected', '');
        // a component block cannot turn into text, and a database is not copied (its items are one of a kind)
        const kind = menuBlock.dataset.type;
        blockMenu.dataset.kind = kind === 'db' ? 'db' : PARTS.includes(kind) ? 'part' : 'text';
        const r = grip.getBoundingClientRect();
        blockMenu._at = { top: r.top, bottom: r.top - 6, left: r.right + 4 };
        menuApi(blockMenu, 'open', { x: r.right + 4, y: r.top });
        return;
      }
      const arrow = e.target.closest('.nt-arrow');
      if (arrow) toggleOpen(arrow);
      // the component blocks: a row or a column more, a milestone more, a milestone reached
      const more = e.target.closest('[data-nt-part]');
      if (more) {
        const b = blockOf(more);
        const k = more.dataset.ntPart;
        if (k === 'row') caret(addRow(b.querySelector('table')).cells[0], false);
        if (k === 'col') {
          const table = b.querySelector('table');
          for (const tr of table.rows)
            tr.insertAdjacentHTML('beforeend', cell(tr.parentElement.tagName === 'THEAD', ''));
          caret(table.rows[0].lastElementChild, false);
        }
        if (k === 'milestone') {
          const ol = b.querySelector('.timeline');
          ol.insertAdjacentHTML('beforeend', milestone('', ''));
          caret(ol.lastElementChild.querySelector('.timeline-title'), false);
        }
        edited();
        return;
      }
      const dot = e.target.closest('.nt-milestones .timeline-dot');
      if (dot) {
        const on = dot.getAttribute('aria-pressed') !== 'true';
        dot.setAttribute('aria-pressed', on);
        dot.dataset.variant = on ? 'active' : 'outline';
        edited();
      }
      const img = e.target.closest('[data-nt-image]');
      if (img) {
        // the picker opens at the button clicked: the Popover gives every trigger of one popover the same anchor
        // name, and a button just made has none yet
        imageFor = blockOf(img);
        app.querySelectorAll('[data-nt-image]').forEach((x) => {
          x.style.anchorName = x === img ? '--nt-image-pick' : '';
        });
        pickImage.style.positionAnchor = '--nt-image-pick';
      }
    });
    const addRow = (table) => {
      const body = table.tBodies[0];
      body.insertAdjacentHTML(
        'beforeend',
        '<tr class="table-row">' + [...table.rows[0].cells].map(() => cell(false, '')).join('') + '</tr>',
      );
      return body.lastElementChild;
    };

    // -- an image block's picture: a file (made smaller, kept as a data URL), a link or one of the photos ------------
    let imageFor = null;
    const pickImage = app.querySelector('#nt-image-pick');
    const setImage = (src) => {
      const b = imageFor;
      pickImage.hidePopover();
      if (!b || !b.isConnected) return;
      const fig = b.querySelector('figure');
      fig.querySelector('.nt-image-empty')?.remove();
      let im = fig.querySelector('img');
      if (!im) {
        fig.insertAdjacentHTML('afterbegin', '<img alt="">' + IMAGE_ACTIONS);
        im = fig.querySelector('img');
      }
      im.src = src;
      im.alt = textOf(b)?.textContent.trim() ?? '';
      caret(textOf(b), false);
      edited();
    };
    const shrink = async (file) => {
      const bmp = await createImageBitmap(file);
      const k = Math.min(1, 1600 / bmp.width);
      const c = document.createElement('canvas');
      c.width = Math.round(bmp.width * k);
      c.height = Math.round(bmp.height * k);
      c.getContext('2d').drawImage(bmp, 0, 0, c.width, c.height);
      bmp.close();
      return c.toDataURL('image/webp', 0.82);
    };
    pickImage.addEventListener('change', async (e) => {
      const input = e.target.closest('[data-nt-image-file]');
      const file = input?.files[0];
      if (!file) return;
      input.value = '';
      try {
        setImage(await shrink(file));
      } catch {
        toast('This browser cannot read that picture');
      }
    });
    pickImage.querySelector('[data-nt-image-link]').addEventListener('submit', (e) => {
      e.preventDefault();
      const input = e.target.querySelector('input');
      if (!/^https?:\/\//i.test(input.value.trim())) return toast('An image link starts with https://');
      setImage(input.value.trim());
      input.value = '';
    });
    pickImage.addEventListener('click', (e) => {
      const photo = e.target.closest('[data-nt-photo]');
      if (photo) setImage(photo.querySelector('img').getAttribute('src'));
    });
    blockMenu.addEventListener('toggle', (e) => {
      if (e.newState === 'closed' && menuBlock) menuBlock.removeAttribute('data-selected');
    });
    blockMenu.addEventListener('click', (e) => {
      const item = e.target.closest('.context-menu-item');
      if (!item || !menuBlock) return;
      menuApi(blockMenu, 'default');
      if (item.dataset.turn) {
        setType(menuBlock, item.dataset.turn);
        caret(textOf(menuBlock), false);
      }
      if (item.dataset.act === 'dup') {
        const c = menuBlock.cloneNode(true);
        c.removeAttribute('data-selected');
        menuBlock.after(c);
      }
      if (item.dataset.act === 'del') {
        const all = texts(),
          t = textOf(menuBlock);
        const prev = all[all.indexOf(t) - 1];
        menuBlock.remove();
        if (prev) caret(prev, false);
        toast('Block deleted');
      }
      edited();
    });

    // -- drag to move (blocks by their ⋮⋮, roadmap cards between columns) -------------------
    let drag = null;
    app.addEventListener('dragstart', (e) => {
      const grip = e.target.closest('.nt-grip');
      const card = e.target.closest('.nt-card');
      if (grip) {
        drag = { kind: 'block', el: blockOf(grip) };
        e.dataTransfer.setDragImage(drag.el, 16, 12);
      } else if (card) drag = { kind: 'card', el: card };
      else return;
      e.dataTransfer.effectAllowed = 'move';
      e.dataTransfer.setData('text/plain', '');
      drag.el.setAttribute('data-dragging', '');
    });
    const unmark = () =>
      app.querySelectorAll('[data-drop], [data-over]').forEach((x) => {
        x.removeAttribute('data-drop');
        x.removeAttribute('data-over');
      });
    app.addEventListener('dragover', (e) => {
      if (!drag) return;
      if (drag.kind === 'block') {
        const b = e.target.closest('.nt-blocks .nt-block');
        if (!b || b === drag.el || drag.el.contains(b)) return;
        e.preventDefault();
        const r = b.getBoundingClientRect();
        const where = e.clientY < r.top + r.height / 2 ? 'before' : 'after';
        if (b.dataset.drop !== where) {
          unmark();
          b.dataset.drop = where;
        }
      } else {
        const col = e.target.closest('.nt-col');
        if (!col || col.closest('[data-nt-db]') !== drag.el.closest('[data-nt-db]')) return;
        e.preventDefault();
        if (!col.hasAttribute('data-over')) {
          unmark();
          col.setAttribute('data-over', '');
        }
      }
    });
    app.addEventListener('drop', (e) => {
      if (!drag) return;
      e.preventDefault();
      const b = app.querySelector('.nt-block[data-drop]');
      const col = app.querySelector('.nt-col[data-over]');
      if (drag.kind === 'block' && b) {
        b.dataset.drop === 'before' ? b.before(drag.el) : b.after(drag.el);
        edited();
      }
      if (drag.kind === 'card' && col) setItem(drag.el.dataset.item, 'status', col.dataset.status);
      unmark();
    });
    app.addEventListener('dragend', () => {
      if (drag) drag.el.removeAttribute('data-dragging');
      drag = null;
      unmark();
    });

    // -- the format bar on a selection (the shipped Toolbar) ---------------------------------
    const bar = app.querySelector('#nt-format');
    let tick;
    const hideFormat = () => {
      if (bar.matches(':popover-open')) bar.hidePopover();
    };
    const inCode = () => {
      const n = getSelection().anchorNode;
      return !!(n && (n.nodeType === 1 ? n : n.parentElement).closest('.nt-text code'));
    };
    const inMark = () => {
      const n = getSelection().anchorNode;
      return !!(n && (n.nodeType === 1 ? n : n.parentElement).closest('.nt-text mark'));
    };
    const showFormat = () => {
      const s = getSelection();
      const n = s.rangeCount && !s.isCollapsed ? s.anchorNode : null;
      const t = n && (n.nodeType === 1 ? n : n.parentElement).closest('.nt-blocks .nt-text');
      if (!t || !s.toString().trim() || blockOf(t).dataset.type === 'code') return hideFormat();
      if (!bar.matches(':popover-open')) bar.showPopover();
      const r = s.getRangeAt(0).getBoundingClientRect();
      bar.style.top = Math.max(8, r.top - bar.offsetHeight - 8) + 'px';
      bar.style.left =
        Math.max(8, Math.min(r.left + r.width / 2 - bar.offsetWidth / 2, innerWidth - bar.offsetWidth - 8)) + 'px';
      bar.querySelectorAll('[data-cmd]').forEach((x) => {
        const c = x.dataset.cmd;
        x.setAttribute(
          'aria-pressed',
          String(c === 'code' ? inCode() : c === 'mark' ? inMark() : document.queryCommandState(c)),
        );
      });
    };
    document.addEventListener('selectionchange', () => {
      clearTimeout(tick);
      tick = setTimeout(showFormat, 80);
    });
    const wrap = (tag) => {
      const s = getSelection();
      const n = s.anchorNode;
      const inside = n && (n.nodeType === 1 ? n : n.parentElement).closest('.nt-text ' + tag);
      if (inside) {
        inside.replaceWith(...inside.childNodes);
        return;
      }
      const r = s.getRangeAt(0);
      const el = document.createElement(tag);
      el.append(r.extractContents());
      r.insertNode(el);
      s.removeAllRanges();
      const sel = document.createRange();
      sel.selectNodeContents(el);
      s.addRange(sel);
    };
    bar.addEventListener('mousedown', (e) => e.preventDefault());
    bar.addEventListener('click', (e) => {
      const x = e.target.closest('[data-cmd]');
      if (!x) return;
      const c = x.dataset.cmd;
      if (c === 'code') wrap('code');
      else if (c === 'mark') wrap('mark');
      else document.execCommand(c);
      edited();
      setTimeout(showFormat, 0);
    });

    // -- pages: icon, cover, new, favorite, trash, options -----------------------------------
    let iconPage = null;
    let n = 0;
    const leafTpl = document.getElementById('nt-tpl-leaf');
    const pageTpl = document.getElementById('nt-tpl-page');
    const newPage = (kind) => {
      const slug = 'untitled-' + ++n;
      app.querySelector('.nt-pages').insertAdjacentHTML('beforeend', pageTpl.innerHTML.replaceAll('__PAGE__', slug));
      app
        .querySelectorAll('[data-nt-private]')
        .forEach((tree) => tree.insertAdjacentHTML('beforeend', leafTpl.innerHTML.replaceAll('__PAGE__', slug)));
      app
        .querySelector('[data-nt-cmd-pages]')
        .insertAdjacentHTML(
          'beforeend',
          '<button class="command-item" data-go="/pages/' +
            slug +
            '" data-page="' +
            slug +
            '"><span data-icon-of="' +
            slug +
            '">📄</span> <span data-title-of="' +
            slug +
            '">Untitled</span></button>',
        );
      lucide();
      location.hash = '/pages/' + slug;
      // a template fills the page once the router shows it (the caret needs a shown page)
      requestAnimationFrame(() => {
        const p = app.querySelector('#p-' + slug);
        if (kind && TEMPLATES[kind]) start(p, kind);
        else app.querySelector('#t-' + slug).focus();
      });
    };
    const today = (long) =>
      new Date().toLocaleDateString(
        'en-US',
        long ? { weekday: 'long', month: 'long', day: 'numeric' } : { month: 'short', day: 'numeric' },
      );
    // the templates a page starts from: the starter on a new page and the palette's "New from a template" offer
    // them. Each names an icon, a title, a cover and full width where it wants them, and its blocks as specs
    // for build(): [type, text | rows | items, tone]. They mirror the sample pages
    const TEMPLATES = {
      empty: { blocks: [['p', '']] },
      todo: {
        icon: '✅',
        blocks: [
          ['todo', ''],
          ['todo', ''],
          ['todo', ''],
        ],
      },
      meeting: {
        icon: '📝',
        title: () => 'Meeting notes · ' + today(),
        focus: '[data-type="bullet"] > .nt-text',
        blocks: [
          ['h2', 'Agenda'],
          ['bullet', ''],
          ['h2', 'Notes'],
          ['p', ''],
          ['h2', 'Action items'],
          ['todo', ''],
        ],
      },
      roadmap: {
        icon: '🗺️',
        title: () => 'Roadmap',
        cover: 'nt-cover-mountains',
        full: true,
        blocks: [
          [
            'p',
            'What we are building, and when. Switch views, drag cards between columns, or open an item to edit it.',
          ],
          ['milestones'],
          ['db'],
        ],
      },
      wiki: {
        icon: '📚',
        title: () => 'Wiki page',
        blocks: [
          ['hint', 'Who keeps this page up to date, and when it was last checked.', 'note'],
          ['h2', 'Overview'],
          ['p', ''],
          ['h2', 'How it works'],
          ['number', ''],
          ['h2', 'Questions'],
          ['toggle', 'A question people ask'],
          ['h2', 'Related pages'],
          ['bullet', ''],
        ],
      },
      journal: {
        icon: '✏️',
        title: () => today(true),
        focus: '[data-type="p"] > .nt-text',
        blocks: [
          ['h2', 'Today'],
          ['p', ''],
          ['image'],
          ['h2', 'Grateful for'],
          ['bullet', ''],
          ['h2', 'Tomorrow'],
          ['todo', ''],
        ],
      },
      onboarding: {
        icon: '🚀',
        title: () => 'Onboarding',
        cover: 'nt-cover-desk',
        blocks: [
          ['hint', 'Work through this list in your first week, and ask whenever you are stuck.', 'tip'],
          ['h2', 'Week one'],
          ['todo', 'Set up your laptop'],
          ['todo', 'Meet your buddy'],
          ['todo', 'Ship a first small change'],
          ['h2', 'The first months'],
          [
            'milestones',
            [
              ['First day', 'Day 1', true],
              ['First change shipped', 'Week 1'],
              ['First feature', 'Month 1'],
              ['On call', 'Month 3'],
            ],
          ],
          ['h2', 'People to meet'],
          [
            'table',
            [
              ['Name', 'Role', 'When'],
              ['', '', ''],
              ['', '', ''],
            ],
          ],
        ],
      },
      project: {
        icon: '🎯',
        title: () => 'Project brief',
        blocks: [
          ['hint', 'One page: why, what, who and when.', 'note'],
          ['h2', 'Problem'],
          ['p', ''],
          ['h2', 'Goals'],
          ['bullet', ''],
          ['h2', 'Timeline'],
          ['milestones'],
          ['h2', 'Risks'],
          ['hint', 'What could stop us, and what we do about it.', 'warning'],
          ['h2', 'Who does what'],
          [
            'table',
            [
              ['Task', 'Owner', 'Due'],
              ['', '', ''],
              ['', '', ''],
            ],
          ],
        ],
      },
    };
    const setCover = (p, name) => {
      const doc = p.querySelector('.nt-doc');
      doc.insertAdjacentHTML(
        'beforebegin',
        '<div class="nt-cover"><img src="images/photos/s-' +
          name +
          '-1600x400.webp" alt=""><span class="nt-cover-actions"><button class="btn" data-variant="secondary" data-size="sm" type="button" data-nt-cover>Change cover</button></span></div>',
      );
      doc.querySelector('[data-nt-add-cover]')?.remove();
    };
    const start = (p, kind) => {
      const tpl = TEMPLATES[kind];
      p.querySelector('[data-nt-starter]')?.remove();
      const slug = p.dataset.page;
      if (tpl.icon)
        app.querySelectorAll('[data-icon-of="' + slug + '"]').forEach((x) => {
          x.textContent = tpl.icon;
        });
      if (tpl.cover && !p.querySelector('.nt-cover')) setCover(p, tpl.cover);
      if (tpl.full) {
        p.setAttribute('data-full', '');
        p.querySelector('[data-nt-opt="full"]')?.setAttribute('aria-checked', 'true');
      }
      const title = p.querySelector('[data-nt-title]');
      if (tpl.title && !title.textContent.trim()) {
        title.textContent = tpl.title();
        title.dispatchEvent(new InputEvent('input', { bubbles: true }));
      }
      const blocks = p.querySelector('.nt-blocks');
      const made = tpl.blocks.map(build);
      blocks.append(...made);
      made.forEach(fill);
      lucide();
      const first = blocks.querySelector(tpl.focus || '.nt-text');
      if (first) caret(first, true);
      edited(p);
    };
    const favs = () => app.querySelectorAll('[data-nt-favs]');
    const setFav = (slug, on) => {
      app
        .querySelectorAll('.nt-page[data-page="' + slug + '"] [data-nt-fav]')
        .forEach((s) => s.setAttribute('aria-pressed', on));
      favs().forEach((tree) => {
        const has = tree.querySelector('[data-page="' + slug + '"]');
        if (on && !has) {
          const src = app.querySelector('[data-nt-private] [data-page="' + slug + '"]');
          tree.insertAdjacentHTML('beforeend', leafTpl.innerHTML.replaceAll('__PAGE__', slug));
          const li = tree.lastElementChild;
          li.querySelector('[data-icon-of]').textContent = src.querySelector('[data-icon-of]').textContent;
          li.querySelector('[data-title-of]').textContent = src.querySelector('[data-title-of]').textContent;
        }
        if (!on && has) has.remove();
      });
    };
    const trash = (slug) => {
      const p = app.querySelector('.nt-page[data-page="' + slug + '"]');
      p.setAttribute('data-trashed', '');
      app
        .querySelectorAll('.nt-tree [data-page="' + slug + '"], [data-nt-cmd-pages] [data-page="' + slug + '"]')
        .forEach((x) => {
          x.hidden = true;
        });
      const li = document.createElement('li');
      li.dataset.page = slug;
      li.innerHTML =
        '<span></span><button class="btn" data-variant="ghost" data-size="xs" type="button" data-nt-restore="' +
        slug +
        '">Restore</button>';
      li.firstChild.textContent =
        p.querySelector('[data-icon-of]').textContent +
        ' ' +
        (p.querySelector('[data-nt-title]').textContent || 'Untitled');
      app.querySelector('[data-nt-trash-list]').append(li);
      const home = [...app.querySelectorAll('.nt-page:not([data-trashed])')][0];
      location.hash = home ? '/pages/' + home.dataset.page : '/';
      toast('Moved to Trash', 'Restore it from Trash in the sidebar.');
    };
    const restore = (slug) => {
      app.querySelector('.nt-page[data-page="' + slug + '"]').removeAttribute('data-trashed');
      app.querySelectorAll('[data-page="' + slug + '"][hidden]').forEach((x) => {
        x.hidden = false;
      });
      app.querySelector('[data-nt-trash-list] [data-page="' + slug + '"]')?.remove();
      toast('Page restored');
    };
    app.addEventListener('dropdown:select', (e) => {
      const p = e.target.closest('.nt-page');
      if (!p) return;
      const item = e.detail.item;
      if (item.hasAttribute('data-nt-font')) {
        if (item.dataset.value === 'default') p.removeAttribute('data-font');
        else p.dataset.font = item.dataset.value;
      }
      if (item.dataset.ntOpt) p.toggleAttribute('data-' + item.dataset.ntOpt, e.detail.checked);
      if (item.hasAttribute('data-nt-trash')) trash(p.dataset.page);
    });

    // -- the roadmap databases ----------------------------------------------------------------
    // a page may hold several (the sample's Product Roadmap, the Roadmap template, a /roadmap block): an item's
    // id is unique in the workspace, so the item names its database. A new database is the sample's markup with
    // its items taken out, read before the stored workspace replaces the pages; a new item is one of the sample's
    // rows, cards and gallery cards. The counters are read again on `nt-restored`
    const peek = app.querySelector('#nt-peek');
    let peekId = null,
      itemN = 7,
      dbN = 0;
    const sample = app.querySelector('[data-nt-db]');
    const proto = (el) => {
      const c = el.cloneNode(true);
      for (const x of [c, ...c.querySelectorAll('*')])
        for (const a of ['data-init', 'data-api', 'data-state-name', 'data-dragging']) x.removeAttribute(a);
      return c;
    };
    const ITEM = {
      row: proto(sample.querySelector('tr[data-item]')),
      card: proto(sample.querySelector('.nt-card')),
      g: proto(sample.querySelector('.nt-gcard')),
    };
    const DB = proto(sample);
    DB.querySelectorAll('[data-item]').forEach((x) => x.remove());
    DB.querySelector('[data-nt-db-filter]').removeAttribute('value');
    DB.querySelectorAll('.nt-count').forEach((c) => {
      c.textContent = '0';
    });
    const highest = (sel, attr, re) =>
      Math.max(0, ...[...app.querySelectorAll(sel)].map((x) => Number((re.exec(x.getAttribute(attr)) || [])[1]) || 0));
    const recount = () => {
      itemN = Math.max(7, highest('[data-nt-db] tr[data-item]', 'data-item', /^r(\d+)$/));
      dbN = highest('[data-nt-db] .nt-db-views input', 'name', /^nt-db-view-(\d+)$/);
    };
    recount();
    app.addEventListener('nt-restored', () => {
      recount();
      n = highest('.nt-page[data-page]', 'data-page', /^untitled-(\d+)$/);
      if (page()) sync();
    });
    const fmt = (iso) =>
      iso
        ? new Date(iso + 'T12:00:00').toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })
        : 'Empty';
    const person = (k) =>
      '<span class="avatar" data-size="sm"><img class="avatar-image" src="' +
      (PEOPLE[k].src || 'images/avatars/' + PEOPLE[k].face + '-96.webp') +
      '" alt=""></span><span>' +
      PEOPLE[k].name +
      '</span>';
    const dbOf = (id) => app.querySelector('[data-nt-db] tr[data-item="' + id + '"]')?.closest('[data-nt-db]');
    const counts = (db) =>
      db.querySelectorAll('.nt-col').forEach((c) => {
        c.querySelector('.nt-count').textContent = c.querySelectorAll('.nt-card').length;
      });
    // `db` is given while a new database is still being built (not yet in the page)
    const setItem = (id, field, v, db = dbOf(id)) => {
      db.querySelectorAll('[data-item="' + id + '"]').forEach((el) => {
        if (field === 'name')
          el.querySelectorAll('[data-f="name"]').forEach((x) => {
            x.textContent = v || 'Untitled';
          });
        if (field === 'status') {
          el.dataset.status = v;
          el.querySelectorAll('select[data-field="status"]').forEach((s) => {
            s.value = v;
            s.dataset.s = v;
          });
          el.querySelectorAll('[data-f="status"]').forEach((x) => {
            x.textContent = STATUS[v];
          });
        }
        if (field === 'owner') {
          el.dataset.owner = v;
          el.querySelectorAll('[data-f="owner"]').forEach((x) => {
            x.innerHTML = person(v);
          });
        }
        if (field === 'due') {
          el.dataset.due = v;
          el.querySelectorAll('[data-f="due"]').forEach((x) => {
            x.textContent = fmt(v);
          });
        }
      });
      if (field === 'status') {
        const card = db.querySelector('.nt-card[data-item="' + id + '"]');
        db.querySelector('.nt-col[data-status="' + v + '"] .nt-cards').append(card);
        counts(db);
      }
      if (peekId === id && field === 'status') {
        const s = peek.querySelector('[data-peek="status"]');
        s.value = v;
        s.dataset.s = v;
      }
      edited(db.closest('.nt-page'));
    };
    const rowOf = (id) => app.querySelector('[data-nt-db] tr[data-item="' + id + '"]');
    const openPeek = (id) => {
      const row = rowOf(id);
      peekId = id;
      peek.querySelector('[data-peek="name"]').textContent =
        row.querySelector('[data-f="name"]').textContent === 'Untitled'
          ? ''
          : row.querySelector('[data-f="name"]').textContent;
      const s = peek.querySelector('[data-peek="status"]');
      s.value = row.dataset.status;
      s.dataset.s = row.dataset.status;
      peek.querySelector('[data-peek="owner"]').value = row.dataset.owner;
      peek.querySelector('[data-peek="due"]').value = row.dataset.due;
      peek.querySelector('[data-peek="tags"]').innerHTML =
        row.querySelector('[data-f="tags"]').innerHTML || '<span class="nt-muted">Empty</span>';
      peek.querySelector('[data-peek="body"]').textContent = row.dataset.body || '';
      peek.showModal();
    };
    const BODIES = {
      r1: 'Show who is editing where - a coloured caret and a name tag per person.',
      r2: "Edit without a connection; merge on reconnect without losing anyone's changes.",
      r3: 'Pages, blocks and databases over one REST surface, with webhooks.',
      r4: 'Start any page from a template: meeting notes, roadmap, wiki, journal.',
      r5: "Pin a page or a to-do list to the phone's home screen.",
      r6: 'One paragraph at the top of any long page, refreshed as it changes.',
      r7: 'Type after the slash to filter block types; Enter inserts the highlighted one.',
    };
    sample.querySelectorAll('tr[data-item]').forEach((r) => {
      r.dataset.body = BODIES[r.dataset.item] || '';
    });
    peek.addEventListener('input', (e) => {
      if (!peekId) return;
      const f = e.target.dataset.peek;
      if (f === 'name') setItem(peekId, 'name', e.target.textContent.trim());
      if (f === 'body') rowOf(peekId).dataset.body = e.target.textContent;
    });
    peek.addEventListener('change', (e) => {
      const f = e.target.dataset.peek;
      if (peekId && (f === 'status' || f === 'owner' || f === 'due')) setItem(peekId, f, e.target.value);
    });
    peek.addEventListener('close', () => {
      peekId = null;
    });
    app.addEventListener('change', (e) => {
      const s = e.target.closest('[data-nt-db] select[data-field="status"]');
      if (s) setItem(s.closest('[data-item]').dataset.item, 'status', s.value);
    });
    // a new item in a database; without a name it opens in the peek to be named there
    const newItem = (db, status, name) => {
      const id = 'r' + ++itemN;
      const today = new Date().toISOString().slice(0, 10);
      const tpl = (el) => {
        const c = el.cloneNode(true);
        c.dataset.item = id;
        c.querySelectorAll('[data-nt-open]').forEach((x) => {
          x.dataset.ntOpen = id;
        });
        if (c.dataset.ntOpen) c.dataset.ntOpen = id;
        c.querySelectorAll('[data-f="tags"]').forEach((x) => x.replaceChildren());
        c.hidden = false;
        return c;
      };
      const row = tpl(ITEM.row);
      const card = tpl(ITEM.card);
      const g = tpl(ITEM.g);
      // the gallery shows one of the seven hosted roadmap photos
      const img = g.querySelector('img');
      img.setAttribute('src', img.getAttribute('src').replace(/s-nt-r\d+/, 's-nt-r' + (((itemN - 1) % 7) + 1)));
      db.querySelector('[data-nt-rows]').append(row);
      db.querySelector('.nt-col .nt-cards').append(card);
      db.querySelector('.nt-db-gallery').append(g);
      row.dataset.body = '';
      setItem(id, 'name', name ?? '', db);
      setItem(id, 'owner', 'aron', db);
      setItem(id, 'due', today, db);
      setItem(id, 'status', status || 'todo', db);
      if (name === undefined) {
        openPeek(id);
        requestAnimationFrame(() => peek.querySelector('[data-peek="name"]').focus());
      }
    };
    const STARTER_ITEMS = [
      ['Write down the first milestone', 'doing'],
      ['Collect ideas from the team', 'todo'],
      ['Set up this board', 'done'],
    ];
    // a database block: its own radio group for the views; the items go in once it is in the page (fill)
    const dbBlock = (list) => {
      const d = DB.cloneNode(true);
      const name = 'nt-db-view-' + ++dbN;
      d.querySelectorAll('.nt-db-views input').forEach((x) => {
        x.name = name;
      });
      const b = part('db', '');
      b.classList.add('nt-db-block');
      b.append(d);
      b._items = list ?? STARTER_ITEMS;
      return b;
    };
    const fill = (b) => {
      const d = b.querySelector(':scope > [data-nt-db]');
      if (!d || !b._items) return;
      b._items.forEach(([title, status]) => newItem(d, status, title));
      delete b._items;
    };
    app.addEventListener('input', (e) => {
      if (!e.target.matches('[data-nt-db-filter]')) return;
      const q = e.target.value.trim().toLowerCase();
      e.target
        .closest('[data-nt-db]')
        .querySelectorAll('[data-item]')
        .forEach((x) => {
          x.hidden = !!q && !x.querySelector('[data-f="name"]').textContent.toLowerCase().includes(q);
        });
    });

    // -- clicks --------------------------------------------------------------------------------
    app.addEventListener('click', (e) => {
      const go = e.target.closest('[data-go]');
      if (go) location.hash = go.dataset.go;
      const nw = e.target.closest('[data-nt-new]');
      if (nw) newPage(nw.dataset.ntNew);
      if (e.target.closest('[data-nt-theme]')) document.documentElement.classList.toggle('dark');
      const st = e.target.closest('[data-starter]');
      if (st) start(st.closest('.nt-page'), st.dataset.starter);
      const icon = e.target.closest('[data-nt-icon]');
      if (icon) iconPage = icon.closest('.nt-page').dataset.page;
      const emo = e.target.closest('[data-emoji]');
      if (emo && iconPage) {
        app.querySelectorAll('[data-icon-of="' + iconPage + '"]').forEach((x) => {
          x.textContent = emo.dataset.emoji;
        });
        app.querySelector('#nt-emoji').hidePopover();
        edited();
      }
      const cover = e.target.closest('[data-nt-cover]');
      if (cover) {
        const img = cover.closest('.nt-cover').querySelector('img');
        const at = COVERS.findIndex((c) => img.src.includes(c));
        img.src = 'images/photos/s-' + COVERS[(at + 1) % COVERS.length] + '-1600x400.webp';
      }
      const addCover = e.target.closest('[data-nt-add-cover]');
      if (addCover) setCover(addCover.closest('.nt-page'), COVERS[Math.floor(Math.random() * COVERS.length)]);
      const fav = e.target.closest('[data-nt-fav]');
      if (fav) {
        const on = fav.getAttribute('aria-pressed') !== 'true';
        setFav(fav.closest('.nt-page').dataset.page, on);
        toast(on ? 'Added to Favorites' : 'Removed from Favorites');
      }
      const res = e.target.closest('[data-nt-restore]');
      if (res) restore(res.dataset.ntRestore);
      if (e.target.closest('[data-nt-copy]')) {
        navigator.clipboard?.writeText(location.href).catch(() => {});
        toast('Link copied');
      }
      const open = e.target.closest('[data-nt-open]');
      if (open && !drag) openPeek(open.dataset.ntOpen);
      const dbNew = e.target.closest('[data-nt-db-new]');
      if (dbNew) newItem(dbNew.closest('[data-nt-db]'), dbNew.dataset.status);
      const t = e.target.closest('[data-toast]');
      if (t) toast(t.dataset.toast, t.dataset.toastDesc);
    });
    app.querySelector('[data-nt-invite]').addEventListener('submit', (e) => {
      e.preventDefault();
      const input = e.target.querySelector('input');
      toast('Invitation sent', input.value + ' can now edit this page.');
      input.value = '';
    });
    app
      .querySelector('[data-nt-web]')
      .addEventListener('change', (e) => toast(e.target.checked ? 'Published to the web' : 'Unpublished'));

    sync();
  })();
</script>
<script type="module">
  // routing and translation: defuss-dom-router owns the address, defuss-i18n the language; the workspace lives in
  // defuss-storage (the origin private file system) and defuss-search ranks every section by keywords and by meaning
  import { createRouter } from 'https://cdn.jsdelivr.net/npm/defuss-dom-router@0.1.1/dist/index.js';
  import { createDomI18n, createI18n } from 'https://cdn.jsdelivr.net/npm/defuss-i18n@0.2.0/dist/core.js';

  // loaded beside the page: the storage adapters and the lexical search; the two models only when asked for
  const STORAGE = Promise.all([
    import('https://cdn.jsdelivr.net/npm/defuss-storage@0.3.1/dist/index.mjs'),
    import('https://cdn.jsdelivr.net/npm/defuss-storage@0.3.1/dist/directory.mjs'),
  ]);
  const SEARCH = Promise.all([
    import('https://cdn.jsdelivr.net/npm/defuss-lexicalsearch@0.4.0/dist/index.js'),
    import('https://cdn.jsdelivr.net/npm/defuss-lexicalsearch@0.4.0/dist/en.js'),
    import('https://cdn.jsdelivr.net/npm/defuss-lexicalsearch@0.4.0/dist/de.js'),
    import('https://cdn.jsdelivr.net/npm/defuss-search@0.5.0/dist/strategies.js'),
  ]);
  const MODELS = () =>
    Promise.all([
      import('https://cdn.jsdelivr.net/npm/defuss-vectorsearch@0.4.0/dist/onnx.mjs'),
      import('https://cdn.jsdelivr.net/npm/defuss-brotli@0.3.0/dist/decompressor-slim.js'),
    ]);
  const BROTLI_WASM = 'https://cdn.jsdelivr.net/npm/defuss-brotli@0.3.0/dist/decompressor.wasm';
  // a full-screen page names its own path to the pictures here (the build rewrites the string)
  const IMAGES = 'images/';

  const WORDS = {
    en: {
      opening: 'Opening your pages...',
      late: 'Your kept pages did not open',
      lateDesc:
        'The storage did not answer in time. This visit shows the sample and keeps nothing - reload to try again.',
      saved: 'Saved in this browser',
      saving: 'Saving…',
      memory: 'Not kept - this preview has no storage',
      failed: 'Not saved: %e',
      storageOpfs:
        'Your pages are kept in this browser, in its origin private file system (saved %t). Nothing leaves it.',
      storageMemory:
        'This preview has no storage, so your pages are gone on reload - the full-screen app keeps them. A backup takes them along either way.',
      never: 'not yet',
      lexical: 'Keyword search over %n sections: ready.',
      lexicalLoading: 'Keyword search is loading…',
      semanticOff:
        'Search by meaning runs two models in this browser - Winzling-embed finds what a query means, a ColBERT reranker orders the best hits. About 34 MB, downloaded once.',
      semanticKept: 'Search by meaning: the models are kept in this browser.',
      semanticLoading: 'Downloading %f - %l of %m',
      semanticStarting: 'Starting the models…',
      semanticIndexing: 'Reading your pages by meaning: %i of %n sections…',
      semanticReady: 'Search by meaning: ready - %n sections, %k.',
      keptHere: 'the models are kept in this browser',
      keptMemory: 'the models stay until the page reloads',
      semanticError: 'The models could not load: %e',
      load: 'Download the models (~34 MB)',
      loadKept: 'Turn on search by meaning',
      retry: 'Try again',
      offer: 'Also search by meaning',
      results: '%n results in %t ms - keywords',
      resultsHybrid: '%n results in %t ms - keywords and meaning',
      plain: 'Titles only until the search has loaded',
      viaWords: 'keywords',
      viaMeaning: 'meaning',
      backedUp: 'Backup saved',
      backedUpDesc: '%n pages and the search index in %f.',
      imported: 'Backup imported',
      importedDesc: '%n pages from %d.',
      notBackup: 'Not a Folio backup',
      reset: 'Back to the sample workspace',
      forgotten: 'Models removed',
      importTitle: 'Replace this workspace?',
      importText: 'The backup from %d holds %n pages. It replaces every page here - back them up first to keep them.',
      importOk: 'Replace',
      resetTitle: 'Reset to the sample?',
      resetText: 'Every page goes back to the sample workspace. Back up first to keep your pages.',
      resetOk: 'Reset',
    },
    de: {
      opening: 'Seiten werden geöffnet...',
      late: 'Deine gespeicherten Seiten haben sich nicht geöffnet',
      lateDesc:
        'Der Speicher hat nicht rechtzeitig geantwortet. Dieser Besuch zeigt das Beispiel und speichert nichts - lade neu, um es noch einmal zu versuchen.',
      saved: 'In diesem Browser gespeichert',
      saving: 'Wird gespeichert…',
      memory: 'Nicht gespeichert - diese Vorschau hat keinen Speicher',
      failed: 'Nicht gespeichert: %e',
      storageOpfs:
        'Deine Seiten bleiben in diesem Browser, in seinem Origin Private File System (gespeichert %t). Nichts verlässt ihn.',
      storageMemory:
        'Diese Vorschau hat keinen Speicher, deine Seiten sind nach dem Neuladen weg - die Vollbild-App behält sie. Eine Sicherung nimmt sie in jedem Fall mit.',
      never: 'noch nicht',
      lexical: 'Stichwortsuche über %n Abschnitte: bereit.',
      lexicalLoading: 'Die Stichwortsuche wird geladen…',
      semanticOff:
        'Die Suche nach Bedeutung führt zwei Modelle in diesem Browser aus - Winzling-embed versteht, was eine Anfrage meint, ein ColBERT-Reranker ordnet die besten Treffer. Etwa 34 MB, einmal geladen.',
      semanticKept: 'Suche nach Bedeutung: die Modelle liegen in diesem Browser.',
      semanticLoading: '%f wird geladen - %l von %m',
      semanticStarting: 'Die Modelle starten…',
      semanticIndexing: 'Deine Seiten werden nach Bedeutung gelesen: %i von %n Abschnitten…',
      semanticReady: 'Suche nach Bedeutung: bereit - %n Abschnitte, %k.',
      keptHere: 'die Modelle bleiben in diesem Browser',
      keptMemory: 'die Modelle bleiben bis zum Neuladen',
      semanticError: 'Die Modelle konnten nicht laden: %e',
      load: 'Modelle laden (~34 MB)',
      loadKept: 'Suche nach Bedeutung einschalten',
      retry: 'Erneut versuchen',
      offer: 'Auch nach Bedeutung suchen',
      results: '%n Treffer in %t ms - Stichwörter',
      resultsHybrid: '%n Treffer in %t ms - Stichwörter und Bedeutung',
      plain: 'Nur Titel, bis die Suche geladen ist',
      viaWords: 'Stichwort',
      viaMeaning: 'Bedeutung',
      backedUp: 'Sicherung gespeichert',
      backedUpDesc: '%n Seiten und der Suchindex in %f.',
      imported: 'Sicherung importiert',
      importedDesc: '%n Seiten vom %d.',
      notBackup: 'Keine Folio-Sicherung',
      reset: 'Zurück zum Beispiel-Arbeitsbereich',
      forgotten: 'Modelle entfernt',
      importTitle: 'Diesen Arbeitsbereich ersetzen?',
      importText:
        'Die Sicherung vom %d enthält %n Seiten. Sie ersetzt jede Seite hier - sichere sie vorher, um sie zu behalten.',
      importOk: 'Ersetzen',
      resetTitle: 'Auf das Beispiel zurücksetzen?',
      resetText: 'Jede Seite wird wieder zum Beispiel-Arbeitsbereich. Sichere vorher, um deine Seiten zu behalten.',
      resetOk: 'Zurücksetzen',
    },
  };

  // df$ comes with the component bundle - a full-screen page loads it after this module
  addEventListener('DOMContentLoaded', async () => {
    const app = df$('[data-nt]').get(0);
    const $ = (sel, root = app) => root.querySelector(sel);
    const $$ = (sel, root = app) => [...root.querySelectorAll(sel)];

    // -- translation: the markup is the catalog (the templates at the end of the app)
    const locale = createI18n({
      locale: 'en', // the demos start in English; the language select offers German
    });
    const i18n = createDomI18n(df$).bind(app, locale);
    // two switches (the sidebar and the mobile drawer) show one language
    df$('[data-app-locale]').each((_i, el) => {
      df$.shadcn.languageSwitcher.bind(el, locale);
    });
    const words = () => WORDS[locale.locale === 'de' ? 'de' : 'en'];
    const fmt = (text, values) => text.replace(/%(\w)/g, (_m, k) => String(values[k] ?? ''));
    const mb = (bytes) => (bytes / 1e6).toFixed(1) + ' MB';
    const toast = (title, description) => df$.shadcn.toast.show(description ? { title, description } : { title });
    const encode = (text) => new TextEncoder().encode(text);
    const decode = (bytes) => new TextDecoder().decode(bytes);

    // -- routing: the first page, and one route per page (#/pages/roadmap) - new pages too. It starts before the
    //    stored workspace is read: storage that answers late (the storage module from the CDN, a busy file) must
    //    never leave the menu dead. The restore shows the route again (`showRoute`)
    const routes = [
      { id: 'home', path: '/' },
      { id: 'page', path: '/pages/:slug' },
      { id: 'missing', path: '*' },
    ];
    let shown = null;
    const show = (to) => {
      shown = to;
      // a page the workspace does not have shows the first one
      const page = to.routeId === 'page' ? document.getElementById('p-' + to.params.slug) : null;
      const open = page?.matches('.nt-page') ? page : df$('.nt-page[data-default]').get(0);
      df$('.nt-page').each((_i, article) => {
        article.hidden = article !== open;
      });
      // the wiring above selects the page in the tree
      app.dispatchEvent(new CustomEvent('nt-route'));
    };
    const showRoute = () => {
      if (shown) show(shown);
    };
    const router = createRouter({ mode: 'hash', routes, prepare: ({ to }) => ({ commit: () => show(to) }) });
    router.attachLinks(app);
    if ((await router.start()).status === 'rejected') {
      // no address the router may own - a docs preview is an about:srcdoc frame: the same routes match its hash
      const preview = createRouter({ mode: 'hash', routes, baseUrl: 'https://preview.invalid/' });
      const follow = () => show(preview.resolve(location.hash.startsWith('#/') ? location.hash : '#/'));
      addEventListener('hashchange', follow);
      follow();
    }

    // -- storage: defuss-storage over a folder of the origin private file system; a page without one (the docs
    //    preview is a sandboxed frame) keeps the files in memory. Files are opened per operation and closed again,
    //    so another tab of the app can open them too (an open file is owned - BUSY elsewhere)
    for (const el of $$('[data-nt-saved]')) {
      el.dataset.state = 'opening';
      el.textContent = words().opening;
    }
    let storage = null;
    let kind = 'memory';
    try {
      // a module import has no time limit of its own: after 10 s this visit goes on without kept pages
      const late = new Promise((_r, reject) => setTimeout(() => reject(new Error('timeout')), 10_000));
      const [{ createMemoryStorage }, { createDirectoryStorage }] = await Promise.race([STORAGE, late]);
      try {
        const root = await navigator.storage.getDirectory();
        storage = await createDirectoryStorage(await root.getDirectoryHandle('folio', { create: true }), {
          name: 'folio',
        });
        kind = 'opfs';
      } catch {
        storage = createMemoryStorage();
      }
    } catch (e) {
      // no storage module (offline, or no answer in time): a map stands in, so the rest still works for this visit
      if (e?.message === 'timeout') toast(words().late, words().lateDesc);
      const files = new Map();
      storage = {
        list: async () => [...files.keys()].sort(),
        remove: async (name) => files.delete(name),
        open: async (name, options = {}) => {
          if (!files.has(name) && !options.create) throw Object.assign(new Error(name), { code: 'NOT_FOUND' });
          if (!files.has(name)) files.set(name, new Uint8Array());
          return {
            size: async () => files.get(name).length,
            readExactly: async () => files.get(name).slice(),
            truncate: async () => files.set(name, new Uint8Array()),
            write: async (_at, bytes) => files.set(name, bytes.slice()),
            flush: async () => {},
            close: async () => {},
          };
        },
      };
    }
    const busy = async (fn) => {
      for (let i = 0; ; i++) {
        try {
          return await fn();
        } catch (e) {
          if (e?.code !== 'BUSY' || i > 20) throw e;
          await new Promise((r) => setTimeout(r, 50));
        }
      }
    };
    const readFile = (name) =>
      busy(async () => {
        let file;
        try {
          file = await storage.open(name, { readOnly: true });
        } catch (e) {
          if (e?.code === 'NOT_FOUND') return null;
          throw e;
        }
        try {
          return await file.readExactly(0, await file.size());
        } finally {
          await file.close();
        }
      });
    const writeFile = (name, bytes) =>
      busy(async () => {
        const file = await storage.open(name, { create: true });
        try {
          await file.truncate(0);
          await file.write(0, bytes);
          await file.flush();
        } finally {
          await file.close();
        }
      });
    const readJson = async (name) => {
      try {
        const bytes = await readFile(name);
        return bytes ? JSON.parse(decode(bytes)) : null;
      } catch {
        return null;
      }
    };

    // -- the workspace: what the reader changes lives in these parts of the page - the pages, the two trees of
    //    both sidebars, the palette's page list and the trash. A snapshot is their markup with live form values
    //    written as attributes and the runtime's marks taken out, so every component starts again on it
    const REGIONS = ['.nt-pages', '[data-nt-private]', '[data-nt-favs]', '[data-nt-cmd-pages]', '[data-nt-trash-list]'];
    const RUNTIME = [
      'data-init',
      'data-api',
      'data-state-name',
      'data-dragging',
      'data-drop',
      'data-over',
      'data-highlighted',
    ];
    const trashed = (page) => !!$('.nt-pages > .nt-page[data-page="' + CSS.escape(page) + '"][data-trashed]');
    const capture = () => {
      const regions = {};
      for (const sel of REGIONS)
        regions[sel] = $$(sel).map((live) => {
          const copy = live.cloneNode(true);
          const fields = $$('input, select, textarea', copy);
          $$('input, select, textarea', live).forEach((x, i) => {
            const y = fields[i];
            if (x.type === 'checkbox' || x.type === 'radio') y.toggleAttribute('checked', x.checked);
            else if (x.tagName === 'SELECT')
              [...y.options].forEach((o, k) => o.toggleAttribute('selected', k === x.selectedIndex));
            else if (x.tagName === 'TEXTAREA') y.textContent = x.value;
            else y.setAttribute('value', x.value);
          });
          for (const el of $$('*', copy)) for (const a of RUNTIME) el.removeAttribute(a);
          // the palette hides its page items under a query: what is kept is only the trash's hiding
          for (const b of $$('.command-item[data-page]', copy)) b.toggleAttribute('hidden', trashed(b.dataset.page));
          // a picture's path from the docs root, whichever page saved it
          return copy.innerHTML.replace(/(src=")(?:\.\.\/)+(?=images\/)/g, '$1');
        });
      return regions;
    };
    // a backup is a file from anywhere: nothing in it may run
    const sanitize = (html) => {
      const t = document.createElement('template');
      t.innerHTML = html;
      // (an SVG animation can set an href to a script URL - the workspace has none)
      for (const el of $$(
        'script, style, template, iframe, frame, object, embed, base, meta, link, animate, set, animateMotion, animateTransform',
        t.content,
      ))
        el.remove();
      for (const el of $$('*', t.content))
        for (const a of [...el.attributes]) {
          const value = a.value.replace(/[\s\u0000-\u001f]/g, '').toLowerCase();
          if (
            a.name.startsWith('on') ||
            a.name === 'srcdoc' ||
            (/^(href|src|action|formaction|xlink:href|poster)$/.test(a.name) &&
              /^(javascript|vbscript|data:(?!image\/(png|jpeg|gif|webp)))/.test(value))
          )
            el.removeAttribute(a.name);
        }
      return t.innerHTML;
    };
    const fits = (regions) =>
      regions && REGIONS.every((sel) => Array.isArray(regions[sel]) && regions[sel].length === $$(sel).length);
    let restoring = false;
    const restore = (regions) => {
      restoring = true;
      for (const sel of REGIONS)
        $$(sel).forEach((el, i) => {
          el.innerHTML = sanitize(String(regions[sel][i])).replace(/src="images\//g, 'src="' + IMAGES);
        });
      globalThis.lucide?.createIcons();
      i18n.rescan();
      i18n.refresh();
      // the wiring reads the roadmap and its counters again
      app.dispatchEvent(new CustomEvent('nt-restored'));
      // the restored pages carry the hidden state of their save: the address decides which one shows
      showRoute();
      queueMicrotask(() => {
        restoring = false;
      });
    };
    const pageCount = (regions) => (String(regions['.nt-pages']?.[0] ?? '').match(/<article\b/g) || []).length;

    // two slots written in turn, each with its generation: a write cut short leaves the other one whole
    const SLOTS = ['workspace-a.json', 'workspace-b.json'];
    let generation = 0;
    let savedAt = '';
    const valid = (doc) => doc?.format === 'folio-workspace' && doc.version === 1 && fits(doc.regions);
    const loadWorkspace = async () =>
      (await Promise.all(SLOTS.map(readJson))).filter(valid).sort((a, b) => b.generation - a.generation)[0] ?? null;

    const SAMPLE = capture(); // before anything is restored: what Reset brings back
    let touched = false; // the reader typed before the stored workspace arrived - theirs wins
    const early = () => {
      touched = true;
    };
    app.addEventListener('input', early, { once: true });
    const stored = await loadWorkspace();
    app.removeEventListener('input', early);
    if (stored && !touched) {
      restore(stored.regions);
      generation = stored.generation;
      savedAt = stored.saved;
    }
    const INDEX = 'search-index.json';
    const storedIndex = await readJson(INDEX);
    app.dataset.ntStore = kind;

    // -- saving: every change, a moment after the last one
    const savedLabel = (state, error) => {
      const w = words();
      const text = { saved: w.saved, saving: w.saving, memory: w.memory, error: fmt(w.failed, { e: error }) }[state];
      for (const el of $$('[data-nt-saved]')) {
        el.dataset.state = state;
        el.textContent = text;
      }
    };
    let saveState = kind === 'opfs' ? 'saved' : 'memory';
    let saveError = '';
    const showSaved = () => savedLabel(saveState, saveError);
    let saveTimer = 0;
    let saving = Promise.resolve();
    const save = (from) => {
      clearTimeout(saveTimer);
      saveState = 'saving';
      showSaved();
      saving = saving.then(async () => {
        const doc = {
          format: 'folio-workspace',
          version: 1,
          generation: generation + 1,
          saved: new Date().toISOString(),
          regions: capture(),
        };
        try {
          await writeFile(SLOTS[doc.generation % 2], encode(JSON.stringify(doc)));
          generation = doc.generation;
          savedAt = doc.saved;
          saveState = kind === 'opfs' ? 'saved' : 'memory';
        } catch (e) {
          saveState = 'error';
          saveError = e?.code || e?.message || String(e);
        }
        showSaved();
        render();
        reindex(from ? { ...from, generation } : undefined);
      });
      return saving;
    };
    const changed = () => {
      if (restoring) return;
      saveState = 'saving';
      showSaved();
      clearTimeout(saveTimer);
      saveTimer = setTimeout(save, 600);
    };
    // what the router and the components mark at run time is no change of the workspace
    const ignored = (m) =>
      m.type === 'attributes' &&
      (RUNTIME.includes(m.attributeName) ||
        ['aria-selected', 'aria-expanded', 'tabindex', 'data-state'].includes(m.attributeName) ||
        (m.attributeName === 'hidden' &&
          m.target.matches('.nt-page, [data-nt-cmd-pages], [data-nt-cmd-pages] .command-item')));
    const watch = new MutationObserver((list) => {
      if (list.some((m) => !ignored(m))) changed();
    });
    for (const sel of REGIONS)
      for (const el of $$(sel))
        watch.observe(el, { subtree: true, childList: true, characterData: true, attributes: true });
    // a checkbox, a select or a date changes a property, not the markup
    app.addEventListener('change', (e) => {
      if (REGIONS.some((sel) => e.target.closest(sel))) changed();
    });
    addEventListener('pagehide', () => {
      if (saveState === 'saving') save();
    });

    // -- the search: one document per section of a page (a heading starts one) and per roadmap item
    const hash = (text) => {
      // cyrb53: a key for a text's vector, not a security hash
      let h1 = 0xdeadbeef,
        h2 = 0x41c6ce57;
      for (let i = 0; i < text.length; i++) {
        const c = text.charCodeAt(i);
        h1 = Math.imul(h1 ^ c, 2654435761);
        h2 = Math.imul(h2 ^ c, 1597334677);
      }
      h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
      h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
      return (h2 >>> 0).toString(16).padStart(8, '0') + (h1 >>> 0).toString(16).padStart(8, '0');
    };
    const sections = () => {
      const docs = [];
      const add = (d) => {
        const meaning = [d.title, d.heading, d.text].filter(Boolean).join('. ').slice(0, 1500);
        docs.push({ ...d, meaning, hash: hash(meaning) });
      };
      for (const p of $$('.nt-pages > .nt-page:not([data-trashed])')) {
        const page = p.dataset.page;
        const title = $('[data-nt-title]', p)?.textContent.trim() || 'Untitled';
        const icon = $('.nt-icon [data-icon-of]', p)?.textContent.trim() || '📄';
        let part = { heading: '', at: 0, lines: [] };
        let k = 0;
        const flush = () => {
          const text = part.lines.join(' ').replace(/\s+/g, ' ').trim();
          if (text || part.heading || !k)
            add({ id: page + '~' + k++, page, title, icon, heading: part.heading, at: part.at, text });
        };
        $$('.nt-blocks .nt-block', p).forEach((b, i) => {
          const text = $$(
            ':scope > .nt-text, :scope > figure > .nt-text, :scope > .nt-hint .nt-text, :scope > .nt-part .nt-cell',
            b,
          )
            .map((x) => x.textContent.trim())
            .filter(Boolean)
            .join(' ');
          if (/^h[123]$/.test(b.dataset.type)) {
            flush();
            part = { heading: text, at: i, lines: [] };
          } else if (text) part.lines.push(text);
        });
        flush();
        for (const r of $$('[data-nt-db] tr[data-item]', p)) {
          const name = $('[data-f="name"]', r)?.textContent.trim() || 'Untitled';
          const facts = ['status', 'owner', 'due', 'tags'].map((f) => $('[data-f="' + f + '"]', r)?.textContent.trim());
          const status = $('select[data-field="status"]', r);
          if (status) facts[0] = status.selectedOptions[0]?.textContent.trim();
          add({
            id: page + '~item~' + r.dataset.item,
            page,
            item: r.dataset.item,
            title: name,
            icon: '🗂️',
            heading: title,
            at: 0,
            text: [...facts, r.dataset.body].filter(Boolean).join(' · '),
          });
        }
      }
      return docs;
    };

    // the index on disk describes one workspace generation: the lexical index, its documents and their vectors
    // (keyed by the text they were made from, so an edit embeds only what changed)
    const toB64 = (f32) => {
      const b = new Uint8Array(f32.buffer, f32.byteOffset, f32.byteLength);
      let s = '';
      for (let i = 0; i < b.length; i += 0x8000) s += String.fromCharCode(...b.subarray(i, i + 0x8000));
      return btoa(s);
    };
    const fromB64 = (text) => {
      const s = atob(text);
      const b = new Uint8Array(s.length);
      for (let i = 0; i < s.length; i++) b[i] = s.charCodeAt(i);
      return new Float32Array(b.buffer);
    };
    let vectors = new Map(); // hash → Float32Array (Winzling-embed, 384 dimensions)
    let vectorModel = '';
    const takeVectors = (index) => {
      if (!index || typeof index.vectors !== 'object' || !index.model) return;
      if (vectorModel && index.model !== vectorModel) return;
      for (const [h, v] of Object.entries(index.vectors))
        if (typeof v === 'string') {
          const f = fromB64(v);
          if (f.length === index.dimensions) vectors.set(h, f);
        }
      vectorModel = index.model;
    };
    const indexFile = (lexical, docs) => ({
      format: 'folio-index',
      version: 1,
      generation,
      lexical: lexical.toJSON(),
      documents: docs,
      model: vectorModel || null,
      dimensions: 384,
      vectors: Object.fromEntries(
        docs.filter((d) => vectors.has(d.hash)).map((d) => [d.hash, toB64(vectors.get(d.hash))]),
      ),
    });

    let current = null; // { docs: Map(id → doc), search, hybrid, count }
    let models = null; // { embedder, reranker }
    const sem = { state: 'off', file: '', loaded: 0, total: 0, done: 0, count: 0, error: '' };
    let indexing = null;
    let again = false;
    // builds the search for the workspace as it is now - from the stored index when it describes this generation
    const reindex = (from) => {
      if (indexing) {
        again = true;
        return indexing;
      }
      indexing = (async () => {
        try {
          const [{ LexicalSearch }, en, de, strategies] = await SEARCH;
          const analyzers = { [en.default.id]: en.default, [de.default.id]: de.default };
          let lexical = null;
          let docs = null;
          if (from?.generation === generation && Array.isArray(from.documents)) {
            try {
              lexical = LexicalSearch.fromJSON(from.lexical, analyzers);
              docs = from.documents;
            } catch {
              lexical = null;
            }
          }
          if (!lexical) {
            docs = sections();
            lexical = new LexicalSearch({
              fields: {
                title: { analyzer: en.default, weight: 3 },
                text: { analyzer: en.default },
                titleDe: { analyzer: de.default, weight: 3 },
                textDe: { analyzer: de.default },
              },
            });
            lexical.addAll(
              docs.map((d) => {
                const title = d.heading ? d.title + ' - ' + d.heading : d.title;
                return { id: d.id, fields: { title, text: d.text, titleDe: title, textDe: d.text } };
              }),
            );
          }
          const options = { lexical: { search: { prefix: true, fuzzy: true } } };
          let search;
          if (models) {
            const missing = [...new Map(docs.filter((d) => !vectors.has(d.hash)).map((d) => [d.hash, d])).values()];
            if (missing.length) {
              Object.assign(sem, { state: 'indexing', done: 0, count: missing.length });
              render();
              for (let i = 0; i < missing.length; i += 8) {
                const batch = missing.slice(i, i + 8);
                const out = await models.embedder.embedDocuments(batch.map((d) => d.meaning));
                batch.forEach((d, j) => vectors.set(d.hash, Float32Array.from(out[j])));
                sem.done = i + batch.length;
                render();
                await new Promise((r) => setTimeout(r)); // the page stays responsive between batches
              }
            }
            search = await strategies.createLexicalSemanticSearch(lexical, {
              documents: docs.map((d) => ({ id: d.id, text: d.meaning })),
              embedder: models.embedder,
              reranker: models.reranker,
              vectors: docs.map((d) => vectors.get(d.hash)),
              ...options,
            });
            sem.state = 'ready';
          } else search = strategies.createLexicalOnlySearch(lexical, options);
          current = { docs: new Map(docs.map((d) => [d.id, d])), search, hybrid: !!models, count: docs.length };
          await writeFile(INDEX, encode(JSON.stringify(indexFile(lexical, docs)))).catch(() => {});
        } catch (e) {
          if (models) Object.assign(sem, { state: 'error', error: e?.message || String(e) });
        } finally {
          indexing = null;
        }
        render();
        find();
        if (again) {
          again = false;
          reindex();
        }
      })();
      return indexing;
    };

    // -- the two models: the pinned files of defuss-vectorsearch's releases, downloaded once as <file>.br from
    //    Hugging Face, decoded with defuss-brotli, checked against their SHA-256 and kept in the storage above
    const sha256 = async (bytes) =>
      [...new Uint8Array(await crypto.subtle.digest('SHA-256', bytes))]
        .map((x) => x.toString(16).padStart(2, '0'))
        .join('');
    const modelFile = (sha) => 'model-' + sha.slice(0, 32) + '.bin';
    // the files of a model download side by side: the status shows the one that moved last
    let shownAt = 0;
    const fetchBytes = async (url, name) => {
      const res = await fetch(url);
      if (!res.ok) throw new Error(name + ': HTTP ' + res.status);
      const total = Number(res.headers.get('content-length')) || 0;
      const reader = res.body.getReader();
      const parts = [];
      let loaded = 0;
      for (;;) {
        const { done, value } = await reader.read();
        if (done) break;
        parts.push(value);
        loaded += value.length;
        Object.assign(sem, { file: name, loaded, total });
        if (performance.now() - shownAt > 100) {
          shownAt = performance.now();
          render();
        }
      }
      const out = new Uint8Array(loaded);
      let at = 0;
      for (const p of parts) {
        out.set(p, at);
        at += p.length;
      }
      return out;
    };
    const loader = (brotli, id, revision, pins) => async (path) => {
      const sha = pins[path];
      if (!sha) throw new Error(path + ' is not pinned');
      const kept = await readFile(modelFile(sha)).catch(() => null);
      if (kept && (await sha256(kept)) === sha) return kept;
      const raw = await fetchBytes(
        'https://huggingface.co/' + id + '/resolve/' + revision + '/' + path + '.br',
        path.split('/').pop(),
      );
      let bytes;
      try {
        bytes = brotli.decompress(raw);
      } catch {
        bytes = raw; // a server that sent it with Content-Encoding: br - the browser decoded it already
      }
      if ((await sha256(bytes)) !== sha) throw new Error(path + ': SHA-256 differs from the pinned release');
      await writeFile(modelFile(sha), bytes).catch(() => {});
      return bytes;
    };
    // the two models are seven pinned files; loading checks each against its SHA-256 anyway
    const modelsKept = async () => (await storage.list()).filter((name) => name.startsWith('model-')).length >= 7;
    const loadModels = async () => {
      if (models || sem.state === 'loading' || sem.state === 'starting') return;
      Object.assign(sem, { state: 'loading', file: '', loaded: 0, total: 0, error: '' });
      render();
      try {
        const [onnx, brotli] = await MODELS();
        await brotli.init(BROTLI_WASM);
        const colbert = onnx.MOEDERNCOLBERT_MODELS['1.5m'];
        const embedder = onnx.createWinzlingEmbedder({
          device: 'wasm',
          numThreads: 1,
          truncate: true,
          loadFile: loader(brotli, onnx.WINZLING_MODEL_ID, onnx.WINZLING_REVISION, onnx.WINZLING_FILES),
        });
        const reranker = onnx.createColbertReranker({
          model: '1.5m',
          precision: 'q8',
          device: 'wasm',
          numThreads: 1,
          truncate: true,
          loadFile: loader(brotli, colbert.id, colbert.revision, colbert.files),
        });
        // both load now, not on the first query
        await embedder.embedQuery('Folio');
        await reranker.encodeQueries(['Folio']);
        sem.state = 'starting';
        render();
        const model = embedder.fingerprint;
        if (vectorModel !== model) vectors = new Map();
        vectorModel = model;
        models = { embedder, reranker };
        kept = await modelsKept().catch(() => false);
        await reindex();
      } catch (e) {
        Object.assign(sem, { state: 'error', error: e?.message || String(e) });
        render();
      }
    };
    const forgetModels = async () => {
      const gone = models;
      models = null;
      await Promise.all([gone?.embedder.dispose?.(), gone?.reranker.dispose?.()]).catch(() => {});
      for (const name of await storage.list())
        if (name.startsWith('model-')) await storage.remove(name).catch(() => {});
      kept = false;
      Object.assign(sem, { state: 'off', error: '' });
      toast(words().forgotten);
      await reindex();
    };

    // -- the palette: below a query the ranked hits replace the page list (the Command component filters nothing
    //    under data-filter="none" - it keeps the keys, the highlight and the empty state)
    const cmd = $('#nt-cmd');
    const query = $('.command-input', cmd);
    const hitsBox = $('[data-nt-hits]', cmd);
    const pageList = $('[data-nt-cmd-pages]', cmd);
    const findStatus = $('[data-nt-find-status]', cmd);
    // a hit found by meaning alone, below this cosine, is noise - VERIFIED on the sample: nonsense scored 0.19 at most,
    // the sections a query meant 0.35 to 0.43
    const MIN_MEANING = 0.3;
    const el = (tag, cls, text) => {
      const node = document.createElement(tag);
      if (cls) node.className = cls;
      if (text !== undefined) node.textContent = text;
      return node;
    };
    // the query's words marked in a snippet around the first of them
    const snippet = (text, q) => {
      const terms = q
        .toLowerCase()
        .split(/[^\p{L}\p{N}]+/u)
        .filter((t) => t.length > 1);
      const lower = text.toLowerCase();
      const first = Math.min(...terms.map((t) => lower.indexOf(t)).filter((i) => i >= 0), Infinity);
      const from = Number.isFinite(first) ? Math.max(0, first - 40) : 0;
      const part = (from ? '…' : '') + text.slice(from, from + 160);
      const box = el('span', 'nt-hit-snippet');
      if (!terms.length) box.textContent = part;
      else
        part
          .split(new RegExp('(' + terms.map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|') + ')', 'gi'))
          .forEach((bit, i) => box.append(i % 2 ? el('mark', '', bit) : document.createTextNode(bit)));
      return box;
    };
    const hitItem = (doc, h, q) => {
      const item = el('button', 'command-item nt-hit');
      item.type = 'button';
      item.dataset.ntHit = doc.id;
      const main = el('span', 'nt-hit-main');
      const title = el('span', 'nt-hit-title', doc.title);
      if (doc.heading) title.append(' ', el('small', '', '· ' + doc.heading));
      main.append(title);
      if (doc.text) main.append(snippet(doc.text, q));
      const via = el('span', 'nt-hit-via');
      item.dataset.via = Object.keys(h.signals).join(' ');
      if (h.signals.lexical) via.append(el('span', 'badge', words().viaWords));
      if (h.signals.vector) via.append(el('span', 'badge', words().viaMeaning));
      for (const b of via.children) b.dataset.variant = 'outline';
      item.append(el('span', 'nt-hit-icon', doc.icon), main, via);
      return item;
    };
    let asked = 0;
    let shownStatus = '';
    const find = async () => {
      const text = query.value.trim();
      const ask = ++asked;
      for (const b of $$('.command-item[data-page]', pageList)) b.hidden = !!text || trashed(b.dataset.page);
      for (const b of $$('.command-group:not([data-nt-hits]):not([data-nt-cmd-pages]) .command-item', cmd))
        b.hidden = !!text && !b.textContent.toLowerCase().includes(text.toLowerCase());
      const w = words();
      let status = '';
      const items = [];
      if (text && current) {
        const t0 = performance.now();
        let found = [];
        try {
          found = await current.search.search({ text }, { limit: 12 });
        } catch {
          found = [];
        }
        if (ask !== asked) return;
        for (const h of found) {
          const doc = current.docs.get(h.id);
          if (!doc) continue;
          if (!h.signals.lexical && (h.signals.vector?.score ?? 0) < MIN_MEANING) continue;
          items.push(hitItem(doc, h, text));
          if (items.length === 8) break;
        }
        status = fmt(current.hybrid ? w.resultsHybrid : w.results, {
          n: items.length,
          t: (performance.now() - t0).toFixed(0),
        });
      } else if (text) {
        // the search has not arrived yet: the page titles
        for (const b of $$('.command-item', pageList))
          if (b.textContent.toLowerCase().includes(text.toLowerCase())) {
            const copy = b.cloneNode(true);
            copy.hidden = false;
            items.push(copy);
          }
        status = w.plain;
      }
      hitsBox.replaceChildren(...items);
      shownStatus = status;
      renderOffer();
    };
    query.addEventListener('input', find);
    new MutationObserver(() => cmd.open && find()).observe(cmd, { attributes: true, attributeFilter: ['open'] });
    // `close` fires after the exit transition: a palette opened again meanwhile keeps its new query
    cmd.addEventListener('close', () => {
      if (cmd.open) return;
      query.value = '';
      find();
    });
    // a hit opens its page at its section (or the roadmap item in its peek)
    const open = (doc) => {
      cmd.close();
      let frames = 0;
      const at = () => {
        const p = $('#p-' + CSS.escape(doc.page));
        if (!p || p.hidden) return ++frames < 60 && requestAnimationFrame(at);
        if (doc.item) {
          $('[data-nt-db] tr[data-item="' + CSS.escape(doc.item) + '"] [data-nt-open]', p)?.click();
          return;
        }
        const block = $$('.nt-blocks .nt-block', p)[doc.at];
        if (!block) return;
        block.scrollIntoView({ block: 'center' });
        block.classList.remove('nt-flash');
        void block.offsetWidth;
        block.classList.add('nt-flash');
        setTimeout(() => block.classList.remove('nt-flash'), 1700);
      };
      if (location.hash !== '#/pages/' + doc.page) location.hash = '/pages/' + doc.page;
      requestAnimationFrame(at);
    };
    hitsBox.addEventListener('click', (e) => {
      const item = e.target.closest('[data-nt-hit]');
      if (item && current?.docs.get(item.dataset.ntHit)) open(current.docs.get(item.dataset.ntHit));
    });

    // -- status: the sidebar's save line, the palette's offer and Settings
    const settingsBox = $('#nt-settings');
    const line = (name, text) => {
      const p = $('[data-nt-set="' + name + '"]', settingsBox);
      if (p) p.textContent = text;
    };
    let kept = false;
    const semanticText = () => {
      const w = words();
      if (sem.state === 'loading')
        return sem.file
          ? fmt(w.semanticLoading, { f: sem.file, l: mb(sem.loaded), m: sem.total ? mb(sem.total) : '…' })
          : w.semanticStarting;
      if (sem.state === 'starting') return w.semanticStarting;
      if (sem.state === 'indexing') return fmt(w.semanticIndexing, { i: sem.done, n: sem.count });
      if (sem.state === 'ready')
        return fmt(w.semanticReady, { n: current?.count ?? 0, k: kind === 'opfs' ? w.keptHere : w.keptMemory });
      if (sem.state === 'error') return fmt(w.semanticError, { e: sem.error });
      return kept ? w.semanticKept : w.semanticOff;
    };
    const offerLabel = () => (sem.state === 'error' ? words().retry : kept ? words().loadKept : words().load);
    // below the hits: their count and time, or what the models are doing; the offer while they are off
    const renderOffer = () => {
      const button = $('[data-nt-semantic]', cmd);
      const offer = !models && (sem.state === 'off' || sem.state === 'error');
      button.hidden = !offer;
      button.textContent = sem.state === 'error' ? words().retry : kept ? words().loadKept : words().offer;
      const busy = ['loading', 'starting', 'indexing', 'error'].includes(sem.state);
      findStatus.textContent = query.value.trim() && !busy ? shownStatus : busy ? semanticText() : '';
    };
    const render = () => {
      const w = words();
      showSaved();
      line(
        'storage',
        kind === 'opfs'
          ? fmt(w.storageOpfs, { t: savedAt ? new Date(savedAt).toLocaleString(locale.locale) : w.never })
          : w.storageMemory,
      );
      line('lexical', current ? fmt(w.lexical, { n: current.count }) : w.lexicalLoading);
      line('semantic', semanticText());
      const bar = $('[data-nt-set="progress"]', settingsBox);
      bar.hidden = sem.state !== 'loading' && sem.state !== 'indexing';
      if (sem.state === 'loading') {
        bar.max = sem.total || 1;
        bar.value = sem.total ? sem.loaded : 0;
      } else if (sem.state === 'indexing') {
        bar.max = sem.count || 1;
        bar.value = sem.done;
      }
      const load = $('[data-nt-semantic]', settingsBox);
      load.hidden = !!models || sem.state === 'loading' || sem.state === 'starting' || sem.state === 'indexing';
      load.textContent = offerLabel();
      $('[data-nt-forget]', settingsBox).hidden = !models && !kept;
      renderOffer();
    };
    app.addEventListener('defuss-i18n:change', () => {
      render();
      find();
    });

    // -- backups: the workspace and its search index in one JSON file, Brotli-compressed with defuss-brotli (the
    //    base64 vectors and the markup shrink to about a tenth), and back. The compressor's WASM loads on the
    //    first backup only; import also takes an uncompressed .json
    const brotliCompressor = async () => {
      const m = await import('https://cdn.jsdelivr.net/npm/defuss-brotli@0.3.0/dist/compressor-slim.js');
      await m.init('https://cdn.jsdelivr.net/npm/defuss-brotli@0.3.0/dist/compressor.wasm');
      return m;
    };
    const brotliDecompressor = async () => {
      const m = await import('https://cdn.jsdelivr.net/npm/defuss-brotli@0.3.0/dist/decompressor-slim.js');
      await m.init(BROTLI_WASM);
      return m;
    };
    const download = async (name, bytes) => {
      if (globalThis.showSaveFilePicker) {
        try {
          const handle = await globalThis.showSaveFilePicker({
            suggestedName: name,
            types: [{ description: 'Folio backup', accept: { 'application/x-brotli': ['.br'] } }],
          });
          const out = await handle.createWritable();
          await out.write(bytes);
          await out.close();
          return true;
        } catch (e) {
          if (e?.name === 'AbortError') return false;
        }
      }
      const url = URL.createObjectURL(new Blob([bytes], { type: 'application/x-brotli' }));
      const a = el('a');
      a.href = url;
      a.download = name;
      document.body.append(a);
      a.click();
      a.remove();
      setTimeout(() => URL.revokeObjectURL(url), 4000);
      return true;
    };
    const backup = async () => {
      if (saveState === 'saving') await save();
      await reindex();
      const index = await readJson(INDEX);
      const regions = capture();
      const name = 'folio-backup-' + new Date().toISOString().slice(0, 10) + '.json.br';
      const text = JSON.stringify({
        format: 'folio-backup',
        version: 1,
        exported: new Date().toISOString(),
        workspace: { format: 'folio-workspace', version: 1, generation, saved: savedAt, regions },
        index,
      });
      // quality 9: within a few percent of 11 on this JSON, several times faster in WASM
      const bytes = (await brotliCompressor()).compressText(text, { quality: 9 });
      if (await download(name, bytes))
        toast(words().backedUp, fmt(words().backedUpDesc, { n: pageCount(regions), f: name }));
    };
    // the confirm dialog: one question, its answer
    const confirmBox = $('#nt-confirm');
    let onConfirm = null;
    const ask = (title, text, ok, then) => {
      $('#nt-confirm-title', confirmBox).textContent = title;
      $('#nt-confirm-desc', confirmBox).textContent = text;
      $('[data-nt-confirm-ok]', confirmBox).textContent = ok;
      onConfirm = then;
      confirmBox.showModal();
    };
    $('[data-nt-confirm-ok]', confirmBox).addEventListener('click', () => {
      const then = onConfirm;
      onConfirm = null;
      then?.();
    });
    confirmBox.addEventListener('close', () => {
      onConfirm = null;
    });
    const replaceWith = async (workspace, index) => {
      clearTimeout(saveTimer);
      restore(workspace.regions);
      // the backup's own index describes what was just restored: its vectors and its lexical index come back
      const own = index?.format === 'folio-index' && index.version === 1 ? index : null;
      if (own) takeVectors(own);
      await save(own);
      await indexing;
      const home = $('.nt-pages > .nt-page:not([data-trashed])');
      location.hash = home ? '/pages/' + home.dataset.page : '/';
    };
    const fileInput = $('[data-nt-import-file]');
    fileInput.addEventListener('change', async () => {
      const file = fileInput.files?.[0];
      fileInput.value = '';
      if (!file) return;
      let data = null;
      try {
        const bytes = new Uint8Array(await file.arrayBuffer());
        // a Brotli stream has no magic number: a backup that starts like JSON is JSON, anything else is decoded
        const plain = /^\s*\{/.test(decode(bytes.subarray(0, 16)));
        data = JSON.parse(plain ? decode(bytes) : (await brotliDecompressor()).decompressText(bytes));
      } catch {
        data = null;
      }
      if (data?.format !== 'folio-backup' || data.version !== 1 || !valid(data.workspace)) {
        toast(words().notBackup, file.name);
        return;
      }
      const date = new Date(data.exported || data.workspace.saved || Date.now()).toLocaleDateString(locale.locale);
      const n = pageCount(data.workspace.regions);
      ask(words().importTitle, fmt(words().importText, { d: date, n }), words().importOk, async () => {
        await replaceWith(data.workspace, data.index);
        toast(words().imported, fmt(words().importedDesc, { n, d: date }));
      });
    });
    app.addEventListener('click', (e) => {
      if (e.target.closest('[data-nt-settings]')) {
        render();
        settingsBox.showModal();
      }
      if (e.target.closest('[data-nt-backup]')) backup();
      if (e.target.closest('[data-nt-import]')) fileInput.click();
      if (e.target.closest('[data-nt-reset]'))
        ask(words().resetTitle, words().resetText, words().resetOk, async () => {
          await replaceWith({ regions: SAMPLE }, null);
          toast(words().reset);
        });
      if (e.target.closest('[data-nt-semantic]')) loadModels();
      if (e.target.closest('[data-nt-forget]')) forgetModels();
    });

    // -- the search starts: from the stored index when it describes this workspace. The models download on a
    //    click (about 34 MB - nobody gets them unasked); once this browser keeps them they load by themselves
    takeVectors(storedIndex);
    render();
    await reindex(storedIndex);
    kept = await modelsKept().catch(() => false);
    render();
    if (kept) (globalThis.requestIdleCallback ?? setTimeout)(() => loadModels(), { timeout: 2000 });
  });
</script>
```

<h2 id="how-it-works" class="h2-display">How it works</h2>

<DocText>A page, not a component: it composes the library and keeps its own glue small - the block editor is the one part that needs real script.</DocText>

<ul class="text-sm" style="display:grid;gap:0.5rem;max-width:46rem;padding-inline-start:1.25rem">
  <li><strong>Shell</strong> - the <DocLink href="sidebar.html">Sidebar</DocLink> holds two <DocLink href="tree-view.html">Tree Views</DocLink> (Favorites, Private pages; a page with sub-pages is a branch), search and new-page actions and the Trash <DocLink href="popover.html">Popover</DocLink>; the top bar has a <DocLink href="breadcrumb.html">Breadcrumb</DocLink>, Share (a Popover with a <DocLink href="switch.html">Switch</DocLink>), favorite and a <DocLink href="dropdown.html">Dropdown</DocLink> of page options - font, small text and full width as radio and checkbox items, copy link, move to trash.</li>
  <li><strong>Routing</strong> - <a href="https://dom-router.defuss.org" target="_blank" rel="noopener">defuss-dom-router</a> in hash mode: every page is <code>#/pages/:slug</code> (a new page too - the route reads the slug when it is opened), <code>#/</code> the first one. The commit shows the page's <code>&lt;article&gt;</code> and the wiring selects it in the tree; a script navigates by changing the hash (a new page, a branch row, the trash), which the router follows. Inside the docs preview the same routes match the frame's hash. See <DocLink href="routing.html">Client-side Routing</DocLink>.</li>
  <li><strong>Translation</strong> - <a href="https://i18n.defuss.org" target="_blank" rel="noopener">defuss-i18n</a>: the language switch at the foot of the sidebar translates the shell - the sidebar, the workspace menu, the palette, the trash and every label - between English and German. The pages are your content and stay as written. See <DocLink href="translation.html">Translation</DocLink>.</li>
  <li><strong>Pages</strong> - every page is an <code>&lt;article&gt;</code> with an id. Its title, icon (an emoji Popover) and name stay in step across the tree, the breadcrumb and the <DocLink href="command.html">Command</DocLink> palette (<kbd class="kbd">⌘K</kbd>). New pages are stamped from a <code>&lt;template&gt;</code>.</li>
  <li><strong>Templates</strong> - a new page starts empty, as a to-do list, meeting notes, a roadmap, a wiki page, a journal entry, an onboarding checklist or a project brief - from the starter under its title or from the palette's "New from a template". A template is data in the page script: an icon, a title, a cover and full width where it wants them, and its blocks, built by the same functions the slash menu uses. A template's roadmap is a database of its own beside the sample's.</li>
  <li><strong>Blocks</strong> - each block is a <code>contenteditable</code> element with a <code>data-type</code>: Enter splits, Backspace at the start merges or turns the block back into text, arrows move between blocks, markdown shortcuts convert. Numbered lists count with CSS counters, to-dos strike through with <code>:has(:checked)</code>.</li>
  <li><strong>Slash and block menus</strong> - the <DocLink href="context-menu.html">Context Menu</DocLink>, opened at the caret through its State API: type to filter, arrows and Enter to pick. The ⋮⋮ handle opens Turn into / Duplicate / Delete, and drags the block with native drag and drop.</li>
  <li><strong>Component blocks</strong> - the slash menu also inserts blocks made of components: hints (an <DocLink href="alert.html">Alert</DocLink> in four tones - note, tip, warning, caution - whose text you write like any other block), an image (upload a file, embed a link or pick a photo; an upload is scaled to 1600 px and kept as a WebP data URL, the caption is its alt text), a table (the Table with editable cells; Enter moves one row down, the last row grows), milestones (a horizontal <DocLink href="timeline.html">Timeline</DocLink> whose dots mark a milestone reached) and a roadmap database. A component block turns into no text type; a database is not duplicated, since its items are one of a kind.</li>
  <li><strong>Format bar</strong> - the <DocLink href="toolbar.html">Toolbar</DocLink> in a manual popover above the selection: bold, italic, underline and strikethrough through the browser's editing commands, inline code and highlight by wrapping the range.</li>
  <li><strong>Database</strong> - a roadmap is one set of items in three views: a <DocLink href="table.html">Table</DocLink> with <DocLink href="select.html">Select</DocLink> status pills, a board you drag cards across, a gallery with covers. Opening an item shows it in a <DocLink href="sheet.html">Sheet</DocLink>; every edit reaches all three views. A page may hold several databases: an item's id is unique in the workspace, so it names its database, and a card only moves between the columns of its own board.</li>
  <li><strong>Storage</strong> - <a href="https://storage.defuss.org" target="_blank" rel="noopener">defuss-storage</a> keeps the workspace in a folder of the browser's origin private file system (its directory adapter, on the page itself). The workspace is the markup of the parts a reader changes - the pages, both sidebars' trees, the palette's page list and the trash - with live form values written as attributes and the components' runtime marks taken out, so every component starts again on it. A change is saved 0.6 s after the last one, into two files in turn, each with its generation: storage files have no atomic replace, and a write cut short leaves the other one whole. Until the stored workspace is in place the pages stay hidden (3 s at most), but the menu already works: the router starts first, and the restored pages show the address the reader went to meanwhile. If the storage module has not loaded after 10 s, the visit goes on with the sample, keeps nothing and says so. Two tabs that edit at once overwrite each other's saves - the last one wins. The docs preview is a sandboxed frame without storage: it keeps the files in memory and says so at the foot of the sidebar; the full-screen app keeps them across reloads.</li>
  <li><strong>Search</strong> - <a href="https://search.defuss.org" target="_blank" rel="noopener">defuss-search</a> ranks one document per section of a page (a heading starts one) and per roadmap item. Keywords work at once: BM25 over an English and a German analyzer, the title three times the text, prefix and fuzzy matching on the last word. Search by meaning is the lexical-semantic strategy with both models of defuss-vectorsearch: Winzling-embed turns every section and query into a vector, and the hits of both sources are fused and reordered by the ColBERT reranker (the reranked preset). The models' pinned files download once as Brotli from Hugging Face (about 34 MB with ONNX Runtime's WASM), are checked against their SHA-256 and are kept in the same storage. They download on a click in the palette or in Settings - nobody gets 34 MB unasked - and once the full-screen app keeps them they load by themselves (the preview keeps nothing, so there they come on a click each time). A vector is kept under a hash of its text, so an edit embeds only the sections it changed. Each hit shows whether keywords, meaning or both found it; a click opens the page at its section.</li>
  <li><strong>Backups</strong> - the workspace menu (and Settings) writes one file, <code>folio-backup-&lt;date&gt;.json.br</code>: the workspace and its search index - the lexical index, its documents and every vector - as JSON, Brotli-compressed with <a href="https://github.com/kyr0/defuss-brotli" target="_blank" rel="noopener">defuss-brotli</a> (its compressor's WASM loads with the first backup). Import decodes it, and also takes an uncompressed <code>.json</code>. Import reads such a file back, after asking, and nothing is embedded again; a backup is treated as foreign markup, so scripts, frames, event attributes and script URLs are removed before it is shown. Reset brings back the sample workspace.</li>
  <li><strong>Full screen</strong> - <DocLink href="app-notes.html">app-notes.html</DocLink> is generated from this page's example at build time.</li>
</ul>

</DocPage>
