hermes-pilot 0.2.2 → 0.2.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/README.ja.md CHANGED
@@ -33,7 +33,8 @@ English README: [`README.md`](README.md)
33
33
  - **全タブ状態保持**: タスク・レビュー・チャット・メモ・ターミナル・設定のすべてのタブを裏で保持し、タブ往復時の再読み込みタイムラグや入力ロスを防止
34
34
  - **英語・日本語**(既定フォールバックは `en`、`ja` 同梱)、**Dark / Light / System** テーマ、そして 2 段階の
35
35
  2 ペイン: **680px から狭幅マスター・ディテール**(左 280px。iPad mini 縦などの 744/768px 用)と
36
- **820px から広幅 2 ペイン**(レビュー左 380px / タスク左 360px)。680px 未満は詳細が全画面シートで開きます
36
+ **820px から広幅 2 ペイン**(タスク・レビューとも左 380px、1180px 以上は 450px。詳細は全幅で本文だけ 1040px 上限)。
37
+ 680px 未満は詳細が全画面シートで開きます
37
38
  - **外部プラグイン不要** — リポジトリはプロジェクトフォルダの 1 階層スキャンで見つけ、システム状態は
38
39
  Hermes 標準 API だけで組み立てます
39
40
 
@@ -231,20 +232,36 @@ data URL として組み立てるため、デモは外部ネットワークに
231
232
 
232
233
  ## インストール
233
234
 
234
- ルートは 2 つ。最初の 1 手が違うだけで、そのあとは同じ **コードを取る → `npm ci` → `init`** の 3 手です。
235
- まだ npm へ公開していないため、以下のコマンドはすべて `npx` ではなくリポジトリ(またはプラグイン
236
- ディレクトリ)の CLI を直接叩く `node bin/hermes-pilot.mjs …` で書いています。
235
+ ルートは 3 つ。**A が最短**(clone 不要・コマンド 1 本)。**B / C** は Hermes のプラグインとして
236
+ 入れるので、ダッシュボードのタブと同梱スキルまで一緒に設定されます。
237
237
 
238
- **A. Hermes のプラグインカタログから(推奨)**
238
+ **A. npm から(公開パッケージ)**
239
239
 
240
240
  ```bash
241
- hermes plugins install hajimemanila/hermes-pilot --ref <sha> # sha で固定。--ref を省くと既定ブランチ
241
+ npx hermes-pilot@0.2.3 init # データ・トークン・同梱スキル・ペアリング QR(冪等)
242
+ npx hermes-pilot@0.2.3 start # ブリッジ起動(http://127.0.0.1:4097)
243
+ ```
244
+
245
+ ログインをまたいで常駐させるなら、一度だけ入れて `service` を使います。
246
+
247
+ ```bash
248
+ npm i -g hermes-pilot@0.2.3
249
+ hermes-pilot service install # macOS は launchd、Linux は systemd --user
250
+ ```
251
+
252
+ npm のパッケージ: <https://www.npmjs.com/package/hermes-pilot>(版は固定を推奨。`@latest` は最新)。
253
+ `postinstall` が npm の tarball 展開で落ちる `spawn-helper` の実行ビットを戻すので、端末タブもそのまま動きます。
254
+
255
+ **B. Hermes のプラグインカタログから**
256
+
257
+ ```bash
258
+ hermes plugins install hajimemanila/hermes-pilot --ref v0.2.3 # タグ/sha で固定。--ref を省くと既定ブランチ
242
259
  cd ~/.hermes/plugins/hermes-pilot
243
260
  npm ci
244
261
  node bin/hermes-pilot.mjs init
245
262
  ```
246
263
 
247
- **B. このリポジトリを clone して**
264
+ **C. このリポジトリを clone して**
248
265
 
249
266
  ```bash
250
267
  git clone https://github.com/hajimemanila/hermes-pilot.git
@@ -253,12 +270,10 @@ npm ci
253
270
  node bin/hermes-pilot.mjs init
254
271
  ```
255
272
 
256
- `npm ci` は省略できません。ブリッジは `ws` と**ネイティブアドオン**の `node-pty` を使い、
257
- `postinstall` が npm の tarball 展開で落ちる `spawn-helper` の実行ビットを戻しています
258
- (これが無いと端末タブが `posix_spawnp failed` で落ちます)。
259
-
260
- 以下の `node bin/hermes-pilot.mjs …` はすべて、カレントディレクトリがそのリポジトリ/プラグイン
261
- ディレクトリである前提です。短く打ちたければ一度 `npm link` してから `hermes-pilot …` を使ってください。
273
+ **B / C** では `npm ci` は省略できません。ブリッジは `ws` と**ネイティブアドオン**の `node-pty` を使い、
274
+ `postinstall` が `spawn-helper` の実行ビットを戻しています(無いと端末タブが `posix_spawnp failed` で落ちます)。
275
+ 以下の `node bin/hermes-pilot.mjs …` はカレントディレクトリがそのリポジトリ/プラグインである前提です。
276
+ **A** の場合は同じコマンドを `hermes-pilot …` で打てます。
262
277
 
263
278
  `init` は何度実行しても安全で、次の 5 つを行います。
264
279
 
@@ -378,7 +393,7 @@ review/ sheets/, shots/, library/, feed.jsonl, chat-reports.jsonl, task-c
378
393
  ```bash
379
394
  npm install # postinstall が node-pty の権限を直す
380
395
  npm run dev # Vite :4098(/api・/ws は 4097 へプロキシ)
381
- npm test # 単体テスト(808 件)
396
+ npm test # 単体テスト(933 件)
382
397
  npm run verify # test + check:pwa(34 項目)+ check:oauth + 本番ビルド + audit:responsive
383
398
  npm run build:demo # バックエンド不要の静的デモ → apps/web/dist-demo(+ google-sites-embed.html)
384
399
  npm run deploy # 検証付きで dist を原子的に切替(無停止)
@@ -390,7 +405,7 @@ node bin/hermes-pilot.mjs --help
390
405
 
391
406
  | 手順 | 何を保証するか |
392
407
  |---|---|
393
- | `npm test` | **808 件**の単体・結合テストが 0 fail(node:test、フレームワーク無し) |
408
+ | `npm test` | **933 件**の単体・結合テストが 0 fail(node:test、フレームワーク無し) |
394
409
  | `check:pwa` | `apps/web/public` に対する **34/34** 項目(マニフェスト・アイコン・マスカブル・Service Worker・viewport) |
395
410
  | `check:oauth` | **0 違反**: 端末の資格情報や OAuth トークンがブラウザ側バンドルから読めないこと |
396
411
  | `build` | Vite 本番ビルドが通り、`demo/` のコードが混入していないこと |
package/README.md CHANGED
@@ -34,7 +34,8 @@ kanban, chat, terminal and usage into a single installable PWA.
34
34
  - **Persistent tab state** — all six tabs (Tasks, Review, Chat, Memos, Terminal, Settings) stay mounted in the background so switching tabs preserves scroll position, drafts, and loaded state without reload lag.
35
35
  - **English and Japanese** (`en` is the fallback, `ja` is bundled), **Dark / Light / System** themes and two
36
36
  two-pane layouts: a **narrow master-detail from 680 px** (280 px master, for portrait tablets such as the
37
- iPad mini) and the **wide two-pane from 820 px** (380 px review master / 360 px tasks master). Below 680 px
37
+ iPad mini) and the **wide two-pane from 820 px** (380 px master for both Tasks and Review, 450 px
38
+ from 1180 px, with the detail column full-bleed and its text capped at 1040 px). Below 680 px
38
39
  every detail opens as a full-height sheet.
39
40
  - **No external plugins required** — repositories are found by scanning your project folders, and system
40
41
  status uses only the standard Hermes APIs.
@@ -240,20 +241,37 @@ check, so a broken file cannot reach the site.
240
241
 
241
242
  ## Install
242
243
 
243
- Two routes, same three steps after the first one: **get the code → `npm ci` → `init`**.
244
- There is no published npm release yet, so every command below runs the checked-in CLI
245
- (`node bin/hermes-pilot.mjs …`) from the repository or plugin directory instead of `npx`.
244
+ Three routes. **A** is the shortest (one command, no clone); **B/C** install it as a Hermes plugin
245
+ so the dashboard tab and the bundled skills are wired up for you.
246
246
 
247
- **A. From the Hermes plugin catalog (recommended)**
247
+ **A. From npm (published package)**
248
248
 
249
249
  ```bash
250
- hermes plugins install hajimemanila/hermes-pilot --ref <sha> # pin a commit; omit --ref to track the default branch
250
+ npx hermes-pilot@0.2.3 init # data dirs, token, bundled skills, pairing QR (idempotent)
251
+ npx hermes-pilot@0.2.3 start # bridge on http://127.0.0.1:4097
252
+ ```
253
+
254
+ To keep it running across logins instead, install it once and use the `service` subcommand:
255
+
256
+ ```bash
257
+ npm i -g hermes-pilot@0.2.3
258
+ hermes-pilot service install # launchd on macOS, systemd --user on Linux
259
+ ```
260
+
261
+ `hermes-pilot` on npm: <https://www.npmjs.com/package/hermes-pilot> (pin the version; `@latest`
262
+ tracks the newest release). The package `postinstall` restores the `spawn-helper` exec bit that
263
+ npm's tarball extraction drops, so the terminal tab works without extra steps.
264
+
265
+ **B. From the Hermes plugin catalog**
266
+
267
+ ```bash
268
+ hermes plugins install hajimemanila/hermes-pilot --ref v0.2.3 # pin a tag/commit; omit --ref to track the default branch
251
269
  cd ~/.hermes/plugins/hermes-pilot
252
270
  npm ci
253
271
  node bin/hermes-pilot.mjs init
254
272
  ```
255
273
 
256
- **B. From a clone of this repository**
274
+ **C. From a clone of this repository**
257
275
 
258
276
  ```bash
259
277
  git clone https://github.com/hajimemanila/hermes-pilot.git
@@ -262,12 +280,10 @@ npm ci
262
280
  node bin/hermes-pilot.mjs init
263
281
  ```
264
282
 
265
- `npm ci` is not optional: the bridge needs `ws` and the **native** addon `node-pty`, and the
266
- `postinstall` step restores the `spawn-helper` exec bit that npm's tarball extraction drops
267
- (without it the terminal tab fails with `posix_spawnp failed`).
268
-
269
- Every `node bin/hermes-pilot.mjs …` below assumes the current directory is that repository /
270
- plugin directory. If you prefer the short form, run `npm link` once and use `hermes-pilot …`.
283
+ For **B/C**, `npm ci` is not optional: the bridge needs `ws` and the **native** addon `node-pty`,
284
+ and the `postinstall` step restores the `spawn-helper` exec bit (without it the terminal tab fails
285
+ with `posix_spawnp failed`). Every `node bin/hermes-pilot.mjs …` below assumes the current
286
+ directory is that repository / plugin directory; with route **A** use `hermes-pilot …` instead.
271
287
 
272
288
  `init` is idempotent and does five things:
273
289
 
@@ -388,7 +404,7 @@ review/ sheets/, shots/, library/, feed.jsonl, chat-reports.jsonl, task-c
388
404
  ```bash
389
405
  npm install # postinstall fixes node-pty permissions
390
406
  npm run dev # Vite on :4098, proxies /api and /ws to :4097
391
- npm test # unit tests (808)
407
+ npm test # unit tests (933)
392
408
  npm run verify # test + check:pwa (34 checks) + check:oauth + production build + audit:responsive
393
409
  npm run build:demo # static interactive demo -> apps/web/dist-demo (+ google-sites-embed.html)
394
410
  npm run deploy # atomic, verified swap of apps/web/dist
@@ -400,7 +416,7 @@ node bin/hermes-pilot.mjs --help
400
416
 
401
417
  | Step | What it proves |
402
418
  |---|---|
403
- | `npm test` | **808** unit / integration tests, 0 fail (node:test, no framework). |
419
+ | `npm test` | **933** unit / integration tests, 0 fail (node:test, no framework). |
404
420
  | `check:pwa` | **34/34** PWA checks against `apps/web/public` (manifest, icons, maskable, service worker, viewport). |
405
421
  | `check:oauth` | **0** violations: no device credential or OAuth token is readable from the browser bundle. |
406
422
  | `build` | Vite production build succeeds and contains no `demo/` code. |
@@ -3,7 +3,7 @@
3
3
  "label": "Hermes Pilot",
4
4
  "description": "Pair a phone with the Hermes Pilot PWA and drive the A2B pipeline from it — Spec Seed to filed batches, live architect progress, one-tap review sheets and visual annotation — plus the one-time pairing QR, bridge status, scan directories and the keep-alive service, all from the standard dashboard.",
5
5
  "icon": "QrCode",
6
- "version": "0.2.2",
6
+ "version": "0.2.3",
7
7
  "tab": {
8
8
  "path": "/hermes-pilot",
9
9
  "position": "after:git-ops"
@@ -1,4 +1,4 @@
1
- import{u as be,r as Y,a as we,s as ye,o as Ee,h as ke,j as J,S as Le,I as De,b as Re}from"./index-BzUof8lw.js";var ge={exports:{}};(function(se,le){(function(Q,K){se.exports=K()})(globalThis,()=>(()=>{var Q={4567:function(T,r,a){var l=this&&this.__decorate||function(e,t,o,f){var d,p=arguments.length,h=p<3?t:f===null?f=Object.getOwnPropertyDescriptor(t,o):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(e,t,o,f);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(h=(p<3?d(h):p>3?d(t,o,h):d(t,o))||h);return p>3&&h&&Object.defineProperty(t,o,h),h},_=this&&this.__param||function(e,t){return function(o,f){t(o,f,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=a(9042),u=a(9924),v=a(844),g=a(4725),c=a(2585),i=a(3656);let s=r.AccessibilityManager=class extends v.Disposable{constructor(e,t,o,f){super(),this._terminal=e,this._coreBrowserService=o,this._renderService=f,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let d=0;d<this._terminal.rows;d++)this._rowElements[d]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[d]);if(this._topBoundaryFocusListener=d=>this._handleBoundaryFocus(d,0),this._bottomBoundaryFocusListener=d=>this._handleBoundaryFocus(d,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new u.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(d=>this._handleResize(d.rows))),this.register(this._terminal.onRender(d=>this._refreshRows(d.start,d.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(d=>this._handleChar(d))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
1
+ import{u as be,r as Y,a as we,s as ye,o as Ee,h as ke,j as J,S as Le,I as De,b as Re}from"./index-CKffAI91.js";var ge={exports:{}};(function(se,le){(function(Q,K){se.exports=K()})(globalThis,()=>(()=>{var Q={4567:function(T,r,a){var l=this&&this.__decorate||function(e,t,o,f){var d,p=arguments.length,h=p<3?t:f===null?f=Object.getOwnPropertyDescriptor(t,o):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(e,t,o,f);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(h=(p<3?d(h):p>3?d(t,o,h):d(t,o))||h);return p>3&&h&&Object.defineProperty(t,o,h),h},_=this&&this.__param||function(e,t){return function(o,f){t(o,f,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=a(9042),u=a(9924),v=a(844),g=a(4725),c=a(2585),i=a(3656);let s=r.AccessibilityManager=class extends v.Disposable{constructor(e,t,o,f){super(),this._terminal=e,this._coreBrowserService=o,this._renderService=f,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let d=0;d<this._terminal.rows;d++)this._rowElements[d]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[d]);if(this._topBoundaryFocusListener=d=>this._handleBoundaryFocus(d,0),this._bottomBoundaryFocusListener=d=>this._handleBoundaryFocus(d,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new u.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(d=>this._handleResize(d.rows))),this.register(this._terminal.onRender(d=>this._refreshRows(d.start,d.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(d=>this._handleChar(d))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
2
  `))),this.register(this._terminal.onA11yTab(d=>this._handleTab(d))),this.register(this._terminal.onKey(d=>this._handleKey(d.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
3
3
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const o=this._terminal.buffer,f=o.lines.length.toString();for(let d=e;d<=t;d++){const p=o.lines.get(o.ydisp+d),h=[],m=(p==null?void 0:p.translateToString(!0,void 0,void 0,h))||"",y=(o.ydisp+d+1).toString(),k=this._rowElements[d];k&&(m.length===0?(k.innerText=" ",this._rowColumns.set(k,[0,1])):(k.textContent=m,this._rowColumns.set(k,h)),k.setAttribute("aria-posinset",y),k.setAttribute("aria-setsize",f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const o=e.target,f=this._rowElements[t===0?1:this._rowElements.length-2];if(o.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==f)return;let d,p;if(t===0?(d=o,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(d=this._rowElements.shift(),p=o,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){const h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{const h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var m;if(this._rowElements.length===0)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},o={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(o.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===o.node&&t.offset>o.offset)&&([t,o]=[o,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;const f=this._rowElements.slice(-1)[0];if(o.node.compareDocumentPosition(f)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(o={node:f,offset:((m=f.textContent)==null?void 0:m.length)??0}),!this._rowContainer.contains(o.node))return;const d=({node:y,offset:k})=>{const L=y instanceof Text?y.parentNode:y;let b=parseInt(L==null?void 0:L.getAttribute("aria-posinset"),10)-1;if(isNaN(b))return console.warn("row is invalid. Race condition?"),null;const x=this._rowColumns.get(L);if(!x)return console.warn("columns is null. Race condition?"),null;let A=k<x.length?x[k]:x.slice(-1)[0]+1;return A>=this._terminal.cols&&(++b,A=0),{row:b,column:A}},p=d(t),h=d(o);if(p&&h){if(p.row>h.row||p.row===h.row&&p.column>=h.column)throw new Error("invalid range");this._terminal.select(p.column,p.row,(h.row-p.row)*this._terminal.cols-p.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=s=l([_(1,c.IInstantiationService),_(2,g.ICoreBrowserService),_(3,g.IRenderService)],s)},3614:(T,r)=>{function a(u){return u.replace(/\r?\n/g,"\r")}function l(u,v){return v?"\x1B[200~"+u+"\x1B[201~":u}function _(u,v,g,c){u=l(u=a(u),g.decPrivateModes.bracketedPasteMode&&c.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(u,!0),v.value=""}function n(u,v,g){const c=g.getBoundingClientRect(),i=u.clientX-c.left-10,s=u.clientY-c.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${i}px`,v.style.top=`${s}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=a,r.bracketTextForPaste=l,r.copyHandler=function(u,v){u.clipboardData&&u.clipboardData.setData("text/plain",v.selectionText),u.preventDefault()},r.handlePasteEvent=function(u,v,g,c){u.stopPropagation(),u.clipboardData&&_(u.clipboardData.getData("text/plain"),v,g,c)},r.paste=_,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(u,v,g,c,i){n(u,v,g),i&&c.rightClickSelect(u),v.value=c.selectionText,v.select()}},7239:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const l=a(1505);r.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(_,n,u){this._css.set(_,n,u)}getCss(_,n){return this._css.get(_,n)}setColor(_,n,u){this._color.set(_,n,u)}getColor(_,n){return this._color.get(_,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(a,l,_,n){a.addEventListener(l,_,n);let u=!1;return{dispose:()=>{u||(u=!0,a.removeEventListener(l,_,n))}}}},3551:function(T,r,a){var l=this&&this.__decorate||function(s,e,t,o){var f,d=arguments.length,p=d<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,o);else for(var h=s.length-1;h>=0;h--)(f=s[h])&&(p=(d<3?f(p):d>3?f(e,t,p):f(e,t))||p);return d>3&&p&&Object.defineProperty(e,t,p),p},_=this&&this.__param||function(s,e){return function(t,o){e(t,o,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const n=a(3656),u=a(8460),v=a(844),g=a(2585),c=a(4725);let i=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,o,f){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=o,this._linkProviderService=f,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new u.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new u.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var d;this._lastMouseEvent=void 0,(d=this._activeProviderReplies)==null||d.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;const t=s.composedPath();for(let o=0;o<t.length;o++){const f=t[o];if(f.classList.contains("xterm"))break;if(f.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,e){var o,f;this._activeProviderReplies&&e||((o=this._activeProviderReplies)==null||o.forEach(d=>{d==null||d.forEach(p=>{p.link.dispose&&p.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let t=!1;for(const[d,p]of this._linkProviderService.linkProviders.entries())e?(f=this._activeProviderReplies)!=null&&f.get(d)&&(t=this._checkLinkProviderResult(d,s,t)):p.provideLinks(s.y,h=>{var y,k;if(this._isMouseOut)return;const m=h==null?void 0:h.map(L=>({link:L}));(y=this._activeProviderReplies)==null||y.set(d,m),t=this._checkLinkProviderResult(d,s,t),((k=this._activeProviderReplies)==null?void 0:k.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,e){const t=new Set;for(let o=0;o<e.size;o++){const f=e.get(o);if(f)for(let d=0;d<f.length;d++){const p=f[d],h=p.link.range.start.y<s?0:p.link.range.start.x,m=p.link.range.end.y>s?this._bufferService.cols:p.link.range.end.x;for(let y=h;y<=m;y++){if(t.has(y)){f.splice(d--,1);break}t.add(y)}}}}_checkLinkProviderResult(s,e,t){var d;if(!this._activeProviderReplies)return t;const o=this._activeProviderReplies.get(s);let f=!1;for(let p=0;p<s;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(f=!0);if(!f&&o){const p=o.find(h=>this._linkAtPosition(h.link,e));p&&(t=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let p=0;p<this._activeProviderReplies.size;p++){const h=(d=this._activeProviderReplies.get(p))==null?void 0:d.find(m=>this._linkAtPosition(m.link,e));if(h){t=!0,this._handleNewLink(h);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>{var t,o;return(o=(t=this._currentLink)==null?void 0:t.state)==null?void 0:o.decorations.pointerCursor},set:t=>{var o;(o=this._currentLink)!=null&&o.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>{var t,o;return(o=(t=this._currentLink)==null?void 0:t.state)==null?void 0:o.decorations.underline},set:t=>{var o,f,d;(o=this._currentLink)!=null&&o.state&&((d=(f=this._currentLink)==null?void 0:f.state)==null?void 0:d.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;const o=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,f=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=o&&this._currentLink.link.range.end.y<=f&&(this._clearCurrentLink(o,f),this._lastMouseEvent)){const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._askForLink(d,!1)}})))}_linkHover(s,e,t){var o;(o=this._currentLink)!=null&&o.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){const t=s.range,o=this._bufferService.buffer.ydisp,f=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-o-1,t.end.x,t.end.y-o-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(f)}_linkLeave(s,e,t){var o;(o=this._currentLink)!=null&&o.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){const t=s.range.start.y*this._bufferService.cols+s.range.start.x,o=s.range.end.y*this._bufferService.cols+s.range.end.x,f=e.y*this._bufferService.cols+e.x;return t<=f&&f<=o}_positionFromMouseEvent(s,e,t){const o=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(o)return{x:o[0],y:o[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,o,f){return{x1:s,y1:e,x2:t,y2:o,cols:this._bufferService.cols,fg:f}}};r.Linkifier=i=l([_(1,c.IMouseService),_(2,c.IRenderService),_(3,g.IBufferService),_(4,c.ILinkProviderService)],i)},9042:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(T,r,a){var l=this&&this.__decorate||function(c,i,s,e){var t,o=arguments.length,f=o<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(c,i,s,e);else for(var d=c.length-1;d>=0;d--)(t=c[d])&&(f=(o<3?t(f):o>3?t(i,s,f):t(i,s))||f);return o>3&&f&&Object.defineProperty(i,s,f),f},_=this&&this.__param||function(c,i){return function(s,e){i(s,e,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=a(511),u=a(2585);let v=r.OscLinkProvider=class{constructor(c,i,s){this._bufferService=c,this._optionsService=i,this._oscLinkService=s}provideLinks(c,i){var m;const s=this._bufferService.buffer.lines.get(c-1);if(!s)return void i(void 0);const e=[],t=this._optionsService.rawOptions.linkHandler,o=new n.CellData,f=s.getTrimmedLength();let d=-1,p=-1,h=!1;for(let y=0;y<f;y++)if(p!==-1||s.hasContent(y)){if(s.loadCell(y,o),o.hasExtendedAttrs()&&o.extended.urlId){if(p===-1){p=y,d=o.extended.urlId;continue}h=o.extended.urlId!==d}else p!==-1&&(h=!0);if(h||p!==-1&&y===f-1){const k=(m=this._oscLinkService.getLinkData(d))==null?void 0:m.uri;if(k){const L={start:{x:p+1,y:c},end:{x:y+(h||y!==f-1?0:1),y:c}};let b=!1;if(!(t!=null&&t.allowNonHttpProtocols))try{const x=new URL(k);["http:","https:"].includes(x.protocol)||(b=!0)}catch{b=!0}b||e.push({text:k,range:L,activate:(x,A)=>t?t.activate(x,A,L):g(0,A),hover:(x,A)=>{var P;return(P=t==null?void 0:t.hover)==null?void 0:P.call(t,x,A,L)},leave:(x,A)=>{var P;return(P=t==null?void 0:t.leave)==null?void 0:P.call(t,x,A,L)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=y,d=o.extended.urlId):(p=-1,d=-1)}}i(e)}};function g(c,i){if(confirm(`Do you want to navigate to ${i}?
4
4
 
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TermPane-q4f5Zu0I.js","assets/TermPane-DYP7pi_n.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TermPane-CsxAnPQk.js","assets/TermPane-DYP7pi_n.css"])))=>i.map(i=>d[i]);
2
2
  (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();const Py="modulepreload",Iy=function(e){return"/"+e},Hp={},_y=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),o=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=Iy(c),c in Hp)return;Hp[c]=!0;const d=c.endsWith(".css"),g=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":Py,d||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),d)return new Promise((h,x)=>{f.addEventListener("load",h),f.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(l){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=l,window.dispatchEvent(o),!o.defaultPrevented)throw l}return r.then(l=>{for(const o of l||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function My(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hm={exports:{}},yo={},zm={exports:{}},Ie={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -88,7 +88,7 @@ ${r}`)}return t.global=t.global.trim(),t}function Am(e,t,n,s,r){const{head:i,sub
88
88
 
89
89
  `:`> ${p}
90
90
 
91
- `),we(null),setTimeout(()=>{var j;return(j=vn.current)==null?void 0:j.focus()},60)},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:C("chat.bubbleQuote")})})})]})]})]}):null]})}let Ds=null;const fo=new Set;typeof window<"u"&&(window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),Ds=e,fo.forEach(t=>t())}),window.addEventListener("appinstalled",()=>{Ds=null,fo.forEach(e=>e())}));function T0(){const[e,t]=u.useState(!!Ds),[n,s]=u.useState(!1);return u.useEffect(()=>{var o;const r=()=>t(!!Ds);fo.add(r);const i=[500,1500,3e3,6e3].map(c=>setTimeout(r,c)),l=(o=window.matchMedia)==null?void 0:o.call(window,"(display-mode: standalone)");return s(!!(l!=null&&l.matches)),()=>{fo.delete(r),i.forEach(clearTimeout)}},[]),{available:e,installed:n,prompt:async()=>{if(!Ds)return null;Ds.prompt();const r=await Ds.userChoice;return Ds=null,t(!1),(r==null?void 0:r.outcome)??null}}}function A0(){try{return"serviceWorker"in navigator?navigator.serviceWorker.controller?C("install.swControlled"):C("install.swWaiting"):C("install.swUnsupported")}catch{return"—"}}async function R0(e){try{const t=await fetch(e,{cache:"no-store"});return{status:t.status,type:t.headers.get("content-type")??"",res:t}}catch(t){return{status:0,type:`error: ${t.message}`,res:null}}}async function P0(e){try{const t=await fetch(e,{cache:"no-store"});if(!t.ok)return{ok:!1,why:`HTTP ${t.status}`,w:0,h:0};const n=await t.blob();try{const s=await createImageBitmap(n);return{ok:!0,w:s.width,h:s.height,bytes:n.size,mime:n.type}}catch{const s=URL.createObjectURL(n);try{const r=await new Promise((i,l)=>{const o=new Image;o.onload=()=>i(o),o.onerror=()=>l(new Error("decode")),o.src=s});return{ok:!0,w:r.naturalWidth,h:r.naturalHeight,bytes:n.size,mime:n.type}}catch{return{ok:!1,why:C("diag.decodeError"),w:0,h:0}}finally{URL.revokeObjectURL(s)}}}catch(t){return{ok:!1,why:t.message,w:0,h:0}}}async function I0(){var m;const e=[],t=(v,T,E)=>e.push({label:v,ok:T,detail:E}),n=document.querySelector('link[rel="manifest"]');if(t(C("diag.manifestLink"),!!n,n?n.getAttribute("href"):C("diag.linkMissing")),!n)return e;const s=new URL(n.getAttribute("href"),location.href).href,r=await R0(s);if(t(C("diag.manifestFetch"),r.status===200,`HTTP ${r.status} / ${r.type}`),!r.res||!r.res.ok)return e;let i;try{i=JSON.parse(await r.res.text())}catch(v){return t(C("diag.manifestJson"),!1,v.message),e}t(C("diag.manifestJson"),!0,C("diag.entries",{count:Object.keys(i).length})),t("name",!!i.name,i.name??C("diag.none")),t("short_name",!!i.short_name,i.short_name??C("diag.none"));const l=new URL(i.start_url??".",s).href,o=new URL(i.scope??"./",s).href,c=i.id,d=c==null?null:new URL(c,s).href;t("start_url",!0,l),t("scope",!0,o),t("id",!0,d??C("diag.idUnset")),t(C("diag.startInScope"),l.startsWith(o),`${l} ⊂ ${o}`),t(C("diag.idSameOrigin"),!d||new URL(d).origin===location.origin,d??"-");const g=i.display??"browser",f=["standalone","fullscreen","minimal-ui"].includes(g);t("display",f,g);const h=i.icons??[];t(C("diag.iconCount"),h.length>0,C("diag.iconCountValue",{count:h.length}));let x=!1,b=!1,w=!1;for(const v of h){const T=new URL(v.src,s).href,E=await P0(T),_=v.sizes??"",I=v.purpose??"any",A=Math.max(E.w,E.h);E.ok&&A>=192&&I.split(" ").includes("any")&&(x=!0),E.ok&&A>=512&&I.split(" ").includes("any")&&(b=!0),E.ok&&I.split(" ").includes("maskable")&&(w=!0);const P=!_||_==="any"||_.split(" ").includes(`${E.w}x${E.h}`);t(`icon ${v.src.split("/").pop()}`,E.ok&&P,E.ok?C("diag.iconLine",{w:E.w,h:E.h,bytes:E.bytes,purpose:I,declared:_}):`${E.why}`)}t(C("diag.any192"),x,C(x?"diag.present":"diag.missingInstall")),t(C("diag.any512"),b,C(b?"diag.present":"diag.missingInstall")),t(C("diag.maskable"),w,C(w?"diag.present":"diag.maskableMissing"));const S=(m=navigator.serviceWorker)==null?void 0:m.controller;t(C("diag.swControl"),!!S,S?S.scriptURL:C("diag.swNone"));try{const T=(await navigator.serviceWorker.getRegistrations()).find(E=>l.startsWith(E.scope));t(C("diag.swCovering"),!!T,T?T.scope:C("diag.none"))}catch(v){t(C("diag.swCovering"),!1,v.message)}const k=["standalone","minimal-ui","fullscreen","browser"];return t(C("diag.viewMode"),!0,k.filter(v=>matchMedia(`(display-mode: ${v})`).matches).join(", ")||C("diag.unknown")),t("referrer",!0,document.referrer||C("diag.empty")),t("UA",!0,navigator.userAgent.slice(0,80)),e}const Yv="hm.theme",wa="dark",_0=["dark","light"],M0={dark:"#051319",light:"#f4f7f8"},Jv="(prefers-color-scheme: dark)";function Bo(e){if(e==null)return null;const t=String(e).trim().toLowerCase();return t?t==="system"||t==="auto"?"system":t==="dark"||t==="light"?t:null:null}function L0(e){try{if(typeof window<"u"&&typeof window.matchMedia=="function")return!!window.matchMedia(Jv).matches}catch{}return!0}function O0(e,t){const n=Bo(e)??wa;return n==="system"?(t&&typeof t.systemDark=="boolean"?t.systemDark:L0())?"dark":"light":n}function D0(){try{const e=typeof localStorage>"u"?null:localStorage.getItem(Yv);return Bo(e)??wa}catch{return wa}}let Ai=wa,go="dark";const Yu=new Set;let Ht=null;function $0(){for(const e of[...Yu])try{e(go,Ai)}catch{}}function F0(e){const t=_0.includes(e)?e:"dark";if(typeof document>"u")return t;try{const n=document.documentElement;n.dataset.theme!==t&&(n.dataset.theme=t),n.style.colorScheme!==t&&(n.style.colorScheme=t);const s=document.querySelector('meta[name="theme-color"]'),r=M0[t];s&&s.getAttribute("content")!==r&&s.setAttribute("content",r)}catch{}return t}function Ju(e,t){const n=Bo(e)??wa,s=O0(n,t),r=n!==Ai||s!==go;return Ai=n,go=s,F0(s),r&&!(t!=null&&t.silent)&&$0(),s}function B0(e){const t=Bo(e)??wa;try{typeof localStorage<"u"&&localStorage.setItem(Yv,t)}catch{}return Ju(t),t}function U0(){return Ai}function Ml(){return go}function Dm(e){return Yu.add(e),()=>Yu.delete(e)}function qv(){if(Ju(D0(),{silent:!0}),Ht||typeof window>"u"||typeof window.matchMedia!="function")return()=>{};try{Ht=window.matchMedia(Jv);const e=()=>{Ai==="system"&&Ju("system")};return typeof Ht.addEventListener=="function"?Ht.addEventListener("change",e):typeof Ht.addListener=="function"&&Ht.addListener(e),()=>{try{typeof(Ht==null?void 0:Ht.removeEventListener)=="function"?Ht.removeEventListener("change",e):typeof(Ht==null?void 0:Ht.removeListener)=="function"&&Ht.removeListener(e)}catch{}Ht=null}}catch{return()=>{}}}let Ms=null;function Xv(e,t=globalThis.window){var l,o;const n=Number(t==null?void 0:t.innerWidth)||390,s=Number(t==null?void 0:t.innerHeight)||844,r=Number(e==null?void 0:e.clientX),i=Number(e==null?void 0:e.clientY);if(Number.isFinite(r)&&Number.isFinite(i)&&(r>0||i>0))return{x:Math.round(r),y:Math.round(i)};try{const c=(o=(l=e==null?void 0:e.currentTarget)==null?void 0:l.getBoundingClientRect)==null?void 0:o.call(l);if(c&&c.width>0&&c.height>0)return{x:Math.round(c.left+c.width/2),y:Math.round(c.top+c.height/2)}}catch{}return{x:Math.round(n/2),y:Math.round(s/2)}}function Zv(e,t,n=globalThis.document){var s,r;try{const i=((s=n==null?void 0:n.querySelector)==null?void 0:s.call(n,".shell"))??(n==null?void 0:n.body);if(!i||typeof i.animate!="function")return null;try{(r=Ms==null?void 0:Ms.cancel)==null||r.call(Ms)}catch{}const l=i.animate(e,t);return Ms=l,l.onfinish=()=>{Ms===l&&(Ms=null)},l}catch{return null}}function H0(e,t){var g,f,h,x,b,w;if(gs()===e||Fo()||typeof document>"u")return um(e);const{x:s,y:r}=Xv(t),i=Number((g=globalThis.window)==null?void 0:g.innerWidth)||390,l=Number((f=globalThis.window)==null?void 0:f.innerHeight)||844,o=Math.ceil(Math.hypot(Math.max(s,i-s),Math.max(r,l-r)));let c=e;const d=()=>{c=um(e),c==="dopamine"&&(bt("vibeWarp",{x:s,y:r,sound:!1}),tp("approve"))};if(typeof document.startViewTransition=="function")try{return(w=(b=(x=(h=document.startViewTransition(d).ready)==null?void 0:h.then)==null?void 0:x.call(h,()=>{var k,m,v,T;c==="dopamine"?(m=(k=document.documentElement)==null?void 0:k.animate)==null||m.call(k,{clipPath:[`circle(0px at ${s}px ${r}px)`,`circle(${o}px at ${s}px ${r}px)`]},{duration:420,easing:"cubic-bezier(0.22, 1, 0.36, 1)",pseudoElement:"::view-transition-new(root)"}):(T=(v=document.documentElement)==null?void 0:v.animate)==null||T.call(v,{opacity:[0,1]},{duration:240,easing:"ease-out",pseudoElement:"::view-transition-new(root)"})}))==null?void 0:b.catch)==null||w.call(b,()=>{}),c}catch{}return d(),Zv([{opacity:.78},{opacity:1}],{duration:220,easing:"ease-out"}),c}function z0(e,t,n){var d,g,f,h,x,b;if(typeof t!="function")return;const s=Ml();if(Fo()||typeof document>"u"){t(e);return}const{x:r,y:i}=Xv(n),l=Number((d=globalThis.window)==null?void 0:d.innerWidth)||390,o=Number((g=globalThis.window)==null?void 0:g.innerHeight)||844,c=Math.ceil(Math.hypot(Math.max(r,l-r),Math.max(i,o-i)));if(typeof document.startViewTransition=="function")try{(b=(x=(h=(f=document.startViewTransition(()=>{t(e)}).ready)==null?void 0:f.then)==null?void 0:h.call(f,()=>{var S,k;Ml()!==s&&((k=(S=document.documentElement)==null?void 0:S.animate)==null||k.call(S,{clipPath:[`circle(0px at ${r}px ${i}px)`,`circle(${c}px at ${r}px ${i}px)`]},{duration:340,easing:"cubic-bezier(0.22, 1, 0.36, 1)",pseudoElement:"::view-transition-new(root)"}))}))==null?void 0:x.catch)==null||b.call(x,()=>{});return}catch{}t(e),Ml()!==s&&Zv([{opacity:.76},{opacity:1}],{duration:220,easing:"ease-out"})}const $m=8;function W0(e,{limit:t=$m,expanded:n=!1}={}){const s=Array.isArray(e)?e:[],r=Number.isFinite(t)&&t>0?Math.floor(t):$m,i=Math.max(0,s.length-r),l=i>0;return{visible:l&&n?s:s.slice(0,r),hiddenCount:i,canExpand:l,expanded:l&&!!n}}function V0(){const e=u.useSyncExternalStore(Dm,U0,()=>"dark"),t=u.useSyncExternalStore(Dm,Ml,()=>"dark"),n=u.useCallback(s=>{B0(s)},[]);return{pref:e,resolved:t,setPref:n}}function K0({notify:e,board:t=""}){var m,v,T;const{t:n}=Fe(),[s,r]=u.useState(null),[i,l]=u.useState(!1),[o,c]=u.useState(null),[d,g]=u.useState(!1),[f,h]=u.useState(null),x=u.useCallback(async()=>{try{const E=await Y("/api/pipeline/status");E!=null&&E.ok?(r(E),l(!1)):l(!0)}catch{l(!0)}try{const E=t?`?board=${encodeURIComponent(t)}`:"",_=await Y(`/api/architect/jobs${E}`);_!=null&&_.ok&&c(_)}catch{c(null)}},[t]);u.useEffect(()=>{x()},[x]);const b=u.useCallback(async()=>{if(!d){g(!0),h(null),H("action");try{const E=await Y("/api/pipeline/optimize",{method:"POST",body:{}});E!=null&&E.ok?(r(E.status??s),e==null||e(n("settings.pipelineOptimized"))):h((E==null?void 0:E.error)??n("settings.pipelineUnavailable"))}catch(E){h((E==null?void 0:E.code)==="UNKNOWN_ENDPOINT"?n("settings.pipelineUnavailable"):(E==null?void 0:E.message)??"")}finally{g(!1),x()}}},[d,x,e,s,n]),w=!!((m=s==null?void 0:s.soul)!=null&&m.applied),S=Array.isArray((v=s==null?void 0:s.hermes)==null?void 0:v.present)?s.hermes.present.length:0,k=Array.isArray((T=s==null?void 0:s.bundled)==null?void 0:T.names)?s.bundled.names.length:0;return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"row-sub",style:{marginBottom:10,lineHeight:1.6},children:n("settings.pipelineLead")}),a.jsxs("div",{className:"kv",style:{alignItems:"center"},children:[a.jsx("span",{children:n("settings.pipelineRunner")}),a.jsx("span",{className:"pill on",children:n("seed.runnerHermes")})]}),a.jsx("p",{className:"row-sub",style:{margin:"6px 0 10px",lineHeight:1.6},children:n("settings.pipelineRunnerHint")}),i?a.jsx("p",{className:"row-sub",style:{marginBottom:10,lineHeight:1.6},children:n("settings.pipelineUnavailable")}):a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineSoul")}),a.jsx("b",{children:n(w?"settings.pipelineApplied":"settings.pipelineMissing")})]}),k?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineSkills")}),a.jsxs("b",{children:[S,"/",k]})]}):null,o?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineJobs")}),a.jsx("b",{children:Array.isArray(o.jobs)?o.jobs.length:0})]}):null,o&&Array.isArray(o.pending)?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelinePending")}),a.jsx("b",{children:o.pending.length})]}):null,a.jsx("button",{type:"button",className:"seed-submit",style:{marginTop:10},disabled:d||i,onClick:b,children:n(d?"settings.pipelineOptimizing":"settings.pipelineOptimize")}),f?a.jsx("div",{className:"seed-error",style:{marginTop:8},children:f}):null]})}function Q0(){var e,t;try{return(document.referrer||"").startsWith("android-app://")?"webapk":((t=(e=window.matchMedia)==null?void 0:e.call(window,"(display-mode: standalone)"))==null?void 0:t.matches)?"standalone":"browser"}catch{return"unknown"}}const G0=[{value:"auto",key:"settings.languageAuto"},...dk.map(e=>({value:e,key:e==="ja"?"settings.languageJa":"settings.languageEn"}))],Y0=[{value:"dark",key:"settings.themeDark"},{value:"light",key:"settings.themeLight"},{value:"system",key:"settings.themeSystem"}],J0=[{value:"dopamine",key:"settings.vibeDopamine"},{value:"serotonin",key:"settings.vibeSerotonin"}],q0=[{id:"chat",key:"settings.barChat"},{id:"annotation",key:"settings.barAnnotation"},{id:"term",key:"settings.barTerm"}];function X0({rows:e,margin:t=4,size:n=300}){const s=ze.useRef(null);return u.useEffect(()=>{const r=s.current;if(!r||!(e!=null&&e.length))return;const i=e.length+t*2,l=Math.max(2,Math.floor(n/i)),o=Math.min(3,window.devicePixelRatio||1),c=i*l,d=Math.round(l*o);r.width=c*o,r.height=c*o,r.style.width=`${c}px`,r.style.height=`${c}px`;const g=r.getContext("2d");g.imageSmoothingEnabled=!1,g.fillStyle="#ffffff",g.fillRect(0,0,r.width,r.height),g.fillStyle="#000000";for(let f=0;f<e.length;f+=1)for(let h=0;h<e[f].length;h+=1)e[f][h]==="1"&&g.fillRect((h+t)*d,(f+t)*d,d,d)},[e,t,n]),a.jsx("canvas",{ref:s,className:"pair-qr-canvas",role:"img","aria-label":"Pairing QR"})}function Z0({notify:e,lang:t}){const{t:n}=Fe(),[s,r]=u.useState("chat"),[i,l]=u.useState({chat:null,term:null}),[o,c]=u.useState({label:"",text:"",hot:!1,run:!0}),[d,g]=u.useState(null),[f,h]=u.useState(!1),x=s==="term"?"/api/snippets/term":"/api/snippets",b=s==="term"?"hm:term-snippets":"hm:snippets",w=i[s],S=(w==null?void 0:w.overrides)??{},k=(w==null?void 0:w.custom)??[],m=(w==null?void 0:w.customMax)??16,v=((w==null?void 0:w.allSnippets)??[]).filter(D=>!D.custom),T=((w==null?void 0:w.allSnippets)??[]).filter(D=>D.custom),E=u.useCallback(async()=>{try{const D=await Y(`${x}?lang=${encodeURIComponent(t)}`);l(X=>({...X,[s]:D}))}catch(D){e(D.message)}},[x,s,t,e]);u.useEffect(()=>{E()},[E]);const _=u.useCallback(async(D,X)=>{h(!0);try{const ge=await Y(x,{method:"PUT",body:D});return l(Z=>({...Z,[s]:ge})),window.dispatchEvent(new Event(b)),X&&e(X),!0}catch(ge){return e(ge.message),!1}finally{h(!1)}},[x,s,b,e]),I=D=>_({overrides:{...S,[D.id]:{...S[D.id]??{},hot:!D.hot}}}),A=D=>_({overrides:{...S,[D.id]:{...S[D.id]??{},hidden:!D.hidden}}}),P=(D,X)=>_({custom:D},X),y=D=>P(k.map(X=>X.id===D.id?{...X,hot:!X.hot}:X)),K=async()=>{const D=o.label.trim(),X=o.text.trim();if(!D||!X)return e(n("settings.needNameAndText"));if(k.length>=m)return e(n("settings.snippetLimit",{max:m}));const ge={label:D,text:X,hot:o.hot};s==="term"&&(ge.run=o.run),await P([...k,ge],n("settings.saved"))&&c({label:"",text:"",hot:!1,run:!0})},$=async()=>{if(!d)return;const D=d.label.trim(),X=d.text.trim();if(!D||!X)return e(n("settings.needNameAndText"));const ge=k.map(G=>G.id===d.id?{...G,label:D,text:X,hot:d.hot,...s==="term"?{run:d.run}:{}}:G);await P(ge,n("settings.saved"))&&g(null)},V=async()=>{h(!0);try{const[D,X]=await Promise.all([Y("/api/snippets",{method:"PUT",body:{reset:!0}}),Y("/api/snippets/term",{method:"PUT",body:{reset:!0}})]);l({chat:D,term:X}),g(null),c({label:"",text:"",hot:!1,run:!0}),window.dispatchEvent(new Event("hm:snippets")),window.dispatchEvent(new Event("hm:term-snippets")),e(n("settings.snippetResetDone"))}catch(D){e(D.message)}finally{h(!1)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"settings-card-head",children:[a.jsx("span",{className:"settings-card-icon","aria-hidden":"true",children:"⚡"}),a.jsx("span",{className:"settings-card-title",children:n("settings.snippets")}),a.jsx("span",{className:"settings-card-action",children:a.jsx("button",{className:"link",disabled:f,onClick:V,children:n("settings.snippetReset")})})]}),a.jsxs("div",{className:"chips",role:"group","aria-label":n("settings.snippets"),style:{marginBottom:10},children:[a.jsx("button",{className:`chip${s==="chat"?" on":""}`,onClick:()=>r("chat"),children:n("settings.snippetChat")}),a.jsx("button",{className:`chip${s==="term"?" on":""}`,onClick:()=>r("term"),children:n("settings.snippetTerm")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:n("settings.snippetBuiltin")})}),a.jsxs("div",{className:"list",children:[v.map(D=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.label}),a.jsx("span",{className:"row-sub",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.text.replace(/\n/g," ")})]}),a.jsx("button",{className:`chip${D.hot?" on":""}`,disabled:f,onClick:()=>I(D),"aria-label":`${n("settings.snippetHot")} ${D.label}`,children:n("settings.snippetHot")}),a.jsx("button",{className:`chip${D.hidden?"":" on"}`,disabled:f,onClick:()=>A(D),"aria-label":`${D.hidden?n("settings.snippetShow"):n("settings.snippetHide")} ${D.label}`,children:D.hidden?n("settings.snippetShow"):n("settings.snippetHide")})]},D.id)),v.length?null:a.jsx("div",{className:"empty",children:n("settings.snippetsEmpty")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:n("settings.customSnippets",{count:k.length,max:m})})}),a.jsxs("div",{className:"list",children:[T.map(D=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsxs("span",{className:"row-title",children:[D.label,D.hot?a.jsx("span",{className:"pill",style:{marginLeft:8},children:n("settings.bar")}):null,s==="term"&&D.run?a.jsx("span",{className:"pill",style:{marginLeft:6},children:n("term.run")}):null,D.hidden?a.jsx("span",{className:"pill",style:{marginLeft:6},children:n("settings.snippetHiddenPill")}):null]}),a.jsx("span",{className:"row-sub",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.text.replace(/\n/g," ")})]}),a.jsx("button",{className:"link",disabled:f,onClick:()=>y(D),children:n("settings.snippetHot")}),a.jsx("button",{className:"link",disabled:f,onClick:()=>g({id:D.id,label:D.label,text:D.text,hot:D.hot,run:D.run!==!1}),children:n("settings.snippetEdit")}),a.jsx("button",{className:"link",disabled:f,onClick:()=>P(k.filter(X=>X.id!==D.id)),children:n("settings.delete")})]},D.id)),T.length?null:a.jsx("div",{className:"empty",children:n("settings.snippetsEmpty")})]}),d?a.jsxs("div",{className:"card",style:{marginTop:10},children:[a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:n("settings.snippetEditTitle")}),a.jsx("input",{className:"inp",placeholder:n("settings.snippetNamePlaceholder"),maxLength:20,value:d.label,onChange:D=>g({...d,label:D.target.value})}),a.jsx("textarea",{className:"inp",placeholder:n(s==="term"?"settings.snippetCommandPlaceholder":"settings.snippetTextPlaceholder"),rows:3,maxLength:400,value:d.text,onChange:D=>g({...d,text:D.target.value}),style:{marginTop:8,resize:"vertical",fontFamily:"inherit"}}),a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:10},children:[a.jsx("input",{type:"checkbox",checked:d.hot,onChange:D=>g({...d,hot:D.target.checked})}),n("settings.showInBar")]}),s==="term"?a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[a.jsx("input",{type:"checkbox",checked:d.run,onChange:D=>g({...d,run:D.target.checked})}),n("settings.snippetRun")]}):null,a.jsxs("div",{className:"row",style:{marginTop:10},children:[a.jsx("button",{className:"btn",disabled:f,onClick:$,children:n("settings.snippetSave")}),a.jsx("button",{className:"link",style:{marginLeft:10},onClick:()=>g(null),children:n("settings.snippetCancel")})]})]}):null,a.jsxs("div",{className:"card",style:{marginTop:10},children:[a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:n("settings.snippetAddTitle")}),a.jsx("input",{className:"inp",placeholder:n("settings.snippetNamePlaceholder"),maxLength:20,value:o.label,onChange:D=>c({...o,label:D.target.value})}),a.jsx("textarea",{className:"inp",placeholder:n(s==="term"?"settings.snippetCommandPlaceholder":"settings.snippetTextPlaceholder"),rows:3,maxLength:400,value:o.text,onChange:D=>c({...o,text:D.target.value}),style:{marginTop:8,resize:"vertical",fontFamily:"inherit"}}),a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:10},children:[a.jsx("input",{type:"checkbox",checked:o.hot,onChange:D=>c({...o,hot:D.target.checked})}),n("settings.showInBar")]}),s==="term"?a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[a.jsx("input",{type:"checkbox",checked:o.run,onChange:D=>c({...o,run:D.target.checked})}),n("settings.snippetRun")]}):null,a.jsx("button",{className:"btn",onClick:K,disabled:f||k.length>=m,style:{marginTop:10},children:n(f?"settings.saving":"settings.snippetAdd")})]}),a.jsx("div",{className:"row-sub",style:{padding:"10px 6px 0",lineHeight:1.7},children:n("settings.snippetHint")})]})}const eN=[{id:"sec-appearance",icon:"🎨",key:"settings.secAppearance"},{id:"sec-pairing",icon:"📱",key:"settings.secPairing"},{id:"sec-snippets",icon:"⚡",key:"settings.secSnippets"},{id:"sec-pipeline",icon:"🏗️",key:"settings.secPipeline"},{id:"sec-repos",icon:"📁",key:"settings.secRepos"},{id:"sec-audit",icon:"🛡️",key:"settings.secAudit"},{id:"sec-status",icon:"🩺",key:"settings.secStatus"}];function Br({icon:e,title:t,action:n}){return a.jsxs("div",{className:"settings-card-head",children:[a.jsx("span",{className:"settings-card-icon","aria-hidden":"true",children:e}),a.jsx("span",{className:"settings-card-title",children:t}),n?a.jsx("span",{className:"settings-card-action",children:n}):null]})}function tN({overview:e,notify:t,refresh:n}){var He,$t,wt,Tt;const{lang:s,t:r,pref:i,setPref:l}=Fe(),{pref:o,setPref:c}=V0(),d=T0(),[g,f]=u.useState(null),[h,x]=u.useState(!1),[b,w]=u.useState(null),[S,k]=u.useState(!1),[m,v]=u.useState(null),[T,E]=u.useState("gateway"),[_,I]=u.useState([]),[A,P]=u.useState(()=>Xd()),[y,K]=u.useState(()=>gs()),[$,V]=u.useState(()=>ep()),[D,X]=u.useState(()=>Sa());u.useEffect(()=>hv(K),[]);const[ge,Z]=u.useState([]),[G,q]=u.useState([]),[ce,te]=u.useState(""),[pe,ve]=u.useState(""),[xe,Oe]=u.useState(!1),[Ae,et]=u.useState(null),[We,Dt]=u.useState(!1),ht=u.useCallback(async()=>{H("tap"),Dt(!0);try{const F=await Y("/api/auth/pairing");et(F)}catch(F){t==null||t(F.message)}finally{Dt(!1)}},[t]),ct=u.useCallback(async F=>{try{await navigator.clipboard.writeText(F),t==null||t(r("settings.pairingCopied"))}catch{t==null||t(F)}},[t,r]),yt=u.useCallback(async()=>{try{const F=await Y("/api/repos");return Z(Array.isArray(F==null?void 0:F.repos)?F.repos:[]),q(Array.isArray(F==null?void 0:F.scanDirs)?F.scanDirs:[]),!0}catch(F){return t(F.message),!1}},[t]),Ge=u.useCallback(async({method:F="POST",path:_e="/api/repos",body:Nt,done:Kn})=>{Oe(!0);try{const mt=await Y(_e,{method:F,body:Nt});return Z(Array.isArray(mt==null?void 0:mt.repos)?mt.repos:[]),Array.isArray(mt==null?void 0:mt.scanDirs)&&q(mt.scanDirs),t(Kn),!0}catch(mt){return t(mt.message),!1}finally{Oe(!1)}},[t]),$e=u.useCallback(async()=>{try{const F=await Y("/api/audit?lines=80");return w(F.lines??[]),!0}catch(F){return t(F.message),!1}},[t]);u.useEffect(()=>{$e(),yt(),Y("/api/sessions?limit=5").then(F=>I(F.sessions??[])).catch(()=>{})},[$e,yt]);const M=async F=>{try{const _e=await Y(`/api/logs?file=${encodeURIComponent(F)}&lines=200`);v({name:_e.file,text:_e.text})}catch(_e){t(_e.message)}},W=u.useCallback(F=>{var Nt;H("tap");const _e=typeof document<"u"?document.getElementById(F):null;(Nt=_e==null?void 0:_e.scrollIntoView)==null||Nt.call(_e,{behavior:"smooth",block:"start"})},[]),L=(He=e==null?void 0:e.system)==null?void 0:He.memory,se=($t=e==null?void 0:e.system)==null?void 0:$t.disk,ue=e==null?void 0:e.bridge,U=e==null?void 0:e.kanban,ee=Array.isArray(b)?b.slice().reverse():[],we=W0(ee,{expanded:S}),ut=Q0(),Ee=ut==="standalone"?r("settings.standalone"):ut==="browser"?r("settings.browser"):ut==="webapk"?"WebAPK":"—";return a.jsxs("div",{className:"pane center-readable",children:[a.jsx("nav",{className:"settings-nav","aria-label":r("settings.sections"),children:eN.map(F=>a.jsxs("button",{type:"button",className:"settings-nav-chip",onClick:()=>W(F.id),children:[a.jsx("span",{"aria-hidden":"true",children:F.icon}),a.jsx("span",{children:r(F.key)})]},F.id))}),a.jsxs("section",{id:"sec-appearance",className:"card settings-card",children:[a.jsx(Br,{icon:"🎨",title:r("settings.secAppearance")}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.language")})}),a.jsx("div",{className:"chips",style:{marginBottom:10},children:G0.map(F=>a.jsx("button",{type:"button",className:`chip${i===F.value?" on":""}`,"aria-pressed":i===F.value,onClick:()=>{H("tap"),l(F.value)},children:r(F.key)},F.value))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.theme")})}),a.jsx("div",{className:"chips",style:{marginBottom:10},role:"group","aria-label":r("settings.theme"),children:Y0.map(F=>a.jsx("button",{type:"button",className:`chip${o===F.value?" on":""}`,"aria-pressed":o===F.value,onClick:_e=>{H("tap"),z0(F.value,c,_e)},children:r(F.key)},F.value))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.vibe")})}),a.jsx("div",{className:"chips",style:{marginBottom:6},role:"group","aria-label":r("settings.vibe"),children:J0.map(F=>a.jsx("button",{type:"button",className:`chip vibe-chip${y===F.value?" on":""}`,"aria-pressed":y===F.value,onClick:_e=>{H("tap");const Nt=H0(F.value,_e);K(Nt),t==null||t(r("settings.vibeSwitched",{mode:r(F.key)}))},children:r(F.key)},F.value))}),a.jsx("p",{className:"row-sub",style:{marginBottom:8,lineHeight:1.6},children:r("settings.vibeHint")}),a.jsxs("div",{className:"kv",style:{alignItems:"center"},children:[a.jsx("span",{children:r("settings.haptics")}),a.jsx("button",{type:"button",role:"switch","aria-checked":A,"aria-label":r("settings.haptics"),className:`hm-switch${A?" on":""}`,onClick:()=>{const F=Gk(!A);P(F),F&&H("tap")},children:a.jsx("span",{className:"hm-switch-knob"})})]}),a.jsxs("div",{className:"kv",style:{alignItems:"center",marginTop:8},children:[a.jsxs("span",{children:[r("settings.sound"),a.jsx("span",{className:"row-sub",style:{display:"block",lineHeight:1.5,marginTop:2},children:r("settings.soundHint")})]}),a.jsx("button",{type:"button",role:"switch","aria-checked":$,"aria-label":r("settings.sound"),className:`hm-switch${$?" on":""}`,onClick:()=>{const F=eb(!$);V(F),H("tap"),F&&tp("approve")},children:a.jsx("span",{className:"hm-switch-knob"})})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.bars")})}),q0.map(F=>a.jsxs("div",{className:"kv",style:{alignItems:"center",marginTop:8},children:[a.jsx("span",{children:r(F.key)}),a.jsx("button",{type:"button",role:"switch","aria-checked":D[F.id]!==!1,"aria-label":r(F.key),"data-bar":F.id,className:`hm-switch${D[F.id]!==!1?" on":""}`,onClick:()=>{H("tap"),X(CS(F.id,D[F.id]===!1))},children:a.jsx("span",{className:"hm-switch-knob"})})]},F.id)),a.jsx("p",{className:"row-sub",style:{marginTop:8,marginBottom:0,lineHeight:1.6},children:r("settings.barsHint")})]}),a.jsxs("section",{id:"sec-pairing",className:"card settings-card",children:[a.jsx(Br,{icon:"📱",title:r("settings.secPairing")}),a.jsx("div",{className:"row-sub",style:{marginTop:8,lineHeight:1.6},children:r("settings.pairingHint")}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:10},disabled:We,onClick:ht,children:[We?a.jsx(hn,{size:14}):null,a.jsx("span",{children:r(We?"settings.pairingLoading":"settings.showPairingQr")})]})]}),a.jsx("section",{id:"sec-snippets",className:"card settings-card",children:a.jsx(Z0,{notify:t,lang:s})}),a.jsxs("section",{id:"sec-pipeline",className:"card settings-card",children:[a.jsx(Br,{icon:"🏗️",title:r("settings.secPipeline")}),a.jsx(K0,{notify:t,board:(()=>{try{return localStorage.getItem(_v)??""}catch{return""}})()})]}),a.jsxs("section",{id:"sec-repos",className:"card settings-card",children:[a.jsx(Br,{icon:"📁",title:r("settings.repos",{count:ge.length}),action:a.jsx("button",{className:"link",disabled:xe,onClick:async()=>{H("tap"),await Ge({path:"/api/repos/scan",done:r("settings.rescanned")})},children:r("settings.rescan")})}),a.jsxs("div",{className:"list",children:[ge.map(F=>{var _e;return a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsxs("span",{className:"row-title",children:[F.label,F.source==="custom"?a.jsx("span",{className:"pill",style:{marginLeft:8},children:r("settings.manual")}):null]}),a.jsx("span",{className:"row-sub",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r("settings.repoLine",{path:F.path,source:F.source,count:((_e=F.boards)==null?void 0:_e.length)??0})})]}),a.jsx("button",{className:"link",disabled:xe,onClick:()=>Ge({method:"DELETE",path:`/api/repos/${encodeURIComponent(F.id)}`,done:r("settings.hidden")}),children:r("settings.hide")})]},F.id)}),ge.length?null:a.jsx("div",{className:"empty",children:r("settings.reposEmpty")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.scanDirs")})}),a.jsxs("div",{className:"list",children:[G.map(F=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:"row-main",style:{minWidth:0},children:a.jsx("span",{className:"row-title mono",children:F})}),a.jsx("button",{className:"link",disabled:xe,onClick:()=>Ge({body:{scanDirs:G.filter(_e=>_e!==F)},done:r("settings.removed")}),children:r("settings.delete")})]},F)),G.length?null:a.jsx("div",{className:"empty",children:r("settings.scanDirsEmpty")})]}),a.jsx("input",{className:"inp",style:{marginTop:10},placeholder:r("settings.scanDirPlaceholder"),maxLength:200,value:ce,onChange:F=>te(F.target.value)}),a.jsx("button",{className:"btn",disabled:xe||!ce.trim(),style:{marginTop:8},onClick:async()=>{const F=[...G,ce.trim()];await Ge({body:{scanDirs:F},done:r("settings.scanDirAdded")})&&te("")},children:r("settings.addScanDir")}),a.jsx("input",{className:"inp",placeholder:r("settings.repoPathPlaceholder"),maxLength:300,value:pe,onChange:F=>ve(F.target.value),style:{marginTop:8}}),a.jsx("button",{className:"btn",disabled:xe||!pe.trim(),style:{marginTop:8},onClick:async()=>{await Ge({body:{path:pe.trim()},done:r("settings.repoAdded")})&&ve("")},children:r("settings.addRepo")})]}),a.jsxs("section",{id:"sec-audit",className:"card settings-card",children:[a.jsx(Br,{icon:"🛡️",title:r("settings.secAudit"),action:a.jsx(Xs,{variant:"link",onRefresh:$e})}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.logs")})}),a.jsx("div",{className:"row",children:["gateway","errors","agent"].map(F=>a.jsxs("button",{className:"chip",onClick:()=>{H("tap"),M(F)},style:{marginRight:6},children:[F,".log"]},F))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.audit")})}),a.jsxs("div",{className:"list",children:[we.visible.map((F,_e)=>a.jsx("div",{className:"row static",children:a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:F.kind}),a.jsxs("span",{className:"row-sub",children:[Lo(F.at),F.task?` ・ ${F.task}`:"",F.action?` ・ ${F.action}`:"",F.ok===!1?` ・ ${r("settings.auditFailed")}`:""]})]})},`${F.at??"x"}-${F.kind??""}-${_e}`)),we.visible.length?null:a.jsx("div",{className:"empty",children:r("settings.auditEmpty")})]}),we.canExpand?a.jsx("button",{type:"button",className:"btn settings-audit-more","aria-expanded":we.expanded,style:{marginTop:8},onClick:()=>{H("tap"),k(F=>!F)},children:we.expanded?r("settings.auditCollapse"):r("settings.auditShowMore",{count:we.hiddenCount})}):null]}),a.jsxs("section",{id:"sec-status",className:"card settings-card",children:[a.jsx(Br,{icon:"🩺",title:r("settings.secStatus")}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Hermes"}),a.jsx("b",{children:((wt=e==null?void 0:e.hermes)==null?void 0:wt.version)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.model")}),a.jsx("b",{children:((Tt=e==null?void 0:e.hermes)==null?void 0:Tt.model)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.memory")}),a.jsx("b",{children:L?r("settings.memoryValue",{used:Tl(L.used),total:Tl(L.total),percent:L.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.disk")}),a.jsx("b",{children:se?r("settings.diskValue",{free:Tl(se.free),percent:se.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.bridge")}),a.jsx("b",{className:(ue==null?void 0:ue.ok)===!1?"bad-text":"",children:ue?ue.ok?r("settings.bridgeOk",{uptime:ue.uptimeSec}):r("settings.disconnected"):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.reviewWaiting")}),a.jsx("b",{children:U?r("settings.kanbanValue",{waiting:U.reviewWaiting,running:U.running}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.lastChecked")}),a.jsx("b",{children:tt(e==null?void 0:e.checkedAt)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.launchSource")}),a.jsx("b",{children:Ee})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.installability")}),a.jsx("b",{children:d.available?r("settings.installPossible"):d.installed?r("settings.installDone"):r("settings.installNo")})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Service Worker"}),a.jsx("b",{children:A0()})]}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:8},disabled:h,"aria-busy":h,onClick:async()=>{H("tap"),x(!0);try{const F=await I0();f(F),Y("/api/client-error",{method:"POST",body:{kind:"pwa-diag",href:location.href,referrer:document.referrer||"",displayMode:["standalone","minimal-ui","fullscreen","browser"].filter(_e=>matchMedia(`(display-mode: ${_e})`).matches).join(","),rows:F}}).catch(()=>{})}finally{x(!1)}},children:[h?a.jsx(hn,{size:14}):null,a.jsx("span",{children:r(h?"settings.diagRunning":"settings.diagRun")})]}),g&&a.jsx("div",{className:"diag",style:{marginTop:10,fontSize:12,lineHeight:1.5},children:g.map(F=>a.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0"},children:[a.jsx("span",{style:{color:F.ok?"var(--good)":"var(--bad)",flex:"0 0 auto"},children:F.ok?"✓":"✗"}),a.jsx("span",{style:{flex:"1 1 auto",color:F.ok?"var(--text)":"var(--danger-fg)"},children:F.label}),a.jsx("span",{style:{flex:"1 1 50%",color:"var(--muted)",wordBreak:"break-all",textAlign:"right"},children:F.detail})]},F.label))}),d.available&&a.jsx("button",{className:"btn primary",style:{marginTop:8},onClick:async()=>{const F=await d.prompt();t==null||t(r(F==="accepted"?"settings.installPromptAccepted":"settings.installPromptCancelled"))},children:r("settings.installApp")}),a.jsx(Xs,{label:r("settings.refresh"),ariaLabel:r("settings.refreshAria"),className:"hm-btn-inner",onRefresh:async()=>!!await(n==null?void 0:n())}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.recentSessions")})}),a.jsxs("div",{className:"list",children:[_.map(F=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:`dot ${F.active?"running":"done"}`}),a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:F.title??F.id}),a.jsxs("span",{className:"row-sub",children:[F.source," ・ ",F.messages," msg ・ ",F.lastActivity??""]})]})]},F.id)),_.length?null:a.jsx("div",{className:"empty",children:r("settings.none")})]}),a.jsxs("div",{className:"row-sub",style:{padding:"10px 0 0",lineHeight:1.7},children:[r("settings.about",{version:"0.2.2"})," ",a.jsx("span",{className:"mono",children:"~/.hermes/plugin-data/hermes-pilot/token"})]})]}),m?a.jsx(Qe,{title:m.name,onClose:()=>v(null),children:a.jsx("pre",{className:"logbox",children:m.text})}):null,Ae?a.jsxs(Qe,{title:r("settings.pairingTitle"),onClose:()=>et(null),children:[a.jsx("div",{className:"row-sub",style:{lineHeight:1.6},children:r("settings.pairingScanHint")}),Ae.qrPng?a.jsx("div",{className:"pair-qr",children:a.jsx("img",{className:"pair-qr-img",src:Ae.qrPng,width:287,height:287,alt:"Pairing QR"})}):Ae.qrRows?a.jsx("div",{className:"pair-qr",children:a.jsx(X0,{rows:Ae.qrRows,margin:Ae.qrMargin??4,size:Math.min(320,Math.max(220,(typeof window<"u"?window.innerWidth:390)-70))})}):Ae.qrSvg?a.jsx("div",{className:"pair-qr",dangerouslySetInnerHTML:{__html:Ae.qrSvg}}):a.jsx("div",{className:"empty",children:r("settings.pairingEmpty")}),a.jsx("div",{className:"list",style:{marginTop:10},children:(Ae.targets??[]).map(F=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:F.label}),a.jsx("span",{className:"row-sub mono",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F.url})]}),a.jsx("button",{className:"link",onClick:()=>ct(F.url),children:r("settings.pairingCopy")})]},F.url))}),a.jsx("div",{className:"row-sub",style:{marginTop:10,lineHeight:1.6},children:r("settings.pairingNote")})]}):null]})}function nN({onClose:e,onOpenSession:t,notify:n}){const{t:s}=Fe(),[r,i]=u.useState(""),[l,o]=u.useState(null),[c,d]=u.useState(!1),g=u.useRef(null),f=u.useRef(0);u.useEffect(()=>{const b=setTimeout(()=>{var w;return(w=g.current)==null?void 0:w.focus()},120);return()=>clearTimeout(b)},[]);const h=u.useCallback(async b=>{const w=b.trim();if(!w){o(null);return}const S=++f.current;d(!0);try{const k=await Y(`/api/search?q=${encodeURIComponent(w)}&limit=30`);S===f.current&&o(k)}catch(k){S===f.current&&(o({ok:!1,reason:k.message,hits:[]}),n==null||n(k.message))}finally{S===f.current&&d(!1)}},[n]);u.useEffect(()=>{const b=setTimeout(()=>h(r),280);return()=>clearTimeout(b)},[r,h]);const x=(l==null?void 0:l.hits)??[];return a.jsxs(Qe,{title:s("search.title"),onClose:e,children:[a.jsx("input",{ref:g,className:"inp",value:r,onChange:b=>i(b.target.value),placeholder:s("search.placeholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,inputMode:"search",enterKeyHint:"search"}),a.jsx("div",{className:"row-sub",style:{padding:"8px 4px 4px",display:"flex",alignItems:"center",gap:6},children:c?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12}),a.jsx("span",{children:s("search.searching")})]}):l!=null&&l.ok?s("search.resultCount",{count:x.length,ms:Math.round(l.tookMs)}):(l==null?void 0:l.reason)??s("search.hint")}),a.jsxs("div",{className:"list",children:[x.map(b=>a.jsx("button",{className:"list-item",onClick:()=>{H("tap"),t==null||t(b),e==null||e()},children:a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsx("span",{className:"row-title",style:{fontSize:12.5},children:b.snippet||s("search.emptySnippet")}),a.jsxs("span",{className:"row-sub",children:[b.role==="user"?s("search.you"):b.role==="assistant"?"Hermes":b.role,` ・ ${tt(b.at)}`,b.sessionTitle?` ・ ${String(b.sessionTitle).slice(0,28)}`:"",b.profile&&b.profile!=="default"?` ・ ${b.profile}`:"",b.source?` ・ ${b.source}`:""]})]})},`${b.profile??"default"}:${b.messageId}`)),!c&&(l!=null&&l.ok)&&!x.length?a.jsx("div",{className:"empty",children:s("search.none")}):null]}),a.jsx("div",{className:"row-sub",style:{padding:"12px 4px 18px",lineHeight:1.7},children:s("search.note")})]})}const sN=["title","body","tagsText","color","pinned","checklist"],Ri=e=>e==null?"":String(e);function ey(e){return Array.isArray(e)?e.map(t=>({id:Ri(t==null?void 0:t.id),text:Ri(t==null?void 0:t.text),done:!!(t!=null&&t.done)})):[]}function qu(e){const t=e??{},n={};for(const s of sN)s==="checklist"?n[s]=ey(t.checklist):s==="pinned"?n[s]=!!t.pinned:n[s]=Ri(t[s]);return JSON.stringify(n)}function Xu(e){return e?Ri(e.title).trim()||Ri(e.body).trim()?!0:ey(e.checklist).length>0:!1}function rN(e,t){if(!e)return!1;if(t==null||t==="")return Xu(e);const n=typeof t=="string"?t:qu(t);return qu(e)!==n}function ty(e){return e==="list"}function Fm(e){return!ty(e)}function aN(e,t={}){var r;const n=t.canOpenChat!==!1,s=[{action:"pin",labelKey:e!=null&&e.pinned?"notes.unpin":"notes.pin"},{action:"brainstorm",labelKey:"notes.brainstorm"},{action:"seed",labelKey:"notes.toSeed"}];return n&&((r=e==null?void 0:e.source)!=null&&r.chatId)&&s.push({action:"chat",labelKey:"notes.openChat"}),s}const ny="hm.memosView",sy=["one","two","list"],Zu="two";function iN(e){const t=typeof e=="string"?e.trim():"";return sy.includes(t)?t:Zu}function lN(e,t){if(!e||typeof e.setItem!="function"||!sy.includes(t))return!1;try{return e.setItem(ny,t),!0}catch{return!1}}const oN=3;function cN(e=[],t,n=oN){const s=Array.isArray(e)?e:[];return t!=="two"||s.length<=n?{visible:s,hidden:0}:{visible:s.slice(0,n),hidden:s.length-n}}function uN(e){if(!e||typeof e.getItem!="function")return Zu;try{return iN(e.getItem(ny))}catch{return Zu}}const dN=["default","teal","amber","violet"],pN=[{view:"one",glyph:"1",labelKey:"notes.viewOne"},{view:"two",glyph:"2",labelKey:"notes.viewTwo"},{view:"list",glyph:"☰",labelKey:"notes.viewList"}];function hN(e){return String(e??"").split(/[,、\s]+/).map(t=>t.trim().replace(/^#+/,"")).filter(Boolean)}function mN({notify:e,onOpenChat:t}){const{t:n}=Fe(),[s,r]=u.useState([]),[i,l]=u.useState([]),[o,c]=u.useState(!0),[d,g]=u.useState(""),[f,h]=u.useState("all"),[x,b]=u.useState(""),[w,S]=u.useState(null),[k,m]=u.useState(""),[v,T]=u.useState(!1),[E,_]=u.useState(()=>uN(typeof localStorage>"u"?null:localStorage)),[I,A]=u.useState(null),[P,y]=u.useState(null),[K,$]=u.useState(!1),[V,D]=u.useState(0),X=u.useCallback(async()=>{var M,W;try{const[L,se]=await Promise.allSettled([Y("/api/memos"),Y("/api/chat-reports?limit=20")]);L.status==="fulfilled"&&Array.isArray((M=L.value)==null?void 0:M.memos)&&r(L.value.memos),se.status==="fulfilled"&&Array.isArray((W=se.value)==null?void 0:W.reports)&&l(se.value.reports)}finally{c(!1)}},[]);u.useEffect(()=>{X();const M=()=>X();return window.addEventListener("hm:memos-changed",M),()=>window.removeEventListener("hm:memos-changed",M)},[X]);const ge=u.useMemo(()=>{const M=new Set;for(const W of s)for(const L of W.tags||[])M.add(L);return[...M].slice(0,12)},[s]),Z=u.useMemo(()=>{var W;const M=new Set;for(const L of s)(W=L.source)!=null&&W.reportKey&&M.add(L.source.reportKey);return M},[s]),G=u.useMemo(()=>{const M=d.trim().toLowerCase();return s.filter(W=>{if(f==="pinned"&&!W.pinned||f==="report"&&W.kind!=="report")return!1;if(f.startsWith("tag:")){const se=f.slice(4).toLowerCase();if(!(W.tags||[]).some(ue=>ue.toLowerCase()===se))return!1}return M?[W.title,W.body,...W.tags||[],...(W.checklist||[]).map(se=>se.text)].join(`
91
+ `),we(null),setTimeout(()=>{var j;return(j=vn.current)==null?void 0:j.focus()},60)},children:a.jsx("span",{className:"pick-main",children:a.jsx("span",{className:"pick-title",children:C("chat.bubbleQuote")})})})]})]})]}):null]})}let Ds=null;const fo=new Set;typeof window<"u"&&(window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),Ds=e,fo.forEach(t=>t())}),window.addEventListener("appinstalled",()=>{Ds=null,fo.forEach(e=>e())}));function T0(){const[e,t]=u.useState(!!Ds),[n,s]=u.useState(!1);return u.useEffect(()=>{var o;const r=()=>t(!!Ds);fo.add(r);const i=[500,1500,3e3,6e3].map(c=>setTimeout(r,c)),l=(o=window.matchMedia)==null?void 0:o.call(window,"(display-mode: standalone)");return s(!!(l!=null&&l.matches)),()=>{fo.delete(r),i.forEach(clearTimeout)}},[]),{available:e,installed:n,prompt:async()=>{if(!Ds)return null;Ds.prompt();const r=await Ds.userChoice;return Ds=null,t(!1),(r==null?void 0:r.outcome)??null}}}function A0(){try{return"serviceWorker"in navigator?navigator.serviceWorker.controller?C("install.swControlled"):C("install.swWaiting"):C("install.swUnsupported")}catch{return"—"}}async function R0(e){try{const t=await fetch(e,{cache:"no-store"});return{status:t.status,type:t.headers.get("content-type")??"",res:t}}catch(t){return{status:0,type:`error: ${t.message}`,res:null}}}async function P0(e){try{const t=await fetch(e,{cache:"no-store"});if(!t.ok)return{ok:!1,why:`HTTP ${t.status}`,w:0,h:0};const n=await t.blob();try{const s=await createImageBitmap(n);return{ok:!0,w:s.width,h:s.height,bytes:n.size,mime:n.type}}catch{const s=URL.createObjectURL(n);try{const r=await new Promise((i,l)=>{const o=new Image;o.onload=()=>i(o),o.onerror=()=>l(new Error("decode")),o.src=s});return{ok:!0,w:r.naturalWidth,h:r.naturalHeight,bytes:n.size,mime:n.type}}catch{return{ok:!1,why:C("diag.decodeError"),w:0,h:0}}finally{URL.revokeObjectURL(s)}}}catch(t){return{ok:!1,why:t.message,w:0,h:0}}}async function I0(){var m;const e=[],t=(v,T,E)=>e.push({label:v,ok:T,detail:E}),n=document.querySelector('link[rel="manifest"]');if(t(C("diag.manifestLink"),!!n,n?n.getAttribute("href"):C("diag.linkMissing")),!n)return e;const s=new URL(n.getAttribute("href"),location.href).href,r=await R0(s);if(t(C("diag.manifestFetch"),r.status===200,`HTTP ${r.status} / ${r.type}`),!r.res||!r.res.ok)return e;let i;try{i=JSON.parse(await r.res.text())}catch(v){return t(C("diag.manifestJson"),!1,v.message),e}t(C("diag.manifestJson"),!0,C("diag.entries",{count:Object.keys(i).length})),t("name",!!i.name,i.name??C("diag.none")),t("short_name",!!i.short_name,i.short_name??C("diag.none"));const l=new URL(i.start_url??".",s).href,o=new URL(i.scope??"./",s).href,c=i.id,d=c==null?null:new URL(c,s).href;t("start_url",!0,l),t("scope",!0,o),t("id",!0,d??C("diag.idUnset")),t(C("diag.startInScope"),l.startsWith(o),`${l} ⊂ ${o}`),t(C("diag.idSameOrigin"),!d||new URL(d).origin===location.origin,d??"-");const g=i.display??"browser",f=["standalone","fullscreen","minimal-ui"].includes(g);t("display",f,g);const h=i.icons??[];t(C("diag.iconCount"),h.length>0,C("diag.iconCountValue",{count:h.length}));let x=!1,b=!1,w=!1;for(const v of h){const T=new URL(v.src,s).href,E=await P0(T),_=v.sizes??"",I=v.purpose??"any",A=Math.max(E.w,E.h);E.ok&&A>=192&&I.split(" ").includes("any")&&(x=!0),E.ok&&A>=512&&I.split(" ").includes("any")&&(b=!0),E.ok&&I.split(" ").includes("maskable")&&(w=!0);const P=!_||_==="any"||_.split(" ").includes(`${E.w}x${E.h}`);t(`icon ${v.src.split("/").pop()}`,E.ok&&P,E.ok?C("diag.iconLine",{w:E.w,h:E.h,bytes:E.bytes,purpose:I,declared:_}):`${E.why}`)}t(C("diag.any192"),x,C(x?"diag.present":"diag.missingInstall")),t(C("diag.any512"),b,C(b?"diag.present":"diag.missingInstall")),t(C("diag.maskable"),w,C(w?"diag.present":"diag.maskableMissing"));const S=(m=navigator.serviceWorker)==null?void 0:m.controller;t(C("diag.swControl"),!!S,S?S.scriptURL:C("diag.swNone"));try{const T=(await navigator.serviceWorker.getRegistrations()).find(E=>l.startsWith(E.scope));t(C("diag.swCovering"),!!T,T?T.scope:C("diag.none"))}catch(v){t(C("diag.swCovering"),!1,v.message)}const k=["standalone","minimal-ui","fullscreen","browser"];return t(C("diag.viewMode"),!0,k.filter(v=>matchMedia(`(display-mode: ${v})`).matches).join(", ")||C("diag.unknown")),t("referrer",!0,document.referrer||C("diag.empty")),t("UA",!0,navigator.userAgent.slice(0,80)),e}const Yv="hm.theme",wa="dark",_0=["dark","light"],M0={dark:"#051319",light:"#f4f7f8"},Jv="(prefers-color-scheme: dark)";function Bo(e){if(e==null)return null;const t=String(e).trim().toLowerCase();return t?t==="system"||t==="auto"?"system":t==="dark"||t==="light"?t:null:null}function L0(e){try{if(typeof window<"u"&&typeof window.matchMedia=="function")return!!window.matchMedia(Jv).matches}catch{}return!0}function O0(e,t){const n=Bo(e)??wa;return n==="system"?(t&&typeof t.systemDark=="boolean"?t.systemDark:L0())?"dark":"light":n}function D0(){try{const e=typeof localStorage>"u"?null:localStorage.getItem(Yv);return Bo(e)??wa}catch{return wa}}let Ai=wa,go="dark";const Yu=new Set;let Ht=null;function $0(){for(const e of[...Yu])try{e(go,Ai)}catch{}}function F0(e){const t=_0.includes(e)?e:"dark";if(typeof document>"u")return t;try{const n=document.documentElement;n.dataset.theme!==t&&(n.dataset.theme=t),n.style.colorScheme!==t&&(n.style.colorScheme=t);const s=document.querySelector('meta[name="theme-color"]'),r=M0[t];s&&s.getAttribute("content")!==r&&s.setAttribute("content",r)}catch{}return t}function Ju(e,t){const n=Bo(e)??wa,s=O0(n,t),r=n!==Ai||s!==go;return Ai=n,go=s,F0(s),r&&!(t!=null&&t.silent)&&$0(),s}function B0(e){const t=Bo(e)??wa;try{typeof localStorage<"u"&&localStorage.setItem(Yv,t)}catch{}return Ju(t),t}function U0(){return Ai}function Ml(){return go}function Dm(e){return Yu.add(e),()=>Yu.delete(e)}function qv(){if(Ju(D0(),{silent:!0}),Ht||typeof window>"u"||typeof window.matchMedia!="function")return()=>{};try{Ht=window.matchMedia(Jv);const e=()=>{Ai==="system"&&Ju("system")};return typeof Ht.addEventListener=="function"?Ht.addEventListener("change",e):typeof Ht.addListener=="function"&&Ht.addListener(e),()=>{try{typeof(Ht==null?void 0:Ht.removeEventListener)=="function"?Ht.removeEventListener("change",e):typeof(Ht==null?void 0:Ht.removeListener)=="function"&&Ht.removeListener(e)}catch{}Ht=null}}catch{return()=>{}}}let Ms=null;function Xv(e,t=globalThis.window){var l,o;const n=Number(t==null?void 0:t.innerWidth)||390,s=Number(t==null?void 0:t.innerHeight)||844,r=Number(e==null?void 0:e.clientX),i=Number(e==null?void 0:e.clientY);if(Number.isFinite(r)&&Number.isFinite(i)&&(r>0||i>0))return{x:Math.round(r),y:Math.round(i)};try{const c=(o=(l=e==null?void 0:e.currentTarget)==null?void 0:l.getBoundingClientRect)==null?void 0:o.call(l);if(c&&c.width>0&&c.height>0)return{x:Math.round(c.left+c.width/2),y:Math.round(c.top+c.height/2)}}catch{}return{x:Math.round(n/2),y:Math.round(s/2)}}function Zv(e,t,n=globalThis.document){var s,r;try{const i=((s=n==null?void 0:n.querySelector)==null?void 0:s.call(n,".shell"))??(n==null?void 0:n.body);if(!i||typeof i.animate!="function")return null;try{(r=Ms==null?void 0:Ms.cancel)==null||r.call(Ms)}catch{}const l=i.animate(e,t);return Ms=l,l.onfinish=()=>{Ms===l&&(Ms=null)},l}catch{return null}}function H0(e,t){var g,f,h,x,b,w;if(gs()===e||Fo()||typeof document>"u")return um(e);const{x:s,y:r}=Xv(t),i=Number((g=globalThis.window)==null?void 0:g.innerWidth)||390,l=Number((f=globalThis.window)==null?void 0:f.innerHeight)||844,o=Math.ceil(Math.hypot(Math.max(s,i-s),Math.max(r,l-r)));let c=e;const d=()=>{c=um(e),c==="dopamine"&&(bt("vibeWarp",{x:s,y:r,sound:!1}),tp("approve"))};if(typeof document.startViewTransition=="function")try{return(w=(b=(x=(h=document.startViewTransition(d).ready)==null?void 0:h.then)==null?void 0:x.call(h,()=>{var k,m,v,T;c==="dopamine"?(m=(k=document.documentElement)==null?void 0:k.animate)==null||m.call(k,{clipPath:[`circle(0px at ${s}px ${r}px)`,`circle(${o}px at ${s}px ${r}px)`]},{duration:420,easing:"cubic-bezier(0.22, 1, 0.36, 1)",pseudoElement:"::view-transition-new(root)"}):(T=(v=document.documentElement)==null?void 0:v.animate)==null||T.call(v,{opacity:[0,1]},{duration:240,easing:"ease-out",pseudoElement:"::view-transition-new(root)"})}))==null?void 0:b.catch)==null||w.call(b,()=>{}),c}catch{}return d(),Zv([{opacity:.78},{opacity:1}],{duration:220,easing:"ease-out"}),c}function z0(e,t,n){var d,g,f,h,x,b;if(typeof t!="function")return;const s=Ml();if(Fo()||typeof document>"u"){t(e);return}const{x:r,y:i}=Xv(n),l=Number((d=globalThis.window)==null?void 0:d.innerWidth)||390,o=Number((g=globalThis.window)==null?void 0:g.innerHeight)||844,c=Math.ceil(Math.hypot(Math.max(r,l-r),Math.max(i,o-i)));if(typeof document.startViewTransition=="function")try{(b=(x=(h=(f=document.startViewTransition(()=>{t(e)}).ready)==null?void 0:f.then)==null?void 0:h.call(f,()=>{var S,k;Ml()!==s&&((k=(S=document.documentElement)==null?void 0:S.animate)==null||k.call(S,{clipPath:[`circle(0px at ${r}px ${i}px)`,`circle(${c}px at ${r}px ${i}px)`]},{duration:340,easing:"cubic-bezier(0.22, 1, 0.36, 1)",pseudoElement:"::view-transition-new(root)"}))}))==null?void 0:x.catch)==null||b.call(x,()=>{});return}catch{}t(e),Ml()!==s&&Zv([{opacity:.76},{opacity:1}],{duration:220,easing:"ease-out"})}const $m=8;function W0(e,{limit:t=$m,expanded:n=!1}={}){const s=Array.isArray(e)?e:[],r=Number.isFinite(t)&&t>0?Math.floor(t):$m,i=Math.max(0,s.length-r),l=i>0;return{visible:l&&n?s:s.slice(0,r),hiddenCount:i,canExpand:l,expanded:l&&!!n}}function V0(){const e=u.useSyncExternalStore(Dm,U0,()=>"dark"),t=u.useSyncExternalStore(Dm,Ml,()=>"dark"),n=u.useCallback(s=>{B0(s)},[]);return{pref:e,resolved:t,setPref:n}}function K0({notify:e,board:t=""}){var m,v,T;const{t:n}=Fe(),[s,r]=u.useState(null),[i,l]=u.useState(!1),[o,c]=u.useState(null),[d,g]=u.useState(!1),[f,h]=u.useState(null),x=u.useCallback(async()=>{try{const E=await Y("/api/pipeline/status");E!=null&&E.ok?(r(E),l(!1)):l(!0)}catch{l(!0)}try{const E=t?`?board=${encodeURIComponent(t)}`:"",_=await Y(`/api/architect/jobs${E}`);_!=null&&_.ok&&c(_)}catch{c(null)}},[t]);u.useEffect(()=>{x()},[x]);const b=u.useCallback(async()=>{if(!d){g(!0),h(null),H("action");try{const E=await Y("/api/pipeline/optimize",{method:"POST",body:{}});E!=null&&E.ok?(r(E.status??s),e==null||e(n("settings.pipelineOptimized"))):h((E==null?void 0:E.error)??n("settings.pipelineUnavailable"))}catch(E){h((E==null?void 0:E.code)==="UNKNOWN_ENDPOINT"?n("settings.pipelineUnavailable"):(E==null?void 0:E.message)??"")}finally{g(!1),x()}}},[d,x,e,s,n]),w=!!((m=s==null?void 0:s.soul)!=null&&m.applied),S=Array.isArray((v=s==null?void 0:s.hermes)==null?void 0:v.present)?s.hermes.present.length:0,k=Array.isArray((T=s==null?void 0:s.bundled)==null?void 0:T.names)?s.bundled.names.length:0;return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"row-sub",style:{marginBottom:10,lineHeight:1.6},children:n("settings.pipelineLead")}),a.jsxs("div",{className:"kv",style:{alignItems:"center"},children:[a.jsx("span",{children:n("settings.pipelineRunner")}),a.jsx("span",{className:"pill on",children:n("seed.runnerHermes")})]}),a.jsx("p",{className:"row-sub",style:{margin:"6px 0 10px",lineHeight:1.6},children:n("settings.pipelineRunnerHint")}),i?a.jsx("p",{className:"row-sub",style:{marginBottom:10,lineHeight:1.6},children:n("settings.pipelineUnavailable")}):a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineSoul")}),a.jsx("b",{children:n(w?"settings.pipelineApplied":"settings.pipelineMissing")})]}),k?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineSkills")}),a.jsxs("b",{children:[S,"/",k]})]}):null,o?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelineJobs")}),a.jsx("b",{children:Array.isArray(o.jobs)?o.jobs.length:0})]}):null,o&&Array.isArray(o.pending)?a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:n("settings.pipelinePending")}),a.jsx("b",{children:o.pending.length})]}):null,a.jsx("button",{type:"button",className:"seed-submit",style:{marginTop:10},disabled:d||i,onClick:b,children:n(d?"settings.pipelineOptimizing":"settings.pipelineOptimize")}),f?a.jsx("div",{className:"seed-error",style:{marginTop:8},children:f}):null]})}function Q0(){var e,t;try{return(document.referrer||"").startsWith("android-app://")?"webapk":((t=(e=window.matchMedia)==null?void 0:e.call(window,"(display-mode: standalone)"))==null?void 0:t.matches)?"standalone":"browser"}catch{return"unknown"}}const G0=[{value:"auto",key:"settings.languageAuto"},...dk.map(e=>({value:e,key:e==="ja"?"settings.languageJa":"settings.languageEn"}))],Y0=[{value:"dark",key:"settings.themeDark"},{value:"light",key:"settings.themeLight"},{value:"system",key:"settings.themeSystem"}],J0=[{value:"dopamine",key:"settings.vibeDopamine"},{value:"serotonin",key:"settings.vibeSerotonin"}],q0=[{id:"chat",key:"settings.barChat"},{id:"annotation",key:"settings.barAnnotation"},{id:"term",key:"settings.barTerm"}];function X0({rows:e,margin:t=4,size:n=300}){const s=ze.useRef(null);return u.useEffect(()=>{const r=s.current;if(!r||!(e!=null&&e.length))return;const i=e.length+t*2,l=Math.max(2,Math.floor(n/i)),o=Math.min(3,window.devicePixelRatio||1),c=i*l,d=Math.round(l*o);r.width=c*o,r.height=c*o,r.style.width=`${c}px`,r.style.height=`${c}px`;const g=r.getContext("2d");g.imageSmoothingEnabled=!1,g.fillStyle="#ffffff",g.fillRect(0,0,r.width,r.height),g.fillStyle="#000000";for(let f=0;f<e.length;f+=1)for(let h=0;h<e[f].length;h+=1)e[f][h]==="1"&&g.fillRect((h+t)*d,(f+t)*d,d,d)},[e,t,n]),a.jsx("canvas",{ref:s,className:"pair-qr-canvas",role:"img","aria-label":"Pairing QR"})}function Z0({notify:e,lang:t}){const{t:n}=Fe(),[s,r]=u.useState("chat"),[i,l]=u.useState({chat:null,term:null}),[o,c]=u.useState({label:"",text:"",hot:!1,run:!0}),[d,g]=u.useState(null),[f,h]=u.useState(!1),x=s==="term"?"/api/snippets/term":"/api/snippets",b=s==="term"?"hm:term-snippets":"hm:snippets",w=i[s],S=(w==null?void 0:w.overrides)??{},k=(w==null?void 0:w.custom)??[],m=(w==null?void 0:w.customMax)??16,v=((w==null?void 0:w.allSnippets)??[]).filter(D=>!D.custom),T=((w==null?void 0:w.allSnippets)??[]).filter(D=>D.custom),E=u.useCallback(async()=>{try{const D=await Y(`${x}?lang=${encodeURIComponent(t)}`);l(X=>({...X,[s]:D}))}catch(D){e(D.message)}},[x,s,t,e]);u.useEffect(()=>{E()},[E]);const _=u.useCallback(async(D,X)=>{h(!0);try{const ge=await Y(x,{method:"PUT",body:D});return l(Z=>({...Z,[s]:ge})),window.dispatchEvent(new Event(b)),X&&e(X),!0}catch(ge){return e(ge.message),!1}finally{h(!1)}},[x,s,b,e]),I=D=>_({overrides:{...S,[D.id]:{...S[D.id]??{},hot:!D.hot}}}),A=D=>_({overrides:{...S,[D.id]:{...S[D.id]??{},hidden:!D.hidden}}}),P=(D,X)=>_({custom:D},X),y=D=>P(k.map(X=>X.id===D.id?{...X,hot:!X.hot}:X)),K=async()=>{const D=o.label.trim(),X=o.text.trim();if(!D||!X)return e(n("settings.needNameAndText"));if(k.length>=m)return e(n("settings.snippetLimit",{max:m}));const ge={label:D,text:X,hot:o.hot};s==="term"&&(ge.run=o.run),await P([...k,ge],n("settings.saved"))&&c({label:"",text:"",hot:!1,run:!0})},$=async()=>{if(!d)return;const D=d.label.trim(),X=d.text.trim();if(!D||!X)return e(n("settings.needNameAndText"));const ge=k.map(G=>G.id===d.id?{...G,label:D,text:X,hot:d.hot,...s==="term"?{run:d.run}:{}}:G);await P(ge,n("settings.saved"))&&g(null)},V=async()=>{h(!0);try{const[D,X]=await Promise.all([Y("/api/snippets",{method:"PUT",body:{reset:!0}}),Y("/api/snippets/term",{method:"PUT",body:{reset:!0}})]);l({chat:D,term:X}),g(null),c({label:"",text:"",hot:!1,run:!0}),window.dispatchEvent(new Event("hm:snippets")),window.dispatchEvent(new Event("hm:term-snippets")),e(n("settings.snippetResetDone"))}catch(D){e(D.message)}finally{h(!1)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"settings-card-head",children:[a.jsx("span",{className:"settings-card-icon","aria-hidden":"true",children:"⚡"}),a.jsx("span",{className:"settings-card-title",children:n("settings.snippets")}),a.jsx("span",{className:"settings-card-action",children:a.jsx("button",{className:"link",disabled:f,onClick:V,children:n("settings.snippetReset")})})]}),a.jsxs("div",{className:"chips",role:"group","aria-label":n("settings.snippets"),style:{marginBottom:10},children:[a.jsx("button",{className:`chip${s==="chat"?" on":""}`,onClick:()=>r("chat"),children:n("settings.snippetChat")}),a.jsx("button",{className:`chip${s==="term"?" on":""}`,onClick:()=>r("term"),children:n("settings.snippetTerm")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:n("settings.snippetBuiltin")})}),a.jsxs("div",{className:"list",children:[v.map(D=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.label}),a.jsx("span",{className:"row-sub",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.text.replace(/\n/g," ")})]}),a.jsx("button",{className:`chip${D.hot?" on":""}`,disabled:f,onClick:()=>I(D),"aria-label":`${n("settings.snippetHot")} ${D.label}`,children:n("settings.snippetHot")}),a.jsx("button",{className:`chip${D.hidden?"":" on"}`,disabled:f,onClick:()=>A(D),"aria-label":`${D.hidden?n("settings.snippetShow"):n("settings.snippetHide")} ${D.label}`,children:D.hidden?n("settings.snippetShow"):n("settings.snippetHide")})]},D.id)),v.length?null:a.jsx("div",{className:"empty",children:n("settings.snippetsEmpty")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:n("settings.customSnippets",{count:k.length,max:m})})}),a.jsxs("div",{className:"list",children:[T.map(D=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsxs("span",{className:"row-title",children:[D.label,D.hot?a.jsx("span",{className:"pill",style:{marginLeft:8},children:n("settings.bar")}):null,s==="term"&&D.run?a.jsx("span",{className:"pill",style:{marginLeft:6},children:n("term.run")}):null,D.hidden?a.jsx("span",{className:"pill",style:{marginLeft:6},children:n("settings.snippetHiddenPill")}):null]}),a.jsx("span",{className:"row-sub",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.text.replace(/\n/g," ")})]}),a.jsx("button",{className:"link",disabled:f,onClick:()=>y(D),children:n("settings.snippetHot")}),a.jsx("button",{className:"link",disabled:f,onClick:()=>g({id:D.id,label:D.label,text:D.text,hot:D.hot,run:D.run!==!1}),children:n("settings.snippetEdit")}),a.jsx("button",{className:"link",disabled:f,onClick:()=>P(k.filter(X=>X.id!==D.id)),children:n("settings.delete")})]},D.id)),T.length?null:a.jsx("div",{className:"empty",children:n("settings.snippetsEmpty")})]}),d?a.jsxs("div",{className:"card",style:{marginTop:10},children:[a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:n("settings.snippetEditTitle")}),a.jsx("input",{className:"inp",placeholder:n("settings.snippetNamePlaceholder"),maxLength:20,value:d.label,onChange:D=>g({...d,label:D.target.value})}),a.jsx("textarea",{className:"inp",placeholder:n(s==="term"?"settings.snippetCommandPlaceholder":"settings.snippetTextPlaceholder"),rows:3,maxLength:400,value:d.text,onChange:D=>g({...d,text:D.target.value}),style:{marginTop:8,resize:"vertical",fontFamily:"inherit"}}),a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:10},children:[a.jsx("input",{type:"checkbox",checked:d.hot,onChange:D=>g({...d,hot:D.target.checked})}),n("settings.showInBar")]}),s==="term"?a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[a.jsx("input",{type:"checkbox",checked:d.run,onChange:D=>g({...d,run:D.target.checked})}),n("settings.snippetRun")]}):null,a.jsxs("div",{className:"row",style:{marginTop:10},children:[a.jsx("button",{className:"btn",disabled:f,onClick:$,children:n("settings.snippetSave")}),a.jsx("button",{className:"link",style:{marginLeft:10},onClick:()=>g(null),children:n("settings.snippetCancel")})]})]}):null,a.jsxs("div",{className:"card",style:{marginTop:10},children:[a.jsx("div",{className:"row-sub",style:{marginBottom:8},children:n("settings.snippetAddTitle")}),a.jsx("input",{className:"inp",placeholder:n("settings.snippetNamePlaceholder"),maxLength:20,value:o.label,onChange:D=>c({...o,label:D.target.value})}),a.jsx("textarea",{className:"inp",placeholder:n(s==="term"?"settings.snippetCommandPlaceholder":"settings.snippetTextPlaceholder"),rows:3,maxLength:400,value:o.text,onChange:D=>c({...o,text:D.target.value}),style:{marginTop:8,resize:"vertical",fontFamily:"inherit"}}),a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:10},children:[a.jsx("input",{type:"checkbox",checked:o.hot,onChange:D=>c({...o,hot:D.target.checked})}),n("settings.showInBar")]}),s==="term"?a.jsxs("label",{className:"row-sub",style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[a.jsx("input",{type:"checkbox",checked:o.run,onChange:D=>c({...o,run:D.target.checked})}),n("settings.snippetRun")]}):null,a.jsx("button",{className:"btn",onClick:K,disabled:f||k.length>=m,style:{marginTop:10},children:n(f?"settings.saving":"settings.snippetAdd")})]}),a.jsx("div",{className:"row-sub",style:{padding:"10px 6px 0",lineHeight:1.7},children:n("settings.snippetHint")})]})}const eN=[{id:"sec-appearance",icon:"🎨",key:"settings.secAppearance"},{id:"sec-pairing",icon:"📱",key:"settings.secPairing"},{id:"sec-snippets",icon:"⚡",key:"settings.secSnippets"},{id:"sec-pipeline",icon:"🏗️",key:"settings.secPipeline"},{id:"sec-repos",icon:"📁",key:"settings.secRepos"},{id:"sec-audit",icon:"🛡️",key:"settings.secAudit"},{id:"sec-status",icon:"🩺",key:"settings.secStatus"}];function Br({icon:e,title:t,action:n}){return a.jsxs("div",{className:"settings-card-head",children:[a.jsx("span",{className:"settings-card-icon","aria-hidden":"true",children:e}),a.jsx("span",{className:"settings-card-title",children:t}),n?a.jsx("span",{className:"settings-card-action",children:n}):null]})}function tN({overview:e,notify:t,refresh:n}){var He,$t,wt,Tt;const{lang:s,t:r,pref:i,setPref:l}=Fe(),{pref:o,setPref:c}=V0(),d=T0(),[g,f]=u.useState(null),[h,x]=u.useState(!1),[b,w]=u.useState(null),[S,k]=u.useState(!1),[m,v]=u.useState(null),[T,E]=u.useState("gateway"),[_,I]=u.useState([]),[A,P]=u.useState(()=>Xd()),[y,K]=u.useState(()=>gs()),[$,V]=u.useState(()=>ep()),[D,X]=u.useState(()=>Sa());u.useEffect(()=>hv(K),[]);const[ge,Z]=u.useState([]),[G,q]=u.useState([]),[ce,te]=u.useState(""),[pe,ve]=u.useState(""),[xe,Oe]=u.useState(!1),[Ae,et]=u.useState(null),[We,Dt]=u.useState(!1),ht=u.useCallback(async()=>{H("tap"),Dt(!0);try{const F=await Y("/api/auth/pairing");et(F)}catch(F){t==null||t(F.message)}finally{Dt(!1)}},[t]),ct=u.useCallback(async F=>{try{await navigator.clipboard.writeText(F),t==null||t(r("settings.pairingCopied"))}catch{t==null||t(F)}},[t,r]),yt=u.useCallback(async()=>{try{const F=await Y("/api/repos");return Z(Array.isArray(F==null?void 0:F.repos)?F.repos:[]),q(Array.isArray(F==null?void 0:F.scanDirs)?F.scanDirs:[]),!0}catch(F){return t(F.message),!1}},[t]),Ge=u.useCallback(async({method:F="POST",path:_e="/api/repos",body:Nt,done:Kn})=>{Oe(!0);try{const mt=await Y(_e,{method:F,body:Nt});return Z(Array.isArray(mt==null?void 0:mt.repos)?mt.repos:[]),Array.isArray(mt==null?void 0:mt.scanDirs)&&q(mt.scanDirs),t(Kn),!0}catch(mt){return t(mt.message),!1}finally{Oe(!1)}},[t]),$e=u.useCallback(async()=>{try{const F=await Y("/api/audit?lines=80");return w(F.lines??[]),!0}catch(F){return t(F.message),!1}},[t]);u.useEffect(()=>{$e(),yt(),Y("/api/sessions?limit=5").then(F=>I(F.sessions??[])).catch(()=>{})},[$e,yt]);const M=async F=>{try{const _e=await Y(`/api/logs?file=${encodeURIComponent(F)}&lines=200`);v({name:_e.file,text:_e.text})}catch(_e){t(_e.message)}},W=u.useCallback(F=>{var Nt;H("tap");const _e=typeof document<"u"?document.getElementById(F):null;(Nt=_e==null?void 0:_e.scrollIntoView)==null||Nt.call(_e,{behavior:"smooth",block:"start"})},[]),L=(He=e==null?void 0:e.system)==null?void 0:He.memory,se=($t=e==null?void 0:e.system)==null?void 0:$t.disk,ue=e==null?void 0:e.bridge,U=e==null?void 0:e.kanban,ee=Array.isArray(b)?b.slice().reverse():[],we=W0(ee,{expanded:S}),ut=Q0(),Ee=ut==="standalone"?r("settings.standalone"):ut==="browser"?r("settings.browser"):ut==="webapk"?"WebAPK":"—";return a.jsxs("div",{className:"pane center-readable",children:[a.jsx("nav",{className:"settings-nav","aria-label":r("settings.sections"),children:eN.map(F=>a.jsxs("button",{type:"button",className:"settings-nav-chip",onClick:()=>W(F.id),children:[a.jsx("span",{"aria-hidden":"true",children:F.icon}),a.jsx("span",{children:r(F.key)})]},F.id))}),a.jsxs("section",{id:"sec-appearance",className:"card settings-card",children:[a.jsx(Br,{icon:"🎨",title:r("settings.secAppearance")}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.language")})}),a.jsx("div",{className:"chips",style:{marginBottom:10},children:G0.map(F=>a.jsx("button",{type:"button",className:`chip${i===F.value?" on":""}`,"aria-pressed":i===F.value,onClick:()=>{H("tap"),l(F.value)},children:r(F.key)},F.value))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.theme")})}),a.jsx("div",{className:"chips",style:{marginBottom:10},role:"group","aria-label":r("settings.theme"),children:Y0.map(F=>a.jsx("button",{type:"button",className:`chip${o===F.value?" on":""}`,"aria-pressed":o===F.value,onClick:_e=>{H("tap"),z0(F.value,c,_e)},children:r(F.key)},F.value))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.vibe")})}),a.jsx("div",{className:"chips",style:{marginBottom:6},role:"group","aria-label":r("settings.vibe"),children:J0.map(F=>a.jsx("button",{type:"button",className:`chip vibe-chip${y===F.value?" on":""}`,"aria-pressed":y===F.value,onClick:_e=>{H("tap");const Nt=H0(F.value,_e);K(Nt),t==null||t(r("settings.vibeSwitched",{mode:r(F.key)}))},children:r(F.key)},F.value))}),a.jsx("p",{className:"row-sub",style:{marginBottom:8,lineHeight:1.6},children:r("settings.vibeHint")}),a.jsxs("div",{className:"kv",style:{alignItems:"center"},children:[a.jsx("span",{children:r("settings.haptics")}),a.jsx("button",{type:"button",role:"switch","aria-checked":A,"aria-label":r("settings.haptics"),className:`hm-switch${A?" on":""}`,onClick:()=>{const F=Gk(!A);P(F),F&&H("tap")},children:a.jsx("span",{className:"hm-switch-knob"})})]}),a.jsxs("div",{className:"kv",style:{alignItems:"center",marginTop:8},children:[a.jsxs("span",{children:[r("settings.sound"),a.jsx("span",{className:"row-sub",style:{display:"block",lineHeight:1.5,marginTop:2},children:r("settings.soundHint")})]}),a.jsx("button",{type:"button",role:"switch","aria-checked":$,"aria-label":r("settings.sound"),className:`hm-switch${$?" on":""}`,onClick:()=>{const F=eb(!$);V(F),H("tap"),F&&tp("approve")},children:a.jsx("span",{className:"hm-switch-knob"})})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.bars")})}),q0.map(F=>a.jsxs("div",{className:"kv",style:{alignItems:"center",marginTop:8},children:[a.jsx("span",{children:r(F.key)}),a.jsx("button",{type:"button",role:"switch","aria-checked":D[F.id]!==!1,"aria-label":r(F.key),"data-bar":F.id,className:`hm-switch${D[F.id]!==!1?" on":""}`,onClick:()=>{H("tap"),X(CS(F.id,D[F.id]===!1))},children:a.jsx("span",{className:"hm-switch-knob"})})]},F.id)),a.jsx("p",{className:"row-sub",style:{marginTop:8,marginBottom:0,lineHeight:1.6},children:r("settings.barsHint")})]}),a.jsxs("section",{id:"sec-pairing",className:"card settings-card",children:[a.jsx(Br,{icon:"📱",title:r("settings.secPairing")}),a.jsx("div",{className:"row-sub",style:{marginTop:8,lineHeight:1.6},children:r("settings.pairingHint")}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:10},disabled:We,onClick:ht,children:[We?a.jsx(hn,{size:14}):null,a.jsx("span",{children:r(We?"settings.pairingLoading":"settings.showPairingQr")})]})]}),a.jsx("section",{id:"sec-snippets",className:"card settings-card",children:a.jsx(Z0,{notify:t,lang:s})}),a.jsxs("section",{id:"sec-pipeline",className:"card settings-card",children:[a.jsx(Br,{icon:"🏗️",title:r("settings.secPipeline")}),a.jsx(K0,{notify:t,board:(()=>{try{return localStorage.getItem(_v)??""}catch{return""}})()})]}),a.jsxs("section",{id:"sec-repos",className:"card settings-card",children:[a.jsx(Br,{icon:"📁",title:r("settings.repos",{count:ge.length}),action:a.jsx("button",{className:"link",disabled:xe,onClick:async()=>{H("tap"),await Ge({path:"/api/repos/scan",done:r("settings.rescanned")})},children:r("settings.rescan")})}),a.jsxs("div",{className:"list",children:[ge.map(F=>{var _e;return a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsxs("span",{className:"row-title",children:[F.label,F.source==="custom"?a.jsx("span",{className:"pill",style:{marginLeft:8},children:r("settings.manual")}):null]}),a.jsx("span",{className:"row-sub",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r("settings.repoLine",{path:F.path,source:F.source,count:((_e=F.boards)==null?void 0:_e.length)??0})})]}),a.jsx("button",{className:"link",disabled:xe,onClick:()=>Ge({method:"DELETE",path:`/api/repos/${encodeURIComponent(F.id)}`,done:r("settings.hidden")}),children:r("settings.hide")})]},F.id)}),ge.length?null:a.jsx("div",{className:"empty",children:r("settings.reposEmpty")})]}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.scanDirs")})}),a.jsxs("div",{className:"list",children:[G.map(F=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:"row-main",style:{minWidth:0},children:a.jsx("span",{className:"row-title mono",children:F})}),a.jsx("button",{className:"link",disabled:xe,onClick:()=>Ge({body:{scanDirs:G.filter(_e=>_e!==F)},done:r("settings.removed")}),children:r("settings.delete")})]},F)),G.length?null:a.jsx("div",{className:"empty",children:r("settings.scanDirsEmpty")})]}),a.jsx("input",{className:"inp",style:{marginTop:10},placeholder:r("settings.scanDirPlaceholder"),maxLength:200,value:ce,onChange:F=>te(F.target.value)}),a.jsx("button",{className:"btn",disabled:xe||!ce.trim(),style:{marginTop:8},onClick:async()=>{const F=[...G,ce.trim()];await Ge({body:{scanDirs:F},done:r("settings.scanDirAdded")})&&te("")},children:r("settings.addScanDir")}),a.jsx("input",{className:"inp",placeholder:r("settings.repoPathPlaceholder"),maxLength:300,value:pe,onChange:F=>ve(F.target.value),style:{marginTop:8}}),a.jsx("button",{className:"btn",disabled:xe||!pe.trim(),style:{marginTop:8},onClick:async()=>{await Ge({body:{path:pe.trim()},done:r("settings.repoAdded")})&&ve("")},children:r("settings.addRepo")})]}),a.jsxs("section",{id:"sec-audit",className:"card settings-card",children:[a.jsx(Br,{icon:"🛡️",title:r("settings.secAudit"),action:a.jsx(Xs,{variant:"link",onRefresh:$e})}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.logs")})}),a.jsx("div",{className:"row",children:["gateway","errors","agent"].map(F=>a.jsxs("button",{className:"chip",onClick:()=>{H("tap"),M(F)},style:{marginRight:6},children:[F,".log"]},F))}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.audit")})}),a.jsxs("div",{className:"list",children:[we.visible.map((F,_e)=>a.jsx("div",{className:"row static",children:a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:F.kind}),a.jsxs("span",{className:"row-sub",children:[Lo(F.at),F.task?` ・ ${F.task}`:"",F.action?` ・ ${F.action}`:"",F.ok===!1?` ・ ${r("settings.auditFailed")}`:""]})]})},`${F.at??"x"}-${F.kind??""}-${_e}`)),we.visible.length?null:a.jsx("div",{className:"empty",children:r("settings.auditEmpty")})]}),we.canExpand?a.jsx("button",{type:"button",className:"btn settings-audit-more","aria-expanded":we.expanded,style:{marginTop:8},onClick:()=>{H("tap"),k(F=>!F)},children:we.expanded?r("settings.auditCollapse"):r("settings.auditShowMore",{count:we.hiddenCount})}):null]}),a.jsxs("section",{id:"sec-status",className:"card settings-card",children:[a.jsx(Br,{icon:"🩺",title:r("settings.secStatus")}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Hermes"}),a.jsx("b",{children:((wt=e==null?void 0:e.hermes)==null?void 0:wt.version)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.model")}),a.jsx("b",{children:((Tt=e==null?void 0:e.hermes)==null?void 0:Tt.model)??"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.memory")}),a.jsx("b",{children:L?r("settings.memoryValue",{used:Tl(L.used),total:Tl(L.total),percent:L.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.disk")}),a.jsx("b",{children:se?r("settings.diskValue",{free:Tl(se.free),percent:se.percent}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.bridge")}),a.jsx("b",{className:(ue==null?void 0:ue.ok)===!1?"bad-text":"",children:ue?ue.ok?r("settings.bridgeOk",{uptime:ue.uptimeSec}):r("settings.disconnected"):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.reviewWaiting")}),a.jsx("b",{children:U?r("settings.kanbanValue",{waiting:U.reviewWaiting,running:U.running}):"—"})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.lastChecked")}),a.jsx("b",{children:tt(e==null?void 0:e.checkedAt)})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.launchSource")}),a.jsx("b",{children:Ee})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:r("settings.installability")}),a.jsx("b",{children:d.available?r("settings.installPossible"):d.installed?r("settings.installDone"):r("settings.installNo")})]}),a.jsxs("div",{className:"kv",children:[a.jsx("span",{children:"Service Worker"}),a.jsx("b",{children:A0()})]}),a.jsxs("button",{className:"btn hm-btn-inner",style:{marginTop:8},disabled:h,"aria-busy":h,onClick:async()=>{H("tap"),x(!0);try{const F=await I0();f(F),Y("/api/client-error",{method:"POST",body:{kind:"pwa-diag",href:location.href,referrer:document.referrer||"",displayMode:["standalone","minimal-ui","fullscreen","browser"].filter(_e=>matchMedia(`(display-mode: ${_e})`).matches).join(","),rows:F}}).catch(()=>{})}finally{x(!1)}},children:[h?a.jsx(hn,{size:14}):null,a.jsx("span",{children:r(h?"settings.diagRunning":"settings.diagRun")})]}),g&&a.jsx("div",{className:"diag",style:{marginTop:10,fontSize:12,lineHeight:1.5},children:g.map(F=>a.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0"},children:[a.jsx("span",{style:{color:F.ok?"var(--good)":"var(--bad)",flex:"0 0 auto"},children:F.ok?"✓":"✗"}),a.jsx("span",{style:{flex:"1 1 auto",color:F.ok?"var(--text)":"var(--danger-fg)"},children:F.label}),a.jsx("span",{style:{flex:"1 1 50%",color:"var(--muted)",wordBreak:"break-all",textAlign:"right"},children:F.detail})]},F.label))}),d.available&&a.jsx("button",{className:"btn primary",style:{marginTop:8},onClick:async()=>{const F=await d.prompt();t==null||t(r(F==="accepted"?"settings.installPromptAccepted":"settings.installPromptCancelled"))},children:r("settings.installApp")}),a.jsx(Xs,{label:r("settings.refresh"),ariaLabel:r("settings.refreshAria"),className:"hm-btn-inner",onRefresh:async()=>!!await(n==null?void 0:n())}),a.jsx("div",{className:"list-head",children:a.jsx("span",{children:r("settings.recentSessions")})}),a.jsxs("div",{className:"list",children:[_.map(F=>a.jsxs("div",{className:"row static",children:[a.jsx("span",{className:`dot ${F.active?"running":"done"}`}),a.jsxs("span",{className:"row-main",children:[a.jsx("span",{className:"row-title",children:F.title??F.id}),a.jsxs("span",{className:"row-sub",children:[F.source," ・ ",F.messages," msg ・ ",F.lastActivity??""]})]})]},F.id)),_.length?null:a.jsx("div",{className:"empty",children:r("settings.none")})]}),a.jsxs("div",{className:"row-sub",style:{padding:"10px 0 0",lineHeight:1.7},children:[r("settings.about",{version:"0.2.3"})," ",a.jsx("span",{className:"mono",children:"~/.hermes/plugin-data/hermes-pilot/token"})]})]}),m?a.jsx(Qe,{title:m.name,onClose:()=>v(null),children:a.jsx("pre",{className:"logbox",children:m.text})}):null,Ae?a.jsxs(Qe,{title:r("settings.pairingTitle"),onClose:()=>et(null),children:[a.jsx("div",{className:"row-sub",style:{lineHeight:1.6},children:r("settings.pairingScanHint")}),Ae.qrPng?a.jsx("div",{className:"pair-qr",children:a.jsx("img",{className:"pair-qr-img",src:Ae.qrPng,width:287,height:287,alt:"Pairing QR"})}):Ae.qrRows?a.jsx("div",{className:"pair-qr",children:a.jsx(X0,{rows:Ae.qrRows,margin:Ae.qrMargin??4,size:Math.min(320,Math.max(220,(typeof window<"u"?window.innerWidth:390)-70))})}):Ae.qrSvg?a.jsx("div",{className:"pair-qr",dangerouslySetInnerHTML:{__html:Ae.qrSvg}}):a.jsx("div",{className:"empty",children:r("settings.pairingEmpty")}),a.jsx("div",{className:"list",style:{marginTop:10},children:(Ae.targets??[]).map(F=>a.jsxs("div",{className:"row static",children:[a.jsxs("span",{className:"row-main",style:{minWidth:0},children:[a.jsx("span",{className:"row-title",children:F.label}),a.jsx("span",{className:"row-sub mono",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F.url})]}),a.jsx("button",{className:"link",onClick:()=>ct(F.url),children:r("settings.pairingCopy")})]},F.url))}),a.jsx("div",{className:"row-sub",style:{marginTop:10,lineHeight:1.6},children:r("settings.pairingNote")})]}):null]})}function nN({onClose:e,onOpenSession:t,notify:n}){const{t:s}=Fe(),[r,i]=u.useState(""),[l,o]=u.useState(null),[c,d]=u.useState(!1),g=u.useRef(null),f=u.useRef(0);u.useEffect(()=>{const b=setTimeout(()=>{var w;return(w=g.current)==null?void 0:w.focus()},120);return()=>clearTimeout(b)},[]);const h=u.useCallback(async b=>{const w=b.trim();if(!w){o(null);return}const S=++f.current;d(!0);try{const k=await Y(`/api/search?q=${encodeURIComponent(w)}&limit=30`);S===f.current&&o(k)}catch(k){S===f.current&&(o({ok:!1,reason:k.message,hits:[]}),n==null||n(k.message))}finally{S===f.current&&d(!1)}},[n]);u.useEffect(()=>{const b=setTimeout(()=>h(r),280);return()=>clearTimeout(b)},[r,h]);const x=(l==null?void 0:l.hits)??[];return a.jsxs(Qe,{title:s("search.title"),onClose:e,children:[a.jsx("input",{ref:g,className:"inp",value:r,onChange:b=>i(b.target.value),placeholder:s("search.placeholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,inputMode:"search",enterKeyHint:"search"}),a.jsx("div",{className:"row-sub",style:{padding:"8px 4px 4px",display:"flex",alignItems:"center",gap:6},children:c?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12}),a.jsx("span",{children:s("search.searching")})]}):l!=null&&l.ok?s("search.resultCount",{count:x.length,ms:Math.round(l.tookMs)}):(l==null?void 0:l.reason)??s("search.hint")}),a.jsxs("div",{className:"list",children:[x.map(b=>a.jsx("button",{className:"list-item",onClick:()=>{H("tap"),t==null||t(b),e==null||e()},children:a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsx("span",{className:"row-title",style:{fontSize:12.5},children:b.snippet||s("search.emptySnippet")}),a.jsxs("span",{className:"row-sub",children:[b.role==="user"?s("search.you"):b.role==="assistant"?"Hermes":b.role,` ・ ${tt(b.at)}`,b.sessionTitle?` ・ ${String(b.sessionTitle).slice(0,28)}`:"",b.profile&&b.profile!=="default"?` ・ ${b.profile}`:"",b.source?` ・ ${b.source}`:""]})]})},`${b.profile??"default"}:${b.messageId}`)),!c&&(l!=null&&l.ok)&&!x.length?a.jsx("div",{className:"empty",children:s("search.none")}):null]}),a.jsx("div",{className:"row-sub",style:{padding:"12px 4px 18px",lineHeight:1.7},children:s("search.note")})]})}const sN=["title","body","tagsText","color","pinned","checklist"],Ri=e=>e==null?"":String(e);function ey(e){return Array.isArray(e)?e.map(t=>({id:Ri(t==null?void 0:t.id),text:Ri(t==null?void 0:t.text),done:!!(t!=null&&t.done)})):[]}function qu(e){const t=e??{},n={};for(const s of sN)s==="checklist"?n[s]=ey(t.checklist):s==="pinned"?n[s]=!!t.pinned:n[s]=Ri(t[s]);return JSON.stringify(n)}function Xu(e){return e?Ri(e.title).trim()||Ri(e.body).trim()?!0:ey(e.checklist).length>0:!1}function rN(e,t){if(!e)return!1;if(t==null||t==="")return Xu(e);const n=typeof t=="string"?t:qu(t);return qu(e)!==n}function ty(e){return e==="list"}function Fm(e){return!ty(e)}function aN(e,t={}){var r;const n=t.canOpenChat!==!1,s=[{action:"pin",labelKey:e!=null&&e.pinned?"notes.unpin":"notes.pin"},{action:"brainstorm",labelKey:"notes.brainstorm"},{action:"seed",labelKey:"notes.toSeed"}];return n&&((r=e==null?void 0:e.source)!=null&&r.chatId)&&s.push({action:"chat",labelKey:"notes.openChat"}),s}const ny="hm.memosView",sy=["one","two","list"],Zu="two";function iN(e){const t=typeof e=="string"?e.trim():"";return sy.includes(t)?t:Zu}function lN(e,t){if(!e||typeof e.setItem!="function"||!sy.includes(t))return!1;try{return e.setItem(ny,t),!0}catch{return!1}}const oN=3;function cN(e=[],t,n=oN){const s=Array.isArray(e)?e:[];return t!=="two"||s.length<=n?{visible:s,hidden:0}:{visible:s.slice(0,n),hidden:s.length-n}}function uN(e){if(!e||typeof e.getItem!="function")return Zu;try{return iN(e.getItem(ny))}catch{return Zu}}const dN=["default","teal","amber","violet"],pN=[{view:"one",glyph:"1",labelKey:"notes.viewOne"},{view:"two",glyph:"2",labelKey:"notes.viewTwo"},{view:"list",glyph:"☰",labelKey:"notes.viewList"}];function hN(e){return String(e??"").split(/[,、\s]+/).map(t=>t.trim().replace(/^#+/,"")).filter(Boolean)}function mN({notify:e,onOpenChat:t}){const{t:n}=Fe(),[s,r]=u.useState([]),[i,l]=u.useState([]),[o,c]=u.useState(!0),[d,g]=u.useState(""),[f,h]=u.useState("all"),[x,b]=u.useState(""),[w,S]=u.useState(null),[k,m]=u.useState(""),[v,T]=u.useState(!1),[E,_]=u.useState(()=>uN(typeof localStorage>"u"?null:localStorage)),[I,A]=u.useState(null),[P,y]=u.useState(null),[K,$]=u.useState(!1),[V,D]=u.useState(0),X=u.useCallback(async()=>{var M,W;try{const[L,se]=await Promise.allSettled([Y("/api/memos"),Y("/api/chat-reports?limit=20")]);L.status==="fulfilled"&&Array.isArray((M=L.value)==null?void 0:M.memos)&&r(L.value.memos),se.status==="fulfilled"&&Array.isArray((W=se.value)==null?void 0:W.reports)&&l(se.value.reports)}finally{c(!1)}},[]);u.useEffect(()=>{X();const M=()=>X();return window.addEventListener("hm:memos-changed",M),()=>window.removeEventListener("hm:memos-changed",M)},[X]);const ge=u.useMemo(()=>{const M=new Set;for(const W of s)for(const L of W.tags||[])M.add(L);return[...M].slice(0,12)},[s]),Z=u.useMemo(()=>{var W;const M=new Set;for(const L of s)(W=L.source)!=null&&W.reportKey&&M.add(L.source.reportKey);return M},[s]),G=u.useMemo(()=>{const M=d.trim().toLowerCase();return s.filter(W=>{if(f==="pinned"&&!W.pinned||f==="report"&&W.kind!=="report")return!1;if(f.startsWith("tag:")){const se=f.slice(4).toLowerCase();if(!(W.tags||[]).some(ue=>ue.toLowerCase()===se))return!1}return M?[W.title,W.body,...W.tags||[],...(W.checklist||[]).map(se=>se.text)].join(`
92
92
  `).toLowerCase().includes(M):!0})},[s,f,d]),q=u.useCallback(async()=>{const M=x.trim();if(!(!M||v)){T(!0);try{const W=await Y("/api/memos",{method:"POST",body:{title:"",body:M,tags:["idea"],kind:"note",color:"default"}});W!=null&&W.memo&&r(L=>[W.memo,...L]),b(""),bt("approve"),e==null||e(n("notes.saved"))}catch(W){e==null||e((W==null?void 0:W.message)||"Error")}finally{T(!1)}}},[x,v,e,n]),ce=u.useCallback(async(M,W)=>{var ue;(ue=W==null?void 0:W.stopPropagation)==null||ue.call(W),H("tap");const L=!M.pinned;r(U=>U.map(ee=>ee.id===M.id?{...ee,pinned:L}:ee));const se=await Y(`/api/memos/${encodeURIComponent(M.id)}`,{method:"PATCH",body:{pinned:L}});se!=null&&se.memo&&X()},[X]),te=u.useCallback(async(M,W,L)=>{var U;(U=L==null?void 0:L.stopPropagation)==null||U.call(L),H("tap");const se=(M.checklist||[]).find(ee=>ee.id===W);se&&!se.done&&bt("spark",{x:L==null?void 0:L.clientX,y:L==null?void 0:L.clientY,sound:!1});const ue=(M.checklist||[]).map(ee=>ee.id===W?{...ee,done:!ee.done}:ee);r(ee=>ee.map(we=>we.id===M.id?{...we,checklist:ue}:we)),await Y(`/api/memos/${encodeURIComponent(M.id)}`,{method:"PATCH",body:{checklist:ue}})},[]),pe=u.useCallback(async M=>{const W=M.key||`${M.at||""}:${M.title||""}`;if(!Z.has(W))try{const L=await Y("/api/memos",{method:"POST",body:{title:M.title||M.specTitle||"Report",body:M.summary||M.body||"",tags:["report"],kind:"report",color:"amber",source:{chatId:M.chat||void 0,board:M.board||void 0,reportKey:W}}});L!=null&&L.memo&&(r(se=>[L.memo,...se]),bt("approve"),e==null||e(n("notes.inboxSaved")))}catch(L){e==null||e((L==null?void 0:L.message)||"Error")}},[Z,e,n]),ve=(M=null)=>{if(H("tap"),m(""),$(!1),M){const W={id:M.id,title:M.title||"",body:M.body||"",tagsText:(M.tags||[]).join(", "),pinned:!!M.pinned,color:M.color||"default",kind:M.kind||"note",checklist:[...M.checklist||[]]};S(W),y(qu(W))}else S({id:null,title:"",body:"",tagsText:"idea",pinned:!1,color:"default",kind:"note",checklist:[]}),y(null)},xe=async()=>{if(!w||v)return!1;const M=hN(w.tagsText);if(!w.id&&!Xu(w))return!1;T(!0);try{let W=!1;if(w.id){const L=await Y(`/api/memos/${encodeURIComponent(w.id)}`,{method:"PATCH",body:{title:w.title,body:w.body,tags:M,pinned:w.pinned,color:w.color,checklist:w.checklist}});L!=null&&L.memo&&(X(),bt("approve"),e==null||e(n("notes.saved")),W=!0)}else{const L=await Y("/api/memos",{method:"POST",body:{title:w.title,body:w.body,tags:M,pinned:w.pinned,color:w.color,kind:"note",checklist:w.checklist}});L!=null&&L.memo&&(X(),bt("approve"),e==null||e(n("notes.saved")),W=!0)}return W&&($(!1),y(null),S(null)),W}catch(W){return e==null||e((W==null?void 0:W.message)||"Error"),!1}finally{T(!1)}},Oe=u.useCallback(()=>{if(!v){if(!rN(w,P)){$(!1),S(null);return}H("tap"),$(!0)}},[w,P,v]),Ae=async()=>{$(!1),await xe()},et=()=>{H("tap"),$(!1),m(""),y(null),S(null)},We=()=>{H("tap"),$(!1),D(M=>M+1)},Dt=async()=>{if(!(!(w!=null&&w.id)||v)){T(!0);try{await Y(`/api/memos/${encodeURIComponent(w.id)}`,{method:"DELETE"}),r(M=>M.filter(W=>W.id!==w.id)),$(!1),y(null),S(null),e==null||e(n("notes.deleted"))}catch(M){e==null||e((M==null?void 0:M.message)||"Error")}finally{T(!1)}}},ht=(M,W)=>{var se;(se=W==null?void 0:W.stopPropagation)==null||se.call(W),H("tap");const L=[M.title,M.body].filter(Boolean).join(`
93
93
  `).trim();window.dispatchEvent(new CustomEvent("hm:open-brainstorm",{detail:{seed:L,memoId:M.id}}))},ct=(M,W)=>{var se,ue,U;(se=W==null?void 0:W.stopPropagation)==null||se.call(W),H("tap");const L=[M.title,M.body,...(M.checklist||[]).map(ee=>`- [${ee.done?"x":" "}] ${ee.text}`)].filter(Boolean).join(`
94
- `).trim();window.dispatchEvent(new CustomEvent("hm:open-seed",{detail:{seed:L,repo:(ue=M.source)==null?void 0:ue.repo,board:(U=M.source)==null?void 0:U.board}}))},yt=(M,W)=>{var L;A(null),W&&(M==="pin"?ce(W):M==="brainstorm"?ht(W):M==="seed"?ct(W):M==="chat"&&((L=W.source)!=null&&L.chatId)&&(H("tap"),t==null||t(W.source.chatId)))},Ge=M=>{H("tap"),_(M);try{lN(window.localStorage,M)}catch{}},$e=u.useMemo(()=>i.filter(M=>{const W=M.key||`${M.at||""}:${M.title||""}`;return!Z.has(W)}),[i,Z]);return a.jsxs("div",{className:"pane memos-pane",children:[a.jsxs("div",{className:"memos-header",children:[a.jsxs("div",{className:"memos-header-titles",children:[a.jsxs("div",{className:"memos-header-title",children:["💡 ",n("notes.title")]}),a.jsx("div",{className:"memos-header-sub",children:n("notes.subtitle")})]}),a.jsxs("div",{className:"memos-header-actions",children:[a.jsx("button",{type:"button",className:"btn primary memos-new-btn",onClick:()=>ve(null),children:n("notes.newBtn")}),a.jsx(Xs,{variant:"icon",onRefresh:X})]})]}),a.jsxs("div",{className:"memos-quick-bar",children:[a.jsx("input",{type:"text",className:"memos-quick-input",value:x,placeholder:n("notes.quickPlaceholder"),onChange:M=>b(M.target.value),onKeyDown:M=>{var W;M.key==="Enter"&&!((W=M.nativeEvent)!=null&&W.isComposing)&&(M.preventDefault(),q())}}),a.jsx("button",{type:"button",className:"btn",disabled:!x.trim()||v,onClick:q,children:n("notes.addChecklistBtn")})]}),a.jsxs("div",{className:"memos-search-row",children:[a.jsx("input",{type:"search",className:"memos-search-input",value:d,placeholder:n("notes.searchPlaceholder"),onChange:M=>g(M.target.value)}),a.jsx("div",{className:"memos-view-seg",role:"group","aria-label":n("notes.viewGroupAria"),children:pN.map(M=>a.jsx("button",{type:"button",className:`memos-view-btn${E===M.view?" on":""}`,"aria-pressed":E===M.view,"aria-label":n(M.labelKey),title:n(M.labelKey),onClick:()=>Ge(M.view),children:M.glyph},M.view))})]}),a.jsxs("div",{className:"chips memos-filter-chips",children:[a.jsx("button",{type:"button",className:`chip${f==="all"?" on":""}`,onClick:()=>h("all"),children:n("notes.filterAll")}),a.jsx("button",{type:"button",className:`chip${f==="pinned"?" on":""}`,onClick:()=>h("pinned"),children:n("notes.filterPinned")}),a.jsx("button",{type:"button",className:`chip${f==="report"?" on":""}`,onClick:()=>h("report"),children:n("notes.filterReports")}),ge.map(M=>a.jsxs("button",{type:"button",className:`chip${f===`tag:${M}`?" on":""}`,onClick:()=>h(f===`tag:${M}`?"all":`tag:${M}`),children:["#",M]},M))]}),$e.length?a.jsxs("details",{className:"memos-inbox-box",children:[a.jsxs("summary",{className:"memos-inbox-summary",children:[a.jsxs("span",{children:["📬 ",n("notes.inboxHead",{n:$e.length})]}),a.jsx(Me,{name:"chevron",size:14})]}),a.jsx("div",{className:"memos-inbox-list",children:$e.slice(0,6).map((M,W)=>a.jsxs("div",{className:"memos-inbox-row",children:[a.jsxs("div",{className:"memos-inbox-main",children:[a.jsx("div",{className:"row-title",children:M.title||M.specTitle||"Report"}),M.summary?a.jsx("div",{className:"row-sub",children:M.summary}):null]}),a.jsx("button",{type:"button",className:"btn",onClick:()=>pe(M),children:n("notes.inboxSave")})]},M.key||W))})]}):null,o?a.jsx(Wn,{label:n("common.loading")}):null,!o&&!G.length?a.jsx("div",{className:"empty",children:n("notes.empty")}):null,a.jsx("div",{className:`memos-grid view-${E}`,children:G.map(M=>{var se,ue,U,ee,we,ut;const W=[(se=M.source)==null?void 0:se.chatTitle,(ue=M.source)==null?void 0:ue.repo,(U=M.source)==null?void 0:U.board].filter(Boolean).join(" · "),L=cN(M.checklist,E);return a.jsxs("article",{className:`card memo-card color-${M.color||"default"}${M.pinned?" is-pinned":""}${M.body?" has-body":""}`,onClick:()=>ve(M),children:[a.jsxs("div",{className:"memo-card-head",children:[a.jsx("div",{className:"memo-card-title",children:M.title||(M.kind==="report"?"📬 Report":"💡")}),Fm(E)?a.jsx("button",{type:"button",className:`memo-pin-btn${M.pinned?" on":""}`,"aria-label":M.pinned?n("notes.unpin"):n("notes.pin"),onClick:Ee=>ce(M,Ee),children:"📌"}):null]}),M.body?a.jsx("div",{className:"memo-card-body",children:M.body}):null,(ee=M.checklist)!=null&&ee.length?a.jsxs("div",{className:"memo-checklist",children:[L.visible.map(Ee=>E==="two"?a.jsxs("span",{className:`memo-check-row${Ee.done?" done":""}`,children:[a.jsx("span",{"aria-hidden":"true",children:Ee.done?"☑":"☐"}),a.jsx("span",{children:Ee.text})]},Ee.id):a.jsxs("button",{type:"button",className:`memo-check-row${Ee.done?" done":""}`,onClick:He=>te(M,Ee.id,He),children:[a.jsx("span",{"aria-hidden":"true",children:Ee.done?"☑":"☐"}),a.jsx("span",{children:Ee.text})]},Ee.id)),L.hidden?a.jsx("span",{className:"memo-check-more",children:n("notes.moreItems",{n:L.hidden})}):null]}):null,(we=M.tags)!=null&&we.length?a.jsx("div",{className:"memo-tags",children:M.tags.map(Ee=>a.jsxs("span",{className:"memo-tag",children:["#",Ee]},Ee))}):null,W?a.jsx("div",{className:"memo-source-meta",children:n("notes.sourceMeta",{meta:W})}):null,Fm(E)?a.jsxs("div",{className:"memo-card-actions",children:[a.jsx("button",{type:"button",className:"report-card-btn",onClick:Ee=>ht(M,Ee),children:n("notes.brainstorm")}),a.jsx("button",{type:"button",className:"report-card-btn primary",onClick:Ee=>ct(M,Ee),children:n("notes.toSeed")}),(ut=M.source)!=null&&ut.chatId&&t?a.jsx("button",{type:"button",className:"report-card-btn",onClick:Ee=>{Ee.stopPropagation(),H("tap"),t(M.source.chatId)},children:n("notes.openChat")}):null]}):null,ty(E)?a.jsx("button",{type:"button",className:"memo-more-btn","aria-label":n("notes.more"),"aria-haspopup":"dialog",onClick:Ee=>{Ee.stopPropagation(),H("tap"),A(M)},children:"⋯"}):null]},M.id)})}),I?a.jsx(Qe,{title:I.title||n("notes.menuTitle"),onClose:()=>A(null),children:a.jsx("div",{className:"memo-menu",children:aN(I,{canOpenChat:!!t}).map(M=>a.jsx("button",{type:"button",className:"memo-menu-row",onClick:()=>yt(M.action,I),children:n(M.labelKey)},M.action))})}):null,w?a.jsxs(Qe,{title:w.id?n("notes.editTitle"):n("notes.createTitle"),onClose:Oe,historyKey:V,children:[K?a.jsxs("div",{className:"memo-unsaved",role:"alertdialog","aria-label":n("notes.unsavedTitle"),children:[a.jsx("div",{className:"memo-unsaved-title",children:n("notes.unsavedTitle")}),a.jsx("div",{className:"memo-unsaved-sub",children:n("notes.unsavedSub")}),a.jsxs("div",{className:"memo-unsaved-actions",children:[a.jsx("button",{type:"button",className:"btn primary",disabled:v,onClick:Ae,children:n("notes.saveAndClose")}),a.jsx("button",{type:"button",className:"btn ghost",disabled:v,onClick:et,children:n("notes.discard")}),a.jsx("button",{type:"button",className:"btn",onClick:We,children:n("notes.keepEditing")})]})]}):null,a.jsxs("div",{className:"memo-editor",style:K?{display:"none"}:void 0,children:[a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldTitle")}),a.jsx("input",{type:"text",className:"memo-input",value:w.title,placeholder:n("notes.fieldTitlePh"),onChange:M=>S(W=>({...W,title:M.target.value}))})]}),a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldBody")}),a.jsx("textarea",{rows:4,className:"memo-textarea",value:w.body,placeholder:n("notes.fieldBodyPh"),onChange:M=>S(W=>({...W,body:M.target.value}))})]}),a.jsxs("div",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldChecklist")}),a.jsxs("div",{className:"memo-editor-checks",children:[w.checklist.map(M=>a.jsxs("div",{className:"memo-editor-check-item",children:[a.jsx("input",{type:"checkbox",checked:M.done,onChange:()=>S(W=>({...W,checklist:W.checklist.map(L=>L.id===M.id?{...L,done:!L.done}:L)}))}),a.jsx("span",{className:M.done?"done":"",children:M.text}),a.jsx("button",{type:"button",className:"link",onClick:()=>S(W=>({...W,checklist:W.checklist.filter(L=>L.id!==M.id)})),children:"✕"})]},M.id)),a.jsxs("div",{className:"memo-check-add-row",children:[a.jsx("input",{type:"text",className:"memo-input",value:k,placeholder:n("notes.addChecklistPh"),onChange:M=>m(M.target.value)}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{const M=k.trim();M&&(S(W=>({...W,checklist:[...W.checklist,{id:`c_${Date.now()}`,text:M,done:!1}]})),m(""))},children:n("notes.addChecklistBtn")})]})]})]}),a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldTags")}),a.jsx("input",{type:"text",className:"memo-input",value:w.tagsText,placeholder:n("notes.fieldTagsPh"),onChange:M=>S(W=>({...W,tagsText:M.target.value}))})]}),a.jsxs("div",{className:"memo-color-row",children:[a.jsx("span",{children:n("notes.colorLabel")}),a.jsx("div",{className:"chips",style:{padding:0},children:dN.map(M=>a.jsx("button",{type:"button",className:`chip${w.color===M?" on":""}`,onClick:()=>S(W=>({...W,color:M})),children:M},M))})]}),a.jsxs("div",{className:"memo-editor-actions",children:[a.jsx("button",{type:"button",className:"btn primary",disabled:v||!w.id&&!Xu(w),onClick:xe,children:n("notes.save")}),w.id?a.jsx("button",{type:"button",className:"btn ghost",disabled:v,onClick:Dt,children:n("notes.delete")}):null]})]})]}):null]})}const fN={allClear:18,receipt:18,vibeWarp:18,launch:16,fastTrack:16,approve:12,stamp:12,combo:10,send:5,spark:4},gN=720,vN=1800,yN=2400,Bm=".btn, .chip, .hm-switch, .seed-seg-btn, .seed-toggle, .seed-submit, .report-card-btn, .composer .plus, .composer .send, .chat-report-btn, .pill-btn, .ak-btn, .ak-empty-btn, .ak-thumb-btn, .ak-anno-preview-btn, .receipt-btn, .spec-banner-btn, .job-bar-btn, .job-bar-x, .icon-btn, .prof-chip, .snippet-chip, .settings-nav-chip, .pick-item, .list-item, .row:not(.static), .stat, .spec-bar, .inbox-bar, details > summary, .link, .code-copy, button.t-pill, .nav-item",wN=".btn, .chip, .hm-switch, .seed-seg-btn, .seed-toggle, .seed-submit, .report-card-btn, .composer .plus, .composer .send, .chat-report-btn, .pill-btn, .ak-btn, .ak-empty-btn, .ak-thumb-btn, .ak-anno-preview-btn, .receipt-btn, .spec-banner-btn, .job-bar-btn, .icon-btn, .prof-chip, .snippet-chip, .settings-nav-chip, details > summary, button.t-pill, .nav-item",xN=".hm-switch, .seed-toggle",kN=".seed-seg-btn, .chip, .prof-chip, .snippet-chip.trigger, .settings-nav-chip",bN={fastTrack:"fx.sfx.fastTrack",approve:"fx.sfx.approve",stamp:"fx.sfx.stamp",launch:"fx.sfx.launch",vibeWarp:"fx.sfx.vibeWarp",send:"fx.sfx.send",allClear:"fx.sfx.allClear",receipt:"fx.sfx.allClear",toggle:"fx.sfx.toggle"};function Fc(){var e,t,n;try{return!!((n=(t=(e=globalThis.window)==null?void 0:e.matchMedia)==null?void 0:t.call(e,np))!=null&&n.matches)}catch{return!1}}function ry(e=0){return e>=3?{hues:["gold","gold","amber","gold-dim"],primary:"#fbbf24",secondary:"#fde68a"}:e===2?{hues:["cyan","gold","teal","gold"],primary:"#22d3ee",secondary:"#fbbf24"}:{hues:["teal","mint","cyan","gold-dim"],primary:"#2dd4bf",secondary:"#5eead4"}}function SN(e,t=0){const n=fN[e]??12,{hues:s}=ry(t);return Array.from({length:n},(r,i)=>{const l=Math.PI*2*i/n+Math.random()*.5,o=(e==="spark"||e==="send"?24:54)+Math.random()*(e==="spark"||e==="send"?32:96);return{id:i,dx:Math.round(Math.cos(l)*o),dy:Math.round(Math.sin(l)*o-(e==="allClear"?26:e==="send"?34:0)),rot:Math.round(Math.random()*300-150),delay:Math.round(Math.random()*90),hue:s[i%s.length]}})}function Um({kind:e,x:t,y:n,width:s,height:r,sfxText:i,combo:l=0}){var _,I;const o=((_=globalThis.window)==null?void 0:_.innerWidth)||390,c=((I=globalThis.window)==null?void 0:I.innerHeight)||844,d=Number.isFinite(t)?t:o*.5,g=Number.isFinite(n)?n:c*.38,f=Number.isFinite(s)&&s>0?s:84,h=Number.isFinite(r)&&r>0?r:36,x=ry(l),b=e==="approve"||e==="fastTrack"||e==="launch"||e==="vibeWarp"||e==="allClear"||e==="receipt"||e==="tapImpact",w=e==="tap"||e==="toggle",S=b?10:w?6:e==="spark"||e==="send"?4:6,k=Array.from({length:S},(A,P)=>({angle:Math.PI*2*P/S+(Math.random()-.5)*.25,inner:(w?10:12)+Math.random()*8,outer:(b?54:w?36:30)+Math.random()*24,color:P%2===0?x.primary:x.secondary})),m=e==="spark"||e==="send"?0:b?5:3,v=Array.from({length:m},(A,P)=>{const y=P%2===0?-1:1;return{ox:d+y*(f*.34+Math.random()*12),oy:g+h*.25+(Math.random()-.5)*8,vx:y*(26+Math.random()*32),vy:8+Math.random()*16,r0:4.5+Math.random()*3.5,r1:(b?16:12)+Math.random()*8}}),T=e==="spark"?3:e==="send"?4:b?8:5,E=Array.from({length:T},(A,P)=>{const y=Math.PI*2*P/T+Math.random()*.4,K=(e==="spark"?40:w?72:85)+Math.random()*65;return{x:d,y:g,vx:Math.cos(y)*K,vy:Math.sin(y)*K-35,rot:Math.random()*Math.PI*2,vrot:(Math.random()-.5)*10,size:(w?3:3.5)+Math.random()*3,color:P%2===0?x.primary:x.secondary}});return{start:performance.now(),duration:e==="vibeWarp"?440:b?520:380,cx:d,cy:g,h,hasImpact:b||w,irisRing:e==="vibeWarp"?{maxR:Math.ceil(Math.hypot(Math.max(d,o-d),Math.max(g,c-g)))}:null,trail:e==="send"?{x:d,y:g,dy:-165}:null,rays:k,smokes:v,chips:E,sfxText:i||null,sfxTilt:(Math.random()-.5)*.22,vw:o,vh:c}}function NN(){const{t:e}=Fe(),[t,n]=u.useState(()=>gs()),[s,r]=u.useState([]),[i,l]=u.useState(null),[o,c]=u.useState(null),[d,g]=u.useState(null),f=u.useRef(0),h=u.useRef([]),x=u.useRef(null),b=u.useRef([]),w=u.useRef(0),S=u.useRef(0),k=u.useRef(e);k.current=e;const m=()=>{for(const I of h.current)clearTimeout(I);h.current=[]},v=(I,A)=>{const P=setTimeout(I,A);return h.current.push(P),P},T=()=>{w.current&&(cancelAnimationFrame(w.current),w.current=0),b.current=[];const I=x.current;if(I){const A=I.getContext("2d");A&&A.clearRect(0,0,I.width,I.height)}},E=()=>{if(w.current||Fc())return;const I=A=>{if(gs()!=="dopamine"||document.visibilityState==="hidden"){T();return}const P=x.current;if(!P){w.current=0;return}const y=P.getContext("2d");if(!y){w.current=0;return}const K=Math.min(window.devicePixelRatio||1,2),$=window.innerWidth,V=window.innerHeight,D=Math.round($*K),X=Math.round(V*K);(P.width!==D||P.height!==X)&&(P.width=D,P.height=X),y.setTransform(K,0,0,K,0,0),y.clearRect(0,0,$,V);const ge=[];for(const Z of b.current){const G=A-Z.start,q=G/Z.duration;if(q>=1)continue;ge.push(Z);const ce=1-Math.pow(1-q,3);if(Z.irisRing){const te=Math.max(8,Z.irisRing.maxR*ce);y.save(),y.globalAlpha=Math.max(0,(1-q)*.92),y.strokeStyle="#22d3ee",y.lineWidth=Math.max(1.5,5*(1-q)),y.beginPath(),y.arc(Z.cx,Z.cy,te,0,Math.PI*2),y.stroke(),y.strokeStyle="#fde68a",y.lineWidth=Math.max(1,2*(1-q)),y.beginPath(),y.arc(Z.cx,Z.cy,Math.max(4,te-4),0,Math.PI*2),y.stroke(),y.restore()}if(Z.hasImpact&&q<.7){const te=q/.7,pe=1-Math.pow(1-te,2);y.save(),y.globalAlpha=Math.max(0,1-te)*.75,y.strokeStyle="#fbbf24",y.lineWidth=2*(1-te)+.5,y.beginPath(),y.arc(Z.cx,Z.cy,12+pe*46,0,Math.PI*2),y.stroke();for(const ve of Z.rays){const xe=ve.inner+pe*14,Oe=ve.inner+(ve.outer-ve.inner)*pe;y.strokeStyle=ve.color,y.lineWidth=2.2*(1-te),y.beginPath(),y.moveTo(Z.cx+Math.cos(ve.angle)*xe,Z.cy+Math.sin(ve.angle)*xe),y.lineTo(Z.cx+Math.cos(ve.angle)*Oe,Z.cy+Math.sin(ve.angle)*Oe),y.stroke()}y.restore()}if(Z.trail){const te=Z.trail.y+Z.trail.dy*ce,pe=Z.trail.y+Z.trail.dy*Math.max(0,ce-.35),ve=y.createLinearGradient(Z.trail.x,pe,Z.trail.x,te);ve.addColorStop(0,"rgba(34, 211, 238, 0)"),ve.addColorStop(.6,"rgba(45, 212, 191, 0.85)"),ve.addColorStop(1,"rgba(251, 191, 36, 0.95)"),y.save(),y.globalAlpha=Math.max(0,1-q),y.strokeStyle=ve,y.lineWidth=2.5,y.lineCap="round",y.beginPath(),y.moveTo(Z.trail.x,pe),y.lineTo(Z.trail.x,te),y.stroke(),y.restore()}if(Z.smokes.length){y.save();for(const te of Z.smokes){const pe=te.ox+te.vx*ce,ve=te.oy+te.vy*ce,xe=te.r0+(te.r1-te.r0)*ce;y.globalAlpha=Math.max(0,(1-q)*.36),y.fillStyle="#d1fae5",y.beginPath(),y.arc(pe,ve,xe,0,Math.PI*2),y.fill()}y.restore()}if(Z.chips.length){const te=G/1e3;y.save();for(const pe of Z.chips){const ve=pe.x+pe.vx*te,xe=pe.y+pe.vy*te+140*te*te;y.save(),y.translate(ve,xe),y.rotate(pe.rot+pe.vrot*te),y.globalAlpha=Math.max(0,1-q),y.fillStyle=pe.color,y.beginPath(),y.moveTo(0,-pe.size),y.lineTo(pe.size*.7,0),y.lineTo(0,pe.size),y.lineTo(-pe.size*.7,0),y.closePath(),y.fill(),y.restore()}y.restore()}if(Z.sfxText){const te=Math.min(1,q*1.15),pe=te<.25?.6+te/.25*.5:1.1-Math.min(1,(te-.25)/.25)*.1,ve=te>.65?Math.max(0,1-(te-.65)/.35):1,xe=Math.max(44,Math.min($-44,Z.cx)),Oe=Math.max(30,Math.min(V-28,Z.cy-Z.h*.55-14-ce*14));y.save(),y.translate(xe,Oe),y.rotate(Z.sfxTilt),y.scale(pe,pe),y.globalAlpha=ve,y.font="900 15px system-ui, -apple-system, sans-serif",y.textAlign="center",y.textBaseline="middle",y.lineJoin="round",y.lineWidth=4,y.strokeStyle="rgba(11, 18, 22, 0.92)",y.strokeText(Z.sfxText,0,0),y.fillStyle="#fde68a",y.fillText(Z.sfxText,0,0),y.restore()}}b.current=ge,ge.length>0?w.current=requestAnimationFrame(I):(w.current=0,y.clearRect(0,0,$,V))};w.current=requestAnimationFrame(I)};u.useEffect(()=>hv(n),[]),u.useEffect(()=>{const I=A=>{if(gs()!=="dopamine")return;const P=(A==null?void 0:A.detail)??{},y=String(P.kind??"combo"),K=f.current+=1,$=Number(P.combo)||0;if(r(V=>[...V,{id:K,kind:y,x:P.x,y:P.y,particles:SN(y,$)}].slice(-4)),v(()=>r(V=>V.filter(D=>D.id!==K)),gN),!Fc()&&document.visibilityState!=="hidden"){const V=bN[y],D=P.sfx||(V?k.current(V):null),X=performance.now();if(D)for(const Z of b.current)Z.fromClick&&X-Z.start<120&&(Z.sfxText=null);const ge=Um({kind:y,x:P.x,y:P.y,width:P.width,height:P.height,sfxText:D,combo:$});b.current=[...b.current,ge].slice(-6),E(),(y==="launch"||y==="vibeWarp")&&(g({id:K}),v(()=>g(Z=>(Z==null?void 0:Z.id)===K?null:Z),440))}$>=2&&(l({n:$,id:K}),v(()=>l(V=>(V==null?void 0:V.id)===K?null:V),vN)),$>=1&&(document.documentElement.dataset.combo=$>=3?"3":String($),clearTimeout(S.current),S.current=setTimeout(()=>{delete document.documentElement.dataset.combo},$o)),(y==="allClear"||y==="receipt")&&(c({kind:y,id:K}),v(()=>c(V=>(V==null?void 0:V.id)===K?null:V),yN))};return window.addEventListener(Fu,I),()=>window.removeEventListener(Fu,I)},[]),u.useEffect(()=>{const I=A=>{var y,K;const P=(K=(y=A.target)==null?void 0:y.closest)==null?void 0:K.call(y,Bm);!P||P.disabled||H("tap")};return document.addEventListener("click",I,{passive:!0,capture:!0}),()=>document.removeEventListener("click",I,{capture:!0})},[]),u.useEffect(()=>{if(t!=="dopamine"||Fc())return;const I=A=>{var K,$;if(gs()!=="dopamine")return;const P=($=(K=A.target)==null?void 0:K.closest)==null?void 0:$.call(K,Bm);if(!P||P.disabled)return;if(!P.matches(wN)){P.classList.remove("fx-sakuga-lite"),P.offsetWidth,P.classList.add("fx-sakuga-lite"),v(()=>P.classList.remove("fx-sakuga-lite"),180);return}if(P.classList.remove("fx-sakuga-pop"),P.offsetWidth,P.classList.add("fx-sakuga-pop"),v(()=>P.classList.remove("fx-sakuga-pop"),340),document.visibilityState!=="hidden"){const V=P.getBoundingClientRect();if(V.width>0&&V.height>0){const D=P.matches(xN),X=!D&&P.matches(kN),ge=P.classList.contains("send")&&!P.classList.contains("stop"),Z=P.classList.contains("primary")||P.classList.contains("fast-track")||P.classList.contains("seed-submit")||P.classList.contains("ak-empty-btn")||P.classList.contains("ak-new-btn")||P.classList.contains("spec-banner-btn")&&!P.classList.contains("ghost")||ge,G=D||X?"toggle":Z?"tapImpact":"tap",q=D?k.current("fx.sfx.toggle"):X?k.current("fx.sfx.tick"):ge?k.current("fx.sfx.send"):Z?k.current("fx.sfx.tapImpact"):null,ce=Um({kind:G,x:V.left+V.width/2,y:V.top+V.height/2,width:V.width,height:V.height,sfxText:q});ce.fromClick=!0,b.current=[...b.current,ce].slice(-6),E()}}};return document.addEventListener("click",I,{passive:!0,capture:!0}),()=>document.removeEventListener("click",I,{capture:!0})},[t]),u.useEffect(()=>{const I=()=>{document.visibilityState==="hidden"&&T()};return document.addEventListener("visibilitychange",I),()=>document.removeEventListener("visibilitychange",I)},[]),u.useEffect(()=>{t!=="dopamine"&&(m(),clearTimeout(S.current),delete document.documentElement.dataset.combo,T(),r([]),l(null),c(null),g(null))},[t]),u.useEffect(()=>()=>{m(),clearTimeout(S.current),delete document.documentElement.dataset.combo,T()},[]);const _=t==="dopamine";return a.jsxs("div",{className:`fx-layer${_?"":" off"}`,"aria-hidden":"true",children:[a.jsx("canvas",{ref:x,className:"fx-canvas","aria-hidden":"true"}),_?s.map(I=>a.jsx("div",{className:`fx-burst fx-${I.kind}`,style:{left:I.x==null?"50%":`${I.x}px`,top:I.y==null?"38%":`${I.y}px`},children:I.particles.map(A=>a.jsx("i",{className:`fx-particle ${A.hue}`,style:{"--fx-dx":`${A.dx}px`,"--fx-dy":`${A.dy}px`,"--fx-rot":`${A.rot}deg`,animationDelay:`${A.delay}ms`}},A.id))},I.id)):null,_&&i?a.jsx("div",{className:"fx-combo-pill",children:e("fx.combo",{n:i.n})},`c${i.id}`):null,_&&o?a.jsxs("div",{className:"fx-allclear-card",children:[a.jsx("span",{className:"fx-allclear-emoji","aria-hidden":"true",children:"🎉"}),a.jsx("span",{children:e("fx.allClear")})]},`f${o.id}`):null,_&&d?a.jsx("div",{className:"fx-scan-sweep"},`s${d.id}`):null]})}const vo=["token","pair"],ay=/^[0-9a-f]{32,}$/i;function iy(e=globalThis.location){const t=String((e==null?void 0:e.search)??""),n=new URLSearchParams(t.startsWith("?")?t.slice(1):t);for(const r of vo){const i=n.get(r);if(i&&String(i).trim())return String(i).trim()}const s=String((e==null?void 0:e.hash)??"").replace(/^#/,"");if(!s)return null;if(s.includes("=")){const r=new URLSearchParams(s);for(const i of vo){const l=r.get(i);if(l&&String(l).trim())return String(l).trim()}return null}return ay.test(s)?s:null}function jN(e=globalThis.location,t=globalThis.history){var i;if(!iy(e))return!1;let n;try{n=new URL(String((e==null?void 0:e.href)??`http://127.0.0.1${(e==null?void 0:e.pathname)??"/"}${(e==null?void 0:e.search)??""}${(e==null?void 0:e.hash)??""}`))}catch{return!1}let s=!1;for(const l of vo)n.searchParams.has(l)&&(n.searchParams.delete(l),s=!0);const r=n.hash.replace(/^#/,"");if(r){if(ay.test(r))n.hash="",s=!0;else if(r.includes("=")){const l=new URLSearchParams(r);let o=!1;for(const c of vo)l.has(c)&&(l.delete(c),o=!0);if(o){const c=l.toString();n.hash=c?`#${c}`:"",s=!0}}}if(!s)return!1;try{return(i=t==null?void 0:t.replaceState)==null||i.call(t,null,"",`${n.pathname}${n.search}${n.hash}`),!0}catch{return!1}}async function CN(e,t=globalThis.fetch){if(typeof e!="string"||!e)return{ok:!1,error:"EMPTY_TOKEN"};let n;try{n=await t("/api/auth/login",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-client":"mobile"},body:JSON.stringify({token:e})})}catch{return{ok:!1,error:"OFFLINE"}}return n!=null&&n.ok?{ok:!0,status:n.status}:{ok:!1,status:(n==null?void 0:n.status)??0,error:"REJECTED"}}async function EN({loc:e=globalThis.location,historyObj:t=globalThis.history,fetchImpl:n=globalThis.fetch}={}){const s=iy(e);if(!s)return{handled:!1,ok:!1};const r=await CN(s,n);return r.ok?(jN(e,t),{handled:!0,ok:!0}):{handled:!0,ok:!1,error:r.error}}const TN=3e4,ly="hermes-pilot:chunk-reload-at",AN=[/failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/importing a module script failed/i,/loading chunk\s*[\w-]*\s*failed/i,/loading css chunk\s*[\w-]*\s*failed/i,/dynamically imported module.*(failed|error)/i];function oy(e){if(!e)return!1;if(typeof e=="object"&&String(e.name??"")==="ChunkLoadError")return!0;const t=String((e==null?void 0:e.message)??e);return AN.some(n=>n.test(t))}const RN=(()=>{const e=new Map;return{getItem:t=>e.has(t)?e.get(t):null,setItem:(t,n)=>{e.set(t,String(n))},removeItem:t=>{e.delete(t)}}})();function PN(){try{if(typeof sessionStorage<"u"&&sessionStorage){const e=`${ly}:probe`;return sessionStorage.setItem(e,"1"),sessionStorage.removeItem(e),sessionStorage}}catch{}return RN}const IN=e=>new Promise(t=>setTimeout(t,e));function _N(e,{retries:t=2,delayMs:n=250,sleep:s=IN,isChunkError:r=oy}={}){const i=async l=>{try{return await e()}catch(o){if(l>=t||!r(o))throw o;return await s(n*(l+1)),i(l+1)}};return i(0)}function MN({storage:e,now:t=Date.now,reload:n=()=>{typeof location<"u"&&typeof location.reload=="function"&&location.reload()},cooldownMs:s=TN,key:r=ly}={}){const i=e??PN();return function(){const o=t();let c=0;try{c=Number((i==null?void 0:i.getItem(r))??0)||0}catch{c=0}if(c&&o-c<s)return!1;try{i==null||i.setItem(r,String(o))}catch{}return n(),!0}}const cy=MN(),LN=u.lazy(()=>_N(()=>_y(()=>import("./TermPane-q4f5Zu0I.js"),__vite__mapDeps([0,1]))).then(e=>({default:e.TermPane}))),ON=[{id:"tasks",key:"nav.tasks",icon:"grid"},{id:"review",key:"nav.review",icon:"pen"},{id:"chat",key:"nav.chat",icon:"chat"},{id:"notes",key:"nav.notes",icon:"memo"},{id:"term",key:"nav.term",icon:"term"},{id:"settings",key:"nav.settings",icon:"gear"}];function Ur({active:e,children:t}){const n=u.useRef(null);return u.useEffect(()=>{const s=n.current;if(!s)return;const r=!e;if("inert"in s&&(s.inert=r),r){const i=document.activeElement;i&&s.contains(i)&&typeof i.blur=="function"&&i.blur()}},[e]),a.jsx("div",{ref:n,className:`pane-host${e?"":" is-hidden"}`,"aria-hidden":e?void 0:"true",children:t})}function DN({error:e,onRetry:t}){const{t:n}=Fe();return a.jsx("div",{className:"pane",children:a.jsxs("div",{className:"card",children:[a.jsx("div",{className:"row-title",children:n("app.tabError")}),a.jsx("div",{className:"row-sub",style:{marginTop:6,lineHeight:1.7},children:String((e==null?void 0:e.message)??e)}),a.jsx("button",{className:"btn",style:{marginTop:12},onClick:t,children:n("common.retry")}),a.jsx("div",{className:"row-sub",style:{marginTop:8},children:n("app.tabErrorLog")})]})})}class Hr extends ze.Component{constructor(t){super(t),this.state={error:null,retryKey:0}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){try{fetch("/api/client-error",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-client":"mobile"},body:JSON.stringify({message:String((t==null?void 0:t.message)??t),stack:String((t==null?void 0:t.stack)??"").slice(0,4e3),componentStack:String((n==null?void 0:n.componentStack)??"").slice(0,4e3),tab:this.props.tab,ua:navigator.userAgent,url:location.href})}).catch(()=>{})}catch{}}retry(){oy(this.state.error)&&cy()||this.setState(t=>({error:null,retryKey:t.retryKey+1}))}render(){return this.state.error?a.jsx(DN,{error:this.state.error,onRetry:()=>this.retry()}):a.jsx(ze.Fragment,{children:this.props.children},`${this.props.tab}:${this.state.retryKey}`)}}function $N(){const{t:e}=Fe(),[t]=u.useState(()=>ik());u.useEffect(()=>qv(),[]),u.useEffect(()=>{const z=de=>{var ie;cy()&&((ie=de.preventDefault)==null||ie.call(de))};return window.addEventListener("vite:preloadError",z),()=>window.removeEventListener("vite:preloadError",z)},[]),u.useEffect(()=>{ub()},[]);const[n,s]=u.useState((t==null?void 0:t.open)==="inbox"||(t==null?void 0:t.open)==="tasks"?"tasks":(t==null?void 0:t.open)==="chat"?"chat":"tasks"),[r,i]=u.useState(null),[l,o]=u.useState("ok"),[c,d]=u.useState(!1),[g,f]=u.useState(""),[h,x]=u.useState(null),[b,w]=u.useState(!0),[S,k]=u.useState(!1),[m,v]=u.useState(()=>({[n]:!0})),T=!!m.chat,[E,_]=u.useState(0),[I,A]=u.useState(0),[P,y]=u.useState(0),[K,$]=u.useState(0),V=u.useRef(0),[D,X]=u.useState([]),[ge,Z]=u.useState(0),[G,q]=u.useState(0),[ce,te]=u.useState(0),[pe,ve]=u.useState(0),[xe,Oe]=u.useState([]),[Ae,et]=u.useState(0),[We,Dt]=u.useState([]),[ht,ct]=u.useState(!1),[yt,Ge]=u.useState(null),[$e,M]=u.useState(null),[W,L]=u.useState(null);u.useEffect(()=>{const z=ie=>{L({kind:"brainstorm",...(ie==null?void 0:ie.detail)||{}}),s("tasks")},de=ie=>{L({kind:"seed",...(ie==null?void 0:ie.detail)||{}}),s("tasks")};return window.addEventListener("hm:open-brainstorm",z),window.addEventListener("hm:open-seed",de),()=>{window.removeEventListener("hm:open-brainstorm",z),window.removeEventListener("hm:open-seed",de)}},[]);const[se,ue]=u.useState(null),[U,ee]=u.useState(null),[we,ut]=u.useState(null),[Ee,He]=u.useState(!1),[$t,wt]=u.useState(!1),Tt=u.useRef(T);Tt.current=T;const F=u.useRef(0),_e=u.useRef(null),Nt=u.useRef(n);Nt.current=n,u.useEffect(()=>{try{F.current=Number(localStorage.getItem(rm))||0}catch{F.current=0}},[]),u.useEffect(()=>{if(!(n!=="tasks"||!ge))try{const z=io(localStorage.getItem(ca)),de=Date.now(),ie={...z};for(const Ne of $u(D,z))ie[Ne.sessionId]=Math.max(de,Number(Ne.at)||0);localStorage.setItem(ca,JSON.stringify(ie)),Z(0)}catch{}},[n,ge,D]);const Kn=u.useCallback(()=>{const z=Date.now();F.current=z,q(0);try{localStorage.setItem(rm,String(z))}catch{}},[]),mt=1500,Ns=u.useRef([]),me=u.useRef(0),jt=u.useCallback(z=>(Ns.current.push(z),()=>{Ns.current=Ns.current.filter(de=>de!==z)}),[]),Ue=u.useCallback(({force:z=!1}={})=>{const de=Date.now();if(!(!z&&de-me.current<mt)){me.current=de;for(const ie of Ns.current)try{Promise.resolve(ie()).catch(()=>{})}catch{}try{window.dispatchEvent(new CustomEvent("hm:wake-sync"))}catch{}}},[mt]);u.useEffect(()=>{const z=()=>{document.visibilityState==="visible"&&Ue()},de=()=>Ue(),ie=()=>Ue({force:!0});return document.addEventListener("visibilitychange",z),window.addEventListener("focus",de),window.addEventListener("online",ie),()=>{document.removeEventListener("visibilitychange",z),window.removeEventListener("focus",de),window.removeEventListener("online",ie)}},[Ue]),u.useEffect(()=>{Ue({force:!0})},[n,Ue]),u.useEffect(()=>{n==="chat"&&Kn()},[n,Kn]),u.useEffect(()=>{const z=Ce=>{var Te;return te(Number((Te=Ce.detail)==null?void 0:Te.count)||0)},de=Ce=>{var Te;return ct(!!((Te=Ce.detail)!=null&&Te.streaming))},ie=Ce=>{s("review"),Ge({...Ce.detail||{},nonce:Date.now()})},Ne=Ce=>{s("chat"),!Tt.current&&Ce.detail&&M(Ce.detail)},Ye=Ce=>{s("chat"),ue({...Ce.detail||{},nonce:Date.now()})},Re=Ce=>{var Te;s("tasks"),ee({board:((Te=Ce.detail)==null?void 0:Te.board)??null,nonce:Date.now()})},je=()=>wt(!0),Se=Ce=>{var Te,xt,ft;s("tasks"),ee({board:((Te=Ce.detail)==null?void 0:Te.board)??null,taskId:((xt=Ce.detail)==null?void 0:xt.taskId)??((ft=Ce.detail)==null?void 0:ft.id)??null,nonce:Date.now()})};return window.addEventListener("hm:chat-unread",z),window.addEventListener("hm:chat-streaming",de),window.addEventListener("hm:open-review",ie),window.addEventListener("hm:open-session",Ne),window.addEventListener("hm:discuss-pipeline",Ye),window.addEventListener("hm:open-board",Re),window.addEventListener("hm:open-live",je),window.addEventListener("hm:open-task",Se),()=>{window.removeEventListener("hm:chat-unread",z),window.removeEventListener("hm:chat-streaming",de),window.removeEventListener("hm:open-review",ie),window.removeEventListener("hm:open-session",Ne),window.removeEventListener("hm:discuss-pipeline",Ye),window.removeEventListener("hm:open-board",Re),window.removeEventListener("hm:open-live",je),window.removeEventListener("hm:open-task",Se)}},[]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/review/chat-reports?limit=200");if(!z)return;const je=Array.isArray(Re.items)?Re.items:[];Nt.current==="chat"&&Kn(),X(je),q(Uk(je,F.current).length);try{const Te=io(localStorage.getItem(ca));if(Z($u(je,Te).length),!Tt.current){const xt=Nn(localStorage);te(lv(je,Te,xt?[xt]:[]).length)}}catch{}const Se=je.reduce((Te,xt)=>Number(xt==null?void 0:xt.at)>Number((Te==null?void 0:Te.at)??-1)?xt:Te,null),Ce=Number(Se==null?void 0:Se.at)||0;if(_e.current===null)_e.current=Ce;else if(Nt.current==="chat"&&Ce>_e.current){_e.current=Ce;const Te=Se.label||Se.taskId||"";It(Te?C("app.reviewDoneLabel",{label:Te}):C("app.reviewDone"))}else Ce>_e.current&&(_e.current=Ce)}catch{}};de();const ie=jt(de),Ne=setInterval(()=>{document.visibilityState==="visible"&&de()},15e3),Ye=()=>de();return window.addEventListener("hm:refresh-reports",Ye),()=>{z=!1,clearInterval(Ne),ie(),window.removeEventListener("hm:refresh-reports",Ye)}},[Kn,jt]),u.useEffect(()=>{try{V.current=Number(localStorage.getItem("hm.reviewSeenAt"))||0}catch{V.current=0}},[]),u.useEffect(()=>{if(b||(t==null?void 0:t.open)!=="inbox")return;const z=setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:t.task}}))},200);return()=>clearTimeout(z)},[b,t]),u.useEffect(()=>{const z=()=>{const de=window.location.hash.replace(/^#/,"");if(!de.startsWith("inbox"))return;const ie=de.includes(":")?de.split(":")[1]:null;window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:ie}}))};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]);const rs=u.useRef(null);u.useEffect(()=>{v(z=>z[n]?z:{...z,[n]:!0})},[n]);const Qn=u.useRef(null);u.useEffect(()=>{var de;const z=(de=Qn.current)==null?void 0:de.querySelector(".nav-item.on");z&&typeof z.scrollIntoView=="function"&&z.scrollIntoView({inline:"center",block:"nearest",behavior:"smooth"})},[n]);const It=u.useCallback(z=>{x({msg:z,at:Date.now()}),clearTimeout(rs.current),rs.current=setTimeout(()=>x(null),2600)},[]),Gt=u.useCallback(async()=>{try{const z=await Y("/api/overview");return i(z),o("ok"),d(!1),z}catch(z){return z.status===401?(d(!0),null):(o(z.code==="OFFLINE"?"offline":"error"),null)}},[]);u.useEffect(()=>{let z=!0;(async()=>{try{await EN()}catch{}z&&(await Gt(),z&&w(!1))})();const de=setInterval(()=>{z&&document.visibilityState==="visible"&&Gt()},5e3),ie=jt(Gt);return()=>{z=!1,clearInterval(de),ie()}},[Gt,jt]);const Ke=bk({reviewWaiting:E,inboxPending:I});u.useEffect(()=>{var z,de;try{Ke>0?(z=navigator.setAppBadge)==null||z.call(navigator,Ke):(de=navigator.clearAppBadge)==null||de.call(navigator)}catch{}},[Ke]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/review");if(!z)return;const je=Array.isArray(Re.items)?Re.items:[];Dt(je),_(sm(je)),y(jc(je))}catch{}},ie=Re=>{var Se;const je=Array.isArray((Se=Re.detail)==null?void 0:Se.items)?Re.detail.items:[];Dt(je),_(sm(je)),y(jc(je))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="review"&&de()},15e3);window.addEventListener("hm:review-items",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:review-items",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const je=await Y("/api/review/feed?limit=20");z&&$(kk(je.items,V.current).length)}catch{}},ie=je=>{var Se;z&&y(jc((Se=je.detail)==null?void 0:Se.items))},Ne=je=>{var Ce;const Se=Number((Ce=je.detail)==null?void 0:Ce.at)||Date.now();V.current=Se,$(0);try{localStorage.setItem("hm.reviewSeenAt",String(Se))}catch{}};de();const Ye=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="review"&&de()},15e3);window.addEventListener("hm:review-items",ie),window.addEventListener("hm:review-seen",Ne);const Re=jt(de);return()=>{z=!1,clearInterval(Ye),Re(),window.removeEventListener("hm:review-items",ie),window.removeEventListener("hm:review-seen",Ne)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/inbox");z&&A(Ou(Re.items))}catch{}},ie=Re=>{var je;return A(Ou((je=Re.detail)==null?void 0:je.items))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="tasks"&&de()},15e3);window.addEventListener("hm:inbox-items",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:inbox-items",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{var Re,je;try{const Se=await Y("/api/live");if(!z)return;ve(Number(((Re=Se==null?void 0:Se.counts)==null?void 0:Re.turns)??0)),Oe(Array.isArray(Se==null?void 0:Se.turns)?Se.turns:[]),et(Number(((je=Se==null?void 0:Se.counts)==null?void 0:je.architect)??0))}catch{}},ie=Re=>{var je,Se,Ce;z&&(ve(Number(((je=Re.detail)==null?void 0:je.turns)??0)),Array.isArray((Se=Re.detail)==null?void 0:Se.items)&&Oe(Re.detail.items),((Ce=Re.detail)==null?void 0:Ce.architect)!==void 0&&et(Number(Re.detail.architect)||0))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&de()},15e3);window.addEventListener("hm:live-turns",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:live-turns",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Ne=await Y("/api/usage?hours=24");z&&ut(Ne)}catch{}};de();const ie=setInterval(()=>document.visibilityState==="visible"&&de(),6e4);return()=>{z=!1,clearInterval(ie)}},[]);const sn=Lk({conn:l,bridge:(r==null?void 0:r.bridge)??null}),An=E+I,rn=Mk({tasksRunning:r==null?void 0:r.runningTasks,turns:pe,architectRunning:Ae}),js=_k(xe),ke=Ik(we==null?void 0:we.cacheHitRate),as=u.useCallback(()=>{H("tap");const z=Ok({reviewItems:We,inboxPending:I});if(z){if(z.kind==="review"){s("review"),Ge({taskId:z.taskId,nonce:Date.now()});return}s("tasks"),setTimeout(()=>window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:null}})),120)}},[We,I]);return c?a.jsxs("div",{className:"login",children:[a.jsx("h1",{children:"Hermes Pilot"}),a.jsx("p",{children:e("app.loginPrompt")}),a.jsx("input",{value:g,onChange:z=>f(z.target.value),placeholder:"~/.hermes/plugin-data/hermes-pilot/token",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsx("button",{onClick:()=>{const z=g.trim();z&&(location.href=`/auth?t=${encodeURIComponent(z)}`)},children:e("app.loginButton")}),a.jsx("p",{className:"hint",children:e("app.loginHint")})]}):a.jsxs("div",{className:"app",children:[a.jsxs("header",{className:"topbar",children:[a.jsxs("span",{className:"brand",onDoubleClick:z=>{if(gs()!=="dopamine")return;const de=z.currentTarget.getBoundingClientRect();bt("allClear",{x:Math.round(de.left+de.width/2),y:Math.round(de.bottom+8),width:Math.round(de.width),height:Math.round(de.height)})},children:["Hermes ",a.jsx("b",{children:"Pilot"})]}),a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[a.jsx("button",{className:"icon-btn","aria-label":e("app.search"),onClick:()=>{H("tap"),k(!0)},children:a.jsx(Me,{name:"search",size:18})}),a.jsx("span",{className:`conn ${l}`,title:e(l==="ok"?"app.connected":"app.disconnected"),children:l==="ok"?"●":"○"})]})]}),a.jsxs("div",{className:"telemetry",role:"status","aria-live":"polite",children:[a.jsx("button",{className:`t-pill gw ${sn}`,onClick:()=>{H("tap"),Gt()},"aria-label":e(sn==="ok"?"app.gwOkAria":"app.gwDownAria"),title:e(sn==="ok"?"app.connected":"app.bridgeOffline"),children:sn==="ok"?a.jsxs(a.Fragment,{children:[a.jsx("i",{className:"t-dot ok","aria-hidden":"true"}),e("status.gw")]}):a.jsxs("span",{className:"t-gw-bad",children:[e("status.gw")," · ",e(sn==="offline"?"status.offline":"app.gwError")]})}),An>0?a.jsxs("button",{className:"t-pill warn pill-warn-pulse",onClick:as,"aria-label":e("app.jumpWaitingAria",{n:An}),children:["🔔 ",e("status.reviewWaiting",{n:An})]}):null,rn>0?a.jsxs("button",{className:"t-pill run",onClick:()=>{H("tap"),wt(!0)},"aria-label":e("app.jumpRunningAria",{n:rn}),children:[a.jsx("i",{className:"t-dot live","aria-hidden":"true"}),"⚡ ",e("status.running",{n:rn}),js?a.jsxs("span",{className:"t-tool",children:[" · ",js]}):null]}):null,ke!==null?a.jsxs("button",{className:"t-pill gem",onClick:()=>{H("tap"),He(!0)},"aria-label":e("app.cacheAria",{pct:ke}),children:["💎 ",ke,"%"]}):null]}),l!=="ok"?a.jsxs("div",{className:"banner",children:[e("app.bridgeOffline"),a.jsx("button",{onClick:()=>{H("tap"),Gt()},children:e("common.retry")})]}):null,a.jsx("main",{className:"panes",children:b?a.jsx(Wn,{label:e("common.loading")}):a.jsxs(a.Fragment,{children:[m.tasks?a.jsx(Ur,{active:n==="tasks",children:a.jsx(Hr,{tab:"tasks",children:a.jsx(XS,{overview:r,refresh:Gt,notify:It,initialInbox:(t==null?void 0:t.open)==="inbox"?t:null,focusBoard:U,onConsumedFocusBoard:()=>ee(null),taskToolRequest:W,onConsumedTaskTool:()=>L(null),active:n==="tasks"})})}):null,m.review?a.jsx(Ur,{active:n==="review",children:a.jsx(Hr,{tab:"review",children:a.jsx(GS,{notify:It,focusRequest:yt,onConsumedFocus:()=>Ge(null),active:n==="review"})})}):null,m.notes?a.jsx(Ur,{active:n==="notes",children:a.jsx(Hr,{tab:"notes",children:a.jsx(mN,{notify:It,onOpenChat:z=>{M({id:z}),s("chat")}})})}):null,m.term?a.jsx(Ur,{active:n==="term",children:a.jsx(Hr,{tab:"term",children:a.jsx(u.Suspense,{fallback:a.jsx(Wn,{label:e("app.termLoading")}),children:a.jsx(LN,{notify:It,active:n==="term"})})})}):null,m.settings?a.jsx(Ur,{active:n==="settings",children:a.jsx(Hr,{tab:"settings",children:a.jsx(tN,{overview:r,notify:It,refresh:Gt})})}):null,m.chat?a.jsx(Ur,{active:n==="chat",children:a.jsx(Hr,{tab:"chat",children:a.jsx(E0,{notify:It,chatReports:D,reviewItems:We,liveTurns:xe,active:n==="chat",openRequest:$e,onConsumedOpen:()=>M(null),discussRequest:se,onConsumedDiscuss:()=>ue(null)})})}):null]})}),a.jsx("nav",{className:"nav",ref:Qn,children:ON.map(z=>{const de=e(z.key),ie=I+ge,Ne=z.id==="review"?E:z.id==="tasks"?ie:0,Ye=(Number(r==null?void 0:r.runningTasks)||0)+pe+Ae,Re=z.id==="review"?Cc({waiting:E,unseen:K,running:P}):z.id==="tasks"?Cc({waiting:ie,running:Ye}):z.id==="chat"?Cc({unseen:Math.max(G,ce),running:ht?1:0}):null,je=!Ne&&Re==="done"?"done":!Ne&&Re==="running"?"running":null,Se=Ne?e(z.id==="review"?"app.navWaiting":"app.navApproval",{label:de,n:Ne}):je==="done"?e("app.navDone",{label:de}):je==="running"?e(z.id==="review"?"app.navReflecting":"app.navRunning",{label:de}):void 0;return a.jsxs("button",{className:`nav-item${n===z.id?" on":""}`,"aria-current":n===z.id?"page":void 0,"aria-label":Se,onClick:()=>{n!==z.id&&H("tap"),s(z.id)},children:[a.jsxs("span",{className:"nav-icon",children:[a.jsx(Me,{name:z.icon}),Ne?a.jsx("span",{className:"nav-badge","aria-hidden":"true",children:Ne}):null,je?a.jsx("span",{className:`nav-dot ${je}`,"aria-hidden":"true"}):null]}),a.jsx("span",{children:de})]},z.id)})}),h?a.jsx("div",{className:`toast ${n}`,children:h.msg}):null,S?a.jsx(nN,{notify:It,onClose:()=>k(!1),onOpenSession:z=>{s("chat"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-session",{detail:{id:z.sessionId,messageId:z.messageId,profile:z.profile}}))},120)}}):null,$t?a.jsx(Tv,{notify:It,onClose:()=>wt(!1)}):null,Ee?a.jsx(vv,{data:we,hours:24,onClose:()=>He(!1)}):null,a.jsx(NN,{})]})}qv();async function FN(){tv(document.getElementById("root")).render(a.jsx(qk,{children:a.jsx($N,{})}))}FN();if("serviceWorker"in navigator){window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})});const e="hm.swReload";try{sessionStorage.getItem(e)==="1"&&sessionStorage.removeItem(e)}catch{}navigator.serviceWorker.addEventListener("controllerchange",()=>{try{if(sessionStorage.getItem(e)==="1")return;sessionStorage.setItem(e,"1")}catch{}window.location.reload()})}export{Me as I,Qe as S,Sa as a,Y as b,H as h,a as j,vk as o,u as r,Uv as s,Fe as u};
94
+ `).trim();window.dispatchEvent(new CustomEvent("hm:open-seed",{detail:{seed:L,repo:(ue=M.source)==null?void 0:ue.repo,board:(U=M.source)==null?void 0:U.board}}))},yt=(M,W)=>{var L;A(null),W&&(M==="pin"?ce(W):M==="brainstorm"?ht(W):M==="seed"?ct(W):M==="chat"&&((L=W.source)!=null&&L.chatId)&&(H("tap"),t==null||t(W.source.chatId)))},Ge=M=>{H("tap"),_(M);try{lN(window.localStorage,M)}catch{}},$e=u.useMemo(()=>i.filter(M=>{const W=M.key||`${M.at||""}:${M.title||""}`;return!Z.has(W)}),[i,Z]);return a.jsxs("div",{className:"pane memos-pane",children:[a.jsxs("div",{className:"memos-header",children:[a.jsxs("div",{className:"memos-header-titles",children:[a.jsxs("div",{className:"memos-header-title",children:["💡 ",n("notes.title")]}),a.jsx("div",{className:"memos-header-sub",children:n("notes.subtitle")})]}),a.jsxs("div",{className:"memos-header-actions",children:[a.jsx("button",{type:"button",className:"btn primary memos-new-btn",onClick:()=>ve(null),children:n("notes.newBtn")}),a.jsx(Xs,{variant:"icon",onRefresh:X})]})]}),a.jsxs("div",{className:"memos-quick-bar",children:[a.jsx("input",{type:"text",className:"memos-quick-input",value:x,placeholder:n("notes.quickPlaceholder"),onChange:M=>b(M.target.value),onKeyDown:M=>{var W;M.key==="Enter"&&!((W=M.nativeEvent)!=null&&W.isComposing)&&(M.preventDefault(),q())}}),a.jsx("button",{type:"button",className:"btn",disabled:!x.trim()||v,onClick:q,children:n("notes.addChecklistBtn")})]}),a.jsxs("div",{className:"memos-search-row",children:[a.jsx("input",{type:"search",className:"memos-search-input",value:d,placeholder:n("notes.searchPlaceholder"),onChange:M=>g(M.target.value)}),a.jsx("div",{className:"memos-view-seg",role:"group","aria-label":n("notes.viewGroupAria"),children:pN.map(M=>a.jsx("button",{type:"button",className:`memos-view-btn${E===M.view?" on":""}`,"aria-pressed":E===M.view,"aria-label":n(M.labelKey),title:n(M.labelKey),onClick:()=>Ge(M.view),children:M.glyph},M.view))})]}),a.jsxs("div",{className:"chips memos-filter-chips",children:[a.jsx("button",{type:"button",className:`chip${f==="all"?" on":""}`,onClick:()=>h("all"),children:n("notes.filterAll")}),a.jsx("button",{type:"button",className:`chip${f==="pinned"?" on":""}`,onClick:()=>h("pinned"),children:n("notes.filterPinned")}),a.jsx("button",{type:"button",className:`chip${f==="report"?" on":""}`,onClick:()=>h("report"),children:n("notes.filterReports")}),ge.map(M=>a.jsxs("button",{type:"button",className:`chip${f===`tag:${M}`?" on":""}`,onClick:()=>h(f===`tag:${M}`?"all":`tag:${M}`),children:["#",M]},M))]}),$e.length?a.jsxs("details",{className:"memos-inbox-box",children:[a.jsxs("summary",{className:"memos-inbox-summary",children:[a.jsxs("span",{children:["📬 ",n("notes.inboxHead",{n:$e.length})]}),a.jsx(Me,{name:"chevron",size:14})]}),a.jsx("div",{className:"memos-inbox-list",children:$e.slice(0,6).map((M,W)=>a.jsxs("div",{className:"memos-inbox-row",children:[a.jsxs("div",{className:"memos-inbox-main",children:[a.jsx("div",{className:"row-title",children:M.title||M.specTitle||"Report"}),M.summary?a.jsx("div",{className:"row-sub",children:M.summary}):null]}),a.jsx("button",{type:"button",className:"btn",onClick:()=>pe(M),children:n("notes.inboxSave")})]},M.key||W))})]}):null,o?a.jsx(Wn,{label:n("common.loading")}):null,!o&&!G.length?a.jsx("div",{className:"empty",children:n("notes.empty")}):null,a.jsx("div",{className:`memos-grid view-${E}`,children:G.map(M=>{var se,ue,U,ee,we,ut;const W=[(se=M.source)==null?void 0:se.chatTitle,(ue=M.source)==null?void 0:ue.repo,(U=M.source)==null?void 0:U.board].filter(Boolean).join(" · "),L=cN(M.checklist,E);return a.jsxs("article",{className:`card memo-card color-${M.color||"default"}${M.pinned?" is-pinned":""}${M.body?" has-body":""}`,onClick:()=>ve(M),children:[a.jsxs("div",{className:"memo-card-head",children:[a.jsx("div",{className:"memo-card-title",children:M.title||(M.kind==="report"?"📬 Report":"💡")}),Fm(E)?a.jsx("button",{type:"button",className:`memo-pin-btn${M.pinned?" on":""}`,"aria-label":M.pinned?n("notes.unpin"):n("notes.pin"),onClick:Ee=>ce(M,Ee),children:"📌"}):null]}),M.body?a.jsx("div",{className:"memo-card-body",children:M.body}):null,(ee=M.checklist)!=null&&ee.length?a.jsxs("div",{className:"memo-checklist",children:[L.visible.map(Ee=>E==="two"?a.jsxs("span",{className:`memo-check-row${Ee.done?" done":""}`,children:[a.jsx("span",{"aria-hidden":"true",children:Ee.done?"☑":"☐"}),a.jsx("span",{children:Ee.text})]},Ee.id):a.jsxs("button",{type:"button",className:`memo-check-row${Ee.done?" done":""}`,onClick:He=>te(M,Ee.id,He),children:[a.jsx("span",{"aria-hidden":"true",children:Ee.done?"☑":"☐"}),a.jsx("span",{children:Ee.text})]},Ee.id)),L.hidden?a.jsx("span",{className:"memo-check-more",children:n("notes.moreItems",{n:L.hidden})}):null]}):null,(we=M.tags)!=null&&we.length?a.jsx("div",{className:"memo-tags",children:M.tags.map(Ee=>a.jsxs("span",{className:"memo-tag",children:["#",Ee]},Ee))}):null,W?a.jsx("div",{className:"memo-source-meta",children:n("notes.sourceMeta",{meta:W})}):null,Fm(E)?a.jsxs("div",{className:"memo-card-actions",children:[a.jsx("button",{type:"button",className:"report-card-btn",onClick:Ee=>ht(M,Ee),children:n("notes.brainstorm")}),a.jsx("button",{type:"button",className:"report-card-btn primary",onClick:Ee=>ct(M,Ee),children:n("notes.toSeed")}),(ut=M.source)!=null&&ut.chatId&&t?a.jsx("button",{type:"button",className:"report-card-btn",onClick:Ee=>{Ee.stopPropagation(),H("tap"),t(M.source.chatId)},children:n("notes.openChat")}):null]}):null,ty(E)?a.jsx("button",{type:"button",className:"memo-more-btn","aria-label":n("notes.more"),"aria-haspopup":"dialog",onClick:Ee=>{Ee.stopPropagation(),H("tap"),A(M)},children:"⋯"}):null]},M.id)})}),I?a.jsx(Qe,{title:I.title||n("notes.menuTitle"),onClose:()=>A(null),children:a.jsx("div",{className:"memo-menu",children:aN(I,{canOpenChat:!!t}).map(M=>a.jsx("button",{type:"button",className:"memo-menu-row",onClick:()=>yt(M.action,I),children:n(M.labelKey)},M.action))})}):null,w?a.jsxs(Qe,{title:w.id?n("notes.editTitle"):n("notes.createTitle"),onClose:Oe,historyKey:V,children:[K?a.jsxs("div",{className:"memo-unsaved",role:"alertdialog","aria-label":n("notes.unsavedTitle"),children:[a.jsx("div",{className:"memo-unsaved-title",children:n("notes.unsavedTitle")}),a.jsx("div",{className:"memo-unsaved-sub",children:n("notes.unsavedSub")}),a.jsxs("div",{className:"memo-unsaved-actions",children:[a.jsx("button",{type:"button",className:"btn primary",disabled:v,onClick:Ae,children:n("notes.saveAndClose")}),a.jsx("button",{type:"button",className:"btn ghost",disabled:v,onClick:et,children:n("notes.discard")}),a.jsx("button",{type:"button",className:"btn",onClick:We,children:n("notes.keepEditing")})]})]}):null,a.jsxs("div",{className:"memo-editor",style:K?{display:"none"}:void 0,children:[a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldTitle")}),a.jsx("input",{type:"text",className:"memo-input",value:w.title,placeholder:n("notes.fieldTitlePh"),onChange:M=>S(W=>({...W,title:M.target.value}))})]}),a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldBody")}),a.jsx("textarea",{rows:4,className:"memo-textarea",value:w.body,placeholder:n("notes.fieldBodyPh"),onChange:M=>S(W=>({...W,body:M.target.value}))})]}),a.jsxs("div",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldChecklist")}),a.jsxs("div",{className:"memo-editor-checks",children:[w.checklist.map(M=>a.jsxs("div",{className:"memo-editor-check-item",children:[a.jsx("input",{type:"checkbox",checked:M.done,onChange:()=>S(W=>({...W,checklist:W.checklist.map(L=>L.id===M.id?{...L,done:!L.done}:L)}))}),a.jsx("span",{className:M.done?"done":"",children:M.text}),a.jsx("button",{type:"button",className:"link",onClick:()=>S(W=>({...W,checklist:W.checklist.filter(L=>L.id!==M.id)})),children:"✕"})]},M.id)),a.jsxs("div",{className:"memo-check-add-row",children:[a.jsx("input",{type:"text",className:"memo-input",value:k,placeholder:n("notes.addChecklistPh"),onChange:M=>m(M.target.value)}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{const M=k.trim();M&&(S(W=>({...W,checklist:[...W.checklist,{id:`c_${Date.now()}`,text:M,done:!1}]})),m(""))},children:n("notes.addChecklistBtn")})]})]})]}),a.jsxs("label",{className:"memo-field-label",children:[a.jsx("span",{children:n("notes.fieldTags")}),a.jsx("input",{type:"text",className:"memo-input",value:w.tagsText,placeholder:n("notes.fieldTagsPh"),onChange:M=>S(W=>({...W,tagsText:M.target.value}))})]}),a.jsxs("div",{className:"memo-color-row",children:[a.jsx("span",{children:n("notes.colorLabel")}),a.jsx("div",{className:"chips",style:{padding:0},children:dN.map(M=>a.jsx("button",{type:"button",className:`chip${w.color===M?" on":""}`,onClick:()=>S(W=>({...W,color:M})),children:M},M))})]}),a.jsxs("div",{className:"memo-editor-actions",children:[a.jsx("button",{type:"button",className:"btn primary",disabled:v||!w.id&&!Xu(w),onClick:xe,children:n("notes.save")}),w.id?a.jsx("button",{type:"button",className:"btn ghost",disabled:v,onClick:Dt,children:n("notes.delete")}):null]})]})]}):null]})}const fN={allClear:18,receipt:18,vibeWarp:18,launch:16,fastTrack:16,approve:12,stamp:12,combo:10,send:5,spark:4},gN=720,vN=1800,yN=2400,Bm=".btn, .chip, .hm-switch, .seed-seg-btn, .seed-toggle, .seed-submit, .report-card-btn, .composer .plus, .composer .send, .chat-report-btn, .pill-btn, .ak-btn, .ak-empty-btn, .ak-thumb-btn, .ak-anno-preview-btn, .receipt-btn, .spec-banner-btn, .job-bar-btn, .job-bar-x, .icon-btn, .prof-chip, .snippet-chip, .settings-nav-chip, .pick-item, .list-item, .row:not(.static), .stat, .spec-bar, .inbox-bar, details > summary, .link, .code-copy, button.t-pill, .nav-item",wN=".btn, .chip, .hm-switch, .seed-seg-btn, .seed-toggle, .seed-submit, .report-card-btn, .composer .plus, .composer .send, .chat-report-btn, .pill-btn, .ak-btn, .ak-empty-btn, .ak-thumb-btn, .ak-anno-preview-btn, .receipt-btn, .spec-banner-btn, .job-bar-btn, .icon-btn, .prof-chip, .snippet-chip, .settings-nav-chip, details > summary, button.t-pill, .nav-item",xN=".hm-switch, .seed-toggle",kN=".seed-seg-btn, .chip, .prof-chip, .snippet-chip.trigger, .settings-nav-chip",bN={fastTrack:"fx.sfx.fastTrack",approve:"fx.sfx.approve",stamp:"fx.sfx.stamp",launch:"fx.sfx.launch",vibeWarp:"fx.sfx.vibeWarp",send:"fx.sfx.send",allClear:"fx.sfx.allClear",receipt:"fx.sfx.allClear",toggle:"fx.sfx.toggle"};function Fc(){var e,t,n;try{return!!((n=(t=(e=globalThis.window)==null?void 0:e.matchMedia)==null?void 0:t.call(e,np))!=null&&n.matches)}catch{return!1}}function ry(e=0){return e>=3?{hues:["gold","gold","amber","gold-dim"],primary:"#fbbf24",secondary:"#fde68a"}:e===2?{hues:["cyan","gold","teal","gold"],primary:"#22d3ee",secondary:"#fbbf24"}:{hues:["teal","mint","cyan","gold-dim"],primary:"#2dd4bf",secondary:"#5eead4"}}function SN(e,t=0){const n=fN[e]??12,{hues:s}=ry(t);return Array.from({length:n},(r,i)=>{const l=Math.PI*2*i/n+Math.random()*.5,o=(e==="spark"||e==="send"?24:54)+Math.random()*(e==="spark"||e==="send"?32:96);return{id:i,dx:Math.round(Math.cos(l)*o),dy:Math.round(Math.sin(l)*o-(e==="allClear"?26:e==="send"?34:0)),rot:Math.round(Math.random()*300-150),delay:Math.round(Math.random()*90),hue:s[i%s.length]}})}function Um({kind:e,x:t,y:n,width:s,height:r,sfxText:i,combo:l=0}){var _,I;const o=((_=globalThis.window)==null?void 0:_.innerWidth)||390,c=((I=globalThis.window)==null?void 0:I.innerHeight)||844,d=Number.isFinite(t)?t:o*.5,g=Number.isFinite(n)?n:c*.38,f=Number.isFinite(s)&&s>0?s:84,h=Number.isFinite(r)&&r>0?r:36,x=ry(l),b=e==="approve"||e==="fastTrack"||e==="launch"||e==="vibeWarp"||e==="allClear"||e==="receipt"||e==="tapImpact",w=e==="tap"||e==="toggle",S=b?10:w?6:e==="spark"||e==="send"?4:6,k=Array.from({length:S},(A,P)=>({angle:Math.PI*2*P/S+(Math.random()-.5)*.25,inner:(w?10:12)+Math.random()*8,outer:(b?54:w?36:30)+Math.random()*24,color:P%2===0?x.primary:x.secondary})),m=e==="spark"||e==="send"?0:b?5:3,v=Array.from({length:m},(A,P)=>{const y=P%2===0?-1:1;return{ox:d+y*(f*.34+Math.random()*12),oy:g+h*.25+(Math.random()-.5)*8,vx:y*(26+Math.random()*32),vy:8+Math.random()*16,r0:4.5+Math.random()*3.5,r1:(b?16:12)+Math.random()*8}}),T=e==="spark"?3:e==="send"?4:b?8:5,E=Array.from({length:T},(A,P)=>{const y=Math.PI*2*P/T+Math.random()*.4,K=(e==="spark"?40:w?72:85)+Math.random()*65;return{x:d,y:g,vx:Math.cos(y)*K,vy:Math.sin(y)*K-35,rot:Math.random()*Math.PI*2,vrot:(Math.random()-.5)*10,size:(w?3:3.5)+Math.random()*3,color:P%2===0?x.primary:x.secondary}});return{start:performance.now(),duration:e==="vibeWarp"?440:b?520:380,cx:d,cy:g,h,hasImpact:b||w,irisRing:e==="vibeWarp"?{maxR:Math.ceil(Math.hypot(Math.max(d,o-d),Math.max(g,c-g)))}:null,trail:e==="send"?{x:d,y:g,dy:-165}:null,rays:k,smokes:v,chips:E,sfxText:i||null,sfxTilt:(Math.random()-.5)*.22,vw:o,vh:c}}function NN(){const{t:e}=Fe(),[t,n]=u.useState(()=>gs()),[s,r]=u.useState([]),[i,l]=u.useState(null),[o,c]=u.useState(null),[d,g]=u.useState(null),f=u.useRef(0),h=u.useRef([]),x=u.useRef(null),b=u.useRef([]),w=u.useRef(0),S=u.useRef(0),k=u.useRef(e);k.current=e;const m=()=>{for(const I of h.current)clearTimeout(I);h.current=[]},v=(I,A)=>{const P=setTimeout(I,A);return h.current.push(P),P},T=()=>{w.current&&(cancelAnimationFrame(w.current),w.current=0),b.current=[];const I=x.current;if(I){const A=I.getContext("2d");A&&A.clearRect(0,0,I.width,I.height)}},E=()=>{if(w.current||Fc())return;const I=A=>{if(gs()!=="dopamine"||document.visibilityState==="hidden"){T();return}const P=x.current;if(!P){w.current=0;return}const y=P.getContext("2d");if(!y){w.current=0;return}const K=Math.min(window.devicePixelRatio||1,2),$=window.innerWidth,V=window.innerHeight,D=Math.round($*K),X=Math.round(V*K);(P.width!==D||P.height!==X)&&(P.width=D,P.height=X),y.setTransform(K,0,0,K,0,0),y.clearRect(0,0,$,V);const ge=[];for(const Z of b.current){const G=A-Z.start,q=G/Z.duration;if(q>=1)continue;ge.push(Z);const ce=1-Math.pow(1-q,3);if(Z.irisRing){const te=Math.max(8,Z.irisRing.maxR*ce);y.save(),y.globalAlpha=Math.max(0,(1-q)*.92),y.strokeStyle="#22d3ee",y.lineWidth=Math.max(1.5,5*(1-q)),y.beginPath(),y.arc(Z.cx,Z.cy,te,0,Math.PI*2),y.stroke(),y.strokeStyle="#fde68a",y.lineWidth=Math.max(1,2*(1-q)),y.beginPath(),y.arc(Z.cx,Z.cy,Math.max(4,te-4),0,Math.PI*2),y.stroke(),y.restore()}if(Z.hasImpact&&q<.7){const te=q/.7,pe=1-Math.pow(1-te,2);y.save(),y.globalAlpha=Math.max(0,1-te)*.75,y.strokeStyle="#fbbf24",y.lineWidth=2*(1-te)+.5,y.beginPath(),y.arc(Z.cx,Z.cy,12+pe*46,0,Math.PI*2),y.stroke();for(const ve of Z.rays){const xe=ve.inner+pe*14,Oe=ve.inner+(ve.outer-ve.inner)*pe;y.strokeStyle=ve.color,y.lineWidth=2.2*(1-te),y.beginPath(),y.moveTo(Z.cx+Math.cos(ve.angle)*xe,Z.cy+Math.sin(ve.angle)*xe),y.lineTo(Z.cx+Math.cos(ve.angle)*Oe,Z.cy+Math.sin(ve.angle)*Oe),y.stroke()}y.restore()}if(Z.trail){const te=Z.trail.y+Z.trail.dy*ce,pe=Z.trail.y+Z.trail.dy*Math.max(0,ce-.35),ve=y.createLinearGradient(Z.trail.x,pe,Z.trail.x,te);ve.addColorStop(0,"rgba(34, 211, 238, 0)"),ve.addColorStop(.6,"rgba(45, 212, 191, 0.85)"),ve.addColorStop(1,"rgba(251, 191, 36, 0.95)"),y.save(),y.globalAlpha=Math.max(0,1-q),y.strokeStyle=ve,y.lineWidth=2.5,y.lineCap="round",y.beginPath(),y.moveTo(Z.trail.x,pe),y.lineTo(Z.trail.x,te),y.stroke(),y.restore()}if(Z.smokes.length){y.save();for(const te of Z.smokes){const pe=te.ox+te.vx*ce,ve=te.oy+te.vy*ce,xe=te.r0+(te.r1-te.r0)*ce;y.globalAlpha=Math.max(0,(1-q)*.36),y.fillStyle="#d1fae5",y.beginPath(),y.arc(pe,ve,xe,0,Math.PI*2),y.fill()}y.restore()}if(Z.chips.length){const te=G/1e3;y.save();for(const pe of Z.chips){const ve=pe.x+pe.vx*te,xe=pe.y+pe.vy*te+140*te*te;y.save(),y.translate(ve,xe),y.rotate(pe.rot+pe.vrot*te),y.globalAlpha=Math.max(0,1-q),y.fillStyle=pe.color,y.beginPath(),y.moveTo(0,-pe.size),y.lineTo(pe.size*.7,0),y.lineTo(0,pe.size),y.lineTo(-pe.size*.7,0),y.closePath(),y.fill(),y.restore()}y.restore()}if(Z.sfxText){const te=Math.min(1,q*1.15),pe=te<.25?.6+te/.25*.5:1.1-Math.min(1,(te-.25)/.25)*.1,ve=te>.65?Math.max(0,1-(te-.65)/.35):1,xe=Math.max(44,Math.min($-44,Z.cx)),Oe=Math.max(30,Math.min(V-28,Z.cy-Z.h*.55-14-ce*14));y.save(),y.translate(xe,Oe),y.rotate(Z.sfxTilt),y.scale(pe,pe),y.globalAlpha=ve,y.font="900 15px system-ui, -apple-system, sans-serif",y.textAlign="center",y.textBaseline="middle",y.lineJoin="round",y.lineWidth=4,y.strokeStyle="rgba(11, 18, 22, 0.92)",y.strokeText(Z.sfxText,0,0),y.fillStyle="#fde68a",y.fillText(Z.sfxText,0,0),y.restore()}}b.current=ge,ge.length>0?w.current=requestAnimationFrame(I):(w.current=0,y.clearRect(0,0,$,V))};w.current=requestAnimationFrame(I)};u.useEffect(()=>hv(n),[]),u.useEffect(()=>{const I=A=>{if(gs()!=="dopamine")return;const P=(A==null?void 0:A.detail)??{},y=String(P.kind??"combo"),K=f.current+=1,$=Number(P.combo)||0;if(r(V=>[...V,{id:K,kind:y,x:P.x,y:P.y,particles:SN(y,$)}].slice(-4)),v(()=>r(V=>V.filter(D=>D.id!==K)),gN),!Fc()&&document.visibilityState!=="hidden"){const V=bN[y],D=P.sfx||(V?k.current(V):null),X=performance.now();if(D)for(const Z of b.current)Z.fromClick&&X-Z.start<120&&(Z.sfxText=null);const ge=Um({kind:y,x:P.x,y:P.y,width:P.width,height:P.height,sfxText:D,combo:$});b.current=[...b.current,ge].slice(-6),E(),(y==="launch"||y==="vibeWarp")&&(g({id:K}),v(()=>g(Z=>(Z==null?void 0:Z.id)===K?null:Z),440))}$>=2&&(l({n:$,id:K}),v(()=>l(V=>(V==null?void 0:V.id)===K?null:V),vN)),$>=1&&(document.documentElement.dataset.combo=$>=3?"3":String($),clearTimeout(S.current),S.current=setTimeout(()=>{delete document.documentElement.dataset.combo},$o)),(y==="allClear"||y==="receipt")&&(c({kind:y,id:K}),v(()=>c(V=>(V==null?void 0:V.id)===K?null:V),yN))};return window.addEventListener(Fu,I),()=>window.removeEventListener(Fu,I)},[]),u.useEffect(()=>{const I=A=>{var y,K;const P=(K=(y=A.target)==null?void 0:y.closest)==null?void 0:K.call(y,Bm);!P||P.disabled||H("tap")};return document.addEventListener("click",I,{passive:!0,capture:!0}),()=>document.removeEventListener("click",I,{capture:!0})},[]),u.useEffect(()=>{if(t!=="dopamine"||Fc())return;const I=A=>{var K,$;if(gs()!=="dopamine")return;const P=($=(K=A.target)==null?void 0:K.closest)==null?void 0:$.call(K,Bm);if(!P||P.disabled)return;if(!P.matches(wN)){P.classList.remove("fx-sakuga-lite"),P.offsetWidth,P.classList.add("fx-sakuga-lite"),v(()=>P.classList.remove("fx-sakuga-lite"),180);return}if(P.classList.remove("fx-sakuga-pop"),P.offsetWidth,P.classList.add("fx-sakuga-pop"),v(()=>P.classList.remove("fx-sakuga-pop"),340),document.visibilityState!=="hidden"){const V=P.getBoundingClientRect();if(V.width>0&&V.height>0){const D=P.matches(xN),X=!D&&P.matches(kN),ge=P.classList.contains("send")&&!P.classList.contains("stop"),Z=P.classList.contains("primary")||P.classList.contains("fast-track")||P.classList.contains("seed-submit")||P.classList.contains("ak-empty-btn")||P.classList.contains("ak-new-btn")||P.classList.contains("spec-banner-btn")&&!P.classList.contains("ghost")||ge,G=D||X?"toggle":Z?"tapImpact":"tap",q=D?k.current("fx.sfx.toggle"):X?k.current("fx.sfx.tick"):ge?k.current("fx.sfx.send"):Z?k.current("fx.sfx.tapImpact"):null,ce=Um({kind:G,x:V.left+V.width/2,y:V.top+V.height/2,width:V.width,height:V.height,sfxText:q});ce.fromClick=!0,b.current=[...b.current,ce].slice(-6),E()}}};return document.addEventListener("click",I,{passive:!0,capture:!0}),()=>document.removeEventListener("click",I,{capture:!0})},[t]),u.useEffect(()=>{const I=()=>{document.visibilityState==="hidden"&&T()};return document.addEventListener("visibilitychange",I),()=>document.removeEventListener("visibilitychange",I)},[]),u.useEffect(()=>{t!=="dopamine"&&(m(),clearTimeout(S.current),delete document.documentElement.dataset.combo,T(),r([]),l(null),c(null),g(null))},[t]),u.useEffect(()=>()=>{m(),clearTimeout(S.current),delete document.documentElement.dataset.combo,T()},[]);const _=t==="dopamine";return a.jsxs("div",{className:`fx-layer${_?"":" off"}`,"aria-hidden":"true",children:[a.jsx("canvas",{ref:x,className:"fx-canvas","aria-hidden":"true"}),_?s.map(I=>a.jsx("div",{className:`fx-burst fx-${I.kind}`,style:{left:I.x==null?"50%":`${I.x}px`,top:I.y==null?"38%":`${I.y}px`},children:I.particles.map(A=>a.jsx("i",{className:`fx-particle ${A.hue}`,style:{"--fx-dx":`${A.dx}px`,"--fx-dy":`${A.dy}px`,"--fx-rot":`${A.rot}deg`,animationDelay:`${A.delay}ms`}},A.id))},I.id)):null,_&&i?a.jsx("div",{className:"fx-combo-pill",children:e("fx.combo",{n:i.n})},`c${i.id}`):null,_&&o?a.jsxs("div",{className:"fx-allclear-card",children:[a.jsx("span",{className:"fx-allclear-emoji","aria-hidden":"true",children:"🎉"}),a.jsx("span",{children:e("fx.allClear")})]},`f${o.id}`):null,_&&d?a.jsx("div",{className:"fx-scan-sweep"},`s${d.id}`):null]})}const vo=["token","pair"],ay=/^[0-9a-f]{32,}$/i;function iy(e=globalThis.location){const t=String((e==null?void 0:e.search)??""),n=new URLSearchParams(t.startsWith("?")?t.slice(1):t);for(const r of vo){const i=n.get(r);if(i&&String(i).trim())return String(i).trim()}const s=String((e==null?void 0:e.hash)??"").replace(/^#/,"");if(!s)return null;if(s.includes("=")){const r=new URLSearchParams(s);for(const i of vo){const l=r.get(i);if(l&&String(l).trim())return String(l).trim()}return null}return ay.test(s)?s:null}function jN(e=globalThis.location,t=globalThis.history){var i;if(!iy(e))return!1;let n;try{n=new URL(String((e==null?void 0:e.href)??`http://127.0.0.1${(e==null?void 0:e.pathname)??"/"}${(e==null?void 0:e.search)??""}${(e==null?void 0:e.hash)??""}`))}catch{return!1}let s=!1;for(const l of vo)n.searchParams.has(l)&&(n.searchParams.delete(l),s=!0);const r=n.hash.replace(/^#/,"");if(r){if(ay.test(r))n.hash="",s=!0;else if(r.includes("=")){const l=new URLSearchParams(r);let o=!1;for(const c of vo)l.has(c)&&(l.delete(c),o=!0);if(o){const c=l.toString();n.hash=c?`#${c}`:"",s=!0}}}if(!s)return!1;try{return(i=t==null?void 0:t.replaceState)==null||i.call(t,null,"",`${n.pathname}${n.search}${n.hash}`),!0}catch{return!1}}async function CN(e,t=globalThis.fetch){if(typeof e!="string"||!e)return{ok:!1,error:"EMPTY_TOKEN"};let n;try{n=await t("/api/auth/login",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-client":"mobile"},body:JSON.stringify({token:e})})}catch{return{ok:!1,error:"OFFLINE"}}return n!=null&&n.ok?{ok:!0,status:n.status}:{ok:!1,status:(n==null?void 0:n.status)??0,error:"REJECTED"}}async function EN({loc:e=globalThis.location,historyObj:t=globalThis.history,fetchImpl:n=globalThis.fetch}={}){const s=iy(e);if(!s)return{handled:!1,ok:!1};const r=await CN(s,n);return r.ok?(jN(e,t),{handled:!0,ok:!0}):{handled:!0,ok:!1,error:r.error}}const TN=3e4,ly="hermes-pilot:chunk-reload-at",AN=[/failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/importing a module script failed/i,/loading chunk\s*[\w-]*\s*failed/i,/loading css chunk\s*[\w-]*\s*failed/i,/dynamically imported module.*(failed|error)/i];function oy(e){if(!e)return!1;if(typeof e=="object"&&String(e.name??"")==="ChunkLoadError")return!0;const t=String((e==null?void 0:e.message)??e);return AN.some(n=>n.test(t))}const RN=(()=>{const e=new Map;return{getItem:t=>e.has(t)?e.get(t):null,setItem:(t,n)=>{e.set(t,String(n))},removeItem:t=>{e.delete(t)}}})();function PN(){try{if(typeof sessionStorage<"u"&&sessionStorage){const e=`${ly}:probe`;return sessionStorage.setItem(e,"1"),sessionStorage.removeItem(e),sessionStorage}}catch{}return RN}const IN=e=>new Promise(t=>setTimeout(t,e));function _N(e,{retries:t=2,delayMs:n=250,sleep:s=IN,isChunkError:r=oy}={}){const i=async l=>{try{return await e()}catch(o){if(l>=t||!r(o))throw o;return await s(n*(l+1)),i(l+1)}};return i(0)}function MN({storage:e,now:t=Date.now,reload:n=()=>{typeof location<"u"&&typeof location.reload=="function"&&location.reload()},cooldownMs:s=TN,key:r=ly}={}){const i=e??PN();return function(){const o=t();let c=0;try{c=Number((i==null?void 0:i.getItem(r))??0)||0}catch{c=0}if(c&&o-c<s)return!1;try{i==null||i.setItem(r,String(o))}catch{}return n(),!0}}const cy=MN(),LN=u.lazy(()=>_N(()=>_y(()=>import("./TermPane-CsxAnPQk.js"),__vite__mapDeps([0,1]))).then(e=>({default:e.TermPane}))),ON=[{id:"tasks",key:"nav.tasks",icon:"grid"},{id:"review",key:"nav.review",icon:"pen"},{id:"chat",key:"nav.chat",icon:"chat"},{id:"notes",key:"nav.notes",icon:"memo"},{id:"term",key:"nav.term",icon:"term"},{id:"settings",key:"nav.settings",icon:"gear"}];function Ur({active:e,children:t}){const n=u.useRef(null);return u.useEffect(()=>{const s=n.current;if(!s)return;const r=!e;if("inert"in s&&(s.inert=r),r){const i=document.activeElement;i&&s.contains(i)&&typeof i.blur=="function"&&i.blur()}},[e]),a.jsx("div",{ref:n,className:`pane-host${e?"":" is-hidden"}`,"aria-hidden":e?void 0:"true",children:t})}function DN({error:e,onRetry:t}){const{t:n}=Fe();return a.jsx("div",{className:"pane",children:a.jsxs("div",{className:"card",children:[a.jsx("div",{className:"row-title",children:n("app.tabError")}),a.jsx("div",{className:"row-sub",style:{marginTop:6,lineHeight:1.7},children:String((e==null?void 0:e.message)??e)}),a.jsx("button",{className:"btn",style:{marginTop:12},onClick:t,children:n("common.retry")}),a.jsx("div",{className:"row-sub",style:{marginTop:8},children:n("app.tabErrorLog")})]})})}class Hr extends ze.Component{constructor(t){super(t),this.state={error:null,retryKey:0}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){try{fetch("/api/client-error",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-client":"mobile"},body:JSON.stringify({message:String((t==null?void 0:t.message)??t),stack:String((t==null?void 0:t.stack)??"").slice(0,4e3),componentStack:String((n==null?void 0:n.componentStack)??"").slice(0,4e3),tab:this.props.tab,ua:navigator.userAgent,url:location.href})}).catch(()=>{})}catch{}}retry(){oy(this.state.error)&&cy()||this.setState(t=>({error:null,retryKey:t.retryKey+1}))}render(){return this.state.error?a.jsx(DN,{error:this.state.error,onRetry:()=>this.retry()}):a.jsx(ze.Fragment,{children:this.props.children},`${this.props.tab}:${this.state.retryKey}`)}}function $N(){const{t:e}=Fe(),[t]=u.useState(()=>ik());u.useEffect(()=>qv(),[]),u.useEffect(()=>{const z=de=>{var ie;cy()&&((ie=de.preventDefault)==null||ie.call(de))};return window.addEventListener("vite:preloadError",z),()=>window.removeEventListener("vite:preloadError",z)},[]),u.useEffect(()=>{ub()},[]);const[n,s]=u.useState((t==null?void 0:t.open)==="inbox"||(t==null?void 0:t.open)==="tasks"?"tasks":(t==null?void 0:t.open)==="chat"?"chat":"tasks"),[r,i]=u.useState(null),[l,o]=u.useState("ok"),[c,d]=u.useState(!1),[g,f]=u.useState(""),[h,x]=u.useState(null),[b,w]=u.useState(!0),[S,k]=u.useState(!1),[m,v]=u.useState(()=>({[n]:!0})),T=!!m.chat,[E,_]=u.useState(0),[I,A]=u.useState(0),[P,y]=u.useState(0),[K,$]=u.useState(0),V=u.useRef(0),[D,X]=u.useState([]),[ge,Z]=u.useState(0),[G,q]=u.useState(0),[ce,te]=u.useState(0),[pe,ve]=u.useState(0),[xe,Oe]=u.useState([]),[Ae,et]=u.useState(0),[We,Dt]=u.useState([]),[ht,ct]=u.useState(!1),[yt,Ge]=u.useState(null),[$e,M]=u.useState(null),[W,L]=u.useState(null);u.useEffect(()=>{const z=ie=>{L({kind:"brainstorm",...(ie==null?void 0:ie.detail)||{}}),s("tasks")},de=ie=>{L({kind:"seed",...(ie==null?void 0:ie.detail)||{}}),s("tasks")};return window.addEventListener("hm:open-brainstorm",z),window.addEventListener("hm:open-seed",de),()=>{window.removeEventListener("hm:open-brainstorm",z),window.removeEventListener("hm:open-seed",de)}},[]);const[se,ue]=u.useState(null),[U,ee]=u.useState(null),[we,ut]=u.useState(null),[Ee,He]=u.useState(!1),[$t,wt]=u.useState(!1),Tt=u.useRef(T);Tt.current=T;const F=u.useRef(0),_e=u.useRef(null),Nt=u.useRef(n);Nt.current=n,u.useEffect(()=>{try{F.current=Number(localStorage.getItem(rm))||0}catch{F.current=0}},[]),u.useEffect(()=>{if(!(n!=="tasks"||!ge))try{const z=io(localStorage.getItem(ca)),de=Date.now(),ie={...z};for(const Ne of $u(D,z))ie[Ne.sessionId]=Math.max(de,Number(Ne.at)||0);localStorage.setItem(ca,JSON.stringify(ie)),Z(0)}catch{}},[n,ge,D]);const Kn=u.useCallback(()=>{const z=Date.now();F.current=z,q(0);try{localStorage.setItem(rm,String(z))}catch{}},[]),mt=1500,Ns=u.useRef([]),me=u.useRef(0),jt=u.useCallback(z=>(Ns.current.push(z),()=>{Ns.current=Ns.current.filter(de=>de!==z)}),[]),Ue=u.useCallback(({force:z=!1}={})=>{const de=Date.now();if(!(!z&&de-me.current<mt)){me.current=de;for(const ie of Ns.current)try{Promise.resolve(ie()).catch(()=>{})}catch{}try{window.dispatchEvent(new CustomEvent("hm:wake-sync"))}catch{}}},[mt]);u.useEffect(()=>{const z=()=>{document.visibilityState==="visible"&&Ue()},de=()=>Ue(),ie=()=>Ue({force:!0});return document.addEventListener("visibilitychange",z),window.addEventListener("focus",de),window.addEventListener("online",ie),()=>{document.removeEventListener("visibilitychange",z),window.removeEventListener("focus",de),window.removeEventListener("online",ie)}},[Ue]),u.useEffect(()=>{Ue({force:!0})},[n,Ue]),u.useEffect(()=>{n==="chat"&&Kn()},[n,Kn]),u.useEffect(()=>{const z=Ce=>{var Te;return te(Number((Te=Ce.detail)==null?void 0:Te.count)||0)},de=Ce=>{var Te;return ct(!!((Te=Ce.detail)!=null&&Te.streaming))},ie=Ce=>{s("review"),Ge({...Ce.detail||{},nonce:Date.now()})},Ne=Ce=>{s("chat"),!Tt.current&&Ce.detail&&M(Ce.detail)},Ye=Ce=>{s("chat"),ue({...Ce.detail||{},nonce:Date.now()})},Re=Ce=>{var Te;s("tasks"),ee({board:((Te=Ce.detail)==null?void 0:Te.board)??null,nonce:Date.now()})},je=()=>wt(!0),Se=Ce=>{var Te,xt,ft;s("tasks"),ee({board:((Te=Ce.detail)==null?void 0:Te.board)??null,taskId:((xt=Ce.detail)==null?void 0:xt.taskId)??((ft=Ce.detail)==null?void 0:ft.id)??null,nonce:Date.now()})};return window.addEventListener("hm:chat-unread",z),window.addEventListener("hm:chat-streaming",de),window.addEventListener("hm:open-review",ie),window.addEventListener("hm:open-session",Ne),window.addEventListener("hm:discuss-pipeline",Ye),window.addEventListener("hm:open-board",Re),window.addEventListener("hm:open-live",je),window.addEventListener("hm:open-task",Se),()=>{window.removeEventListener("hm:chat-unread",z),window.removeEventListener("hm:chat-streaming",de),window.removeEventListener("hm:open-review",ie),window.removeEventListener("hm:open-session",Ne),window.removeEventListener("hm:discuss-pipeline",Ye),window.removeEventListener("hm:open-board",Re),window.removeEventListener("hm:open-live",je),window.removeEventListener("hm:open-task",Se)}},[]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/review/chat-reports?limit=200");if(!z)return;const je=Array.isArray(Re.items)?Re.items:[];Nt.current==="chat"&&Kn(),X(je),q(Uk(je,F.current).length);try{const Te=io(localStorage.getItem(ca));if(Z($u(je,Te).length),!Tt.current){const xt=Nn(localStorage);te(lv(je,Te,xt?[xt]:[]).length)}}catch{}const Se=je.reduce((Te,xt)=>Number(xt==null?void 0:xt.at)>Number((Te==null?void 0:Te.at)??-1)?xt:Te,null),Ce=Number(Se==null?void 0:Se.at)||0;if(_e.current===null)_e.current=Ce;else if(Nt.current==="chat"&&Ce>_e.current){_e.current=Ce;const Te=Se.label||Se.taskId||"";It(Te?C("app.reviewDoneLabel",{label:Te}):C("app.reviewDone"))}else Ce>_e.current&&(_e.current=Ce)}catch{}};de();const ie=jt(de),Ne=setInterval(()=>{document.visibilityState==="visible"&&de()},15e3),Ye=()=>de();return window.addEventListener("hm:refresh-reports",Ye),()=>{z=!1,clearInterval(Ne),ie(),window.removeEventListener("hm:refresh-reports",Ye)}},[Kn,jt]),u.useEffect(()=>{try{V.current=Number(localStorage.getItem("hm.reviewSeenAt"))||0}catch{V.current=0}},[]),u.useEffect(()=>{if(b||(t==null?void 0:t.open)!=="inbox")return;const z=setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:t.task}}))},200);return()=>clearTimeout(z)},[b,t]),u.useEffect(()=>{const z=()=>{const de=window.location.hash.replace(/^#/,"");if(!de.startsWith("inbox"))return;const ie=de.includes(":")?de.split(":")[1]:null;window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:ie}}))};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]);const rs=u.useRef(null);u.useEffect(()=>{v(z=>z[n]?z:{...z,[n]:!0})},[n]);const Qn=u.useRef(null);u.useEffect(()=>{var de;const z=(de=Qn.current)==null?void 0:de.querySelector(".nav-item.on");z&&typeof z.scrollIntoView=="function"&&z.scrollIntoView({inline:"center",block:"nearest",behavior:"smooth"})},[n]);const It=u.useCallback(z=>{x({msg:z,at:Date.now()}),clearTimeout(rs.current),rs.current=setTimeout(()=>x(null),2600)},[]),Gt=u.useCallback(async()=>{try{const z=await Y("/api/overview");return i(z),o("ok"),d(!1),z}catch(z){return z.status===401?(d(!0),null):(o(z.code==="OFFLINE"?"offline":"error"),null)}},[]);u.useEffect(()=>{let z=!0;(async()=>{try{await EN()}catch{}z&&(await Gt(),z&&w(!1))})();const de=setInterval(()=>{z&&document.visibilityState==="visible"&&Gt()},5e3),ie=jt(Gt);return()=>{z=!1,clearInterval(de),ie()}},[Gt,jt]);const Ke=bk({reviewWaiting:E,inboxPending:I});u.useEffect(()=>{var z,de;try{Ke>0?(z=navigator.setAppBadge)==null||z.call(navigator,Ke):(de=navigator.clearAppBadge)==null||de.call(navigator)}catch{}},[Ke]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/review");if(!z)return;const je=Array.isArray(Re.items)?Re.items:[];Dt(je),_(sm(je)),y(jc(je))}catch{}},ie=Re=>{var Se;const je=Array.isArray((Se=Re.detail)==null?void 0:Se.items)?Re.detail.items:[];Dt(je),_(sm(je)),y(jc(je))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="review"&&de()},15e3);window.addEventListener("hm:review-items",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:review-items",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const je=await Y("/api/review/feed?limit=20");z&&$(kk(je.items,V.current).length)}catch{}},ie=je=>{var Se;z&&y(jc((Se=je.detail)==null?void 0:Se.items))},Ne=je=>{var Ce;const Se=Number((Ce=je.detail)==null?void 0:Ce.at)||Date.now();V.current=Se,$(0);try{localStorage.setItem("hm.reviewSeenAt",String(Se))}catch{}};de();const Ye=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="review"&&de()},15e3);window.addEventListener("hm:review-items",ie),window.addEventListener("hm:review-seen",Ne);const Re=jt(de);return()=>{z=!1,clearInterval(Ye),Re(),window.removeEventListener("hm:review-items",ie),window.removeEventListener("hm:review-seen",Ne)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Re=await Y("/api/inbox");z&&A(Ou(Re.items))}catch{}},ie=Re=>{var je;return A(Ou((je=Re.detail)==null?void 0:je.items))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&Nt.current!=="tasks"&&de()},15e3);window.addEventListener("hm:inbox-items",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:inbox-items",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{var Re,je;try{const Se=await Y("/api/live");if(!z)return;ve(Number(((Re=Se==null?void 0:Se.counts)==null?void 0:Re.turns)??0)),Oe(Array.isArray(Se==null?void 0:Se.turns)?Se.turns:[]),et(Number(((je=Se==null?void 0:Se.counts)==null?void 0:je.architect)??0))}catch{}},ie=Re=>{var je,Se,Ce;z&&(ve(Number(((je=Re.detail)==null?void 0:je.turns)??0)),Array.isArray((Se=Re.detail)==null?void 0:Se.items)&&Oe(Re.detail.items),((Ce=Re.detail)==null?void 0:Ce.architect)!==void 0&&et(Number(Re.detail.architect)||0))};de();const Ne=setInterval(()=>{document.visibilityState==="visible"&&de()},15e3);window.addEventListener("hm:live-turns",ie);const Ye=jt(de);return()=>{z=!1,clearInterval(Ne),Ye(),window.removeEventListener("hm:live-turns",ie)}},[jt]),u.useEffect(()=>{let z=!0;const de=async()=>{try{const Ne=await Y("/api/usage?hours=24");z&&ut(Ne)}catch{}};de();const ie=setInterval(()=>document.visibilityState==="visible"&&de(),6e4);return()=>{z=!1,clearInterval(ie)}},[]);const sn=Lk({conn:l,bridge:(r==null?void 0:r.bridge)??null}),An=E+I,rn=Mk({tasksRunning:r==null?void 0:r.runningTasks,turns:pe,architectRunning:Ae}),js=_k(xe),ke=Ik(we==null?void 0:we.cacheHitRate),as=u.useCallback(()=>{H("tap");const z=Ok({reviewItems:We,inboxPending:I});if(z){if(z.kind==="review"){s("review"),Ge({taskId:z.taskId,nonce:Date.now()});return}s("tasks"),setTimeout(()=>window.dispatchEvent(new CustomEvent("hm:open-inbox",{detail:{task:null}})),120)}},[We,I]);return c?a.jsxs("div",{className:"login",children:[a.jsx("h1",{children:"Hermes Pilot"}),a.jsx("p",{children:e("app.loginPrompt")}),a.jsx("input",{value:g,onChange:z=>f(z.target.value),placeholder:"~/.hermes/plugin-data/hermes-pilot/token",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsx("button",{onClick:()=>{const z=g.trim();z&&(location.href=`/auth?t=${encodeURIComponent(z)}`)},children:e("app.loginButton")}),a.jsx("p",{className:"hint",children:e("app.loginHint")})]}):a.jsxs("div",{className:"app",children:[a.jsxs("header",{className:"topbar",children:[a.jsxs("span",{className:"brand",onDoubleClick:z=>{if(gs()!=="dopamine")return;const de=z.currentTarget.getBoundingClientRect();bt("allClear",{x:Math.round(de.left+de.width/2),y:Math.round(de.bottom+8),width:Math.round(de.width),height:Math.round(de.height)})},children:["Hermes ",a.jsx("b",{children:"Pilot"})]}),a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[a.jsx("button",{className:"icon-btn","aria-label":e("app.search"),onClick:()=>{H("tap"),k(!0)},children:a.jsx(Me,{name:"search",size:18})}),a.jsx("span",{className:`conn ${l}`,title:e(l==="ok"?"app.connected":"app.disconnected"),children:l==="ok"?"●":"○"})]})]}),a.jsxs("div",{className:"telemetry",role:"status","aria-live":"polite",children:[a.jsx("button",{className:`t-pill gw ${sn}`,onClick:()=>{H("tap"),Gt()},"aria-label":e(sn==="ok"?"app.gwOkAria":"app.gwDownAria"),title:e(sn==="ok"?"app.connected":"app.bridgeOffline"),children:sn==="ok"?a.jsxs(a.Fragment,{children:[a.jsx("i",{className:"t-dot ok","aria-hidden":"true"}),e("status.gw")]}):a.jsxs("span",{className:"t-gw-bad",children:[e("status.gw")," · ",e(sn==="offline"?"status.offline":"app.gwError")]})}),An>0?a.jsxs("button",{className:"t-pill warn pill-warn-pulse",onClick:as,"aria-label":e("app.jumpWaitingAria",{n:An}),children:["🔔 ",e("status.reviewWaiting",{n:An})]}):null,rn>0?a.jsxs("button",{className:"t-pill run",onClick:()=>{H("tap"),wt(!0)},"aria-label":e("app.jumpRunningAria",{n:rn}),children:[a.jsx("i",{className:"t-dot live","aria-hidden":"true"}),"⚡ ",e("status.running",{n:rn}),js?a.jsxs("span",{className:"t-tool",children:[" · ",js]}):null]}):null,ke!==null?a.jsxs("button",{className:"t-pill gem",onClick:()=>{H("tap"),He(!0)},"aria-label":e("app.cacheAria",{pct:ke}),children:["💎 ",ke,"%"]}):null]}),l!=="ok"?a.jsxs("div",{className:"banner",children:[e("app.bridgeOffline"),a.jsx("button",{onClick:()=>{H("tap"),Gt()},children:e("common.retry")})]}):null,a.jsx("main",{className:"panes",children:b?a.jsx(Wn,{label:e("common.loading")}):a.jsxs(a.Fragment,{children:[m.tasks?a.jsx(Ur,{active:n==="tasks",children:a.jsx(Hr,{tab:"tasks",children:a.jsx(XS,{overview:r,refresh:Gt,notify:It,initialInbox:(t==null?void 0:t.open)==="inbox"?t:null,focusBoard:U,onConsumedFocusBoard:()=>ee(null),taskToolRequest:W,onConsumedTaskTool:()=>L(null),active:n==="tasks"})})}):null,m.review?a.jsx(Ur,{active:n==="review",children:a.jsx(Hr,{tab:"review",children:a.jsx(GS,{notify:It,focusRequest:yt,onConsumedFocus:()=>Ge(null),active:n==="review"})})}):null,m.notes?a.jsx(Ur,{active:n==="notes",children:a.jsx(Hr,{tab:"notes",children:a.jsx(mN,{notify:It,onOpenChat:z=>{M({id:z}),s("chat")}})})}):null,m.term?a.jsx(Ur,{active:n==="term",children:a.jsx(Hr,{tab:"term",children:a.jsx(u.Suspense,{fallback:a.jsx(Wn,{label:e("app.termLoading")}),children:a.jsx(LN,{notify:It,active:n==="term"})})})}):null,m.settings?a.jsx(Ur,{active:n==="settings",children:a.jsx(Hr,{tab:"settings",children:a.jsx(tN,{overview:r,notify:It,refresh:Gt})})}):null,m.chat?a.jsx(Ur,{active:n==="chat",children:a.jsx(Hr,{tab:"chat",children:a.jsx(E0,{notify:It,chatReports:D,reviewItems:We,liveTurns:xe,active:n==="chat",openRequest:$e,onConsumedOpen:()=>M(null),discussRequest:se,onConsumedDiscuss:()=>ue(null)})})}):null]})}),a.jsx("nav",{className:"nav",ref:Qn,children:ON.map(z=>{const de=e(z.key),ie=I+ge,Ne=z.id==="review"?E:z.id==="tasks"?ie:0,Ye=(Number(r==null?void 0:r.runningTasks)||0)+pe+Ae,Re=z.id==="review"?Cc({waiting:E,unseen:K,running:P}):z.id==="tasks"?Cc({waiting:ie,running:Ye}):z.id==="chat"?Cc({unseen:Math.max(G,ce),running:ht?1:0}):null,je=!Ne&&Re==="done"?"done":!Ne&&Re==="running"?"running":null,Se=Ne?e(z.id==="review"?"app.navWaiting":"app.navApproval",{label:de,n:Ne}):je==="done"?e("app.navDone",{label:de}):je==="running"?e(z.id==="review"?"app.navReflecting":"app.navRunning",{label:de}):void 0;return a.jsxs("button",{className:`nav-item${n===z.id?" on":""}`,"aria-current":n===z.id?"page":void 0,"aria-label":Se,onClick:()=>{n!==z.id&&H("tap"),s(z.id)},children:[a.jsxs("span",{className:"nav-icon",children:[a.jsx(Me,{name:z.icon}),Ne?a.jsx("span",{className:"nav-badge","aria-hidden":"true",children:Ne}):null,je?a.jsx("span",{className:`nav-dot ${je}`,"aria-hidden":"true"}):null]}),a.jsx("span",{children:de})]},z.id)})}),h?a.jsx("div",{className:`toast ${n}`,children:h.msg}):null,S?a.jsx(nN,{notify:It,onClose:()=>k(!1),onOpenSession:z=>{s("chat"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("hm:open-session",{detail:{id:z.sessionId,messageId:z.messageId,profile:z.profile}}))},120)}}):null,$t?a.jsx(Tv,{notify:It,onClose:()=>wt(!1)}):null,Ee?a.jsx(vv,{data:we,hours:24,onClose:()=>He(!1)}):null,a.jsx(NN,{})]})}qv();async function FN(){tv(document.getElementById("root")).render(a.jsx(qk,{children:a.jsx($N,{})}))}FN();if("serviceWorker"in navigator){window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})});const e="hm.swReload";try{sessionStorage.getItem(e)==="1"&&sessionStorage.removeItem(e)}catch{}navigator.serviceWorker.addEventListener("controllerchange",()=>{try{if(sessionStorage.getItem(e)==="1")return;sessionStorage.setItem(e,"1")}catch{}window.location.reload()})}export{Me as I,Qe as S,Sa as a,Y as b,H as h,a as j,vk as o,u as r,Uv as s,Fe as u};
@@ -12,7 +12,7 @@
12
12
  <link rel="apple-touch-icon" href="/icon-180-v6.png" />
13
13
  <link rel="icon" type="image/svg+xml" href="/icon-v6.svg" />
14
14
  <title>Hermes Pilot</title>
15
- <script type="module" crossorigin src="/assets/index-BzUof8lw.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-CKffAI91.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/assets/index-DwZdbPU7.css">
17
17
  </head>
18
18
  <body>
@@ -948,10 +948,26 @@ export async function main(argv = process.argv.slice(2)) {
948
948
  return 2
949
949
  }
950
950
 
951
- const invokedDirectly =
952
- process.argv[1] && path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url))
951
+ /**
952
+ * このファイルが「直接実行された」か。
953
+ *
954
+ * `npm i -g hermes-pilot` / `npx hermes-pilot` は `node_modules/.bin/hermes-pilot` という
955
+ * **シンボリックリンク**経由で起動する。素の `path.resolve(argv[1])` 比較だと、リンク側の
956
+ * パスと実体(`bin/hermes-pilot.mjs`)が一致せず **main() が呼ばれずに無言で exit 0** する
957
+ * (実測: npm から入れた 0.2.2 で `hermes-pilot --help` が何も出力しない)。
958
+ * 実体パスに解決してから比べる。
959
+ */
960
+ function invokedDirectly() {
961
+ if (!process.argv[1]) return false
962
+ const self = fileURLToPath(import.meta.url)
963
+ try {
964
+ return fs.realpathSync(path.resolve(process.argv[1])) === fs.realpathSync(path.resolve(self))
965
+ } catch {
966
+ return path.resolve(process.argv[1]) === path.resolve(self)
967
+ }
968
+ }
953
969
 
954
- if (invokedDirectly) {
970
+ if (invokedDirectly()) {
955
971
  main()
956
972
  .then((code) => {
957
973
  if (code) process.exit(code)
@@ -3,7 +3,7 @@
3
3
  "label": "Hermes Pilot",
4
4
  "description": "Pair a phone with the Hermes Pilot PWA and drive the A2B pipeline from it — Spec Seed to filed batches, live architect progress, one-tap review sheets and visual annotation — plus the one-time pairing QR, bridge status, scan directories and the keep-alive service, all from the standard dashboard.",
5
5
  "icon": "QrCode",
6
- "version": "0.2.2",
6
+ "version": "0.2.3",
7
7
  "tab": {
8
8
  "path": "/hermes-pilot",
9
9
  "position": "after:git-ops"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-pilot",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Drive an autonomous Hermes Agent from your phone or tablet: Quick Review, annotation, kanban and chat in one installable PWA.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/hajimemanila/hermes-pilot#readme",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hermes-pilot",
3
3
  "displayName": "Hermes Pilot",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "description": "The A2B pipeline for an autonomous Hermes Agent, in your pocket: turn a one-line Spec Seed into a Quick Review interview, a spec the batch runner can execute, filed kanban batches, live monitoring and a Mission Receipt — plus annotation, chat, terminal and usage in one installable PWA.",
6
6
  "author": "Hermes Pilot contributors",
7
7
  "license": "MIT",
package/plugin.yaml CHANGED
@@ -1,4 +1,4 @@
1
1
  name: hermes-pilot
2
- version: 0.2.2
2
+ version: 0.2.3
3
3
  description: "Hermes Pilot — drive an autonomous Hermes Agent from your phone or tablet. Ships a Hermes dashboard tab (pairing QR, bridge status, scan directories, service control) and the PWA bridge it talks to."
4
4
  requires_hermes: ">=0.23.0"