pi-roundtable-web 0.26.1 → 0.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +25 -6
- package/dist/chunk-account-hck7mhf8.js +1 -0
- package/dist/chunk-action-menu-beqh40k6.js +1 -0
- package/dist/{chunk-agent-rdv7ekrt.js → chunk-agent-znnth24t.js} +1 -1
- package/dist/chunk-arranged-rooms-wfakrddk.js +1 -0
- package/dist/chunk-bulk-actions-c4tkvk9g.js +1 -0
- package/dist/chunk-character-creator-qwcsdytw.js +1 -0
- package/dist/{chunk-codeeditor-ajhgd33t.js → chunk-codeeditor-6xavqntt.js} +2 -2
- package/dist/chunk-confirm-z95j9jt3.js +1 -0
- package/dist/chunk-connectors-7xqsg5q5.js +1 -0
- package/dist/chunk-conversations-zc4mv6vj.js +1 -0
- package/dist/{chunk-drag-peyb8t0k.js → chunk-drag-0mefcvp3.js} +1 -1
- package/dist/chunk-entry-hrt97qed.js +1 -0
- package/dist/chunk-folder-list-nemtqbnc.js +1 -0
- package/dist/chunk-folds-xpg9qcwf.js +1 -0
- package/dist/chunk-gate-86r8a2vf.js +1 -0
- package/dist/chunk-group-scene-g24kxz6f.js +1 -0
- package/dist/chunk-group-table-851jm8ef.js +1 -0
- package/dist/chunk-host-icons-23zhqpmc.js +1 -0
- package/dist/chunk-host-picture-8tnh2wam.js +1 -0
- package/dist/chunk-host-state-j41sp065.js +1 -0
- package/dist/chunk-host-ui-cje7a9t9.js +1 -0
- package/dist/chunk-index-1fn8q4ps.js +2 -0
- package/dist/{chunk-index-73gh7kgr.js → chunk-index-30vw4nhh.js} +35 -3
- package/dist/{chunk-index-k7t14rwa.js → chunk-index-3aa5czxj.js} +2 -2
- package/dist/chunk-index-3k7sdph2.js +1 -0
- package/dist/{chunk-index-w31c4yjv.js → chunk-index-3wbyq10m.js} +2 -2
- package/dist/{chunk-index-vcyzwtk2.js → chunk-index-47yspxa4.js} +2 -2
- package/dist/chunk-index-4jf4jvfd.css +1 -0
- package/dist/chunk-index-4s1qj9we.js +2 -0
- package/dist/chunk-index-5fz5e1ct.js +2 -0
- package/dist/{chunk-index-5yzfrf7b.js → chunk-index-67p2sc14.js} +3 -3
- package/dist/{chunk-index-gyary7np.js → chunk-index-6c8mewwy.js} +12 -12
- package/dist/{chunk-index-yzsgsvnp.js → chunk-index-84wbc80d.js} +2 -2
- package/dist/{chunk-index-snzzfhk3.js → chunk-index-8eexybcx.js} +2 -2
- package/dist/{chunk-index-pk1yxkv4.js → chunk-index-agrvqf5b.js} +2 -2
- package/dist/chunk-index-azrnzgev.js +2 -0
- package/dist/{chunk-index-0xh24y25.js → chunk-index-c2ag3qw2.js} +2 -2
- package/dist/{chunk-index-kwcx62wb.js → chunk-index-e90kztkx.js} +3 -3
- package/dist/chunk-index-efgm0066.js +2 -0
- package/dist/{chunk-index-w2j3njb6.js → chunk-index-eh0wb6g0.js} +2 -2
- package/dist/{chunk-index-z9x4cnzf.js → chunk-index-eyc2rkq5.js} +2 -2
- package/dist/chunk-index-fe0m5mht.js +2 -0
- package/dist/{chunk-index-2yebd9tb.js → chunk-index-gt42wjby.js} +4 -4
- package/dist/{chunk-index-cvbdf2ca.js → chunk-index-hc0dgmrs.js} +2 -2
- package/dist/{chunk-index-eg55mqqe.js → chunk-index-hczrjnky.js} +1 -1
- package/dist/chunk-index-hrtyanda.js +2 -0
- package/dist/chunk-index-j479p62w.js +2 -0
- package/dist/chunk-index-jq970hsd.js +42 -0
- package/dist/chunk-index-kankja6p.js +50 -0
- package/dist/chunk-index-kb44jp50.js +2 -0
- package/dist/{chunk-index-m7fvw92f.js → chunk-index-m65cv329.js} +2 -2
- package/dist/chunk-index-mnwdbb4n.js +2 -0
- package/dist/chunk-index-n6zrc05a.js +2 -0
- package/dist/chunk-index-n93wqszt.js +8 -0
- package/dist/{chunk-index-zrvg23jd.js → chunk-index-nrexxkar.js} +2 -2
- package/dist/chunk-index-pgxgq61x.js +2 -0
- package/dist/chunk-index-q5vzjqr5.js +2 -0
- package/dist/chunk-index-qqwk157d.js +2 -0
- package/dist/{chunk-index-czdketze.js → chunk-index-r1v895tj.js} +2 -2
- package/dist/chunk-index-r3tqhew8.js +2 -0
- package/dist/chunk-index-raf772z6.js +2 -0
- package/dist/{chunk-index-dt9775ka.js → chunk-index-rcxz5w5d.js} +5 -5
- package/dist/chunk-index-rg9vh59e.js +1 -0
- package/dist/chunk-index-sxq69p1f.js +2 -0
- package/dist/chunk-index-taq2psr6.js +2 -0
- package/dist/{chunk-index-rmxbdmn2.js → chunk-index-tsxsy4qs.js} +2 -2
- package/dist/chunk-index-wc83vb0a.js +2 -0
- package/dist/chunk-index-xbs8q4kn.js +2 -0
- package/dist/chunk-index-xxbveevc.js +2 -0
- package/dist/{chunk-index-0fmmvgee.js → chunk-index-zx6yka30.js} +2 -2
- package/dist/chunk-lang-css-yrc25qk9.js +1 -0
- package/dist/{chunk-lang-dockerfile-k728ewsf.js → chunk-lang-dockerfile-tjxsnhr9.js} +1 -1
- package/dist/{chunk-lang-go-wjwgay4v.js → chunk-lang-go-drmfa25k.js} +3 -3
- package/dist/chunk-lang-html-rwe8epvf.js +1 -0
- package/dist/chunk-lang-javascript-d6x6qjtg.js +1 -0
- package/dist/{chunk-lang-json-7gd89mvs.js → chunk-lang-json-790swysy.js} +1 -1
- package/dist/{chunk-lang-markdown-b6qbe8bt.js → chunk-lang-markdown-483dkxcq.js} +5 -5
- package/dist/{chunk-lang-python-3v56y31b.js → chunk-lang-python-v9s40bzj.js} +2 -2
- package/dist/{chunk-lang-rust-kh0z74d1.js → chunk-lang-rust-z4gry1bf.js} +1 -1
- package/dist/{chunk-lang-shell-9zv0zvbx.js → chunk-lang-shell-egsvk8rj.js} +1 -1
- package/dist/{chunk-lang-sql-yw6bf3t7.js → chunk-lang-sql-75j3denr.js} +2 -2
- package/dist/{chunk-lang-toml-tg1r96nq.js → chunk-lang-toml-7dbjvhex.js} +1 -1
- package/dist/chunk-lang-typescript-1rv9vdcz.js +1 -0
- package/dist/{chunk-lang-xml-ev1mndd4.js → chunk-lang-xml-jg1sv4h2.js} +1 -1
- package/dist/{chunk-lang-yaml-fz5qpb3r.js → chunk-lang-yaml-g3v7s5je.js} +1 -1
- package/dist/chunk-layout-actions-6assr93n.js +1 -0
- package/dist/chunk-menu-items-9szcza00.js +2 -0
- package/dist/chunk-mode-toggle-bzbq7ycq.js +1 -0
- package/dist/{chunk-note-row-kd0fy7ee.js → chunk-note-row-g20h11pm.js} +2 -2
- package/dist/chunk-notes-gc8bssxn.js +1 -0
- package/dist/chunk-notice-bell-jehad6sx.js +1 -0
- package/dist/chunk-notices-prqkv7ge.js +1 -0
- package/dist/chunk-onboarding-mdtc2mb7.js +1 -0
- package/dist/chunk-overview-2j1s6kqg.js +1 -0
- package/dist/chunk-palette-4qt6ewem.js +1 -0
- package/dist/chunk-placement-items-2eect825.js +1 -0
- package/dist/chunk-profile-pfzyc04p.js +1 -0
- package/dist/chunk-prompt-history-2bcp2rky.js +1 -0
- package/dist/chunk-prompts-052mb05y.js +1 -0
- package/dist/chunk-room-confirms-asvmjh5s.js +1 -0
- package/dist/chunk-room-menu-dm2r2hk6.js +1 -0
- package/dist/chunk-rooms-menu-button-32hemzxc.js +1 -0
- package/dist/chunk-schedules-64h9gfwn.js +1 -0
- package/dist/{chunk-seat-menu-ys5v9abz.js → chunk-seat-menu-vrpc40v9.js} +1 -1
- package/dist/chunk-sheet-hosts-jaqx490x.js +1 -0
- package/dist/chunk-shortcut-help-bdbkdcs9.js +26 -0
- package/dist/chunk-shortcuts-qft33r8t.js +1 -0
- package/dist/chunk-skill-editor-z3dx2895.js +8 -0
- package/dist/chunk-skills-4jfcv39n.js +1 -0
- package/dist/chunk-switcher-list-xysjd4tw.js +1 -0
- package/dist/{chunk-tab-dot-r6brdbmw.js → chunk-tab-dot-1p68ybf8.js} +1 -1
- package/dist/chunk-table-0v4q4dx3.js +1 -0
- package/dist/chunk-table-seats-f683hx8k.js +1 -0
- package/dist/chunk-table2d-1a6atjhj.js +1 -0
- package/dist/chunk-table3d-k0ffeffj.js +4220 -0
- package/dist/chunk-thread-actions-4rpfg4fq.js +1 -0
- package/dist/chunk-thread-cards-t794fp4d.js +1 -0
- package/dist/chunk-thread-list-1pcygpka.js +1 -0
- package/dist/chunk-transcript-km4e3aey.js +1 -0
- package/dist/chunk-where-phjwqggy.js +1 -0
- package/dist/chunk-workspace-d064v56e.js +578 -0
- package/dist/chunk-zh-tw-qf18hcxc.js +1 -0
- package/dist/index.html +1 -2
- package/dist/sw.js +1 -1
- package/package.json +2 -2
- package/src/api-types.ts +27 -0
- package/src/app/api-http.ts +1 -1
- package/src/app/routes.ts +158 -3
- package/src/app/surface-threads.ts +1 -1
- package/src/app/surface.ts +2 -1
- package/src/app/threads.ts +31 -0
- package/src/auth/authenticator.ts +8 -1
- package/src/auth/sessions.ts +10 -3
- package/src/host/host-app.ts +15 -1
- package/src/host/read-all.ts +80 -0
- package/src/host/reads.ts +67 -0
- package/src/i18n/zh-tw.ts +110 -79
- package/src/options.ts +1 -1
- package/src/web-plugin.ts +12 -1
- package/dist/chunk-account-ghq105t4.js +0 -1
- package/dist/chunk-action-menu-me0g9qsc.js +0 -1
- package/dist/chunk-arranged-rooms-81rqhx9x.js +0 -1
- package/dist/chunk-character-creator-bd426yjw.js +0 -1
- package/dist/chunk-confirm-p3mts8mx.js +0 -1
- package/dist/chunk-connectors-bkv3xn83.js +0 -1
- package/dist/chunk-conversations-0e0vbxwr.js +0 -1
- package/dist/chunk-entry-mv7q8br0.js +0 -1
- package/dist/chunk-folder-list-era3tksh.js +0 -1
- package/dist/chunk-folds-hvws0bd5.js +0 -1
- package/dist/chunk-gate-hc7dd0fx.js +0 -1
- package/dist/chunk-group-scene-dkbpmbh5.js +0 -1
- package/dist/chunk-group-table-fqmxgdfw.js +0 -1
- package/dist/chunk-host-icons-4xde9ntk.js +0 -1
- package/dist/chunk-host-picture-014yzk20.js +0 -1
- package/dist/chunk-host-state-t56e5sdy.js +0 -1
- package/dist/chunk-host-ui-p1zy9nmp.js +0 -1
- package/dist/chunk-index-4t0r3t3b.js +0 -2
- package/dist/chunk-index-6twb7ccd.js +0 -2
- package/dist/chunk-index-7xffskfa.js +0 -8
- package/dist/chunk-index-aqw7cy5j.js +0 -1
- package/dist/chunk-index-b6ca02e8.js +0 -2
- package/dist/chunk-index-b8nvhcx5.js +0 -2
- package/dist/chunk-index-gr6e0hse.js +0 -2
- package/dist/chunk-index-j214tczc.js +0 -1
- package/dist/chunk-index-jd6632ef.js +0 -2
- package/dist/chunk-index-jw7dtshr.js +0 -2
- package/dist/chunk-index-mmg788a1.js +0 -2
- package/dist/chunk-index-mq0dacwr.js +0 -2
- package/dist/chunk-index-p53ak25v.js +0 -2
- package/dist/chunk-index-rbcz9jd4.css +0 -1
- package/dist/chunk-index-rnxj3z8k.js +0 -2
- package/dist/chunk-index-v3bmr0nw.js +0 -2
- package/dist/chunk-index-wrm8w165.js +0 -2
- package/dist/chunk-index-xh0mg9cw.js +0 -2
- package/dist/chunk-index-ybtvvx85.js +0 -2
- package/dist/chunk-index-zynq0b0w.js +0 -50
- package/dist/chunk-lang-css-88v3hp3d.js +0 -1
- package/dist/chunk-lang-html-07d47es4.js +0 -1
- package/dist/chunk-lang-javascript-fmhhgzwd.js +0 -1
- package/dist/chunk-lang-typescript-etjjvr2g.js +0 -1
- package/dist/chunk-layout-actions-48ecgtkg.js +0 -1
- package/dist/chunk-menu-items-1epy3h0t.js +0 -2
- package/dist/chunk-mode-toggle-fxmfxsa4.js +0 -1
- package/dist/chunk-notes-yb8f057c.js +0 -1
- package/dist/chunk-notice-bell-wr4f1rph.js +0 -1
- package/dist/chunk-notices-x07da5bb.js +0 -1
- package/dist/chunk-onboarding-csrkbh9z.js +0 -1
- package/dist/chunk-overview-avc2d30t.js +0 -1
- package/dist/chunk-palette-9nhp95bz.js +0 -1
- package/dist/chunk-placement-items-q694dpgk.js +0 -1
- package/dist/chunk-profile-6qemf3m7.js +0 -1
- package/dist/chunk-prompt-history-7enzp2p3.js +0 -1
- package/dist/chunk-prompts-nv6mrn0q.js +0 -1
- package/dist/chunk-room-confirms-zz7n61y7.js +0 -1
- package/dist/chunk-room-menu-rr6nzap1.js +0 -1
- package/dist/chunk-rooms-menu-button-zbtwj47d.js +0 -1
- package/dist/chunk-schedules-rw57nr0m.js +0 -1
- package/dist/chunk-sheet-hosts-jhvaacst.js +0 -1
- package/dist/chunk-skill-editor-sz8an8qr.js +0 -8
- package/dist/chunk-skills-tnr1h16h.js +0 -1
- package/dist/chunk-switcher-list-17enhrse.js +0 -1
- package/dist/chunk-table-r12cja6p.js +0 -1
- package/dist/chunk-table-seats-g3t392zz.js +0 -1
- package/dist/chunk-table2d-p3ezsdcj.js +0 -1
- package/dist/chunk-table3d-4x2n2b00.js +0 -4220
- package/dist/chunk-thread-actions-qc6ezkha.js +0 -1
- package/dist/chunk-transcript-n2s6dher.js +0 -1
- package/dist/chunk-where-f3scdydc.js +0 -1
- package/dist/chunk-workspace-xs023bxm.js +0 -1
- package/dist/chunk-zh-tw-efvmk3fd.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,30 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.26.3] - 2026-10-30
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Mark all as read.** The room list's menu and each folder's menu have **Mark all as read**, left out when nothing in its scope is unread (a folder's scope is its rooms and the threads under them). It sets the person's read cursor to the newest message in every room they may read, agent, group, thread and host rooms, in one call: `POST api/rooms/read-all` with `{ "rooms": [...] }` (at most 500; left out, every room the list shows), owners only, with rooms the person may not read passed over. The unread badges, the tab title's count and the tab icon's dot clear at once, the person's other pages and devices hear of it through the `read` frames a single read sends and a `changed` frame, and a notice offers Undo for five seconds: `{ "restore": [...] }` to the same route puts each cursor back unless the person has read on since. Nothing asks first
|
|
13
|
+
- **Clear all finished threads.** The same two menus have **Clear all finished threads**, which hides every finished dispatch thread under every room of the list, or under the folder's rooms, in one call: `POST api/rooms/dismiss-finished-threads` with `{ "rooms": [...] }`, owners only, open threads never touched. The answer names the threads cleared by room, and the notice's Undo puts exactly those back through `undismiss-threads`
|
|
14
|
+
- Keyboard shortcuts in the owner app. Alt+↑ / Alt+↓ (Option on a Mac) go to the previous or next room in the order the room list shows (folders respected, a folded folder skipped unless it holds the open room, threads after their room, no wrapping), and Alt+Shift+↑ / Alt+Shift+↓ to the previous or next room with unread messages. Switching uses the router as a click does and scrolls the open room's row into view; it works on a page with no list too. In a text field the arrows act only when the field is empty or the caret is at the very start (up) or very end (down) with nothing selected, and nothing acts while an input method composes. Esc closes the topmost menu or sheet and otherwise lets go of the message box without touching its text. `?` outside a text field opens a sheet that lists the keys (a lazy chunk; en and zh-TW wording). Ctrl/⌘ K, which opens the search, now also ignores an input method's composition. The handler is a part that loads after the first paint, about 0.1 KB gzipped more in the first load.
|
|
15
|
+
- A message nobody has seen yet wears an unread frame: a soft ring and glow in the accent colour, uniform on every side (no thick or one-sided border), in the modern and camelot looks, light and dark. It marks the messages past the person's read marker as the room opened, and those that arrive while the tab is hidden or the log is scrolled away from its end, in agent, group, thread and host rooms. The person's own messages, lines the server wrote, internal notes and a message that arrives while they are watching the end of the log do not get one. Passing a pointer over a message, focusing it with the keyboard, or tapping it clears its frame, each message on its own; on a touch screen a frame also clears once the message has stood at least half in view (or half of the screen, for a long one) for one and a half seconds, through one IntersectionObserver. It is only a look: what the server counts as read, the read API and the "New messages" divider are unchanged, a cleared frame stays cleared until the page is reloaded, and `prefers-reduced-motion: reduce` removes it without the fade. The code and its styles load with the read marks (the lazy host chunk), not with the first page.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Clearing finished dispatch threads no longer asks first, however many there are: **Clear finished** in a room's list of threads and the new menu items clear at once, and the notice's Undo is the way back
|
|
20
|
+
|
|
21
|
+
## [0.26.2] - 2026-10-30
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Opening a room from a seat of the round table is a dive: the view zooms toward the seat that was tapped, creeping at first and then rushing in (`cubic-bezier(0.7, 0, 0.84, 0)`, about 380 ms), and the room settles in already at full size, with no blank frame. A mouse click, a tap and a key press on a seat all do it, and the camera of the 3D table dives into a seat from the whole ring the same way. It uses transform and opacity only, a second tap during the zoom is dropped, Back or leaving the table mid-zoom gives the view back and opens nothing, and `prefers-reduced-motion: reduce` switches at once. The code is part of the round table's lazy chunk, not the first load.
|
|
26
|
+
- Dispatch threads in the room list are cards: the title, the room's knight, an in-progress or finished badge, the time and the unread count, with a going-on thread tinted and a finished one at rest. Swiping a finished card to the right clears it (the card slides out, the list closes the gap, and a notice offers Undo for five seconds); a going-on card gives a little and springs back. Holding a card or right-clicking it, or the menu button on a finished one, opens a menu with "Clear this thread" and "Clear all finished"; Delete on a focused finished card clears it, and "Clear finished" in the header of the finished threads clears them all, asking first with the count when there are more than five. Reduced motion skips the slide. The undo is two new owner routes, `POST api/rooms/<thread>/undismiss` and `POST api/rooms/<room>/undismiss-threads` (body `{ "threads": [<keys>] }`, at most 100 keys under that room), which put dismissed threads back on the list for every owner.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- The page's word for an agent is now "Knight" in every look: lists, sheets, menus, the table, notifications and the server's refusals. The main agent is the "main knight". The model picker's "Follow the assistant" row is "Default model", and the sheet shows the model it resolves to when it knows it. Agents over MCP outside Discord are "Outside AI clients", and the agent server is the "Bot server". Text only: identifiers, API fields and configuration keys are unchanged.
|
|
31
|
+
|
|
8
32
|
## [0.26.1] - 2026-10-30
|
|
9
33
|
|
|
10
34
|
### Added
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The plugin is a chat surface of its own (`app`), so a team of agents can live in
|
|
|
11
11
|
- **Cards.** Approvals, questions, questionnaires and the card at a turn's time limit appear in the room, and any owner's device can answer them.
|
|
12
12
|
- **Modes.** Yolo mode approves the held actions a rule allows without asking; long-running mode lets a turn go past its time limit. Each is a switch per room, and a banner shows while one is on.
|
|
13
13
|
- **An app.** A web app manifest, a service worker and Web Push make it installable and let a card wake the phone.
|
|
14
|
-
- **Files.** The owner browses the
|
|
14
|
+
- **Files.** The owner browses the knights' workspace, reads files with syntax highlighting, and edits, creates, renames and deletes them (to a restorable trash), with a check on every save that a knight did not change the file meanwhile.
|
|
15
15
|
- **Looks.** Agents are drawn as characters; the page has a Modern and a Camelot look, light and dark, and a round table that seats the whole team.
|
|
16
16
|
|
|
17
17
|
Who may enter is the host's `access` configuration plus an authentication mode you choose: `none`, `password` or `verifier` (see [Authentication](#authentication)), and the plugin refuses to start without one.
|
|
@@ -109,7 +109,7 @@ The page is built for a phone first: a bottom tab bar under 720 px, a side rail
|
|
|
109
109
|
| **Rooms** | Home first, then the pinned rooms, the owners' folders and the rest by latest activity, each with its dispatch threads, with badges for working, a card waiting, yolo and long-running (see [Pins and folders](#pins-and-folders)). |
|
|
110
110
|
| **A room** | Each message with its author's picture and name, Markdown (raw HTML is shown as text), files, and a live progress strip with the streamed text and tool chips. A sticky composer with upload and Stop. The header menu holds the mode switches, Profile and Start over. |
|
|
111
111
|
| **Cards** | Inline in the room: an approval with the call's details and a copy button; a question with options, an "Other" field and Cancel; a questionnaire; and the card at a turn's time limit. Answered cards show the answer given. |
|
|
112
|
-
| **
|
|
112
|
+
| **Knight sheet** | Display name, prompt (with its History), model and thinking level, the skills it carries, Notifications, the character creator (see [Characters in the page](#characters-in-the-page)) and Archive. See [Making and arranging agents](#making-and-arranging-agents). |
|
|
113
113
|
| **Schedules** | Every schedule of the team, labelled by room or channel, with a confirmed cancel. |
|
|
114
114
|
| **Table** | The round table (see [The round table](#the-round-table)). |
|
|
115
115
|
| **Files** | The agents' workspace: a tree, highlighted files and an editor (see [The files pane](#the-files-pane)). |
|
|
@@ -149,12 +149,16 @@ The app hosts the core's dispatch threads (`ChatSurface.threads`). A background
|
|
|
149
149
|
|
|
150
150
|
A thread's room is read only: a `send` to it is refused with `read_only`, and it has no modes. Its cards are the dispatch's own, such as a coding job's approvals, and any owner answers them there as in any room. Agents post in it under their own names. A closed thread stays readable (the list keeps the 30 newest closed ones), and the host closes the threads a restart left open, with a restart notice. `GET api/rooms` lists a thread with `parent` and, once closed, `closed: true`; opening and closing one sends `changed`.
|
|
151
151
|
|
|
152
|
+
Each thread is a card in that list: its title, its room's knight, a badge (in progress or finished), the time of its last post and its unread count. A going-on thread wears its knight's tint and a finished one rests. An owner clears a finished thread off the list by swiping its card to the right (the card slides out, the list closes the gap, and a notice offers Undo for five seconds), by pressing the menu button on the card, by holding it or right-clicking it (**Clear this thread**, **Clear all finished**), or with Delete on a focused card; **Clear finished** in the header of the finished threads does the same for all of them. Nothing asks first, however many there are: the notice's Undo is the way back. A going-on thread does not swipe: the card gives a little and springs back. Clearing hides a thread and does not delete it: it leaves the list for every owner and every open page at once, and stays readable by its address and through the links in its room. The routes are `POST api/rooms/<thread>/dismiss` (409 while the thread is open), `POST api/rooms/<room>/dismiss-threads` (every finished thread of the room), their undos `POST api/rooms/<thread>/undismiss` and `POST api/rooms/<room>/undismiss-threads` (body `{ "threads": [<keys>] }`, at most 100, those that hang under the room), and `GET api/rooms/<thread>` for the view of a thread the list does not carry. All of them are the owners' like the rest of `api/rooms`.
|
|
153
|
+
|
|
154
|
+
The room list's menu (the button beside the search) and each folder's menu clear every finished thread at once: **Clear all finished threads** takes the finished threads of every room in the list, or of the folder's rooms. The route is `POST api/rooms/dismiss-finished-threads` with `{ "rooms": [<keys>] }` (at most 500; left out, every room the list shows). It answers with the number cleared and the cleared threads' keys by room (`{ "dismissed": 3, "threads": { "<room>": [<keys>] } }`), which the notice's Undo sends back through `undismiss-threads`, room by room. Open threads are never cleared, and the item is left out of the menu when no finished thread is listed.
|
|
155
|
+
|
|
152
156
|
|
|
153
157
|
### Making and arranging agents
|
|
154
158
|
|
|
155
159
|
An owner changes the team from the app. Everything goes through the agent server's own operations (`AgentTeam`), the ones the `agent_create`, `archive` and `group_*` tools use, so an agent made here is the one an agent would make, and an archived one is the one the `archive` tool leaves.
|
|
156
160
|
|
|
157
|
-
- **New
|
|
161
|
+
- **New knight.** The **+** button of the room list and of the drawer opens a menu with New knight, New group and Archived. New knight asks for a name, the permanent name (lowercase letters, digits and dashes, which names the room and cannot be changed; it follows the name until typed by hand), the prompt, a model, an optional opening task and a look. The look is the one its role suggests until the creator picks another. On success the new agent's room opens. A bad or taken name, an unusable model, a bad look and an unknown skill are refused with the bot server's words before anything is made.
|
|
158
162
|
- **Archive and restore.** Archive is in the agent sheet and in the ⋯ menu and long-press menu of a room (the coordinator's room has none). It asks first, naming the agent or group. An archived agent stops answering, its schedules are cancelled and it leaves its groups; its history is kept. **Archived** in the **+** menu lists what is archived with Restore and Delete. Restoring an agent does not put it back in its groups; restoring a group needs all its members active, otherwise it is refused and stays archived.
|
|
159
163
|
- **Delete.** Only an archived agent or group can be deleted, from the archive, after a question that names it. Deleting frees the name, removes the agent's group cursors and detaches its skills, and clears what this app kept of the room (its messages, its cards, its mute and its modes). A Discord channel, if the agent had one, stays under Archive with its history, since Discord is never asked to delete a channel.
|
|
160
164
|
- **Skills.** The agent sheet lists the host's skills (the Skills pane's catalog when the host supplies it, else the skills addon's own) with a switch each, applied as it is flipped and from the agent's next turn. Built-in skills are carried by every agent and stay on. A host without the skills addon shows nothing.
|
|
@@ -188,6 +192,18 @@ Until the owners arrange something, the page is the plain list it always was; th
|
|
|
188
192
|
|
|
189
193
|
The layout lives in three additive tables created by the plugin's migration `web-room-layout`: `web_room_folders`, `web_room_folder_rooms` and `web_room_pins`. Every write takes one advisory lock and rewrites the positions densely, so two devices editing at once leave no gap and no duplicate.
|
|
190
194
|
|
|
195
|
+
### Keyboard shortcuts
|
|
196
|
+
|
|
197
|
+
| Keys (Mac / elsewhere) | What they do |
|
|
198
|
+
|---|---|
|
|
199
|
+
| ⌥↑ / ⌥↓, Alt+↑ / Alt+↓ | The previous or next room, in the order the room list shows: Home, the pinned rooms, the folders (a folded folder is skipped unless it holds the open room), the rest, with a room's open threads after it and its finished threads only while their fold is open. The run does not wrap. On a page that shows no list, such as a room open full screen on a phone, the same order applies; from a page that is no room, the first key press opens the first or the last room. Hosts' own room kinds are not in the run. |
|
|
200
|
+
| ⌥⇧↑ / ⌥⇧↓, Alt+Shift+↑ / Alt+Shift+↓ | The previous or next room with unread messages, in the same order; folded folders and finished threads are searched too. |
|
|
201
|
+
| ⌘K, Ctrl+K | Find a room (the search sheet), from anywhere, a message box included. |
|
|
202
|
+
| Esc | Closes the topmost menu or sheet; with none open, the message box lets go of focus. Typed text is never discarded. |
|
|
203
|
+
| ? | Opens the list of these shortcuts, a sheet that loads on the first press. Typing `?` in a text field types it. |
|
|
204
|
+
|
|
205
|
+
Switching goes through the same router as a click on the row, so it adds a history entry, uses the same view transition, and scrolls the open room's row into view in the list. Nothing here acts while an input method is composing. In a text field Option/Alt with the up and down arrows is paragraph navigation on a Mac, so the room keys act only when the field is empty or the caret rests at its very start (up) or very end (down) with nothing selected; Shift, Ctrl/Cmd and plain arrows are never taken. While a menu, sheet or the room drawer is open the room keys leave the page alone.
|
|
206
|
+
|
|
191
207
|
### Uploads
|
|
192
208
|
|
|
193
209
|
An owner may send a file of any kind in a room, up to four to a message: the button, a paste (a copied image, say) or a drop. `POST <mount>/api/uploads` takes one file as `multipart/form-data` (field `file`) and answers `{id, name, type, size}`; the message then names it in `uploads`. A long text goes as a file too: the page turns a paste of 4,000 characters or more into a `pasted-text-<n>.txt` chip, and a message over 32,000 characters into `message.txt` with the line "(long text attached)"; the server still refuses a text over 32,000 characters.
|
|
@@ -222,6 +238,8 @@ Every agent is drawn as its composed character (`pi-roundtable/characters`). The
|
|
|
222
238
|
|
|
223
239
|
The `table` pane is a council hall: a ring of tall dark-wood podiums, one for each active agent whose room is not muted (the coordinator first) and one low lip at the near edge for you, under torches, banners and a stained-glass window, around a glowing rune circle. The hall is drawn in the characters' own flat, outlined style (a stepped tone gradient and a dark line round every shape, no photographic textures). Dark is the hall at night, light the same hall by day; the Modern and Camelot looks change the banners and the trim, not the hall. Each agent stands behind its podium as a waist-up standee: the character without its frame, cut out with a thin light rim, a dark line and a visible board thickness, turning to the camera within limits. A seat's state comes from the same rules as the room list (`sleepy` sits as `idle`): a thinking seat shows a "…" badge and bobs, a seat with a card waiting a gold "!", a speaking seat has a light on its podium and the concept art's three gold emphasis strokes beside its head; a change of face redraws that one picture once it has stood for 300 ms. More than twelve agents show twelve and a "+N" podium that opens the list.
|
|
224
240
|
|
|
241
|
+
If the host has kinds of room the owner may list (for example a support desk's ticket rooms), the owners' table seats those host rooms too, after the agents and newest first, by the same lists and `access` as the member table below; a tap on such a seat opens the room's own page. A host with no host room kinds seats agents only.
|
|
242
|
+
|
|
225
243
|
This section describes the owners' table. A member or an admin is served the table only when the host names it for their tier, and theirs seats host rooms instead of agents: see [What each tier is served](#what-each-tier-is-served).
|
|
226
244
|
|
|
227
245
|
- **Cameras.** The overview stands behind your podium, raised. A drag or swipe turns it round the ring and snaps to a podium; the wheel or a pinch moves in on the podium across the ring and back out. A close-up of a speaker stands low inside the ring, tilted a little, with thin speed lines flashing for 400 ms on a new speaker. A turn follows the ring the shorter way and takes 450 to 650 ms. A swipe never starts within 32 px of the screen's edge. Under `prefers-reduced-motion` the camera cuts, with no speed lines, bob or flicker.
|
|
@@ -262,7 +280,7 @@ There is no autocomplete and no auto-closing of brackets, which fight phone keyb
|
|
|
262
280
|
**Saving.** A file is read with its SHA-256 hash, and a save carries it back as `baseHash`.
|
|
263
281
|
The server reads the file again and compares just before it replaces it, and a mismatch answers `409` with the file as it is now and writes nothing; so does a file that was deleted meanwhile.
|
|
264
282
|
The page then opens a dialog: Copy my text, Reload (discard my edits), and Save mine anyway, which asks a second time and then writes with the hash the conflict named.
|
|
265
|
-
While a file is open the page looks at it again on focus and every 5 seconds; in read mode it reloads silently, and in edit mode a banner says a
|
|
283
|
+
While a file is open the page looks at it again on focus and every 5 seconds; in read mode it reloads silently, and in edit mode a banner says a knight is changing the file.
|
|
266
284
|
A save writes a temporary file beside the original, with the original's mode, flushes it, checks again that the directory is still the one inside the root and the file is still a regular file, and renames it over the original.
|
|
267
285
|
It keeps the file's line separator (`\r\n` or `\n`), a leading byte order mark and whether the file ends with a newline.
|
|
268
286
|
A save gives the file a new inode and the server's user as its owner, so a hard link to the old file keeps the old text.
|
|
@@ -505,9 +523,9 @@ A verifier may vouch for members as well as owners, through a proxy that lets th
|
|
|
505
523
|
4. The session slides: it ends after `sessionDays` (30) without a visit, and a visit moves the limit at most once an hour. Nothing the provider said is trusted again; the tier is read from `IDENTITY` on every request. Disabling the principal refuses the next request and closes the socket.
|
|
506
524
|
5. Log out deletes the row, so the old cookie is refused afterwards, clears the cookie and, with `endSession`, also signs out at the provider. A person who just logged out is asked, not signed in silently again.
|
|
507
525
|
|
|
508
|
-
`reauthHours` makes the provider vouch again: past it, the next page load does a silent round trip that refreshes the stored facts and roles, a provider that wants the person sends them through a normal sign-in, and a request to the API
|
|
526
|
+
`reauthHours` makes the provider vouch again: past it, the next page load does a silent round trip that refreshes the stored facts and roles, a provider that wants the person sends them through a normal sign-in, and a request to the API on such a session is answered `401` until then. An open socket checks the same limit at its periodic recheck and is closed as signed out, so its page shows sign-in again. `storeClaims` keeps the named `id_token` claims with the session, replaced at each sign-in, for a sender that needs, say, a mailbox address.
|
|
509
527
|
|
|
510
|
-
`onSessionVerified(principalId)` is called when a request or an open socket proves a live session, at most once per session every five minutes. Use it to count who is present: a host that keeps a linked chat account only while its web person is active can note the person there, even when they only have the app open and call nothing of the host's. It is not awaited, and an error it throws is logged and never fails the request.
|
|
528
|
+
`onSessionVerified(principalId)` is called when a request or an open socket proves a live session, at most once per session every five minutes. A session past `reauthHours` is not live for this, on either path. Use it to count who is present: a host that keeps a linked chat account only while its web person is active can note the person there, even when they only have the app open and call nothing of the host's. It is not awaited, and an error it throws is logged and never fails the request.
|
|
511
529
|
|
|
512
530
|
### Upgrading from 0.8
|
|
513
531
|
|
|
@@ -857,6 +875,7 @@ A room's key is `<surface>:<kind>.<id>`, with an id of 8 to 64 letters, digits,
|
|
|
857
875
|
- **Pages.** A page is at `<mount>/p/<id>` and is built from sections: Markdown, a list of rows (each may open a link and carry buttons), a form with an action, and a card. `place` is `main` (the navigation), `settings` (the Settings pane) or `hidden`. `visible(viewer)` is asked on every fetch and action; a page that is not visible is a `404`. `app.pages.changed(id?)` sends the viewers who may see it a `page_changed` frame and their page fetches the view again.
|
|
858
876
|
- **Retention.** A kind's `retention: { textDays, fileDays }` deletes its messages, author names, host cards and files that old, counted from each message's `at` (a card's from when it was first posted). Without it nothing is deleted. A card the host still wants, such as a ticket's pinned card while the ticket is open, carries `keep: true` in `card` and `updateCard`: the sweep skips it for as long as the host passes `keep: true`, and `updateCard` without it makes the card an ordinary one again.
|
|
859
877
|
- **Read marks.** The page tells the app how far a person has read (the newest message in view, at most once a second, never while the page is hidden). The app keeps one cursor per person and room, for host rooms and agent rooms alike (among owners), and computes each room's `unread` from it; the list and the drawer show the count, an attention dot where the host sets `attention`, and the room opens with a "new messages" divider where the person stopped. Under each message the people who have read up to it are named: "Seen by 2", with their pictures; a person's own mark is not shown to them.
|
|
878
|
+
- **Mark all as read.** The room list's menu and each folder's menu have **Mark all as read**, left out when nothing in its scope is unread (a folder's scope is its rooms and the threads under them). It reads every room the person may read, agent, group, thread and host rooms, up to the newest message in one call: `POST api/rooms/read-all` with `{ "rooms": [<keys>] }` (at most 500; left out, every room the list shows, host rooms excepted), owners only like the rest of `api/rooms`. Rooms the person may not read are passed over as if they were not named. The answer lists the cursors that moved, `{ "moved": [{ "room", "from", "to" }] }`; sending them back as `{ "restore": [...] }` to the same route puts each cursor back where it was, unless the person has read on since. The unread badges, the tab title's count and the tab icon's dot clear at once, the person's other pages and devices hear of it through the same `read` frames a single read sends (and a `changed` frame for the lists), and a notice offers Undo for five seconds. Nothing asks first.
|
|
860
879
|
- **The page is lazy.** The room, the lists and the pages load as separate chunks when first opened, so the app's first load is the same size as before.
|
|
861
880
|
|
|
862
881
|
## App protocol
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h,Q,S,e,w}from"./chunk-index-kankja6p.js";var a={profile:S(()=>(h("pfzyc04p"),import("./chunk-profile-pfzyc04p.js")).then((o)=>({default:o.ProfilePage}))),notices:S(()=>(h("prqkv7ge"),import("./chunk-notices-prqkv7ge.js")).then((o)=>({default:o.NoticesPage}))),onboarding:S(()=>(h("mdtc2mb7"),import("./chunk-onboarding-mdtc2mb7.js")).then((o)=>({default:o.OnboardingPage})))};function n({pane:o}){let t=a[o];return t?e(Q,{fallback:e(w,{}),children:e(t,{})}):null}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s,Fe,a,r,g,e,n,o,kt,zo}from"./chunk-index-kankja6p.js";import{L}from"./chunk-index-47yspxa4.js";var k=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches,x={rtMenu:!0},H=()=>Boolean(window.history.state?.rtMenu),w=8,M=(t)=>t?.isConnected?t:null;function y(t){return t.items.map((u)=>n("button",{type:"button",role:u.checked===void 0?"menuitem":"menuitemcheckbox",...u.checked===void 0?{}:{"aria-checked":u.checked},className:"menu-item menu-link","data-tone":u.tone,onClick:()=>t.onChoose(u),children:[u.icon?e("span",{className:"menu-icon","data-tone":u.tone,children:e(o,{name:u.icon,size:18})}):null,e("span",{className:"menu-text",children:e("strong",{children:u.label})}),u.checked?e(o,{name:"check",size:18,className:"menu-check"}):null]},u.id))}function T({menu:t}){let u=a(void 0);if(t)u.current=t;let c=u.current,m=a(!1),p=a(void 0),h=t?.serial;return s(()=>{if(h===void 0)return;return window.history.pushState(x,"",window.location.href),m.current=!0,()=>{if(m.current)m.current=!1,window.history.back()}},[h]),s(()=>{let f=()=>{if(!m.current||H())return;m.current=!1,kt();let E=p.current;p.current=void 0,E?.()};return window.addEventListener("popstate",f),()=>window.removeEventListener("popstate",f)},[]),e(L,{open:t!==void 0,title:c?.title??"",onClose:kt,restoreFocus:()=>M(c?.source??null),children:c?e("div",{className:"menu action-items",role:"menu","aria-label":c.title,children:e(y,{items:c.items,onChoose:(f)=>{if(!m.current){kt(),f.run();return}p.current=f.run,window.history.back()}})}):null})}function C({menu:t}){let u=a(null),[c,m]=r(t.at),{source:p}=t,h=(i)=>{M(p)?.focus(),kt(),i?.()},f=a(h);f.current=h,Fe(()=>{let i=u.current;if(!i)return;let d=i.getBoundingClientRect();m({x:Math.max(w,Math.min(t.at.x,window.innerWidth-d.width-w)),y:Math.max(w,Math.min(t.at.y,window.innerHeight-d.height-w))}),i.querySelector('[role^="menuitem"]')?.focus()},[t.serial]),s(()=>{let i=(l)=>{if(l.target instanceof Node&&u.current?.contains(l.target))return;kt()},d=()=>kt();return document.addEventListener("pointerdown",i,!0),document.addEventListener("wheel",i,{capture:!0,passive:!0}),document.addEventListener("touchmove",i,{capture:!0,passive:!0}),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",i,!0),document.removeEventListener("wheel",i,!0),document.removeEventListener("touchmove",i,!0),window.removeEventListener("resize",d)}},[]);let E=(i)=>{let d=[...u.current?.querySelectorAll('[role^="menuitem"]')??[]],l=d.indexOf(document.activeElement),v=(b)=>{i.preventDefault(),d[(b+d.length)%d.length]?.focus()};switch(i.key){case"Escape":i.preventDefault(),i.stopPropagation(),f.current();return;case"ArrowDown":return v(l+1);case"ArrowUp":return v(l<0?-1:l-1);case"Tab":return v(i.shiftKey?l<0?-1:l-1:l+1);case"Home":return v(0);case"End":return v(-1)}};return e("div",{ref:u,className:"action-popover",role:"menu","aria-label":t.title,tabIndex:-1,style:{left:`${c.x}px`,top:`${c.y}px`},onKeyDown:E,children:e(y,{items:t.items,onChoose:(i)=>h(i.run)})})}function O(){let t=zo(),u=a(void 0);if(t&&u.current?.serial!==t.serial)u.current={serial:t.serial,sheet:k()};let c=Boolean(t&&u.current?.sheet);return n(g,{children:[e(T,{menu:c?t:void 0}),t&&!c?e(C,{menu:t},t.serial):null]})}export{O as ActionMenuHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s,e,F,d,w,tt}from"./chunk-index-kankja6p.js";function g({name:o}){let i=d((t)=>t.listed),r=d((t)=>Object.values(t.rooms).find((m)=>m.view?.kind==="agent"&&m.view.name===o)?.view?.key,o);return s(()=>{if(r)F("room",r,{replace:!0}),tt(o);else if(i)F("rooms",void 0,{replace:!0})},[r,i,o]),e("div",{className:"page",children:e(w,{})})}export{g as AgentPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h,Q,S,J,N,a,t,g,e,n,o,_e,d,k,_,fe,Yt,mn,ne,Fi,di,kr,Ht,fi,_r}from"./chunk-index-kankja6p.js";import{Ee}from"./chunk-index-qqwk157d.js";import{ti}from"./chunk-index-azrnzgev.js";import"./chunk-index-raf772z6.js";import{Wn}from"./chunk-index-r3tqhew8.js";import{Jn,ei}from"./chunk-index-gt42wjby.js";import{qt}from"./chunk-index-1fn8q4ps.js";import"./chunk-index-sxq69p1f.js";import"./chunk-index-xxbveevc.js";import{it}from"./chunk-index-nrexxkar.js";Jn();var M=S(()=>(h("nemtqbnc"),import("./chunk-folder-list-nemtqbnc.js")).then((s)=>({default:s.FolderList}))),O=J(function(l){let{view:r}=l,p=qt(()=>Yt(r.key),r.home?void 0:ei(r.key));return e(kr,{...l,press:p,item:{...r.home?{}:{"data-drop-item":"","data-key":r.key},...l.arranging?{"data-arranging":""}:{}},after:l.arranging?e("button",{type:"button",className:"icon-button row-more","aria-haspopup":"menu","aria-label":t("Room menu"),onClick:(c)=>{let u=c.currentTarget;Yt(r.key).then((i)=>{if(!i)return;let y=u.getBoundingClientRect();fe({...i,at:{x:y.left,y:y.bottom},via:"key",source:u})},()=>{return})},children:e(o,{name:"more",size:18})}):null})});function P(s){let{now:l}=ne(),{timeZone:r}=_(),p=Ht(s.rooms);return e("ul",{className:"room-list",children:p.map(({key:c,...u})=>{let i=s.threads[c];return e(O,{...u,active:c===s.active,now:l,timeZone:r,arranging:s.arranging,...i?{threads:e(fi,{open:i.open,closed:i.closed,active:s.active,parent:c})}:{}},c)})})}function v(s){let r=Ht(s.rooms).length===0;if(r&&s.zone?.kind!=="pinned")return null;return n("section",{className:"stack",...r?{"data-empty":""}:{},...s.zone?{"data-drop-zone":s.zone.kind,"data-zone-id":s.zone.id}:{},children:[e("h2",{className:"section-title",children:s.title}),r?null:e(P,{rooms:s.rooms,threads:s.threads,active:s.active,arranging:s.arranging})]})}function re(s){let l=Boolean(_().kinds?.length),r=d((m)=>JSON.stringify({listed:m.listed,...it(m,(F)=>_e(m,F))})),p=ti(),c=a(r);if(!p)c.current=r;let u=c.current,{listed:i,...y}=N(()=>JSON.parse(u),[u]),{home:z,pinned:A,folders:R,restAgents:T,restGroups:D,rest:C,threads:L,orphans:f}=y,w=Fi(),K=z.length+A.length+C.length===0&&R.every((m)=>m.rooms.length===0)&&f.open.length+f.closed.length===0,b={threads:L,active:s.active,arranging:w};return n("div",{className:"page","data-column":s.active?"":void 0,"data-drop-root":"",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Rooms")}),n("div",{className:"actions",children:[n("button",{type:"button",className:"header-button search-button",onClick:s.onSearch,children:[e(o,{name:"search",size:16}),e("span",{children:t("Find a room")}),e("kbd",{children:"⌘K"})]}),i?e("button",{type:"button",className:"header-button icon-button","aria-haspopup":"menu","aria-label":t("Folders and order"),onClick:(m)=>Wn(m.currentTarget),children:e(o,{name:"more",size:18})}):null,e("button",{type:"button",className:"header-button icon-button","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(m)=>mn(m.currentTarget),children:e(o,{name:"plus"})})]})]}),w?n("div",{className:"arrange-bar",children:[n("button",{type:"button",className:"secondary",onClick:()=>Ee({kind:"new"}),children:[e(o,{name:"plus",size:16}),e("span",{children:t("Add a folder")})]}),e("button",{type:"button",onClick:()=>di(!1),children:t("Done")})]}):null,i&&K&&!l?e(k,{children:t("No rooms yet. Rooms appear when the team has a knight.")}):null,!i?n("div",{className:"stack","aria-busy":"true",children:[e("div",{className:"skeleton"}),e("div",{className:"skeleton"}),e("div",{className:"skeleton"})]}):null,e(v,{title:t("Home"),rooms:z,...b}),e(v,{title:t("Pinned"),rooms:A,zone:{kind:"pinned",id:"pinned"},...b}),R.length>0?e("div",{className:"stack folder-list","data-folder-list":"",children:e(Q,{fallback:e("div",{className:"skeleton","aria-busy":"true"}),children:e(M,{folders:R,active:s.active,listed:i,rooms:(m)=>e(P,{rooms:m,threads:L,active:s.active,arranging:w})})})}):null,R.length>0?e(v,{title:t("Ungrouped"),rooms:C,zone:{kind:"rest",id:"rest"},...b}):n(g,{children:[e(v,{title:t("Knights"),rooms:T,zone:{kind:"rest",id:"rest-agents"},...b}),e(v,{title:t("Groups"),rooms:D,zone:{kind:"rest",id:"rest-groups"},...b})]}),f.open.length+f.closed.length>0?n("section",{className:"stack",children:[e("h2",{className:"section-title",children:t("Dispatch threads")}),e(fi,{open:f.open,closed:f.closed,active:s.active})]}):null,e(_r,{active:s.active})]})}export{re as ArrangedRoomsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,te,y,u,p}from"./chunk-index-kankja6p.js";import{Jt}from"./chunk-index-raf772z6.js";import{pi,Er}from"./chunk-index-xbs8q4kn.js";import{Ir}from"./chunk-index-sxq69p1f.js";import"./chunk-index-xxbveevc.js";var s=500,d=(e)=>{let n=[];for(let r=0;r<e.length;r+=s)n.push(e.slice(r,r+s));return n},i=()=>y.dispatch({type:"changed"});async function v(e){let n=Ir(e),r=Object.keys(n);if(r.length===0)return;let a=[];try{for(let o of d(r))a.push(...(await pi.readAll(o)).moved)}catch(o){p(u(o),"danger"),i();return}Jt(Object.fromEntries(r.map((o)=>[o,0]))),p(te(r.length,"Marked {count} room as read","Marked {count} rooms as read"),"info",a.length?{label:t("Undo"),run:()=>void l(a,n)}:void 0)}async function l(e,n){try{for(let r of d(e)){let{restored:a}=await pi.unreadAll(r);Jt(Object.fromEntries(a.map((o)=>[o,n[o]??0])))}}catch(r){p(u(r),"danger")}i()}var R=(e)=>Er(e);export{R as clearAllFinished,v as markAllRead};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Be,jt,G,hi,bn}from"./chunk-index-eyc2rkq5.js";import{J,gr,s,A,N,a,r,t,c,g,e,n,si,le,O,u,p,gn,he,Ze,Me}from"./chunk-index-kankja6p.js";import{K}from"./chunk-index-3wbyq10m.js";import{L}from"./chunk-index-47yspxa4.js";var ue={"hat.none":"No hat","hat.goggcap":"Leather cap","hat.tallcap":"Burgundian felt cap","hat.softcap":"Soft cap","hat.hardhat":"Iron skullcap","hat.fcap":"Hunter's cap","hat.winghelm":"Winged helm","hat.helm":"Helm","hat.mortar":"Biretta","hat.beret":"Chaperon","hat.goggles":"Pointed cap","hat.tricorn":"Pilgrim hat","hat.sailor":"Straw hat","hat.kettle":"Kettle hat","hat.cavalier":"Feathered hat","hat.toque":"Linen cook's cap","hair.none":"No hair","beard.none":"No beard","accessory.none":"No accessory","prop.beads":"Prayer beads","prop.marotte":"Marotte","prop.map":"Chart","prop.flask":"Alchemist's phial","prop.telescope":"Astrolabe","prop.wrench":"Dividers","outfit.surplice":"Surplice","outfit.overalls":"Work jerkin","outfit.armor":"Mail hauberk","outfit.apron":"Smith's apron","outfit.chef":"Cook's tunic","outfit.coat":"Doublet","outfit.vest":"Pourpoint","outfit.sailor":"Mariner's tunic","hair.bob":"Bob","hair.bun":"Bun","hair.ponytail":"Ponytail"},Y=(i)=>i.charAt(0).toUpperCase()+i.slice(1);function S(i,l){let m=`character.${i}.${l}`,h=t(m);if(h!==m)return h;if(i==="class")return G.classes[l]?.label??Y(l);return ue[`${i}.${l}`]??Y(l)}function Z(i){let l=`character.jobs.${i}`,m=t(l);return m!==l?m:G.classes[i]?.jobs??""}var z=[{field:"hat",title:c("Hat"),ids:G.hats},{field:"outfit",title:c("Outfit"),ids:G.outfits},{field:"prop",title:c("Prop"),ids:G.props},{field:"hair",title:c("Hair"),ids:G.hair},{field:"beard",title:c("Beard"),ids:["none",...G.beards]},{field:"accessory",title:c("Accessory"),ids:["none",...G.accessories]}],fe=new Set(["class","colors","palette","build","skin","hairColor",...z.map((i)=>i.field)]),re=Object.keys(G.palettes),ee={idle:c("Idle"),thinking:c("Thinking"),working:c("Working"),waiting:c("Waiting for you"),done:c("Done"),error:c("Error"),sleepy:c("Sleepy")},me={slim:c("Slim"),regular:c("Regular"),stout:c("Stout")};function W(i){return{class:i.class,outfit:i.outfit,hat:i.hat,prop:i.prop,hair:i.hair,beard:i.beard,accessory:i.accessory,build:i.build,skin:i.skin,hairColor:i.hairColor,colors:{...i.colors}}}var te=(i)=>JSON.stringify(W(i)),k=(i)=>i[Math.floor(Math.random()*i.length)];function be(){return{class:k(Be),outfit:k(G.outfits),hat:k(G.hats),prop:k(G.props),hair:k(G.hair),beard:k(["none",...G.beards]),accessory:k(["none",...G.accessories]),build:k(["slim","regular","stout"]),skin:k([0,1,2,3,4,5]),hairColor:k(G.hairColors),palette:k(re)}}var ie=J(function(l){return n("button",{type:"button",className:"creator-tile","aria-pressed":l.pressed,title:l.hint?`${l.label} — ${l.hint}`:l.label,onClick:l.onPick,...l.data,children:[e(he,{spec:l.spec,size:l.size,live:!1}),e("span",{children:l.label})]})});function ge(i,l,m){let h=JSON.stringify({...i,[l]:0});return N(()=>m.map((d)=>({...i,[l]:d})),[h,l,m])}function pe(){let i=a(null),[l,m]=r();return s(()=>{let h=i.current;if(!h)return;let d=()=>{let v=h.scrollLeft>1,w=h.scrollLeft+h.clientWidth<h.scrollWidth-1;m(v&&w?"both":w?"end":v?"start":void 0)};d(),h.addEventListener("scroll",d,{passive:!0});let b=typeof ResizeObserver>"u"?void 0:new ResizeObserver(d);return b?.observe(h),()=>{h.removeEventListener("scroll",d),b?.disconnect()}},[]),[i,l]}function ye(i){let{part:l}=i,m=ge(i.shown,l.field,l.ids),[h,d]=pe();return e("div",{className:"creator-strip",ref:h,"data-more":d,children:l.ids.map((b,v)=>e(ie,{data:{[`data-${l.field}`]:b},spec:m[v],size:44,label:S(l.field,b),pressed:i.draft[l.field]===b,onPick:()=>i.onPick(b)},b))})}function M(i){return e("button",{type:"button",className:"creator-swatch","aria-pressed":i.pressed,"aria-label":i.label,title:i.label,style:{background:i.background},onClick:i.onPick,...i.data})}function P(i){return n("div",{className:"creator-field","data-field":i.field,children:[i.title?e("h3",{children:i.title}):null,i.children,i.error?e("p",{className:"field-error",role:"alert",children:i.error}):null]})}function Oe(i){let[l,m]=r(i.character),h=gr(l),[d,b]=r({}),[v,w]=r(!1),[I,ne]=r("idle"),[U,R]=r(),[D,_]=r(),j=Me("(max-width: 719px)"),V=a(null),F=A(),oe=Ze(l),se=gn(),E=te(l)!==te(i.character);s(()=>m(i.character),[i.character]),s(()=>{if(!E||i.onPick)return;let o=(y)=>y.preventDefault(),f=(y)=>{if(y.button!==0||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey)return;let T=y.target instanceof Element?y.target.closest("a"):null;if(!T||T.target||T.hasAttribute("download"))return;if(V.current?.contains(T))return;y.preventDefault(),y.stopPropagation(),R({kind:"link",anchor:T})},H=si((y)=>R({kind:"navigate",proceed:y}));return window.addEventListener("beforeunload",o),document.addEventListener("click",f,!0),()=>{H(),window.removeEventListener("beforeunload",o),document.removeEventListener("click",f,!0)}},[E,i.onPick]);let C=(o)=>{b({}),m((f)=>hi(o,f))},ce=async()=>{if(i.onPick){i.onPick(W(l),l);return}w(!0),b({});try{let o=await O.setCharacter(i.name,W(l));i.onSaved?.(o),p(t("Saved."))}catch(o){let f=o instanceof le&&o.field?o.field.split(".")[0]:void 0,H=f&&fe.has(f)?f:"*";b({[H]:u(o)})}finally{w(!1)}},de=async()=>{let o=U;if(m(i.character),b({}),o?.kind==="link")setTimeout(()=>o.anchor.click(),0);else if(o?.kind==="navigate")o.proceed()},q=e(P,{field:"class",title:t("Class"),error:d.class,children:e("div",{className:"creator-grid",children:Be.map((o)=>e(ke,{id:o,base:h,pressed:l.class===o,onPick:()=>C({class:o,colors:l.colors})},o))})}),x=n(P,{field:"colors",title:t("Colors"),error:d.colors??d.palette,children:[n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Palette")}),re.map((o)=>{let f=G.palettes[o];return e(M,{data:{"data-palette":o},label:S("palette",o),pressed:l.palette===o,background:`linear-gradient(135deg, ${f.primary} 52%, ${f.trim} 52%)`,onPick:()=>C({palette:o})},o)})]}),e("div",{className:"creator-custom",children:["primary","secondary","trim"].map((o)=>n("label",{children:[e("span",{children:o==="primary"?t("Primary (the accent)"):o==="secondary"?t("Secondary"):t("Trim")}),e("input",{type:"color",value:l.colors[o],onChange:(f)=>C({colors:{[o]:f.target.value}})})]},o))})]}),Q=z.map((o)=>e(P,{field:o.field,title:t(o.title),error:d[o.field],children:e(ye,{part:o,draft:l,shown:h,onPick:(f)=>C({[o.field]:f})})},o.field)),X=n(g,{children:[e(P,{field:"build",title:t("Build"),error:d.build,children:n("fieldset",{className:"segmented",children:[e("legend",{className:"visually-hidden",children:t("Build")}),["slim","regular","stout"].map((o)=>n("label",{"data-checked":l.build===o,children:[e("input",{type:"radio",name:`${F}-build`,checked:l.build===o,onChange:()=>C({build:o})}),ae(o)]},o))]})}),e(P,{field:"skin",title:t("Skin tone"),error:d.skin,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Skin tone")}),(se??G.skins).map((o,f)=>e(M,{data:{"data-skin":String(f)},label:t("Skin tone {n}",{n:f+1}),pressed:l.skin===f,background:o,onPick:()=>C({skin:f})},f))]})}),e(P,{field:"hairColor",title:t("Hair color"),error:d.hairColor,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Hair color")}),G.hairColors.map((o,f)=>e(M,{data:{"data-hair-color":o},label:t("Hair color {n}",{n:f+1}),pressed:l.hairColor===o,background:o,onPick:()=>C({hairColor:o})},o)),e("input",{type:"color","aria-label":t("Hair color"),value:l.hairColor,onChange:(o)=>C({hairColor:o.target.value})})]})})]}),B=[{id:"class",title:t("Class"),summary:S("class",l.class),error:d.class,node:q},{id:"colors",title:t("Colors"),summary:l.palette?S("palette",l.palette):l.colors.primary,error:d.colors??d.palette,node:x},...z.map((o,f)=>({id:o.field,title:t(o.title),summary:S(o.field,l[o.field]),error:d[o.field],node:Q[f]})),{id:"body",title:t("Body"),summary:ae(l.build),error:d.build??d.skin??d.hairColor,node:X}];return n("form",{ref:V,className:"creator",style:oe,"aria-labelledby":F,onSubmit:(o)=>{if(o.preventDefault(),(E||i.onPick)&&!v)ce()},children:[e("h2",{id:F,className:"visually-hidden",children:t("Character of {name}",{name:i.displayName})}),n("div",{className:"creator-preview",children:[e(he,{spec:l,name:i.name,state:I,size:176,label:t("{name}, {state}",{name:i.displayName,state:t(ee[I])})}),e("button",{type:"button",className:"secondary","data-action":"cycle",onClick:()=>ne((o)=>jt[(jt.indexOf(o)+1)%jt.length]??"idle"),children:t("Preview states")}),e("span",{className:"meta","aria-live":"polite",children:t(ee[I])})]}),n("div",{className:"creator-body",children:[d["*"]?e("p",{className:"field-error",role:"alert","data-field":"*",children:d["*"]}):null,j?e("ul",{className:"creator-sections",children:B.map((o)=>e("li",{children:n("button",{type:"button",className:"creator-section secondary",onClick:()=>_(o.id),children:[e("strong",{children:o.title}),e("span",{className:"meta",children:o.summary}),o.error?e("span",{className:"field-error",role:"alert",children:o.error}):null]})},o.id))}):n(g,{children:[q,x,Q,X]}),n("div",{className:"actions creator-actions",children:[e("button",{type:"button",className:"secondary","data-action":"suggest",onClick:()=>{b({}),m(bn({name:i.name,displayName:i.displayName,prompt:i.prompt}))},children:t("Suggest from role")}),e("button",{type:"button",className:"secondary","data-action":"randomize",onClick:()=>C(be()),children:t("Randomize")}),e("button",{type:"button",className:"secondary","data-action":"cancel",onClick:()=>{if(i.onCancel)i.onCancel();else if(E)R({kind:"cancel"})},children:t("Cancel")}),e("button",{type:"submit","data-action":"save",disabled:!E&&!i.onPick||v,children:v?t("Saving…"):i.onPick?t("Use this look"):t("Save")})]})]}),e(L,{open:j&&D!==void 0,title:B.find((o)=>o.id===D)?.title??"",onClose:()=>_(void 0),children:e("div",{className:"stack",children:B.find((o)=>o.id===D)?.node})}),e(K,{open:U!==void 0,title:t("Discard your changes?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>R(void 0),onConfirm:de,children:e("p",{children:t("The new look for {name} has not been saved.",{name:i.displayName})})})]})}var ae=(i)=>t(me[i]);function ke(i){let l=i.base.colors,m=N(()=>hi({class:i.id,colors:l}),[i.id,l]);return e(ie,{data:{"data-class":i.id},spec:m,size:56,label:S("class",i.id),hint:Z(i.id),pressed:i.pressed,onPick:i.onPick})}export{Oe as CharacterCreator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{U,fe,ii,Rr,ri,it,he,l,v,we,Ae,At,$e,q,re,se,z,ht,pt,Ne,pe,E,ee,_e,g,xt,Er,Cr,Ar,si,En,$r,Nr,Lr,Xr,T,i,C,Fe,Lt,$n,Ii,hn,pn,Dr,Ur,st}from"./chunk-index-gyary7np.js";import{h}from"./chunk-index-zynq0b0w.js";var nn=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ce(e.state,n.from);return r.line?rn(e):r.block?ln(e):!1};function be(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);if(!o)return!1;return r(n.update(o)),!0}}var rn=be(an,0);var on=be(Ye,0);var ln=be((e,t)=>Ye(e,t,cn(t)),0);function Ce(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var V=50;function sn(e,{open:t,close:n},r,o){let s=e.sliceDoc(r-V,r),c=e.sliceDoc(o,o+V),a=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(c)[0].length,d=s.length-a;if(s.slice(d-t.length,d)==t&&c.slice(u,u+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:o+u,margin:u&&1}};let f,m;if(o-r<=2*V)f=m=e.sliceDoc(r,o);else f=e.sliceDoc(r,r+V),m=e.sliceDoc(o-V,o);let p=/^\s*/.exec(f)[0].length,D=/\s*$/.exec(m)[0].length,M=m.length-D-n.length;if(f.slice(p,p+t.length)==t&&m.slice(M,M+n.length)==n)return{open:{pos:r+p+t.length,margin:/\s/.test(f.charAt(p+t.length))?1:0},close:{pos:o-D-n.length,margin:/\s/.test(m.charAt(M-1))?1:0}};return null}function cn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);if(o.from>r.from&&o.from==n.to)o=n.to==r.to+1?r:e.doc.lineAt(n.to-1);let s=t.length-1;if(s>=0&&t[s].to>r.from)t[s].to=o.to;else t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function Ye(e,t,n=t.selection.ranges){let r=n.map((s)=>Ce(t,s.from).block);if(!r.every((s)=>s))return null;let o=n.map((s,c)=>sn(t,r[c],s.from,s.to));if(e!=2&&!o.every((s)=>s))return{changes:t.changes(n.map((s,c)=>{if(o[c])return[];return[{from:s.from,insert:r[c].open+" "},{from:s.to,insert:" "+r[c].close}]}))};else if(e!=1&&o.some((s)=>s)){let s=[];for(let c=0,a;c<o.length;c++)if(a=o[c]){let u=r[c],{open:d,close:f}=a;s.push({from:d.pos-u.open.length,to:d.pos+d.margin},{from:f.pos-f.margin,to:f.pos+u.close.length})}return{changes:s}}return null}function an(e,t,n=t.selection.ranges){let r=[],o=-1;e:for(let{from:s,to:c}of n){let a=r.length,u=1e9,d;for(let f=s;f<=c;){let m=t.doc.lineAt(f);if(d==null){if(d=Ce(t,m.from).line,!d)continue e}if(m.from>o&&(s==c||c>m.from)){o=m.from;let p=/^\s*/.exec(m.text)[0].length,D=p==m.length,M=m.text.slice(p,p+d.length)==d?p:-1;if(p<m.text.length&&p<u)u=p;r.push({line:m,comment:M,token:d,indent:p,empty:D,single:!1})}f=m.to+1}if(u<1e9){for(let f=a;f<r.length;f++)if(r[f].indent<r[f].line.text.length)r[f].indent=u}if(r.length==a+1)r[a].single=!0}if(e!=2&&r.some((s)=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:u,indent:d,empty:f,single:m}of r)if(m||!f)s.push({from:a.from+d,insert:u+" "});let c=t.changes(s);return{changes:c,selection:t.selection.map(c,1)}}else if(e!=1&&r.some((s)=>s.comment>=0)){let s=[];for(let{line:c,comment:a,token:u}of r)if(a>=0){let d=c.from+a,f=d+u.length;if(c.text[f-c.from]==" ")f++;s.push({from:d,to:f})}return{changes:s}}return null}var Se=$e.define(),un=$e.define(),fn=v.define(),Ze=v.define({combine(e){return ht(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,o)=>t(r,o)||n(r,o)})}}),et=we.define({create(){return B.empty},update(e,t){let n=t.state.facet(Ze),r=t.annotation(Se);if(r){let u=x.fromTransaction(t,r.selection),d=r.side,f=d==0?e.undone:e.done;if(u)f=Q(f,f.length,n.minDepth,u);else f=rt(f,t.startState.selection);return new B(d==0?r.rest:f,d==0?f:r.rest)}let o=t.annotation(un);if(o=="full"||o=="before")e=e.isolate();if(t.annotation(re.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let s=x.fromTransaction(t),c=t.annotation(re.time),a=t.annotation(re.userEvent);if(s)e=e.addChanges(s,c,a,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,c,a,n.newGroupDelay);if(o=="full"||o=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new B(e.done.map(x.fromJSON),e.undone.map(x.fromJSON))}});function tt(e={}){return[et,Ze.of(e),g.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?X:t.inputType=="historyRedo"?G:null;if(!r)return!1;return t.preventDefault(),r(n)}})]}function j(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(et,!1);if(!o)return!1;let s=o.pop(e,n,t);if(!s)return!1;return r(s),!0}}var X=j(0,!1),G=j(1,!1),dn=j(0,!0),mn=j(1,!0);class x{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new x(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((r)=>r.toJSON())}}static fromJSON(e){return new x(e.changes&&he.fromJSON(e.changes),[],e.mapped&&it.fromJSON(e.mapped),e.startSelection&&l.fromJSON(e.startSelection),e.selectionsAfter.map(l.fromJSON))}static fromTransaction(e,t){let n=k;for(let r of e.startState.facet(fn)){let o=r(e);if(o.length)n=n.concat(o)}if(!n.length&&e.changes.empty)return null;return new x(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,k)}static selection(e){return new x(void 0,k,void 0,void 0,e)}}function Q(e,t,n,r){let o=t+1>n+20?t-n-1:0,s=e.slice(o,t);return s.push(r),s}function gn(e,t){let n=[],r=!1;return e.iterChangedRanges((o,s)=>n.push(o,s)),t.iterChangedRanges((o,s,c,a)=>{for(let u=0;u<n.length;){let d=n[u++],f=n[u++];if(a>=d&&c<=f)r=!0}}),r}function yn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function nt(e,t){return!e.length?t:!t.length?e:e.concat(t)}var k=[],xn=200;function rt(e,t){if(!e.length)return[x.selection([t])];else{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-xn));if(r.length&&r[r.length-1].eq(t))return e;return r.push(t),Q(e,e.length-1,1e9,n.setSelAfter(r))}}function Sn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function xe(e,t){if(!e.length)return e;let n=e.length,r=k;while(n){let o=kn(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let s=e.slice(0,n);return s[n-1]=o,s}else t=o.mapped,n--,r=o.selectionsAfter}return r.length?[x.selection(r)]:k}function kn(e,t,n){let r=nt(e.selectionsAfter.length?e.selectionsAfter.map((a)=>a.map(t)):k,n);if(!e.changes)return x.selection(r);let o=e.changes.map(t),s=t.mapDesc(e.changes,!0),c=e.mapped?e.mapped.composeDesc(s):s;return new x(o,q.mapEffects(e.effects,t),c,e.startSelection.map(s),r)}var vn=/^(input\.type|delete)($|\.)/;class B{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new B(this.done,this.undone):this}addChanges(e,t,n,r,o){let s=this.done,c=s[s.length-1];if(c&&c.changes&&!c.changes.empty&&e.changes&&(!n||vn.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,gn(c.changes,e.changes))||n=="input.type.compose"))s=Q(s,s.length-1,r.minDepth,new x(e.changes.compose(c.changes),nt(q.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,k));else s=Q(s,s.length,r.minDepth,e);return new B(s,k,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:k;if(o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&yn(o[o.length-1],e))return this;return new B(rt(this.done,e),this.undone,t,n)}addMapping(e){return new B(xe(this.done,e),xe(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Se.of({side:e,rest:Sn(r),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!o.changes)return null;else{let c=r.length==1?k:r.slice(0,r.length-1);if(o.mapped)c=xe(c,o.mapped);return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Se.of({side:e,rest:c,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}B.empty=new B(k,k);var ot=[{key:"Mod-z",run:X,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:G,preventDefault:!0},{linux:"Ctrl-Shift-z",run:G,preventDefault:!0},{key:"Mod-u",run:dn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:mn,preventDefault:!0}];function F(e,t){return l.create(e.ranges.map(t),e.mainIndex)}function A(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);if(r.eq(e.selection,!0))return!1;return t(A(e,r)),!0}function Y(e,t){return l.cursor(t?e.to:e.from)}function lt(e,t){return L(e,(n)=>n.empty?e.moveByChar(n,t):Y(n,t))}function y(e){return e.textDirectionAt(e.state.selection.main.head)==ee.LTR}var ct=(e)=>lt(e,!y(e)),at=(e)=>lt(e,y(e));function ut(e,t){return L(e,(n)=>n.empty?e.moveByGroup(n,t):Y(n,t))}var bn=(e)=>ut(e,!y(e)),Cn=(e)=>ut(e,y(e));var no=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Mn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Z(e,t,n){let r=C(e).resolveInner(t.head),o=n?T.closedBy:T.openedBy;for(let u=t.head;;){let d=n?r.childAfter(u):r.childBefore(u);if(!d)break;if(Mn(e,d,o))r=d;else u=n?d.to:d.from}let s=r.type.prop(o),c,a;if(s&&(c=n?st(e,r.from,1):st(e,r.to,-1))&&c.matched)a=n?c.end.to:c.end.from;else a=n?r.to:r.from;return l.cursor(a,n?-1:1)}var An=(e)=>L(e,(t)=>Z(e.state,t,!y(e))),Ln=(e)=>L(e,(t)=>Z(e.state,t,y(e)));function ft(e,t){return L(e,(n)=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}var dt=(e)=>ft(e,!1),mt=(e)=>ft(e,!0);function gt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,o;if(t){for(let s of e.state.facet(g.scrollMargins)){let c=s(e);if(c===null||c===void 0?void 0:c.top)n=Math.max(c===null||c===void 0?void 0:c.top,n);if(c===null||c===void 0?void 0:c.bottom)r=Math.max(c===null||c===void 0?void 0:c.bottom,r)}o=e.scrollDOM.clientHeight-n-r}else o=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,o-5)}}function yt(e,t){let n=gt(e),{state:r}=e,o=F(r.selection,(c)=>c.empty?e.moveVertically(c,t,n.height):Y(c,t));if(o.eq(r.selection))return!1;let s;if(n.selfScroll){let c=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),u=a.top+n.marginTop,d=a.bottom-n.marginBottom;if(c&&c.top>u&&c.bottom<d)s=g.scrollIntoView(o.main.head,{y:"start",yMargin:c.top-u})}return e.dispatch(A(r,o),{effects:s}),!0}var Ue=(e)=>yt(e,!1),ke=(e)=>yt(e,!0);function w(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from))o=e.moveToLineBoundary(t,n,!1);if(!n&&o.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;if(s&&t.head!=r.from+s)o=l.cursor(r.from+s)}return o}var Bn=(e)=>L(e,(t)=>w(e,t,!0)),Dn=(e)=>L(e,(t)=>w(e,t,!1)),Tn=(e)=>L(e,(t)=>w(e,t,!y(e))),wn=(e)=>L(e,(t)=>w(e,t,y(e))),Wn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!1,!1)),Rn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!0,!1));function On(e,t,n){let r=!1,o=F(e.selection,(s)=>{let c=st(e,s.head,-1)||st(e,s.head,1)||s.head>0&&st(e,s.head-1,1)||s.head<e.doc.length&&st(e,s.head+1,-1);if(!c||!c.end)return s;r=!0;let a=c.start.from==s.head?c.end.to:c.end.from;return n?l.range(s.anchor,a):l.cursor(a)});if(!r)return!1;return t(A(e,o)),!0}var Fn=({state:e,dispatch:t})=>On(e,t,!1);function b(e,t,n){let r=F(e.state.selection,(o)=>{if(o.undirectional&&o.head>=o.anchor!=t)o=l.range(o.head,o.anchor);let s=n(o);return l.range(o.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});if(r.eq(e.state.selection))return!1;return e.dispatch(A(e.state,r)),!0}function St(e,t){return b(e,t,(n)=>e.moveByChar(n,t))}var kt=(e)=>St(e,!y(e)),vt=(e)=>St(e,y(e));function bt(e,t){return b(e,t,(n)=>e.moveByGroup(n,t))}var In=(e)=>bt(e,!y(e)),Pn=(e)=>bt(e,y(e));var Nn=(e)=>{let t=!y(e);return b(e,t,(n)=>Z(e.state,n,t))},qn=(e)=>{let t=y(e);return b(e,t,(n)=>Z(e.state,n,t))};function Ct(e,t){return b(e,t,(n)=>e.moveVertically(n,t))}var Mt=(e)=>Ct(e,!1),Bt=(e)=>Ct(e,!0);function Dt(e,t){return b(e,t,(n)=>e.moveVertically(n,t,gt(e).height))}var ze=(e)=>Dt(e,!1),Je=(e)=>Dt(e,!0),Vn=(e)=>b(e,!0,(t)=>w(e,t,!0)),Gn=(e)=>b(e,!1,(t)=>w(e,t,!1)),Un=(e)=>{let t=!y(e);return b(e,t,(n)=>w(e,n,t))},zn=(e)=>{let t=y(e);return b(e,t,(n)=>w(e,n,t))},_n=(e)=>b(e,!1,(t)=>l.cursor(e.lineBlockAt(t.head).from)),Jn=(e)=>b(e,!0,(t)=>l.cursor(e.lineBlockAt(t.head).to)),Ke=({state:e,dispatch:t})=>(t(A(e,{anchor:0})),!0),He=({state:e,dispatch:t})=>(t(A(e,{anchor:e.doc.length})),!0),Qe=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:0})),!0),je=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Kn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Hn=({state:e,dispatch:t})=>{let n=te(e).map(({from:r,to:o})=>l.undirectionalRange(r,Math.min(o+1,e.doc.length)));return t(e.update({selection:l.create(n),userEvent:"select"})),!0},Qn=({state:e,dispatch:t})=>{let n=F(e.selection,(r)=>{let o=C(e),s=o.resolveStack(r.from,1);if(r.empty){let c=o.resolveStack(r.from,-1);if(c.node.from>=s.node.from&&c.node.to<=s.node.to)s=c}for(let c=s;c;c=c.next){let{node:a}=c;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&c.next)return l.undirectionalRange(a.from,a.to)}return r});if(n.eq(e.selection))return!1;return t(A(e,n)),!0};function Et(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let s of n.selection.ranges){let c=n.doc.lineAt(s.head);if(t?c.to<e.state.doc.length:c.from>0)for(let a=s;;){let u=e.moveVertically(a,t);if(u.head<c.from||u.head>c.to){if(!o.some((d)=>d.head==u.head))o.push(u);break}else if(u.head==a.head)break;else a=u}}if(o.length==r.ranges.length)return!1;return e.dispatch(A(n,l.create(o,o.length-1))),!0}var jn=(e)=>Et(e,!1),Xn=(e)=>Et(e,!0),Yn=({state:e,dispatch:t})=>{let n=e.selection,r=null;if(n.ranges.length>1)r=l.create([n.main]);else if(!n.main.empty)r=l.create([l.cursor(n.main.head)]);if(!r)return!1;return t(A(e,r)),!0};function _(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((s)=>{let{from:c,to:a}=s;if(c==a){let u=t(s);if(u<c)n="delete.backward",u=H(e,u,!1);else if(u>c)n="delete.forward",u=H(e,u,!0);c=Math.min(c,u),a=Math.max(a,u)}else c=H(e,c,!1),a=H(e,a,!0);return c==a?{range:s}:{changes:{from:c,to:a},range:l.cursor(c,c<s.head?-1:1)}});if(o.changes.empty)return!1;return e.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?g.announce.of(r.phrase("Selection deleted")):void 0})),!0}function H(e,t,n){if(e instanceof g)for(let r of e.state.facet(g.atomicRanges).map((o)=>o(e)))r.between(t,t,(o,s)=>{if(o<t&&s>t)t=n?s:o});return t}var Tt=(e,t,n)=>_(e,(r)=>{let o=r.from,{state:s}=e,c=s.doc.lineAt(o),a,u;if(n&&!t&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(a=c.text.slice(0,o-c.from))){if(a[a.length-1]=="\t")return o-1;let d=Ne(a,s.tabSize),f=d%Lt(s)||Lt(s);for(let m=0;m<f&&a[a.length-1-m]==" ";m++)o--;u=o}else if(u=fe(c.text,o-c.from,t,t)+c.from,u==o&&c.number!=(t?s.doc.lines:1))u+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from)))u=fe(c.text,u-c.from,!1,!1)+c.from;return u}),ve=(e)=>Tt(e,!1,!0);var wt=(e)=>Tt(e,!0,!1),Wt=(e,t)=>_(e,(n)=>{let r=n.head,{state:o}=e,s=o.doc.lineAt(r),c=o.charCategorizer(r);for(let a=null;;){if(r==(t?s.to:s.from)){if(r==n.head&&s.number!=(t?o.doc.lines:1))r+=t?1:-1;break}let u=fe(s.text,r-s.from,t)+s.from,d=s.text.slice(Math.min(r,u)-s.from,Math.max(r,u)-s.from),f=c(d);if(a!=null&&f!=a)break;if(d!=" "||r!=n.head)a=f;r=u}return r}),Rt=(e)=>Wt(e,!1),Zn=(e)=>Wt(e,!0);var er=(e)=>_(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var tr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),nr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var rr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>({changes:{from:r.from,to:r.to,insert:U.of(["",""])},range:l.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},or=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let o=r.from,s=e.doc.lineAt(o),c=o==s.from?o-1:fe(s.text,o-s.from,!1)+s.from,a=o==s.to?o+1:fe(s.text,o-s.from,!0)+s.from;return{changes:{from:c,to:a,insert:e.doc.slice(o,a).append(e.doc.slice(c,o))},range:l.cursor(a)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function te(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from)s=e.doc.lineAt(r.to-1);if(n>=o.number){let c=t[t.length-1];c.to=s.to,c.ranges.push(r)}else t.push({from:o.from,to:s.to,ranges:[r]});n=s.number+1}return t}function Ot(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let s of te(e)){if(n?s.to==e.doc.length:s.from==0)continue;let c=e.doc.lineAt(n?s.to+1:s.from-1),a=c.length+1;if(n){r.push({from:s.to,to:c.to},{from:s.from,insert:c.text+e.lineBreak});for(let u of s.ranges)o.push(l.range(Math.min(e.doc.length,u.anchor+a),Math.min(e.doc.length,u.head+a)))}else{r.push({from:c.from,to:s.from},{from:s.to,insert:e.lineBreak+c.text});for(let u of s.ranges)o.push(l.range(u.anchor-a,u.head-a))}}if(!r.length)return!1;return t(e.update({changes:r,scrollIntoView:!0,selection:l.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0}var lr=({state:e,dispatch:t})=>Ot(e,t,!1),ir=({state:e,dispatch:t})=>Ot(e,t,!0);function Ft(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of te(e))if(n)r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak});else r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var sr=({state:e,dispatch:t})=>Ft(e,t,!1),cr=({state:e,dispatch:t})=>Ft(e,t,!0),ar=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(te(t).map(({from:o,to:s})=>{if(o>0)o--;else if(s<t.doc.length)s++;return{from:o,to:s}})),r=F(t.selection,(o)=>{let s=void 0;if(e.lineWrapping){let c=e.lineBlockAt(o.head),a=e.coordsAtPos(o.head,o.assoc||1);if(a)s=c.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2}return e.moveVertically(o,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ur(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=C(e).resolveInner(t),r=n.childBefore(t),o=n.childAfter(t),s;if(r&&o&&r.to<=t&&o.from>=t&&(s=r.type.prop(T.closedBy))&&s.indexOf(o.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(r.to,o.from)))return{from:r.to,to:o.from};return null}var Xe=It(!1),hr=It(!0);function It(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange((o)=>{let{from:s,to:c}=o,a=t.doc.lineAt(s),u=!e&&s==c&&ur(t,s);if(e)s=c=(c<=a.to?a:t.doc.lineAt(c)).to;let d=new hn(t,{simulateBreak:s,simulateDoubleBreak:!!u}),f=Ii(d,s);if(f==null)f=Ne(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize);while(c<a.to&&/\s/.test(a.text[c-a.from]))c++;if(u)({from:s,to:c}=u);else if(s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s)))s=a.from;let m=["",$n(t,f)];if(u)m.push($n(t,d.lineIndent(a.from,-1)));return{changes:{from:s,to:c,insert:U.of(m)},range:l.cursor(s+1+m[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Me(e,t){let n=-1;return e.changeByRange((r)=>{let o=[];for(let c=r.from;c<=r.to;){let a=e.doc.lineAt(c);if(a.number>n&&(r.empty||r.to>a.from))t(a,o,r),n=a.number;c=a.to+1}let s=e.changes(o);return{changes:o,range:l.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var fr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new hn(e,{overrideIndentation:(s)=>{let c=n[s];return c==null?-1:c}}),o=Me(e,(s,c,a)=>{let u=Ii(r,s.from);if(u==null)return;if(!/\S/.test(s.text))u=0;let d=/^\s*/.exec(s.text)[0],f=$n(e,u);if(d!=f||a.from<s.from+d.length)n[s.from]=u,c.push({from:s.from,to:s.from+d.length,insert:f})});if(!o.changes.empty)t(e.update(o,{userEvent:"indent"}));return!0},ne=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{r.push({from:n.from,insert:e.facet(Fe)})}),{userEvent:"input.indent"})),!0},Pt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let s=Ne(o,e.tabSize),c=0,a=$n(e,Math.max(0,s-Lt(e)));while(c<o.length&&c<a.length&&o.charCodeAt(c)==a.charCodeAt(c))c++;r.push({from:n.from+c,to:n.from+o.length,insert:a.slice(c)})}),{userEvent:"delete.dedent"})),!0},dr=(e)=>(e.setTabFocusMode(),!0);var mr=[{key:"Ctrl-b",run:ct,shift:kt,preventDefault:!0},{key:"Ctrl-f",run:at,shift:vt},{key:"Ctrl-p",run:dt,shift:Mt},{key:"Ctrl-n",run:mt,shift:Bt},{key:"Ctrl-a",run:Wn,shift:_n},{key:"Ctrl-e",run:Rn,shift:Jn},{key:"Ctrl-d",run:wt},{key:"Ctrl-h",run:ve},{key:"Ctrl-k",run:er},{key:"Ctrl-Alt-h",run:Rt},{key:"Ctrl-o",run:rr},{key:"Ctrl-t",run:or},{key:"Ctrl-v",run:ke}],pr=[{key:"ArrowLeft",run:ct,shift:kt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:bn,shift:In,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Tn,shift:Un,preventDefault:!0},{key:"ArrowRight",run:at,shift:vt,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Cn,shift:Pn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:wn,shift:zn,preventDefault:!0},{key:"ArrowUp",run:dt,shift:Mt,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ke,shift:Qe},{mac:"Ctrl-ArrowUp",run:Ue,shift:ze},{key:"ArrowDown",run:mt,shift:Bt,preventDefault:!0},{mac:"Cmd-ArrowDown",run:He,shift:je},{mac:"Ctrl-ArrowDown",run:ke,shift:Je},{key:"PageUp",run:Ue,shift:ze},{key:"PageDown",run:ke,shift:Je},{key:"Home",run:Dn,shift:Gn,preventDefault:!0},{key:"Mod-Home",run:Ke,shift:Qe},{key:"End",run:Bn,shift:Vn,preventDefault:!0},{key:"Mod-End",run:He,shift:je},{key:"Enter",run:Xe,shift:Xe},{key:"Mod-a",run:Kn},{key:"Backspace",run:ve,shift:ve,preventDefault:!0},{key:"Delete",run:wt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Rt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Zn,preventDefault:!0},{mac:"Mod-Backspace",run:tr,preventDefault:!0},{mac:"Mod-Delete",run:nr,preventDefault:!0}].concat(mr.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),Nt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:An,shift:Nn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ln,shift:qn},{key:"Alt-ArrowUp",run:lr},{key:"Shift-Alt-ArrowUp",run:sr},{key:"Alt-ArrowDown",run:ir},{key:"Shift-Alt-ArrowDown",run:cr},{key:"Mod-Alt-ArrowUp",run:jn},{key:"Mod-Alt-ArrowDown",run:Xn},{key:"Escape",run:Yn},{key:"Mod-Enter",run:hr},{key:"Alt-l",mac:"Ctrl-l",run:Hn},{key:"Mod-i",run:Qn,preventDefault:!0},{key:"Mod-[",run:Pt},{key:"Mod-]",run:ne},{key:"Mod-Alt-\\",run:fr},{key:"Shift-Mod-k",run:ar},{key:"Shift-Mod-\\",run:Fn},{key:"Mod-/",run:nn},{key:"Alt-A",mac:"Ctrl-A",run:on},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dr}].concat(pr),qt={key:"Tab",run:ne,shift:Pt};var Vt=typeof String.prototype.normalize=="function"?(e)=>e.normalize("NFKD"):(e)=>e;class R{constructor(e,t,n=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?(c)=>o(Vt(c)):Vt,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ii(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Rr(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ri(e);let r=this.normalize(t);if(r.length)for(let o=0,s=n,c=!0;;o++){let a=r.charCodeAt(o),u=this.match(a,s,c,this.bufferPos+this.bufferStart,o==r.length-1);if(u)return this.value=u,this;if(o==r.length-1)break;if(c&&o<t.length&&t.charCodeAt(o)==a)s++;else c=!1}}}match(e,t,n,r,o){let s=null;for(let c=0;c<this.matches.length;){let a=this.matches[c],u=!1;if(this.query.charCodeAt(a.index)==e)if(a.index==this.query.length-1)s={from:a.from,to:r,precise:o&&a.precise};else a.index++,u=!0;if(u)c++;else this.matches.splice(c,1)}if(this.query.charCodeAt(0)==e)if(this.query.length==1)s={from:t,to:r,precise:n&&o};else this.matches.push({from:t,index:1,precise:n});if(s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart))s=null;return s}}if(typeof Symbol<"u")R.prototype[Symbol.iterator]=function(){return this};var zt={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Ee="gm"+(/x/.unicode==null?"":"u");class Te{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=zt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new We(e,t,n,r,o);this.re=new RegExp(t,Ee+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.iter=e.iter();let s=e.lineAt(r);this.curLineStart=s.from,this.matchPos=ce(e,r),this.getLine(this.curLineStart)}getLine(e){if(this.iter.next(e),this.iter.lineBreak)this.curLine="";else{if(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){if(this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=ce(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length)this.nextLine();if((n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}var Le=new WeakMap;class N{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Le.get(e);if(!r||r.from>=n||r.to<=t){let c=new N(t,e.sliceString(t,n));return Le.set(e,c),c}if(r.from==t&&r.to==n)return r;let{text:o,from:s}=r;if(s>t)o=e.sliceString(t,s)+o,s=t;if(r.to<n)o+=e.sliceString(r.to,n);return Le.set(e,new N(s,o)),new N(t,o.slice(t-s,n-s))}}class We{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=zt,this.matchPos=ce(e,r),this.re=new RegExp(t,Ee+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.flat=N.get(e,r,this.chunkEnd(r+5000))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e)this.re.lastIndex=e+1,t=this.re.exec(this.flat.text);if(t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this.matchPos=ce(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=N.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")Te.prototype[Symbol.iterator]=We.prototype[Symbol.iterator]=function(){return this};function gr(e){try{return new RegExp(e,Ee),!0}catch(t){return!1}}function ce(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;while(t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344)t++;return t}var yr=(e)=>{let t=Nr(e,"cm-goto-line");if(t){let c=t.dom.querySelector("input[type=text]");if(c)c.select();return!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:o,result:s}=$r(e,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return s.then((c)=>{let a=c&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(c.elements.line.value);if(!a){e.dispatch({effects:o});return}let u=n.doc.lineAt(n.selection.main.head),[,d,f,m,p]=a,D=m?+m.slice(1):0,M=f?+f:u.number;if(f&&p){let ye=M/100;if(d)ye=ye*(d=="-"?-1:1)+u.number/n.doc.lines;M=Math.round(n.doc.lines*ye)}else if(f&&d)M=M*(d=="-"?-1:1)+u.number;let Ve=n.doc.line(Math.max(1,Math.min(n.doc.lines,M))),Ge=l.cursor(Ve.from+Math.max(0,Math.min(D,Ve.length)));e.dispatch({effects:[o,g.scrollIntoView(Ge.from,{y:"center"})],selection:Ge})}),!0},xr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_t=v.define({combine(e){return ht(e,xr,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jt(e){let t=[Mr,br];if(e)t.push(_t.of(e));return t}var Sr=E.mark({class:"cm-selectionMatch"}),kr=E.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Gt(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=se.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=se.Word)}function vr(e,t,n,r){return e(t.sliceDoc(n,n+1))==se.Word&&e(t.sliceDoc(r-1,r))==se.Word}var br=_e.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){if(e.selectionSet||e.docChanged||e.viewportChanged)this.decorations=this.getDeco(e.view)}getDeco(e){let t=e.state.facet(_t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let o=r.main,s,c=null;if(o.empty){if(!t.highlightWordAroundCursor)return E.none;let u=n.wordAt(o.head);if(!u)return E.none;c=n.charCategorizer(o.head),s=n.sliceDoc(u.from,u.to)}else{let u=o.to-o.from;if(u<t.minSelectionLength||u>200)return E.none;if(t.wholeWords){if(s=n.sliceDoc(o.from,o.to),c=n.charCategorizer(o.head),!(Gt(c,n,o.from,o.to)&&vr(c,n,o.from,o.to)))return E.none}else if(s=n.sliceDoc(o.from,o.to),!s)return E.none}let a=[];for(let u of e.visibleRanges){let d=new R(n.doc,s,u.from,u.to);while(!d.next().done){let{from:f,to:m}=d.value;if(!c||Gt(c,n,f,m)){if(o.empty&&f<=o.from&&m>=o.to)a.push(kr.range(f,m));else if(f>=o.to||m<=o.from)a.push(Sr.range(f,m));if(a.length>t.maxMatches)return E.none}}}return E.set(a)}},{decorations:(e)=>e.decorations}),Mr=g.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Br=({state:e,dispatch:t})=>{let{selection:n}=e,r=l.create(n.ranges.map((o)=>e.wordAt(o.head)||l.cursor(o.head)),n.mainIndex);if(r.eq(n))return!1;return t(e.update({selection:r})),!0};function Tr(e,t){let{main:n,ranges:r}=e.selection,o=e.wordAt(n.head),s=o&&o.from==n.from&&o.to==n.to;for(let c=!1,a=new R(e.doc,t,r[r.length-1].to);;)if(a.next(),a.done){if(c)return null;a=new R(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),c=!0}else{if(c&&r.some((u)=>u.from==a.value.from))continue;if(s){let u=e.wordAt(a.value.from);if(!u||u.from!=a.value.from||u.to!=a.value.to)continue}return a.value}}var wr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((s)=>s.from===s.to))return Br({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((s)=>e.sliceDoc(s.from,s.to)!=r))return!1;let o=Tr(e,r);if(!o)return!1;return t(e.update({selection:e.selection.addRange(l.range(o.from,o.to),!1),effects:g.scrollIntoView(o.to)})),!0},O=v.define({combine(e){return ht(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:(t)=>new Zt(t),scrollToMatch:(t)=>g.scrollIntoView(t)})}});function $t(e){return e?[O.of(e),De]:De}class Re{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||gr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
2
|
-
`:n=="r"?"\r":n=="t"?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ht(this):new Kt(this)}getCursor(e,t=0,n){let r=e.doc?e:z.create({doc:e});if(n==null)n=r.doc.length;return this.regexp?P(this,r,t,n):I(this,r,t,n)}}class Oe{constructor(e){this.spec=e}}function Wr(e,t,n){return(r,o,s,c)=>{if(n&&!n(r,o,s,c))return!1;let a=r>=c&&o<=c+s.length?s.slice(r-c,o-c):t.doc.sliceString(r,o);return e(a,t,r,o)}}function I(e,t,n,r){let o;if(e.wholeWord)o=Or(t.doc,t.charCategorizer(t.selection.main.head));if(e.test)o=Wr(e.test,t,o);return new R(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:(s)=>s.toLowerCase(),o)}function Or(e,t){return(n,r,o,s)=>{if(s>n||s+o.length<r)s=Math.max(0,n-2),o=e.sliceString(s,Math.min(e.length,r+2));return(t(ae(o,n-s))!=se.Word||t(ue(o,n-s))!=se.Word)&&(t(ue(o,r-s))!=se.Word||t(ae(o,r-s))!=se.Word)}}class Kt extends Oe{constructor(e){super(e)}nextMatch(e,t,n){let r=I(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,t+this.spec.unquoted.length);r=I(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let o=Math.max(t,r-1e4-this.spec.unquoted.length),s=I(this.spec,e,o,r),c=null;while(!s.nextOverlapping().done)c=s.value;if(c)return c;if(o==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);if(!r)r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length);return r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=I(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=I(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}function Fr(e,t,n){return(r,o,s)=>(!n||n(r,o,s))&&e(s[0],t,r,o)}function P(e,t,n,r){let o;if(e.wholeWord)o=Ir(t.charCategorizer(t.selection.main.head));if(e.test)o=Fr(e.test,t,o);return new Te(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,r)}function ae(e,t){return e.slice(fe(e,t,!1),t)}function ue(e,t){return e.slice(t,fe(e,t))}function Ir(e){return(t,n,r)=>!r[0].length||(e(ae(r.input,r.index))!=se.Word||e(ue(r.input,r.index))!=se.Word)&&(e(ue(r.input,r.index+r[0].length))!=se.Word||e(ae(r.input,r.index+r[0].length))!=se.Word)}class Ht extends Oe{nextMatch(e,t,n){let r=P(this.spec,e,n,e.doc.length).next();if(r.done)r=P(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let o=Math.max(t,n-r*1e4),s=P(this.spec,e,o,n),c=null;while(!s.next().done)c=s.value;if(c&&(o==t||c.from>o+10))return c;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return t})}matchAll(e,t){let n=P(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=P(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}var J=q.define(),Ie=q.define(),W=we.define({create(e){return new ie(Be(e).create(),null)},update(e,t){for(let n of t.effects)if(n.is(J))e=new ie(n.value.create(),e.panel);else if(n.is(Ie))e=new ie(e.query,n.value?Pe:null);return e},provide:(e)=>En.from(e,(t)=>t.panel)});class ie{constructor(e,t){this.query=e,this.panel=t}}var Pr=E.mark({class:"cm-searchMatch"}),qr=E.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Vr=_e.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(W))}update(e){let t=e.state.field(W);if(t!=e.startState.field(W)||e.docChanged||e.selectionSet||e.viewportChanged)this.decorations=this.highlight(t)}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new pt;for(let o=0,s=n.visibleRanges,c=s.length;o<c;o++){let{from:a,to:u}=s[o];while(o<c-1&&u>s[o+1].from-500)u=s[++o].to;e.highlight(n.state,a,u,(d,f)=>{let m=n.state.selection.ranges.some((p)=>p.from==d&&p.to==f);r.add(d,f,m?qr:Pr)})}return r.finish()}},{decorations:(e)=>e.decorations});function K(e){return(t)=>{let n=t.state.field(W,!1);return n&&n.query.spec.valid?e(t,n):ge(t)}}var de=K((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let o=l.single(r.from,r.to),s=e.state.facet(O);return e.dispatch({selection:o,effects:[qe(e,r),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),jt(e),!0}),me=K((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,o=t.prevMatch(n,r,r);if(!o)return!1;let s=l.single(o.from,o.to),c=e.state.facet(O);return e.dispatch({selection:s,effects:[qe(e,o),c.scrollToMatch(s.main,e)],userEvent:"select.search"}),jt(e),!0}),Gr=K((e,{query:t})=>{let n=t.matchAll(e.state,1000);if(!n||!n.length)return!1;return e.dispatch({selection:l.create(n.map((r)=>l.range(r.from,r.to))),userEvent:"select.search.matches"}),!0}),zr=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,s=[],c=0;for(let a=new R(e.doc,e.sliceDoc(r,o));!a.next().done;){if(s.length>1000)return!1;if(a.value.from==r)c=s.length;s.push(l.range(a.value.from,a.value.to))}return t(e.update({selection:l.create(s,c),userEvent:"select.search.matches"})),!0},Ut=K((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let c=s,a=[],u,d,f=[];if(!c.precise)c=t.nextMatch(n,c.from,c.to);else if(c.from==r&&c.to==o)d=n.toText(t.getReplacement(c)),a.push({from:c.from,to:c.to,insert:d}),c=t.nextMatch(n,c.from,c.to),f.push(g.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."));let m=e.state.changes(a);if(c)u=l.single(c.from,c.to).map(m),f.push(qe(e,c)),f.push(n.facet(O).scrollToMatch(u.main,e));return e.dispatch({changes:m,selection:u,effects:f,userEvent:"input.replace"}),!0}),_r=K((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let o of t.matchAll(e.state,1e9)){let{from:s,to:c,precise:a}=o;if(a)n.push({from:s,to:c,insert:t.getReplacement(o)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:g.announce.of(r),userEvent:"input.replace.all"}),!0});function Pe(e){return e.state.facet(O).createPanel(e)}function Be(e,t){var n,r,o,s,c;let a=e.selection.main,u=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!u)return t;let d=e.facet(O);return new Re({search:((n=t===null||t===void 0?void 0:t.literal)!==null&&n!==void 0?n:d.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=t===null||t===void 0?void 0:t.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(o=t===null||t===void 0?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(s=t===null||t===void 0?void 0:t.regexp)!==null&&s!==void 0?s:d.regexp,wholeWord:(c=t===null||t===void 0?void 0:t.wholeWord)!==null&&c!==void 0?c:d.wholeWord})}function Qt(e){let t=si(e,Pe);return t&&t.dom.querySelector("[main-field]")}function jt(e){let t=Qt(e);if(t&&t==e.root.activeElement)t.select()}var ge=(e)=>{let t=e.state.field(W,!1);if(t&&t.panel){let n=Qt(e);if(n&&n!=e.root.activeElement){let r=Be(e.state,t.query.spec);if(r.valid)e.dispatch({effects:J.of(r)});n.focus(),n.select()}}else e.dispatch({effects:[Ie.of(!0),t?J.of(Be(e.state,t.query.spec)):q.appendConfig.of(De)]});return!0},Xt=(e)=>{let t=e.state.field(W,!1);if(!t||!t.panel)return!1;let n=si(e,Pe);if(n&&n.dom.contains(e.root.activeElement))e.focus();return e.dispatch({effects:Ie.of(!1)}),!0},Yt=[{key:"Mod-f",run:ge,scope:"editor search-panel"},{key:"F3",run:de,shift:me,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:de,shift:me,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Xt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:zr},{key:"Mod-Alt-g",run:yr},{key:"Mod-d",run:wr,preventDefault:!0}];class Zt{constructor(e){this.view=e;let t=this.query=e.state.field(W).query.spec;this.commit=this.commit.bind(this),this.searchField=pe("input",{value:t.search,placeholder:S(e,"Find"),"aria-label":S(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=pe("input",{value:t.replace,placeholder:S(e,"Replace"),"aria-label":S(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=pe("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=pe("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=pe("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,o,s){return pe("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=pe("div",{onkeydown:(r)=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>de(e),[S(e,"next")]),n("prev",()=>me(e),[S(e,"previous")]),n("select",()=>Gr(e),[S(e,"all")]),pe("label",null,[this.caseField,S(e,"match case")]),pe("label",null,[this.reField,S(e,"regexp")]),pe("label",null,[this.wordField,S(e,"by word")]),...e.state.readOnly?[]:[pe("br"),this.replaceField,n("replace",()=>Ut(e),[S(e,"replace")]),n("replaceAll",()=>_r(e),[S(e,"replace all")])],pe("button",{name:"close",onclick:()=>Xt(e),"aria-label":S(e,"close"),type:"button"},["×"])])}commit(){let e=new Re({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query))this.query=e,this.view.dispatch({effects:J.of(e)})}keydown(e){if(Er(this.view,e,"search-panel"))e.preventDefault();else if(e.keyCode==13&&e.target==this.searchField)e.preventDefault(),(e.shiftKey?me:de)(this.view);else if(e.keyCode==13&&e.target==this.replaceField)e.preventDefault(),Ut(this.view)}update(e){for(let t of e.transactions)for(let n of t.effects)if(n.is(J)&&!n.value.eq(this.query))this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(O).top}}function S(e,t){return e.state.phrase(t)}var oe=30,le=/[\s\.,:;?!]/;function qe(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-oe),c=Math.min(o,n+oe),a=e.state.sliceDoc(s,c);if(s!=r.from){for(let u=0;u<oe;u++)if(!le.test(a[u+1])&&le.test(a[u])){a=a.slice(u);break}}if(c!=o){for(let u=a.length-1;u>a.length-oe;u--)if(!le.test(a[u-1])&&le.test(a[u])){a=a.slice(0,u);break}}return g.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}var Jr=g.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),De=[W,Ae.low(Vr),Jr];var Kr=g.theme({"&":{color:"var(--code-fg)",backgroundColor:"var(--code-bg)",height:"100%",fontSize:"var(--code-size, 13px)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-mono)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--code-fg)",padding:"0.5rem 0"},".cm-line":{padding:"0 0.75rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--code-fg)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--code-selection)"},".cm-activeLine":{backgroundColor:"var(--code-active-line)"},".cm-gutters":{backgroundColor:"var(--code-gutter-bg)",color:"var(--code-gutter)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--code-active-line)",color:"var(--code-fg)"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 0.5rem",minWidth:"2.25rem"},".cm-matchingBracket, .cm-nonmatchingBracket":{backgroundColor:"var(--code-selection)",outline:"1px solid var(--border-strong)"},".cm-searchMatch":{backgroundColor:"var(--warn-soft)",outline:"1px solid var(--warn)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)",outline:"1px solid var(--accent)"},".cm-panels":{backgroundColor:"var(--surface-2)",color:"var(--text)",borderColor:"var(--border)",fontFamily:"var(--font)"},".cm-panels-top":{borderBottom:"1px solid var(--border)"},".cm-panel.cm-search":{padding:"0.5rem 2rem 0.5rem 0.5rem"},".cm-panel.cm-search input, .cm-panel.cm-search button, .cm-panel.cm-search label":{fontSize:"0.875rem"},".cm-panel.cm-search input[type=text]":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--control-border)",borderRadius:"var(--radius-sm)",padding:"0.25rem 0.5rem"},".cm-panel.cm-search button":{backgroundColor:"var(--surface-3)",color:"var(--text)",border:"1px solid var(--border-strong)",borderRadius:"var(--radius-sm)",backgroundImage:"none",padding:"0.25rem 0.625rem"},".cm-panel.cm-search [name=close]":{color:"var(--muted)"}}),Hr=pn.define([{tag:[i.keyword,i.modifier,i.operatorKeyword,i.controlKeyword],color:"var(--code-keyword)"},{tag:[i.string,i.regexp,i.special(i.string),i.inserted],color:"var(--code-string)"},{tag:[i.number,i.bool,i.null,i.atom,i.literal],color:"var(--code-number)"},{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:"var(--code-comment)",fontStyle:"italic"},{tag:[i.typeName,i.className,i.namespace,i.tagName,i.standard(i.tagName)],color:"var(--code-type)"},{tag:[i.function(i.variableName),i.function(i.propertyName),i.definition(i.variableName),i.labelName],color:"var(--code-function)"},{tag:[i.meta,i.processingInstruction,i.annotation,i.attributeName,i.propertyName,i.heading],color:"var(--code-meta)"},{tag:i.heading,fontWeight:"bold"},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:i.link,color:"var(--code-function)",textDecoration:"underline"},{tag:i.url,color:"var(--code-function)"},{tag:i.invalid,color:"var(--danger)"},{tag:i.deleted,color:"var(--danger)"}]),en=[Kr,Dr(Hr)];var Qr={typescript:()=>(h("etjjvr2g"),import("./chunk-lang-typescript-etjjvr2g.js")),javascript:()=>(h("fmhhgzwd"),import("./chunk-lang-javascript-fmhhgzwd.js")),json:()=>(h("7gd89mvs"),import("./chunk-lang-json-7gd89mvs.js")),markdown:()=>(h("b6qbe8bt"),import("./chunk-lang-markdown-b6qbe8bt.js")),css:()=>(h("88v3hp3d"),import("./chunk-lang-css-88v3hp3d.js")),html:()=>(h("07d47es4"),import("./chunk-lang-html-07d47es4.js")),python:()=>(h("3v56y31b"),import("./chunk-lang-python-3v56y31b.js")),yaml:()=>(h("fz5qpb3r"),import("./chunk-lang-yaml-fz5qpb3r.js")),go:()=>(h("wjwgay4v"),import("./chunk-lang-go-wjwgay4v.js")),rust:()=>(h("kh0z74d1"),import("./chunk-lang-rust-kh0z74d1.js")),sql:()=>(h("yw6bf3t7"),import("./chunk-lang-sql-yw6bf3t7.js")),xml:()=>(h("ev1mndd4"),import("./chunk-lang-xml-ev1mndd4.js")),shell:()=>(h("9zv0zvbx"),import("./chunk-lang-shell-9zv0zvbx.js")),toml:()=>(h("tg1r96nq"),import("./chunk-lang-toml-tg1r96nq.js")),dockerfile:()=>(h("k728ewsf"),import("./chunk-lang-dockerfile-k728ewsf.js"))};async function tn(e){if(e==="plain")return;try{return(await Qr[e]()).language()}catch(t){console.warn("a language for the editor failed to load",t);return}}function jr(e){if(typeof e.attachShadow!=="function"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in Document.prototype))return{parent:e,root:void 0};let t=e.shadowRoot??e.attachShadow({mode:"open"}),n=new CSSStyleSheet;return n.replaceSync(":host{display:flex;flex-direction:column;min-height:0}.cm-editor{flex:1;min-height:0}"),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],{parent:t,root:t}}async function vo(e){let t=new At,n=new At,r=new At,o=await tn(e.language),s=(m)=>[z.readOnly.of(!m),g.editable.of(m)],c={editable:e.editable,wrap:e.wrap,language:o??[]},a,u=(m)=>[Lr(),Ar(),Xr(),tt(),Cr(),Ur(),Jt(),$t({top:!0}),Fe.of(" "),z.phrases.of(e.phrases),en,xt.of([{key:"Mod-s",preventDefault:!0,run:()=>(e.onSave(),!0)},{key:"Escape",run:()=>(e.onEscape(),!0)},qt,...Yt,...ot,...Nt]),z.lineSeparator.of(m),t.of(s(c.editable)),n.of(c.wrap?g.lineWrapping:[]),r.of(c.language),g.updateListener.of((p)=>{if(p.docChanged)e.onChange()})],d=jr(e.parent),f=new g({parent:d.parent,root:d.root,state:z.create({doc:e.text,extensions:u(e.eol)})});return a=f.state.doc,{text:()=>f.state.doc.sliceString(0,void 0,f.state.lineBreak),dirty:()=>a===void 0||!f.state.doc.eq(a),snapshot:()=>f.state.doc,markSaved:(m)=>{a=m??f.state.doc},replace:(m,p)=>{let D=f.scrollDOM.scrollTop;f.setState(z.create({doc:m,extensions:u(p)})),a=f.state.doc,f.scrollDOM.scrollTop=D},setEditable:(m)=>{c.editable=m,f.dispatch({effects:t.reconfigure(s(m))})},setWrap:(m)=>{c.wrap=m,f.dispatch({effects:n.reconfigure(m?g.lineWrapping:[])})},setLanguage:async(m)=>{c.language=await tn(m)??[],f.dispatch({effects:r.reconfigure(c.language)})},undo:()=>{X(f)},redo:()=>{G(f)},find:()=>{ge(f)},tab:()=>{ne(f)},focus:()=>f.focus(),scrollTop:()=>f.scrollDOM.scrollTop,scrollTo:(m)=>{f.scrollDOM.scrollTop=m},destroy:()=>f.destroy()}}export{vo as createEditor};
|
|
1
|
+
import{V,pe,bi,Hr,vi,ut,me,l,x,ke,Le,zt,Xe,B,oe,se,D,bt,vt,ze,ge,E,ee,Te,b,Tt,jr,Kr,Jr,xi,Vn,eo,to,no,io,T,i,C,je,Ut,Fn,Ki,xn,Sn,so,ao,ft}from"./chunk-index-6c8mewwy.js";import{h}from"./chunk-index-kankja6p.js";var nn=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Me(e.state,n.from);return r.line?rn(e):r.block?ln(e):!1};function Ce(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);if(!o)return!1;return r(n.update(o)),!0}}var rn=Ce(an,0);var on=Ce(Ye,0);var ln=Ce((e,t)=>Ye(e,t,cn(t)),0);function Me(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var U=50;function sn(e,{open:t,close:n},r,o){let s=e.sliceDoc(r-U,r),c=e.sliceDoc(o,o+U),a=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(c)[0].length,d=s.length-a;if(s.slice(d-t.length,d)==t&&c.slice(u,u+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:o+u,margin:u&&1}};let f,m;if(o-r<=2*U)f=m=e.sliceDoc(r,o);else f=e.sliceDoc(r,r+U),m=e.sliceDoc(o-U,o);let p=/^\s*/.exec(f)[0].length,W=/\s*$/.exec(m)[0].length,M=m.length-W-n.length;if(f.slice(p,p+t.length)==t&&m.slice(M,M+n.length)==n)return{open:{pos:r+p+t.length,margin:/\s/.test(f.charAt(p+t.length))?1:0},close:{pos:o-W-n.length,margin:/\s/.test(m.charAt(M-1))?1:0}};return null}function cn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);if(o.from>r.from&&o.from==n.to)o=n.to==r.to+1?r:e.doc.lineAt(n.to-1);let s=t.length-1;if(s>=0&&t[s].to>r.from)t[s].to=o.to;else t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function Ye(e,t,n=t.selection.ranges){let r=n.map((s)=>Me(t,s.from).block);if(!r.every((s)=>s))return null;let o=n.map((s,c)=>sn(t,r[c],s.from,s.to));if(e!=2&&!o.every((s)=>s))return{changes:t.changes(n.map((s,c)=>{if(o[c])return[];return[{from:s.from,insert:r[c].open+" "},{from:s.to,insert:" "+r[c].close}]}))};else if(e!=1&&o.some((s)=>s)){let s=[];for(let c=0,a;c<o.length;c++)if(a=o[c]){let u=r[c],{open:d,close:f}=a;s.push({from:d.pos-u.open.length,to:d.pos+d.margin},{from:f.pos-f.margin,to:f.pos+u.close.length})}return{changes:s}}return null}function an(e,t,n=t.selection.ranges){let r=[],o=-1;e:for(let{from:s,to:c}of n){let a=r.length,u=1e9,d;for(let f=s;f<=c;){let m=t.doc.lineAt(f);if(d==null){if(d=Me(t,m.from).line,!d)continue e}if(m.from>o&&(s==c||c>m.from)){o=m.from;let p=/^\s*/.exec(m.text)[0].length,W=p==m.length,M=m.text.slice(p,p+d.length)==d?p:-1;if(p<m.text.length&&p<u)u=p;r.push({line:m,comment:M,token:d,indent:p,empty:W,single:!1})}f=m.to+1}if(u<1e9){for(let f=a;f<r.length;f++)if(r[f].indent<r[f].line.text.length)r[f].indent=u}if(r.length==a+1)r[a].single=!0}if(e!=2&&r.some((s)=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:u,indent:d,empty:f,single:m}of r)if(m||!f)s.push({from:a.from+d,insert:u+" "});let c=t.changes(s);return{changes:c,selection:t.selection.map(c,1)}}else if(e!=1&&r.some((s)=>s.comment>=0)){let s=[];for(let{line:c,comment:a,token:u}of r)if(a>=0){let d=c.from+a,f=d+u.length;if(c.text[f-c.from]==" ")f++;s.push({from:d,to:f})}return{changes:s}}return null}var Se=Xe.define(),un=Xe.define(),hn=x.define(),Ze=x.define({combine(e){return bt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,o)=>t(r,o)||n(r,o)})}}),et=ke.define({create(){return w.empty},update(e,t){let n=t.state.facet(Ze),r=t.annotation(Se);if(r){let u=y.fromTransaction(t,r.selection),d=r.side,f=d==0?e.undone:e.done;if(u)f=Q(f,f.length,n.minDepth,u);else f=rt(f,t.startState.selection);return new w(d==0?r.rest:f,d==0?f:r.rest)}let o=t.annotation(un);if(o=="full"||o=="before")e=e.isolate();if(t.annotation(oe.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let s=y.fromTransaction(t),c=t.annotation(oe.time),a=t.annotation(oe.userEvent);if(s)e=e.addChanges(s,c,a,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,c,a,n.newGroupDelay);if(o=="full"||o=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new w(e.done.map(y.fromJSON),e.undone.map(y.fromJSON))}});function tt(e={}){return[et,Ze.of(e),b.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?X:t.inputType=="historyRedo"?z:null;if(!r)return!1;return t.preventDefault(),r(n)}})]}function j(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(et,!1);if(!o)return!1;let s=o.pop(e,n,t);if(!s)return!1;return r(s),!0}}var X=j(0,!1),z=j(1,!1),fn=j(0,!0),dn=j(1,!0);class y{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new y(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((r)=>r.toJSON())}}static fromJSON(e){return new y(e.changes&&me.fromJSON(e.changes),[],e.mapped&&ut.fromJSON(e.mapped),e.startSelection&&l.fromJSON(e.startSelection),e.selectionsAfter.map(l.fromJSON))}static fromTransaction(e,t){let n=k;for(let r of e.startState.facet(hn)){let o=r(e);if(o.length)n=n.concat(o)}if(!n.length&&e.changes.empty)return null;return new y(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,k)}static selection(e){return new y(void 0,k,void 0,void 0,e)}}function Q(e,t,n,r){let o=t+1>n+20?t-n-1:0,s=e.slice(o,t);return s.push(r),s}function mn(e,t){let n=[],r=!1;return e.iterChangedRanges((o,s)=>n.push(o,s)),t.iterChangedRanges((o,s,c,a)=>{for(let u=0;u<n.length;){let d=n[u++],f=n[u++];if(a>=d&&c<=f)r=!0}}),r}function pn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function nt(e,t){return!e.length?t:!t.length?e:e.concat(t)}var k=[],gn=200;function rt(e,t){if(!e.length)return[y.selection([t])];else{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-gn));if(r.length&&r[r.length-1].eq(t))return e;return r.push(t),Q(e,e.length-1,1e9,n.setSelAfter(r))}}function yn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function xe(e,t){if(!e.length)return e;let n=e.length,r=k;while(n){let o=kn(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let s=e.slice(0,n);return s[n-1]=o,s}else t=o.mapped,n--,r=o.selectionsAfter}return r.length?[y.selection(r)]:k}function kn(e,t,n){let r=nt(e.selectionsAfter.length?e.selectionsAfter.map((a)=>a.map(t)):k,n);if(!e.changes)return y.selection(r);let o=e.changes.map(t),s=t.mapDesc(e.changes,!0),c=e.mapped?e.mapped.composeDesc(s):s;return new y(o,B.mapEffects(e.effects,t),c,e.startSelection.map(s),r)}var vn=/^(input\.type|delete)($|\.)/;class w{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new w(this.done,this.undone):this}addChanges(e,t,n,r,o){let s=this.done,c=s[s.length-1];if(c&&c.changes&&!c.changes.empty&&e.changes&&(!n||vn.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,mn(c.changes,e.changes))||n=="input.type.compose"))s=Q(s,s.length-1,r.minDepth,new y(e.changes.compose(c.changes),nt(B.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,k));else s=Q(s,s.length,r.minDepth,e);return new w(s,k,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:k;if(o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&pn(o[o.length-1],e))return this;return new w(rt(this.done,e),this.undone,t,n)}addMapping(e){return new w(xe(this.done,e),xe(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Se.of({side:e,rest:yn(r),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!o.changes)return null;else{let c=r.length==1?k:r.slice(0,r.length-1);if(o.mapped)c=xe(c,o.mapped);return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Se.of({side:e,rest:c,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}w.empty=new w(k,k);var ot=[{key:"Mod-z",run:X,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:z,preventDefault:!0},{linux:"Ctrl-Shift-z",run:z,preventDefault:!0},{key:"Mod-u",run:fn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:dn,preventDefault:!0}];function P(e,t){return l.create(e.ranges.map(t),e.mainIndex)}function A(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function L({state:e,dispatch:t},n){let r=P(e.selection,n);if(r.eq(e.selection,!0))return!1;return t(A(e,r)),!0}function Y(e,t){return l.cursor(t?e.to:e.from)}function lt(e,t){return L(e,(n)=>n.empty?e.moveByChar(n,t):Y(n,t))}function g(e){return e.textDirectionAt(e.state.selection.main.head)==ee.LTR}var it=(e)=>lt(e,!g(e)),st=(e)=>lt(e,g(e));function ct(e,t){return L(e,(n)=>n.empty?e.moveByGroup(n,t):Y(n,t))}var bn=(e)=>ct(e,!g(e)),Cn=(e)=>ct(e,g(e));var Qr=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Mn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Z(e,t,n){let r=C(e).resolveInner(t.head),o=n?T.closedBy:T.openedBy;for(let u=t.head;;){let d=n?r.childAfter(u):r.childBefore(u);if(!d)break;if(Mn(e,d,o))r=d;else u=n?d.to:d.from}let s=r.type.prop(o),c,a;if(s&&(c=n?ft(e,r.from,1):ft(e,r.to,-1))&&c.matched)a=n?c.end.to:c.end.from;else a=n?r.to:r.from;return l.cursor(a,n?-1:1)}var An=(e)=>L(e,(t)=>Z(e.state,t,!g(e))),Ln=(e)=>L(e,(t)=>Z(e.state,t,g(e)));function at(e,t){return L(e,(n)=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}var ht=(e)=>at(e,!1),dt=(e)=>at(e,!0);function mt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,o;if(t){for(let s of e.state.facet(b.scrollMargins)){let c=s(e);if(c===null||c===void 0?void 0:c.top)n=Math.max(c===null||c===void 0?void 0:c.top,n);if(c===null||c===void 0?void 0:c.bottom)r=Math.max(c===null||c===void 0?void 0:c.bottom,r)}o=e.scrollDOM.clientHeight-n-r}else o=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,o-5)}}function pt(e,t){let n=mt(e),{state:r}=e,o=P(r.selection,(c)=>c.empty?e.moveVertically(c,t,n.height):Y(c,t));if(o.eq(r.selection))return!1;let s;if(n.selfScroll){let c=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),u=a.top+n.marginTop,d=a.bottom-n.marginBottom;if(c&&c.top>u&&c.bottom<d)s=b.scrollIntoView(o.main.head,{y:"start",yMargin:c.top-u})}return e.dispatch(A(r,o),{effects:s}),!0}var Ge=(e)=>pt(e,!1),ve=(e)=>pt(e,!0);function R(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from))o=e.moveToLineBoundary(t,n,!1);if(!n&&o.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;if(s&&t.head!=r.from+s)o=l.cursor(r.from+s)}return o}var Bn=(e)=>L(e,(t)=>R(e,t,!0)),Dn=(e)=>L(e,(t)=>R(e,t,!1)),En=(e)=>L(e,(t)=>R(e,t,!g(e))),Tn=(e)=>L(e,(t)=>R(e,t,g(e))),wn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!1,!1)),Wn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!0,!1));function Rn(e,t,n){let r=!1,o=P(e.selection,(s)=>{let c=ft(e,s.head,-1)||ft(e,s.head,1)||s.head>0&&ft(e,s.head-1,1)||s.head<e.doc.length&&ft(e,s.head+1,-1);if(!c||!c.end)return s;r=!0;let a=c.start.from==s.head?c.end.to:c.end.from;return n?l.range(s.anchor,a):l.cursor(a)});if(!r)return!1;return t(A(e,o)),!0}var On=({state:e,dispatch:t})=>Rn(e,t,!1);function v(e,t,n){let r=P(e.state.selection,(o)=>{if(o.undirectional&&o.head>=o.anchor!=t)o=l.range(o.head,o.anchor);let s=n(o);return l.range(o.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});if(r.eq(e.state.selection))return!1;return e.dispatch(A(e.state,r)),!0}function gt(e,t){return v(e,t,(n)=>e.moveByChar(n,t))}var yt=(e)=>gt(e,!g(e)),xt=(e)=>gt(e,g(e));function St(e,t){return v(e,t,(n)=>e.moveByGroup(n,t))}var In=(e)=>St(e,!g(e)),Pn=(e)=>St(e,g(e));var Nn=(e)=>{let t=!g(e);return v(e,t,(n)=>Z(e.state,n,t))},qn=(e)=>{let t=g(e);return v(e,t,(n)=>Z(e.state,n,t))};function kt(e,t){return v(e,t,(n)=>e.moveVertically(n,t))}var Ct=(e)=>kt(e,!1),Mt=(e)=>kt(e,!0);function At(e,t){return v(e,t,(n)=>e.moveVertically(n,t,mt(e).height))}var Ue=(e)=>At(e,!1),_e=(e)=>At(e,!0),Gn=(e)=>v(e,!0,(t)=>R(e,t,!0)),Un=(e)=>v(e,!1,(t)=>R(e,t,!1)),zn=(e)=>{let t=!g(e);return v(e,t,(n)=>R(e,n,t))},_n=(e)=>{let t=g(e);return v(e,t,(n)=>R(e,n,t))},Jn=(e)=>v(e,!1,(t)=>l.cursor(e.lineBlockAt(t.head).from)),$n=(e)=>v(e,!0,(t)=>l.cursor(e.lineBlockAt(t.head).to)),Je=({state:e,dispatch:t})=>(t(A(e,{anchor:0})),!0),$e=({state:e,dispatch:t})=>(t(A(e,{anchor:e.doc.length})),!0),Ke=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:0})),!0),He=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Kn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Hn=({state:e,dispatch:t})=>{let n=te(e).map(({from:r,to:o})=>l.undirectionalRange(r,Math.min(o+1,e.doc.length)));return t(e.update({selection:l.create(n),userEvent:"select"})),!0},Qn=({state:e,dispatch:t})=>{let n=P(e.selection,(r)=>{let o=C(e),s=o.resolveStack(r.from,1);if(r.empty){let c=o.resolveStack(r.from,-1);if(c.node.from>=s.node.from&&c.node.to<=s.node.to)s=c}for(let c=s;c;c=c.next){let{node:a}=c;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&c.next)return l.undirectionalRange(a.from,a.to)}return r});if(n.eq(e.selection))return!1;return t(A(e,n)),!0};function Lt(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let s of n.selection.ranges){let c=n.doc.lineAt(s.head);if(t?c.to<e.state.doc.length:c.from>0)for(let a=s;;){let u=e.moveVertically(a,t);if(u.head<c.from||u.head>c.to){if(!o.some((d)=>d.head==u.head))o.push(u);break}else if(u.head==a.head)break;else a=u}}if(o.length==r.ranges.length)return!1;return e.dispatch(A(n,l.create(o,o.length-1))),!0}var jn=(e)=>Lt(e,!1),Xn=(e)=>Lt(e,!0),Yn=({state:e,dispatch:t})=>{let n=e.selection,r=null;if(n.ranges.length>1)r=l.create([n.main]);else if(!n.main.empty)r=l.create([l.cursor(n.main.head)]);if(!r)return!1;return t(A(e,r)),!0};function _(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((s)=>{let{from:c,to:a}=s;if(c==a){let u=t(s);if(u<c)n="delete.backward",u=H(e,u,!1);else if(u>c)n="delete.forward",u=H(e,u,!0);c=Math.min(c,u),a=Math.max(a,u)}else c=H(e,c,!1),a=H(e,a,!0);return c==a?{range:s}:{changes:{from:c,to:a},range:l.cursor(c,c<s.head?-1:1)}});if(o.changes.empty)return!1;return e.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?b.announce.of(r.phrase("Selection deleted")):void 0})),!0}function H(e,t,n){if(e instanceof b)for(let r of e.state.facet(b.atomicRanges).map((o)=>o(e)))r.between(t,t,(o,s)=>{if(o<t&&s>t)t=n?s:o});return t}var Bt=(e,t,n)=>_(e,(r)=>{let o=r.from,{state:s}=e,c=s.doc.lineAt(o),a,u;if(n&&!t&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(a=c.text.slice(0,o-c.from))){if(a[a.length-1]=="\t")return o-1;let d=ze(a,s.tabSize),f=d%Ut(s)||Ut(s);for(let m=0;m<f&&a[a.length-1-m]==" ";m++)o--;u=o}else if(u=pe(c.text,o-c.from,t,t)+c.from,u==o&&c.number!=(t?s.doc.lines:1))u+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from)))u=pe(c.text,u-c.from,!1,!1)+c.from;return u}),be=(e)=>Bt(e,!1,!0);var Dt=(e)=>Bt(e,!0,!1),Et=(e,t)=>_(e,(n)=>{let r=n.head,{state:o}=e,s=o.doc.lineAt(r),c=o.charCategorizer(r);for(let a=null;;){if(r==(t?s.to:s.from)){if(r==n.head&&s.number!=(t?o.doc.lines:1))r+=t?1:-1;break}let u=pe(s.text,r-s.from,t)+s.from,d=s.text.slice(Math.min(r,u)-s.from,Math.max(r,u)-s.from),f=c(d);if(a!=null&&f!=a)break;if(d!=" "||r!=n.head)a=f;r=u}return r}),wt=(e)=>Et(e,!1),Zn=(e)=>Et(e,!0);var er=(e)=>_(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var tr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),nr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var rr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>({changes:{from:r.from,to:r.to,insert:V.of(["",""])},range:l.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},or=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let o=r.from,s=e.doc.lineAt(o),c=o==s.from?o-1:pe(s.text,o-s.from,!1)+s.from,a=o==s.to?o+1:pe(s.text,o-s.from,!0)+s.from;return{changes:{from:c,to:a,insert:e.doc.slice(o,a).append(e.doc.slice(c,o))},range:l.cursor(a)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function te(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from)s=e.doc.lineAt(r.to-1);if(n>=o.number){let c=t[t.length-1];c.to=s.to,c.ranges.push(r)}else t.push({from:o.from,to:s.to,ranges:[r]});n=s.number+1}return t}function Wt(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let s of te(e)){if(n?s.to==e.doc.length:s.from==0)continue;let c=e.doc.lineAt(n?s.to+1:s.from-1),a=c.length+1;if(n){r.push({from:s.to,to:c.to},{from:s.from,insert:c.text+e.lineBreak});for(let u of s.ranges)o.push(l.range(Math.min(e.doc.length,u.anchor+a),Math.min(e.doc.length,u.head+a)))}else{r.push({from:c.from,to:s.from},{from:s.to,insert:e.lineBreak+c.text});for(let u of s.ranges)o.push(l.range(u.anchor-a,u.head-a))}}if(!r.length)return!1;return t(e.update({changes:r,scrollIntoView:!0,selection:l.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0}var lr=({state:e,dispatch:t})=>Wt(e,t,!1),ir=({state:e,dispatch:t})=>Wt(e,t,!0);function Rt(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of te(e))if(n)r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak});else r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var sr=({state:e,dispatch:t})=>Rt(e,t,!1),cr=({state:e,dispatch:t})=>Rt(e,t,!0),ar=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(te(t).map(({from:o,to:s})=>{if(o>0)o--;else if(s<t.doc.length)s++;return{from:o,to:s}})),r=P(t.selection,(o)=>{let s=void 0;if(e.lineWrapping){let c=e.lineBlockAt(o.head),a=e.coordsAtPos(o.head,o.assoc||1);if(a)s=c.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2}return e.moveVertically(o,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ur(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=C(e).resolveInner(t),r=n.childBefore(t),o=n.childAfter(t),s;if(r&&o&&r.to<=t&&o.from>=t&&(s=r.type.prop(T.closedBy))&&s.indexOf(o.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(r.to,o.from)))return{from:r.to,to:o.from};return null}var Qe=Ot(!1),hr=Ot(!0);function Ot(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange((o)=>{let{from:s,to:c}=o,a=t.doc.lineAt(s),u=!e&&s==c&&ur(t,s);if(e)s=c=(c<=a.to?a:t.doc.lineAt(c)).to;let d=new xn(t,{simulateBreak:s,simulateDoubleBreak:!!u}),f=Ki(d,s);if(f==null)f=ze(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize);while(c<a.to&&/\s/.test(a.text[c-a.from]))c++;if(u)({from:s,to:c}=u);else if(s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s)))s=a.from;let m=["",Fn(t,f)];if(u)m.push(Fn(t,d.lineIndent(a.from,-1)));return{changes:{from:s,to:c,insert:V.of(m)},range:l.cursor(s+1+m[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ae(e,t){let n=-1;return e.changeByRange((r)=>{let o=[];for(let c=r.from;c<=r.to;){let a=e.doc.lineAt(c);if(a.number>n&&(r.empty||r.to>a.from))t(a,o,r),n=a.number;c=a.to+1}let s=e.changes(o);return{changes:o,range:l.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var fr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new xn(e,{overrideIndentation:(s)=>{let c=n[s];return c==null?-1:c}}),o=Ae(e,(s,c,a)=>{let u=Ki(r,s.from);if(u==null)return;if(!/\S/.test(s.text))u=0;let d=/^\s*/.exec(s.text)[0],f=Fn(e,u);if(d!=f||a.from<s.from+d.length)n[s.from]=u,c.push({from:s.from,to:s.from+d.length,insert:f})});if(!o.changes.empty)t(e.update(o,{userEvent:"indent"}));return!0},ne=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Ae(e,(n,r)=>{r.push({from:n.from,insert:e.facet(je)})}),{userEvent:"input.indent"})),!0},Ft=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Ae(e,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let s=ze(o,e.tabSize),c=0,a=Fn(e,Math.max(0,s-Ut(e)));while(c<o.length&&c<a.length&&o.charCodeAt(c)==a.charCodeAt(c))c++;r.push({from:n.from+c,to:n.from+o.length,insert:a.slice(c)})}),{userEvent:"delete.dedent"})),!0},dr=(e)=>(e.setTabFocusMode(),!0);var mr=[{key:"Ctrl-b",run:it,shift:yt,preventDefault:!0},{key:"Ctrl-f",run:st,shift:xt},{key:"Ctrl-p",run:ht,shift:Ct},{key:"Ctrl-n",run:dt,shift:Mt},{key:"Ctrl-a",run:wn,shift:Jn},{key:"Ctrl-e",run:Wn,shift:$n},{key:"Ctrl-d",run:Dt},{key:"Ctrl-h",run:be},{key:"Ctrl-k",run:er},{key:"Ctrl-Alt-h",run:wt},{key:"Ctrl-o",run:rr},{key:"Ctrl-t",run:or},{key:"Ctrl-v",run:ve}],pr=[{key:"ArrowLeft",run:it,shift:yt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:bn,shift:In,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:En,shift:zn,preventDefault:!0},{key:"ArrowRight",run:st,shift:xt,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Cn,shift:Pn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Tn,shift:_n,preventDefault:!0},{key:"ArrowUp",run:ht,shift:Ct,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Je,shift:Ke},{mac:"Ctrl-ArrowUp",run:Ge,shift:Ue},{key:"ArrowDown",run:dt,shift:Mt,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$e,shift:He},{mac:"Ctrl-ArrowDown",run:ve,shift:_e},{key:"PageUp",run:Ge,shift:Ue},{key:"PageDown",run:ve,shift:_e},{key:"Home",run:Dn,shift:Un,preventDefault:!0},{key:"Mod-Home",run:Je,shift:Ke},{key:"End",run:Bn,shift:Gn,preventDefault:!0},{key:"Mod-End",run:$e,shift:He},{key:"Enter",run:Qe,shift:Qe},{key:"Mod-a",run:Kn},{key:"Backspace",run:be,shift:be,preventDefault:!0},{key:"Delete",run:Dt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:wt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Zn,preventDefault:!0},{mac:"Mod-Backspace",run:tr,preventDefault:!0},{mac:"Mod-Delete",run:nr,preventDefault:!0}].concat(mr.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),It=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:An,shift:Nn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ln,shift:qn},{key:"Alt-ArrowUp",run:lr},{key:"Shift-Alt-ArrowUp",run:sr},{key:"Alt-ArrowDown",run:ir},{key:"Shift-Alt-ArrowDown",run:cr},{key:"Mod-Alt-ArrowUp",run:jn},{key:"Mod-Alt-ArrowDown",run:Xn},{key:"Escape",run:Yn},{key:"Mod-Enter",run:hr},{key:"Alt-l",mac:"Ctrl-l",run:Hn},{key:"Mod-i",run:Qn,preventDefault:!0},{key:"Mod-[",run:Ft},{key:"Mod-]",run:ne},{key:"Mod-Alt-\\",run:fr},{key:"Shift-Mod-k",run:ar},{key:"Shift-Mod-\\",run:On},{key:"Mod-/",run:nn},{key:"Alt-A",mac:"Ctrl-A",run:on},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dr}].concat(pr),Pt={key:"Tab",run:ne,shift:Ft};var Nt=typeof String.prototype.normalize=="function"?(e)=>e.normalize("NFKD"):(e)=>e;class F{constructor(e,t,n=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?(c)=>o(Nt(c)):Nt,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return bi(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Hr(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=vi(e);let r=this.normalize(t);if(r.length)for(let o=0,s=n,c=!0;;o++){let a=r.charCodeAt(o),u=this.match(a,s,c,this.bufferPos+this.bufferStart,o==r.length-1);if(u)return this.value=u,this;if(o==r.length-1)break;if(c&&o<t.length&&t.charCodeAt(o)==a)s++;else c=!1}}}match(e,t,n,r,o){let s=null;for(let c=0;c<this.matches.length;){let a=this.matches[c],u=!1;if(this.query.charCodeAt(a.index)==e)if(a.index==this.query.length-1)s={from:a.from,to:r,precise:o&&a.precise};else a.index++,u=!0;if(u)c++;else this.matches.splice(c,1)}if(this.query.charCodeAt(0)==e)if(this.query.length==1)s={from:t,to:r,precise:n&&o};else this.matches.push({from:t,index:1,precise:n});if(s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart))s=null;return s}}if(typeof Symbol<"u")F.prototype[Symbol.iterator]=function(){return this};var Gt={from:-1,to:-1,match:/.*/.exec(""),precise:!0},we="gm"+(/x/.unicode==null?"":"u");class We{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=Gt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Re(e,t,n,r,o);this.re=new RegExp(t,we+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.iter=e.iter();let s=e.lineAt(r);this.curLineStart=s.from,this.matchPos=ce(e,r),this.getLine(this.curLineStart)}getLine(e){if(this.iter.next(e),this.iter.lineBreak)this.curLine="";else{if(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){if(this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=ce(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length)this.nextLine();if((n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}var Be=new WeakMap;class G{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Be.get(e);if(!r||r.from>=n||r.to<=t){let c=new G(t,e.sliceString(t,n));return Be.set(e,c),c}if(r.from==t&&r.to==n)return r;let{text:o,from:s}=r;if(s>t)o=e.sliceString(t,s)+o,s=t;if(r.to<n)o+=e.sliceString(r.to,n);return Be.set(e,new G(s,o)),new G(t,o.slice(t-s,n-s))}}class Re{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=Gt,this.matchPos=ce(e,r),this.re=new RegExp(t,we+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.flat=G.get(e,r,this.chunkEnd(r+5000))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e)this.re.lastIndex=e+1,t=this.re.exec(this.flat.text);if(t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this.matchPos=ce(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=G.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")We.prototype[Symbol.iterator]=Re.prototype[Symbol.iterator]=function(){return this};function gr(e){try{return new RegExp(e,we),!0}catch(t){return!1}}function ce(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;while(t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344)t++;return t}var yr=(e)=>{let t=to(e,"cm-goto-line");if(t){let c=t.dom.querySelector("input[type=text]");if(c)c.select();return!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:o,result:s}=eo(e,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return s.then((c)=>{let a=c&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(c.elements.line.value);if(!a){e.dispatch({effects:o});return}let u=n.doc.lineAt(n.selection.main.head),[,d,f,m,p]=a,W=m?+m.slice(1):0,M=f?+f:u.number;if(f&&p){let ye=M/100;if(d)ye=ye*(d=="-"?-1:1)+u.number/n.doc.lines;M=Math.round(n.doc.lines*ye)}else if(f&&d)M=M*(d=="-"?-1:1)+u.number;let qe=n.doc.line(Math.max(1,Math.min(n.doc.lines,M))),Ve=l.cursor(qe.from+Math.max(0,Math.min(W,qe.length)));e.dispatch({effects:[o,b.scrollIntoView(Ve.from,{y:"center"})],selection:Ve})}),!0},xr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_t=x.define({combine(e){return bt(e,xr,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jt(e){let t=[Cr,br];if(e)t.push(_t.of(e));return t}var Sr=E.mark({class:"cm-selectionMatch"}),kr=E.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function qt(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=se.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=se.Word)}function vr(e,t,n,r){return e(t.sliceDoc(n,n+1))==se.Word&&e(t.sliceDoc(r-1,r))==se.Word}var br=Te.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){if(e.selectionSet||e.docChanged||e.viewportChanged)this.decorations=this.getDeco(e.view)}getDeco(e){let t=e.state.facet(_t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let o=r.main,s,c=null;if(o.empty){if(!t.highlightWordAroundCursor)return E.none;let u=n.wordAt(o.head);if(!u)return E.none;c=n.charCategorizer(o.head),s=n.sliceDoc(u.from,u.to)}else{let u=o.to-o.from;if(u<t.minSelectionLength||u>200)return E.none;if(t.wholeWords){if(s=n.sliceDoc(o.from,o.to),c=n.charCategorizer(o.head),!(qt(c,n,o.from,o.to)&&vr(c,n,o.from,o.to)))return E.none}else if(s=n.sliceDoc(o.from,o.to),!s)return E.none}let a=[];for(let u of e.visibleRanges){let d=new F(n.doc,s,u.from,u.to);while(!d.next().done){let{from:f,to:m}=d.value;if(!c||qt(c,n,f,m)){if(o.empty&&f<=o.from&&m>=o.to)a.push(kr.range(f,m));else if(f>=o.to||m<=o.from)a.push(Sr.range(f,m));if(a.length>t.maxMatches)return E.none}}}return E.set(a)}},{decorations:(e)=>e.decorations}),Cr=b.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Mr=({state:e,dispatch:t})=>{let{selection:n}=e,r=l.create(n.ranges.map((o)=>e.wordAt(o.head)||l.cursor(o.head)),n.mainIndex);if(r.eq(n))return!1;return t(e.update({selection:r})),!0};function Ar(e,t){let{main:n,ranges:r}=e.selection,o=e.wordAt(n.head),s=o&&o.from==n.from&&o.to==n.to;for(let c=!1,a=new F(e.doc,t,r[r.length-1].to);;)if(a.next(),a.done){if(c)return null;a=new F(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),c=!0}else{if(c&&r.some((u)=>u.from==a.value.from))continue;if(s){let u=e.wordAt(a.value.from);if(!u||u.from!=a.value.from||u.to!=a.value.to)continue}return a.value}}var Lr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((s)=>s.from===s.to))return Mr({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((s)=>e.sliceDoc(s.from,s.to)!=r))return!1;let o=Ar(e,r);if(!o)return!1;return t(e.update({selection:e.selection.addRange(l.range(o.from,o.to),!1),effects:b.scrollIntoView(o.to)})),!0},I=x.define({combine(e){return bt(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:(t)=>new Zt(t),scrollToMatch:(t)=>b.scrollIntoView(t)})}});function $t(e){return e?[I.of(e),Ee]:Ee}class Oe{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||gr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
2
|
+
`:n=="r"?"\r":n=="t"?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ht(this):new Kt(this)}getCursor(e,t=0,n){let r=e.doc?e:D.create({doc:e});if(n==null)n=r.doc.length;return this.regexp?q(this,r,t,n):N(this,r,t,n)}}class Fe{constructor(e){this.spec=e}}function Br(e,t,n){return(r,o,s,c)=>{if(n&&!n(r,o,s,c))return!1;let a=r>=c&&o<=c+s.length?s.slice(r-c,o-c):t.doc.sliceString(r,o);return e(a,t,r,o)}}function N(e,t,n,r){let o;if(e.wholeWord)o=Dr(t.doc,t.charCategorizer(t.selection.main.head));if(e.test)o=Br(e.test,t,o);return new F(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:(s)=>s.toLowerCase(),o)}function Dr(e,t){return(n,r,o,s)=>{if(s>n||s+o.length<r)s=Math.max(0,n-2),o=e.sliceString(s,Math.min(e.length,r+2));return(t(ae(o,n-s))!=se.Word||t(ue(o,n-s))!=se.Word)&&(t(ue(o,r-s))!=se.Word||t(ae(o,r-s))!=se.Word)}}class Kt extends Fe{constructor(e){super(e)}nextMatch(e,t,n){let r=N(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,t+this.spec.unquoted.length);r=N(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let o=Math.max(t,r-1e4-this.spec.unquoted.length),s=N(this.spec,e,o,r),c=null;while(!s.nextOverlapping().done)c=s.value;if(c)return c;if(o==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);if(!r)r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length);return r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=N(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=N(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}function Er(e,t,n){return(r,o,s)=>(!n||n(r,o,s))&&e(s[0],t,r,o)}function q(e,t,n,r){let o;if(e.wholeWord)o=Tr(t.charCategorizer(t.selection.main.head));if(e.test)o=Er(e.test,t,o);return new We(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,r)}function ae(e,t){return e.slice(pe(e,t,!1),t)}function ue(e,t){return e.slice(t,pe(e,t))}function Tr(e){return(t,n,r)=>!r[0].length||(e(ae(r.input,r.index))!=se.Word||e(ue(r.input,r.index))!=se.Word)&&(e(ue(r.input,r.index+r[0].length))!=se.Word||e(ae(r.input,r.index+r[0].length))!=se.Word)}class Ht extends Fe{nextMatch(e,t,n){let r=q(this.spec,e,n,e.doc.length).next();if(r.done)r=q(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let o=Math.max(t,n-r*1e4),s=q(this.spec,e,o,n),c=null;while(!s.next().done)c=s.value;if(c&&(o==t||c.from>o+10))return c;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return t})}matchAll(e,t){let n=q(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=q(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}var J=B.define(),Ie=B.define(),O=ke.define({create(e){return new ie(De(e).create(),null)},update(e,t){for(let n of t.effects)if(n.is(J))e=new ie(n.value.create(),e.panel);else if(n.is(Ie))e=new ie(e.query,n.value?Pe:null);return e},provide:(e)=>Vn.from(e,(t)=>t.panel)});class ie{constructor(e,t){this.query=e,this.panel=t}}var wr=E.mark({class:"cm-searchMatch"}),Wr=E.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Rr=Te.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(O))}update(e){let t=e.state.field(O);if(t!=e.startState.field(O)||e.docChanged||e.selectionSet||e.viewportChanged)this.decorations=this.highlight(t)}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new vt;for(let o=0,s=n.visibleRanges,c=s.length;o<c;o++){let{from:a,to:u}=s[o];while(o<c-1&&u>s[o+1].from-500)u=s[++o].to;e.highlight(n.state,a,u,(d,f)=>{let m=n.state.selection.ranges.some((p)=>p.from==d&&p.to==f);r.add(d,f,m?Wr:wr)})}return r.finish()}},{decorations:(e)=>e.decorations});function K(e){return(t)=>{let n=t.state.field(O,!1);return n&&n.query.spec.valid?e(t,n):de(t)}}var he=K((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let o=l.single(r.from,r.to),s=e.state.facet(I);return e.dispatch({selection:o,effects:[Ne(e,r),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),jt(e),!0}),fe=K((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,o=t.prevMatch(n,r,r);if(!o)return!1;let s=l.single(o.from,o.to),c=e.state.facet(I);return e.dispatch({selection:s,effects:[Ne(e,o),c.scrollToMatch(s.main,e)],userEvent:"select.search"}),jt(e),!0}),Or=K((e,{query:t})=>{let n=t.matchAll(e.state,1000);if(!n||!n.length)return!1;return e.dispatch({selection:l.create(n.map((r)=>l.range(r.from,r.to))),userEvent:"select.search.matches"}),!0}),Fr=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,s=[],c=0;for(let a=new F(e.doc,e.sliceDoc(r,o));!a.next().done;){if(s.length>1000)return!1;if(a.value.from==r)c=s.length;s.push(l.range(a.value.from,a.value.to))}return t(e.update({selection:l.create(s,c),userEvent:"select.search.matches"})),!0},Vt=K((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let c=s,a=[],u,d,f=[];if(!c.precise)c=t.nextMatch(n,c.from,c.to);else if(c.from==r&&c.to==o)d=n.toText(t.getReplacement(c)),a.push({from:c.from,to:c.to,insert:d}),c=t.nextMatch(n,c.from,c.to),f.push(b.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."));let m=e.state.changes(a);if(c)u=l.single(c.from,c.to).map(m),f.push(Ne(e,c)),f.push(n.facet(I).scrollToMatch(u.main,e));return e.dispatch({changes:m,selection:u,effects:f,userEvent:"input.replace"}),!0}),Ir=K((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let o of t.matchAll(e.state,1e9)){let{from:s,to:c,precise:a}=o;if(a)n.push({from:s,to:c,insert:t.getReplacement(o)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:b.announce.of(r),userEvent:"input.replace.all"}),!0});function Pe(e){return e.state.facet(I).createPanel(e)}function De(e,t){var n,r,o,s,c;let a=e.selection.main,u=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!u)return t;let d=e.facet(I);return new Oe({search:((n=t===null||t===void 0?void 0:t.literal)!==null&&n!==void 0?n:d.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=t===null||t===void 0?void 0:t.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(o=t===null||t===void 0?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(s=t===null||t===void 0?void 0:t.regexp)!==null&&s!==void 0?s:d.regexp,wholeWord:(c=t===null||t===void 0?void 0:t.wholeWord)!==null&&c!==void 0?c:d.wholeWord})}function Qt(e){let t=xi(e,Pe);return t&&t.dom.querySelector("[main-field]")}function jt(e){let t=Qt(e);if(t&&t==e.root.activeElement)t.select()}var de=(e)=>{let t=e.state.field(O,!1);if(t&&t.panel){let n=Qt(e);if(n&&n!=e.root.activeElement){let r=De(e.state,t.query.spec);if(r.valid)e.dispatch({effects:J.of(r)});n.focus(),n.select()}}else e.dispatch({effects:[Ie.of(!0),t?J.of(De(e.state,t.query.spec)):B.appendConfig.of(Ee)]});return!0},Xt=(e)=>{let t=e.state.field(O,!1);if(!t||!t.panel)return!1;let n=xi(e,Pe);if(n&&n.dom.contains(e.root.activeElement))e.focus();return e.dispatch({effects:Ie.of(!1)}),!0},Yt=[{key:"Mod-f",run:de,scope:"editor search-panel"},{key:"F3",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Xt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Fr},{key:"Mod-Alt-g",run:yr},{key:"Mod-d",run:Lr,preventDefault:!0}];class Zt{constructor(e){this.view=e;let t=this.query=e.state.field(O).query.spec;this.commit=this.commit.bind(this),this.searchField=ge("input",{value:t.search,placeholder:S(e,"Find"),"aria-label":S(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ge("input",{value:t.replace,placeholder:S(e,"Replace"),"aria-label":S(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ge("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ge("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ge("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,o,s){return ge("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=ge("div",{onkeydown:(r)=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>he(e),[S(e,"next")]),n("prev",()=>fe(e),[S(e,"previous")]),n("select",()=>Or(e),[S(e,"all")]),ge("label",null,[this.caseField,S(e,"match case")]),ge("label",null,[this.reField,S(e,"regexp")]),ge("label",null,[this.wordField,S(e,"by word")]),...e.state.readOnly?[]:[ge("br"),this.replaceField,n("replace",()=>Vt(e),[S(e,"replace")]),n("replaceAll",()=>Ir(e),[S(e,"replace all")])],ge("button",{name:"close",onclick:()=>Xt(e),"aria-label":S(e,"close"),type:"button"},["×"])])}commit(){let e=new Oe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query))this.query=e,this.view.dispatch({effects:J.of(e)})}keydown(e){if(jr(this.view,e,"search-panel"))e.preventDefault();else if(e.keyCode==13&&e.target==this.searchField)e.preventDefault(),(e.shiftKey?fe:he)(this.view);else if(e.keyCode==13&&e.target==this.replaceField)e.preventDefault(),Vt(this.view)}update(e){for(let t of e.transactions)for(let n of t.effects)if(n.is(J)&&!n.value.eq(this.query))this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I).top}}function S(e,t){return e.state.phrase(t)}var re=30,le=/[\s\.,:;?!]/;function Ne(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-re),c=Math.min(o,n+re),a=e.state.sliceDoc(s,c);if(s!=r.from){for(let u=0;u<re;u++)if(!le.test(a[u+1])&&le.test(a[u])){a=a.slice(u);break}}if(c!=o){for(let u=a.length-1;u>a.length-re;u--)if(!le.test(a[u-1])&&le.test(a[u])){a=a.slice(0,u);break}}return b.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}var Pr=b.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Ee=[O,Le.low(Rr),Pr];var Nr=b.theme({"&":{color:"var(--code-fg)",backgroundColor:"var(--code-bg)",height:"100%",fontSize:"var(--code-size, 13px)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-mono)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--code-fg)",padding:"0.5rem 0"},".cm-line":{padding:"0 0.75rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--code-fg)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--code-selection)"},".cm-activeLine":{backgroundColor:"var(--code-active-line)"},".cm-gutters":{backgroundColor:"var(--code-gutter-bg)",color:"var(--code-gutter)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--code-active-line)",color:"var(--code-fg)"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 0.5rem",minWidth:"2.25rem"},".cm-matchingBracket, .cm-nonmatchingBracket":{backgroundColor:"var(--code-selection)",outline:"1px solid var(--border-strong)"},".cm-searchMatch":{backgroundColor:"var(--warn-soft)",outline:"1px solid var(--warn)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)",outline:"1px solid var(--accent)"},".cm-panels":{backgroundColor:"var(--surface-2)",color:"var(--text)",borderColor:"var(--border)",fontFamily:"var(--font)"},".cm-panels-top":{borderBottom:"1px solid var(--border)"},".cm-panel.cm-search":{padding:"0.5rem 2rem 0.5rem 0.5rem"},".cm-panel.cm-search input, .cm-panel.cm-search button, .cm-panel.cm-search label":{fontSize:"0.875rem"},".cm-panel.cm-search input[type=text]":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--control-border)",borderRadius:"var(--radius-sm)",padding:"0.25rem 0.5rem"},".cm-panel.cm-search button":{backgroundColor:"var(--surface-3)",color:"var(--text)",border:"1px solid var(--border-strong)",borderRadius:"var(--radius-sm)",backgroundImage:"none",padding:"0.25rem 0.625rem"},".cm-panel.cm-search [name=close]":{color:"var(--muted)"}}),qr=Sn.define([{tag:[i.keyword,i.modifier,i.operatorKeyword,i.controlKeyword],color:"var(--code-keyword)"},{tag:[i.string,i.regexp,i.special(i.string),i.inserted],color:"var(--code-string)"},{tag:[i.number,i.bool,i.null,i.atom,i.literal],color:"var(--code-number)"},{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:"var(--code-comment)",fontStyle:"italic"},{tag:[i.typeName,i.className,i.namespace,i.tagName,i.standard(i.tagName)],color:"var(--code-type)"},{tag:[i.function(i.variableName),i.function(i.propertyName),i.definition(i.variableName),i.labelName],color:"var(--code-function)"},{tag:[i.meta,i.processingInstruction,i.annotation,i.attributeName,i.propertyName,i.heading],color:"var(--code-meta)"},{tag:i.heading,fontWeight:"bold"},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:i.link,color:"var(--code-function)",textDecoration:"underline"},{tag:i.url,color:"var(--code-function)"},{tag:i.invalid,color:"var(--danger)"},{tag:i.deleted,color:"var(--danger)"}]),en=[Nr,so(qr)];var Vr={typescript:()=>(h("1rv9vdcz"),import("./chunk-lang-typescript-1rv9vdcz.js")),javascript:()=>(h("d6x6qjtg"),import("./chunk-lang-javascript-d6x6qjtg.js")),json:()=>(h("790swysy"),import("./chunk-lang-json-790swysy.js")),markdown:()=>(h("483dkxcq"),import("./chunk-lang-markdown-483dkxcq.js")),css:()=>(h("yrc25qk9"),import("./chunk-lang-css-yrc25qk9.js")),html:()=>(h("rwe8epvf"),import("./chunk-lang-html-rwe8epvf.js")),python:()=>(h("v9s40bzj"),import("./chunk-lang-python-v9s40bzj.js")),yaml:()=>(h("g3v7s5je"),import("./chunk-lang-yaml-g3v7s5je.js")),go:()=>(h("drmfa25k"),import("./chunk-lang-go-drmfa25k.js")),rust:()=>(h("z4gry1bf"),import("./chunk-lang-rust-z4gry1bf.js")),sql:()=>(h("75j3denr"),import("./chunk-lang-sql-75j3denr.js")),xml:()=>(h("jg1sv4h2"),import("./chunk-lang-xml-jg1sv4h2.js")),shell:()=>(h("egsvk8rj"),import("./chunk-lang-shell-egsvk8rj.js")),toml:()=>(h("7dbjvhex"),import("./chunk-lang-toml-7dbjvhex.js")),dockerfile:()=>(h("tjxsnhr9"),import("./chunk-lang-dockerfile-tjxsnhr9.js"))};async function tn(e){if(e==="plain")return;try{return(await Vr[e]()).language()}catch(t){console.warn("a language for the editor failed to load",t);return}}function Gr(e){if(typeof e.attachShadow!=="function"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in Document.prototype))return{parent:e,root:void 0};let t=e.shadowRoot??e.attachShadow({mode:"open"}),n=new CSSStyleSheet;return n.replaceSync(":host{display:flex;flex-direction:column;min-height:0}.cm-editor{flex:1;min-height:0}"),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],{parent:t,root:t}}async function vo(e){let t=new zt,n=new zt,r=new zt,o=await tn(e.language),s=(m)=>[D.readOnly.of(!m),b.editable.of(m)],c={editable:e.editable,wrap:e.wrap,language:o??[]},a,u=(m)=>[no(),Jr(),io(),tt(),Kr(),ao(),Jt(),$t({top:!0}),je.of(" "),D.phrases.of(e.phrases),en,Tt.of([{key:"Mod-s",preventDefault:!0,run:()=>(e.onSave(),!0)},{key:"Escape",run:()=>(e.onEscape(),!0)},Pt,...Yt,...ot,...It]),D.lineSeparator.of(m),t.of(s(c.editable)),n.of(c.wrap?b.lineWrapping:[]),r.of(c.language),b.updateListener.of((p)=>{if(p.docChanged)e.onChange()})],d=Gr(e.parent),f=new b({parent:d.parent,root:d.root,state:D.create({doc:e.text,extensions:u(e.eol)})});return a=f.state.doc,{text:()=>f.state.doc.sliceString(0,void 0,f.state.lineBreak),dirty:()=>a===void 0||!f.state.doc.eq(a),snapshot:()=>f.state.doc,markSaved:(m)=>{a=m??f.state.doc},replace:(m,p)=>{let W=f.scrollDOM.scrollTop;f.setState(D.create({doc:m,extensions:u(p)})),a=f.state.doc,f.scrollDOM.scrollTop=W},setEditable:(m)=>{c.editable=m,f.dispatch({effects:t.reconfigure(s(m))})},setWrap:(m)=>{c.wrap=m,f.dispatch({effects:n.reconfigure(m?b.lineWrapping:[])})},setLanguage:async(m)=>{c.language=await tn(m)??[],f.dispatch({effects:r.reconfigure(c.language)})},undo:()=>{X(f)},redo:()=>{z(f)},find:()=>{de(f)},tab:()=>{ne(f)},focus:()=>f.focus(),scrollTop:()=>f.scrollDOM.scrollTop,scrollTo:(m)=>{f.scrollDOM.scrollTop=m},destroy:()=>f.destroy()}}export{vo as createEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{K}from"./chunk-index-3wbyq10m.js";import"./chunk-index-47yspxa4.js";export{K as Confirm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,g,e,n,O,w,m,k,P,_}from"./chunk-index-kankja6p.js";import{ye}from"./chunk-index-wc83vb0a.js";function p(){let{connectorAdminUrl:o}=_(),{data:r,error:s}=ye(()=>O.connectors(),"connectors");return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h2",{children:t("Connectors")}),e("p",{className:"hint",children:t("Upstream MCP gateways and virtual servers used by the knights.")})]}),o?e("a",{href:o,target:"_blank",rel:"noreferrer",children:t("Open connector admin")}):null]}),s?e(m,{message:s}):null,!r&&!s?e(w,{}):null,r?n(g,{children:[e("h3",{children:t("Upstream gateways")}),r.gateways.length===0?e(k,{children:t("No gateways.")}):null,r.gateways.map((a)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:a.enabled?t("Enabled"):t("Disabled")}),e(P,{tone:a.reachable?"plain":"warn",children:a.reachable?t("Reachable"):t("Unreachable")}),e(P,{children:t("{count} tools",{count:a.tools})})]})},a.name)),e("h3",{children:t("Virtual servers")}),r.servers.length===0?e(k,{children:t("No virtual servers.")}):null,r.servers.map((a)=>n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:t("{count} tools",{count:a.tools.length})})]}),n("p",{children:[t("Used by"),": ",a.usedBy.join(", ")||t("None")]}),n("details",{children:[e("summary",{children:t("Tool list")}),e("ul",{children:a.tools.map((l)=>e("li",{children:l},l))})]})]},a.name))]}):null]})}export{p as ConnectorsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,c,g,e,n,v,O,w,m,k,P,_,Pe,ie,Qe,un,ci,ne}from"./chunk-index-kankja6p.js";import{ye}from"./chunk-index-wc83vb0a.js";var u=[{kind:"owner",title:c("Owner channels"),note:c("Direct messages and channels where the owner talks to a knight.")},{kind:"agent",title:c("Bot server channels"),note:c("The bot server's one-to-one channels.")},{kind:"group",title:c("Group channels"),note:c("The bot server's group channels.")},{kind:"outside",title:c("Outside AI clients"),note:c("Conversations an outside AI client holds over MCP.")},{kind:"plugin",title:c("Plugin conversations"),note:c("Conversations a plugin runs, such as a web chat, as the host recorded them.")}];function Z(){let{timeZone:o}=_(),{now:i}=ne(),{data:a,error:s}=ye(()=>O.conversations(),"conversations"),d=a?.conversations;if(!d)return s?e(m,{message:s}):e(w,{});return n(g,{children:[s?e(m,{message:s}):null,u.map((r)=>{let h=d.filter((l)=>l.kind===r.kind);return n("section",{className:"stack",children:[e("h2",{children:t(r.title)}),e("p",{className:"hint",children:t(r.note)}),h.length===0?e(k,{children:t("None stored.")}):null,h.map((l)=>e(p,{item:l,now:i,timeZone:o},l.key))]},r.kind)})]})}function p(o){let{item:i}=o,a=un(i.channel,i.id),s=ci(i);return n("a",{className:"card card-link",href:v("conversations",i.key),children:[n("div",{className:"card-head",children:[e("strong",{children:s}),i.busy>0?e(P,{tone:"busy",children:t("running")}):null,i.liveBytes===0?e(P,{children:t("archived only")}):null]}),n("p",{className:"meta",children:[(i.kind==="outside"||i.kind==="plugin")&&i.startedAt?`${t("Started")} ${ie(i.startedAt,o.timeZone)} · `:a.detail?`${a.detail} · `:"",i.principal?`${i.visibility==="private"?t("Private to {name}",{name:i.principal.name}):t("Shared · {name}",{name:i.principal.name})} · `:"",t("Last active")," ",Pe(i.lastActive,o.now,o.timeZone)," ·"," ",Qe(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{Z as ConversationsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{xr}from"./chunk-index-kankja6p.js";import{cr}from"./chunk-index-azrnzgev.js";import{Ho,Ko,Lr,Xr,Jo,es}from"./chunk-index-4s1qj9we.js";var ne=xr,re=(a)=>{for(let n=a;n;n=n.parentElement){let{overflowY:l}=getComputedStyle(n);if((l==="auto"||l==="scroll")&&n.scrollHeight>n.clientHeight)return n}return document.scrollingElement??document.documentElement};function se(a){let{item:n,root:l,key:u,mode:C}=a,c=re(l),O=c===document.scrollingElement||c===document.documentElement,k=()=>O?0:c.getBoundingClientRect().top,X=()=>O?window.innerHeight:c.clientHeight,x=(e)=>e-k()+c.scrollTop,p=(e)=>{let t=e.getBoundingClientRect();return{top:x(t.top),height:t.height}},y=document.createElement("div");y.className="drop-line",y.setAttribute("aria-hidden","true");let z=[],P=[],g=[],h=[],R=[],B={top:0,bottom:0},D=()=>{let e=[...l.querySelectorAll("[data-drop-item], [data-folder-block]")].map((t)=>[t,t.style.transform]);for(let[t]of e)t.style.removeProperty("transform");try{j()}finally{for(let[t,r]of e)if(r)t.style.transform=r}},j=()=>{if(C==="room"){P=[...l.querySelectorAll("[data-drop-zone]")],z=P.map((t)=>{let{top:r,height:H}=p(t);return{id:t.dataset.zoneId??"",kind:t.dataset.dropZone,...t.dataset.folder?{folder:t.dataset.folder}:{},top:r,bottom:r+H,items:t.dataset.collapsed===void 0?[...t.querySelectorAll("[data-drop-item]")].map((o)=>({key:o.dataset.key??"",...p(o)})):[]}});return}g=[...l.querySelectorAll(":scope > [data-folder-block]")],h=g.map((t)=>({key:t.dataset.key??"",...p(t)})),R=g.map((t)=>({key:t.dataset.key??"",...p(t.querySelector("[data-folder-head]")??t)}));let e=p(l);B={top:e.top,bottom:e.top+e.height}};cr(!0);let G=n.getBoundingClientRect().top;n.setAttribute("data-lifted",""),l.setAttribute("data-reordering","");let F=n.getBoundingClientRect().top-G;if(F)c.scrollTop+=F;D();let J=x(a.y),I={x:0,y:a.y},Z=!1,f=0,w,d,q={type:"cancel"};try{n.setPointerCapture(a.pointerId)}catch{}let _=()=>{f=0;let e=x(I.y),t=e-J;if(Math.abs(t)>ne)Z=!0;n.style.transform=`translate3d(0, ${t}px, 0)`;let r;if(C==="room"){let o=Ho(z,u,e);q=o?{type:"room",drop:o}:{type:"cancel"};let M=o?z.indexOf(o.zone):-1;r=P[M];let E=r?.contains(n)??!1,s=o?o.zone.items:[],m=E?[...r.querySelectorAll("[data-drop-item]")]:[],v=s.findIndex((i)=>i.key===u),W=o?Xr(s.map((i)=>i.key),u,o.before):0,ee=s.length>1?Math.max(0,(s[1]?.top??0)-(s[0]?.top??0)-(s[0]?.height??0)):0,U=E&&v>=0?Lr(s,v,W,ee):[];for(let i of document.querySelectorAll("[data-drop-item]:not([data-lifted])"))i.style.removeProperty("transform");if(m.forEach((i,A)=>{if(U[A])i.style.transform=`translate3d(0, ${U[A]}px, 0)`}),r&&o&&!E){let i=o.before===null?void 0:o.zone.items.find((oe)=>oe.key===o.before),A=p(r).top,te=i?i.top-A:o.zone.items.length?p(r).height:0;y.style.top=`${te}px`,r.append(y)}else y.remove();if(o?.zone.kind==="folder"&&o.zone.items.length===0&&r?.dataset.collapsed!==void 0){if(d?.zone!==o.zone.id){if(d)clearTimeout(d.timer);let i=o.zone.folder??"";d={zone:o.zone.id,timer:setTimeout(()=>{a.open(i),requestAnimationFrame(()=>requestAnimationFrame(()=>{D(),L()}))},es)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=Ko(R,B,u,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let M=h.findIndex((m)=>m.key===u),E=o?Xr(h.map((m)=>m.key),u,o.before):M,s=Lr(h,M,E,12);g.forEach((m,v)=>{if(m!==n)m.style.transform=s[v]?`translate3d(0, ${s[v]}px, 0)`:""})}if(r!==w)w?.removeAttribute("data-drop-target"),r?.setAttribute("data-drop-target",""),w=r;let H=Jo(I.y,k(),k()+X());if(H)c.scrollTop+=H,L()},L=()=>{if(!f)f=requestAnimationFrame(_)},b=(e)=>{Q(),a.done(e)},S=(e)=>e.pointerId===a.pointerId,K=(e)=>{if(!S(e))return;e.stopPropagation(),e.preventDefault(),I={x:e.clientX,y:e.clientY},L()},N=(e)=>{if(!S(e))return;if(e.stopPropagation(),f)cancelAnimationFrame(f),_();b(Z?q:{type:"tap"})},V=(e)=>{if(S(e))b({type:"cancel"})},Y=(e)=>{if(e.key!=="Escape")return;e.preventDefault(),e.stopPropagation(),b({type:"cancel"})},T=(e)=>e.preventDefault();function Q(){if(cr(!1),window.removeEventListener("pointermove",K,!0),window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",V,!0),window.removeEventListener("keydown",Y,!0),window.removeEventListener("touchmove",T,!0),window.removeEventListener("contextmenu",T,!0),f)cancelAnimationFrame(f);if(d)clearTimeout(d.timer);w?.removeAttribute("data-drop-target"),y.remove(),n.removeAttribute("data-lifted"),n.style.removeProperty("transform"),l.removeAttribute("data-reordering");for(let e of l.querySelectorAll("[data-drop-item], [data-folder-block]"))e.style.removeProperty("transform");try{n.releasePointerCapture(a.pointerId)}catch{}}return window.addEventListener("pointermove",K,!0),window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",V,!0),window.addEventListener("keydown",Y,!0),window.addEventListener("touchmove",T,{capture:!0,passive:!1}),window.addEventListener("contextmenu",T,!0),L(),()=>b({type:"cancel"})}export{se as lift};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ct,Gt}from"./chunk-index-pgxgq61x.js";import{h}from"./chunk-index-kankja6p.js";function H(){try{let c=document.createElement("canvas");return!!(c.getContext("webgl2")||c.getContext("webgl"))}catch{return!1}}function x(c,n){return[c,n.includes("?")?n.slice(n.indexOf("?")):""].some((r)=>{let d=new URLSearchParams(r).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function I(c,n,S){let r=n.variant==="compact",d=n.labels??Gt,l=new Map,E=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};E(n.seats);let m={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=r?"compact":"full";let f=document.createElement("div");f.className="rt-table-stage",o.appendChild(f);let i=null,y=!1,A=()=>!r&&(Boolean(n.listBelow)||y);c.appendChild(o);let u=new Map,g=()=>{if(!A()){i?.remove(),i=null,u.clear(),delete o.dataset.list;return}if(!i)i=document.createElement("ul"),i.className="rt-table-list",i.setAttribute("aria-label",d.table),o.appendChild(i),o.dataset.list="";for(let e of[...u.keys()])if(!l.has(e))u.delete(e);for(let e of l.values()){let t=u.get(e.id);if(!t){t=document.createElement("button"),t.type="button",t.dataset.seat=e.id;let s=e.id;t.addEventListener("click",(p)=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name,at:Ct(p,p.currentTarget)})}),u.set(e.id,t)}t.textContent=d.seat(e.name,e.state??"idle"),t.style.setProperty("--seat",e.color)}i.replaceChildren(...[...l.values()].map((e)=>{let t=document.createElement("li"),s=u.get(e.id);if(s)t.appendChild(s);return t}))};g();let w=(e)=>{y=!e,g(),n.onNames?.(e)},T=async()=>{let{createTable2D:e}=await (h("1a6atjhj"),import("./chunk-table2d-1a6atjhj.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()]}),w(!0)},C=async()=>{let{createTable3D:e}=await (h("k0ffeffj"),import("./chunk-table3d-k0ffeffj.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()],onNames:w},()=>{a?.dispose(),T()})};if(r||S==="svg"||S!=="webgl"&&(x(location.search,location.hash)||!H()))await T();else try{await C()}catch{await T()}let L,M=n.onSeatMenu;if(M&&!r){let{attachSeatMenu:e}=await (h("vrpc40v9"),import("./chunk-seat-menu-vrpc40v9.js"));L=e(o,(t,s,p)=>{let b=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,v=l.get(b??a?.seatAt?.(s,p)??"");return v?{id:v.id,name:v.name}:void 0},M)}return{get kind(){return a.kind},setTheme(e,t){m={t:e,s:t},a.setTheme(e,t)},setSeats(e){E(e),g(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;g(),a.setState(e,t)},setAvatar(e,t){let s=l.get(e);if(s)s.avatarSvg=t;return a.setAvatar(e,t)},setReducedMotion:(e)=>a.setReducedMotion(e),resetCamera:()=>a.resetCamera(),focus:(e,t)=>a.focus(e,t),focused:()=>a.focused(),seatAt:(e,t)=>a.seatAt?.(e,t)??null,getStats:()=>a.getStats(),dispose(){L?.(),a?.dispose(),o.remove()}}}export{I as mountRoundTable};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h,s,A,t,te,g,e,n,o,Ot,d,fe,We,Ln,Xn}from"./chunk-index-kankja6p.js";import{ir,or,sr,ar}from"./chunk-index-rg9vh59e.js";import{qt}from"./chunk-index-1fn8q4ps.js";import{yi}from"./chunk-index-nrexxkar.js";var v=()=>(h("6assr93n"),import("./chunk-layout-actions-6assr93n.js")),y=(a)=>(h("2eect825"),import("./chunk-placement-items-2eect825.js")).then((r)=>r.folderMenu(a)),F=(a)=>({mode:"folder",key:a,item:(r)=>r.closest("[data-folder-block]"),root:(r)=>r.closest("[data-folder-block]")?.parentElement??null,onDrop:(r)=>{if(r.type==="folder")v().then((i)=>i.placeFolderBefore(a,r.before))},open:sr});function k(a){let{id:r,name:i}=a,m=ir().has(r),l=a.holdsActive||!m,c=A(),b=qt(()=>y(r),F(r)),N=(u)=>{y(r).then((f)=>{if(!f)return;let p=u.getBoundingClientRect();fe({...f,at:{x:p.left,y:p.bottom},via:"key",source:u})},()=>{return})};return n("section",{className:"folder","aria-label":i,"data-folder-block":"","data-key":r,"data-drop-zone":"folder","data-zone-id":r,"data-folder":r,"data-collapsed":l?void 0:"",children:[n("header",{className:"folder-head","data-folder-head":"",...b,children:[n("button",{type:"button",className:"folder-toggle","aria-expanded":l,"aria-controls":c,"aria-label":l?t("Collapse {name}",{name:i}):t("Expand {name}",{name:i}),onClick:()=>or(r),children:[e(o,{name:"chevron",size:16,className:"folder-chevron","data-open":l||void 0}),e("strong",{children:i}),e("span",{className:"meta",children:te(a.count,"{count} room","{count} rooms")}),l?null:a.stack]}),a.muted==="none"?null:e(o,{name:"bell-off",size:14,className:"muted-mark","data-partial":a.muted==="some"||void 0,role:"img","aria-hidden":!1,"aria-label":a.muted==="all"?t("Notifications are off"):t("Some notifications are off")}),l?null:a.summary,e("button",{type:"button",className:"icon-button folder-more","aria-haspopup":"menu","aria-label":t("Folder menu"),onClick:(u)=>N(u.currentTarget),children:e(o,{name:"more",size:18})})]}),e("div",{id:c,className:"folder-body",hidden:!l,children:l?a.count===0?e("p",{className:"meta folder-empty",children:t("No rooms in this folder yet.")}):a.children:null})]})}var R=4;function S(a){let r=a.rooms.slice(0,R),i=d((l)=>r.map((c)=>l.rooms[c]?.view),r.join(",")),m=a.rooms.length-r.length;return n("span",{className:"folder-stack","aria-hidden":"true",children:[i.map((l)=>l?e("span",{className:"folder-stack-item",children:e(We,{view:l,size:28})},l.key):null),m>0?n("span",{className:"folder-stack-more",children:["+",m]}):null]})}function M(a){let r=d((i)=>({waiting:a.rooms.reduce((m,l)=>m+Ot(i,l),0),typing:a.rooms.some((m)=>i.rooms[m]?.typing)}),a.rooms.join(","));return n(g,{children:[r.typing?e(Ln,{}):null,r.waiting?e(Xn,{count:r.waiting}):null]})}function w(a){return d((r)=>yi(a,(i)=>r.rooms[i]?.view?.muted===!0),a.join(","))}function Q(a){let r=a.folders.map((i)=>i.id).join(",");return s(()=>{if(a.listed)ar(r?r.split(","):[])},[a.listed,r]),e(g,{children:a.folders.map((i)=>e(C,{folder:i,...a},i.id))})}function C(a){let{folder:r}=a,i=w(r.rooms);return e(k,{id:r.id,name:r.name,count:r.rooms.length,holdsActive:a.active!==void 0&&r.rooms.includes(a.active),muted:i,summary:e(M,{rooms:r.rooms}),stack:e(S,{rooms:r.rooms}),children:a.rooms(r.rooms)})}export{Q as FolderList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ir,rr,or,sr,ar}from"./chunk-index-rg9vh59e.js";export{rr as collapsedNow,sr as expandFolder,ar as pruneCollapsed,or as toggleCollapsed,ir as useCollapsed};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,e,n,o,v}from"./chunk-index-kankja6p.js";import{Pn,nn}from"./chunk-index-8eexybcx.js";function l({steps:s}){return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Finish setting up")})}),e("p",{className:"meta",children:t("These steps come first. The rest of the app opens when they are done.")}),e("ul",{className:"menu",children:s.map((a)=>e("li",{children:n("a",{className:"menu-item menu-link",href:v(a.open.page),children:[n("span",{className:"menu-text",children:[e("strong",{children:Pn(a)}),nn(a)?e("span",{className:"meta",children:nn(a)}):null]}),e(o,{name:"chevron",size:16})]})},a.id))})]})}export{l as GatePage};
|