Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

chore(web): rebuild the desktop demo

leepokai76e8f03b6361
diff --git a/apps/desktop/src/renderer/demo/story.ts b/apps/desktop/src/renderer/demo/story.ts
index 2e76fe5a..5d85bec1 100644
--- a/apps/desktop/src/renderer/demo/story.ts
+++ b/apps/desktop/src/renderer/demo/story.ts
@@ -71,9 +71,6 @@ export const entries: SeedEntry[] = [
{ id: 's5', botId: 'scout', kind: 'tool', at: 56, data: { title: 'npm test', toolKind: 'execute', command: 'npm test', status: 'completed', output: '✓ isoWeek: mid year\n✓ isoWeek: first week\n✓ weeklyTotals: sums one week\n✓ weeklyTotals: week that crosses into 2027\n\n4 passing (12ms)', author: 'scout' } },
reply('s6', 'scout', 'scout', 55, 'I added `weeklyTotals(runs)` to `src/pace.js`. It takes runs shaped like `{ date, distance, time }`, groups them by ISO week in UTC (keys like `"2026-W53"`) and sums distance and time. The new test covers the week that crosses into 2027. All 4 tests pass and nothing is committed yet.'),
- { id: 'generated-file', botId: 'scout', kind: 'agent', at: 0, data: { text: 'report.pdf (1250000 bytes)', final: true, files: [{ id: 'demo-report', name: 'report.pdf', size: 1250000, sha256: '0'.repeat(64) }] } },
- { id: 'generated-binary', botId: 'scout', kind: 'agent', at: 0, data: { text: 'binary-output.dat (2000000 bytes)', final: true, files: [{ id: 'demo-binary', name: 'binary-output.dat', size: 2000000, sha256: '0'.repeat(64) }] } },
-
// Reviewer looks it over.
user('r1', 'reviewer', 50, 'Review weeklyTotals before we ship it.'),
tool('r2', 'reviewer', 49, 'Read src/pace.js', 'read'),
diff --git a/web/public/demo/desktop.html b/web/public/demo/desktop.html
index e6b485eb..63ce6e5c 100644
--- a/web/public/demo/desktop.html
+++ b/web/public/demo/desktop.html
@@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<title>Codync demo</title>
- <script type="module" crossorigin src="/demo/desktop/assets/index-DJ5oPlCe.js"></script>
- <link rel="stylesheet" crossorigin href="/demo/desktop/assets/index-DLwuTq6o.css">
+ <script type="module" crossorigin src="/demo/desktop/assets/index-BWLSTWHb.js"></script>
+ <link rel="stylesheet" crossorigin href="/demo/desktop/assets/index-BJEFoEwc.css">
</head>
<body>
<div id="root"></div>
diff --git a/web/public/demo/desktop/assets/icon-Cw_ov8Nx.png b/web/public/demo/desktop/assets/icon-Cw_ov8Nx.png
new file mode 100644
index 00000000..b94ae6d7
Binary files /dev/null and b/web/public/demo/desktop/assets/icon-Cw_ov8Nx.png differ
diff --git a/web/public/demo/desktop/assets/index-BJEFoEwc.css b/web/public/demo/desktop/assets/index-BJEFoEwc.css
new file mode 100644
index 00000000..6d706464
--- /dev/null
+++ b/web/public/demo/desktop/assets/index-BJEFoEwc.css
@@ -0,0 +1 @@
+:root{color-scheme:light dark;--background: #ffffff;--surface: #f4f4f4;--bubble-agent: #f0f0f0;--bubble-user: #e2e2e2;--border: #e6e6e6;--text: #141414;--text-rgb: 20, 20, 20;--secondary: #6b6b6b;--tertiary: #767676;--accent-fill: #000000;--accent: #000000;--on-accent: #ffffff;--accent-dim: #d9d9d9;--danger: #c23a2b;--warning: #f0a030;--code-background: #f4f4f4;--added: #2e7d32;--removed: #c62828;--panel: #fafafa;--chat-agent: #eeeeee;--chat-user: #e2e2e2;--chat-button: #eeeeee;--composer-fill: #f3f3f3;--chrome-fill: #fafafa;--chrome-stroke: rgba(0, 0, 0, .09);--composer-stroke: rgba(0, 0, 0, .14);--roster-selected: #e7e7e7;--frosted: rgba(244, 244, 244, .82);--scale: 1;--conversation: 12px;--md-scale: var(--scale);--ease: cubic-bezier(.25, .1, .25, 1);--hover: .12s var(--ease);--fade: .12s var(--ease);--press: .05s var(--ease);--morph: .2s cubic-bezier(.22, 1, .36, 1);--spring: linear(0, .0712, .2244, .3992, .5638, .7018, .8077, .8834, .9342, .9663, .9853, .9958, 1.0009, 1.0028, 1.0029, 1);--layout: .3s var(--spring);--conversation-motion: .42s var(--spring);--font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;--mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace}@media all{:root{--background: #070707;--surface: #111111;--bubble-agent: #1c1c1c;--bubble-user: #3a3a3a;--border: #262626;--text: #fafafa;--text-rgb: 250, 250, 250;--secondary: #a0a0a0;--tertiary: #929292;--accent-fill: #ffffff;--accent: #ffffff;--on-accent: #000000;--accent-dim: #333333;--danger: #f0a7a7;--code-background: #111111;--added: #8fd18b;--removed: #f0a7a7;--panel: #1b1b1b;--chat-agent: #262626;--chat-user: #363636;--chat-button: #303030;--composer-fill: #2f2f2f;--chrome-fill: #181818;--chrome-stroke: rgba(255, 255, 255, .1);--composer-stroke: rgba(255, 255, 255, .17);--roster-selected: #292929;--frosted: rgba(35, 35, 35, .82)}}@media(prefers-reduced-motion:reduce){:root{--hover: 0s;--fade: 0s;--press: 0s;--morph: 0s;--layout: 0s;--conversation-motion: 0s}}*,*:before,*:after{box-sizing:border-box}html,body,#root{margin:0;height:100%;overflow:hidden}body{background:var(--background);color:var(--text);font-family:var(--font);font-size:calc(13px * var(--scale));line-height:normal;-webkit-font-smoothing:antialiased;-webkit-user-select:none;user-select:none;cursor:default}::-webkit-scrollbar{display:none}*{scrollbar-width:none}button{font:inherit;color:inherit;background:none;border:none;padding:0;margin:0;cursor:default;text-align:inherit}button:focus-visible,[role=separator]:focus-visible{outline:2px solid var(--secondary);outline-offset:-2px}button:disabled{cursor:default}input,textarea{font:inherit;color:inherit;background:transparent;border:none;outline:none;padding:0;margin:0;resize:none}input::placeholder,textarea::placeholder{color:var(--tertiary)}.selectable{-webkit-user-select:text;user-select:text;cursor:text}::selection{background:rgba(var(--text-rgb),.2)}a{color:inherit}.press{transition:transform var(--press)}.press:active:not(:disabled){transform:scale(.98)}.drag{-webkit-app-region:drag}.no-drag{-webkit-app-region:no-drag}.modal-card{position:fixed;inset:0;z-index:100;display:grid;place-items:center}.modal-dim{position:absolute;inset:0;background:#0006;opacity:0;transition:opacity var(--layout)}.modal-content{position:relative;background:var(--background);border-radius:20px;overflow:hidden;box-shadow:0 12px 60px #0000004d;opacity:0;transform:scale(.96);transition:opacity var(--layout),transform var(--layout);display:flex;flex-direction:column}.modal-card.shown .modal-dim{opacity:1}.modal-card.shown .modal-content{opacity:1;transform:none}.modal-card:not(.shown),.dialog:not(.shown){pointer-events:none}.modal-header{display:flex;align-items:center;gap:8px;height:48px;padding:0 10px 0 16px;flex:none}.modal-content:after,.dialog-card:after{content:"";position:absolute;inset:0;border:1px solid color-mix(in srgb,var(--text) 18%,transparent);border-radius:inherit;pointer-events:none;z-index:1}.dialog{position:fixed;inset:0;z-index:200;display:grid;place-items:center;opacity:0;transition:opacity var(--fade)}.dialog.shown{opacity:1}.dialog.shown .dialog-card{transform:none}.dialog-dim{position:absolute;inset:0;background:#00000059}.dialog-card{position:relative;transform:scale(.98);transition:transform var(--fade);width:min(320px,calc(100vw - 48px));padding:18px;background:var(--bubble-agent);border-radius:22px;box-shadow:0 10px 48px #00000040;display:flex;flex-direction:column;gap:14px}.dialog-text{display:flex;flex-direction:column;gap:6px;text-align:center;color:var(--text)}.dialog-buttons{display:flex;flex-direction:column;gap:8px}.dialog-button{font-size:calc(12px * var(--scale));font-weight:500;text-align:center;padding:8px 0;border-radius:999px;background:var(--bubble-user);color:var(--text);transition:transform var(--press),opacity var(--press)}.dialog-button.prominent{background:var(--accent-fill);color:var(--on-accent)}.dialog-button.destructive{background:var(--danger);color:#fff}.dialog-button:active{transform:scale(.98);opacity:.85}.anchored{position:fixed;inset:0;z-index:300;opacity:0;transition:opacity var(--fade)}.anchored.shown{opacity:1}.anchored-panel{background:var(--bubble-agent);border-radius:14px;box-shadow:0 8px 40px #00000040;overflow:hidden;transform:scale(.98);transition:transform var(--layout)}.anchored.shown .anchored-panel{transform:none}.menu-panel{padding:6px;display:flex;flex-direction:column;gap:2px;overflow-y:auto}.menu-divider{height:.5px;background:rgba(var(--text-rgb),.1);margin:4px 10px}.menu-row{display:flex;align-items:center;gap:10px;width:100%;padding:6px 10px;border-radius:8px;font-size:calc(12px * var(--scale));color:var(--text);transition:background-color var(--hover)}.menu-row.destructive{color:var(--danger)}.menu-row.highlight{background:rgba(var(--text-rgb),.07)}.menu-icon{width:18px;display:flex;justify-content:center;flex:none}.menu-title{flex:1;margin-right:16px}.reaction-button{display:grid;place-items:center;transition:background-color var(--hover),transform var(--press)}.reaction-button span{transition:transform var(--hover)}.reaction-button:hover{background:rgba(var(--text-rgb),.06)}.reaction-button:hover span{transform:scale(1.15)}.reaction-button:active span{transform:scale(.85)}.reaction-button.chosen{background:rgba(var(--text-rgb),.12)}.icon-button{display:grid;place-items:center;color:var(--secondary);flex:none;transition:background-color var(--hover),color var(--hover),transform var(--press)}.icon-button:hover:not(:disabled){color:var(--text);background:rgba(var(--text-rgb),.08)}.icon-button:active:not(:disabled){background:rgba(var(--text-rgb),.14);transform:scale(.98)}.icon-button.selected{background:var(--accent-fill);color:var(--on-accent)}.icon-button:disabled{opacity:.35}html[data-platform=darwin] .modal-card,html[data-platform=darwin] .dialog{padding-top:28px}.styled-button{font-size:calc(12px * var(--scale));font-weight:500;padding:6px 12px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:transform var(--press),opacity var(--press)}.styled-button.primary{background:var(--accent-fill);color:var(--on-accent)}.styled-button.secondary{background:var(--bubble-user);color:var(--text)}.styled-button:active:not(:disabled){transform:scale(.98);opacity:.85}.styled-button:disabled{opacity:.4}.spinner{animation:spin .8s linear infinite;flex:none}@keyframes spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation:none}}.switch{display:flex;align-items:center;gap:12px;width:100%}.switch:disabled{opacity:.4}.switch-label{flex:1;min-width:0}.switch-track{position:relative;width:34px;height:20px;border-radius:999px;background:var(--bubble-user);flex:none;transition:background-color var(--hover)}.switch-track.on{background:var(--accent-fill)}.switch-knob{position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform var(--hover),background-color var(--hover)}.switch-track.on .switch-knob{transform:translate(14px);background:var(--on-accent)}.choice-picker{display:inline-flex;align-items:center;gap:6px;font-size:calc(12px * var(--scale));color:var(--text);padding:5px 9px;border-radius:10px;max-width:100%}.choice-picker.outlined{box-shadow:inset 0 0 0 1px var(--border)}.choice-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.segmented{position:relative;display:flex;gap:2px;padding:3px;background:var(--bubble-user);border-radius:999px}.segmented-thumb{position:absolute;top:3px;bottom:3px;left:3px;border-radius:999px;background:var(--background);transition:transform var(--morph)}.segmented-option{position:relative;flex:1;text-align:center;font-size:calc(11px * var(--scale));font-weight:500;color:var(--secondary);padding:5px 0;white-space:nowrap}.segmented-option.on{color:var(--text)}.choice-row{display:flex;align-items:center;gap:10px;width:100%}.card-form{height:100%;overflow-y:auto;background:var(--background)}.card-form-content{display:flex;flex-direction:column;gap:28px;padding:14px;font-size:calc(12px * var(--scale))}.card-section{display:flex;flex-direction:column;gap:10px;width:100%}.card-section-title{display:flex;align-items:center;gap:8px;padding-left:2px}.card-section-rows{background:var(--surface);border-radius:16px;display:flex;flex-direction:column}.card-row{min-height:52px;padding:12px 16px;display:flex;align-items:center}.card-row>*{flex:1;min-width:0}.card-section-footer{font-size:calc(10px * var(--scale));color:var(--secondary);line-height:1.4;padding:0 2px}.hairline{height:1px;background:var(--border);flex:none}@media(min-resolution:2dppx){.hairline{height:.5px}}.hairline.inset{margin:0 16px}.value-row{display:flex;align-items:center;width:100%}.search-field{display:flex;align-items:center;gap:8px;padding:7px 10px;background:var(--bubble-agent);border-radius:999px;font-size:calc(12px * var(--scale))}.search-field input{flex:1;min-width:0}.disclosure-label{display:flex;align-items:center;gap:6px;width:100%}.pill{display:inline-flex;align-items:center;padding:5px 9px;border-radius:10px}.computer-roster-section{flex:none;min-width:0;transition:opacity var(--layout)}.computer-roster-section.dragging{opacity:.45}.computer-roster-heading{display:flex;align-items:center;gap:2px;padding:12px 2px 4px}.computer-roster-toggle{display:flex;align-items:center;gap:5px;flex:1;min-width:0;padding:5px 4px;color:var(--secondary);border-radius:8px;cursor:grab}.computer-roster-toggle:hover{background:var(--bubble-agent)}.computer-roster-label{display:flex;flex:1;min-width:0;align-items:baseline;gap:6px;font-size:calc(11px * var(--scale));text-align:left}.computer-roster-label strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.computer-roster-label>span{color:var(--tertiary);font-size:calc(10px * var(--scale));white-space:nowrap}.computer-roster-label>.warning{color:var(--warning)}.computer-roster-chevron{flex:none;display:flex;transition:transform var(--layout)}.computer-roster-chevron.collapsed{transform:rotate(-90deg)}.computer-roster-content{display:grid;grid-template-rows:1fr;opacity:1;transition:grid-template-rows var(--layout),opacity var(--layout)}.computer-roster-content.collapsed{grid-template-rows:0fr;opacity:0}.computer-roster-content>div{min-height:0;overflow:hidden}.computer-roster-empty{padding:8px 10px 12px;color:var(--tertiary);font-size:calc(11px * var(--scale))}.sidebar.compact .computer-roster-toggle{justify-content:center;padding:4px 0;gap:2px}.sidebar:not(.compact) .roster{padding-bottom:72px;scroll-padding-bottom:72px}.sidebar-footer{position:absolute;z-index:2;bottom:0;left:0;right:0;display:flex;align-items:center;gap:8px;padding:10px 14px 14px;isolation:isolate}.sidebar-footer-fade{position:absolute;z-index:-1;inset:-38px 0 0;pointer-events:none;background:linear-gradient(to top,var(--surface) 22%,color-mix(in srgb,var(--surface) 90%,transparent) 54%,transparent)}.sidebar-footer-fade:before,.sidebar-footer-fade:after{content:"";position:absolute;inset:0;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);-webkit-mask-image:linear-gradient(to top,black 40%,transparent);mask-image:linear-gradient(to top,black 40%,transparent)}.sidebar-footer-fade:after{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);-webkit-mask-image:linear-gradient(to top,black 18%,transparent 75%);mask-image:linear-gradient(to top,black 18%,transparent 75%)}.sidebar-account{flex:none;display:grid;place-items:center;width:32px;height:34px;border-radius:50%;transition:background-color var(--hover),transform var(--hover)}.sidebar-account .profile-avatar{width:32px;height:32px}.sidebar-account:hover,.sidebar-account.active{background:var(--bubble-agent)}.connect-apps{flex:1;min-width:0;height:34px;border-radius:999px;padding:0 12px;display:flex;align-items:center;justify-content:center;gap:9px;white-space:nowrap;font-size:calc(13px * var(--scale));font-weight:500;background:var(--chrome-fill);border:1px solid var(--chrome-stroke);transition:background-color var(--hover),transform var(--hover)}.connect-apps:hover{background:color-mix(in srgb,var(--text) 10%,var(--surface))}.connect-apps:active,.sidebar-account:active{transform:scale(.97)}.connect-apps-logos{display:flex;flex:none}.connect-apps-logos img{width:14px;height:16px;padding:1px;background:#fff;border-radius:3px;object-fit:contain}.connect-apps-logos>*+*{margin-left:-3px}@media(prefers-reduced-motion:reduce){.connect-apps:active,.sidebar-account:active{transform:none}}@media(prefers-reduced-transparency:reduce){.sidebar-footer-fade{background:var(--surface);inset:0}.sidebar-footer-fade:before,.sidebar-footer-fade:after{backdrop-filter:none;-webkit-backdrop-filter:none}}.market-page{position:relative;height:100%;background:var(--background)}.market-scroll{height:100%;overflow-y:auto}.market-page-content{display:flex;flex-direction:column;gap:24px;padding:30px 36px;max-width:860px;margin:0 auto}.market-close{position:absolute;top:8px;right:8px}.market-stack{position:relative;height:100%;overflow:hidden;background:var(--background)}.market-layer{position:absolute;inset:0;display:flex;flex-direction:column;transition:transform var(--layout),opacity var(--layout)}.market-layer.off-leading{transform:translate(-100%);opacity:0;pointer-events:none}.market-layer.off-trailing{transform:translate(100%);opacity:0;pointer-events:none}.market-search{display:flex;align-items:center;gap:10px;padding:0 14px;height:38px;background:var(--bubble-agent);border-radius:12px}.market-search input{flex:1;min-width:0}.market-section{display:flex;flex-direction:column;gap:12px}.agent-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}.item-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));column-gap:10px;row-gap:4px}.agent-card{display:flex;flex-direction:row;align-items:center;text-align:left;gap:12px;padding:10px 12px;border-radius:12px;min-width:0;background:transparent;transition:background-color var(--hover),transform var(--press)}.agent-card:hover{background:color-mix(in srgb,var(--bubble-agent) 80%,transparent)}.agent-card:active{transform:scale(.98)}.market-row{display:flex;align-items:center;gap:14px;padding:10px 12px;border-radius:16px;min-width:0;transition:background-color var(--hover)}.market-row.openable:hover{background:color-mix(in srgb,var(--bubble-agent) 60%,transparent)}.capsule-action{font-weight:600;color:var(--text);padding:7px 16px;background:var(--bubble-agent);border-radius:999px;white-space:nowrap;flex:none;transition:transform var(--press),opacity var(--press)}.capsule-action:active:not(:disabled){transform:scale(.98);opacity:.85}.skeleton{animation:market-pulse .9s ease-in-out infinite alternate}@keyframes market-pulse{to{opacity:.5}}@media(prefers-reduced-motion:reduce){.skeleton{animation:none}}.plain-link{color:var(--text);text-decoration:underline;text-align:left}.option-row{display:flex;align-items:center;gap:12px;width:100%}.option-row:disabled{opacity:.5}.plain-row-button{display:flex;align-items:center;width:100%}.market-field{width:100%;display:block}textarea.market-field{field-sizing:content}.setup-terminal{flex:1;min-height:0;padding:6px 10px 0}.setup-terminal .xterm{height:100%}.setup-terminal .xterm-viewport{background:transparent!important}.fade-in{animation:market-fade-in var(--fade) both}@keyframes market-fade-in{0%{opacity:0}}.market-heading{display:flex;align-items:center;gap:12px;padding-right:10px;flex-wrap:wrap}@media(max-width:640px){.market-page-content{padding:28px 18px}.item-grid,.agent-grid{grid-template-columns:minmax(0,1fr)}}.bot-message-row{display:flex;align-items:center;gap:6px;margin:0 auto;padding:10px 0}.bot-conversation{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--background)}.bot-conversation-scroll{flex:1;min-height:0;overflow-y:auto;container-type:inline-size}.bot-conversation-rows{padding:0 16px 8px}.memory-header-actions{display:flex;align-items:center;gap:2px}.memory-menu{width:28px;height:28px;border-radius:8px}.memory-search{display:flex;align-items:center;gap:8px}.memory-search .search-field{flex:1;min-width:0}.memory-empty{display:flex;flex-direction:column;align-items:center;gap:8px;padding:18px 12px;text-align:center;color:var(--secondary);line-height:1.45}.memory-item{display:flex;align-items:flex-start;gap:8px}.memory-item .memory-menu{margin:-4px -6px 0 0}.memory-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0;text-align:left}.memory-content strong{display:flex;align-items:center;gap:6px}.memory-content span{white-space:pre-wrap;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.memory-content small,.memory-muted{color:var(--secondary)}.memory-more{color:var(--secondary);text-align:center}.memory-actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.memory-actions button{color:var(--secondary);font-size:12px}.memory-actions button[aria-pressed=true]{color:var(--text);font-weight:650}.memory-editor{display:flex;flex-direction:column;gap:16px;padding:20px;max-height:70vh;overflow:auto}.memory-editor label{display:flex;flex-direction:column;gap:6px}.memory-editor input,.memory-editor textarea{padding:10px;background:var(--surface);color:var(--text);border:0;border-radius:8px;font:inherit}.memory-editor textarea{resize:vertical}.memory-history{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;-webkit-user-select:text;user-select:text}.memory-error{color:var(--danger, #df665e);white-space:pre-wrap}.field-box{display:block;width:100%;padding:8px 10px;background:var(--background);border-radius:12px;color:var(--text);-webkit-user-select:text;user-select:text;cursor:text}textarea.field-box{line-height:1.3}.bot-form{height:100%;overflow-y:auto;background:var(--background)}.bot-form-content{display:flex;flex-direction:column;gap:24px;padding:14px;font-size:calc(12px * var(--scale))}.avatar-button{padding:12px;background:var(--bubble-agent);border-radius:20px;display:flex}.swatch{padding:4px;border-radius:50%;flex:none;display:flex;box-shadow:inset 0 0 0 2px transparent;transition:box-shadow var(--hover)}.swatch.on{box-shadow:inset 0 0 0 2px var(--accent)}.swatch-row{display:flex;gap:10px;padding:4px;overflow-x:auto}.bot-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 6px 5px 8px;background:var(--bubble-agent);border-radius:999px;flex:none;animation:chip-in var(--layout) both}@keyframes chip-in{0%{opacity:0;transform:scale(.85)}}.chip-row{display:flex;align-items:center;gap:6px;overflow-x:auto;min-width:0}.pick-row{display:flex;align-items:center;gap:12px;width:100%;padding:8px 12px;border-radius:12px;transition:background-color var(--hover),transform var(--press)}.pick-row.hover:hover{background:var(--bubble-agent)}.key-cap{min-width:18px;min-height:18px;display:grid;place-items:center;border-radius:4px;background:var(--background);color:var(--secondary);font-family:var(--mono);font-size:calc(10px * var(--scale))}.compose-list{max-height:460px;overflow-y:auto;background:var(--surface);border-radius:18px;box-shadow:0 6px 32px #00000014;max-width:620px;margin:10px 22px 0;padding:8px;display:flex;flex-direction:column;gap:2px}.compose-box{display:flex;align-items:flex-end;margin:16px;padding:6px 6px 6px 18px;background:var(--bubble-user);border-radius:24px;box-shadow:0 2px 20px #0000000f}.compose-box textarea{flex:1;min-width:0;font-size:var(--conversation);line-height:round(up,calc(var(--conversation) * 1.25),1px);padding:11px 0;-webkit-user-select:text;user-select:text;cursor:text}.level-slide{animation:level-in var(--layout) both}.level-slide.from-trailing{--from: 40px}.level-slide.from-leading{--from: -40px}@keyframes level-in{0%{opacity:0;transform:translate(var(--from))}}.fade-in{animation:fade-in var(--fade) both}@keyframes fade-in{0%{opacity:0}}.group-form{display:flex;flex-direction:column;gap:28px;padding:8px 20px 24px}.group-identity{display:flex;flex-direction:column;align-items:center;gap:10px}.group-name,.group-about{width:100%;text-align:center;background:transparent;color:var(--text);resize:none}.group-name{font-size:calc(22px * var(--scale));font-weight:600;margin-top:6px}.group-about{font-size:calc(13px * var(--scale));color:var(--secondary);line-height:1.35}.group-name::placeholder,.group-about::placeholder{color:var(--tertiary)}.group-section-title{font-size:calc(13px * var(--scale));font-weight:600;color:var(--secondary);padding-bottom:4px}.member-row{display:flex;align-items:center;gap:14px;width:calc(100% + 16px);min-height:48px;margin:0 -8px;padding:4px 8px;border-radius:12px;text-align:left;transition:background-color var(--hover),transform var(--press)}button.member-row:hover{background:var(--bubble-agent)}.member-name{flex:1;min-width:0;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.member-row.removable:hover{background:var(--bubble-agent)}.member-open{display:flex;align-items:center;gap:14px;flex:1;min-width:0;min-height:40px;text-align:left}.member-row.removable>:last-child:not(.member-open){opacity:0;transition:opacity var(--hover)}.member-row.removable:hover>:last-child,.member-row.removable:focus-within>:last-child{opacity:1}.routine-input{width:100%;padding:12px;border:none;outline:none;border-radius:12px;background:var(--bubble-user);color:var(--text);font:inherit;-webkit-user-select:text;user-select:text;resize:none}.routine-input::placeholder{color:var(--secondary)}textarea.routine-input{field-sizing:content;min-height:calc(3lh + 24px);max-height:calc(8lh + 24px)}.routine-form{border:none;margin:0;padding:0;min-width:0}.routine-form:disabled{opacity:.6}.routine-cron{container-type:inline-size}.routine-cron-fields{display:flex;align-items:flex-start;gap:10px}.routine-cron-fields>:first-child{flex:1;min-width:220px}.routine-cron-fields>:last-child{width:170px;flex:none}@container (max-width: 400px){.routine-cron-fields{flex-direction:column;align-items:stretch;gap:14px}.routine-cron-fields>:first-child,.routine-cron-fields>:last-child{width:auto;min-width:0}}.routine-row{display:flex;flex-direction:column;gap:3px;padding:10px 0;flex:1;min-width:0;text-align:left}.routine-fade{animation:routine-fade var(--hover) both}@keyframes routine-fade{0%{opacity:0}}.settings{display:flex;height:100%;background:var(--background);position:relative}.settings-sidebar{width:200px;flex:none;display:flex;flex-direction:column;gap:2px;padding:30px 10px 10px}.settings-group{font-size:calc(12px * var(--scale));font-weight:500;color:var(--tertiary);padding:0 10px 4px}.settings-item{display:flex;align-items:center;gap:10px;height:32px;padding:0 10px;border-radius:10px;font-size:calc(13px * var(--scale));color:var(--text);transition:background-color var(--hover)}.settings-item.selected{background:rgba(var(--text-rgb),.08)}.settings-divider{width:1px;flex:none;background:var(--border)}.settings-main{flex:1;min-width:0;display:flex;flex-direction:column}.settings-page{flex:1;min-height:0;padding:0 18px;animation:settings-fade var(--fade) both}.settings-close{position:absolute;top:14px;right:14px}@keyframes settings-fade{0%{opacity:0}}.settings-card{padding:16px;width:100%;background:var(--surface);border-radius:16px;margin-bottom:8px;display:flex;flex-direction:column;gap:8px}.settings-section-header{display:flex;align-items:center;min-height:24px;padding:0 0 10px 2px}.settings-row{display:flex;align-items:center;gap:10px;width:100%}.settings-stack{display:flex;flex-direction:column;gap:1px;min-width:0}.settings-field{flex:1;min-width:0;text-align:right}.settings-code{font-family:var(--mono);font-size:calc(10px * var(--scale));padding:6px;flex:1;min-width:0;background:var(--code-background);border-radius:6px}.settings-appear{animation:settings-fade var(--layout) both}.settings-reveal{display:grid;grid-template-rows:0fr;opacity:0;transform:translateY(-4px);transition:grid-template-rows var(--layout),opacity var(--layout),transform var(--layout)}.settings-reveal.shown{grid-template-rows:1fr;opacity:1;transform:none}.settings-reveal>div{min-height:0;overflow:hidden}.call{-webkit-app-region:no-drag;display:flex;flex-direction:column;align-items:center;gap:6px;padding:0 12px;max-width:100%}.call-bar{display:flex;align-items:center;gap:10px;padding:10px 10px 10px 18px;border-radius:999px;background:var(--frosted);backdrop-filter:blur(24px) saturate(1.8);-webkit-backdrop-filter:blur(24px) saturate(1.8);box-shadow:0 8px 40px #00000040}.call-avatar{display:flex;transition:transform var(--layout)}.call-avatar.speaking{animation:call-pulse .6s ease-in-out infinite alternate}@keyframes call-pulse{to{transform:scale(1.1)}}.call-round{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;flex:none;background:var(--bubble-user);color:var(--secondary);transition:background-color var(--hover),color var(--hover),transform var(--press)}.call-round.on{background:var(--accent-fill);color:var(--on-accent)}.call-round.end{background:var(--danger);color:#fff}.call-round:active{transform:scale(.98)}.call-line{font-size:calc(10px * var(--scale));text-align:center;padding:8px 12px;border-radius:999px;background:var(--bubble-user);box-shadow:0 2px 20px #0000000f;animation:call-line-in var(--fade) both}@keyframes call-line-in{0%{opacity:0}}@media(prefers-reduced-motion:reduce){.call-avatar.speaking{animation:none}}.thread-view{display:flex;height:100%;overflow:hidden}.conversation{--conversation: var(--chat);--md-scale: var(--chat-scale);flex:1;min-width:0;height:100%;position:relative;display:flex;flex-direction:column;background:var(--background)}.top-chrome{position:absolute;top:0;left:0;right:0;z-index:5;padding:10px 16px 14px;display:grid;place-items:center;pointer-events:none;-webkit-app-region:drag}.top-chrome>*{grid-area:1 / 1}.top-chrome-row{display:flex;width:100%;align-items:center;gap:8px}.top-chrome-row>*,.title-pill{pointer-events:auto;-webkit-app-region:no-drag}.top-fade{grid-area:auto!important;position:absolute;inset:0 0 -24px;pointer-events:none;background:linear-gradient(to bottom,var(--background) 0%,color-mix(in srgb,var(--background) 60%,transparent) 35%,transparent 100%)}.top-fade:before{content:"";position:absolute;inset:0;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);-webkit-mask-image:linear-gradient(to bottom,#000,transparent 50%);mask-image:linear-gradient(to bottom,#000,transparent 50%)}.title-pill{position:relative;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 12px 6px 8px;background:var(--chrome-fill);border:1px solid var(--chrome-stroke);border-radius:999px;box-shadow:0 4px 32px #0000001f;max-width:60%}.title-pill{transition:opacity var(--layout),transform var(--layout)}.title-pill.hidden-by-call{opacity:0;transform:translateY(-8px)}.frosted-circle{border-radius:50%;background:var(--frosted);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);display:flex}.frosted-circle .icon-button{border-radius:50%!important}.round-button{width:32px;height:32px;border-radius:50%;background:var(--frosted);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);display:grid;place-items:center;flex:none}.transcript-frame{position:absolute;inset:0}.transcript{height:100%;overflow-y:auto;overflow-anchor:none}.transcript-content{container-type:inline-size;max-width:1120px;margin:0 auto;padding:64px 14px var(--composer-height, 70px)}.load-earlier{display:block;width:100%;text-align:center;padding:12px 0;font-size:calc(10px * var(--scale));color:var(--secondary)}.intro-card{display:flex;flex-direction:column;align-items:center;gap:14px;max-width:440px;margin:0 auto;padding:0 24px;text-align:center}.composer-dock{flex:none}.message{display:flex;flex-direction:column;width:100%}.message.user{align-items:flex-end;padding-left:56px}.message.agent{align-items:flex-start}.message-body{position:relative;display:flex;flex-direction:column;gap:4px;min-width:0;max-width:100%}.message.user .message-body{align-items:flex-end;margin-left:88px;max-width:calc(100% - 88px)}.message.agent .message-body{align-items:flex-start;max-width:max(80px,min((100cqw + 32px) * .8 - 32px,100cqw - 88px));margin-right:88px}.bubble{padding:8px 10px;border-radius:16px;max-width:100%;min-width:0}.bubble.user{background:var(--chat-user);color:var(--text);font-size:var(--conversation);line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}.bubble.agent{background:var(--chat-agent)}.message-actions{position:absolute;bottom:0;display:flex;align-items:center;gap:2px;transition:opacity var(--hover)}.message-actions.leading{right:calc(100% + 6px)}.message-actions.trailing{left:calc(100% + 6px)}.message-action{width:26px;height:26px;display:grid;place-items:center;color:var(--secondary)}.message-action:hover{color:var(--text)}.reaction-chip{padding:3px 8px;border-radius:999px;background:var(--surface)}.thread-chip{display:flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;background:var(--surface)}.working{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:22px;background:var(--bubble-agent);text-align:left;min-width:0}.thinking{max-height:180px;overflow-y:auto;white-space:pre-wrap;text-align:left}.mentions{display:flex;gap:6px;padding:0 16px 6px;overflow-x:auto}.mention{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:var(--surface);flex:none}.composer{display:flex;align-items:flex-end;gap:8px;padding:8px 14px 14px;max-width:1120px;margin:0 auto;width:100%}.symbol-swap{animation:symbol-in var(--morph) both}@keyframes symbol-in{0%{opacity:0;transform:scale(.6)}}.file-chips{display:flex;gap:6px;padding:8px 10px 0;overflow-x:auto}.file-chips:has(.attachment-tile){align-items:flex-start}.attachment-tile{position:relative;width:80px;height:80px;flex:none;border-radius:16px;overflow:hidden;background:var(--surface)}.attachment-tile img{width:100%;height:100%;object-fit:contain}.attachment-remove{position:absolute;top:4px;right:4px;width:22px;height:22px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#000000bf}.file-chip{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:var(--surface);flex:none}.call-overlay{position:absolute;top:16px;left:0;right:0;z-index:6;display:flex;justify-content:center;animation:call-in var(--layout) both}@keyframes call-in{0%{opacity:0;transform:translateY(-100%)}}.side-panel{height:100%;display:flex;flex:none;opacity:0;transition:width var(--layout),opacity var(--morph);overflow:hidden}.side-panel.shown{opacity:1}.side-panel-border{width:1px;background:var(--border);flex:none}@keyframes panel-slide{0%{opacity:0;transform:translate(20px)}}.panel-slide.from-trailing{animation:from-trailing var(--layout) both}.panel-slide.from-leading{animation:from-leading var(--layout) both}@keyframes from-trailing{0%{opacity:0;transform:translate(30%)}}@keyframes from-leading{0%{opacity:0;transform:translate(-30%)}}.row-in{animation:row-in .24s cubic-bezier(.23,1,.32,1) both;transform-origin:bottom left}.row-in.mine{transform-origin:bottom right}@keyframes row-in{0%{opacity:0;transform:translateY(12px) scale(.94)}}@media(prefers-reduced-motion:reduce){.row-in{animation:row-fade .12s both}}@keyframes row-fade{0%{opacity:0}}.composer-add{width:25px;height:25px;border-radius:50%;background:color-mix(in srgb,var(--text) 9%,var(--composer-fill));border:1px solid var(--chrome-stroke);box-shadow:0 2px 20px #0000000f;display:grid;place-items:center;flex:none;margin-bottom:max(0px,(round(up,calc(var(--conversation) * 1.25),1px) + 10px - 25px) / 2)}.composer-surface{flex:1;min-width:0;background:var(--composer-fill);border-radius:22px;border:1px solid var(--composer-stroke);box-shadow:0 2px 20px #0000000f;display:flex;flex-direction:column}.composer-box{display:flex;align-items:flex-end;gap:8px;padding:6px 7px}.composer-field{flex:1;min-width:0;position:relative}.composer-box textarea,.composer-measure{flex:1;min-width:0;font-size:var(--conversation);line-height:round(up,calc(var(--conversation) * 1.25),1px);padding:5px 0;color:var(--text);-webkit-user-select:text;user-select:text;cursor:text}.composer-box textarea{display:block;width:100%;height:calc(round(up,calc(var(--conversation) * 1.25),1px) + 10px);transition:height var(--layout)}.composer-measure{position:absolute;inset:0 0 auto;visibility:hidden;pointer-events:none;white-space:pre-wrap;overflow-wrap:break-word}.composer-reveal{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows var(--layout),opacity var(--morph)}.composer-reveal.shown{grid-template-rows:1fr;opacity:1}.composer-reveal>div{min-height:0;overflow:hidden}.composer-symbol{grid-area:1 / 1;display:grid;place-items:center;opacity:0;transform:scale(.55) rotate(-35deg);transition:opacity var(--morph),transform var(--morph)}.composer-symbol.active{opacity:1;transform:scale(1) rotate(0)}.composer-send{width:25px;height:25px;border-radius:999px;display:grid;place-items:center;flex:none;margin-bottom:max(0px,(round(up,calc(var(--conversation) * 1.25),1px) + 10px - 25px) / 2);transition:background-color var(--morph),color var(--morph),transform var(--press)}.mac-chat-button{border-radius:50%;background:var(--chat-button);color:var(--secondary);display:grid;place-items:center;flex:none;position:relative;overflow:hidden;transition:transform var(--morph),color var(--hover)}.mac-chat-button:after{content:"";position:absolute;inset:0;border-radius:50%;background:rgba(var(--text-rgb),0);transition:background-color var(--hover)}.mac-chat-button>*{transition:translate var(--morph)}.mac-chat-button:hover{color:var(--text)}.mac-chat-button:hover:after{background:rgba(var(--text-rgb),.06)}.mac-chat-button:hover>*{translate:calc(var(--dx) * 1px) calc(var(--dy) * 1px)}.mac-chat-button:active{transform:scale(.94);transition:transform var(--press)}.mac-chat-button:active:after{background:rgba(var(--text-rgb),.12)}.mac-chat-button:active>*{translate:calc(var(--dx) * 1.5px) calc(var(--dy) * 1.5px)}@media(prefers-reduced-motion:reduce){.mac-chat-button:hover>*,.mac-chat-button:active>*{translate:none}.mac-chat-button:active{transform:none}}.composer-dock{position:absolute;left:0;right:0;bottom:0;z-index:4}.composer-fade{position:absolute;z-index:-1;inset:-24px 0 0;pointer-events:none;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);-webkit-mask-image:linear-gradient(to top,#000 40%,transparent);mask-image:linear-gradient(to top,#000 40%,transparent);background:linear-gradient(to top,color-mix(in srgb,var(--background) 90%,transparent) 0%,color-mix(in srgb,var(--background) 45%,transparent) 40%,transparent 100%)}.jump-to-latest{position:absolute;left:50%;z-index:5;transform:translate(-50%);border-radius:50%;box-shadow:0 3px 20px #0000001f;animation:jump-in var(--morph) both}@keyframes jump-in{0%{opacity:0;translate:0 6px}}.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.credentials-page{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--background)}.credentials-page>.card-form{flex:1;min-height:0}.credentials-page .card-form-content{width:100%;max-width:620px;margin:0 auto;padding:20px 28px 32px;gap:24px;font-size:calc(13px * var(--scale))}.credentials-page .card-section{gap:10px}.credentials-page .card-section-rows{background:none;border-radius:0;gap:10px}.credentials-page .card-row{min-height:0;padding:0}.credentials-page .card-section-rows>.hairline{display:none}.credentials-page .card-section-footer{font-size:calc(11px * var(--scale));line-height:1.5}.credentials-page .card-section+.card-section{padding-top:22px;border-top:1px solid var(--border)}.credential-storage{display:flex;align-items:center;gap:12px;padding:14px 16px;background:var(--surface);border-radius:12px}.credential-storage strong{font-weight:500}.credential-storage p{margin:4px 0 0;color:var(--secondary);font-size:calc(11px * var(--scale))}.credential-field{display:flex;flex-direction:column;gap:7px}.credential-field>span{font-size:calc(12px * var(--scale));color:var(--secondary)}.credential-field .market-field{min-height:36px;padding:9px 12px;background:var(--surface);border-radius:9px;box-shadow:inset 0 0 0 1px var(--border);transition:box-shadow var(--hover)}.credential-field .market-field:focus-visible{outline-offset:2px}.credentials-page .plain-row-button{min-height:38px;padding:8px 10px;border-radius:8px}.credentials-page .plain-row-button:hover{background:var(--surface)}@media(max-width:600px){.credentials-page .card-form-content{padding:16px}}.computer-access{overflow:auto;width:100%;animation:computer-access-appear .18s ease-out}@keyframes computer-access-appear{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.computer-access.onboarding{height:100%;padding:clamp(24px,6vh,56px) 24px 24px}.settings-page>.computer-access{height:100%;padding-bottom:24px}.modal-content>.computer-access{flex:1;min-height:0;height:auto;padding-top:20px}.computer-access-content{width:100%;max-width:520px;margin:0 auto}.computer-access-header{margin-bottom:24px}.computer-access-identity{display:flex;align-items:center;gap:10px;margin-bottom:24px}.computer-access-identity img{flex:none}.computer-access-identity div{display:grid;gap:3px;min-width:0}.computer-access-identity span{color:var(--secondary);font-size:11px}.computer-access-identity strong{font-size:12px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.computer-access h1{font-size:26px;letter-spacing:-.65px;line-height:1.2;font-weight:600;margin:0 0 10px;text-wrap:balance}.computer-access p{color:var(--secondary);font-size:12px;line-height:1.6;margin:5px 0 0;text-wrap:pretty}.computer-access-header>p{font-size:13px;max-width:480px}.computer-access-section-label{display:flex;justify-content:space-between;gap:12px;margin-bottom:10px;font-size:11px;color:var(--secondary)}.computer-access-section-label>:first-child{color:var(--text);font-weight:500}.computer-access-steps{border:1px solid var(--composer-stroke);border-radius:16px;overflow:hidden;background:var(--surface)}.computer-access-row{display:flex;align-items:flex-start;gap:12px;padding:18px;transition:background var(--fade)}.computer-access-row+.computer-access-row{border-top:1px solid var(--border)}.computer-access-row.current{background:var(--chrome-fill)}.computer-access-row-icon{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex:none;color:var(--secondary)}.computer-access-row.current .computer-access-row-icon,.computer-access-row.granted .computer-access-row-icon{color:var(--text)}.computer-access-row-body{flex:1;min-width:0}.computer-access-row-heading{display:flex;align-items:baseline;gap:10px;justify-content:space-between;flex-wrap:wrap}.computer-access h2{font-size:13px;line-height:1.5;font-weight:600;margin:0}.computer-access-status{display:inline-flex;align-items:center;gap:5px;color:var(--secondary);font-size:10px;line-height:1.5;white-space:nowrap}.computer-access-row.current .computer-access-status,.computer-access-row.granted .computer-access-status{color:var(--text)}.computer-access-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.computer-access-actions:not(:empty){margin-top:12px}.computer-access .styled-button{min-height:30px;font-size:11px;padding:6px 12px}.computer-access .styled-button.secondary{background:transparent;border:1px solid var(--composer-stroke)}.computer-access .styled-button.secondary:hover:not(:disabled){background:var(--chrome-fill)}.computer-access .styled-button:focus-visible{outline:2px solid var(--text);outline-offset:3px}.computer-access .computer-access-inline-note{flex-basis:100%;margin:0}.computer-access-help,.computer-access-reassurance{display:flex;align-items:flex-start;gap:8px;margin-top:16px;color:var(--secondary)}.computer-access-help>:first-child,.computer-access-reassurance>:first-child{margin-top:3px}.computer-access-help p,.computer-access-reassurance p{margin:0;font-size:11px}.computer-access-help strong{font-weight:500;color:var(--text)}.computer-access-reassurance{margin-top:20px}.computer-access-footer{display:flex;justify-content:space-between;gap:12px;margin-top:22px;padding-top:18px;border-top:1px solid var(--border)}.computer-access .computer-access-phone-note{font-size:10px;margin-top:16px}.computer-access-notice{display:flex;align-items:flex-start;gap:10px;border:1px solid var(--composer-stroke);border-radius:12px;padding:12px 14px;margin-bottom:20px}.computer-access-notice>:first-child{margin-top:2px;color:var(--secondary)}.computer-access-notice strong{font-size:12px;font-weight:500}.computer-access-notice p{font-size:11px;margin-top:3px}.computer-access-notice.error{border-color:var(--danger)}.computer-access-notice.error strong,.computer-access-notice.error>:first-child{color:var(--danger)}@media(max-width:440px){.computer-access.onboarding{padding:24px 16px}.computer-access-row{padding:14px 12px;gap:8px}.computer-access-row-heading{gap:4px 8px}.computer-access h1{font-size:24px}}@media(prefers-reduced-motion:reduce){.computer-access{animation:none}}.palette{display:flex;flex-direction:column;max-height:min(560px,calc(100vh - 120px));background:var(--surface)}.palette-field{display:flex;align-items:center;gap:10px;height:56px;padding:0 20px;flex:none;font-size:calc(15px * var(--scale))}.palette-field input{flex:1;min-width:0}.palette-list{flex:1;min-height:0;overflow-y:auto;padding:0 8px 8px;display:flex;flex-direction:column;gap:2px}.palette-row{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:8px 12px;border-radius:12px;text-align:left;transition:background-color var(--hover)}.palette-row.active{background:var(--bubble-user)}.palette-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.palette-key{flex:none;font-family:inherit;font-size:calc(12px * var(--scale));padding:0 6px;height:22px;border-radius:6px}.palette-empty{padding:28px 0;text-align:center;color:var(--secondary);font-size:calc(13px * var(--scale))}.startup-recovery{height:100%;overflow-y:auto;display:flex;padding:44px 32px 32px}.startup-recovery-content{width:min(560px,100%);margin:auto;display:flex;flex-direction:column;align-items:flex-start;gap:16px}.startup-recovery-title{display:flex;align-items:center;gap:10px}.startup-recovery-profiles{width:100%;display:flex;flex-direction:column;gap:8px}.startup-recovery .local-recovery{height:auto;width:100%;align-items:flex-start;padding:18px;margin-top:12px;border-radius:14px;background:var(--surface)}.chat-window{height:100%;min-width:760px;min-height:500px;background:var(--background);position:relative}.empty-state{height:100%;padding:32px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}.split{display:flex;height:100%}.sidebar{position:relative;flex:none;height:100%;background:var(--surface);display:flex;flex-direction:column;overflow:hidden;transition:width var(--layout)}.sidebar-header{display:flex;align-items:center;gap:6px;height:54px;padding-right:14px;flex:none;transition:opacity var(--layout),padding var(--layout)}.roster{flex:1;overflow-y:auto;padding:0 10px;display:flex;flex-direction:column;gap:2px;outline:none;position:relative}.sidebar.compact .roster{padding-top:4px}.roster-row{width:100%;border-radius:12px;display:flex;transition:background-color var(--hover);flex:none}.roster-row.dragging{opacity:.45}.roster-row+.roster-row{margin-top:4px}.roster-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;pointer-events:none}.profile-avatar{width:28px;height:28px;border-radius:50%;background:var(--bubble-user);display:grid;place-items:center;flex:none}.rail-actions{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 0 10px;flex:none}.rail-profile{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;margin-top:4px}.sidebar-divider{width:1px;flex:none;background:var(--border);position:relative;z-index:2}.sidebar-divider:after{content:"";position:absolute;top:0;bottom:0;left:-4px;width:9px;cursor:col-resize}.detail{flex:1;min-width:420px;height:100%;position:relative;overflow:hidden}.detail-column{display:flex;flex-direction:column;height:100%}.empty-detail{height:100%;padding:32px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px}.context-layer{position:fixed;inset:0;z-index:50;pointer-events:auto}.account-panel,.action-menu{position:absolute;padding:7px;background:var(--panel);box-shadow:0 8px 40px #00000040;animation:panel-in var(--fade) both}.account-panel{border-radius:18px;transform-origin:bottom left}.action-menu{width:260px;border-radius:14px}@keyframes panel-in{0%{opacity:0;transform:scale(.97)}}.panel-row{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 10px;border-radius:10px}.panel-row.highlight{background:rgba(var(--text-rgb),.08)}.panel-row:disabled{opacity:.4}.panel-divider{height:.5px;background:rgba(var(--text-rgb),.13);margin:5px 10px}.panel-identity{display:flex;align-items:center;gap:8px;height:30px;padding:0 10px;color:var(--secondary)}.sidebar:not(.compact) .sidebar-header{position:absolute;z-index:3;inset:0 0 auto;isolation:isolate}.sidebar:not(.compact) .roster{padding-top:54px;scroll-padding-top:54px}.sidebar:not(.compact) .sidebar-header:before{content:"";position:absolute;z-index:-1;inset:0 0 -18px;pointer-events:none;background:linear-gradient(to bottom,var(--surface) 50%,transparent);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);-webkit-mask-image:linear-gradient(to bottom,black 65%,transparent);mask-image:linear-gradient(to bottom,black 65%,transparent)}.sidebar-header .sidebar-header-action{border-radius:50%!important;border:1px solid var(--chrome-stroke);background:var(--chrome-fill);color:var(--text)}.sidebar-header .sidebar-header-action:hover{background:color-mix(in srgb,var(--text) 5%,var(--chrome-fill))}@media(prefers-reduced-transparency:reduce){.sidebar:not(.compact) .sidebar-header:before{-webkit-backdrop-filter:none;backdrop-filter:none}}.computer-filter-action{height:32px;min-width:44px;justify-content:center;flex:none;border:1px solid var(--chrome-stroke);border-radius:999px;background:var(--chrome-fill);transition:background-color var(--hover)}.computer-filter-action:hover{background:color-mix(in srgb,var(--text) 5%,var(--chrome-fill))}html[data-window=island],html[data-window=island] body,html[data-window=island] #root{background:transparent}.island{--text: #f5f6f8;--text-rgb: 245, 246, 248;--secondary: #8e939c;--tertiary: #5f646d;--accent-fill: #f5f6f8;--on-accent: #0b0c0e;--bubble-user: rgba(255, 255, 255, .09);--danger: #ff8d97;--island-card: #141518;--bubble-agent: rgba(255, 255, 255, .12);--warning: #f0a030;--scale: 1;position:absolute;top:0;left:50%;transform:translate(-50%);color:var(--text);font-size:13px;transition:width .52s cubic-bezier(.32,1.22,.42,1),height .52s cubic-bezier(.32,1.22,.42,1),opacity .2s var(--ease)}.island.shrinking{transition:width .34s cubic-bezier(.45,0,.2,1),height .34s cubic-bezier(.45,0,.2,1),opacity .2s var(--ease)}.island[data-mode=hidden]{opacity:0}.island.shrinking[data-mode=hidden]{transition:width .34s cubic-bezier(.45,0,.2,1),height .34s cubic-bezier(.45,0,.2,1),opacity .16s var(--ease) .3s}.island-layer{position:absolute;inset:0}.island-layer.leaving{opacity:0;filter:blur(8px);transform:scale(.97);transition:opacity .16s var(--ease),filter .16s var(--ease),transform .16s var(--ease);pointer-events:none}.island-body{position:absolute;inset:0;overflow:hidden;background:#000;transition:border-radius .34s var(--ease)}.island-ear{position:absolute;top:0;width:14px;height:14px}.island-ear.left{left:-14px;background:radial-gradient(circle at 0 100%,transparent 13.5px,#000 14px)}.island-ear.right{right:-14px;background:radial-gradient(circle at 100% 100%,transparent 13.5px,#000 14px)}.island.edge .island-ear{width:10px;height:10px}.island.edge .island-ear.left{left:-10px;background:radial-gradient(circle at 0 100%,transparent 9.5px,#000 10px)}.island.edge .island-ear.right{right:-10px;background:radial-gradient(circle at 100% 100%,transparent 9.5px,#000 10px)}:where(.island button){border:0;padding:0;cursor:default}.island-wings{position:absolute;inset:0;display:flex;justify-content:space-between;align-items:center}.island-wing-left,.island-wing-right{position:relative;width:52px;height:100%;display:grid;place-items:center}.island-wings.peeking .island-wing-left{width:32px}.island-wings-label{position:absolute;inset:0;display:grid;place-items:center;font-size:11.5px;color:var(--secondary)}.island-wing-avatar{position:relative;display:block}.island-cluster{display:grid;grid-template-columns:repeat(2,11px);gap:1px;justify-items:center}.island-cluster-bot{position:relative}.island-header{animation:island-in .3s .3s var(--ease) backwards;position:absolute;top:2px;left:14px;right:14px;height:32px;display:flex;align-items:center;justify-content:space-between}.island-tabs{display:flex;align-items:center;gap:6px}.island-tab{width:30px;height:30px;border-radius:15px;display:grid;place-items:center;background:transparent;color:var(--secondary);transition:background-color var(--hover),color var(--hover)}.island-tab:hover{background:#ffffff14;color:var(--text)}.island-tab.selected{background:#ffffff1f;color:var(--text)}.island-count{font-size:12px;color:var(--secondary);margin-right:4px}.island-content{position:absolute;left:10px;right:10px;bottom:10px;animation:island-in .3s .16s var(--ease) backwards}@keyframes island-in{0%{opacity:0;filter:blur(8px);transform:scale(.97)}}.island-card{position:relative;height:100%;box-sizing:border-box;border-radius:20px;background:var(--island-card);overflow:hidden;color:var(--text)}.island-row-cards,.island-with-minis{display:flex;height:100%;gap:10px}.island-with-minis{gap:0}.island-with-minis>.island-card{flex:1;min-width:0}.island-big{position:relative;flex:none;background:none}.island-big canvas{position:relative}.island-glow{position:absolute;inset:-18px;border-radius:50%}.island-badge{position:absolute;left:-5px;top:3px;z-index:1;width:18px;height:18px;border-radius:50%;box-shadow:0 0 0 2.5px #000;display:grid;place-items:center;color:#0b0c0e}.island-badge.orb{left:-7px;top:1px;width:22px;height:22px;background:#000;box-shadow:0 0 0 1.5px #ffffff24}.island-badge.dots{left:-6px;top:4px;width:auto;height:16px;padding:0 4px;border-radius:8px;background:#f5f6f8;display:flex;align-items:center;gap:2px}.island-badge.dots i{width:3px;height:3px;border-radius:50%;background:#0b0c0e}.island-badge.small{left:-4px;top:-3px;width:9px;height:9px;box-shadow:0 0 0 1.5px #000}.island-badge.dots.small{width:auto;height:7px;padding:0 2px;gap:1px}.island-badge.dots.small i{width:1.5px;height:1.5px}.island-agent{display:flex;align-items:center;gap:7px;min-width:0;height:26px}.island-dot{width:8px;height:8px;border-radius:50%;flex:none}.island-agent-name{font-size:14px;font-weight:600;white-space:nowrap}.island-agent-subtitle{font-size:13px;color:var(--secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.island-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.island-focus{display:flex;align-items:center;gap:13px;padding:0 14px 0 19px;text-align:left;font:inherit}.island-focus-text{flex:1;min-width:0;display:flex;flex-direction:column}.island-step{height:30px;display:flex;align-items:center;gap:9px;font-size:13px;color:var(--tertiary);min-width:0}.island-step.current{font-size:15px;font-weight:500;color:#e8eaed}.island-pills{flex:1;min-width:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-content:center;padding:0 8px}.island-pill{height:34px;border-radius:17px;padding:0 10px 0 5px;display:flex;align-items:center;gap:7px;font:inherit;font-size:12.5px;font-weight:500;min-width:0;transition:filter var(--hover)}.island-pill:hover{filter:brightness(1.25)}.island-pill-bot,.island-mini{position:relative;flex:none;background:none}.island-status-dot{position:absolute;left:-1px;top:-1px;width:6px;height:6px;border-radius:50%;box-shadow:0 0 0 1.5px #000}.island-cluster .island-status-dot{width:4px;height:4px;left:-2px;top:-2px}.island-alert{display:flex;align-items:center;gap:24px;padding:0 20px 0 24px}.island-alert-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:9px}.island-alert .island-agent-name{font-size:15px}.island-alert .island-agent-subtitle{font-size:14px}.island-code{align-self:flex-start;max-width:100%;box-sizing:border-box;padding:8px 12px;border-radius:10px;background:#22242a;font-family:var(--mono);font-size:13.5px;color:#e8eaed;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.island-title{font-size:17px;font-weight:700}.island-error{font-size:13.5px;line-height:1.4;color:var(--danger);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.island-buttons{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.island .styled-button{height:32px;border-radius:16px;padding:0 14px;font-size:13px;font-weight:500;gap:8px}.island-key{min-width:16px;height:16px;box-sizing:border-box;padding:0 3px;border-radius:5px;border:1.5px solid;opacity:.55;display:grid;place-items:center;font-size:10px}.island-minis{width:42px;display:flex;flex-direction:column;align-items:center;gap:6px;padding-top:4px}.island-meter{height:30px;padding:0 6px;border-radius:15px;display:flex;align-items:center;gap:6px;background:transparent;color:var(--secondary);font-size:12px;font-variant-numeric:tabular-nums;transition:background-color var(--hover),color var(--hover)}.island-meter:hover{background:#ffffff14;color:var(--text)}.island-meter-bar{width:28px;display:flex}.island-usage{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:8px;padding:0 18px}.island-usage-row{display:flex;align-items:center;gap:10px;font-size:12.5px;white-space:nowrap}.island-usage-title{width:56px;flex:none;overflow:hidden;text-overflow:ellipsis}.island-usage-value{width:34px;flex:none;text-align:right;font-variant-numeric:tabular-nums}.island-usage-reset{width:66px;flex:none;text-align:right;color:var(--secondary);overflow:hidden;text-overflow:ellipsis}.island-empty{display:flex;align-items:center;gap:28px;padding:0 22px 0 29px}.island-empty-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}.island-empty .island-title{font-size:16px}.island-subtitle{font-size:13.5px;line-height:1.35;color:var(--secondary)}.island-message{display:flex;align-items:center;gap:22px;padding:0 18px 0 20px}.island-message-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:9px}.island-chip{height:26px;border-radius:13px;padding:0 9px 0 4px;display:flex;align-items:center;gap:6px;font:inherit;font-size:12.5px;font-weight:500;flex:none}.island-field{display:flex;align-items:center;gap:8px;height:40px;border-radius:20px;background:#22242a;padding:0 5px 0 16px;margin:0}.island-field input{flex:1;min-width:0;border:0;outline:none;background:transparent;color:var(--text);font:inherit;font-size:14px;-webkit-user-select:text;user-select:text}.island-field input::placeholder{color:#6b7079}.island-send{width:30px;height:30px;border-radius:15px;display:grid;place-items:center;background:#f5f6f8;color:#0b0c0e}.island-send:disabled{opacity:.35}.island-countdown{position:absolute;bottom:4px;left:50%;transform:translate(-50%);height:2px;border-radius:1px;background:#ffffff59;animation:island-countdown linear forwards}@keyframes island-countdown{0%{width:160px}to{width:0}}@media(prefers-reduced-motion:reduce){.island,.island.shrinking,.island-body{transition:none}.island-content,.island-header{animation:none}.island-layer.leaving{transition:none}}
diff --git a/web/public/demo/desktop/assets/index-BWLSTWHb.js b/web/public/demo/desktop/assets/index-BWLSTWHb.js
new file mode 100644
index 00000000..82bb9921
--- /dev/null
+++ b/web/public/demo/desktop/assets/index-BWLSTWHb.js
@@ -0,0 +1,55 @@
+(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const h of l)if(h.type==="childList")for(const u of h.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function s(l){const h={};return l.integrity&&(h.integrity=l.integrity),l.referrerPolicy&&(h.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?h.credentials="include":l.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function r(l){if(l.ep)return;l.ep=!0;const h=s(l);fetch(l.href,h)}})();function r2(e){const t=e.createdAt??0;return{id:e.id,kind:e.kind??"agent",members:e.members??[],name:e.name??"Bot",description:e.description??"",avatarColor:e.avatarColor??"blue",avatarShape:e.avatarShape??"blob",backend:e.backend??"custom",command:e.command??null,cwd:e.cwd??"",managedWorkspace:e.managedWorkspace??!1,permission:e.permission??"auto",model:e.model??null,pinned:e.pinned??!1,position:e.position??0,hidden:e.hidden??!1,notify:e.notify??null,connectors:e.connectors??[],skills:e.skills??[],computer:e.computer??!1,autoName:e.autoName??!1,createdAt:t,rev:e.rev??0,status:e.status??"idle",activity:e.activity??"",startedAt:e.startedAt??null,workingChat:e.workingChat??null,workingThread:e.workingThread??null,unread:e.unread??0,lastMessage:e.lastMessage??null,lastAt:e.lastAt??t}}const ft=e=>e.kind==="group",mn=e=>e.status==="working"||e.status==="needsInput",pn=e=>e.status==="needsInput",pp=(e,t,s)=>mn(e)&&(e.workingChat??e.id)===t&&(e.workingThread??null)===(s??null),ru=e=>e.managedWorkspace?"Personal workspace":e.cwd.split("/").filter(Boolean).pop()??e.cwd,Cx=e=>["png","jpg","jpeg","heic","gif","webp","tiff","bmp"].includes(e.split(".").pop()?.toLowerCase()??"");function Fa(e){switch(e.kind){case"user":case"permission":case"notice":return!0;case"agent":return e.data.final===!0;default:return!1}}function qh(e){return e?{enabled:e.enabled??!1,connected:e.connected??!1,platform:e.platform??"",permissionApp:e.permissionApp,capture:e.capture??!1,input:e.input??!1,displays:e.displays??[],userControl:e.userControl??!1,agentBot:e.agentBot??null,computerUse:e.computerUse??!1,viewers:e.viewers??0}:null}function Co(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const a2="demo-mac",kx="MacBook Pro",jx="/Users/demo/code/pace",n6=[{id:"pacer",name:"Pacer",description:"Owns the pace math",avatarColor:"orange",avatarShape:"squircle",backend:"claude",model:"opus",permission:"ask",status:"needsInput",activity:"Needs approval: Edit src/pace.js",unread:1},{id:"scout",name:"Scout",description:"Finds things in the repo and builds them",avatarColor:"green",avatarShape:"cloud",backend:"codex",model:null,unread:1},{id:"reviewer",name:"Reviewer",description:"Reviews every change before it ships",avatarColor:"violet",avatarShape:"blob",backend:"claude",model:"sonnet",unread:1},{id:"relay",name:"Relay",description:"Writes the release notes",avatarColor:"blue",avatarShape:"tablet",backend:"codex",model:null,unread:1},{id:"ship",kind:"group",members:["pacer","scout","reviewer"],name:"Ship room",description:"Getting weeklyTotals out",avatarColor:"gray",avatarShape:"blob",backend:"",model:null}],Zf=jx,Er=(e,t,s,r,l)=>({id:e,botId:t,kind:"user",at:s,data:{text:r,status:"sent"},threadId:l}),Fn=(e,t,s,r,l,h)=>({id:e,botId:t,kind:"agent",at:r,data:{text:l,final:!0,author:s},threadId:h}),My=(e,t,s,r)=>({id:e,botId:t,kind:"thought",at:s,data:{text:r,author:t}}),dh=(e,t,s,r,l,h="")=>({id:e,botId:t,kind:"tool",at:s,data:{title:r,toolKind:l,status:"completed",output:h,author:t}}),r6=["@@ -18,3 +18,15 @@ export function isoWeek(date) {"," ","+export function weeklyTotals(runs) {","+ const weeks = {}","+ for (const run of runs) {","+ const key = isoWeek(run.date)","+ const week = (weeks[key] ??= { distance: 0, time: 0 })","+ week.distance += run.distance","+ week.time += run.time","+ }","+ return weeks","+}"].join(`
+`),a6=["@@ -4,9 +4,10 @@ export function isoWeek(date) {"," const d = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()))","- const year = d.getUTCFullYear()"," d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7))","+ // The ISO year is the year of the Thursday of this week.","+ const year = d.getUTCFullYear()"," const start = new Date(Date.UTC(year, 0, 1))"," const week = Math.ceil(((d - start) / 86400000 + 1) / 7)",' return `${year}-W${String(week).padStart(2, "0")}`'].join(`
+`),l6=[Er("s1","scout",58,"Add a weeklyTotals(runs) helper that sums distance and time per ISO week, with a test."),My("s2","scout",58,"isoWeek already lives in src/pace.js, so weeklyTotals can key on it and stay small."),dh("s3","scout",57,"Read src/pace.js","read"),{id:"s4",botId:"scout",kind:"tool",at:57,data:{title:"Edit src/pace.js",toolKind:"edit",status:"completed",author:"scout",diffs:[{path:"src/pace.js",added:10,removed:0,isNew:!1,startLine:18,patch:r6}]}},{id:"s5",botId:"scout",kind:"tool",at:56,data:{title:"npm test",toolKind:"execute",command:"npm test",status:"completed",output:`✓ isoWeek: mid year
+✓ isoWeek: first week
+✓ weeklyTotals: sums one week
+✓ weeklyTotals: week that crosses into 2027
+
+4 passing (12ms)`,author:"scout"}},Fn("s6","scout","scout",55,'I added `weeklyTotals(runs)` to `src/pace.js`. It takes runs shaped like `{ date, distance, time }`, groups them by ISO week in UTC (keys like `"2026-W53"`) and sums distance and time. The new test covers the week that crosses into 2027. All 4 tests pass and nothing is committed yet.'),Er("r1","reviewer",50,"Review weeklyTotals before we ship it."),dh("r2","reviewer",49,"Read src/pace.js","read"),dh("r3","reviewer",49,"Read test/pace.test.js","read"),Fn("r4","reviewer","reviewer",48,`I found no blockers. The ISO week math is right, including the New Year edge.
+
+Two small things:
+- A bad date becomes a \`"NaN-WNaN"\` bucket instead of an error.
+- Weeks are grouped in UTC, so a late evening run west of UTC can land in the next week.`),Er("l1","relay",41,"Summarize what changed in pace today for the team channel."),Fn("l2","relay","relay",40,"Added `weeklyTotals` to group run distance and time by ISO week, with a test for the 2026 to 2027 rollover. Reviewer found no blockers. An invalid-date guard is being added in Ship room."),Er("l3","relay",38,"Make it one line for the changelog.","l2"),Fn("l4","relay","relay",38,"Pace now shows your weekly distance and time totals.","l2"),Er("g1","ship",22,"Is weeklyTotals ready to ship? One short sentence each."),Fn("g2","ship","reviewer",21,'Almost: the week math is right and all 4 tests pass, but a bad date gets bucketed as `"NaN-WNaN"` instead of raising an error. @Scout, can you add an invalid-date guard?'),Fn("g3","ship","scout",19,"Added the guard: `weeklyTotals` now throws a `RangeError` on an invalid date, and all 5 tests pass. Weeks are still grouped in UTC, so say if they should follow the runner's local time instead."),Er("g4","ship",17,"UTC is right, keep it.","g3"),Fn("g5","ship","scout",17,"Got it, UTC stays. I left a comment above `weeklyTotals` so nobody flips it later.","g3"),Fn("g6","ship","pacer",15,"Ship it once my `isoWeek` New Year fix lands. Dec 30, 2024 still comes out as 2024-W01 instead of 2025-W01."),Er("p1","pacer",9,"Fix the isoWeek New Year bug you mentioned."),My("p2","pacer",9,"The year is read before moving to the Thursday of the week, so late December dates get the wrong ISO year."),dh("p3","pacer",8,"Read src/pace.js","read"),{id:"p4",botId:"pacer",kind:"agent",at:7,data:{text:"Found it: the year comes from the date itself, not from the Thursday of its week.",final:!1,author:"pacer"}},{id:"p5",botId:"pacer",kind:"permission",at:6,data:{title:"Edit src/pace.js",toolKind:"edit",cwd:jx,status:"pending",selected:void 0,author:"pacer",diffs:[{path:"src/pace.js",added:2,removed:1,isNew:!1,startLine:4,patch:a6}],options:[{optionId:"allow",name:"Allow",kind:"allow_once"},{optionId:"always",name:"Always allow",kind:"allow_always"},{optionId:"deny",name:"Deny",kind:"reject_once"}]}}],o6={pacer:["Sure. I'll keep it inside `src/pace.js` and rerun `npm test` when it's done.","Makes sense. The week math is the risky part, so I'll add a test for it first.","Good call. Nothing else imports that function, so it's a one-file change."],scout:["On it. I'll grep the repo first so we know what else touches it.","Done a quick pass: only `src/pace.js` and its test use it, so the change stays small.","Sure. I'll write the test first, then make it pass."],reviewer:["I'll look at the diff once it lands and flag anything that isn't a nit.","Looks fine to me. Just keep the test for the New Year week, that's where it broke before.","One thing to watch: dates without a time zone are read as UTC. Worth a comment."],relay:[`Here's a draft: "Pace now groups your runs by week, with totals for distance and time."`,"Noted. I'll fold that into the release notes for the next version.","Short version for the channel: weekly totals are in, a New Year week fix is next."]},c6="I'm still waiting on your approval for the `isoWeek` edit. Once you allow it, I'll keep going.",h6="Fixed: `isoWeek` now takes the year from the Thursday of the week, so Dec 30, 2024 is 2025-W01. I added a test for it and all 6 tests pass.",u6="OK, I left `src/pace.js` alone. Want me to explain the fix so you can make it yourself?";function Ay(e){const t=s=>e+s*36e5;return{providers:[{id:"claude",name:"Claude",source:"statusline",updatedAt:e,windows:[{id:"five_hour",label:"5-hour",percent:38,resetsAt:t(2.4)},{id:"seven_day",label:"Weekly",percent:61,resetsAt:t(70)}]},{id:"codex",name:"Codex",source:"sessions",updatedAt:e,windows:[{id:"primary",label:"5-hour",percent:22,resetsAt:t(3.1)},{id:"secondary",label:"Weekly",percent:47,resetsAt:t(95)}]}]}}const Ty=1500,Vh="Not available in the web demo. Install Codync to use this.";class d6{constructor(t,s=Date.now()){this.version=t;for(const r of n6)this.bots.set(r.id,r2({...r,cwd:r.kind==="group"?"":Zf,createdAt:s-864e5,permission:r.permission??"auto"}));for(const r of l6)this.add({botId:r.botId,threadId:r.threadId??null,kind:r.kind,data:r.data},r.id,s-r.at*6e4,!1);for(const r of this.bots.values())this.refreshPreview(r),r.rev=++this.rev}version;hostId="demo-host";rev=0;seq=0;bots=new Map;entries=[];listeners=new Set;turns=new Map;nextReply=new Map;analytics=!0;subscribe(t,s){const r=[...[...this.bots.values()].filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"bot",rev:p.rev,bot:this.botJSON(p)}})),...this.entries.filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"entry",rev:p.rev,entry:p}}))].sort((p,m)=>p.rev-m.rev),l={type:"hello",hostId:this.hostId,computerId:a2,rev:this.rev,usage:Ay(Date.now()),screen:null};let h=!0;const u=p=>h&&s(p);return setTimeout(()=>{if(h){for(const p of[{line:l},...r])s(JSON.stringify(p.line));this.listeners.add(u)}},0),()=>{h=!1,this.listeners.delete(u)}}emit(t){const s=JSON.stringify(t);for(const r of this.listeners)r(s)}emitBot(t){if(t.rev=++this.rev,this.emit({type:"bot",rev:t.rev,bot:this.botJSON(t)}),t.kind!=="group")for(const s of this.bots.values())s.kind==="group"&&s.members.includes(t.id)&&this.emitBot(s)}emitEntry(t){t.rev=++this.rev,t.updatedAt=Date.now(),this.emit({type:"entry",rev:t.rev,entry:t})}botJSON(t){if(t.kind!=="group")return t;const s=t.members.map(r=>this.bots.get(r)).find(r=>r&&r.status!=="idle"&&r.workingChat===t.id);return s?{...t,status:s.status,activity:s.activity,startedAt:s.startedAt,workingChat:t.id,workingThread:s.workingThread}:t}add(t,s=crypto.randomUUID(),r=Date.now(),l=!0){const h={...t,id:s,seq:++this.seq,rev:++this.rev,turn:1,createdAt:r,updatedAt:r};if(this.entries.push(h),h.threadId&&this.summarize(h.botId,h.threadId,l),l){this.emit({type:"entry",rev:h.rev,entry:h});const u=this.bots.get(h.botId);u&&!h.threadId&&Fa(h)&&(this.refreshPreview(u),h.kind!=="user"&&u.unread++,this.emitBot(u))}return h}summarize(t,s,r){const l=this.entries.find(p=>p.id===s);if(!l)return;const h=this.entries.filter(p=>p.botId===t&&p.threadId===s&&Fa(p)),u=[];for(const p of h){const m=p.kind==="user"?"user":p.data.author??t;u.includes(m)||u.push(m)}l.data={...l.data,thread:{count:h.length,lastAt:h.at(-1)?.createdAt??0,authors:u,unread:0}},r&&this.emitEntry(l)}refreshPreview(t){const s=this.entries.filter(l=>l.botId===t.id&&!l.threadId&&(l.kind==="user"||l.kind==="agent"&&l.data.final)).at(-1);if(!s)return;const r=s.data.text??"";t.lastAt=s.createdAt,t.lastMessage=s.kind==="user"?`You: ${r}`:t.kind==="group"?`${this.bots.get(s.data.author??"")?.name??"A bot"}: ${r}`:r}setStatus(t,s,r="",l=null,h=null){const u=this.bots.get(t);u&&(Object.assign(u,{status:s,activity:r,startedAt:s==="idle"?null:Date.now(),workingChat:l,workingThread:h}),this.emitBot(u))}pending(t){return this.entries.find(s=>s.kind==="permission"&&s.data.author===t&&s.data.status==="pending")??null}settle(t){const s=this.pending(t);s?this.setStatus(t,"needsInput",`Needs approval: ${s.data.title??""}`,s.botId):this.setStatus(t,"idle")}async answer(t,s,r,l){const h=(this.turns.get(t)??0)+1;this.turns.set(t,h),this.setStatus(t,"working","Typing…",s,r),await Ny(Ty+Math.random()*600),this.turns.get(t)===h&&(this.add({botId:s,threadId:r,kind:"agent",data:{text:l,final:!0,author:t}}),this.settle(t))}replyText(t){if(this.pending(t))return c6;const s=o6[t]??["Got it. I'll take a look and report back."],r=this.nextReply.get(t)??0;return this.nextReply.set(t,r+1),s[r%s.length]}async converse(t,s,r){let l=[t.id];if(t.kind==="group"){const h=t.members.filter(m=>this.bots.has(m)),u=h.filter(m=>r.toLowerCase().includes(`@${this.bots.get(m).name.toLowerCase()}`)),p=s?this.entries.find(m=>m.id===s)?.data.author:void 0;l=u.length?u:p&&h.includes(p)?[p]:h.slice(0,2)}for(const h of l)await this.answer(h,t.id,s,this.replyText(h))}async call(t,s){const r=l=>typeof s[l]=="string"?s[l]:"";switch(t){case"hello":return{hostId:this.hostId,computerId:a2,signKey:"",boxKey:"",cloud:null,name:kx,version:this.version,minApp:this.version,os:"macos",device:"MacBookPro",home:"/Users/demo",rev:this.rev,analytics:this.analytics,urls:[],backends:[{id:"claude",name:"Claude Code",available:!0,installed:!0,signedIn:!0,command:"claude",installHint:""},{id:"codex",name:"Codex",available:!0,installed:!0,signedIn:!0,command:"codex",installHint:""}]};case"accessRequests":return{requests:[]};case"cloudStatus":return{enabled:!1};case"usage":return Ay(Date.now());case"history":return{entries:[]};case"thread":return{entries:this.entries.filter(l=>l.botId===r("botId")&&l.threadId===r("rootId"))};case"send":{const l=this.bots.get(r("botId"));if(!l)throw Xf("That bot was deleted.");const h=r("threadId")||null,u=this.add({botId:l.id,threadId:h,kind:"user",data:{text:r("text"),status:"sent",clientNonce:r("clientNonce")}});return this.converse(l,h,r("text")),{entry:u}}case"markRead":{const l=this.bots.get(r("botId"));return l&&l.unread>0&&(l.unread=0,this.emitBot(l)),{}}case"respondPermission":return this.respond(r("entryId"),r("optionId")||null);case"react":{const l=this.entries.find(u=>u.id===r("entryId"));if(!l)throw Xf("That message is gone.");const h=new Set(l.data.reactions??[]);return h.delete(r("emoji"))||h.add(r("emoji")),l.data={...l.data,reactions:[...h]},this.emitEntry(l),{entry:l}}case"stop":{const l=r("botId");return this.turns.set(l,(this.turns.get(l)??0)+1),this.settle(l),{}}case"newSession":return this.add({botId:r("botId"),threadId:null,kind:"notice",data:{text:"New session",style:"divider"}}),{};case"createBot":case"updateBot":return{bot:this.saveBot(s)};case"reorderBots":return s.ids.forEach((l,h)=>{const u=this.bots.get(l);u&&this.emitBot(Object.assign(u,{position:h}))}),{};case"deleteBot":{const l=r("botId");return this.bots.delete(l),this.emit({type:"bot",rev:++this.rev,bot:{id:l,rev:this.rev,deleted:!0}}),{}}case"refreshBackends":return{backends:(await this.call("hello",{})).backends};case"listDirs":return{path:"/Users/demo/code",parent:"/Users/demo",isGit:!1,dirs:[{name:"pace",path:Zf,isGit:!0}]};case"memory":return{location:"",facts:[],total:0,nextOffset:null};case"routines":return{routines:[],runs:[]};case"skills":case"connectors":case"marketSkills":case"marketConnectors":case"credentialLogins":case"composioToolkits":return{items:[]};case"devices":return{devices:[]};case"voiceStatus":return{providers:[]};case"composioStatus":return{configured:!1,keyUrl:""};case"credentialStatus":return{provider:"",onePasswordConnected:!1};case"setAnalytics":return this.analytics=s.enabled===!0,{enabled:this.analytics};case"track":return{};default:throw Xf(Vh)}}async respond(t,s){const r=this.entries.find(p=>p.id===t);if(!r||r.data.status!=="pending")return{};const l=r.data.options?.find(p=>p.optionId===s),h=!!l&&l.kind.startsWith("allow");r.data={...r.data,status:s?"answered":"cancelled",selected:s??void 0},this.emitEntry(r);const u=r.data.author??r.botId;return(async()=>(this.setStatus(u,"working",h?"Editing src/pace.js":"Typing…",r.botId),await Ny(Ty),this.add({botId:r.botId,threadId:r.threadId??null,kind:"agent",data:{text:h?h6:u6,final:!0,author:u}}),this.settle(u)))(),{}}saveBot(t){const s=t.id?this.bots.get(t.id):void 0,r=r2({...s??{createdAt:Date.now(),cwd:"cwd"in t?t.cwd||Zf:""},...t,id:s?.id??crypto.randomUUID()});s&&Object.assign(s,r);const l=s??r;return this.bots.set(l.id,l),this.emitBot(l),this.botJSON(l)}}function Xf(e){return{status:400,message:e}}const Ny=e=>new Promise(t=>setTimeout(t,e)),Ex="2.15.0",Dy=new d6(Ex),Rs=()=>()=>{},Xl=()=>Promise.reject(new Error(Vh)),f6={state:{kind:"running"},local:{computerId:a2,baseURL:"http://demo.invalid",token:"demo"},dev:!1,logPath:""},p6={ready:!0,configured:!1,busy:!1,error:null,user:null,cloudURL:null},m6={supported:!1,checking:!1,availableVersion:null,staged:!1,autoCheck:!1,autoDownload:!1,lastCheck:null,error:null,waitingForApp:null},g6={platform:"darwin",appName:"Codync",appScheme:"codync",hostPort:19222,appVersion:Ex,computerName:kx,debugOpen:"Ship room",host:{snapshot:async()=>f6,onChange:Rs,install(){},restart(){},async call(e,t,s,r){await new Promise(l=>setTimeout(l,30));try{return await Dy.call(s,r??{})}catch(l){throw l.status?l:{status:500,message:String(l)}}},stream(e,t,s){const r=Number(new URL(e).searchParams.get("since")??0);return Dy.subscribe(r,s)}},account:{state:async()=>p6,onChange:Rs,signIn:Xl,signOut:async()=>{},token:Xl},speech:{available:!1,locales:()=>[],start(){},stop(){},onEvent:Rs},ssh:{state:async()=>({profiles:[],status:{},attachments:[]}),onChange:Rs,save:async()=>Vh,remove(){},connect(){},disconnect(){},trustHostKey(){},chooseKey:async()=>null},island:{supported:!1,enabled:async()=>!1,setEnabled:async()=>!1,setSummary(){},state:async()=>({screen:{notch:null},summary:{bots:[],permissions:[],usage:[]}}),onSummary:Rs,onScreen:Rs,onHover:Rs,setShape(){},setFocusable(){},setKeys(){},onKey:Rs,respond(){},send(){},openBot(){},newBot(){},openApp(){}},cloud:{request:async()=>({ok:!1,error:{status:503,code:"demo",message:Vh}})},updates:{state:async()=>m6,onChange:Rs,check(){},setAutoCheck(){},setAutoDownload(){}},files:{begin:Xl,write:async()=>{},finish:async()=>{},cancel:async()=>{}},app:{openExternal:e=>{window.open(e,"_blank","noopener")},copy:e=>{navigator.clipboard?.writeText(e).catch(()=>{})},pickFiles:async()=>[],readClipboardFiles:async()=>[],setTraySummary(){},onCommand:Rs,resetAllData:async()=>{},setLaunchAtLogin:async()=>!1,showInDock:async()=>!0,setShowInDock:async()=>!0,launchAtLogin:async()=>!1,openSettings(){},authenticate:Xl,screenAgentState:async()=>({available:!1,needsApproval:!1,registered:!1}),setScreenAgent:Xl,syncScreenAgent:async()=>({needsApproval:!1})}};try{for(const e of Object.keys(localStorage))e.startsWith("codync-")&&localStorage.removeItem(e);localStorage.setItem("macAccountOnboardingCompleted","true"),localStorage.setItem("computerAccessSetup",JSON.stringify("later")),localStorage.setItem("githubStarAsk",JSON.stringify({kind:"done"}))}catch{}const v6=window.matchMedia.bind(window);window.matchMedia=e=>v6(e.includes("prefers-color-scheme: dark")?"all":e);window.codync=g6;function y6(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qf={exports:{}},Ql={};var Ry;function _6(){if(Ry)return Ql;Ry=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,l,h){var u=null;if(h!==void 0&&(u=""+h),l.key!==void 0&&(u=""+l.key),"key"in l){h={};for(var p in l)p!=="key"&&(h[p]=l[p])}else h=l;return l=h.ref,{$$typeof:e,type:r,key:u,ref:l!==void 0?l:null,props:h}}return Ql.Fragment=t,Ql.jsx=s,Ql.jsxs=s,Ql}var Ly;function x6(){return Ly||(Ly=1,Qf.exports=_6()),Qf.exports}var o=x6(),Jf={exports:{}},Jl={},e0={exports:{}},t0={};var By;function w6(){return By||(By=1,(function(e){function t(V,ie){var ee=V.length;V.push(ie);e:for(;0<ee;){var ce=ee-1>>>1,Y=V[ce];if(0<l(Y,ie))V[ce]=ie,V[ee]=Y,ee=ce;else break e}}function s(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var ie=V[0],ee=V.pop();if(ee!==ie){V[0]=ee;e:for(var ce=0,Y=V.length,oe=Y>>>1;ce<oe;){var xe=2*(ce+1)-1,we=V[xe],D=xe+1,J=V[D];if(0>l(we,ee))D<Y&&0>l(J,we)?(V[ce]=J,V[D]=ee,ce=D):(V[ce]=we,V[xe]=ee,ce=xe);else if(D<Y&&0>l(J,ee))V[ce]=J,V[D]=ee,ce=D;else break e}}return ie}function l(V,ie){var ee=V.sortIndex-ie.sortIndex;return ee!==0?ee:V.id-ie.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var u=Date,p=u.now();e.unstable_now=function(){return u.now()-p}}var m=[],g=[],y=1,v=null,x=3,S=!1,w=!1,C=!1,j=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function L(V){for(var ie=s(g);ie!==null;){if(ie.callback===null)r(g);else if(ie.startTime<=V)r(g),ie.sortIndex=ie.expirationTime,t(m,ie);else break;ie=s(g)}}function q(V){if(C=!1,L(V),!w)if(s(m)!==null)w=!0,B||(B=!0,z());else{var ie=s(g);ie!==null&&X(q,ie.startTime-V)}}var B=!1,I=-1,U=5,P=-1;function F(){return j?!0:!(e.unstable_now()-P<U)}function $(){if(j=!1,B){var V=e.unstable_now();P=V;var ie=!0;try{e:{w=!1,C&&(C=!1,A(I),I=-1),S=!0;var ee=x;try{t:{for(L(V),v=s(m);v!==null&&!(v.expirationTime>V&&F());){var ce=v.callback;if(typeof ce=="function"){v.callback=null,x=v.priorityLevel;var Y=ce(v.expirationTime<=V);if(V=e.unstable_now(),typeof Y=="function"){v.callback=Y,L(V),ie=!0;break t}v===s(m)&&r(m),L(V)}else r(m);v=s(m)}if(v!==null)ie=!0;else{var oe=s(g);oe!==null&&X(q,oe.startTime-V),ie=!1}}break e}finally{v=null,x=ee,S=!1}ie=void 0}}finally{ie?z():B=!1}}}var z;if(typeof N=="function")z=function(){N($)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,M=O.port2;O.port1.onmessage=$,z=function(){M.postMessage(null)}}else z=function(){E($,0)};function X(V,ie){I=E(function(){V(e.unstable_now())},ie)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(V){switch(x){case 1:case 2:case 3:var ie=3;break;default:ie=x}var ee=x;x=ie;try{return V()}finally{x=ee}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(V,ie){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ee=x;x=V;try{return ie()}finally{x=ee}},e.unstable_scheduleCallback=function(V,ie,ee){var ce=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?ce+ee:ce):ee=ce,V){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=ee+Y,V={id:y++,callback:ie,priorityLevel:V,startTime:ee,expirationTime:Y,sortIndex:-1},ee>ce?(V.sortIndex=ee,t(g,V),s(m)===null&&V===s(g)&&(C?(A(I),I=-1):C=!0,X(q,ee-ce))):(V.sortIndex=Y,t(m,V),w||S||(w=!0,B||(B=!0,z()))),V},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(V){var ie=x;return function(){var ee=x;x=ie;try{return V.apply(this,arguments)}finally{x=ee}}}})(t0)),t0}var Oy;function S6(){return Oy||(Oy=1,e0.exports=w6()),e0.exports}var i0={exports:{}},De={};var zy;function b6(){if(zy)return De;zy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),u=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),S=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=S&&D[S]||D["@@iterator"],typeof D=="function"?D:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function A(D,J,le){this.props=D,this.context=J,this.refs=E,this.updater=le||C}A.prototype.isReactComponent={},A.prototype.setState=function(D,J){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,J,"setState")},A.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function N(){}N.prototype=A.prototype;function L(D,J,le){this.props=D,this.context=J,this.refs=E,this.updater=le||C}var q=L.prototype=new N;q.constructor=L,j(q,A.prototype),q.isPureReactComponent=!0;var B=Array.isArray;function I(){}var U={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function F(D,J,le){var he=le.ref;return{$$typeof:e,type:D,key:J,ref:he!==void 0?he:null,props:le}}function $(D,J){return F(D.type,J,D.props)}function z(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function O(D){var J={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(le){return J[le]})}var M=/\/+/g;function X(D,J){return typeof D=="object"&&D!==null&&D.key!=null?O(""+D.key):J.toString(36)}function V(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(I,I):(D.status="pending",D.then(function(J){D.status==="pending"&&(D.status="fulfilled",D.value=J)},function(J){D.status==="pending"&&(D.status="rejected",D.reason=J)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function ie(D,J,le,he,je){var pe=typeof D;(pe==="undefined"||pe==="boolean")&&(D=null);var Ee=!1;if(D===null)Ee=!0;else switch(pe){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(D.$$typeof){case e:case t:Ee=!0;break;case y:return Ee=D._init,ie(Ee(D._payload),J,le,he,je)}}if(Ee)return je=je(D),Ee=he===""?"."+X(D,0):he,B(je)?(le="",Ee!=null&&(le=Ee.replace(M,"$&/")+"/"),ie(je,J,le,"",function(Le){return Le})):je!=null&&(z(je)&&(je=$(je,le+(je.key==null||D&&D.key===je.key?"":(""+je.key).replace(M,"$&/")+"/")+Ee)),J.push(je)),1;Ee=0;var me=he===""?".":he+":";if(B(D))for(var _e=0;_e<D.length;_e++)he=D[_e],pe=me+X(he,_e),Ee+=ie(he,J,le,pe,je);else if(_e=w(D),typeof _e=="function")for(D=_e.call(D),_e=0;!(he=D.next()).done;)he=he.value,pe=me+X(he,_e++),Ee+=ie(he,J,le,pe,je);else if(pe==="object"){if(typeof D.then=="function")return ie(V(D),J,le,he,je);throw J=String(D),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return Ee}function ee(D,J,le){if(D==null)return D;var he=[],je=0;return ie(D,he,"","",function(pe){return J.call(le,pe,je++)}),he}function ce(D){if(D._status===-1){var J=D._result,le=J();le.then(function(he){(D._status===0||D._status===-1)&&(D._status=1,D._result=he,le.status===void 0&&(le.status="fulfilled",le.value=he))},function(he){(D._status===0||D._status===-1)&&(D._status=2,D._result=he,le.status===void 0&&(le.status="rejected",le.reason=he))}),D._status===-1&&(D._status=0,D._result=le)}if(D._status===1)return D._result.default;throw D._result}var Y=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function oe(D){var J=U.T,le={};le.types=J!==null?J.types:null,U.T=le;try{var he=D(),je=U.S;je!==null&&je(le,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(I,Y)}catch(pe){Y(pe)}finally{J!==null&&le.types!==null&&(J.types=le.types),U.T=J}}function xe(D){var J=U.T;if(J!==null){var le=J.types;le===null?J.types=[D]:le.indexOf(D)===-1&&le.push(D)}else oe(xe.bind(null,D))}var we={map:ee,forEach:function(D,J,le){ee(D,function(){J.apply(this,arguments)},le)},count:function(D){var J=0;return ee(D,function(){J++}),J},toArray:function(D){return ee(D,function(J){return J})||[]},only:function(D){if(!z(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return De.Activity=v,De.Children=we,De.Component=A,De.Fragment=s,De.Profiler=l,De.PureComponent=L,De.StrictMode=r,De.Suspense=m,De.ViewTransition=x,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,De.__COMPILER_RUNTIME={__proto__:null,c:function(D){return U.H.useMemoCache(D)}},De.addTransitionType=xe,De.cache=function(D){return function(){return D.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(D,J,le){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var he=j({},D.props),je=D.key;if(J!=null)for(pe in J.key!==void 0&&(je=""+J.key),J)!P.call(J,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&J.ref===void 0||(he[pe]=J[pe]);var pe=arguments.length-2;if(pe===1)he.children=le;else if(1<pe){for(var Ee=Array(pe),me=0;me<pe;me++)Ee[me]=arguments[me+2];he.children=Ee}return F(D.type,je,he)},De.createContext=function(D){return D={$$typeof:u,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:h,_context:D},D},De.createElement=function(D,J,le){var he,je={},pe=null;if(J!=null)for(he in J.key!==void 0&&(pe=""+J.key),J)P.call(J,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(je[he]=J[he]);var Ee=arguments.length-2;if(Ee===1)je.children=le;else if(1<Ee){for(var me=Array(Ee),_e=0;_e<Ee;_e++)me[_e]=arguments[_e+2];je.children=me}if(D&&D.defaultProps)for(he in Ee=D.defaultProps,Ee)je[he]===void 0&&(je[he]=Ee[he]);return F(D,pe,je)},De.createRef=function(){return{current:null}},De.forwardRef=function(D){return{$$typeof:p,render:D}},De.isValidElement=z,De.lazy=function(D){return{$$typeof:y,_payload:{_status:-1,_result:D},_init:ce}},De.memo=function(D,J){return{$$typeof:g,type:D,compare:J===void 0?null:J}},De.startTransition=oe,De.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},De.use=function(D){return U.H.use(D)},De.useActionState=function(D,J,le){return U.H.useActionState(D,J,le)},De.useCallback=function(D,J){return U.H.useCallback(D,J)},De.useContext=function(D){return U.H.useContext(D)},De.useDebugValue=function(){},De.useDeferredValue=function(D,J){return U.H.useDeferredValue(D,J)},De.useEffect=function(D,J){return U.H.useEffect(D,J)},De.useEffectEvent=function(D){return U.H.useEffectEvent(D)},De.useId=function(){return U.H.useId()},De.useImperativeHandle=function(D,J,le){return U.H.useImperativeHandle(D,J,le)},De.useInsertionEffect=function(D,J){return U.H.useInsertionEffect(D,J)},De.useLayoutEffect=function(D,J){return U.H.useLayoutEffect(D,J)},De.useMemo=function(D,J){return U.H.useMemo(D,J)},De.useOptimistic=function(D,J){return U.H.useOptimistic(D,J)},De.useReducer=function(D,J,le){return U.H.useReducer(D,J,le)},De.useRef=function(D){return U.H.useRef(D)},De.useState=function(D){return U.H.useState(D)},De.useSyncExternalStore=function(D,J,le){return U.H.useSyncExternalStore(D,J,le)},De.useTransition=function(){return U.H.useTransition()},De.version="19.3.0",De}var Hy;function mp(){return Hy||(Hy=1,i0.exports=b6()),i0.exports}var s0={exports:{}},Jt={};var Iy;function C6(){if(Iy)return Jt;Iy=1;var e=mp();function t(y){var v="https://react.dev/errors/"+y;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)v+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+y+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function p(y,v,x){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:S==null?null:S===u?u:""+S,children:y,containerInfo:v,implementation:x}}var m=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(y,v){if(y==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Jt.browser=function(y){return{$$typeof:h,_reason:y}},Jt.createPortal=function(y,v){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(t(299));return p(y,v,null,x)},Jt.flushSync=function(y){var v=m.T,x=r.p;try{if(m.T=null,r.p=2,y)return y()}finally{m.T=v,r.p=x,r.d.f()}},Jt.preconnect=function(y,v){typeof y=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,r.d.C(y,v))},Jt.prefetchDNS=function(y){typeof y=="string"&&r.d.D(y)},Jt.preinit=function(y,v){if(typeof y=="string"&&v&&typeof v.as=="string"){var x=v.as,S=g(x,v.crossOrigin),w=typeof v.integrity=="string"?v.integrity:void 0,C=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;x==="style"?r.d.S(y,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:S,integrity:w,fetchPriority:C}):x==="script"&&r.d.X(y,{crossOrigin:S,integrity:w,fetchPriority:C,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Jt.preinitModule=function(y,v){if(typeof y=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var x=g(v.as,v.crossOrigin);r.d.M(y,{crossOrigin:x,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}}else v==null&&r.d.M(y)},Jt.preload=function(y,v){if(typeof y=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var x=v.as,S=g(x,v.crossOrigin);r.d.L(y,x,{crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Jt.preloadModule=function(y,v){if(typeof y=="string")if(v){var x=g(v.as,v.crossOrigin);r.d.m(y,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:x,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}else r.d.m(y)},Jt.requestFormReset=function(y){r.d.r(y)},Jt.unstable_batchedUpdates=function(y,v){return y(v)},Jt.useFormState=function(y,v,x){return m.H.useFormState(y,v,x)},Jt.useFormStatus=function(){return m.H.useHostTransitionStatus()},Jt.version="19.3.0",Jt}var Uy;function Mx(){if(Uy)return s0.exports;Uy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),s0.exports=C6(),s0.exports}var Py;function k6(){if(Py)return Jl;Py=1;var e=S6(),t=mp(),s=Mx();function r(i){var n="https://react.dev/errors/"+i;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function h(i){for(var n=i,a=n;a&&!a.alternate;)n=a,(n.flags&4098)!==0&&(i=n.return),a=n.return;for(;n.return;)n=n.return;return n.tag===3?i:null}function u(i){if(i.tag===13){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function p(i){if(i.tag===31){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function m(i){if(h(i)!==i)throw Error(r(188))}function g(i){var n=i.alternate;if(!n){if(n=h(i),n===null)throw Error(r(188));return n!==i?null:i}for(var a=i,c=n;;){var d=a.return;if(d===null)break;var f=d.alternate;if(f===null){if(c=d.return,c!==null){a=c;continue}break}if(d.child===f.child){for(f=d.child;f;){if(f===a)return m(d),i;if(f===c)return m(d),n;f=f.sibling}throw Error(r(188))}if(a.return!==c.return)a=d,c=f;else{for(var _=!1,k=d.child;k;){if(k===a){_=!0,a=d,c=f;break}if(k===c){_=!0,c=d,a=f;break}k=k.sibling}if(!_){for(k=f.child;k;){if(k===a){_=!0,a=f,c=d;break}if(k===c){_=!0,c=f,a=d;break}k=k.sibling}if(!_)throw Error(r(189))}}if(a.alternate!==c)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:n}function y(i){var n=i.tag;if(n===5||n===26||n===27||n===6)return i;for(i=i.child;i!==null;){if(n=y(i),n!==null)return n;i=i.sibling}return null}function v(i,n,a,c,d,f){for(;i!==null;){if((i.tag===5||i.tag===27||i.tag===6)&&a(i,c,d,f)||(i.tag!==22||i.memoizedState===null)&&(n||i.tag!==5&&i.tag!==27)&&v(i.child,n,a,c,d,f))return!0;i=i.sibling}return!1}function x(i){for(i=i.return;i!==null;){if(i.tag===3||i.tag===5||i.tag===27)return i;i=i.return}return null}function S(i){var n=!1;for(i=i.return;i!==null&&(i.tag===4&&(n=!0),!(i.tag===3||i.tag===5||i.tag===27));)i=i.return;return n}function w(i){var n=[null,null],a=x(i);return a===null||C(n,i,a.child,{foundSelf:!1}),n}function C(i,n,a,c){for(;a!==null;){if(a===n)c.foundSelf=!0;else if(a.tag===5||a.tag===27||a.tag===6){if(c.foundSelf)return i[1]=a,!0;i[0]=a}else if((a.tag!==22||a.memoizedState===null)&&C(i,n,a.child,c))return!0;a=a.sibling}return!1}function j(i){switch(i.tag){case 5:case 27:case 6:return i.stateNode;case 3:return i.stateNode.containerInfo;default:throw Error(r(559))}}var E=null,A=null;function N(i,n,a){return i===a?!0:i===n?(E=i,!0):!1}function L(i,n,a){return i===a?(A=i,!1):i===n?(A!==null&&(E=i),!0):!1}function q(i){if(i===null)return null;do i=i===null?null:i.return;while(i&&i.tag!==5&&i.tag!==27&&i.tag!==3);return i||null}function B(i,n,a){for(var c=0,d=i;d;d=a(d))c++;d=0;for(var f=n;f;f=a(f))d++;for(;0<c-d;)i=a(i),c--;for(;0<d-c;)n=a(n),d--;for(;c--;){if(i===n||n!==null&&i===n.alternate)return i;i=a(i),n=a(n)}return null}var I=Object.assign,U=Symbol.for("react.element"),P=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),X=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),ie=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),xe=Symbol.for("react.legacy_hidden"),we=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),J=Symbol.for("react.recoverable"),le=Symbol.iterator;function he(i){return i===null||typeof i!="object"?null:(i=le&&i[le]||i["@@iterator"],typeof i=="function"?i:null)}var je=Symbol.for("react.client.reference");function pe(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===je?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case $:return"Fragment";case O:return"Profiler";case z:return"StrictMode";case ie:return"Suspense";case ee:return"SuspenseList";case oe:return"Activity";case D:return"ViewTransition"}if(typeof i=="object")switch(i.$$typeof){case F:return"Portal";case X:return i.displayName||"Context";case M:return(i._context.displayName||"Context")+".Consumer";case V:var n=i.render;return i=i.displayName,i||(i=n.displayName||n.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ce:return n=i.displayName||null,n!==null?n:pe(i.type)||"Memo";case Y:n=i._payload,i=i._init;try{return pe(i(n))}catch{}}return null}var Ee=Array.isArray,me=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Le={pending:!1,data:null,method:null,action:null},ni=[],ri=-1;function fi(i){return{current:i}}function mt(i){0>ri||(i.current=ni[ri],ni[ri]=null,ri--)}function Ye(i,n){ri++,ni[ri]=i.current,i.current=n}var Si=fi(null),Ni=fi(null),Di=fi(null),yn=fi(null);function ge(i,n){switch(Ye(Di,n),Ye(Ni,i),Ye(Si,null),n.nodeType){case 9:case 11:i=(i=n.documentElement)&&(i=i.namespaceURI)?zv(i):0;break;default:if(i=n.tagName,n=n.namespaceURI)n=zv(n),i=Hv(n,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}mt(Si),Ye(Si,i)}function ot(){mt(Si),mt(Ni),mt(Di)}function ai(i){var n=i.memoizedState;n!==null&&(La._currentValue=n.memoizedState,Ye(yn,i)),n=Si.current;var a=Hv(n,i.type);n!==a&&(Ye(Ni,i),Ye(Si,a))}function Fr(i){Ni.current===i&&(mt(Si),mt(Ni)),yn.current===i&&(mt(yn),La._currentValue=Le)}var $s,il;function ue(i){if($s===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);$s=n&&n[1]||"",il=-1<a.stack.indexOf(`
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
+`+$s+i+il}var rt=!1;function Ft(i,n){if(!i||rt)return"";rt=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(n){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(fe){var W=fe}Reflect.construct(i,[],re)}else{try{re.call()}catch(fe){W=fe}re=!1;try{var Q=Object.getOwnPropertyDescriptor(i.prototype,"props");Object.defineProperty(i.prototype,"props",{configurable:!0,set:function(){throw Error()}}),re=!0,new i}finally{re&&(Q!==void 0?Object.defineProperty(i.prototype,"props",Q):delete i.prototype.props)}}}else{try{throw Error()}catch(fe){W=fe}(re=i())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(fe){if(fe&&W&&typeof fe.stack=="string")return[fe.stack,W.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=c.DetermineComponentFrameRoot(),_=f[0],k=f[1];if(_&&k){var T=_.split(`
+`),G=k.split(`
+`);for(d=c=0;c<T.length&&!T[c].includes("DetermineComponentFrameRoot");)c++;for(;d<G.length&&!G[d].includes("DetermineComponentFrameRoot");)d++;if(c===T.length||d===G.length)for(c=T.length-1,d=G.length-1;1<=c&&0<=d&&T[c]!==G[d];)d--;for(;1<=c&&0<=d;c--,d--)if(T[c]!==G[d]){if(c!==1||d!==1)do if(c--,d--,0>d||T[c]!==G[d]){var te=`
+`+T[c].replace(" at new "," at ");return i.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",i.displayName)),te}while(1<=c&&0<=d);break}}}finally{rt=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?ue(a):""}function sl(i,n){switch(i.tag){case 26:case 27:case 5:return ue(i.type);case 16:return ue("Lazy");case 13:return i.child!==n&&n!==null?ue("Suspense Fallback"):ue("Suspense");case 19:return ue("SuspenseList");case 0:case 15:return Ft(i.type,!1);case 11:return Ft(i.type.render,!1);case 1:return Ft(i.type,!0);case 31:return ue("Activity");case 30:return ue("ViewTransition");default:return""}}function Kr(i){try{var n="",a=null;do n+=sl(i,a),a=i,i=i.return;while(i);return n}catch(c){return`
+Error generating stack: `+c.message+`
+`+c.stack}}var _u=Object.prototype.hasOwnProperty,xu=e.unstable_scheduleCallback,wu=e.unstable_cancelCallback,cb=e.unstable_shouldYield,hb=e.unstable_requestPaint,Ri=e.unstable_now,ub=e.unstable_getCurrentPriorityLevel,a1=e.unstable_ImmediatePriority,l1=e.unstable_UserBlockingPriority,Io=e.unstable_NormalPriority,db=e.unstable_LowPriority,o1=e.unstable_IdlePriority,fb=e.log,pb=e.unstable_setDisableYieldValue,nl=null,Li=null;function _n(i){if(typeof fb=="function"&&pb(i),Li&&typeof Li.setStrictMode=="function")try{Li.setStrictMode(nl,i)}catch{}}var Bi=Math.clz32?Math.clz32:vb,mb=Math.log,gb=Math.LN2;function vb(i){return i>>>=0,i===0?32:31-(mb(i)/gb|0)|0}var Uo=256,Po=262144,qo=4194304;function nr(i){var n=i&42;if(n!==0)return n;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&-i;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Vo(i,n,a){var c=i.pendingLanes;if(c===0)return 0;var d=0,f=i.suspendedLanes,_=i.pingedLanes;i=i.warmLanes;var k=c&134217727;return k!==0?(c=k&~f,c!==0?d=nr(c):(_&=k,_!==0?d=nr(_):a||(a=k&~i,a!==0&&(d=nr(a))))):(k=c&~f,k!==0?d=nr(k):_!==0?d=nr(_):a||(a=c&~i,a!==0&&(d=nr(a)))),d===0?0:n!==0&&n!==d&&(n&f)===0&&(f=d&-d,a=n&-n,f>=a||f===32&&(a&4194048)!==0)?n:d}function rl(i,n){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&n)===0}function c1(i,n){(n&8)!==0&&(n|=n&32);var a=i.entangledLanes;if(a!==0)for(i=i.entanglements,a&=n;0<a;){var c=31-Bi(a),d=1<<c;n|=i[c],a&=~d}return n}function yb(i,n){switch(i){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function h1(){var i=qo;return qo<<=1,(qo&62914560)===0&&(qo=4194304),i}function Su(i){for(var n=[],a=0;31>a;a++)n.push(i);return n}function al(i,n){i.pendingLanes|=n,n!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function _b(i,n,a,c,d,f){var _=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var k=i.entanglements,T=i.expirationTimes,G=i.hiddenUpdates;for(a=_&~a;0<a;){var te=31-Bi(a),re=1<<te;k[te]=0,T[te]=-1;var W=G[te];if(W!==null)for(G[te]=null,te=0;te<W.length;te++){var Q=W[te];Q!==null&&(Q.lane&=-536870913)}a&=~re}c!==0&&u1(i,c,0),f!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=f&~(_&~n))}function u1(i,n,a){i.pendingLanes|=n,i.suspendedLanes&=~n;var c=31-Bi(n);i.entangledLanes|=n,i.entanglements[c]=i.entanglements[c]|1073741824|a&261930}function d1(i,n){var a=i.entangledLanes|=n;for(i=i.entanglements;a;){var c=31-Bi(a),d=1<<c;d&n|i[c]&n&&(i[c]|=n),a&=~d}}function f1(i,n){var a=n&-n;return a=(a&42)!==0?1:bu(a),(a&(i.suspendedLanes|n))!==0?0:a}function bu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Cu(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function p1(){var i=_e.p;return i!==0?i:(i=window.event,i===void 0?32:wy(i.type))}function m1(i,n){var a=_e.p;try{return _e.p=i,n()}finally{_e.p=a}}var Ws=Math.random().toString(36).slice(2),Kt="__reactFiber$"+Ws,bi="__reactProps$"+Ws,Yr="__reactContainer$"+Ws,g1="__reactEvents$"+Ws,xb="__reactListeners$"+Ws,wb="__reactHandles$"+Ws,v1="__reactResources$"+Ws,ll="__reactMarker$"+Ws,$o="__reactLoad$"+Ws;function Wo(i){delete i[Kt],delete i[bi],delete i[xb],delete i[wb]}function rr(i){var n;if(n=i[Kt])return n;for(var a=i.parentNode;a;){if(n=a[Yr]||a[Kt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(i=ty(i);i!==null;){if(a=i[Kt])return a;i=ty(i)}return n}i=a,a=i.parentNode}return null}function Gr(i){if(i=i[Kt]||i[Yr]){var n=i.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return i}return null}function ol(i){var n=i.tag;if(n===5||n===26||n===27||n===6)return i.stateNode;throw Error(r(33))}function Zr(i){var n=i[v1];return n||(n=i[v1]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function zt(i){i[ll]=!0}function y1(i){i[$o]=void 0}var _1=new Set,x1={};function ar(i,n){Xr(i,n),Xr(i+"Capture",n)}function Xr(i,n){for(x1[i]=n,i=0;i<n.length;i++)_1.add(n[i])}var Sb=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),w1={},S1={};function bb(i){return _u.call(S1,i)?!0:_u.call(w1,i)?!1:Sb.test(i)?S1[i]=!0:(w1[i]=!0,!1)}var Fe=!1;function b1(){var i=Fe;return Fe=!1,i}function Fo(i,n,a){if(bb(n))if(a===null)i.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(n);return;case"boolean":var c=n.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){i.removeAttribute(n);return}}i.setAttribute(n,a)}}function Ko(i,n,a){if(a===null)i.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(n);return}i.setAttribute(n,a)}}function Fs(i,n,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(n,a,c)}}function Oi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function C1(i){var n=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Cb(i,n,a){var c=Object.getOwnPropertyDescriptor(i.constructor.prototype,n);if(!i.hasOwnProperty(n)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var d=c.get,f=c.set;return Object.defineProperty(i,n,{configurable:!0,get:function(){return d.call(this)},set:function(_){a=""+_,f.call(this,_)}}),Object.defineProperty(i,n,{enumerable:c.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){i._valueTracker=null,delete i[n]}}}}function ku(i){if(!i._valueTracker){var n=C1(i)?"checked":"value";i._valueTracker=Cb(i,n,""+i[n])}}function k1(i){if(!i)return!1;var n=i._valueTracker;if(!n)return!0;var a=n.getValue(),c="";return i&&(c=C1(i)?i.checked?"true":"false":i.value),i=c,i!==a?(n.setValue(i),!0):!1}var kb=/[\n"\\]/g;function Yi(i){return i.replace(kb,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ju(i,n,a,c,d,f,_,k){i.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?i.type=_:i.removeAttribute("type"),n!=null?_==="number"?(n===0&&i.value===""||i.value!=n)&&(i.value=""+Oi(n)):i.value!==""+Oi(n)&&(i.value=""+Oi(n)):_!=="submit"&&_!=="reset"||i.removeAttribute("value"),n!=null?_==="number"&&i.value==n?Eu(i,Oi(i.value)):Eu(i,Oi(n)):a!=null?Eu(i,Oi(a)):c!=null&&i.removeAttribute("value"),d==null&&f!=null&&(i.defaultChecked=!!f),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?i.name=""+Oi(k):i.removeAttribute("name")}function j1(i,n,a,c,d,f,_,k){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(i.type=f),n!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||n!=null)){ku(i);return}a=a!=null?""+Oi(a):"",n=n!=null?""+Oi(n):a,k||n===i.value||(i.value=n),i.defaultValue=n}c=c??d,c=typeof c!="function"&&typeof c!="symbol"&&!!c,i.checked=k?i.checked:!!c,i.defaultChecked=!!c,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(i.name=_),ku(i)}function Eu(i,n){i.defaultValue!==""+n&&(i.defaultValue=""+n)}function Qr(i,n,a,c){if(i=i.options,n){n={};for(var d=0;d<a.length;d++)n["$"+a[d]]=!0;for(a=0;a<i.length;a++)d=n.hasOwnProperty("$"+i[a].value),i[a].selected!==d&&(i[a].selected=d),d&&c&&(i[a].defaultSelected=!0)}else{for(a=""+Oi(a),n=null,d=0;d<i.length;d++){if(i[d].value===a){i[d].selected=!0,c&&(i[d].defaultSelected=!0);return}n!==null||i[d].disabled||(n=i[d])}n!==null&&(n.selected=!0)}}function E1(i,n,a){if(n!=null&&(n=""+Oi(n),n!==i.value&&(i.value=n),a==null)){i.defaultValue!==n&&(i.defaultValue=n);return}i.defaultValue=a!=null?""+Oi(a):""}function M1(i,n,a,c){if(n==null){if(c!=null){if(a!=null)throw Error(r(92));if(Ee(c)){if(1<c.length)throw Error(r(93));c=c[0]}a=c}a==null&&(a=""),n=a}a=Oi(n),i.defaultValue=a,c=i.textContent,c===a&&c!==""&&c!==null&&(i.value=c),ku(i)}function Jr(i,n){if(n){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=n;return}}i.textContent=n}var jb=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function A1(i,n,a){var c=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?c?i.setProperty(n,""):n==="float"?i.cssFloat="":i[n]="":c?i.setProperty(n,a):typeof a!="number"||a===0||jb.has(n)?n==="float"?i.cssFloat=a:i[n]=(""+a).trim():i[n]=a+"px"}function T1(i,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(i=i.style,a!=null){for(var c in a)!a.hasOwnProperty(c)||n!=null&&n.hasOwnProperty(c)||(c.indexOf("--")===0?i.setProperty(c,""):c==="float"?i.cssFloat="":i[c]="",Fe=!0);for(var d in n)c=n[d],n.hasOwnProperty(d)&&a[d]!==c&&(A1(i,d,c),Fe=!0)}else for(var f in n)n.hasOwnProperty(f)&&A1(i,f,n[f])}function Mu(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Eb=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Mb=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Yo(i){return Mb.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ss(){}var Au=null;function Tu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ea=null,ta=null;function N1(i){var n=Gr(i);if(n&&(i=n.stateNode)){var a=i[bi]||null;e:switch(i=n.stateNode,n.type){case"input":if(ju(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Yi(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var c=a[n];if(c!==i&&c.form===i.form){var d=c[bi]||null;if(!d)throw Error(r(90));ju(c,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<a.length;n++)c=a[n],c.form===i.form&&k1(c)}break e;case"textarea":E1(i,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Qr(i,!!a.multiple,n,!1)}}}var Nu=!1;function D1(i,n,a){if(Nu)return i(n,a);Nu=!0;try{var c=i(n);return c}finally{if(Nu=!1,(ea!==null||ta!==null)&&(Yc(),ea&&(n=ea,i=ta,ta=ea=null,N1(n),i)))for(n=0;n<i.length;n++)N1(i[n])}}function cl(i,n){var a=i.stateNode;if(a===null)return null;var c=a[bi]||null;if(c===null)return null;a=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Ks=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Du=!1;if(Ks)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){Du=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{Du=!1}var xn=null,Ru=null,Go=null;function R1(){if(Go)return Go;var i,n=Ru,a=n.length,c,d="value"in xn?xn.value:xn.textContent,f=d.length;for(i=0;i<a&&n[i]===d[i];i++);var _=a-i;for(c=1;c<=_&&n[a-c]===d[f-c];c++);return Go=d.slice(i,1<c?1-c:void 0)}function Zo(i){var n=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&n===13&&(i=13)):i=n,i===10&&(i=13),32<=i||i===13?i:0}function Xo(){return!0}function L1(){return!1}function pi(i){function n(a,c,d,f,_){this._reactName=a,this._targetInst=d,this.type=c,this.nativeEvent=f,this.target=_,this.currentTarget=null;for(var k in i)i.hasOwnProperty(k)&&(a=i[k],this[k]=a?a(f):f[k]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Xo:L1,this.isPropagationStopped=L1,this}return I(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Xo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Xo)},persist:function(){},isPersistent:Xo}),n}var wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qo=pi(wn),ul=I({},wn,{view:0,detail:0}),Ab=pi(ul),Lu,Bu,dl,Jo=I({},ul,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zu,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==dl&&(dl&&i.type==="mousemove"?(Lu=i.screenX-dl.screenX,Bu=i.screenY-dl.screenY):Bu=Lu=0,dl=i),Lu)},movementY:function(i){return"movementY"in i?i.movementY:Bu}}),B1=pi(Jo),Tb=I({},Jo,{dataTransfer:0}),Nb=pi(Tb),Db=I({},ul,{relatedTarget:0}),Ou=pi(Db),Rb=I({},wn,{animationName:0,elapsedTime:0,pseudoElement:0}),Lb=pi(Rb),Bb=I({},wn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Ob=pi(Bb),zb=I({},wn,{data:0}),O1=pi(zb),Hb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ib={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ub={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pb(i){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(i):(i=Ub[i])?!!n[i]:!1}function zu(){return Pb}var qb=I({},ul,{key:function(i){if(i.key){var n=Hb[i.key]||i.key;if(n!=="Unidentified")return n}return i.type==="keypress"?(i=Zo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Ib[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zu,charCode:function(i){return i.type==="keypress"?Zo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Zo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Vb=pi(qb),$b=I({},Jo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),z1=pi($b),Wb=I({},wn,{submitter:0}),Fb=pi(Wb),Kb=I({},ul,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zu}),Yb=pi(Kb),Gb=I({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zb=pi(Gb),Xb=I({},Jo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Qb=pi(Xb),Jb=I({},wn,{newState:0,oldState:0,source:0}),e4=pi(Jb),t4=[9,13,27,32],Hu=Ks&&"CompositionEvent"in window,fl=null;Ks&&"documentMode"in document&&(fl=document.documentMode);var i4=Ks&&"TextEvent"in window&&!fl,H1=Ks&&(!Hu||fl&&8<fl&&11>=fl),I1=" ",U1=!1;function P1(i,n){switch(i){case"keyup":return t4.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q1(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ia=!1;function s4(i,n){switch(i){case"compositionend":return q1(n);case"keypress":return n.which!==32?null:(U1=!0,I1);case"textInput":return i=n.data,i===I1&&U1?null:i;default:return null}}function n4(i,n){if(ia)return i==="compositionend"||!Hu&&P1(i,n)?(i=R1(),Go=Ru=xn=null,ia=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return H1&&n.locale!=="ko"?null:n.data;default:return null}}var r4={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function V1(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n==="input"?!!r4[i.type]:n==="textarea"}function $1(i,n,a,c){ea?ta?ta.push(c):ta=[c]:ea=c,n=eh(n,"onChange"),0<n.length&&(a=new Qo("onChange","change",null,a,c),i.push({event:a,listeners:n}))}var pl=null,ml=null;function a4(i){Nv(i,0)}function ec(i){var n=ol(i);if(k1(n))return i}function W1(i,n){if(i==="change")return n}var F1=!1;if(Ks){var Iu;if(Ks){var Uu="oninput"in document;if(!Uu){var K1=document.createElement("div");K1.setAttribute("oninput","return;"),Uu=typeof K1.oninput=="function"}Iu=Uu}else Iu=!1;F1=Iu&&(!document.documentMode||9<document.documentMode)}function Y1(){pl&&(pl.detachEvent("onpropertychange",G1),ml=pl=null)}function G1(i){if(i.propertyName==="value"&&ec(ml)){var n=[];$1(n,ml,i,Tu(i)),D1(a4,n)}}function l4(i,n,a){i==="focusin"?(Y1(),pl=n,ml=a,pl.attachEvent("onpropertychange",G1)):i==="focusout"&&Y1()}function o4(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return ec(ml)}function c4(i,n){if(i==="click")return ec(n)}function h4(i,n){if(i==="input"||i==="change")return ec(n)}function u4(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var zi=typeof Object.is=="function"?Object.is:u4;function gl(i,n){if(zi(i,n))return!0;if(typeof i!="object"||i===null||typeof n!="object"||n===null)return!1;var a=Object.keys(i),c=Object.keys(n);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var d=a[c];if(!_u.call(n,d)||!zi(i[d],n[d]))return!1}return!0}function Pu(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Z1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function X1(i,n){var a=Z1(i);i=0;for(var c;a;){if(a.nodeType===3){if(c=i+a.textContent.length,i<=n&&c>=n)return{node:a,offset:n-i};i=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Z1(a)}}function Q1(i,n){return i&&n?i===n?!0:i&&i.nodeType===3?!1:n&&n.nodeType===3?Q1(i,n.parentNode):"contains"in i?i.contains(n):i.compareDocumentPosition?!!(i.compareDocumentPosition(n)&16):!1:!1}function J1(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var n=Pu(i.document);n instanceof i.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)i=n.contentWindow;else break;n=Pu(i.document)}return n}function qu(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n&&(n==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||n==="textarea"||i.contentEditable==="true")}var d4=Ks&&"documentMode"in document&&11>=document.documentMode,sa=null,Vu=null,vl=null,$u=!1;function em(i,n,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;$u||sa==null||sa!==Pu(c)||(c=sa,"selectionStart"in c&&qu(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),vl&&gl(vl,c)||(vl=c,c=eh(Vu,"onSelect"),0<c.length&&(n=new Qo("onSelect","select",null,n,a),i.push({event:n,listeners:c}),n.target=sa)))}function lr(i,n){var a={};return a[i.toLowerCase()]=n.toLowerCase(),a["Webkit"+i]="webkit"+n,a["Moz"+i]="moz"+n,a}var na={animationend:lr("Animation","AnimationEnd"),animationiteration:lr("Animation","AnimationIteration"),animationstart:lr("Animation","AnimationStart"),transitionrun:lr("Transition","TransitionRun"),transitionstart:lr("Transition","TransitionStart"),transitioncancel:lr("Transition","TransitionCancel"),transitionend:lr("Transition","TransitionEnd")},Wu={},tm={};Ks&&(tm=document.createElement("div").style,"AnimationEvent"in window||(delete na.animationend.animation,delete na.animationiteration.animation,delete na.animationstart.animation),"TransitionEvent"in window||delete na.transitionend.transition);function or(i){if(Wu[i])return Wu[i];if(!na[i])return i;var n=na[i],a;for(a in n)if(n.hasOwnProperty(a)&&a in tm)return Wu[i]=n[a];return i}var im=or("animationend"),sm=or("animationiteration"),nm=or("animationstart"),f4=or("transitionrun"),p4=or("transitionstart"),m4=or("transitioncancel"),rm=or("transitionend"),am=new Map,Fu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Fu.push("scrollEnd");function us(i,n){am.set(i,n),ar(n,[i])}var g4=0;function Ys(i,n){if(i.name!=null&&i.name!=="auto")return i.name;if(n.autoName!==null)return n.autoName;i=ms.identifierPrefix;var a=g4++;return i="_"+i+"t_"+a.toString(32)+"_",n.autoName=i}function lm(i){if(i==null||typeof i=="string")return i;var n=null,a=Ca;if(a!==null)for(var c=0;c<a.length;c++){var d=i[a[c]];if(d!=null){if(d==="none")return"none";n=n==null?d:n+(" "+d)}}return n??i.default}function Gs(i,n){return i=lm(i),n=lm(n),n==null?i==="auto"?null:i:n==="auto"?null:n}var tc=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Gi=[],ra=0,Ku=0;function ic(){for(var i=ra,n=Ku=ra=0;n<i;){var a=Gi[n];Gi[n++]=null;var c=Gi[n];Gi[n++]=null;var d=Gi[n];Gi[n++]=null;var f=Gi[n];if(Gi[n++]=null,c!==null&&d!==null){var _=c.pending;_===null?d.next=d:(d.next=_.next,_.next=d),c.pending=d}f!==0&&om(a,d,f)}}function sc(i,n,a,c){Gi[ra++]=i,Gi[ra++]=n,Gi[ra++]=a,Gi[ra++]=c,Ku|=c,i.lanes|=c,i=i.alternate,i!==null&&(i.lanes|=c)}function Yu(i,n,a,c){return sc(i,n,a,c),nc(i)}function cr(i,n){return sc(i,null,null,n),nc(i)}function om(i,n,a){i.lanes|=a;var c=i.alternate;c!==null&&(c.lanes|=a);for(var d=!1,f=i.return;f!==null;)f.childLanes|=a,c=f.alternate,c!==null&&(c.childLanes|=a),f.tag===22&&(i=f.stateNode,i===null||i._visibility&1||(d=!0)),i=f,f=f.return;return i.tag===3?(f=i.stateNode,d&&n!==null&&(d=31-Bi(a),i=f.hiddenUpdates,c=i[d],c===null?i[d]=[n]:c.push(n),n.lane=a|536870912),f):null}function nc(i){if(50<Il)throw Il=0,Kc=null,Error(r(185));for(var n=i.return;n!==null;)i=n,n=i.return;return i.tag===3?i.stateNode:null}var aa={};function v4(i,n,a,c){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ci(i,n,a,c){return new v4(i,n,a,c)}function Gu(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Zs(i,n){var a=i.alternate;return a===null?(a=Ci(i.tag,n,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=n,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&1206910976,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,n=i.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function cm(i,n){i.flags&=1206910978;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=n,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,n=a.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),i}function rc(i,n,a,c,d,f){var _=0;if(c=i,typeof c=="function")Gu(c)&&(_=1);else if(typeof c=="string")_=W5(i,a,Si.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(c){case oe:return i=Ci(31,a,n,d),i.elementType=oe,i.lanes=f,i;case $:return hr(a.children,d,f,n);case z:_=8,d|=24;break;case O:return i=Ci(12,a,n,d|2),i.elementType=O,i.lanes=f,i;case ie:return i=Ci(13,a,n,d),i.elementType=ie,i.lanes=f,i;case ee:return i=Ci(19,a,n,d),i.elementType=ee,i.lanes=f,i;case xe:case D:return i=d|32,i=Ci(30,a,n,i),i.elementType=D,i.lanes=f,i.stateNode={autoName:null,paired:null,clones:null,ref:null},i;default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case X:_=10;break e;case M:_=9;break e;case V:_=11;break e;case ce:_=14;break e;case Y:_=16,c=null;break e}_=29,a=Error(r(130,i===null?"null":typeof i,"")),c=null}return n=Ci(_,a,n,d),n.elementType=i,n.type=c,n.lanes=f,n}function hr(i,n,a,c){return i=Ci(7,i,c,n),i.lanes=a,i}function Zu(i,n,a){return i=Ci(6,i,null,n),i.lanes=a,i}function hm(i){var n=Ci(18,null,null,0);return n.stateNode=i,n}function Xu(i,n,a){return n=Ci(4,i.children!==null?i.children:[],i.key,n),n.lanes=a,n.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},n}var um=new WeakMap;function Zi(i,n){if(typeof i=="object"&&i!==null){var a=um.get(i);return a!==void 0?a:(n={value:i,source:n,stack:Kr(n)},um.set(i,n),n)}return{value:i,source:n,stack:Kr(n)}}var la=[],oa=0,ac=null,yl=0,Xi=[],Qi=0,Sn=null,bs=1,Cs="";function Xs(i,n){la[oa++]=yl,la[oa++]=ac,ac=i,yl=n}function dm(i,n,a){Xi[Qi++]=bs,Xi[Qi++]=Cs,Xi[Qi++]=Sn,Sn=i;var c=bs;i=Cs;var d=32-Bi(c)-1;c&=~(1<<d),a+=1;var f=32-Bi(n)+d;if(30<f){var _=d-d%5;f=(c&(1<<_)-1).toString(32),c>>=_,d-=_,bs=1<<32-Bi(n)+d|a<<d|c,Cs=f+i}else bs=1<<f|a<<d|c,Cs=i}function lc(i){i.return!==null&&(Xs(i,1),dm(i,1,0))}function Qu(i){for(;i===ac;)ac=la[--oa],la[oa]=null,yl=la[--oa],la[oa]=null;for(;i===Sn;)Sn=Xi[--Qi],Xi[Qi]=null,Cs=Xi[--Qi],Xi[Qi]=null,bs=Xi[--Qi],Xi[Qi]=null}function fm(i,n){Xi[Qi++]=bs,Xi[Qi++]=Cs,Xi[Qi++]=Sn,bs=n.id,Cs=n.overflow,Sn=i}var Ht=null,at=null,ze=!1,bn=null,Ji=!1,Ju=Error(r(519));function Cn(i){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _l(Zi(n,i)),Ju}function pm(i){var n=i.stateNode,a=i.type,c=i.memoizedProps;switch(n[Kt]=i,n[bi]=c,a){case"dialog":Pe("cancel",n),Pe("close",n);break;case"iframe":case"object":case"embed":Pe("load",n);break;case"video":case"audio":for(a=0;a<Pl.length;a++)Pe(Pl[a],n);break;case"source":Pe("error",n);break;case"img":case"image":case"link":Pe("error",n),Pe("load",n);break;case"details":Pe("toggle",n);break;case"input":Pe("invalid",n),j1(n,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Pe("invalid",n);break;case"textarea":Pe("invalid",n),M1(n,c.value,c.defaultValue,c.children)}a=c.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||c.suppressHydrationWarning===!0||Bv(n.textContent,a)?(c.popover!=null&&(Pe("beforetoggle",n),Pe("toggle",n)),c.onScroll!=null&&Pe("scroll",n),c.onScrollEnd!=null&&Pe("scrollend",n),c.onClick!=null&&(n.onclick=Ss),n=!0):n=!1,n||Cn(i,!0)}function oc(i){for(Ht=i.return;Ht;)switch(Ht.tag){case 5:case 31:case 13:Ji=!1;return;case 27:case 3:Ji=!0;return;default:Ht=Ht.return}}function ca(i){if(i!==Ht)return!1;if(!ze)return oc(i),ze=!0,!1;var n=i.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||Tf(i.type,i.memoizedProps)),a=!a),a&&at&&Cn(i),oc(i),n===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));at=ey(i)}else if(n===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));at=ey(i)}else n===27?(n=at,Un(i.type)?(i=If,If=null,at=i):at=n):at=Ht?ts(i.stateNode.nextSibling):null;return!0}function ur(){at=Ht=null,ze=!1}function ed(){var i=bn;return i!==null&&(Ei===null?Ei=i:Ei.push.apply(Ei,i),bn=null),i}function _l(i){bn===null?bn=[i]:bn.push(i)}var td=fi(null),dr=null,Qs=null;function kn(i,n,a){Ye(td,n._currentValue),n._currentValue=a}function Js(i){i._currentValue=td.current,mt(td)}function cc(i,n,a){for(;i!==null;){var c=i.alternate;if((i.childLanes&n)!==n?(i.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),i===a)break;i=i.return}}function id(i,n,a,c){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var f=d.dependencies;if(f!==null){var _=d.child;f=f.firstContext;e:for(;f!==null;){var k=f;f=d;for(var T=0;T<n.length;T++)if(k.context===n[T]){f.lanes|=a,k=f.alternate,k!==null&&(k.lanes|=a),cc(f.return,a,i),c||(_=null);break e}f=k.next}}else if(d.tag===18){if(_=d.return,_===null)throw Error(r(341));_.lanes|=a,f=_.alternate,f!==null&&(f.lanes|=a),cc(_,a,i),_=null}else d.tag===13&&d.memoizedState!==null&&d.memoizedState.dehydrated===null?(d.lanes|=a,_=d.alternate,_!==null&&(_.lanes|=a),cc(d.return,a,i),_=d.child,_=_!==null?_.sibling:null):_=d.child;if(_!==null)_.return=d;else for(_=d;_!==null;){if(_===i){_=null;break}if(d=_.sibling,d!==null){d.return=_.return,_=d;break}_=_.return}d=_}}function fr(i,n,a,c){i=null;for(var d=n,f=!1;d!==null;){if(!f){if((d.flags&524288)!==0)f=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var _=d.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var k=d.type;zi(d.pendingProps.value,_.value)||(i!==null?i.push(k):i=[k])}}else if(d===yn.current){if(_=d.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(La):i=[La])}d=d.return}return i!==null&&id(n,i,a,c),n.flags|=262144,i!==null}function hc(i){for(i=i.firstContext;i!==null;){if(!zi(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function pr(i){dr=i,Qs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Yt(i){return mm(dr,i)}function uc(i,n){return dr===null&&pr(i),mm(i,n)}function mm(i,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Qs===null){if(i===null)throw Error(r(308));Qs=n,i.dependencies={lanes:0,firstContext:n},i.flags|=524288}else Qs=Qs.next=n;return a}var y4=typeof AbortController<"u"?AbortController:function(){var i=[],n=this.signal={aborted:!1,addEventListener:function(a,c){i.push(c)}};this.abort=function(){n.aborted=!0,i.forEach(function(a){return a()})}},_4=e.unstable_scheduleCallback,x4=e.unstable_NormalPriority,jt={$$typeof:X,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sd(){return{controller:new y4,data:new Map,refCount:0}}function xl(i){i.refCount--,i.refCount===0&&_4(x4,function(){i.controller.abort()})}function gm(i,n){if((i.pendingLanes&4194048)!==0){var a=i.transitionTypes;for(a===null&&(a=i.transitionTypes=[]),i=0;i<n.length;i++){var c=n[i];a.indexOf(c)===-1&&a.push(c)}}}var wl=null;function w4(i){var n=i.transitionTypes;return i.transitionTypes=null,n}var Sl=null,nd=0,mr=0,ha=null;function S4(i,n){if(Sl===null){var a=Sl=[];nd=0,mr=wf(),ha={status:"pending",value:void 0,then:function(c){a.push(c)}}}return nd++,n.then(vm,vm),n}function vm(){if(--nd===0&&(wl=null,Sl!==null)){ha!==null&&(ha.status="fulfilled");var i=Sl;Sl=null,mr=0,ha=null;for(var n=0;n<i.length;n++)(0,i[n])()}}function b4(i,n){var a=[],c={status:"pending",value:null,reason:null,then:function(d){a.push(d)}};return i.then(function(){c.status="fulfilled",c.value=n;for(var d=0;d<a.length;d++)(0,a[d])(n)},function(d){for(c.status="rejected",c.reason=d,d=0;d<a.length;d++)(0,a[d])(void 0)}),c}var ym=me.S;me.S=function(i,n){if(hv=Ri(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&S4(i,n),wl!==null)for(var a=Ma;a!==null;)gm(a,wl),a=a.next;if(a=i.types,a!==null){for(var c=Ma;c!==null;)gm(c,a),c=c.next;if(mr!==0){c=wl,c===null&&(c=wl=[]);for(var d=0;d<a.length;d++){var f=a[d];c.indexOf(f)===-1&&c.push(f)}}}ym!==null&&ym(i,n)};var gr=fi(null);function rd(){var i=gr.current;return i!==null?i:it.pooledCache}function dc(i,n){n===null?Ye(gr,gr.current):Ye(gr,n.pool)}function _m(){var i=rd();return i===null?null:{parent:jt._currentValue,pool:i}}var ua=Error(r(460)),ad=Error(r(474)),fc=Error(r(542)),pc={then:function(){}};function xm(i){return i=i.status,i==="fulfilled"||i==="rejected"}function wm(i,n,a){switch(a=i[a],a===void 0?i.push(n):a!==n&&(n.then(Ss,Ss),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw i=n.reason,bm(i),i===void 0&&!("reason"in n)?Error(r(600)):i;default:if(typeof n.status=="string")n.then(Ss,Ss);else{if(i=it,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=n,i.status="pending",i.then(function(c){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=c}},function(c){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=c}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw i=n.reason,bm(i),i}throw yr=n,ua}}function vr(i){try{var n=i._init;return n(i._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(yr=a,ua):a}}var yr=null;function Sm(){if(yr===null)throw Error(r(459));var i=yr;return yr=null,i}function bm(i){if(i===ua||i===fc)throw Error(r(483))}var da=null,bl=0;function mc(i){var n=bl;return bl+=1,da===null&&(da=[]),wm(da,i,n)}function jn(i,n){n=n.props.ref,i.ref=n!==void 0?n:null}function gc(i,n){throw n.$$typeof===U?Error(r(525)):(i=Object.prototype.toString.call(n),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":i)))}function Cm(i){function n(K,H){if(i){var Z=K.deletions;Z===null?(K.deletions=[H],K.flags|=16):Z.push(H)}}function a(K,H){if(!i)return null;for(;H!==null;)n(K,H),H=H.sibling;return null}function c(K){for(var H=new Map;K!==null;)K.key===null?H.set(K.index,K):H.set(K.key,K),K=K.sibling;return H}function d(K,H){return K=Zs(K,H),K.index=0,K.sibling=null,K}function f(K,H,Z){return K.index=Z,i?(Z=K.alternate,Z!==null?(Z=Z.index,Z<H?(K.flags|=2,H):Z):(K.flags|=134217730,H)):(K.flags|=1048576,H)}function _(K){return i&&K.alternate===null&&(K.flags|=134217730),K}function k(K,H,Z,ne){return H===null||H.tag!==6?(H=Zu(Z,K.mode,ne),H.return=K,H):(H=d(H,Z),H.return=K,H)}function T(K,H,Z,ne){var ye=Z.type;return ye===$?(K=te(K,H,Z.props.children,ne,Z.key),jn(K,Z),K):H!==null&&(H.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===Y&&vr(ye)===H.type)?(H=d(H,Z.props),jn(H,Z),H.return=K,H):(H=rc(Z.type,Z.key,Z.props,null,K.mode,ne),jn(H,Z),H.return=K,H)}function G(K,H,Z,ne){return H===null||H.tag!==4||H.stateNode.containerInfo!==Z.containerInfo||H.stateNode.implementation!==Z.implementation?(H=Xu(Z,K.mode,ne),H.return=K,H):(H=d(H,Z.children||[]),H.return=K,H)}function te(K,H,Z,ne,ye){return H===null||H.tag!==7?(H=hr(Z,K.mode,ne,ye),H.return=K,H):(H=d(H,Z),H.return=K,H)}function re(K,H,Z){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Zu(""+H,K.mode,Z),H.return=K,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case P:return Z=rc(H.type,H.key,H.props,null,K.mode,Z),jn(Z,H),Z.return=K,Z;case F:return H=Xu(H,K.mode,Z),H.return=K,H;case Y:return H=vr(H),re(K,H,Z)}if(Ee(H)||he(H))return H=hr(H,K.mode,Z,null),H.return=K,H;if(typeof H.then=="function")return re(K,mc(H),Z);if(H.$$typeof===X)return re(K,uc(K,H),Z);gc(K,H)}return null}function W(K,H,Z,ne){var ye=H!==null?H.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return ye!==null?null:k(K,H,""+Z,ne);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case P:return Z.key===ye?T(K,H,Z,ne):null;case F:return Z.key===ye?G(K,H,Z,ne):null;case Y:return Z=vr(Z),W(K,H,Z,ne)}if(Ee(Z)||he(Z))return ye!==null?null:te(K,H,Z,ne,null);if(typeof Z.then=="function")return W(K,H,mc(Z),ne);if(Z.$$typeof===X)return W(K,H,uc(K,Z),ne);gc(K,Z)}return null}function Q(K,H,Z,ne,ye){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return K=K.get(Z)||null,k(H,K,""+ne,ye);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case P:return K=K.get(ne.key===null?Z:ne.key)||null,T(H,K,ne,ye);case F:return K=K.get(ne.key===null?Z:ne.key)||null,G(H,K,ne,ye);case Y:return ne=vr(ne),Q(K,H,Z,ne,ye)}if(Ee(ne)||he(ne))return K=K.get(Z)||null,te(H,K,ne,ye,null);if(typeof ne.then=="function")return Q(K,H,Z,mc(ne),ye);if(ne.$$typeof===X)return Q(K,H,Z,uc(H,ne),ye);gc(H,ne)}return null}function fe(K,H,Z,ne){for(var ye=null,Ve=null,Ce=H,Me=H=0,At=null;Ce!==null&&Me<Z.length;Me++){Ce.index>Me?(At=Ce,Ce=null):At=Ce.sibling;var We=W(K,Ce,Z[Me],ne);if(We===null){Ce===null&&(Ce=At);break}i&&Ce&&We.alternate===null&&n(K,Ce),H=f(We,H,Me),Ve===null?ye=We:Ve.sibling=We,Ve=We,Ce=At}if(Me===Z.length)return a(K,Ce),ze&&Xs(K,Me),ye;if(Ce===null){for(;Me<Z.length;Me++)Ce=re(K,Z[Me],ne),Ce!==null&&(H=f(Ce,H,Me),Ve===null?ye=Ce:Ve.sibling=Ce,Ve=Ce);return ze&&Xs(K,Me),ye}for(Ce=c(Ce);Me<Z.length;Me++)At=Q(Ce,K,Me,Z[Me],ne),At!==null&&(i&&(We=At.alternate,We!==null&&Ce.delete(We.key===null?Me:We.key)),H=f(At,H,Me),Ve===null?ye=At:Ve.sibling=At,Ve=At);return i&&Ce.forEach(function(Wn){return n(K,Wn)}),ze&&Xs(K,Me),ye}function Se(K,H,Z,ne){if(Z==null)throw Error(r(151));for(var ye=null,Ve=null,Ce=H,Me=H=0,At=null,We=Z.next();Ce!==null&&!We.done;Me++,We=Z.next()){Ce.index>Me?(At=Ce,Ce=null):At=Ce.sibling;var Wn=W(K,Ce,We.value,ne);if(Wn===null){Ce===null&&(Ce=At);break}i&&Ce&&Wn.alternate===null&&n(K,Ce),H=f(Wn,H,Me),Ve===null?ye=Wn:Ve.sibling=Wn,Ve=Wn,Ce=At}if(We.done)return a(K,Ce),ze&&Xs(K,Me),ye;if(Ce===null){for(;!We.done;Me++,We=Z.next())We=re(K,We.value,ne),We!==null&&(H=f(We,H,Me),Ve===null?ye=We:Ve.sibling=We,Ve=We);return ze&&Xs(K,Me),ye}for(Ce=c(Ce);!We.done;Me++,We=Z.next())We=Q(Ce,K,Me,We.value,ne),We!==null&&(i&&(At=We.alternate,At!==null&&Ce.delete(At.key===null?Me:At.key)),H=f(We,H,Me),Ve===null?ye=We:Ve.sibling=We,Ve=We);return i&&Ce.forEach(function(s6){return n(K,s6)}),ze&&Xs(K,Me),ye}function Oe(K,H,Z,ne){if(typeof Z=="object"&&Z!==null&&Z.type===$&&Z.key===null&&Z.props.ref===void 0&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case P:e:{for(var ye=Z.key;H!==null;){if(H.key===ye){if(ye=Z.type,ye===$){if(H.tag===7){a(K,H.sibling),ne=d(H,Z.props.children),jn(ne,Z),ne.return=K,K=ne;break e}}else if(H.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===Y&&vr(ye)===H.type){a(K,H.sibling),ne=d(H,Z.props),jn(ne,Z),ne.return=K,K=ne;break e}a(K,H);break}else n(K,H);H=H.sibling}Z.type===$?(ne=hr(Z.props.children,K.mode,ne,Z.key),jn(ne,Z),ne.return=K,K=ne):(ne=rc(Z.type,Z.key,Z.props,null,K.mode,ne),jn(ne,Z),ne.return=K,K=ne)}return _(K);case F:e:{for(ye=Z.key;H!==null;){if(H.key===ye)if(H.tag===4&&H.stateNode.containerInfo===Z.containerInfo&&H.stateNode.implementation===Z.implementation){a(K,H.sibling),ne=d(H,Z.children||[]),ne.return=K,K=ne;break e}else{a(K,H);break}else n(K,H);H=H.sibling}ne=Xu(Z,K.mode,ne),ne.return=K,K=ne}return _(K);case Y:return Z=vr(Z),Oe(K,H,Z,ne)}if(Ee(Z))return fe(K,H,Z,ne);if(he(Z)){if(ye=he(Z),typeof ye!="function")throw Error(r(150));return Z=ye.call(Z),Se(K,H,Z,ne)}if(typeof Z.then=="function")return Oe(K,H,mc(Z),ne);if(Z.$$typeof===X)return Oe(K,H,uc(K,Z),ne);gc(K,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,H!==null&&H.tag===6?(a(K,H.sibling),ne=d(H,Z),ne.return=K,K=ne):(a(K,H),ne=Zu(Z,K.mode,ne),ne.return=K,K=ne),_(K)):a(K,H)}return function(K,H,Z,ne){try{bl=0;var ye=Oe(K,H,Z,ne);return da=null,ye}catch(Ce){if(Ce===ua||Ce===fc)throw Ce;var Ve=Ci(29,Ce,null,K.mode);return Ve.lanes=ne,Ve.return=K,Ve}}}var _r=Cm(!0),km=Cm(!1),En=!1;function ld(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function od(i,n){i=i.updateQueue,n.updateQueue===i&&(n.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Mn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function An(i,n,a){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(Ke&2)!==0){var d=c.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),c.pending=n,n=nc(i),om(i,null,a),n}return sc(i,c,n,a),nc(i)}function Cl(i,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,d1(i,a)}}function cd(i,n){var a=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var d=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?d=f=_:f=f.next=_,a=a.next}while(a!==null);f===null?d=f=n:f=f.next=n}else d=f=n;a={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:f,shared:c.shared,callbacks:c.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=n:i.next=n,a.lastBaseUpdate=n}var hd=!1;function kl(){if(hd){var i=ha;if(i!==null)throw i}}function jl(i,n,a,c){hd=!1;var d=i.updateQueue;En=!1;var f=d.firstBaseUpdate,_=d.lastBaseUpdate,k=d.shared.pending;if(k!==null){d.shared.pending=null;var T=k,G=T.next;T.next=null,_===null?f=G:_.next=G,_=T;var te=i.alternate;te!==null&&(te=te.updateQueue,k=te.lastBaseUpdate,k!==_&&(k===null?te.firstBaseUpdate=G:k.next=G,te.lastBaseUpdate=T))}if(f!==null){var re=d.baseState;_=0,te=G=T=null,k=f;do{var W=k.lane&-536870913,Q=W!==k.lane;if(Q?(qe&W)===W:(c&W)===W){W!==0&&W===mr&&(hd=!0),te!==null&&(te=te.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var fe=i,Se=k;W=n;var Oe=a;switch(Se.tag){case 1:if(fe=Se.payload,typeof fe=="function"){re=fe.call(Oe,re,W);break e}re=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=Se.payload,W=typeof fe=="function"?fe.call(Oe,re,W):fe,W==null)break e;re=I({},re,W);break e;case 2:En=!0}}W=k.callback,W!==null&&(i.flags|=64,Q&&(i.flags|=8192),Q=d.callbacks,Q===null?d.callbacks=[W]:Q.push(W))}else Q={lane:W,tag:k.tag,payload:k.payload,callback:k.callback,next:null},te===null?(G=te=Q,T=re):te=te.next=Q,_|=W;if(k=k.next,k===null){if(k=d.shared.pending,k===null)break;Q=k,k=Q.next,Q.next=null,d.lastBaseUpdate=Q,d.shared.pending=null}}while(!0);te===null&&(T=re),d.baseState=T,d.firstBaseUpdate=G,d.lastBaseUpdate=te,f===null&&(d.shared.lanes=0),On|=_,i.lanes=_,i.memoizedState=re}}function jm(i,n){if(typeof i!="function")throw Error(r(191,i));i.call(n)}function Em(i,n){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)jm(a[i],n)}var Tn=fi(null),vc=fi(0);function Mm(i,n){i=rn,Ye(vc,i),Ye(Tn,n),rn=i|n.baseLanes}function ud(){Ye(vc,rn),Ye(Tn,Tn.current)}function dd(){rn=vc.current,mt(Tn),mt(vc)}var Gt=fi(null),li=null;function Nn(i){var n=i.alternate;Ye(Zt,Zt.current&1),Ye(Gt,i),li===null&&(n===null||Tn.current!==null||n.memoizedState!==null)&&(li=i)}function fd(i){Ye(Zt,Zt.current),Ye(Gt,i),li===null&&(li=i)}function Am(i){i.tag===22?(Ye(Zt,Zt.current),Ye(Gt,i),li===null&&(li=i)):Dn()}function Dn(){Ye(Zt,Zt.current),Ye(Gt,Gt.current)}function Hi(i){mt(Gt),li===i&&(li=null),mt(Zt)}var Zt=fi(0);function El(i,n){Ye(Gt,Gt.current),Ye(Zt,n)}function pd(i){mt(Zt),mt(Gt),li===i&&(li=null)}function yc(i){for(var n=i;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||zf(a)||Hf(a)))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!=="independent"){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var en=0,Be=null,Je=null,Et=null,_c=!1,fa=!1,xr=!1,xc=0,Ml=0,pa=null,C4=0;function _t(){throw Error(r(321))}function md(i,n){if(n===null)return!1;for(var a=0;a<n.length&&a<i.length;a++)if(!zi(i[a],n[a]))return!1;return!0}function gd(i,n,a,c,d,f){return en=f,Be=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,me.H=i===null||i.memoizedState===null?dg:fg,xr=!1,f=a(c,d),xr=!1,fa&&(f=Nm(n,a,c,d)),Tm(i),f}function Tm(i){me.H=Ec;var n=Je!==null&&Je.next!==null;if(en=0,Et=Je=Be=null,_c=!1,Ml=0,pa=null,n)throw Error(r(300));i===null||Mt||(i=i.dependencies,i!==null&&hc(i)&&(Mt=!0))}function Nm(i,n,a,c){Be=i;var d=0;do{if(fa&&(pa=null),Ml=0,fa=!1,25<=d)throw Error(r(301));if(d+=1,Et=Je=null,i.updateQueue!=null){var f=i.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}me.H=D4,f=n(a,c)}while(fa);return f}function k4(){var i=me.H,n=i.useState()[0];return n=typeof n.then=="function"?Al(n):n,i=i.useState()[0],(Je!==null?Je.memoizedState:null)!==i&&(Be.flags|=1024),n}function vd(){var i=xc!==0;return xc=0,i}function yd(i,n,a){n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~a}function _d(i){if(_c){for(i=i.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}_c=!1}en=0,Et=Je=Be=null,fa=!1,Ml=xc=0,pa=null}function mi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Et===null?Be.memoizedState=Et=i:Et=Et.next=i,Et}function bt(){if(Je===null){var i=Be.alternate;i=i!==null?i.memoizedState:null}else i=Je.next;var n=Et===null?Be.memoizedState:Et.next;if(n!==null)Et=n,Je=i;else{if(i===null)throw Be.alternate===null?Error(r(467)):Error(r(310));Je=i,i={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},Et===null?Be.memoizedState=Et=i:Et=Et.next=i}return Et}function wc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Al(i){var n=Ml;return Ml+=1,pa===null&&(pa=[]),i=wm(pa,i,n),n=Be,(Et===null?n.memoizedState:Et.next)===null&&(n=n.alternate,me.H=n===null||n.memoizedState===null?dg:fg),i}function Sc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Al(i);if(i.$$typeof===J)return;if(i.$$typeof===X)return Yt(i)}throw Error(r(438,String(i)))}function xd(i){var n=null,a=Be.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var c=Be.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(n={data:c.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=wc(),Be.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(i),c=0;c<i;c++)a[c]=we;return n.index++,a}function tn(i,n){return typeof n=="function"?n(i):n}function bc(i){var n=bt();return wd(n,Je,i)}function wd(i,n,a){var c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=a;var d=i.baseQueue,f=c.pending;if(f!==null){if(d!==null){var _=d.next;d.next=f.next,f.next=_}n.baseQueue=d=f,c.pending=null}if(f=i.baseState,d===null)i.memoizedState=f;else{n=d.next;var k=_=null,T=null,G=n,te=!1;do{var re=G.lane&-536870913;if(re!==G.lane?(qe&re)===re:(en&re)===re){var W=G.revertLane;if(W===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),re===mr&&(te=!0);else if((en&W)===W){G=G.next,W===mr&&(te=!0);continue}else re={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(k=T=re,_=f):T=T.next=re,Be.lanes|=W,On|=W;re=G.action,xr&&a(f,re),f=G.hasEagerState?G.eagerState:a(f,re)}else W={lane:re,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(k=T=W,_=f):T=T.next=W,Be.lanes|=re,On|=re;G=G.next}while(G!==null&&G!==n);if(T===null?_=f:T.next=k,!zi(f,i.memoizedState)&&(Mt=!0,te&&(a=ha,a!==null)))throw a;i.memoizedState=f,i.baseState=_,i.baseQueue=T,c.lastRenderedState=f}return d===null&&(c.lanes=0),[i.memoizedState,c.dispatch]}function Sd(i){var n=bt(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var c=a.dispatch,d=a.pending,f=n.memoizedState;if(d!==null){a.pending=null;var _=d=d.next;do f=i(f,_.action),_=_.next;while(_!==d);zi(f,n.memoizedState)||(Mt=!0),n.memoizedState=f,n.baseQueue===null&&(n.baseState=f),a.lastRenderedState=f}return[f,c]}function Dm(i,n,a){var c=Be,d=bt(),f=ze;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=n();var _=!zi((Je||d).memoizedState,a);if(_&&(d.memoizedState=a,Mt=!0),d=d.queue,kd(Bm.bind(null,c,d,i),[i]),i=d.getSnapshot!==n||_||Et!==null&&(Et.memoizedState.tag&1)!==0,ma(i?9:8,{destroy:void 0},Lm.bind(null,c,d,a,n),null),i){if(c.flags|=2048,it===null)throw Error(r(349));f||(en&127)!==0||Rm(c,n,a)}return a}function Rm(i,n,a){i.flags|=16384,i={getSnapshot:n,value:a},n=Be.updateQueue,n===null?(n=wc(),Be.updateQueue=n,n.stores=[i]):(a=n.stores,a===null?n.stores=[i]:a.push(i))}function Lm(i,n,a,c){n.value=a,n.getSnapshot=c,Om(n)&&zm(i)}function Bm(i,n,a){return a(function(){Om(n)&&zm(i)})}function Om(i){var n=i.getSnapshot;i=i.value;try{var a=n();return!zi(i,a)}catch{return!0}}function zm(i){var n=cr(i,2);n!==null&&Mi(n,i,2)}function bd(i){var n=mi();if(typeof i=="function"){var a=i;if(i=a(),xr){_n(!0);try{a()}finally{_n(!1)}}}return n.memoizedState=n.baseState=i,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:i},n}function Hm(i,n,a,c){return i.baseState=a,wd(i,Je,typeof c=="function"?c:tn)}function j4(i,n,a,c,d){if(jc(i))throw Error(r(485));if(i=n.action,i!==null){var f={payload:d,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){f.listeners.push(_)}};me.T!==null?a(!0):f.isTransition=!1,c(f),a=n.pending,a===null?(f.next=n.pending=f,Im(n,f)):(f.next=a.next,n.pending=a.next=f)}}function Im(i,n){var a=n.action,c=n.payload,d=i.state;if(n.isTransition){var f=me.T,_={};_.types=f!==null?f.types:null,me.T=_;try{var k=a(d,c),T=me.S;T!==null&&T(_,k),Um(i,n,k)}catch(G){Cd(i,n,G)}finally{f!==null&&_.types!==null&&(f.types=_.types),me.T=f}}else try{f=a(d,c),Um(i,n,f)}catch(G){Cd(i,n,G)}}function Um(i,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){Pm(i,n,c)},function(c){return Cd(i,n,c)}):Pm(i,n,a)}function Pm(i,n,a){n.status="fulfilled",n.value=a,qm(n),i.state=a,n=i.pending,n!==null&&(a=n.next,a===n?i.pending=null:(a=a.next,n.next=a,Im(i,a)))}function Cd(i,n,a){var c=i.pending;if(i.pending=null,c!==null){c=c.next;do n.status="rejected",n.reason=a,qm(n),n=n.next;while(n!==c)}i.action=null}function qm(i){i=i.listeners;for(var n=0;n<i.length;n++)(0,i[n])()}function Vm(i,n){return n}function $m(i,n){if(ze){var a=it.formState;if(a!==null){e:{var c=Be;if(ze){if(at){t:{for(var d=at,f=Ji;d.nodeType!==8;){if(!f){d=null;break t}if(d=ts(d.nextSibling),d===null){d=null;break t}}f=d.data,d=f==="F!"||f==="F"?d:null}if(d){at=ts(d.nextSibling),c=d.data==="F!";break e}}Cn(c)}c=!1}c&&(n=a[0])}}return a=mi(),a.memoizedState=a.baseState=n,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vm,lastRenderedState:n},a.queue=c,a=cg.bind(null,Be,c),c.dispatch=a,c=bd(!1),f=Td.bind(null,Be,!1,c.queue),c=mi(),d={state:n,dispatch:null,action:i,pending:null},c.queue=d,a=j4.bind(null,Be,d,f,a),d.dispatch=a,c.memoizedState=i,[n,a,!1]}function Wm(i){var n=bt();return Fm(n,Je,i)}function Fm(i,n,a){if(n=wd(i,n,Vm)[0],i=bc(tn)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var c=Al(n)}catch(_){throw _===ua?fc:_}else c=n;n=bt();var d=n.queue,f=d.dispatch;return a!==n.memoizedState&&(Be.flags|=2048,ma(9,{destroy:void 0},E4.bind(null,d,a),null)),[c,f,i]}function E4(i,n){i.action=n}function Km(i){var n=bt(),a=Je;if(a!==null)return Fm(n,a,i);bt(),n=n.memoizedState,a=bt();var c=a.queue.dispatch;return a.memoizedState=i,[n,c,!1]}function ma(i,n,a,c){return i={tag:i,create:a,deps:c,inst:n,next:null},n=Be.updateQueue,n===null&&(n=wc(),Be.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=i.next=i:(c=a.next,a.next=i,i.next=c,n.lastEffect=i),i}function Ym(){return bt().memoizedState}function Cc(i,n,a,c){var d=mi();Be.flags|=i,d.memoizedState=ma(1|n,{destroy:void 0},a,c===void 0?null:c)}function kc(i,n,a,c){var d=bt();c=c===void 0?null:c;var f=d.memoizedState.inst;Je!==null&&c!==null&&md(c,Je.memoizedState.deps)?d.memoizedState=ma(n,f,a,c):(Be.flags|=i,d.memoizedState=ma(1|n,f,a,c))}function Gm(i,n){Cc(8390656,8,i,n)}function kd(i,n){kc(2048,8,i,n)}function M4(i){Be.flags|=4;var n=Be.updateQueue;if(n===null)n=wc(),Be.updateQueue=n,n.events=[i];else{var a=n.events;a===null?n.events=[i]:a.push(i)}}function Zm(i){var n=bt().memoizedState;return M4({ref:n,nextImpl:i}),function(){if((Ke&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Xm(i,n){return kc(4,2,i,n)}function Qm(i,n){return kc(4,4,i,n)}function Jm(i,n){if(typeof n=="function"){i=i();var a=n(i);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return i=i(),n.current=i,function(){n.current=null}}function eg(i,n,a){a=a!=null?a.concat([i]):null,kc(4,4,Jm.bind(null,n,i),a)}function jd(){}function tg(i,n){var a=bt();n=n===void 0?null:n;var c=a.memoizedState;return n!==null&&md(n,c[1])?c[0]:(a.memoizedState=[i,n],i)}function ig(i,n){var a=bt();n=n===void 0?null:n;var c=a.memoizedState;if(n!==null&&md(n,c[1]))return c[0];if(c=i(),xr){_n(!0);try{i()}finally{_n(!1)}}return a.memoizedState=[c,n],c}function Ed(i,n,a){return a===void 0||(en&1073741824)!==0&&(qe&261930)===0?i.memoizedState=n:(i.memoizedState=a,i=dv(),Be.lanes|=i,On|=i,a)}function sg(i,n,a,c){return zi(a,n)?a:Tn.current!==null?(i=Ed(i,a,c),zi(i,n)||(Mt=!0),i):(en&106)===0||(en&1073741824)!==0&&(qe&261930)===0?(Mt=!0,i.memoizedState=a):(i=dv(),Be.lanes|=i,On|=i,n)}function ng(i,n,a,c,d){var f=_e.p;_e.p=f!==0&&8>f?f:8;var _=me.T,k={};k.types=_!==null?_.types:null,me.T=k,Td(i,!1,n,a);try{var T=d(),G=me.S;if(G!==null&&G(k,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var te=b4(T,c);Tl(i,n,te,qi(i))}else Tl(i,n,c,qi(i))}catch(re){Tl(i,n,{then:function(){},status:"rejected",reason:re},qi())}finally{_e.p=f,_!==null&&k.types!==null&&(_.types=k.types),me.T=_}}function A4(){}function Md(i,n,a,c){if(i.tag!==5)throw Error(r(476));var d=rg(i).queue;ng(i,d,n,Le,a===null?A4:function(){return ag(i),a(c)})}function rg(i){var n=i.memoizedState;if(n!==null)return n;n={memoizedState:Le,baseState:Le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:Le},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:a},next:null},i.memoizedState=n,i=i.alternate,i!==null&&(i.memoizedState=n),n}function ag(i){var n=rg(i);n.next===null&&(n=i.alternate.memoizedState),Tl(i,n.next.queue,{},qi())}function Ad(){return Yt(La)}function lg(){return bt().memoizedState}function og(){return bt().memoizedState}function T4(i){for(var n=i.return;n!==null;){switch(n.tag){case 24:case 3:var a=qi();i=Mn(a);var c=An(n,i,a);c!==null&&(Mi(c,n,a),Cl(c,n,a)),n={cache:sd()},i.payload=n;return}n=n.return}}function N4(i,n,a){var c=qi();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},jc(i)?hg(n,a):(a=Yu(i,n,a,c),a!==null&&(Mi(a,i,c),ug(a,n,c)))}function cg(i,n,a){var c=qi();Tl(i,n,a,c)}function Tl(i,n,a,c){var d={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(jc(i))hg(n,d);else{var f=i.alternate;if(i.lanes===0&&(f===null||f.lanes===0)&&(f=n.lastRenderedReducer,f!==null))try{var _=n.lastRenderedState,k=f(_,a);if(d.hasEagerState=!0,d.eagerState=k,zi(k,_))return sc(i,n,d,0),it===null&&ic(),!1}catch{}if(a=Yu(i,n,d,c),a!==null)return Mi(a,i,c),ug(a,n,c),!0}return!1}function Td(i,n,a,c){if(c={lane:2,revertLane:wf(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},jc(i)){if(n)throw Error(r(479))}else n=Yu(i,a,c,2),n!==null&&Mi(n,i,2)}function jc(i){var n=i.alternate;return i===Be||n!==null&&n===Be}function hg(i,n){fa=_c=!0;var a=i.pending;a===null?n.next=n:(n.next=a.next,a.next=n),i.pending=n}function ug(i,n,a){if((a&4194048)!==0){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,d1(i,a)}}var Ec={readContext:Yt,use:Sc,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useLayoutEffect:_t,useInsertionEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useSyncExternalStore:_t,useId:_t,useHostTransitionStatus:_t,useFormState:_t,useActionState:_t,useOptimistic:_t,useMemoCache:_t,useCacheRefresh:_t,useEffectEvent:_t},dg={readContext:Yt,use:Sc,useCallback:function(i,n){return mi().memoizedState=[i,n===void 0?null:n],i},useContext:Yt,useEffect:Gm,useImperativeHandle:function(i,n,a){a=a!=null?a.concat([i]):null,Cc(4194308,4,Jm.bind(null,n,i),a)},useLayoutEffect:function(i,n){return Cc(4194308,4,i,n)},useInsertionEffect:function(i,n){Cc(4,2,i,n)},useMemo:function(i,n){var a=mi();n=n===void 0?null:n;var c=i();if(xr){_n(!0);try{i()}finally{_n(!1)}}return a.memoizedState=[c,n],c},useReducer:function(i,n,a){var c=mi();if(a!==void 0){var d=a(n);if(xr){_n(!0);try{a(n)}finally{_n(!1)}}}else d=n;return c.memoizedState=c.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},c.queue=i,i=i.dispatch=N4.bind(null,Be,i),[c.memoizedState,i]},useRef:function(i){var n=mi();return i={current:i},n.memoizedState=i},useState:function(i){i=bd(i);var n=i.queue,a=cg.bind(null,Be,n);return n.dispatch=a,[i.memoizedState,a]},useDebugValue:jd,useDeferredValue:function(i,n){var a=mi();return Ed(a,i,n)},useTransition:function(){var i=bd(!1);return i=ng.bind(null,Be,i.queue,!0,!1),mi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,n,a){var c=Be,d=mi();if(ze){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),it===null)throw Error(r(349));(qe&127)!==0||Rm(c,n,a)}d.memoizedState=a;var f={value:a,getSnapshot:n};return d.queue=f,Gm(Bm.bind(null,c,f,i),[i]),c.flags|=2048,ma(9,{destroy:void 0},Lm.bind(null,c,f,a,n),null),a},useId:function(){var i=mi(),n=it.identifierPrefix;if(ze){var a=Cs,c=bs;a=(c&~(1<<32-Bi(c)-1)).toString(32)+a,n="_"+n+"R_"+a,a=xc++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=C4++,n="_"+n+"r_"+a.toString(32)+"_";return i.memoizedState=n},useHostTransitionStatus:Ad,useFormState:$m,useActionState:$m,useOptimistic:function(i){var n=mi();n.memoizedState=n.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Td.bind(null,Be,!0,a),a.dispatch=n,[i,n]},useMemoCache:xd,useCacheRefresh:function(){return mi().memoizedState=T4.bind(null,Be)},useEffectEvent:function(i){var n=mi(),a={impl:i};return n.memoizedState=a,function(){if((Ke&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},fg={readContext:Yt,use:Sc,useCallback:tg,useContext:Yt,useEffect:kd,useImperativeHandle:eg,useInsertionEffect:Xm,useLayoutEffect:Qm,useMemo:ig,useReducer:bc,useRef:Ym,useState:function(){return bc(tn)},useDebugValue:jd,useDeferredValue:function(i,n){var a=bt();return sg(a,Je.memoizedState,i,n)},useTransition:function(){var i=bc(tn)[0],n=bt().memoizedState;return[typeof i=="boolean"?i:Al(i),n]},useSyncExternalStore:Dm,useId:lg,useHostTransitionStatus:Ad,useFormState:Wm,useActionState:Wm,useOptimistic:function(i,n){var a=bt();return Hm(a,Je,i,n)},useMemoCache:xd,useCacheRefresh:og,useEffectEvent:Zm},D4={readContext:Yt,use:Sc,useCallback:tg,useContext:Yt,useEffect:kd,useImperativeHandle:eg,useInsertionEffect:Xm,useLayoutEffect:Qm,useMemo:ig,useReducer:Sd,useRef:Ym,useState:function(){return Sd(tn)},useDebugValue:jd,useDeferredValue:function(i,n){var a=bt();return Je===null?Ed(a,i,n):sg(a,Je.memoizedState,i,n)},useTransition:function(){var i=Sd(tn)[0],n=bt().memoizedState;return[typeof i=="boolean"?i:Al(i),n]},useSyncExternalStore:Dm,useId:lg,useHostTransitionStatus:Ad,useFormState:Km,useActionState:Km,useOptimistic:function(i,n){var a=bt();return Je!==null?Hm(a,Je,i,n):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:xd,useCacheRefresh:og,useEffectEvent:Zm};function Nd(i,n,a,c){n=i.memoizedState,a=a(c,n),a=a==null?n:I({},n,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var Dd={enqueueSetState:function(i,n,a){i=i._reactInternals;var c=qi(),d=Mn(c);d.payload=n,a!=null&&(d.callback=a),n=An(i,d,c),n!==null&&(Mi(n,i,c),Cl(n,i,c))},enqueueReplaceState:function(i,n,a){i=i._reactInternals;var c=qi(),d=Mn(c);d.tag=1,d.payload=n,a!=null&&(d.callback=a),n=An(i,d,c),n!==null&&(Mi(n,i,c),Cl(n,i,c))},enqueueForceUpdate:function(i,n){i=i._reactInternals;var a=qi(),c=Mn(a);c.tag=2,n!=null&&(c.callback=n),n=An(i,c,a),n!==null&&(Mi(n,i,a),Cl(n,i,a))}};function pg(i,n,a,c,d,f,_){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,f,_):n.prototype&&n.prototype.isPureReactComponent?!gl(a,c)||!gl(d,f):!0}function mg(i,n,a,c){i=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,c),n.state!==i&&Dd.enqueueReplaceState(n,n.state,null)}function wr(i,n){var a=n;if("ref"in n){a={};for(var c in n)c!=="ref"&&(a[c]=n[c])}if(i=i.defaultProps){a===n&&(a=I({},a));for(var d in i)a[d]===void 0&&(a[d]=i[d])}return a}function gg(i){tc(i)}function vg(i){console.error(i)}function yg(i){tc(i)}function Mc(i,n){try{var a=i.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(c){setTimeout(function(){throw c})}}function _g(i,n,a){try{var c=i.onCaughtError;c(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Rd(i,n,a){return a=Mn(a),a.tag=3,a.payload={element:null},a.callback=function(){Mc(i,n)},a}function xg(i){return i=Mn(i),i.tag=3,i}function wg(i,n,a,c){var d=a.type.getDerivedStateFromError;if(typeof d=="function"){var f=c.value;i.payload=function(){return d(f)},i.callback=function(){_g(n,a,c)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(i.callback=function(){_g(n,a,c),typeof d!="function"&&(zn===null?zn=new Set([this]):zn.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function R4(i,n,a,c,d){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(n=a.alternate,n!==null&&fr(n,a,d,!0),a=Gt.current,a!==null){switch(a.tag){case 31:case 13:case 19:return li===null?Gc():a.alternate===null&&xt===0&&(xt=3),a.flags&=-257,a.flags|=65536,a.lanes=d,c===pc?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([c]):n.add(c),yf(i,c,d)),!1;case 22:return a.flags|=65536,c===pc?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([c])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([c]):a.add(c)),yf(i,c,d)),!1}throw Error(r(435,a.tag))}return yf(i,c,d),Gc(),!1}if(ze)return n=Gt.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,c!==Ju&&(i=Error(r(422),{cause:c}),_l(Zi(i,a)))):(c!==Ju&&(n=Error(r(423),{cause:c}),_l(Zi(n,a))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,c=Zi(c,a),d=Rd(i.stateNode,c,d),cd(i,d),xt!==4&&(xt=2)),!1;var f=Error(r(520),{cause:c});if(f=Zi(f,a),Hl===null?Hl=[f]:Hl.push(f),xt!==4&&(xt=2),n===null)return!0;c=Zi(c,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,i=d&-d,a.lanes|=i,i=Rd(a.stateNode,c,i),cd(a,i),!1;case 1:if(n=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(zn===null||!zn.has(f))))return a.flags|=65536,d&=-d,a.lanes|=d,d=xg(d),wg(d,i,a,c),cd(a,d),!1;break;case 22:if(a.memoizedState!==null)return a.flags|=65536,!1}a=a.return}while(a!==null);return!1}var Ld=Error(r(461)),Mt=!1;function Dt(i,n,a,c){n.child=i===null?km(n,null,a,c):_r(n,i.child,a,c)}function Sg(i,n,a,c,d){a=a.render;var f=n.ref;if("ref"in c){var _={};for(var k in c)k!=="ref"&&(_[k]=c[k])}else _=c;return pr(n),c=gd(i,n,a,_,f,d),k=vd(),i!==null&&!Mt?(yd(i,n,d),sn(i,n,d)):(ze&&k&&lc(n),n.flags|=1,Dt(i,n,c,d),n.child)}function bg(i,n,a,c,d){if(i===null){var f=a.type;return typeof f=="function"&&!Gu(f)&&f.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=f,Cg(i,n,f,c,d)):(i=rc(a.type,null,c,n,n.mode,d),i.ref=n.ref,i.return=n,n.child=i)}if(f=i.child,!qd(i,d)){var _=f.memoizedProps;if(a=a.compare,a=a!==null?a:gl,a(_,c)&&i.ref===n.ref)return sn(i,n,d)}return n.flags|=1,i=Zs(f,c),i.ref=n.ref,i.return=n,n.child=i}function Cg(i,n,a,c,d){if(i!==null){var f=i.memoizedProps;if(gl(f,c)&&i.ref===n.ref)if(Mt=!1,n.pendingProps=c=f,qd(i,d))(i.flags&131072)!==0&&(Mt=!0);else return n.lanes=i.lanes,sn(i,n,d)}return Bd(i,n,a,c,d)}function kg(i,n,a,c){var d=c.children,f=i!==null?i.memoizedState:null;if(i===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((n.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,i!==null){for(c=n.child=i.child,d=0;c!==null;)d=d|c.lanes|c.childLanes,c=c.sibling;c=d&~f}else c=0,n.child=null;return jg(i,n,f,a,c)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},i!==null&&dc(n,f!==null?f.cachePool:null),f!==null?Mm(n,f):ud(),Am(n);else return c=n.lanes=536870912,jg(i,n,f!==null?f.baseLanes|a:a,a,c)}else f!==null?(dc(n,f.cachePool),Mm(n,f),Dn(),n.memoizedState=null):(i!==null&&dc(n,null),ud(),Dn());return Dt(i,n,d,a),n.child}function Nl(i,n){return i!==null&&i.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function jg(i,n,a,c,d){var f=rd();return f=f===null?null:{parent:jt._currentValue,pool:f},n.memoizedState={baseLanes:a,cachePool:f},i!==null&&dc(n,null),ud(),Am(n),i!==null&&fr(i,n,c,!0),n.childLanes=d,null}function Ac(i,n){return n=Tc({mode:n.mode,children:n.children},i.mode),n.ref=i.ref,i.child=n,n.return=i,n}function Eg(i,n,a){return _r(n,i.child,null,a),i=Ac(n,n.pendingProps),i.flags|=2,Hi(n),n.memoizedState=null,i}function L4(i,n,a){var c=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,i===null){if(ze){if(c.mode==="hidden")return i=Ac(n,c),n.lanes=536870912,i.memoizedState={baseLanes:0,cachePool:null},Nl(null,i);if(fd(n),(i=at)?(i=Jv(i,Ji),i=i!==null&&i.data==="&"?i:null,i!==null&&(n.memoizedState={dehydrated:i,treeContext:Sn!==null?{id:bs,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},a=hm(i),a.return=n,n.child=a,Ht=n,at=null)):i=null,i===null)throw Cn(n);return n.lanes=536870912,null}return Ac(n,c)}var f=i.memoizedState;if(f!==null){var _=f.dehydrated;if(fd(n),d)if(n.flags&256)n.flags&=-257,n=Eg(i,n,a);else if(n.memoizedState!==null)n.child=i.child,n.flags|=128,n=null;else throw Error(r(558));else if(Mt||fr(i,n,a,!1),d=(a&i.childLanes)!==0,Mt||d){if(Tn.current===null){if(c=it,c!==null&&(_=f1(c,a),_!==0&&_!==f.retryLane))throw f.retryLane=_,cr(i,_),Mi(c,i,_),Ld;Gc()}n=Eg(i,n,a)}else i=f.treeContext,at=ts(_.nextSibling),Ht=n,ze=!0,bn=null,Ji=!1,i!==null&&fm(n,i),n=Ac(n,c),n.flags|=134221824;return n}return i=Zs(i.child,{mode:c.mode,children:c.children}),i.ref=n.ref,n.child=i,i.return=n,i}function ga(i,n){var a=n.ref;if(a===null)i!==null&&i.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(n.flags|=4194816)}}function Bd(i,n,a,c,d){return pr(n),a=gd(i,n,a,c,void 0,d),c=vd(),i!==null&&!Mt?(yd(i,n,d),sn(i,n,d)):(ze&&c&&lc(n),n.flags|=1,Dt(i,n,a,d),n.child)}function Mg(i,n,a,c,d,f){return pr(n),n.updateQueue=null,a=Nm(n,c,a,d),Tm(i),c=vd(),i!==null&&!Mt?(yd(i,n,f),sn(i,n,f)):(ze&&c&&lc(n),n.flags|=1,Dt(i,n,a,f),n.child)}function Ag(i,n,a,c,d){if(pr(n),n.stateNode===null){var f=aa,_=a.contextType;typeof _=="object"&&_!==null&&(f=Yt(_)),f=new a(c,f),n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Dd,n.stateNode=f,f._reactInternals=n,f=n.stateNode,f.props=c,f.state=n.memoizedState,f.refs={},ld(n),_=a.contextType,f.context=typeof _=="object"&&_!==null?Yt(_):aa,f.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Nd(n,a,_,c),f.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(_=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),_!==f.state&&Dd.enqueueReplaceState(f,f.state,null),jl(n,c,f,d),kl(),f.state=n.memoizedState),typeof f.componentDidMount=="function"&&(n.flags|=4194308),c=!0}else if(i===null){f=n.stateNode;var k=n.memoizedProps,T=wr(a,k);f.props=T;var G=f.context,te=a.contextType;_=aa,typeof te=="object"&&te!==null&&(_=Yt(te));var re=a.getDerivedStateFromProps;te=typeof re=="function"||typeof f.getSnapshotBeforeUpdate=="function",k=n.pendingProps!==k,te||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(k||G!==_)&&mg(n,f,c,_),En=!1;var W=n.memoizedState;f.state=W,jl(n,c,f,d),kl(),G=n.memoizedState,k||W!==G||En?(typeof re=="function"&&(Nd(n,a,re,c),G=n.memoizedState),(T=En||pg(n,a,T,c,W,G,_))?(te||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(n.flags|=4194308)):(typeof f.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=G),f.props=c,f.state=G,f.context=_,c=T):(typeof f.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{f=n.stateNode,od(i,n),_=n.memoizedProps,te=wr(a,_),f.props=te,re=n.pendingProps,W=f.context,G=a.contextType,T=aa,typeof G=="object"&&G!==null&&(T=Yt(G)),k=a.getDerivedStateFromProps,(G=typeof k=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(_!==re||W!==T)&&mg(n,f,c,T),En=!1,W=n.memoizedState,f.state=W,jl(n,c,f,d),kl();var Q=n.memoizedState;_!==re||W!==Q||En||i!==null&&i.dependencies!==null&&hc(i.dependencies)?(typeof k=="function"&&(Nd(n,a,k,c),Q=n.memoizedState),(te=En||pg(n,a,te,c,W,Q,T)||i!==null&&i.dependencies!==null&&hc(i.dependencies))?(G||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(c,Q,T),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(c,Q,T)),typeof f.componentDidUpdate=="function"&&(n.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof f.componentDidUpdate!="function"||_===i.memoizedProps&&W===i.memoizedState||(n.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||_===i.memoizedProps&&W===i.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=Q),f.props=c,f.state=Q,f.context=T,c=te):(typeof f.componentDidUpdate!="function"||_===i.memoizedProps&&W===i.memoizedState||(n.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||_===i.memoizedProps&&W===i.memoizedState||(n.flags|=1024),c=!1)}return f=c,ga(i,n),c=(n.flags&128)!==0,f||c?(f=n.stateNode,a=c&&typeof a.getDerivedStateFromError!="function"?null:f.render(),n.flags|=1,i!==null&&c?(n.child=_r(n,i.child,null,d),n.child=_r(n,null,a,d)):Dt(i,n,a,d),n.memoizedState=f.state,i=n.child):i=sn(i,n,d),i}function Tg(i,n,a,c){return ur(),n.flags|=256,Dt(i,n,a,c),n.child}var Od={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zd(i){return{baseLanes:i,cachePool:_m()}}function Hd(i,n,a){return i=i!==null?i.childLanes&~a:0,n&&(i|=Pi),i}function Ng(i,n,a){var c=n.pendingProps,d=!1,f=(n.flags&128)!==0,_;if((_=f)||(_=i!==null&&i.memoizedState===null?!1:(Zt.current&2)!==0),_&&(d=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,i===null){if(ze){if(d?Nn(n):Dn(),(i=at)?(i=Jv(i,Ji),i=i!==null&&i.data!=="&"?i:null,i!==null&&(n.memoizedState={dehydrated:i,treeContext:Sn!==null?{id:bs,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},a=hm(i),a.return=n,n.child=a,Ht=n,at=null)):i=null,i===null)throw Cn(n);return Hf(i)?n.lanes=32:n.lanes=536870912,null}return f=c.children,c=c.fallback,d?(Dn(),d=n.mode,f=Tc({mode:"hidden",children:f},d),c=hr(c,d,a,null),f.return=n,c.return=n,f.sibling=c,n.child=f,c=n.child,c.memoizedState=zd(a),c.childLanes=Hd(i,_,a),n.memoizedState=Od,Nl(null,c)):(Nn(n),Id(n,f))}var k=i.memoizedState;if(k!==null){var T=k.dehydrated;if(T!==null)return B4(i,n,f,_,c,T,k,a)}return d?(Dn(),d=c.fallback,f=n.mode,k=i.child,T=k.sibling,c=Zs(k,{mode:"hidden",children:c.children}),c.subtreeFlags=k.subtreeFlags&1206910976,T!==null?d=Zs(T,d):(d=hr(d,f,a,null),d.flags|=2),d.return=n,c.return=n,c.sibling=d,n.child=c,Nl(null,c),c=n.child,d=i.child.memoizedState,d===null?d=zd(a):(f=d.cachePool,f!==null?(k=jt._currentValue,f=f.parent!==k?{parent:k,pool:k}:f):f=_m(),d={baseLanes:d.baseLanes|a,cachePool:f}),c.memoizedState=d,c.childLanes=Hd(i,_,a),n.memoizedState=Od,Nl(i.child,c)):(Nn(n),a=i.child,i=a.sibling,a=Zs(a,{mode:"visible",children:c.children}),a.return=n,a.sibling=null,i!==null&&(_=n.deletions,_===null?(n.deletions=[i],n.flags|=16):_.push(i)),n.child=a,n.memoizedState=null,a)}function Id(i,n){return n=Tc({mode:"visible",children:n},i.mode),n.return=i,i.child=n}function Tc(i,n){return i=Ci(22,i,null,n),i.lanes=0,i}function Nc(i,n,a){return _r(n,i.child,null,a),i=Id(n,n.pendingProps.children),i.flags|=2,n.memoizedState=null,i}function B4(i,n,a,c,d,f,_,k){if(a)return n.flags&256?(Nn(n),n.flags&=-257,Nc(i,n,k)):n.memoizedState!==null?(Dn(),n.child=i.child,n.flags|=128,null):(Dn(),f=d.fallback,_=n.mode,d=Tc({mode:"visible",children:d.children},_),f=hr(f,_,k,null),f.flags|=2,d.return=n,f.return=n,d.sibling=f,n.child=d,_r(n,i.child,null,k),d=n.child,d.memoizedState=zd(k),d.childLanes=Hd(i,c,k),n.memoizedState=Od,Nl(null,d));if(Nn(n),Hf(f)){if(c=f.nextSibling&&f.nextSibling.dataset,c)var T=c.dgst;return c=T,c!==""&&(d=Error(r(419)),d.stack="",d.digest=c,_l({value:d,source:null,stack:null})),Nc(i,n,k)}if(Mt||fr(i,n,k,!1),c=(k&i.childLanes)!==0,Mt||c){if(Tn.current!==null)return Nc(i,n,k);if(c=it,c!==null&&(d=f1(c,k),d!==0&&d!==_.retryLane))throw _.retryLane=d,cr(i,d),Mi(c,i,d),Ld;return zf(f)||Gc(),Nc(i,n,k)}return zf(f)?(n.flags|=192,n.child=i.child,null):(i=_.treeContext,at=ts(f.nextSibling),Ht=n,ze=!0,bn=null,Ji=!1,i!==null&&fm(n,i),n=Id(n,d.children),n.flags|=134221824,n)}function Dg(i,n,a){i.lanes|=n;var c=i.alternate;c!==null&&(c.lanes|=n),cc(i.return,n,a)}function Rg(i){for(var n=null;i!==null;){var a=i.alternate;a!==null&&yc(a)===null&&(n=i),i=i.sibling}return n}function Dc(i,n,a,c,d,f){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:d,treeForkCount:f}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=c,_.tail=a,_.tailMode=d,_.treeForkCount=f)}function Ud(i){var n=i.child;for(i.child=null;n!==null;){var a=n.sibling;n.sibling=i.child,i.child=n,n=a}}function Pd(i,n,a){var c=n.pendingProps,d=c.revealOrder,f=c.tail;c=c.children;var _=Zt.current;if(n.flags&128)return El(n,_),null;var k=(_&2)!==0;if(k?(_=_&1|2,n.flags|=128):_&=1,El(n,_),d==="backwards"&&i!==null?(Ud(i),Dt(i,n,c,a),Ud(i)):Dt(i,n,c,a),c=ze?yl:0,!k&&i!==null&&(i.flags&128)!==0)e:for(i=n.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Dg(i,a,n);else if(i.tag===19)Dg(i,a,n);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(d){case"backwards":a=Rg(n.child),a===null?(d=n.child,n.child=null):(d=a.sibling,a.sibling=null,Ud(n)),Dc(n,!0,d,null,f,c);break;case"unstable_legacy-backwards":for(a=null,d=n.child,n.child=null;d!==null;){if(i=d.alternate,i!==null&&yc(i)===null){n.child=d;break}i=d.sibling,d.sibling=a,a=d,d=i}Dc(n,!0,a,null,f,c);break;case"together":Dc(n,!1,null,null,void 0,c);break;case"independent":n.memoizedState=null;break;default:a=Rg(n.child),a===null?(d=n.child,n.child=null):(d=a.sibling,a.sibling=null),Dc(n,!1,d,a,f,c)}return n.child}function Lg(i,n,a){var c=n.pendingProps;return kn(n,n.type,c.value),Dt(i,n,c.children,a),n.child}function sn(i,n,a){if(i!==null&&(n.dependencies=i.dependencies),On|=n.lanes,(a&n.childLanes)===0)if(i!==null){if(fr(i,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(i!==null&&n.child!==i.child)throw Error(r(153));if(n.child!==null){for(i=n.child,a=Zs(i,i.pendingProps),n.child=a,a.return=n;i.sibling!==null;)i=i.sibling,a=a.sibling=Zs(i,i.pendingProps),a.return=n;a.sibling=null}return n.child}function qd(i,n){return(i.lanes&n)!==0?!0:(i=i.dependencies,!!(i!==null&&hc(i)))}function O4(i,n,a){switch(n.tag){case 3:ge(n,n.stateNode.containerInfo),kn(n,jt,i.memoizedState.cache),ur();break;case 27:case 5:ai(n);break;case 4:ge(n,n.stateNode.containerInfo);break;case 10:kn(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,fd(n),null;break;case 13:var c=n.memoizedState;if(c!==null){if(c.dehydrated!==null)return Nn(n),n.flags|=128,null;c=fr(i,n,a,!1);var d=n.child.childLanes;return c||(a&d)!==0?Ng(i,n,a):(Nn(n),i=sn(i,n,a),i!==null?i.sibling:null)}Nn(n);break;case 19:if(n.flags&128)return Pd(i,n,a);if(d=(i.flags&128)!==0,c=(a&n.childLanes)!==0,c||(fr(i,n,a,!1),c=(a&n.childLanes)!==0),d){if(c)return Pd(i,n,a);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),El(n,Zt.current),c)break;return null;case 22:return n.lanes=0,kg(i,n,a,n.pendingProps);case 24:kn(n,jt,i.memoizedState.cache)}return sn(i,n,a)}function Bg(i,n,a){if(i!==null)if(i.memoizedProps!==n.pendingProps)Mt=!0;else{if(!qd(i,a)&&(n.flags&128)===0)return Mt=!1,O4(i,n,a);Mt=(i.flags&131072)!==0}else Mt=!1,ze&&(n.flags&1048576)!==0&&dm(n,yl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var c=n.pendingProps;if(i=vr(n.elementType),n.type=i,typeof i=="function")Gu(i)?(c=wr(i,c),n.tag=1,n=Ag(null,n,i,c,a)):(n.tag=0,n=Bd(null,n,i,c,a));else{if(i!=null){var d=i.$$typeof;if(d===V){n.tag=11,n=Sg(null,n,i,c,a);break e}else if(d===ce){n.tag=14,n=bg(null,n,i,c,a);break e}else if(d===X){n.tag=10,n.type=i,n=Lg(null,n,a);break e}}throw n=pe(i)||i,Error(r(306,n,""))}}return n;case 0:return Bd(i,n,n.type,n.pendingProps,a);case 1:return c=n.type,d=wr(c,n.pendingProps),Ag(i,n,c,d,a);case 3:e:{if(ge(n,n.stateNode.containerInfo),i===null)throw Error(r(387));c=n.pendingProps;var f=n.memoizedState;d=f.element,od(i,n),jl(n,c,null,a);var _=n.memoizedState;if(c=_.cache,kn(n,jt,c),c!==f.cache&&id(n,[jt],a,!0),kl(),c=_.element,f.isDehydrated)if(f={element:c,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=f,n.memoizedState=f,n.flags&256){n=Tg(i,n,c,a);break e}else if(c!==d){d=Zi(Error(r(424)),n),_l(d),n=Tg(i,n,c,a);break e}else for(i=n.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,at=ts(i.firstChild),Ht=n,ze=!0,bn=null,Ji=!0,a=km(n,null,c,a),n.child=a;a;)a.flags=a.flags&-3|134221824,a=a.sibling;else{if(ur(),c===d){n=sn(i,n,a);break e}Dt(i,n,c,a)}n=n.child}return n;case 26:return ga(i,n),i===null?(a=ay(n.type,null,n.pendingProps,null))?n.memoizedState=a:ze||(n.stateNode=Iv(n.type,n.pendingProps,Di.current,n)):n.memoizedState=ay(n.type,i.memoizedProps,n.pendingProps,i.memoizedState),null;case 27:return ai(n),i===null&&ze&&(c=n.stateNode=iy(n.type,n.pendingProps,Di.current),Ht=n,Ji=!0,d=at,Un(n.type)?(If=d,at=ts(c.firstChild)):at=d),Dt(i,n,n.pendingProps.children,a),ga(i,n),i===null&&(n.flags|=4194304),n.child;case 5:return i===null&&ze&&((d=c=at)&&(c=T5(c,n.type,n.pendingProps,Ji),c!==null?(n.stateNode=c,Ht=n,at=ts(c.firstChild),Ji=!1,d=!0):d=!1),d||Cn(n)),ai(n),d=n.type,f=n.pendingProps,_=i!==null?i.memoizedProps:null,c=f.children,Tf(d,f)?c=null:_!==null&&Tf(d,_)&&(n.flags|=32),n.memoizedState!==null&&(d=gd(i,n,k4,null,null,a),La._currentValue=d),ga(i,n),Dt(i,n,c,a),n.child;case 6:return i===null&&ze&&((i=a=at)&&(a=N5(a,n.pendingProps,Ji),a!==null?(n.stateNode=a,Ht=n,at=null,i=!0):i=!1),i||Cn(n)),null;case 13:return Ng(i,n,a);case 4:return ge(n,n.stateNode.containerInfo),c=n.pendingProps,i===null?n.child=_r(n,null,c,a):Dt(i,n,c,a),n.child;case 11:return Sg(i,n,n.type,n.pendingProps,a);case 7:return c=n.pendingProps,ga(i,n),Dt(i,n,c,a),n.child;case 8:return Dt(i,n,n.pendingProps.children,a),n.child;case 12:return Dt(i,n,n.pendingProps.children,a),n.child;case 10:return Lg(i,n,a);case 9:return d=n.type._context,c=n.pendingProps.children,pr(n),d=Yt(d),c=c(d),n.flags|=1,Dt(i,n,c,a),n.child;case 14:return bg(i,n,n.type,n.pendingProps,a);case 15:return Cg(i,n,n.type,n.pendingProps,a);case 19:return Pd(i,n,a);case 31:return L4(i,n,a);case 22:return kg(i,n,a,n.pendingProps);case 24:return pr(n),c=Yt(jt),i===null?(d=rd(),d===null&&(d=it,f=sd(),d.pooledCache=f,f.refCount++,f!==null&&(d.pooledCacheLanes|=a),d=f),n.memoizedState={parent:c,cache:d},ld(n),kn(n,jt,d)):((i.lanes&a)!==0&&(od(i,n),jl(n,null,null,a),kl()),d=i.memoizedState,f=n.memoizedState,d.parent!==c?(d={parent:c,cache:c},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),kn(n,jt,c)):(c=f.cache,kn(n,jt,c),c!==d.cache&&id(n,[jt],a,!0))),Dt(i,n,n.pendingProps.children,a),n.child;case 30:return n.stateNode===null&&(n.stateNode={autoName:null,paired:null,clones:null,ref:null}),c=n.pendingProps,c.name!=null&&c.name!=="auto"?n.flags|=i===null?18882560:18874368:ze&&lc(n),i!==null&&i.memoizedProps.name!==c.name?n.flags|=4194816:ga(i,n),Dt(i,n,c.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function nn(i){i.flags|=4}function Vd(i,n,a,c,d){var f;if((f=(i.mode&32)!==0)&&(f=a===null?hy(n,c):hy(n,c)&&(c.src!==a.src||c.srcSet!==a.srcSet)),f){if(i.flags|=16777216,(d&335544128)===d)if(i.stateNode.complete)i.flags|=8192;else if(gv())i.flags|=8192;else throw yr=pc,ad}else i.flags&=-16777217}function Og(i,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!uy(n))if(gv())i.flags|=8192;else throw yr=pc,ad}function Rc(i,n){n!==null&&(i.flags|=4),i.flags&16384&&(n=i.tag!==22?h1():536870912,i.lanes|=n,wa|=n)}function Dl(i,n){if(!ze)switch(i.tailMode){case"visible":break;case"collapsed":for(var a=i.tail,c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null;break;default:for(n=i.tail,a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?i.tail=null:a.sibling=null}}function lt(i){var n=i.alternate!==null&&i.alternate.child===i.child,a=0,c=0;if(n)for(var d=i.child;d!==null;)a|=d.lanes|d.childLanes,c|=d.subtreeFlags&1206910976,c|=d.flags&1206910976,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)a|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=c,i.childLanes=a,n}function z4(i,n,a){var c=n.pendingProps;switch(Qu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(n),null;case 1:return lt(n),null;case 3:return a=n.stateNode,c=null,i!==null&&(c=i.memoizedState.cache),n.memoizedState.cache!==c&&(n.flags|=2048),Js(jt),ot(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(ca(n)?nn(n):i===null||i.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ed())),lt(n),null;case 26:var d=n.type,f=n.memoizedState;return i===null?(nn(n),f!==null?(lt(n),Og(n,f)):(lt(n),Vd(n,d,null,c,a))):f?f!==i.memoizedState?(nn(n),lt(n),Og(n,f)):(lt(n),n.flags&=-16777217):(i=i.memoizedProps,i!==c&&nn(n),lt(n),Vd(n,d,i,c,a)),null;case 27:if(Fr(n),a=Di.current,d=n.type,i!==null&&n.stateNode!=null)i.memoizedProps!==c&&nn(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return lt(n),n.subtreeFlags&=-33554433,null}i=Si.current,ca(n)?pm(n):(i=iy(d,c,a),n.stateNode=i,nn(n))}return lt(n),n.subtreeFlags&=-33554433,null;case 5:if(Fr(n),d=n.type,i!==null&&n.stateNode!=null)i.memoizedProps!==c&&nn(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return lt(n),n.subtreeFlags&=-33554433,null}if(f=Si.current,ca(n))pm(n);else{var _=Vl(Di.current);switch(f){case 1:f=_.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:f=_.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":f=_.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":f=_.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":f=_.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof c.is=="string"?_.createElement("select",{is:c.is}):_.createElement("select"),c.multiple?f.multiple=!0:c.size&&(f.size=c.size);break;default:f=typeof c.is=="string"?_.createElement(d,{is:c.is}):_.createElement(d)}}f[Kt]=n,f[bi]=c;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)f.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=f;e:switch(Qt(f,d,c),d){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&nn(n)}}return lt(n),n.subtreeFlags&=-33554433,Vd(n,n.type,i===null?null:i.memoizedProps,n.pendingProps,a),null;case 6:if(i&&n.stateNode!=null)i.memoizedProps!==c&&nn(n);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(i=Di.current,ca(n)){if(i=n.stateNode,a=n.memoizedProps,c=null,d=Ht,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}i[Kt]=n,i=!!(i.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||Bv(i.nodeValue,a)),i||Cn(n,!0)}else i=Vl(i).createTextNode(c),i[Kt]=n,n.stateNode=i}return lt(n),null;case 31:if(a=n.memoizedState,i===null||i.memoizedState!==null){if(c=ca(n),a!==null){if(i===null){if(!c)throw Error(r(318));if(i=n.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Kt]=n}else ur(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;lt(n),i=!1}else a=ed(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=a),i=!0;if(!i)return n.flags&256?(Hi(n),n):(Hi(n),null);if((n.flags&128)!==0)throw Error(r(558))}return lt(n),null;case 13:if(c=n.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=ca(n),c!==null&&c.dehydrated!==null){if(i===null){if(!d)throw Error(r(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[Kt]=n}else ur(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;lt(n),d=!1}else d=ed(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(Hi(n),n):(Hi(n),null)}return Hi(n),(n.flags&128)!==0?(n.lanes=a,n):(a=c!==null,i=i!==null&&i.memoizedState!==null,a&&(c=n.child,d=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(d=c.alternate.memoizedState.cachePool.pool),f=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(f=c.memoizedState.cachePool.pool),f!==d&&(c.flags|=2048)),a!==i&&a&&(n.child.flags|=8192),Rc(n,n.updateQueue),lt(n),null);case 4:return ot(),i===null&&kf(n.stateNode.containerInfo),n.flags|=67108864,lt(n),null;case 10:return Js(n.type),lt(n),null;case 19:if(pd(n),c=n.memoizedState,c===null)return lt(n),null;if(d=(n.flags&128)!==0,f=c.rendering,f===null)if(d)Dl(c,!1);else{if(xt!==0||i!==null&&(i.flags&128)!==0)for(i=n.child;i!==null;){if(f=yc(i),f!==null){for(n.flags|=128,Dl(c,!1),i=f.updateQueue,n.updateQueue=i,Rc(n,i),n.subtreeFlags=0,i=a,a=n.child;a!==null;)cm(a,i),a=a.sibling;return El(n,Zt.current&1|2),ze&&Xs(n,c.treeForkCount),n.child}i=i.sibling}c.tail!==null&&Ri()>Wc&&(n.flags|=128,d=!0,Dl(c,!1),n.lanes=4194304)}else{if(!d)if(i=yc(f),i!==null){if(n.flags|=128,d=!0,i=i.updateQueue,n.updateQueue=i,Rc(n,i),Dl(c,!0),c.tail===null&&c.tailMode!=="collapsed"&&c.tailMode!=="visible"&&!f.alternate&&!ze)return lt(n),null}else 2*Ri()-c.renderingStartTime>Wc&&a!==536870912&&(n.flags|=128,d=!0,Dl(c,!1),n.lanes=4194304);c.isBackwards?(f.sibling=n.child,n.child=f):(i=c.last,i!==null?i.sibling=f:n.child=f,c.last=f)}if(c.tail!==null){i=c.tail;e:{for(a=i;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return c.rendering=i,c.tail=i.sibling,c.renderingStartTime=Ri(),i.sibling=null,f=Zt.current,f=d?f&1|2:f&1,c.tailMode==="visible"||c.tailMode==="collapsed"||!a||ze?El(n,f):(a=f,Ye(Gt,n),Ye(Zt,a),li===null&&(li=n)),ze&&Xs(n,c.treeForkCount),i}return lt(n),null;case 22:case 23:return Hi(n),dd(),c=n.memoizedState!==null,i!==null?i.memoizedState!==null!==c&&(n.flags|=8192):c&&(n.flags|=8192),c?(a&536870912)!==0&&(n.flags&128)===0&&(lt(n),n.subtreeFlags&6&&(n.flags|=8192)):lt(n),a=n.updateQueue,a!==null&&Rc(n,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==a&&(n.flags|=2048),i!==null&&mt(gr),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Js(jt),lt(n),null;case 25:return null;case 30:return n.flags|=33554432,lt(n),null}throw Error(r(156,n.tag))}function H4(i,n){switch(Qu(n),n.tag){case 1:return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 3:return Js(jt),ot(),i=n.flags,(i&65536)!==0&&(i&128)===0?(n.flags=i&-65537|128,n):null;case 26:case 27:case 5:return Fr(n),null;case 31:if(n.memoizedState!==null){if(Hi(n),n.alternate===null)throw Error(r(340));ur()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 13:if(Hi(n),i=n.memoizedState,i!==null&&i.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ur()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 19:return pd(n),i=n.flags,i&65536?(n.flags=i&-65537|128,i=n.memoizedState,i!==null&&(i.rendering=null,i.tail=null),n.flags|=4,n):null;case 4:return ot(),null;case 10:return Js(n.type),null;case 22:case 23:return Hi(n),dd(),i!==null&&mt(gr),i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 24:return Js(jt),null;case 25:return null;default:return null}}function zg(i,n){switch(Qu(n),n.tag){case 3:Js(jt),ot();break;case 26:case 27:case 5:Fr(n);break;case 4:ot();break;case 31:n.memoizedState!==null&&Hi(n);break;case 13:Hi(n);break;case 19:pd(n);break;case 10:Js(n.type);break;case 22:case 23:Hi(n),dd(),i!==null&&mt(gr);break;case 24:Js(jt)}}function Rl(i,n){try{var a=n.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var d=c.next;a=d;do{if((a.tag&i)===i){c=void 0;var f=a.create,_=a.inst;c=f(),_.destroy=c}a=a.next}while(a!==d)}}catch(k){Xe(n,n.return,k)}}function Rn(i,n,a){try{var c=n.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var f=d.next;c=f;do{if((c.tag&i)===i){var _=c.inst,k=_.destroy;if(k!==void 0){_.destroy=void 0,d=n;var T=a,G=k;try{G()}catch(te){Xe(d,T,te)}}}c=c.next}while(c!==f)}}catch(te){Xe(n,n.return,te)}}function Hg(i){var n=i.updateQueue;if(n!==null){var a=i.stateNode;try{Em(n,a)}catch(c){Xe(i,i.return,c)}}}function Ig(i,n,a){a.props=wr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(c){Xe(i,n,c)}}function ks(i,n){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var c=i.stateNode;break;case 30:var d=i.stateNode,f=Ys(i.memoizedProps,d);(d.ref===null||d.ref.name!==f)&&(d.ref=Fv(f)),c=d.ref;break;case 7:if(i.stateNode===null){var _=new Vi(i);v(i.child,!1,M5,_,void 0,void 0),i.stateNode=_}c=i.stateNode;break;default:c=i.stateNode}typeof a=="function"?i.refCleanup=a(c):a.current=c}}catch(k){Xe(i,n,k)}}function Xt(i,n){var a=i.ref,c=i.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(d){Xe(i,n,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){Xe(i,n,d)}else a.current=null}function Lc(i,n){if((i.tag===5||i.tag===27||i.tag===6)&&i.alternate===null&&n!==null)for(var a=0;a<n.length;a++)Qv(i.stateNode,n[a])}function Ug(i){for(var n=i.return;n!==null&&(Wd(n)&&Qv(i.stateNode,n.stateNode),!$d(n));)n=n.return}function Ll(i){for(var n=i.return;n!==null&&(Wd(n)&&A5(i.stateNode,n.stateNode),!$d(n));)n=n.return}function $d(i){return i.tag===5||i.tag===3||i.tag===27}function Wd(i){return i&&i.tag===7&&i.stateNode!==null}function Fd(i){var n=i.type,a=i.memoizedProps,c=i.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(d){Xe(i,i.return,d)}}function Kd(i,n,a){try{var c=i.stateNode;h5(c,i.type,a,n),c[bi]=n}catch(d){Xe(i,i.return,d)}}function Pg(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Un(i.type)||i.tag===4}function Yd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Pg(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Un(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Gd(i,n,a,c){var d=i.tag;if(d===5||d===6)d=i.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(d,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(d),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Ss)),Lc(i,c),Fe=!0;else if(d!==4&&(d===27&&(Lc(i,c),c=null,Un(i.type)&&(a=i.stateNode,n=null)),i=i.child,i!==null))for(Gd(i,n,a,c),i=i.sibling;i!==null;)Gd(i,n,a,c),i=i.sibling}function Bc(i,n,a,c){var d=i.tag;if(d===5||d===6)d=i.stateNode,n?a.insertBefore(d,n):a.appendChild(d),Lc(i,c),Fe=!0;else if(d!==4&&(d===27&&(Lc(i,c),c=null,Un(i.type)&&(a=i.stateNode)),i=i.child,i!==null))for(Bc(i,n,a,c),i=i.sibling;i!==null;)Bc(i,n,a,c),i=i.sibling}function qg(i){var n=i.stateNode,a=i.memoizedProps;try{for(var c=i.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);Qt(n,c,a),n[Kt]=i,n[bi]=a}catch(f){Xe(i,i.return,f)}}var Oc=!1,Ii=null;function Vg(i){(i.tag===30||(i.subtreeFlags&33554432)!==0)&&(Oc=!0)}var js=null;function $g(){var i=js;return js=null,i}var ki=0;function va(i,n,a,c,d){return ki=0,Wg(i.child,n,a,c,d)}function Wg(i,n,a,c,d){for(var f=!1;i!==null;){if(i.tag===5){var _=i.stateNode;if(c!==null){var k=Rf(_);c.push(k),k.view&&(f=!0)}else f||Rf(_).view&&(f=!0);Oc=!0,$v(_,ki===0?n:n+"_"+ki,a),ki++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&d||Wg(i.child,n,a,c,d)&&(f=!0));i=i.sibling}return f}function Es(i,n){for(;i!==null;)i.tag===5?Wv(i.stateNode,i.memoizedProps):(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&n||Es(i.child,n)),i=i.sibling}function zc(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if((i.tag!==22||i.memoizedState===null)&&(zc(i),i.tag===30&&(i.flags&18874368)!==0&&i.stateNode.paired)){var n=i.memoizedProps;if(n.name==null||n.name==="auto")throw Error(r(544));var a=n.name;n=Gs(n.default,n.share),n!=="none"&&(va(i,a,n,null,!1)||Es(i.child,!1))}i=i.sibling}}function Zd(i,n){if(i.tag===30){var a=i.stateNode,c=i.memoizedProps,d=Ys(c,a),f=Gs(c.default,a.paired?c.share:c.enter);f!=="none"?va(i,d,f,null,!1)?(zc(i),a.paired||n||ka(i,c.onEnter)):Es(i.child,!1):zc(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Zd(i,n),i=i.sibling;else zc(i)}function Xd(i){if(Ii!==null&&Ii.size!==0){var n=Ii;if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var a=i.memoizedProps,c=a.name;if(c!=null&&c!=="auto"){var d=n.get(c);if(d!==void 0){var f=Gs(a.default,a.share);if(f!=="none"&&(va(i,c,f,null,!1)?(f=i.stateNode,d.paired=f,f.paired=d,ka(i,a.onShare)):Es(i.child,!1)),n.delete(c),n.size===0)break}}}Xd(i)}i=i.sibling}}}function Qd(i){if(i.tag===30){var n=i.memoizedProps,a=Ys(n,i.stateNode),c=Ii!==null?Ii.get(a):void 0,d=Gs(n.default,c!==void 0?n.share:n.exit);d!=="none"&&(va(i,a,d,null,!1)?c!==void 0?(d=i.stateNode,c.paired=d,d.paired=c,Ii.delete(a),ka(i,n.onShare)):ka(i,n.onExit):Es(i.child,!1)),Ii!==null&&Xd(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Qd(i),i=i.sibling;else Ii!==null&&Xd(i)}function Fg(i){for(i=i.child;i!==null;){if(i.tag===30){var n=i.memoizedProps,a=Ys(n,i.stateNode);n=Gs(n.default,n.update),i.flags&=-5,n!=="none"&&va(i,a,n,i.memoizedState=[],!1)}else(i.subtreeFlags&33554432)!==0&&Fg(i);i=i.sibling}}function Jd(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var n=i.stateNode;n.paired!==null&&(n.paired=null,Es(i.child,!1))}Jd(i)}i=i.sibling}}function Hc(i){if(i.tag===30)i.stateNode.paired=null,Es(i.child,!1),Jd(i);else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Hc(i),i=i.sibling;else Jd(i)}function Kg(i){for(i=i.child;i!==null;)i.tag===30?Es(i.child,!1):(i.subtreeFlags&33554432)!==0&&Kg(i),i=i.sibling}function ef(i,n,a,c,d,f,_){for(var k=!1;n!==null;){if(n.tag===5){var T=n.stateNode;if(f!==null&&ki<f.length){var G=f[ki],te=Rf(T);(G.view||te.view)&&(k=!0);var re;if(re=(i.flags&4)===0)if(te.clip)re=!0;else{re=G.rect;var W=te.rect;re=re.y!==W.y||re.x!==W.x||re.height!==W.height||re.width!==W.width}re&&(i.flags|=4),te.abs?te=!G.abs:(G=G.rect,te=te.rect,te=G.height!==te.height||G.width!==te.width),te&&(i.flags|=32)}else i.flags|=32;(i.flags&4)!==0&&$v(T,ki===0?a:a+"_"+ki,d),k&&(i.flags&4)!==0||(js===null&&(js=[]),js.push(T,ki===0?c:c+"_"+ki,n.memoizedProps)),ki++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&_?i.flags|=n.flags&32:ef(i,n.child,a,c,d,f,_)&&(k=!0));n=n.sibling}return k}function Yg(i,n){for(i=i.child;i!==null;){if(i.tag===30){var a=i.memoizedProps,c=i.stateNode,d=Ys(a,c),f=Gs(a.default,a.update),_;_=i.memoizedState,i.memoizedState=null,c=i;var k=i.child;ki=0,d=ef(c,k,d,d,f,_,!1),(i.flags&4)!==0&&d&&ka(i,a.onUpdate)}else(i.subtreeFlags&33554432)!==0&&Yg(i);i=i.sibling}}var It=!1,Ge=!1,Ms=!1,tf=!1,Gg=typeof WeakSet=="function"?WeakSet:Set,Ut=null,As=!1,Bl=!1,Ic=!1,sf=!1;function I4(i,n,a){if(i=i.containerInfo,Mf=Ba,i=J1(i),qu(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var f=d.anchorOffset,_=d.focusNode;d=d.focusOffset;try{c.nodeType,_.nodeType}catch{c=null;break e}var k=0,T=-1,G=-1,te=0,re=0,W=i,Q=null;t:for(;;){for(var fe;W!==c||f!==0&&W.nodeType!==3||(T=k+f),W!==_||d!==0&&W.nodeType!==3||(G=k+d),W.nodeType===3&&(k+=W.nodeValue.length),(fe=W.firstChild)!==null;)Q=W,W=fe;for(;;){if(W===i)break t;if(Q===c&&++te===f&&(T=k),Q===_&&++re===d&&(G=k),(fe=W.nextSibling)!==null)break;W=Q,Q=W.parentNode}W=fe}c=T===-1||G===-1?null:{start:T,end:G}}else c=null}c=c||{start:0,end:0}}else c=null;for(Af={focusedElem:i,selectionRange:c},Ba=!1,a=(a&335544064)===a,Ut=n,n=a?9270:1024;Ut!==null;){if(i=Ut,a&&(c=i.deletions,c!==null))for(f=0;f<c.length;f++)a&&Qd(c[f]);if(i.alternate===null&&(i.flags&2)!==0)a&&Vg(i),Uc(a);else{if(i.tag===22){if(c=i.alternate,i.memoizedState!==null){c!==null&&c.memoizedState===null&&a&&Qd(c),Uc(a);continue}else if(c!==null&&c.memoizedState!==null){a&&Vg(i),Uc(a);continue}}c=i.child,(i.subtreeFlags&n)!==0&&c!==null?(c.return=i,Ut=c):(a&&Fg(i),Uc(a))}}Ii=null}function Uc(i){for(;Ut!==null;){var n=Ut,a=i,c=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 15:break;case 1:if((d&1024)!==0&&c!==null){a=void 0,d=c.memoizedProps,c=c.memoizedState;var f=n.stateNode;try{var _=wr(n.type,d);a=f.getSnapshotBeforeUpdate(_,c),f.__reactInternalSnapshotBeforeUpdate=a}catch(k){Xe(n,n.return,k)}}break;case 3:if((d&1024)!==0){if(c=n.stateNode.containerInfo,a=c.nodeType,a===9)Of(c);else if(a===1)switch(c.nodeName){case"HEAD":case"HTML":case"BODY":Of(c);break;default:c.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:a&&c!==null&&(a=Ys(c.memoizedProps,c.stateNode),d=n.memoizedProps,d=Gs(d.default,d.update),d!=="none"&&va(c,a,d,c.memoizedState=[],!0));break;default:if((d&1024)!==0)throw Error(r(163))}if(c=n.sibling,c!==null){c.return=n.return,Ut=c;break}Ut=n.return}}function Zg(i,n,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:Ts(i,a),c&4&&Rl(5,a);break;case 1:if(Ts(i,a),c&4)if(i=a.stateNode,n===null)try{i.componentDidMount()}catch(_){Xe(a,a.return,_)}else{var d=wr(a.type,n.memoizedProps);n=n.memoizedState;try{i.componentDidUpdate(d,n,i.__reactInternalSnapshotBeforeUpdate)}catch(_){Xe(a,a.return,_)}}c&64&&Hg(a),c&512&&ks(a,a.return);break;case 3:if(Ts(i,a),c&64&&(i=a.updateQueue,i!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Em(i,n)}catch(_){Xe(a,a.return,_)}}break;case 27:n===null&&c&4&&qg(a);case 26:case 5:Ts(i,a),n===null&&c&4&&Fd(a),c&512&&ks(a,a.return);break;case 12:Ts(i,a);break;case 31:Ts(i,a),c&4&&ev(i,a);break;case 13:Ts(i,a),c&4&&tv(i,a),c&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=X4.bind(null,a),D5(i,a))));break;case 22:if(c=a.memoizedState!==null||It,!c){var f=n!==null&&n.memoizedState!==null||Ge;n=It,d=Ge,It=c,(Ge=f)&&!d?(c=2,(a.subtreeFlags&8772)!==0&&(c|=1),ps(i,a,c)):Ts(i,a),It=n,Ge=d}break;case 30:Ts(i,a),c&512&&ks(a,a.return);break;case 7:c&512&&ks(a,a.return);default:Ts(i,a)}}function nf(i,n){for(i=i.child;i!==null;)Xg(i,n),i=i.sibling}function Xg(i,n){switch(i.tag){case 5:case 26:try{var a=i.stateNode;if(n){var c=a.style;typeof c.setProperty=="function"?c.setProperty("display","none","important"):c.display="none"}else{var d=i.stateNode,f=i.memoizedProps.style,_=f!=null&&f.hasOwnProperty("display")?f.display:null;d.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(T){Xe(i,i.return,T)}rf(i,n);break;case 6:try{i.stateNode.nodeValue=n?"":i.memoizedProps,Fe=!0}catch(T){Xe(i,i.return,T)}break;case 18:try{var k=i.stateNode;n?Vv(k,!0):Vv(i.stateNode,!1)}catch(T){Xe(i,i.return,T)}break;case 22:case 23:i.memoizedState===null&&nf(i,n);break;default:nf(i,n)}}function rf(i,n){if(i.subtreeFlags&67108864)for(i=i.child;i!==null;){e:{var a=i,c=n;switch(a.tag){case 4:Xg(a,c);break e;case 22:a.memoizedState===null&&rf(a,c);break e;default:rf(a,c)}}i=i.sibling}}function Qg(i){var n=i.alternate;n!==null&&(i.alternate=null,Qg(n)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(n=i.stateNode,n!==null&&Wo(n)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var dt=null,ji=!1;function ds(i,n,a){for(a=a.child;a!==null;)Jg(i,n,a),a=a.sibling}function Jg(i,n,a){if(Li&&typeof Li.onCommitFiberUnmount=="function")try{Li.onCommitFiberUnmount(nl,a)}catch{}switch(a.tag){case 26:Ge||Xt(a,n),ds(i,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&!Ge&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ge||Xt(a,n),Ll(a);var c=dt,d=ji;Un(a.type)&&(dt=a.stateNode,ji=!1),ds(i,n,a),sy(a.stateNode,a.type,a.memoizedProps),dt=c,ji=d;break;case 5:Ge||Xt(a,n),Ll(a);case 6:if(a.tag===6&&Ll(a),c=dt,d=ji,dt=null,ds(i,n,a),dt=c,ji=d,dt!==null)if(ji)try{(dt.nodeType===9?dt.body:dt.nodeName==="HTML"?dt.ownerDocument.body:dt).removeChild(a.stateNode),Fe=!0}catch(f){Xe(a,n,f)}else try{dt.removeChild(a.stateNode),Fe=!0}catch(f){Xe(a,n,f)}break;case 18:dt!==null&&(ji?(i=dt,qv(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Oa(i)):qv(dt,a.stateNode));break;case 4:c=dt,d=ji,dt=a.stateNode.containerInfo,ji=!0,ds(i,n,a),dt=c,ji=d;break;case 0:case 11:case 14:case 15:Rn(2,a,n),Ge||Rn(4,a,n),ds(i,n,a);break;case 1:Ge||(Xt(a,n),c=a.stateNode,typeof c.componentWillUnmount=="function"&&Ig(a,n,c)),ds(i,n,a);break;case 21:ds(i,n,a);break;case 22:Ge=(c=Ge)||a.memoizedState!==null,ds(i,n,a),Ge=c;break;case 30:Xt(a,n),ds(i,n,a);break;case 7:Ge||Xt(a,n),ds(i,n,a);break;default:ds(i,n,a)}}function ev(i,n){if(n.memoizedState===null&&(i=n.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Oa(i)}catch(a){Xe(n,n.return,a)}}}function tv(i,n){if(n.memoizedState===null&&(i=n.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Oa(i)}catch(a){Xe(n,n.return,a)}}function U4(i){switch(i.tag){case 31:case 13:case 19:var n=i.stateNode;return n===null&&(n=i.stateNode=new Gg),n;case 22:return i=i.stateNode,n=i._retryCache,n===null&&(n=i._retryCache=new Gg),n;default:throw Error(r(435,i.tag))}}function Pc(i,n){var a=U4(i);n.forEach(function(c){if(!a.has(c)){a.add(c);var d=Q4.bind(null,i,c);c.then(d,d)}})}function gi(i,n,a){var c=n.deletions;if(c!==null)for(var d=0;d<c.length;d++){var f=c[d],_=i,k=n,T=k;e:for(;T!==null;){switch(T.tag){case 27:if(Un(T.type)){dt=T.stateNode,ji=!1;break e}break;case 5:dt=T.stateNode,ji=!1;break e;case 3:case 4:dt=T.stateNode.containerInfo,ji=!0;break e}T=T.return}if(dt===null)throw Error(r(160));Jg(_,k,f),dt=null,ji=!1,_=f.alternate,_!==null&&(_.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)iv(n,i,a),n=n.sibling}var fs=null;function iv(i,n,a){var c=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(d&4&&(c=i.updateQueue,c=c!==null?c.events:null,c!==null))for(var f=0;f<c.length;f++){var _=c[f];_.ref.impl=_.nextImpl}gi(n,i,a),vi(i),d&4&&(Rn(3,i,i.return),Rl(3,i),Rn(5,i,i.return));break;case 1:gi(n,i,a),vi(i),d&512&&(Ge||c===null||Xt(c,c.return)),d&64&&It&&(i=i.updateQueue,i!==null&&(n=i.callbacks,n!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:if(f=fs,gi(n,i,a),vi(i),d&512&&(Ge||c===null||Xt(c,c.return)),d&4)if(d=c!==null?c.memoizedState:null,a=i.memoizedState,c===null)if(a===null)if(i.stateNode===null)if(It)i.stateNode=Iv(i.type,i.memoizedProps,n.containerInfo,i);else{e:{n=i.type,a=i.memoizedProps,d=f.ownerDocument||f;t:switch(n){case"title":c=d.getElementsByTagName("title")[0],(!c||c[ll]||c[Kt]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=d.createElement(n),d.head.insertBefore(c,d.querySelector("head > title"))),Qt(c,n,a),c[Kt]=i,zt(c),n=c;break e;case"link":if(f=cy("link","href",d).get(n+(a.href||""))){for(_=0;_<f.length;_++)if(c=f[_],c.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&c.getAttribute("rel")===(a.rel==null?null:a.rel)&&c.getAttribute("title")===(a.title==null?null:a.title)&&c.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(_,1);break t}}c=d.createElement(n),Qt(c,n,a),d.head.appendChild(c);break;case"meta":if(f=cy("meta","content",d).get(n+(a.content||""))){for(_=0;_<f.length;_++)if(c=f[_],c.getAttribute("content")===(a.content==null?null:""+a.content)&&c.getAttribute("name")===(a.name==null?null:a.name)&&c.getAttribute("property")===(a.property==null?null:a.property)&&c.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&c.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(_,1);break t}}c=d.createElement(n),Qt(c,n,a),d.head.appendChild(c);break;default:throw Error(r(468,n))}c[Kt]=i,zt(c),n=c}i.stateNode=n}else It||Vf(f,i.type,i.stateNode);else i.stateNode=oy(f,a,i.memoizedProps);else d!==a?(d===null?(n=c.stateNode,n===null||Ge||n.parentNode.removeChild(n)):d.count--,a===null?It||Vf(f,i.type,i.stateNode):oy(f,a,i.memoizedProps)):a===null&&i.stateNode!==null&&Kd(i,i.memoizedProps,c.memoizedProps);break;case 27:gi(n,i,a),vi(i),d&512&&(Ge||c===null||Xt(c,c.return)),c!==null&&d&4&&Kd(i,i.memoizedProps,c.memoizedProps);break;case 5:if(f=Ms,Ms=!1,gi(n,i,a),Ms=f,vi(i),d&512&&(Ge||c===null||Xt(c,c.return)),i.flags&32){n=i.stateNode;try{Jr(n,""),Fe=!0}catch(te){Xe(i,i.return,te)}}d&4&&i.stateNode!=null&&(n=i.memoizedProps,Kd(i,n,c!==null?c.memoizedProps:n)),d&1024&&(tf=!0);break;case 6:if(gi(n,i,a),vi(i),d&4){if(i.stateNode===null)throw Error(r(162));n=i.memoizedProps,a=i.stateNode;try{a.nodeValue=n,Fe=!0}catch(te){Xe(i,i.return,te)}}break;case 3:if(Fe=!1,ih=null,f=fs,fs=$l(n.containerInfo),gi(n,i,a),fs=f,vi(i),d&4&&c!==null&&c.memoizedState.isDehydrated)try{Oa(n.containerInfo)}catch(te){Xe(i,i.return,te)}tf&&(tf=!1,sv(i)),Fe=!1;break;case 4:d=Ms,Ms=It,c=b1(),f=fs,fs=$l(i.stateNode.containerInfo),gi(n,i,a),vi(i),fs=f,Fe&&Bl&&(Ic=!0),Fe=c,Ms=d;break;case 12:gi(n,i,a),vi(i);break;case 31:gi(n,i,a),vi(i),d&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,Pc(i,n)));break;case 13:gi(n,i,a),vi(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&($c=Ri()),d&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,Pc(i,n)));break;case 22:f=i.memoizedState!==null,_=c!==null&&c.memoizedState!==null;var k=It,T=Ge,G=Ms;It=k||f,Ms=G||f,Ge=T||_,gi(n,i,a),Ge=T,Ms=G,It=k,vi(i),d&8192&&(n=i.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,!f||c===null||_||It||Ge||(n=_||Ge,a=It,c=Ge,It=f||It,Ge=n,Ln(i,2),It=a,Ge=c),!f&&Ms||nf(i,f)),d&4&&(n=i.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,Pc(i,a))));break;case 19:gi(n,i,a),vi(i),d&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,Pc(i,n)));break;case 30:d&512&&(Ge||c===null||Xt(c,c.return)),d=b1(),f=Bl,_=(a&335544064)===a,k=i.memoizedProps,Bl=_&&Gs(k.default,k.update)!=="none",gi(n,i,a),vi(i),_&&c!==null&&Fe&&(i.flags|=4),Bl=f,Fe=d;break;case 21:break;case 7:d&512&&(Ge||c===null||Xt(c,c.return)),c&&c.stateNode!==null&&(c.stateNode._fragmentFiber=i);default:gi(n,i,a),vi(i)}}function vi(i){var n=i.flags;if(n&2){try{for(var a,c=i.return;c!==null;){if(Pg(c)){a=c;break}c=c.return}c=null;for(var d=i.return;d!==null;){if(Wd(d)){var f=d.stateNode;c===null?c=[f]:c.push(f)}if($d(d))break;d=d.return}var _=c;if(a==null)throw Error(r(160));switch(a.tag){case 27:var k=a.stateNode,T=Yd(i);Bc(i,T,k,_);break;case 5:var G=a.stateNode;a.flags&32&&(Jr(G,""),a.flags&=-33);var te=Yd(i);Bc(i,te,G,_);break;case 3:case 4:var re=a.stateNode.containerInfo,W=Yd(i);Gd(i,W,re,_);break;default:throw Error(r(161))}}catch(Q){Xe(i,i.return,Q)}i.flags&=-3}n&4096&&(i.flags&=-4097)}function sv(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var n=i;sv(n),n.tag===5&&n.flags&1024&&(n=n.stateNode,Ba=!0,n.reset(),Ba=!1),i=i.sibling}}function ya(i,n){if(n.subtreeFlags&9270)for(n=n.child;n!==null;)nv(n,i),n=n.sibling;else Yg(n)}function nv(i,n){var a=i.alternate;if(a===null)Zd(i,!1);else switch(i.tag){case 3:if(sf=As=!1,$g(),ya(n,i),!As&&!Ic){if(i=js,i!==null)for(var c=0;c<i.length;c+=3){a=i[c];var d=i[c+1];Wv(a,i[c+2]),a=a.ownerDocument.documentElement,a!==null&&a.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+d+")"})}i=n.containerInfo,i=i.nodeType===9?i.documentElement:i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName===""&&(i.style.viewTransitionName="none",i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),i.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),sf=!0}js=null;break;case 5:ya(n,i);break;case 4:c=As,As=!1,ya(n,i),As&&(Ic=!0),As=c;break;case 22:i.memoizedState===null&&(a.memoizedState!==null?Zd(i,!1):ya(n,i));break;case 30:c=As,d=$g(),As=!1,ya(n,i),As&&(i.flags|=4);var f=i.memoizedProps,_=i.stateNode;n=Ys(f,_),_=Ys(a.memoizedProps,_);var k=Gs(f.default,f.update);k==="none"?n=!1:(f=a.memoizedState,a.memoizedState=null,a=i.child,ki=0,n=ef(i,a,n,_,k,f,!0),ki!==(f===null?0:f.length)&&(i.flags|=32)),(i.flags&4)!==0&&n?(ka(i,i.memoizedProps.onUpdate),js=d):d!==null&&(d.push.apply(d,js),js=d),As=(i.flags&32)!==0?!0:c;break;default:ya(n,i)}}function Ts(i,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Zg(i,n.alternate,n),n=n.sibling}function Ln(i,n){for(i=i.child;i!==null;){var a=i,c=n;switch(a.tag){case 0:case 11:case 14:case 15:Rn(4,a,a.return),Ln(a,c);break;case 1:Xt(a,a.return);var d=a.stateNode;typeof d.componentWillUnmount=="function"&&Ig(a,a.return,d),Ln(a,c);break;case 27:(c&2)!==0&&sy(a.stateNode,a.type,a.memoizedProps);case 5:Xt(a,a.return),a.tag!==5&&a.tag!==27||Ll(a),Ln(a,c);break;case 6:Ll(a);break;case 26:Xt(a,a.return),d=a.stateNode,a.memoizedState!==null||d===null||Ge||d.parentNode.removeChild(d),Ln(a,c);break;case 22:a.memoizedState===null&&Ln(a,c);break;case 30:Xt(a,a.return),Ln(a,c);break;case 7:Xt(a,a.return);default:Ln(a,c)}i=i.sibling}}function ps(i,n,a){for(a=(n.subtreeFlags&8772)!==0?a:a&-2,n=n.child;n!==null;){var c=n.alternate,d=i,f=n,_=f.flags,k=(a&1)!==0;switch(f.tag){case 0:case 11:case 15:ps(d,f,a),Rl(4,f);break;case 1:if(ps(d,f,a),c=f,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(te){Xe(c,c.return,te)}if(c=f,d=c.updateQueue,d!==null){var T=c.stateNode;try{var G=d.shared.hiddenCallbacks;if(G!==null)for(d.shared.hiddenCallbacks=null,d=0;d<G.length;d++)jm(G[d],T)}catch(te){Xe(c,c.return,te)}}k&&_&64&&Hg(f),ks(f,f.return);break;case 27:(a&2)!==0&&qg(f);case 5:f.tag!==5&&f.tag!==27||Ug(f),ps(d,f,a),k&&c===null&&_&4&&Fd(f),ks(f,f.return);break;case 6:Ug(f);break;case 26:T=f.stateNode,f.memoizedState!==null||T===null||It||Vf($l(T.ownerDocument),f.type,T),ps(d,f,a),k&&c===null&&_&4&&Fd(f),ks(f,f.return);break;case 12:ps(d,f,a);break;case 31:ps(d,f,a),k&&_&4&&ev(d,f);break;case 13:ps(d,f,a),k&&_&4&&tv(d,f);break;case 22:f.memoizedState===null&&ps(d,f,a),ks(f,f.return);break;case 30:ps(d,f,a),ks(f,f.return);break;case 7:ks(f,f.return);default:ps(d,f,a)}n=n.sibling}}function af(i,n){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&xl(a))}function lf(i,n){i=null,n.alternate!==null&&(i=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==i&&(n.refCount++,i!=null&&xl(i))}function es(i,n,a,c){var d=(a&335544064)===a;if(n.subtreeFlags&(d?10262:10256))for(n=n.child;n!==null;)rv(i,n,a,c),n=n.sibling;else d&&Kg(n)}function rv(i,n,a,c){var d=(a&335544064)===a;d&&n.alternate===null&&n.return!==null&&n.return.alternate!==null&&Hc(n);var f=n.flags;switch(n.tag){case 0:case 11:case 15:es(i,n,a,c),f&2048&&Rl(9,n);break;case 1:es(i,n,a,c);break;case 3:es(i,n,a,c),d&&sf&&(i=i.containerInfo,i=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,i.style.viewTransitionName==="root"&&(i.style.viewTransitionName=""),i=i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName==="none"&&(i.style.viewTransitionName="")),f&2048&&(f=null,n.alternate!==null&&(f=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==f&&(n.refCount++,f!=null&&xl(f)));break;case 12:if(f&2048){es(i,n,a,c),f=n.stateNode;try{var _=n.memoizedProps,k=_.id,T=_.onPostCommit;typeof T=="function"&&T(k,n.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(G){Xe(n,n.return,G)}}else es(i,n,a,c);break;case 31:es(i,n,a,c);break;case 13:es(i,n,a,c);break;case 23:break;case 22:_=n.stateNode,k=n.alternate,n.memoizedState!==null?(d&&k!==null&&k.memoizedState===null&&Hc(k),_._visibility&2?es(i,n,a,c):Ol(i,n)):(d&&k!==null&&k.memoizedState!==null&&Hc(n),_._visibility&2?es(i,n,a,c):(_._visibility|=2,_a(i,n,a,c,(n.subtreeFlags&10256)!==0||!1))),f&2048&&af(k,n);break;case 24:es(i,n,a,c),f&2048&&lf(n.alternate,n);break;case 30:d&&(f=n.alternate,f!==null&&(Es(f.child,!0),Es(n.child,!0))),es(i,n,a,c);break;default:es(i,n,a,c)}}function _a(i,n,a,c,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var f=i,_=n,k=a,T=c,G=_.flags;switch(_.tag){case 0:case 11:case 15:_a(f,_,k,T,d),Rl(8,_);break;case 23:break;case 22:var te=_.stateNode;_.memoizedState!==null?te._visibility&2?_a(f,_,k,T,d):Ol(f,_):(te._visibility|=2,_a(f,_,k,T,d)),d&&G&2048&&af(_.alternate,_);break;case 24:_a(f,_,k,T,d),d&&G&2048&&lf(_.alternate,_);break;default:_a(f,_,k,T,d)}n=n.sibling}}function Ol(i,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=i,c=n,d=c.flags;switch(c.tag){case 22:Ol(a,c),d&2048&&af(c.alternate,c);break;case 24:Ol(a,c),d&2048&&lf(c.alternate,c);break;default:Ol(a,c)}n=n.sibling}}var Sr=8192;function br(i,n,a){if(i.subtreeFlags&Sr)for(i=i.child;i!==null;)av(i,n,a),i=i.sibling}function av(i,n,a){switch(i.tag){case 26:br(i,n,a),i.flags&Sr&&(i.memoizedState!==null?F5(a,fs,i.memoizedState,i.memoizedProps):(i=i.stateNode,(n&335544128)===n&&fy(a,i)));break;case 5:br(i,n,a),i.flags&Sr&&(i=i.stateNode,(n&335544128)===n&&fy(a,i));break;case 3:case 4:var c=fs;fs=$l(i.stateNode.containerInfo),br(i,n,a),fs=c;break;case 22:i.memoizedState===null&&(c=i.alternate,c!==null&&c.memoizedState!==null?(c=Sr,Sr=16777216,br(i,n,a),Sr=c):br(i,n,a));break;case 30:if((i.flags&Sr)!==0&&(c=i.memoizedProps.name,c!=null&&c!=="auto")){var d=i.stateNode;d.paired=null,Ii===null&&(Ii=new Map),Ii.set(c,d)}br(i,n,a);break;default:br(i,n,a)}}function lv(i){var n=i.alternate;if(n!==null&&(i=n.child,i!==null)){n.child=null;do n=i.sibling,i.sibling=null,i=n;while(i!==null)}}function zl(i){var n=i.deletions;if((i.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var c=n[a];Ut=c,cv(c,i)}lv(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)ov(i),i=i.sibling}function ov(i){switch(i.tag){case 0:case 11:case 15:zl(i),i.flags&2048&&Rn(9,i,i.return);break;case 3:zl(i);break;case 12:zl(i);break;case 22:var n=i.stateNode;i.memoizedState!==null&&n._visibility&2&&(i.return===null||i.return.tag!==13)?(n._visibility&=-3,qc(i)):zl(i);break;default:zl(i)}}function qc(i){var n=i.deletions;if((i.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var c=n[a];Ut=c,cv(c,i)}lv(i)}for(i=i.child;i!==null;){switch(n=i,n.tag){case 0:case 11:case 15:Rn(8,n,n.return),qc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,qc(n));break;default:qc(n)}i=i.sibling}}function cv(i,n){for(;Ut!==null;){var a=Ut;switch(a.tag){case 0:case 11:case 15:Rn(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var c=a.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:xl(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,Ut=c;else e:for(a=i;Ut!==null;){c=Ut;var d=c.sibling,f=c.return;if(Qg(c),c===a){Ut=null;break e}if(d!==null){d.return=f,Ut=d;break e}Ut=f}}}var P4={getCacheForType:function(i){var n=Yt(jt),a=n.data.get(i);return a===void 0&&(a=i(),n.data.set(i,a)),a},cacheSignal:function(){return Yt(jt).controller.signal}},q4=typeof WeakMap=="function"?WeakMap:Map,Ke=0,it=null,Ue=null,qe=0,Ze=0,Ui=null,Bn=!1,xa=!1,of=!1,rn=0,xt=0,On=0,Cr=0,Vc=0,Pi=0,wa=0,Hl=null,Ei=null,cf=!1,$c=0,hv=0,Wc=1/0,Fc=null,zn=null,gt=0,ms=null,kr=null,Ns=0,hf=0,uf=null,uv=null,Sa=null,ba=null,Ca=null,Il=0,Kc=null;function qi(){return(Ke&2)!==0&&qe!==0?qe&-qe:me.T!==null?wf():p1()}function dv(){if(Pi===0)if((qe&536870912)===0||ze){var i=Po;Po<<=1,(Po&3932160)===0&&(Po=262144),Pi=i}else Pi=536870912;return i=Gt.current,i!==null&&(i.flags|=32),Pi}function ka(i,n){if(n!=null){var a=i.stateNode,c=a.ref;c===null&&(c=a.ref=Fv(Ys(i.memoizedProps,a))),ba===null&&(ba=[]),ba.push(n.bind(null,c))}}function Mi(i,n,a){(i===it&&(Ze===2||Ze===9)||i.cancelPendingCommit!==null)&&(ja(i,0),Hn(i,qe,Pi,!1)),al(i,a),((Ke&2)===0||i!==it)&&(i===it&&((Ke&2)===0&&(Cr|=a),xt===4&&Hn(i,qe,Pi,!1)),Ds(i))}function fv(i,n,a){if((Ke&6)!==0)throw Error(r(327));var c=!a&&(n&127)===0&&(n&i.expiredLanes)===0||rl(i,n),d=c?W4(i,n):ff(i,n,!0),f=c;do{if(d===0){xa&&!c&&Hn(i,n,0,!1);break}else{if(a=i.current.alternate,f&&!V4(a)){d=ff(i,n,!1),f=!1;continue}if(d===2){if(f=n,i.errorRecoveryDisabledLanes&f)var _=0;else _=i.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var k=i;d=Hl;var T=k.current.memoizedState.isDehydrated;if(T&&(ja(k,_).flags|=256),_=ff(k,_,!1),_!==2&&_!==6){if(of&&!T){k.errorRecoveryDisabledLanes|=f,Cr|=f,d=4;break e}f=Ei,Ei=d,f!==null&&(Ei===null?Ei=f:Ei.push.apply(Ei,f))}d=_}if(f=!1,d!==2)continue}}if(d===1){ja(i,0),Hn(i,n,0,!0);break}e:{switch(c=i,f=d,f){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n&&(n&62914560)!==n)break;case 6:Hn(c,n,Pi,!Bn);break e;case 2:Ei=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(d=$c+300-Ri(),10<d)){if(Hn(c,n,Pi,!Bn),Vo(c,0,!0)!==0)break e;Ns=n,c.timeoutHandle=Df(pv.bind(null,c,a,Ei,Fc,cf,n,Pi,Cr,wa,Bn,f,"Throttled",-0,0),d);break e}pv(c,a,Ei,Fc,cf,n,Pi,Cr,wa,Bn,f,null,-0,0)}}break}while(!0);Ds(i)}function pv(i,n,a,c,d,f,_,k,T,G,te,re,W,Q){i.timeoutHandle=-1;var fe=n.subtreeFlags,Se=(f&335544064)===f;if(re=null,(Se||fe&8192||(fe&16785408)===16785408)&&(re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ss},Ii=null,av(n,f,re),Se&&(fe=re,Se=i.containerInfo,Se=(Se.nodeType===9?Se:Se.ownerDocument).__reactViewTransition,Se!=null&&(fe.count++,fe.waitingForViewTransition=!0,fe=Kl.bind(fe),Se.finished.then(fe,fe))),fe=(f&62914560)===f?$c-Ri():(f&4194048)===f?hv-Ri():0,fe=K5(re,fe),fe!==null)){Ns=f,i.cancelPendingCommit=fe(Sv.bind(null,i,n,f,a,c,d,_,k,T,G,te,re,null,W,Q)),Hn(i,f,_,!G);return}Sv(i,n,f,a,c,d,_,k,T,G,te,re)}function V4(i){for(var n=i;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var c=0;c<a.length;c++){var d=a[c],f=d.getSnapshot;d=d.value;try{if(!zi(f(),d))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Hn(i,n,a,c){n=c1(i,n),n&=~Vc,n&=~Cr,i.suspendedLanes|=n,i.pingedLanes&=~n,c&&(i.warmLanes|=n),c=i.expirationTimes;for(var d=n;0<d;){var f=31-Bi(d),_=1<<f;c[f]=-1,d&=~_}a!==0&&u1(i,a,n)}function Yc(){return(Ke&6)===0?(Ul(0),!1):!0}function df(){if(Ue!==null){if(Ze===0)var i=Ue.return;else i=Ue,Qs=dr=null,_d(i),da=null,bl=0,i=Ue;for(;i!==null;)zg(i.alternate,i),i=i.return;Ue=null}}function ja(i,n){var a=i.timeoutHandle;return a!==-1&&(i.timeoutHandle=-1,f5(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),Ns=0,df(),it=i,Ue=a=Zs(i.current,null),qe=n,Ze=0,Ui=null,Bn=!1,xa=rl(i,n),of=!1,wa=Pi=Vc=Cr=On=xt=0,Ei=Hl=null,cf=!1,rn=c1(i,n),ic(),a}function mv(i,n){Be=null,me.H=Ec,n===ua||n===fc?(n=Sm(),Ze=3):n===ad?(n=Sm(),Ze=4):Ze=n===Ld?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Ui=n,Ue===null&&(xt=1,Mc(i,Zi(n,i.current)))}function gv(){var i=Gt.current;return i===null?!0:(qe&4194048)===qe?li===null:(qe&62914560)===qe||(qe&536870912)!==0?i===li:!1}function vv(){var i=me.H;return me.H=Ec,i===null?Ec:i}function yv(){var i=me.A;return me.A=P4,i}function Gc(){xt=4,Bn||(qe&4194048)!==qe&&Gt.current!==null||(xa=!0),(On&134217727)===0&&(Cr&134217727)===0||it===null||Hn(it,qe,Pi,!1)}function ff(i,n,a){var c=Ke;Ke|=2;var d=vv(),f=yv();(it!==i||qe!==n)&&(Fc=null,ja(i,n)),n=!1;var _=xt;e:do try{if(Ze!==0&&Ue!==null){var k=Ue,T=Ui;switch(Ze){case 8:df(),_=6;break e;case 3:case 2:case 9:case 6:Gt.current===null&&(n=!0);var G=Ze;if(Ze=0,Ui=null,Ea(i,k,T,G),a&&xa){_=0;break e}break;default:G=Ze,Ze=0,Ui=null,Ea(i,k,T,G)}}$4(),_=xt;break}catch(te){mv(i,te)}while(!0);return n&&i.shellSuspendCounter++,Qs=dr=null,Ke=c,me.H=d,me.A=f,Ue===null&&(it=null,qe=0,ic()),_}function $4(){for(;Ue!==null;)_v(Ue)}function W4(i,n){var a=Ke;Ke|=2;var c=vv(),d=yv();it!==i||qe!==n?(Fc=null,Wc=Ri()+500,ja(i,n)):xa=rl(i,n);e:do try{if(Ze!==0&&Ue!==null){n=Ue;var f=Ui;t:switch(Ze){case 1:Ze=0,Ui=null,Ea(i,n,f,1);break;case 2:case 9:if(xm(f)){Ze=0,Ui=null,xv(n);break}n=function(){Ze!==2&&Ze!==9||it!==i||(Ze=7),Ds(i)},f.then(n,n);break e;case 3:Ze=7;break e;case 4:Ze=5;break e;case 7:xm(f)?(Ze=0,Ui=null,xv(n)):(Ze=0,Ui=null,Ea(i,n,f,7));break;case 5:var _=null;switch(Ue.tag){case 26:_=Ue.memoizedState;case 5:case 27:var k=Ue;if(_?uy(_):k.stateNode.complete){Ze=0,Ui=null;var T=k.sibling;if(T!==null)Ue=T;else{var G=k.return;G!==null?(Ue=G,Zc(G)):Ue=null}break t}}Ze=0,Ui=null,Ea(i,n,f,5);break;case 6:Ze=0,Ui=null,Ea(i,n,f,6);break;case 8:df(),xt=6;break e;default:throw Error(r(462))}}F4();break}catch(te){mv(i,te)}while(!0);return Qs=dr=null,me.H=c,me.A=d,Ke=a,Ue!==null?0:(it=null,qe=0,ic(),xt)}function F4(){for(;Ue!==null&&!cb();)_v(Ue)}function _v(i){var n=Bg(i.alternate,i,rn);i.memoizedProps=i.pendingProps,n===null?Zc(i):Ue=n}function xv(i){var n=i,a=n.alternate;switch(n.tag){case 15:case 0:n=Mg(a,n,n.pendingProps,n.type,void 0,qe);break;case 11:n=Mg(a,n,n.pendingProps,n.type.render,n.ref,qe);break;case 5:_d(n);var c=n;c===Ht&&(ze?(oc(c),c.tag===5&&c.stateNode!=null&&(at=c.stateNode)):(oc(c),ze=!0));default:zg(a,n),n=Ue=cm(n,rn),n=Bg(a,n,rn)}i.memoizedProps=i.pendingProps,n===null?Zc(i):Ue=n}function Ea(i,n,a,c){Qs=dr=null,_d(n),da=null,bl=0;var d=n.return;try{if(R4(i,d,n,a,qe)){xt=1,Mc(i,Zi(a,i.current)),Ue=null;return}}catch(f){if(d!==null)throw Ue=d,f;xt=1,Mc(i,Zi(a,i.current)),Ue=null;return}n.flags&32768?(ze||c===1?i=!0:xa||(qe&536870912)!==0?i=!1:(Bn=i=!0,(c===2||c===9||c===3||c===6)&&(c=Gt.current,c!==null&&c.tag===13&&(c.flags|=16384))),wv(n,i)):Zc(n)}function Zc(i){var n=i;do{if((n.flags&32768)!==0){wv(n,Bn);return}i=n.return;var a=z4(n.alternate,n,rn);if(a!==null){Ue=a;return}if(n=n.sibling,n!==null){Ue=n;return}Ue=n=i}while(n!==null);xt===0&&(xt=5)}function wv(i,n){do{var a=H4(i.alternate,i);if(a!==null){a.flags&=32767,Ue=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(i=i.sibling,i!==null)){Ue=i;return}Ue=i=a}while(i!==null);xt=6,Ue=null}function Sv(i,n,a,c,d,f,_,k,T,G,te,re){i.cancelPendingCommit=null;do Xc();while(gt!==0);if((Ke&6)!==0)throw Error(r(327));if(n!==null){if(n===i.current)throw Error(r(177));i===it&&(Ue=it=null,qe=0),kr=n,ms=i,Ns=a,uf=d,uv=c,K4(i,n,a,_,k,T,re)}}function K4(i,n,a,c,d,f,_){var k=n.lanes|n.childLanes;if(hf=k,k|=Ku,_b(i,a,k,c,d,f),ba=null,(a&335544064)===a?(Ca=w4(i),c=10262):(Ca=null,c=10256),(n.subtreeFlags&c)!==0||(n.flags&c)!==0?(i.callbackNode=null,i.callbackPriority=0,J4(Io,function(){return vf(),null})):(i.callbackNode=null,i.callbackPriority=0),Oc=!1,c=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||c){c=me.T,me.T=null,d=_e.p,_e.p=2,f=Ke,Ke|=4;try{I4(i,n,a)}finally{Ke=f,_e.p=d,me.T=c}}gt=1,Oc?Sa=_5(_,i.containerInfo,Ca,pf,mf,G4,gf,vf,Y4):(pf(),mf(),gf())}function Y4(i){if(gt!==0){var n=ms.onRecoverableError;n(i,{componentStack:null})}}function G4(){gt===3&&(gt=0,nv(kr,ms),gt=4)}function pf(){if(gt===1){gt=0;var i=ms,n=kr,a=Ns,c=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||c){c=me.T,me.T=null;var d=_e.p;_e.p=2;var f=Ke;Ke|=4;try{Bl=Ic=!1,iv(n,i,a),a=Af;var _=J1(i.containerInfo),k=a.focusedElem,T=a.selectionRange;if(_!==k&&k&&k.ownerDocument&&Q1(k.ownerDocument.documentElement,k)){if(T!==null&&qu(k)){var G=T.start,te=T.end;if(te===void 0&&(te=G),"selectionStart"in k)k.selectionStart=G,k.selectionEnd=Math.min(te,k.value.length);else{var re=k.ownerDocument||document,W=re&&re.defaultView||window;if(W.getSelection){var Q=W.getSelection(),fe=k.textContent.length,Se=Math.min(T.start,fe),Oe=T.end===void 0?Se:Math.min(T.end,fe);!Q.extend&&Se>Oe&&(_=Oe,Oe=Se,Se=_);var K=X1(k,Se),H=X1(k,Oe);if(K&&H&&(Q.rangeCount!==1||Q.anchorNode!==K.node||Q.anchorOffset!==K.offset||Q.focusNode!==H.node||Q.focusOffset!==H.offset)){var Z=re.createRange();Z.setStart(K.node,K.offset),Q.removeAllRanges(),Se>Oe?(Q.addRange(Z),Q.extend(H.node,H.offset)):(Z.setEnd(H.node,H.offset),Q.addRange(Z))}}}}for(re=[],Q=k;Q=Q.parentNode;)Q.nodeType===1&&re.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<re.length;k++){var ne=re[k];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}Ba=!!Mf,Af=Mf=null}finally{Ke=f,_e.p=d,me.T=c}}i.current=n,gt=2}}function mf(){if(gt===2){gt=0;var i=ms,n=kr,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=me.T,me.T=null;var c=_e.p;_e.p=2;var d=Ke;Ke|=4;try{Zg(i,n.alternate,n)}finally{Ke=d,_e.p=c,me.T=a}}gt=3}}function gf(){if(gt===4||gt===3){gt=0;var i=Sa;Sa=null,hb();var n=ms,a=kr,c=Ns,d=uv,f=(c&335544064)===c?10262:10256;if((a.subtreeFlags&f)!==0||(a.flags&f)!==0?gt=5:(gt=0,kr=ms=null,bv(n,n.pendingLanes)),f=n.pendingLanes,f===0&&(zn=null),Cu(c),a=a.stateNode,Li&&typeof Li.onCommitFiberRoot=="function")try{Li.onCommitFiberRoot(nl,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=me.T,f=_e.p,_e.p=2,me.T=null;try{for(var _=n.onRecoverableError,k=0;k<d.length;k++){var T=d[k];_(T.value,{componentStack:T.stack})}}finally{me.T=a,_e.p=f}}if(d=ba,_=Ca,Ca=null,d!==null&&(ba=null,_===null&&(_=[]),i!==null))for(T=0;T<d.length;T++)a=(0,d[T])(_),a!==void 0&&i.finished.finally(a);(Ns&3)!==0&&Xc(),Ds(n),f=n.pendingLanes,(c&261930)!==0&&(f&42)!==0?n===Kc?Il++:(Il=0,Kc=n):(Il=0,Kc=null),Ul(0)}}function bv(i,n){(i.pooledCacheLanes&=n)===0&&(n=i.pooledCache,n!=null&&(i.pooledCache=null,xl(n)))}function Xc(){return Sa!==null&&(Sa.skipTransition(),Sa=null),pf(),mf(),gf(),vf()}function vf(){if(gt!==5)return!1;var i=ms,n=hf;hf=0;var a=Cu(Ns),c=me.T,d=_e.p;try{_e.p=32>a?32:a,me.T=null,a=uf,uf=null;var f=ms,_=Ns;if(gt=0,kr=ms=null,Ns=0,(Ke&6)!==0)throw Error(r(331));var k=Ke;if(Ke|=4,ov(f.current),rv(f,f.current,_,a),Ke=k,Ul(0,!1),Li&&typeof Li.onPostCommitFiberRoot=="function")try{Li.onPostCommitFiberRoot(nl,f)}catch{}return!0}finally{_e.p=d,me.T=c,bv(i,n)}}function Cv(i,n,a){n=Zi(a,n),n=Rd(i.stateNode,n,2),i=An(i,n,2),i!==null&&(al(i,2),Ds(i))}function Xe(i,n,a){if(i.tag===3)Cv(i,i,a);else for(;n!==null;){if(n.tag===3){Cv(n,i,a);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(zn===null||!zn.has(c))){i=Zi(a,i),a=xg(2),c=An(n,a,2),c!==null&&(wg(a,c,n,i),al(c,2),Ds(c));break}}n=n.return}}function yf(i,n,a){var c=i.pingCache;if(c===null){c=i.pingCache=new q4;var d=new Set;c.set(n,d)}else d=c.get(n),d===void 0&&(d=new Set,c.set(n,d));d.has(a)||(of=!0,d.add(a),i=Z4.bind(null,i,n,a),n.then(i,i))}function Z4(i,n,a){var c=i.pingCache;c!==null&&c.delete(n),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,it===i&&(qe&a)===a&&((xt===4||xt===3&&(qe&62914560)===qe&&300>Ri()-$c)&&(Ke&2)===0?ja(i,0):Vc|=a,wa===qe&&(wa=0)),Ds(i)}function kv(i,n){n===0&&(n=h1()),i=cr(i,n),i!==null&&(al(i,n),Ds(i))}function X4(i){var n=i.memoizedState,a=0;n!==null&&(a=n.retryLane),kv(i,a)}function Q4(i,n){var a=0;switch(i.tag){case 31:case 13:var c=i.stateNode,d=i.memoizedState;d!==null&&(a=d.retryLane);break;case 19:c=i.stateNode;break;case 22:c=i.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(n),kv(i,a)}function J4(i,n){return xu(i,n)}var Ma=null,Aa=null,_f=!1,Qc=!1,xf=!1,In=0;function Ds(i){i!==Aa&&i.next===null&&(Aa===null?Ma=Aa=i:Aa=Aa.next=i),Qc=!0,_f||(_f=!0,t5())}function Ul(i,n){if(!xf&&Qc){xf=!0;do for(var a=!1,c=Ma;c!==null;){if(i!==0){var d=c.pendingLanes;if(d===0)var f=0;else{var _=c.suspendedLanes,k=c.pingedLanes;f=(1<<31-Bi(42|i)+1)-1,f&=d&~(_&~k),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Av(c,f))}else f=qe,f=Vo(c,c===it?f:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(f&3)===0||rl(c,f)||(a=!0,Av(c,f));c=c.next}while(a);xf=!1}}function e5(){jv()}function jv(){Qc=_f=!1;var i=0;In!==0&&d5()&&(i=In);for(var n=Ri(),a=null,c=Ma;c!==null;){var d=c.next,f=Ev(c,n);f===0?(c.next=null,a===null?Ma=d:a.next=d,d===null&&(Aa=a)):(a=c,(i!==0||(f&3)!==0)&&(Qc=!0)),c=d}gt!==0&&gt!==5||Ul(i),In!==0&&(In=0)}function Ev(i,n){for(var a=i.suspendedLanes,c=i.pingedLanes,d=i.expirationTimes,f=i.pendingLanes&-62914561;0<f;){var _=31-Bi(f),k=1<<_,T=d[_];T===-1?((k&a)===0||(k&c)!==0)&&(d[_]=yb(k,n)):T<=n&&(i.expiredLanes|=k),f&=~k}if(n=it,a=qe,a=Vo(i,i===n?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c=i.callbackNode,a===0||i===n&&(Ze===2||Ze===9)||i.cancelPendingCommit!==null)return c!==null&&c!==null&&wu(c),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||rl(i,a)){if(n=a&-a,n===i.callbackPriority)return n;switch(c!==null&&wu(c),Cu(a)){case 2:case 8:a=l1;break;case 32:a=Io;break;case 268435456:a=o1;break;default:a=Io}return c=Mv.bind(null,i),a=xu(a,c),i.callbackPriority=n,i.callbackNode=a,n}return c!==null&&c!==null&&wu(c),i.callbackPriority=2,i.callbackNode=null,2}function Mv(i,n){if(gt!==0&&gt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Xc()&&i.callbackNode!==a)return null;var c=qe;return c=Vo(i,i===it?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c===0?null:(fv(i,c,n),Ev(i,Ri()),i.callbackNode!=null&&i.callbackNode===a?Mv.bind(null,i):null)}function Av(i,n){if(Xc())return null;fv(i,n,!0)}function t5(){p5(function(){(Ke&6)!==0?xu(a1,e5):jv()})}function wf(){if(In===0){var i=mr;i===0&&(i=Uo,Uo<<=1,(Uo&261888)===0&&(Uo=256)),In=i}return In}function Tv(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Yo(i)}function i5(i,n,a,c,d){if(n==="submit"&&a&&a.stateNode===d){var f=Tv((d[bi]||null).action),_=c.submitter;_&&(n=(n=_[bi]||null)?Tv(n.formAction):_.getAttribute("formAction"),n!==null&&(f=n,_=null));var k=new Qo("action","action",null,c,d);i.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(In!==0){var T=new FormData(d,_);Md(a,{pending:!0,data:T,method:d.method,action:f},null,T)}}else typeof f=="function"&&(k.preventDefault(),T=new FormData(d,_),Md(a,{pending:!0,data:T,method:d.method,action:f},f,T))},currentTarget:d}]})}}for(var Sf=0;Sf<Fu.length;Sf++){var bf=Fu[Sf],s5=bf.toLowerCase(),n5=bf[0].toUpperCase()+bf.slice(1);us(s5,"on"+n5)}us(im,"onAnimationEnd"),us(sm,"onAnimationIteration"),us(nm,"onAnimationStart"),us("dblclick","onDoubleClick"),us("focusin","onFocus"),us("focusout","onBlur"),us(f4,"onTransitionRun"),us(p4,"onTransitionStart"),us(m4,"onTransitionCancel"),us(rm,"onTransitionEnd"),Xr("onMouseEnter",["mouseout","mouseover"]),Xr("onMouseLeave",["mouseout","mouseover"]),Xr("onPointerEnter",["pointerout","pointerover"]),Xr("onPointerLeave",["pointerout","pointerover"]),ar("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ar("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ar("onBeforeInput",["compositionend","keypress","textInput","paste"]),ar("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ar("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ar("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),r5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pl));function Nv(i,n){n=(n&4)!==0;for(var a=0;a<i.length;a++){var c=i[a],d=c.event;c=c.listeners;e:{var f=void 0;if(n)for(var _=c.length-1;0<=_;_--){var k=c[_],T=k.instance,G=k.currentTarget;if(k=k.listener,T!==f&&d.isPropagationStopped())break e;f=k,d.currentTarget=G;try{f(d)}catch(te){tc(te)}d.currentTarget=null,f=T}else for(_=0;_<c.length;_++){if(k=c[_],T=k.instance,G=k.currentTarget,k=k.listener,T!==f&&d.isPropagationStopped())break e;f=k,d.currentTarget=G;try{f(d)}catch(te){tc(te)}d.currentTarget=null,f=T}}}}function Pe(i,n){var a=n[g1];a===void 0&&(a=n[g1]=new Set);var c=i+"__bubble";a.has(c)||(Dv(n,i,2,!1),a.add(c))}function Cf(i,n,a){var c=0;n&&(c|=4),Dv(a,i,c,n)}var Jc="_reactListening"+Math.random().toString(36).slice(2);function kf(i){if(!i[Jc]){i[Jc]=!0,_1.forEach(function(a){a!=="selectionchange"&&(r5.has(a)||Cf(a,!1,i),Cf(a,!0,i))});var n=i.nodeType===9?i:i.ownerDocument;n===null||n[Jc]||(n[Jc]=!0,Cf("selectionchange",!1,n))}}function Dv(i,n,a,c){switch(wy(n)){case 2:var d=X5;break;case 8:d=Q5;break;default:d=Wf}a=d.bind(null,n,a,i),d=void 0,!Du||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),c?d!==void 0?i.addEventListener(n,a,{capture:!0,passive:d}):i.addEventListener(n,a,!0):d!==void 0?i.addEventListener(n,a,{passive:d}):i.addEventListener(n,a,!1)}function jf(i,n,a,c,d){var f=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var _=c.tag;if(_===3||_===4){var k=c.stateNode.containerInfo;if(k===d)break;if(_===4)for(_=c.return;_!==null;){var T=_.tag;if((T===3||T===4)&&_.stateNode.containerInfo===d)return;_=_.return}for(;k!==null;){if(_=rr(k),_===null)return;if(T=_.tag,T===5||T===6||T===26||T===27){c=f=_;continue e}k=k.parentNode}}c=c.return}D1(function(){var G=f,te=Tu(a),re=[];e:{var W=am.get(i);if(W!==void 0){var Q=Qo,fe=i;switch(i){case"keypress":if(Zo(a)===0)break e;case"keydown":case"keyup":Q=Vb;break;case"focusin":fe="focus",Q=Ou;break;case"focusout":fe="blur",Q=Ou;break;case"beforeblur":case"afterblur":Q=Ou;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=B1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=Nb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=Yb;break;case im:case sm:case nm:Q=Lb;break;case rm:Q=Zb;break;case"scroll":case"scrollend":Q=Ab;break;case"wheel":Q=Qb;break;case"copy":case"cut":case"paste":Q=Ob;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=z1;break;case"submit":Q=Fb;break;case"toggle":case"beforetoggle":Q=e4}var Se=(n&4)!==0,Oe=!Se&&(i==="scroll"||i==="scrollend"),K=Se?W!==null?W+"Capture":null:W;Se=[];for(var H=G,Z;H!==null;){var ne=H;if(Z=ne.stateNode,ne=ne.tag,ne!==5&&ne!==26&&ne!==27||Z===null||K===null||(ne=cl(H,K),ne!=null&&Se.push(ql(H,ne,Z))),Oe)break;H=H.return}0<Se.length&&(W=new Q(W,fe,null,a,te),re.push({event:W,listeners:Se}))}}if((n&7)===0){e:{if(Q=i==="mouseover"||i==="pointerover",W=i==="mouseout"||i==="pointerout",Q&&a!==Au&&(fe=a.relatedTarget||a.fromElement)&&(rr(fe)||fe[Yr]))break e;(W||Q)&&(fe=te.window===te?te:(Q=te.ownerDocument)?Q.defaultView||Q.parentWindow:window,W?(Q=a.relatedTarget||a.toElement,W=G,Q=Q?rr(Q):null,Q!==null&&(Oe=h(Q),Se=Q.tag,Q!==Oe||Se!==5&&Se!==27&&Se!==6)&&(Q=null)):(W=null,Q=G),W!==Q&&(Se=B1,ne="onMouseLeave",K="onMouseEnter",H="mouse",(i==="pointerout"||i==="pointerover")&&(Se=z1,ne="onPointerLeave",K="onPointerEnter",H="pointer"),Oe=W==null?fe:ol(W),Z=Q==null?fe:ol(Q),fe=new Se(ne,H+"leave",W,a,te),fe.target=Oe,fe.relatedTarget=Z,ne=null,rr(te)===G&&(Se=new Se(K,H+"enter",Q,a,te),Se.target=Z,Se.relatedTarget=Oe,ne=Se),Oe=ne,Se=W&&Q?B(W,Q,a5):null,W!==null&&Rv(re,fe,W,Se,!1),Q!==null&&Oe!==null&&Rv(re,Oe,Q,Se,!0)))}e:{if(W=G?ol(G):window,Q=W.nodeName&&W.nodeName.toLowerCase(),Q==="select"||Q==="input"&&W.type==="file")var ye=W1;else if(V1(W))if(F1)ye=h4;else{ye=o4;var Ve=l4}else Q=W.nodeName,!Q||Q.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?G&&Mu(G.elementType)&&(ye=W1):ye=c4;if(ye&&(ye=ye(i,G))){$1(re,ye,a,te);break e}Ve&&Ve(i,W,G)}switch(Ve=G?ol(G):window,i){case"focusin":(V1(Ve)||Ve.contentEditable==="true")&&(sa=Ve,Vu=G,vl=null);break;case"focusout":vl=Vu=sa=null;break;case"mousedown":$u=!0;break;case"contextmenu":case"mouseup":case"dragend":$u=!1,em(re,a,te);break;case"selectionchange":if(d4)break;case"keydown":case"keyup":em(re,a,te)}var Ce;if(Hu)e:{switch(i){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else ia?P1(i,a)&&(Me="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(Me="onCompositionStart");Me&&(H1&&a.locale!=="ko"&&(ia||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&ia&&(Ce=R1()):(xn=te,Ru="value"in xn?xn.value:xn.textContent,ia=!0)),Ve=eh(G,Me),0<Ve.length&&(Me=new O1(Me,i,null,a,te),re.push({event:Me,listeners:Ve}),Ce?Me.data=Ce:(Ce=q1(a),Ce!==null&&(Me.data=Ce)))),(Ce=i4?s4(i,a):n4(i,a))&&(Me=eh(G,"onBeforeInput"),0<Me.length&&(Ve=new O1("onBeforeInput","beforeinput",null,a,te),re.push({event:Ve,listeners:Me}),Ve.data=Ce)),i5(re,i,G,a,te)}Nv(re,n)})}function ql(i,n,a){return{instance:i,listener:n,currentTarget:a}}function eh(i,n){for(var a=n+"Capture",c=[];i!==null;){var d=i,f=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||f===null||(d=cl(i,a),d!=null&&c.unshift(ql(i,d,f)),d=cl(i,n),d!=null&&c.push(ql(i,d,f))),i.tag===3)return c;i=i.return}return[]}function a5(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Rv(i,n,a,c,d){for(var f=n._reactName,_=[];a!==null&&a!==c;){var k=a,T=k.alternate,G=k.stateNode;if(k=k.tag,T!==null&&T===c)break;k!==5&&k!==26&&k!==27||G===null||(T=G,d?(G=cl(a,f),G!=null&&_.unshift(ql(a,G,T))):d||(G=cl(a,f),G!=null&&_.push(ql(a,G,T)))),a=a.return}_.length!==0&&i.push({event:n,listeners:_})}var l5=/\r\n?/g,o5=/\u0000|\uFFFD/g;function Lv(i){return(typeof i=="string"?i:""+i).replace(l5,`
+`).replace(o5,"")}function Bv(i,n){return n=Lv(n),Lv(i)===n}function Qe(i,n,a,c,d,f){switch(a){case"children":if(typeof c=="string")n==="body"||n==="textarea"&&c===""||Jr(i,c);else if(typeof c=="number"||typeof c=="bigint")n!=="body"&&Jr(i,""+c);else return;break;case"className":Ko(i,"class",c);break;case"tabIndex":Ko(i,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Ko(i,a,c);break;case"style":T1(i,c,f);return;case"data":if(n!=="object"){Ko(i,"data",c);break}case"src":case"href":if(c===""&&(n!=="a"||a!=="href")){i.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=Yo(c),i.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="function"){i.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(a==="formAction"?(n!=="input"&&Qe(i,n,"name",d.name,d,null),Qe(i,n,"formEncType",d.formEncType,d,null),Qe(i,n,"formMethod",d.formMethod,d,null),Qe(i,n,"formTarget",d.formTarget,d,null)):(Qe(i,n,"encType",d.encType,d,null),Qe(i,n,"method",d.method,d,null),Qe(i,n,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=Yo(c),i.setAttribute(a,c);break;case"onClick":c!=null&&(i.onclick=Ss);return;case"onScroll":c!=null&&Pe("scroll",i);return;case"onScrollEnd":c!=null&&Pe("scrollend",i);return;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(d.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"multiple":i.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":i.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){i.removeAttribute("xlink:href");break}a=Yo(c),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,c):i.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":c===!0?i.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,c):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?i.setAttribute(a,c):i.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?i.removeAttribute(a):i.setAttribute(a,c);break;case"popover":Pe("beforetoggle",i),Pe("toggle",i),Fo(i,"popover",c);break;case"xlinkActuate":Fs(i,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Fs(i,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Fs(i,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Fs(i,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Fs(i,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Fs(i,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Fs(i,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Fs(i,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Fs(i,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Fo(i,"is",c);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=Eb.get(a)||a,Fo(i,a,c);else return}Fe=!0}function Ef(i,n,a,c,d,f){switch(a){case"style":T1(i,c,f);return;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(d.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"children":if(typeof c=="string")Jr(i,c);else if(typeof c=="number"||typeof c=="bigint")Jr(i,""+c);else return;break;case"onScroll":c!=null&&Pe("scroll",i);return;case"onScrollEnd":c!=null&&Pe("scrollend",i);return;case"onClick":c!=null&&(i.onclick=Ss);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!x1.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(d=a.endsWith("Capture"),f=a.slice(2,d?a.length-7:void 0),n=i[bi]||null,n=n!=null?n[a]:null,typeof n=="function"&&i.removeEventListener(f,n,d),typeof c=="function")){typeof n!="function"&&n!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(f,c,d);break e}Fe=!0,a in i?i[a]=c:c===!0?i.setAttribute(a,""):Fo(i,a,c)}return}Fe=!0}function Qt(i,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pe("error",i),Pe("load",i);var c=!1,d=!1,f;for(f in a)if(a.hasOwnProperty(f)){var _=a[f];if(_!=null)switch(f){case"src":c=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Qe(i,n,f,_,a,null)}}d&&Qe(i,n,"srcSet",a.srcSet,a,null),c&&Qe(i,n,"src",a.src,a,null);return;case"input":Pe("invalid",i);var k=f=_=d=null,T=null,G=null;for(c in a)if(a.hasOwnProperty(c)){var te=a[c];if(te!=null)switch(c){case"name":d=te;break;case"type":_=te;break;case"checked":T=te;break;case"defaultChecked":G=te;break;case"value":f=te;break;case"defaultValue":k=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,n));break;default:Qe(i,n,c,te,a,null)}}j1(i,f,k,T,G,_,d,!1);return;case"select":Pe("invalid",i),c=_=f=null;for(d in a)if(a.hasOwnProperty(d)&&(k=a[d],k!=null))switch(d){case"value":f=k;break;case"defaultValue":_=k;break;case"multiple":c=k;default:Qe(i,n,d,k,a,null)}n=f,a=_,i.multiple=!!c,n!=null?Qr(i,!!c,n,!1):a!=null&&Qr(i,!!c,a,!0);return;case"textarea":Pe("invalid",i),f=d=c=null;for(_ in a)if(a.hasOwnProperty(_)&&(k=a[_],k!=null))switch(_){case"value":c=k;break;case"defaultValue":d=k;break;case"children":f=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:Qe(i,n,_,k,a,null)}M1(i,c,d,f);return;case"option":for(T in a)a.hasOwnProperty(T)&&(c=a[T],c!=null)&&(T==="selected"?i.selected=c&&typeof c!="function"&&typeof c!="symbol":Qe(i,n,T,c,a,null));return;case"dialog":Pe("beforetoggle",i),Pe("toggle",i),Pe("cancel",i),Pe("close",i);break;case"iframe":case"object":Pe("load",i);break;case"video":case"audio":for(c=0;c<Pl.length;c++)Pe(Pl[c],i);break;case"image":Pe("error",i),Pe("load",i);break;case"details":Pe("toggle",i);break;case"embed":case"source":case"link":Pe("error",i),Pe("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(c=a[G],c!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Qe(i,n,G,c,a,null)}return;default:if(Mu(n)){for(te in a)a.hasOwnProperty(te)&&(c=a[te],c!==void 0&&Ef(i,n,te,c,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(c=a[k],c!=null&&Qe(i,n,k,c,a,null))}var c5={};function h5(i,n,a,c){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,f=null,_=null,k=null,T=null,G=null,te=null;for(Q in a){var re=a[Q];if(a.hasOwnProperty(Q)&&re!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":T=re;default:c.hasOwnProperty(Q)||Qe(i,n,Q,null,c,re)}}for(var W in c){var Q=c[W];if(re=a[W],c.hasOwnProperty(W)&&(Q!=null||re!=null))switch(W){case"type":Q!==re&&(Fe=!0),f=Q;break;case"name":Q!==re&&(Fe=!0),d=Q;break;case"checked":Q!==re&&(Fe=!0),G=Q;break;case"defaultChecked":Q!==re&&(Fe=!0),te=Q;break;case"value":Q!==re&&(Fe=!0),_=Q;break;case"defaultValue":Q!==re&&(Fe=!0),k=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,n));break;default:Q!==re&&Qe(i,n,W,Q,c,re)}}ju(i,_,k,T,G,te,f,d);return;case"select":Q=_=k=W=null;for(f in a)if(T=a[f],a.hasOwnProperty(f)&&T!=null)switch(f){case"value":break;case"multiple":Q=T;default:c.hasOwnProperty(f)||Qe(i,n,f,null,c,T)}for(d in c)if(f=c[d],T=a[d],c.hasOwnProperty(d)&&(f!=null||T!=null))switch(d){case"value":f!==T&&(Fe=!0),W=f;break;case"defaultValue":f!==T&&(Fe=!0),k=f;break;case"multiple":f!==T&&(Fe=!0),_=f;default:f!==T&&Qe(i,n,d,f,c,T)}n=k,a=_,c=Q,W!=null?Qr(i,!!a,W,!1):!!c!=!!a&&(n!=null?Qr(i,!!a,n,!0):Qr(i,!!a,a?[]:"",!1));return;case"textarea":Q=W=null;for(k in a)if(d=a[k],a.hasOwnProperty(k)&&d!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:Qe(i,n,k,null,c,d)}for(_ in c)if(d=c[_],f=a[_],c.hasOwnProperty(_)&&(d!=null||f!=null))switch(_){case"value":d!==f&&(Fe=!0),W=d;break;case"defaultValue":d!==f&&(Fe=!0),Q=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==f&&Qe(i,n,_,d,c,f)}E1(i,W,Q);return;case"option":for(var fe in a)W=a[fe],a.hasOwnProperty(fe)&&W!=null&&!c.hasOwnProperty(fe)&&(fe==="selected"?i.selected=!1:Qe(i,n,fe,null,c,W));for(T in c)W=c[T],Q=a[T],c.hasOwnProperty(T)&&W!==Q&&(W!=null||Q!=null)&&(T==="selected"?(W!==Q&&(Fe=!0),i.selected=W&&typeof W!="function"&&typeof W!="symbol"):Qe(i,n,T,W,c,Q));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Se in a)W=a[Se],a.hasOwnProperty(Se)&&W!=null&&!c.hasOwnProperty(Se)&&Qe(i,n,Se,null,c,W);for(G in c)if(W=c[G],Q=a[G],c.hasOwnProperty(G)&&W!==Q&&(W!=null||Q!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,n));break;default:Qe(i,n,G,W,c,Q)}return;default:if(Mu(n)){for(var Oe in a)W=a[Oe],a.hasOwnProperty(Oe)&&W!==void 0&&!c.hasOwnProperty(Oe)&&Ef(i,n,Oe,void 0,c,W);for(te in c)W=c[te],Q=a[te],!c.hasOwnProperty(te)||W===Q||W===void 0&&Q===void 0||Ef(i,n,te,W,c,Q);return}}for(var K in a)W=a[K],a.hasOwnProperty(K)&&W!=null&&!c.hasOwnProperty(K)&&Qe(i,n,K,null,c,W);for(re in c)W=c[re],Q=a[re],!c.hasOwnProperty(re)||W===Q||W==null&&Q==null||Qe(i,n,re,W,c,Q)}function Ov(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u5(){if(typeof performance.getEntriesByType=="function"){for(var i=0,n=0,a=performance.getEntriesByType("resource"),c=0;c<a.length;c++){var d=a[c],f=d.transferSize,_=d.initiatorType,k=d.duration;if(f&&k&&Ov(_)){for(_=0,k=d.responseEnd,c+=1;c<a.length;c++){var T=a[c],G=T.startTime;if(G>k)break;var te=T.transferSize,re=T.initiatorType;te&&Ov(re)&&(T=T.responseEnd,_+=te*(T<k?1:(k-G)/(T-G)))}if(--c,n+=8*(f+_)/(d.duration/1e3),i++,10<i)break}}if(0<i)return n/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Mf=null,Af=null;function Vl(i){return i.nodeType===9?i:i.ownerDocument}function zv(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Hv(i,n){if(i===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&n==="foreignObject"?0:i}function Iv(i,n,a,c){return a=Vl(a).createElement(i),a[Kt]=c,a[bi]=n,Qt(a,i,n),zt(a),a}function Tf(i,n){return i==="textarea"||i==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Nf=null;function d5(){var i=window.event;return i&&i.type==="popstate"?i===Nf?!1:(Nf=i,!0):(Nf=null,!1)}var Df=typeof setTimeout=="function"?setTimeout:void 0,f5=typeof clearTimeout=="function"?clearTimeout:void 0,Uv=typeof Promise=="function"?Promise:void 0,Pv=typeof requestAnimationFrame=="function"?requestAnimationFrame:Df,p5=typeof queueMicrotask=="function"?queueMicrotask:typeof Uv<"u"?function(i){return Uv.resolve(null).then(i).catch(m5)}:Df;function m5(i){setTimeout(function(){throw i})}function Un(i){return i==="head"}function qv(i,n){var a=n,c=0;do{var d=a.nextSibling;if(i.removeChild(a),d&&d.nodeType===8)if(a=d.data,a==="/$"||a==="/&"){if(c===0){i.removeChild(d),Oa(n);return}c--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")c++;else if(a==="html")Uf(i.ownerDocument.documentElement);else if(a==="head"){a=i.ownerDocument.head,Uf(a);for(var f=a.firstChild;f;){var _=f.nextSibling,k=f.nodeName;f[ll]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=_}}else a==="body"&&Uf(i.ownerDocument.body);a=d}while(a);Oa(n)}function Vv(i,n){var a=i;i=0;do{var c=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),c&&c.nodeType===8)if(a=c.data,a==="/$"){if(i===0)break;i--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||i++;a=c}while(a)}function $v(i,n,a){if(n=CSS.escape(n)!==n?"r-"+btoa(n).replace(/=/g,""):n,i.style.viewTransitionName=n,a!=null&&(i.style.viewTransitionClass=a),a=getComputedStyle(i),a.display==="inline"){if(n=i.getClientRects(),n.length===1)var c=1;else for(var d=c=0;d<n.length;d++){var f=n[d];0<f.width&&0<f.height&&c++}c===1&&(i=i.style,i.display=n.length===1?"inline-block":"block",i.marginTop="-"+a.paddingTop,i.marginBottom="-"+a.paddingBottom)}}function Wv(i,n){i=i.style,n=n.style;var a=n!=null?n.hasOwnProperty("viewTransitionName")?n.viewTransitionName:n.hasOwnProperty("view-transition-name")?n["view-transition-name"]:null:null;i.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=n!=null?n.hasOwnProperty("viewTransitionClass")?n.viewTransitionClass:n.hasOwnProperty("view-transition-class")?n["view-transition-class"]:null:null,i.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),i.display==="inline-block"&&(n==null?i.display=i.margin="":(a=n.display,i.display=a==null||typeof a=="boolean"?"":a,a=n.margin,a!=null?i.margin=a:(a=n.hasOwnProperty("marginTop")?n.marginTop:n["margin-top"],i.marginTop=a==null||typeof a=="boolean"?"":a,n=n.hasOwnProperty("marginBottom")?n.marginBottom:n["margin-bottom"],i.marginBottom=n==null||typeof n=="boolean"?"":n)))}function g5(i,n,a){return a=a.ownerDocument.defaultView,{rect:i,abs:n.position==="absolute"||n.position==="fixed",clip:n.clipPath!=="none"||n.overflow!=="visible"||n.filter!=="none"||n.mask!=="none"||n.mask!=="none"||n.borderRadius!=="0px",view:0<=i.bottom&&0<=i.right&&i.top<=a.innerHeight&&i.left<=a.innerWidth}}function Rf(i){var n=i.getBoundingClientRect(),a=getComputedStyle(i);return g5(n,a,i)}function v5(i){return i.documentElement.clientHeight}function y5(i){this.addEventListener("load",i),this.addEventListener("error",i)}function _5(i,n,a,c,d,f,_,k,T){var G=n.nodeType===9?n:n.ownerDocument;try{var te=G.startViewTransition({update:function(){var W=G.defaultView,Q=W.navigation&&W.navigation.transition,fe=G.fonts.status;c();var Se=[];if(fe==="loaded"&&(v5(G),G.fonts.status==="loading"&&Se.push(G.fonts.ready)),fe=Se.length,i!==null)for(var Oe=i.suspenseyImages,K=0,H=0;H<Oe.length;H++){var Z=Oe[H];if(!Z.complete){var ne=Z.getBoundingClientRect();if(0<ne.bottom&&0<ne.right&&ne.top<W.innerHeight&&ne.left<W.innerWidth){if(K+=dy(Z),K>sh){Se.length=fe;break}Z=new Promise(y5.bind(Z)),Se.push(Z)}}}if(0<Se.length)return W=Promise.race([Promise.all(Se),new Promise(function(ye){return setTimeout(ye,500)})]).then(d,d),(Q?Promise.allSettled([Q.finished,W]):W).then(f,f);if(d(),Q)return Q.finished.then(f,f);f()},types:a});G.__reactViewTransition=te;var re=[];return te.ready.then(function(){for(var W=G.documentElement.getAnimations({subtree:!0}),Q=0;Q<W.length;Q++){var fe=W[Q],Se=fe.effect,Oe=Se.pseudoElement;if(Oe!=null&&Oe.startsWith("::view-transition")){re.push(fe),fe=Se.getKeyframes();for(var K=Oe=void 0,H=!0,Z=0;Z<fe.length;Z++){var ne=fe[Z],ye=ne.width;if(Oe===void 0)Oe=ye;else if(Oe!==ye){H=!1;break}if(ye=ne.height,K===void 0)K=ye;else if(K!==ye){H=!1;break}delete ne.width,delete ne.height,ne.transform==="none"&&delete ne.transform}H&&Oe!==void 0&&K!==void 0&&(Se.setKeyframes(fe),H=getComputedStyle(Se.target,Se.pseudoElement),H.width!==Oe||H.height!==K)&&(H=fe[0],H.width=Oe,H.height=K,H=fe[fe.length-1],H.width=Oe,H.height=K,Se.setKeyframes(fe))}}_()},function(W){G.__reactViewTransition===te&&(G.__reactViewTransition=null);try{typeof W=="object"&&W!==null&&W.name==="InvalidStateError"&&(W.message==="View transition was skipped because document visibility state is hidden."||W.message==="Skipping view transition because document visibility state has become hidden."||W.message==="Skipping view transition because viewport size changed."||W.message==="Transition was aborted because of invalid state")&&(W=null),W!==null&&T(W)}finally{c(),d(),_()}}),te.finished.finally(function(){for(var W=0;W<re.length;W++)re[W].cancel();G.__reactViewTransition===te&&(G.__reactViewTransition=null),k()}),te}catch{return c(),d(),_(),null}}function jr(i,n){this._scope=document.documentElement,this._selector="::view-transition-"+i+"("+n+")"}jr.prototype.animate=function(i,n){return n=typeof n=="number"?{duration:n}:I({},n),n.pseudoElement=this._selector,this._scope.animate(i,n)},jr.prototype.getAnimations=function(){for(var i=this._scope,n=this._selector,a=i.getAnimations({subtree:!0}),c=[],d=0;d<a.length;d++){var f=a[d].effect;f!==null&&f.target===i&&f.pseudoElement===n&&c.push(a[d])}return c},jr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Fv(i){return{name:i,group:new jr("group",i),imagePair:new jr("image-pair",i),old:new jr("old",i),new:new jr("new",i)}}function Vi(i){this._fragmentFiber=i,this._observers=this._eventListeners=null}Vi.prototype.addEventListener=function(i,n,a){var c=null,d=null;if(!(a!=null&&typeof a!="boolean"&&(c=a.signal||null,c!==null&&c.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(Yv(f,i,n,a)===-1){var _=this,k=n;a!=null&&typeof a!="boolean"&&a.once===!0&&(k=function(T){_.removeEventListener(i,n,a),typeof n=="function"?n.call(this,T):n.handleEvent(T)}),c!==null&&(d=_.removeEventListener.bind(_,i,n,a),c.addEventListener("abort",d,{once:!0}),d=c.removeEventListener.bind(c,"abort",d)),c=Ta(a),f.push({type:i,listener:n,optionsOrUseCapture:a,attachedListener:k,cleanup:d}),v(this._fragmentFiber.child,!1,x5,i,k,c)}this._eventListeners=f}};function x5(i,n,a,c){return j(i).addEventListener(n,a,c),!1}Vi.prototype.removeEventListener=function(i,n,a){var c=this._eventListeners;if(c!==null&&(n=Yv(c,i,n,a),n!==-1)){var d=c[n];a=d.attachedListener;var f=d.cleanup;d=Ta(d.optionsOrUseCapture),v(this._fragmentFiber.child,!1,w5,i,a,d),c.splice(n,1),f!==null&&f()}};function w5(i,n,a,c){return j(i).removeEventListener(n,a,c),!1}function Ta(i){return i!=null&&typeof i!="boolean"&&(i.once===!0||i.signal instanceof AbortSignal)?{capture:i.capture,passive:i.passive}:i}function Kv(i){return i==null?"c=0":typeof i=="boolean"?"c="+(i?"1":"0"):"c="+(i.capture?"1":"0")}function Yv(i,n,a,c){if(i.length===0)return-1;c=Kv(c);for(var d=0;d<i.length;d++){var f=i[d];if(f.type===n&&f.listener===a&&Kv(f.optionsOrUseCapture)===c)return d}return-1}Vi.prototype.dispatchEvent=function(i){var n=x(this._fragmentFiber);if(n===null)return!0;n=j(n);var a=this._eventListeners;if(a!==null&&0<a.length||!i.bubbles){var c=n.nodeType===9?n.createComment(""):document.createTextNode("");if(a)for(var d=0;d<a.length;d++){var f=a[d];c.addEventListener(f.type,f.attachedListener,Ta(f.optionsOrUseCapture))}if(n.appendChild(c),i=c.dispatchEvent(i),a)for(d=0;d<a.length;d++)f=a[d],c.removeEventListener(f.type,f.attachedListener,Ta(f.optionsOrUseCapture));return n.removeChild(c),i}return n.dispatchEvent(i)},Vi.prototype.focus=function(i){v(this._fragmentFiber.child,!0,Gv,i,void 0,void 0)};function Gv(i,n){return i.tag===6?!1:(i=j(i),R5(i,n))}Vi.prototype.focusLast=function(i){var n=[];v(this._fragmentFiber.child,!0,Lf,n,void 0,void 0);for(var a=n.length-1;0<=a&&!Gv(n[a],i);a--);};function Lf(i,n){return n.push(i),!1}Vi.prototype.blur=function(){var i=x(this._fragmentFiber);i!==null&&(i=j(i),i=Vl(i).activeElement,i!==null&&v(this._fragmentFiber.child,!1,S5,i,void 0,void 0))};function S5(i,n){return i.tag===6?!1:(i=j(i),i===n||i.contains(n)?(n.blur(),!0):!1)}Vi.prototype.observeUsing=function(i){this._observers===null&&(this._observers=new Set),this._observers.add(i),v(this._fragmentFiber.child,!1,b5,i,void 0,void 0)};function b5(i,n){return i.tag===6||(i=j(i),n.observe(i)),!1}Vi.prototype.unobserveUsing=function(i){var n=this._observers;if(n!==null&&n.has(i)){n.delete(i),v(this._fragmentFiber.child,!1,C5,i,void 0,void 0);for(var a=n=0;a<gs.length;a++){var c=gs[a];c.fragmentInstance===this&&c.observer===i?i.unobserve(c.instance):gs[n++]=c}gs.length=n}};function C5(i,n){return i.tag===6||(i=j(i),n.unobserve(i)),!1}var gs=[],Bf=!1;function k5(i,n,a){gs.push({fragmentInstance:i,observer:n,instance:a}),Bf||(Bf=!0,L5(function(){Bf=!1;var c=gs;gs=[];for(var d=0;d<c.length;d++){var f=c[d];f.observer.unobserve(f.instance)}}))}Vi.prototype.getClientRects=function(){var i=[];return v(this._fragmentFiber.child,!1,j5,i,void 0,void 0),i};function j5(i,n){if(i.tag===6){i=i.stateNode;var a=i.ownerDocument.createRange();a.selectNodeContents(i),n.push.apply(n,a.getClientRects())}else i=j(i),n.push.apply(n,i.getClientRects());return!1}Vi.prototype.getRootNode=function(i){var n=x(this._fragmentFiber);return n===null?this:j(n).getRootNode(i)},Vi.prototype.compareDocumentPosition=function(i){var n=x(this._fragmentFiber);if(n===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];v(this._fragmentFiber.child,!1,Lf,a,void 0,void 0);var c=j(n);if(a.length===0){if(a=c,S(this._fragmentFiber)){e:{for(n=this._fragmentFiber.return;n!==null;){if(n.tag===4){n=n.stateNode.containerInfo;break e}if(n.tag===3||n.tag===5||n.tag===27)break;n=n.return}n=null}n!=null&&(a=n)}n=this._fragmentFiber;var d=c=a.compareDocumentPosition(i);return a===i?d=Node.DOCUMENT_POSITION_CONTAINS:c&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=w(n)[1],a===null?d=Node.DOCUMENT_POSITION_PRECEDING:(i=j(a).compareDocumentPosition(i),d=i===0||i&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),d|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}n=j(a[0]),d=j(a[a.length-1]);var f=S(this._fragmentFiber)?n.parentElement:c;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;c=f.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_CONTAINED_BY;var _=n.compareDocumentPosition(i),k=d.compareDocumentPosition(i),T=_&Node.DOCUMENT_POSITION_CONTAINED_BY||k&Node.DOCUMENT_POSITION_CONTAINED_BY;return k=c&&f&&_&Node.DOCUMENT_POSITION_FOLLOWING&&k&Node.DOCUMENT_POSITION_PRECEDING,n=c&&n===i||f&&d===i||T||k?Node.DOCUMENT_POSITION_CONTAINED_BY:!c&&n===i||!f&&d===i?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:_,n&Node.DOCUMENT_POSITION_DISCONNECTED||n&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||E5(n,this._fragmentFiber,a[0],a[a.length-1],i)?n:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function E5(i,n,a,c,d){var f=rr(d);if(i&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!f)e:{for(;f!==null;){if(f.tag===7&&(f===n||f.alternate===n)){a=!0;break e}f=f.return}a=!1}return a}if(i&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=d.ownerDocument,d===f||d===f.documentElement||d===f.body;e:{for(f=n,n=x(n);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==n&&f.alternate!==n)){f=!0;break e}f=f.return}f=!1}return f}return i&Node.DOCUMENT_POSITION_PRECEDING?((n=!!f)&&!(n=f===a)&&(n=B(a,f,q),n===null?n=!1:(v(n,!0,N,f,a),f=E,E=null,n=f!==null)),n):i&Node.DOCUMENT_POSITION_FOLLOWING?((n=!!f)&&!(n=f===c)&&(n=B(c,f,q),n===null?n=!1:(v(n,!0,L,f,c),f=E,A=E=null,n=f!==null)),n):!1}function Zv(i,n){var a=i.ownerDocument.createRange();a.selectNodeContents(i),i=a.getBoundingClientRect(),window.scrollTo(window.scrollX+i.left,n?window.scrollY+i.top:window.scrollY+i.bottom-window.innerHeight)}Vi.prototype.scrollIntoView=function(i){if(typeof i=="object")throw Error(r(566));var n=[];v(this._fragmentFiber.child,!1,Lf,n,void 0,void 0);var a=i!==!1;if(n.length===0){var c=w(this._fragmentFiber);if(c=a?c[1]||c[0]||x(this._fragmentFiber):c[0]||c[1],c===null)return;if(c.tag===6){i=j(c),Zv(i,a);return}if(c=j(c),c.nodeType!==9){if(c.nodeType===11){a="host"in c?c.host:null,a!==null&&a.scrollIntoView(i);return}c.scrollIntoView(i)}}for(c=a?n.length-1:0;c!==(a?-1:n.length);){var d=n[c];d.tag===6?(d=j(d),Zv(d,a)):j(d).scrollIntoView(i),c+=a?-1:1}};function M5(i,n){return i=j(i),Xv(i,n),!1}function Xv(i,n){i.reactFragments==null&&(i.reactFragments=new Set),i.reactFragments.add(n)}function Qv(i,n){var a=n._eventListeners;if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];i.addEventListener(d.type,d.attachedListener,Ta(d.optionsOrUseCapture))}i.nodeType!==3&&(a=n._observers,a!==null&&a.forEach(function(f){for(var _=0,k=0;k<gs.length;k++){var T=gs[k];(T.fragmentInstance!==n||T.observer!==f||T.instance!==i)&&(gs[_++]=T)}gs.length=_,f.observe(i)}),Xv(i,n))}function A5(i,n){var a=n._eventListeners;if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];i.removeEventListener(d.type,d.attachedListener,Ta(d.optionsOrUseCapture))}i.nodeType!==3&&(a=n._observers,a!==null&&a.forEach(function(f){typeof f.rootMargin=="string"?k5(n,f,i):f.unobserve(i)}),i.reactFragments!=null&&i.reactFragments.delete(n))}function Of(i){var n=i.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Of(a),Wo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function T5(i,n,a,c){for(;i.nodeType===1;){var d=a;if(i.nodeName.toLowerCase()!==n.toLowerCase()){if(!c&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(c){if(!i[ll])switch(n){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(f=i.getAttribute("rel"),f==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(f!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(f=i.getAttribute("src"),(f!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&f&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(n==="input"&&i.type==="hidden"){var f=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===f)return i}else return i;if(i=ts(i.nextSibling),i===null)break}return null}function N5(i,n,a){if(n==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=ts(i.nextSibling),i===null))return null;return i}function Jv(i,n){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!n||(i=ts(i.nextSibling),i===null))return null;return i}function zf(i){return i.data==="$?"||i.data==="$~"}function Hf(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function D5(i,n){var a=i.ownerDocument;if(i.data==="$~")i._reactRetry=n;else if(i.data!=="$?"||a.readyState!=="loading")n();else{var c=function(){n(),a.removeEventListener("DOMContentLoaded",c)};a.addEventListener("DOMContentLoaded",c),i._reactRetry=c}}function ts(i){for(;i!=null;i=i.nextSibling){var n=i.nodeType;if(n===1||n===3)break;if(n===8){if(n=i.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return i}var If=null;function ey(i){i=i.nextSibling;for(var n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"||a==="/&"){if(n===0)return ts(i.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}i=i.nextSibling}return null}function ty(i){i=i.previousSibling;for(var n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return i;n--}else a!=="/$"&&a!=="/&"||n++}i=i.previousSibling}return null}function R5(i,n){function a(){c=!0}if(i.ownerDocument.activeElement===i)return!0;var c=!1;try{i.ownerDocument.addEventListener("focus",a,!0),(i.focus||HTMLElement.prototype.focus).call(i,n)}finally{i.ownerDocument.removeEventListener("focus",a,!0)}return c}function L5(i){Pv(function(){Pv(function(n){return i(n)})})}function iy(i,n,a){switch(n=Vl(a),i){case"html":if(i=n.documentElement,!i)throw Error(r(452));return i;case"head":if(i=n.head,!i)throw Error(r(453));return i;case"body":if(i=n.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function sy(i,n,a){for(var c in a){var d=a[c];a.hasOwnProperty(c)&&d!=null&&Qe(i,n,c,null,c5,d)}a.dangerouslySetInnerHTML!=null&&(i.textContent=""),i.onclick===Ss&&(i.onclick=null),Wo(i)}function Uf(i){for(var n=i.attributes;n.length;)i.removeAttributeNode(n[0]);Wo(i)}var is=new Map,ny=new Set;function $l(i){if(typeof i.getRootNode=="function"){var n=i.getRootNode();if(n.nodeType===9||n.nodeType===11)return n}return i.nodeType===9?i:i.ownerDocument}var an=_e.d;_e.d={f:B5,r:O5,D:z5,C:H5,L:I5,m:U5,X:q5,S:P5,M:V5};function B5(){var i=an.f(),n=Yc();return i||n}function O5(i){var n=Gr(i);n!==null&&n.tag===5&&n.type==="form"?ag(n):an.r(i)}var Na=typeof document>"u"?null:document;function ry(i,n,a){var c=Na;if(c&&typeof n=="string"&&n){var d=Yi(n);d='link[rel="'+i+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),ny.has(d)||(ny.add(d),i={rel:i,crossOrigin:a,href:n},c.querySelector(d)===null&&(n=c.createElement("link"),Qt(n,"link",i),zt(n),c.head.appendChild(n)))}}function z5(i){an.D(i),ry("dns-prefetch",i,null)}function H5(i,n){an.C(i,n),ry("preconnect",i,n)}function I5(i,n,a){an.L(i,n,a);var c=Na;if(c&&i&&n){var d='link[rel="preload"][as="'+Yi(n)+'"]';n==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+Yi(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+Yi(a.imageSizes)+'"]')):d+='[href="'+Yi(i)+'"]';var f=d;switch(n){case"style":f=Da(i);break;case"script":f=Ra(i)}if(!(is.has(f)||(i=I({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:i,as:n},a),is.set(f,i),c.querySelector(d)!==null||n==="style"&&c.querySelector(Wl(f))||n==="script"&&c.querySelector(Fl(f))))){var _=c.createElement("link");Qt(_,"link",i),n==="style"&&(_[$o]=!0,_.onload=_.onerror=function(){y1(_)}),zt(_),c.head.appendChild(_)}}}function U5(i,n){an.m(i,n);var a=Na;if(a&&i){var c=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+Yi(c)+'"][href="'+Yi(i)+'"]',f=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ra(i)}if(!is.has(f)&&(i=I({rel:"modulepreload",href:i},n),is.set(f,i),a.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Fl(f)))return}c=a.createElement("link"),Qt(c,"link",i),zt(c),a.head.appendChild(c)}}}function P5(i,n,a){an.S(i,n,a);var c=Na;if(c&&i){var d=Zr(c).hoistableStyles,f=Da(i);n=n||"default";var _=d.get(f);if(!_){var k={loading:0,preload:null};if(_=c.querySelector(Wl(f)))k.loading=5;else{i=I({rel:"stylesheet",href:i,"data-precedence":n},a),(a=is.get(f))&&Pf(i,a);var T=_=c.createElement("link");zt(T),Qt(T,"link",i),T._p=new Promise(function(G,te){T.onload=G,T.onerror=te}),T.addEventListener("load",function(){k.loading|=1}),T.addEventListener("error",function(){k.loading|=2}),k.loading|=4,th(_,n,c)}_={type:"stylesheet",instance:_,count:1,state:k},d.set(f,_)}}}function q5(i,n){an.X(i,n);var a=Na;if(a&&i){var c=Zr(a).hoistableScripts,d=Ra(i),f=c.get(d);f||(f=a.querySelector(Fl(d)),f||(i=I({src:i,async:!0},n),(n=is.get(d))&&qf(i,n),f=a.createElement("script"),zt(f),Qt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},c.set(d,f))}}function V5(i,n){an.M(i,n);var a=Na;if(a&&i){var c=Zr(a).hoistableScripts,d=Ra(i),f=c.get(d);f||(f=a.querySelector(Fl(d)),f||(i=I({src:i,async:!0,type:"module"},n),(n=is.get(d))&&qf(i,n),f=a.createElement("script"),zt(f),Qt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},c.set(d,f))}}function ay(i,n,a,c){var d=(d=Di.current)?$l(d):null;if(!d)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Da(a.href),n=Zr(d).hoistableStyles,c=n.get(a),c||(c={type:"style",instance:null,count:0,state:null},n.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=Da(a.href);var f=Zr(d).hoistableStyles,_=f.get(i);if(_||(d=d.ownerDocument||d,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(i,_),(f=d.querySelector(Wl(i)))?f._p||(_.instance=f,_.state.loading=5):(f=is.get(i),f||(f={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},is.set(i,f)),$5(d,i,f,_.state))),n&&c===null)throw Error(r(528,""));return _}if(n&&c!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(a=Ra(a),n=Zr(d).hoistableScripts,c=n.get(a),c||(c={type:"script",instance:null,count:0,state:null},n.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Da(i){return'href="'+Yi(i)+'"'}function Wl(i){return'link[rel="stylesheet"]['+i+"]"}function ly(i){return I({},i,{"data-precedence":i.precedence,precedence:null})}function $5(i,n,a,c){if(n=i.querySelector('link[rel="preload"][as="style"]['+n+"]")){if(n[$o]!==!0){c.loading=1;return}}else n=i.createElement("link"),n[$o]=!0,n.onload=n.onerror=y1.bind(null,n),Qt(n,"link",a),zt(n),i.head.appendChild(n);c.preload=n,n.addEventListener("load",function(){return c.loading|=1}),n.addEventListener("error",function(){return c.loading|=2})}function Ra(i){return'[src="'+Yi(i)+'"]'}function Fl(i){return"script[async]"+i}function oy(i,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var c=i.querySelector('style[data-href~="'+Yi(a.href)+'"]');if(c)return n.instance=c,zt(c),c;var d=I({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(i.ownerDocument||i).createElement("style"),zt(c),Qt(c,"style",d),th(c,a.precedence,i),n.instance=c;case"stylesheet":d=Da(a.href);var f=i.querySelector(Wl(d));if(f)return n.state.loading|=4,n.instance=f,zt(f),f;c=ly(a),(d=is.get(d))&&Pf(c,d),f=(i.ownerDocument||i).createElement("link"),zt(f);var _=f;return _._p=new Promise(function(k,T){_.onload=k,_.onerror=T}),Qt(f,"link",c),n.state.loading|=4,th(f,a.precedence,i),n.instance=f;case"script":return f=Ra(a.src),(d=i.querySelector(Fl(f)))?(n.instance=d,zt(d),d):(c=a,(d=is.get(f))&&(c=I({},a),qf(c,d)),i=i.ownerDocument||i,d=i.createElement("script"),zt(d),Qt(d,"link",c),i.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(c=n.instance,n.state.loading|=4,th(c,a.precedence,i));return n.instance}function th(i,n,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=c.length?c[c.length-1]:null,f=d,_=0;_<c.length;_++){var k=c[_];if(k.dataset.precedence===n)f=k;else if(f!==d)break}f?f.parentNode.insertBefore(i,f.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(i,n.firstChild))}function Pf(i,n){i.crossOrigin==null&&(i.crossOrigin=n.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=n.referrerPolicy),i.title==null&&(i.title=n.title)}function qf(i,n){i.crossOrigin==null&&(i.crossOrigin=n.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=n.referrerPolicy),i.integrity==null&&(i.integrity=n.integrity)}var ih=null;function cy(i,n,a){if(ih===null){var c=new Map,d=ih=new Map;d.set(a,c)}else d=ih,c=d.get(a),c||(c=new Map,d.set(a,c));if(c.has(i))return c;for(c.set(i,null),a=a.getElementsByTagName(i),d=0;d<a.length;d++){var f=a[d];if(!(f[ll]||f[Kt]||i==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var _=f.getAttribute(n)||"";_=i+_;var k=c.get(_);k?k.push(f):c.set(_,[f])}}return c}function Vf(i,n,a){i=i.ownerDocument||i,i.head.insertBefore(a,n==="title"?i.querySelector("head > title"):null)}function W5(i,n,a){if(a===1||n.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(i=n.disabled,typeof n.precedence=="string"&&i==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function hy(i,n){return i==="img"&&n.src!=null&&n.src!==""&&n.onLoad==null&&n.loading!=="lazy"}function uy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function dy(i){return(i.width||100)*(i.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function fy(i,n){typeof n.decode=="function"&&(i.imgCount++,n.complete||(i.imgBytes+=dy(n),i.suspenseyImages.push(n)),i=Y5.bind(i),n.decode().then(i,i))}function F5(i,n,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var d=Da(c.href),f=n.querySelector(Wl(d));if(f){n=f._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(i.count++,i=Kl.bind(i),n.then(i,i)),a.state.loading|=4,a.instance=f,zt(f);return}f=n.ownerDocument||n,c=ly(c),(d=is.get(d))&&Pf(c,d),f=f.createElement("link"),zt(f);var _=f;_._p=new Promise(function(k,T){_.onload=k,_.onerror=T}),Qt(f,"link",c),a.instance=f}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(i.count++,a=Kl.bind(i),n.addEventListener("load",a),n.addEventListener("error",a))}}var sh=0;function K5(i,n){return i.stylesheets&&i.count===0&&rh(i,i.stylesheets),0<i.count||0<i.imgCount?function(a){var c=setTimeout(function(){if(i.stylesheets&&rh(i,i.stylesheets),i.unsuspend){var f=i.unsuspend;i.unsuspend=null,f()}},6e4+n);0<i.imgBytes&&sh===0&&(sh=62500*u5());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&rh(i,i.stylesheets),i.unsuspend)){var f=i.unsuspend;i.unsuspend=null,f()}},(i.imgBytes>sh?50:800)+n);return i.unsuspend=a,function(){i.unsuspend=null,clearTimeout(c),clearTimeout(d)}}:null}function py(i){if(i.count===0&&(i.imgCount===0||!i.waitingForImages)){if(i.stylesheets)rh(i,i.stylesheets);else if(i.unsuspend){var n=i.unsuspend;i.unsuspend=null,n()}}}function Kl(){this.count--,py(this)}function Y5(){this.imgCount--,py(this)}var nh=null;function rh(i,n){i.stylesheets=null,i.unsuspend!==null&&(i.count++,nh=new Map,n.forEach(G5,i),nh=null,Kl.call(i))}function G5(i,n){if(!(n.state.loading&4)){var a=nh.get(i);if(a)var c=a.get(null);else{a=new Map,nh.set(i,a);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<d.length;f++){var _=d[f];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),c=_)}c&&a.set(null,c)}d=n.instance,_=d.getAttribute("data-precedence"),f=a.get(_)||c,f===c&&a.set(null,d),a.set(_,d),this.count++,c=Kl.bind(this),d.addEventListener("load",c),d.addEventListener("error",c),f?f.parentNode.insertBefore(d,f.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),n.state.loading|=4}}var La={$$typeof:X,Provider:null,Consumer:null,_currentValue:Le,_currentValue2:Le,_threadCount:0};function Z5(i,n,a,c,d,f,_,k,T){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Su(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Su(0),this.hiddenUpdates=Su(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=f,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.transitionTypes=null,this.incompleteTransitions=new Map}function my(i,n,a,c,d,f,_,k,T,G,te,re){return i=new Z5(i,n,a,_,T,G,te,re,k),n=1,f===!0&&(n|=24),f=Ci(3,null,null,n),i.current=f,f.stateNode=i,n=sd(),n.refCount++,i.pooledCache=n,n.refCount++,f.memoizedState={element:c,isDehydrated:a,cache:n},ld(f),i}function gy(i){return i?(i=aa,i):aa}function vy(i,n,a,c,d,f){d=gy(d),c.context===null?c.context=d:c.pendingContext=d,c=Mn(n),c.payload={element:a},f=f===void 0?null:f,f!==null&&(c.callback=f),a=An(i,c,n),a!==null&&(Mi(a,i,n),Cl(a,i,n))}function yy(i,n){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<n?a:n}}function $f(i,n){yy(i,n),(i=i.alternate)&&yy(i,n)}function _y(i){if(i.tag===13||i.tag===31){var n=cr(i,67108864);n!==null&&Mi(n,i,67108864),$f(i,67108864)}}function xy(i){if(i.tag===13||i.tag===31){var n=qi();n=bu(n);var a=cr(i,n);a!==null&&Mi(a,i,n),$f(i,n)}}var Ba=!0;function X5(i,n,a,c){var d=me.T;me.T=null;var f=_e.p;try{_e.p=2,Wf(i,n,a,c)}finally{_e.p=f,me.T=d}}function Q5(i,n,a,c){var d=me.T;me.T=null;var f=_e.p;try{_e.p=8,Wf(i,n,a,c)}finally{_e.p=f,me.T=d}}function Wf(i,n,a,c){if(Ba){var d=Ff(c);if(d===null)jf(i,n,c,ah,a),Sy(i,c);else if(e6(d,i,n,a,c))c.stopPropagation();else if(Sy(i,c),n&4&&-1<J5.indexOf(i)){for(;d!==null;){var f=Gr(d);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var _=nr(f.pendingLanes);if(_!==0){var k=f;for(k.pendingLanes|=2,k.entangledLanes|=2;_;){var T=1<<31-Bi(_);k.entanglements[1]|=T,_&=~T}Ds(f),(Ke&6)===0&&(Wc=Ri()+500,Ul(0))}}break;case 31:case 13:k=cr(f,2),k!==null&&Mi(k,f,2),Yc(),$f(f,2)}if(f=Ff(c),f===null&&jf(i,n,c,ah,a),f===d)break;d=f}d!==null&&c.stopPropagation()}else jf(i,n,c,null,a)}}function Ff(i){return i=Tu(i),Kf(i)}var ah=null;function Kf(i){if(ah=null,i=rr(i),i!==null){var n=h(i);if(n===null)i=null;else{var a=n.tag;if(a===13){if(i=u(n),i!==null)return i;i=null}else if(a===31){if(i=p(n),i!==null)return i;i=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;i=null}else n!==i&&(i=null)}}return ah=i,null}function wy(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ub()){case a1:return 2;case l1:return 8;case Io:case db:return 32;case o1:return 268435456;default:return 32}default:return 32}}var Yf=!1,Pn=null,qn=null,Vn=null,Yl=new Map,Gl=new Map,$n=[],J5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Sy(i,n){switch(i){case"focusin":case"focusout":Pn=null;break;case"dragenter":case"dragleave":qn=null;break;case"mouseover":case"mouseout":Vn=null;break;case"pointerover":case"pointerout":Yl.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gl.delete(n.pointerId)}}function Zl(i,n,a,c,d,f){return i===null||i.nativeEvent!==f?(i={blockedOn:n,domEventName:a,eventSystemFlags:c,nativeEvent:f,targetContainers:[d]},n!==null&&(n=Gr(n),n!==null&&_y(n)),i):(i.eventSystemFlags|=c,n=i.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),i)}function e6(i,n,a,c,d){switch(n){case"focusin":return Pn=Zl(Pn,i,n,a,c,d),!0;case"dragenter":return qn=Zl(qn,i,n,a,c,d),!0;case"mouseover":return Vn=Zl(Vn,i,n,a,c,d),!0;case"pointerover":var f=d.pointerId;return Yl.set(f,Zl(Yl.get(f)||null,i,n,a,c,d)),!0;case"gotpointercapture":return f=d.pointerId,Gl.set(f,Zl(Gl.get(f)||null,i,n,a,c,d)),!0}return!1}function by(i){var n=rr(i.target);if(n!==null){var a=h(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){i.blockedOn=n,m1(i.priority,function(){xy(a)});return}}else if(n===31){if(n=p(a),n!==null){i.blockedOn=n,m1(i.priority,function(){xy(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function lh(i){if(i.blockedOn!==null)return!1;for(var n=i.targetContainers;0<n.length;){var a=Ff(i.nativeEvent);if(a===null){a=i.nativeEvent;var c=new a.constructor(a.type,a);Au=c,a.target.dispatchEvent(c),Au=null}else return n=Gr(a),n!==null&&_y(n),i.blockedOn=a,!1;n.shift()}return!0}function Cy(i,n,a){lh(i)&&a.delete(n)}function t6(){Yf=!1,Pn!==null&&lh(Pn)&&(Pn=null),qn!==null&&lh(qn)&&(qn=null),Vn!==null&&lh(Vn)&&(Vn=null),Yl.forEach(Cy),Gl.forEach(Cy)}function oh(i,n){i.blockedOn===n&&(i.blockedOn=null,Yf||(Yf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,t6)))}var ch=null;function ky(i){ch!==i&&(ch=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ch===i&&(ch=null);for(var n=0;n<i.length;n+=3){var a=i[n],c=i[n+1],d=i[n+2];if(typeof c!="function"){if(Kf(c||a)===null)continue;break}var f=Gr(a);f!==null&&(i.splice(n,3),n-=3,Md(f,{pending:!0,data:d,method:a.method,action:c},c,d))}}))}function Oa(i){function n(T){return oh(T,i)}Pn!==null&&oh(Pn,i),qn!==null&&oh(qn,i),Vn!==null&&oh(Vn,i),Yl.forEach(n),Gl.forEach(n);for(var a=0;a<$n.length;a++){var c=$n[a];c.blockedOn===i&&(c.blockedOn=null)}for(;0<$n.length&&(a=$n[0],a.blockedOn===null);)by(a),a.blockedOn===null&&$n.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(c=0;c<a.length;c+=3){var d=a[c],f=a[c+1],_=d[bi]||null;if(typeof f=="function")_||ky(a);else if(_){var k=null;if(f&&f.hasAttribute("formAction")){if(d=f,_=f[bi]||null)k=_.formAction;else if(Kf(d)!==null)continue}else k=_.action;typeof k=="function"?a[c+1]=k:(a.splice(c,3),c-=3),ky(a)}}}function jy(){function i(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(_){return d=_})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),c||setTimeout(a,20)}function a(){if(!c&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,d=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){c=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function Gf(i){this._internalRoot=i}hh.prototype.render=Gf.prototype.render=function(i){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,c=qi();vy(a,c,i,n,null,null)},hh.prototype.unmount=Gf.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var n=i.containerInfo;vy(i.current,2,null,i,null,null),Yc(),n[Yr]=null}};function hh(i){this._internalRoot=i}hh.prototype.unstable_scheduleHydration=function(i){if(i){var n=p1();i={blockedOn:null,target:i,priority:n};for(var a=0;a<$n.length&&n!==0&&n<$n[a].priority;a++);$n.splice(a,0,i),a===0&&by(i)}};var Ey=t.version;if(Ey!=="19.3.0")throw Error(r(527,Ey,"19.3.0"));_e.findDOMNode=function(i){var n=i._reactInternals;if(n===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=g(n),i=i!==null?y(i):null,i=i===null?null:i.stateNode,i};var i6={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:me,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uh.isDisabled&&uh.supportsFiber)try{nl=uh.inject(i6),Li=uh}catch{}}return Jl.createRoot=function(i,n){if(!l(i))throw Error(r(299));var a=!1,c="",d=gg,f=vg,_=yg;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=my(i,1,!1,null,null,a,c,null,d,f,_,jy),i[Yr]=n.current,kf(i),new Gf(n)},Jl.hydrateRoot=function(i,n,a){if(!l(i))throw Error(r(299));var c=!1,d="",f=gg,_=vg,k=yg,T=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError),a.formState!==void 0&&(T=a.formState)),n=my(i,1,!0,n,a??null,c,d,T,f,_,k,jy),n.context=gy(null),a=n.current,c=qi(),c=bu(c),d=Mn(c),d.callback=null,An(a,d,c),a=c,n.current.lanes=a,al(n,a),Ds(n),i[Yr]=n.current,kf(i),new hh(n)},Jl.version="19.3.0",Jl}var qy;function j6(){if(qy)return Jf.exports;qy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Jf.exports=k6(),Jf.exports}var E6=j6(),b=mp();function gp(e){return e.kind==="connecting"||e.kind==="retrying"}function M6(e,t,s){return e==="running"||t>0||s.profiles.length>0}function A6(e){const t=e.filter(gp).length,s=e.filter(h=>h.kind==="failed"||h.kind==="notInstalled"||h.kind==="confirmHostKey").length,r=e.filter(h=>h.kind==="connected").length,l=e.filter(h=>h.kind==="idle").length;return[t&&`${t} connecting…`,s&&`${s} ${s===1?"needs":"need"} attention`,r&&`${r} opening…`,l&&`${l} not connected`].filter(Boolean).join(" · ")}function Ax(e,t=!0){switch(e.kind){case"idle":return"Not connected";case"connecting":return e.step;case"retrying":return`${e.message} Retrying…`;case"confirmHostKey":return"Confirm host key…";case"connected":return t?"Connected":"Connected · opening…";case"failed":return e.message;case"notInstalled":return"Host not installed"}}const l2=window.matchMedia("(prefers-color-scheme: dark)"),o2=window.matchMedia("(prefers-reduced-motion: reduce)"),Tx=e=>t=>(e.addEventListener("change",t),()=>e.removeEventListener("change",t));function vp(){return b.useSyncExternalStore(Tx(l2),()=>l2.matches)}function Qa(){return b.useSyncExternalStore(Tx(o2),()=>o2.matches)}const To=()=>l2.matches,c2=()=>o2.matches,T6=e=>({text:e?[242,242,242]:[20,20,20],secondary:e?"#9a9a9a":"#6b6b6b",background:e?"#0a0a0a":"#ffffff"}),$h=[{id:"black",label:"Black",hex:"#2B2B2B"},{id:"brown",label:"Brown",hex:"#936439"},{id:"red",label:"Red",hex:"#FF263C"},{id:"orange",label:"Orange",hex:"#FF6700"},{id:"yellow",label:"Yellow",hex:"#FF9800"},{id:"green",label:"Green",hex:"#00C972"},{id:"cyan",label:"Cyan",hex:"#00BCA6"},{id:"blue",label:"Blue",hex:"#1084FE"},{id:"violet",label:"Violet",hex:"#9159FE"},{id:"magenta",label:"Magenta",hex:"#FF309B"},{id:"gray",label:"Gray",hex:"#777777"}],Nx=["blob","pebble","squircle","tablet","wedge","hex","cloud","teardrop"];function _s(e){return($h.find(t=>t.id===e)??$h[7]).hex}function Rr(e,t){const s=parseInt(e.slice(1),16);return`rgba(${s>>16&255}, ${s>>8&255}, ${s&255}, ${t})`}const N6=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];const D6=[["path",{d:"M8 3 4 7l4 4"}],["path",{d:"M4 7h16"}],["path",{d:"m16 21 4-4-4-4"}],["path",{d:"M20 17H4"}]];const R6=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];const L6=[["path",{d:"M17 12H3"}],["path",{d:"m11 18 6-6-6-6"}],["path",{d:"M21 5v14"}]];const B6=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];const O6=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];const z6=[["path",{d:"M2 10v3"}],["path",{d:"M6 6v11"}],["path",{d:"M10 3v18"}],["path",{d:"M14 8v7"}],["path",{d:"M18 5v13"}],["path",{d:"M22 10v3"}]];const H6=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const I6=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M11.68 2.009A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673c-.824-.85-1.678-1.731-2.21-3.348"}],["circle",{cx:"18",cy:"5",r:"3"}]];const U6=[["path",{d:"M12 5v16"}],["path",{d:"M16 13h2"}],["path",{d:"M16 9h2"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z"}],["path",{d:"M6 13h2"}],["path",{d:"M6 9h2"}]];const P6=[["path",{d:"M12 5v16"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z"}]];const q6=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"}]];const V6=[["path",{d:"M8 2v3"}],["path",{d:"M16 2v3"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}],["path",{d:"M3 9h18"}]];const $6=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]];const W6=[["path",{d:"M20 6 9 17l-5-5"}]];const F6=[["path",{d:"m6 9 6 6 6-6"}]];const K6=[["path",{d:"m15 18-6-6 6-6"}]];const Y6=[["path",{d:"m18 15-6-6-6 6"}]];const G6=[["path",{d:"m9 18 6-6-6-6"}]];const Z6=[["path",{d:"m11 17-5-5 5-5"}],["path",{d:"m18 17-5-5 5-5"}]];const X6=[["path",{d:"m6 17 5-5-5-5"}],["path",{d:"m13 17 5-5-5-5"}]];const Q6=[["path",{d:"m7 15 5 5 5-5"}],["path",{d:"m7 9 5-5 5 5"}]];const Vy=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]];const J6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 8v8"}],["path",{d:"m8 12 4 4 4-4"}]];const $y=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const eC=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"}]];const tC=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"12",cy:"12",r:"10"}]];const iC=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M17 12h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M7 12h.01"}]];const sC=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}]];const nC=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z"}],["circle",{cx:"12",cy:"12",r:"10"}]];const rC=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}],["path",{d:"M12 8v8"}]];const aC=[["circle",{cx:"12",cy:"12",r:"10"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1"}]];const lC=[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"10",r:"3"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"}]];const Wy=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];const Dx=[["circle",{cx:"12",cy:"12",r:"10"}]];const oC=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];const cC=[["path",{d:"M11 14h10"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344"}],["path",{d:"m17 18 4-4-4-4"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}]];const Fy=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];const hC=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];const uC=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"}]];const dC=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z"}]];const Ky=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];const fC=[["path",{d:"M12 20v2"}],["path",{d:"M12 2v2"}],["path",{d:"M17 20v2"}],["path",{d:"M17 2v2"}],["path",{d:"M2 12h2"}],["path",{d:"M2 17h2"}],["path",{d:"M2 7h2"}],["path",{d:"M20 12h2"}],["path",{d:"M20 17h2"}],["path",{d:"M20 7h2"}],["path",{d:"M7 20v2"}],["path",{d:"M7 2v2"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1"}]];const pC=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];const mC=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];const gC=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];const vC=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];const yC=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 12v-1"}],["path",{d:"M8 18v-2"}],["path",{d:"M8 7V6"}],["circle",{cx:"8",cy:"20",r:"2"}]];const _C=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M9 15h6"}],["path",{d:"M12 18v-6"}]];const n0=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];const xC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];const wC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M7 3v18"}],["path",{d:"M3 7.5h4"}],["path",{d:"M3 12h18"}],["path",{d:"M3 16.5h4"}],["path",{d:"M17 3v18"}],["path",{d:"M17 7.5h4"}],["path",{d:"M17 16.5h4"}]];const SC=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];const bC=[["path",{d:"m12 14 4-4"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}]];const CC=[["path",{d:"M15 6a9 9 0 0 0-9 9V3"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}]];const kC=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]];const jC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];const EC=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9"}],["path",{d:"m18 15 4-4"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5"}]];const MC=[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5"}]];const AC=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const TC=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}]];const NC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];const DC=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2"}]];const RC=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];const LC=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];const BC=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor"}]];const OC=[["path",{d:"m2 21 9.6-9.6"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5"}]];const zC=[["path",{d:"M10 8h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M14 8h.01"}],["path",{d:"M16 12h.01"}],["path",{d:"M18 8h.01"}],["path",{d:"M6 8h.01"}],["path",{d:"M7 16h10"}],["path",{d:"M8 12h.01"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}]];const HC=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z"}],["path",{d:"M20.054 15.987H3.946"}]];const IC=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}]];const UC=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];const PC=[["path",{d:"M13 5h8"}],["path",{d:"M13 12h8"}],["path",{d:"M13 19h8"}],["path",{d:"m3 17 2 2 4-4"}],["path",{d:"m3 7 2 2 4-4"}]];const qC=[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]];const VC=[["path",{d:"m16 17 5-5-5-5"}],["path",{d:"M21 12H9"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}]];const $C=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"}],["path",{d:"M7 11h10"}],["path",{d:"M7 15h6"}],["path",{d:"M7 7h8"}]];const Yy=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"}]];const WC=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1"}]];const Gy=[["path",{d:"M12 19v3"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}]];const Zy=[["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]];const FC=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const KC=[["path",{d:"M12 17v4"}],["path",{d:"M22 12.307V15a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8.693"}],["path",{d:"M8 21h8"}],["circle",{cx:"19",cy:"6",r:"3"}]];const YC=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"}],["path",{d:"M10 19v-3.96 3.15"}],["path",{d:"M7 19h5"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2"}]];const Xy=[["path",{d:"m14.5 12.5-5-5"}],["path",{d:"m9.5 12.5 5-5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["path",{d:"M12 17v4"}],["path",{d:"M8 21h8"}]];const Qy=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];const GC=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"}]];const ZC=[["path",{d:"M14 4.1 12 6"}],["path",{d:"m5.1 8-2.9-.8"}],["path",{d:"m6 12-1.9 2"}],["path",{d:"M7.2 2.2 8 5.1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"}]];const XC=[["path",{d:"M9 18V5l12-2v13"}],["circle",{cx:"6",cy:"18",r:"3"}],["circle",{cx:"18",cy:"16",r:"3"}]];const QC=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]];const JC=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"}],["path",{d:"M12 22V12"}],["polyline",{points:"3.29 7 12 12 20.71 7"}],["path",{d:"m7.5 4.27 9 5.15"}]];const e8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M9 3v18"}]];const t8=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];const i8=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272"}],["path",{d:"M22 2 2 22"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473"}]];const s8=[["path",{d:"M12 17v5"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"}]];const Jy=[["path",{d:"M12 17v5"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"}]];const n8=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];const r8=[["path",{d:"M22 14a8 8 0 0 1-8 8"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const a8=[["path",{d:"M12 2v10"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04"}]];const l8=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3"}],["path",{d:"M21 21v.01"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7"}],["path",{d:"M3 12h.01"}],["path",{d:"M12 3h.01"}],["path",{d:"M12 16v.01"}],["path",{d:"M16 12h1"}],["path",{d:"M21 12v.01"}],["path",{d:"M12 21v-1"}]];const o8=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];const c8=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}],["path",{d:"m9 17-5-5 5-5"}]];const h8=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}],["path",{d:"M12 7v5l4 2"}]];const u8=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const e_=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];const d8=[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"}]];const f8=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];const fh=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18"}]];const p8=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];const m8=[["path",{d:"M12 2v13"}],["path",{d:"m16 6-4-4-4 4"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}]];const g8=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m9 12 2 2 4-4"}]];const v8=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const y8=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]];const _8=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}],["path",{d:"M20 2v4"}],["path",{d:"M22 4h-4"}],["circle",{cx:"4",cy:"20",r:"2"}]];const x8=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}],["path",{d:"m21 3-9 9"}],["path",{d:"M15 3h6v6"}]];const w8=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"}]];const S8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];const b8=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]];const C8=[["path",{d:"M12 19h8"}],["path",{d:"m4 17 6-6-6-6"}]];const k8=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];const r0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];const j8=[["path",{d:"m16 11 2 2 4-4"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}]];const E8=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11"}]];const t_=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]];const M8=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}],["circle",{cx:"9",cy:"7",r:"4"}]];const i_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]];const A8=[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z"}],["path",{d:"m16.5 14.5 5-5"}],["path",{d:"m16.5 9.5 5 5"}]];const T8=[["path",{d:"m10.586 5.414-5.172 5.172"}],["path",{d:"m18.586 13.414-5.172 5.172"}],["path",{d:"M6 12h12"}],["circle",{cx:"12",cy:"20",r:"2"}],["circle",{cx:"12",cy:"4",r:"2"}],["circle",{cx:"20",cy:"12",r:"2"}],["circle",{cx:"4",cy:"12",r:"2"}]];const N8=[["path",{d:"M12 20h.01"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764"}],["path",{d:"m2 2 20 20"}]];const D8=[["path",{d:"M12 20h.01"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}]];const R8=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"}]];const L8=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const B8=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"}]],O8=[["path",{fill:"currentColor",stroke:"none",d:"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"}]],z8={"arrow.clockwise":e_,"arrow.counterclockwise":u8,"arrow.down":N6,"arrow.down.to.line":pC,"arrow.down.circle":J6,"arrow.down.right.and.arrow.up.left":FC,"arrow.left":R6,"arrow.left.arrow.right":D6,"arrow.right":B6,"arrow.right.doc.on.clipboard":oC,"arrow.up.doc.on.clipboard":cC,"arrow.right.to.line":L6,"arrow.triangle.2.circlepath":o8,"arrow.triangle.branch":CC,"arrow.up":O6,"arrow.up.right.square":x8,"arrowshape.turn.up.left":c8,"apple.logo":O8,"bell.badge":I6,bolt:B8,book:P6,"book.closed":q6,"book.pages":U6,"bubble.left":Yy,"bubble.left.fill":Yy,"bubble.left.and.bubble.right":WC,calendar:V6,"chart.bar":$6,checklist:PC,checkmark:W6,"checkmark.circle":$y,"checkmark.circle.fill":$y,"checkmark.seal":H6,"chevron.down":F6,"chevron.left":K6,"chevron.left.2":Z6,"chevron.right":G6,"chevron.right.2":X6,"chevron.up":Y6,"chevron.up.chevron.down":Q6,circle:Dx,"circle.dotted":eC,clock:hC,"clock.arrow.circlepath":h8,cloud:uC,cpu:fC,"cursorarrow.motionlines":ZC,desktopcomputer:Qy,"desktopcomputer.trianglebadge.exclamationmark":Xy,display:Qy,"display.2":YC,"display.trianglebadge.exclamationmark":Xy,doc:xC,"doc.badge.plus":_C,"doc.on.clipboard":Fy,"doc.on.clipboard.fill":Fy,"doc.on.doc":Ky,"doc.plaintext":n0,"doc.richtext":n0,"doc.text":n0,"doc.zipper":yC,ellipsis:mC,"ellipsis.circle":iC,exclamationmark:r0,"exclamationmark.circle":Vy,"exclamationmark.circle.fill":Vy,"exclamationmark.triangle":r0,"exclamationmark.triangle.fill":r0,eye:vC,"eye.slash":gC,film:wC,folder:SC,"gauge.with.dots.needle.33percent":bC,gearshape:p8,globe:kC,"house.fill":TC,hammer:EC,"hand.point.up.left":r8,"hand.raised":AC,"hand.raised.slash":MC,"info.circle":LC,iphone:y8,key:OC,"key.fill":BC,"keyboard.chevron.compact.down":zC,laptopcomputer:HC,link:UC,"list.bullet":qC,"list.bullet.rectangle":d8,"lock.display":KC,"lock.shield":g8,macmini:fh,"macpro.gen3":fh,macstudio:fh,magnifyingglass:f8,mic:Zy,"mic.fill":Zy,"mic.slash":Gy,"mic.slash.fill":Gy,"minus.circle":sC,"music.note":XC,network:QC,pencil:t8,person:t_,"person.2":M8,"person.crop.circle":lC,"person.crop.circle.badge.checkmark":j8,"person.crop.circle.badge.plus":E8,"person.fill":t_,"phone.down.fill":i8,photo:NC,"photo.on.rectangle":DC,pin:Jy,"pin.fill":Jy,"pin.slash":s8,"play.circle":nC,plus:n8,"plus.circle":rC,"point.3.connected.trianglepath.dotted":T8,power:a8,qrcode:l8,"record.circle":tC,"rectangle.and.hand.point.up.left":GC,"rectangle.portrait.and.arrow.right":VC,"rotate.right":e_,safari:dC,"server.rack":fh,shippingbox:JC,"sidebar.left":e8,"slider.horizontal.3":v8,sparkles:_8,"speaker.slash.fill":A8,"speaker.wave.2":i_,"speaker.wave.2.fill":i_,"square.and.arrow.up":m8,"square.and.pencil":w8,"square.grid.2x2":IC,"square.grid.3x3":jC,"square.on.square":Ky,star:b8,"stop.circle":aC,"stop.fill":S8,terminal:C8,"text.bubble":$C,tray:RC,trash:k8,waveform:z6,wifi:D8,"wifi.slash":N8,"wrench.and.screwdriver":R8,xmark:L8,"xmark.circle":Wy,"xmark.circle.fill":Wy},s_=new Map;function H8(e){const t=s_.get(e);if(t!==void 0)return t;const r=(z8[e]??Dx).map(([l,h])=>`<${l} ${Object.entries(h).filter(([,u])=>u!==void 0).map(([u,p])=>`${u}="${p}"`).join(" ")}/>`).join("");return s_.set(e,r),r}let Nh=null;const Wh=new Set;window.codync?.platform==="darwin"?fetch("/demo/desktop/symbols/manifest.json").then(e=>e.ok?e.json():{}).then(e=>{Nh=e;for(const t of Wh)t()}).catch(()=>{Nh={};for(const e of Wh)e()}):Nh={};function I8(){return b.useSyncExternalStore(e=>(Wh.add(e),()=>{Wh.delete(e)}),()=>Nh)}function se({name:e,size:t,weight:s="regular",color:r,style:l,className:h,scaled:u=!0,title:p}){const g=I8()?.[e],y=u?`${t}px * var(--scale)`:`${t}px`;if(g){const x=`url("/demo/desktop/symbols/${e}.${s}.png")`;return o.jsx("span",{className:h,title:p,"aria-hidden":p?void 0:!0,style:{display:"inline-block",flex:"none",width:`calc(${g.w} * ${y})`,height:`calc(${g.h} * ${y})`,backgroundColor:r??"currentColor",WebkitMaskImage:x,maskImage:x,WebkitMaskSize:"100% 100%",maskSize:"100% 100%",WebkitMaskRepeat:"no-repeat",...l}})}const v={light:1.5,regular:1.75,medium:2,semibold:2.25,bold:2.5,black:2.75}[s];return o.jsx("svg",{className:h,"aria-hidden":p?void 0:!0,viewBox:"0 0 24 24",fill:"none",stroke:r??"currentColor",strokeWidth:v,strokeLinecap:"round",strokeLinejoin:"round",style:{width:`calc(1.2 * ${y})`,height:`calc(1.2 * ${y})`,flex:"none",...l},dangerouslySetInnerHTML:{__html:(p?`<title>${p}</title>`:"")+H8(e)}})}function U8(e,t,s){const r=new Path2D;let l=0;switch(e){case"pebble":r.ellipse(t/2,s/2,t/2,s*.4,0,0,Math.PI*2);break;case"squircle":r.roundRect(t*.04,s*.04,t*.92,s*.92,t*.3);break;case"tablet":r.roundRect(t*.14,0,t*.72,s,t*.22);break;case"wedge":r.moveTo(t*.5,s*.04),r.quadraticCurveTo(t*.9,s*.4,t*.98,s*.86),r.quadraticCurveTo(t*.5,s*1.04,t*.02,s*.86),r.quadraticCurveTo(t*.1,s*.4,t*.5,s*.04);break;case"hex":for(let h=0;h<6;h++){const u=h*Math.PI/3-Math.PI/2,p=t/2+Math.cos(u)*t*.49,m=s/2+Math.sin(u)*s*.49;h===0?r.moveTo(p,m):r.lineTo(p,m)}r.closePath(),l=t*.08;break;case"cloud":r.ellipse(t*.275,s*.575,t*.275,s*.275,0,0,Math.PI*2),r.moveTo(t,s*.575),r.ellipse(t*.725,s*.575,t*.275,s*.275,0,0,Math.PI*2),r.moveTo(t*.82,s*.4),r.ellipse(t*.5,s*.4,t*.32,s*.32,0,0,Math.PI*2),r.roundRect(t*.1,s*.5,t*.8,s*.35,t*.15);break;case"teardrop":r.moveTo(t*.5,0),r.bezierCurveTo(t*.62,s*.2,t*.94,s*.38,t*.94,s*.62),r.arc(t*.5,s*.62,t*.44,0,Math.PI,!1),r.bezierCurveTo(t*.06,s*.38,t*.38,s*.2,t*.5,0);break;default:{for(let u=0;u<=64;u++){const p=u/64*2*Math.PI,m=.46+.035*Math.sin(p*3+.6),g=t/2+Math.cos(p)*t*m,y=s/2+Math.sin(p)*s*m;u===0?r.moveTo(g,y):r.lineTo(g,y)}r.closePath()}}return{path:r,stroke:l}}const ph=document.createElement("canvas").getContext("2d"),n_=new Map;function P8(e,t,s){const r=`${e}|${t}|${s}`,l=n_.get(r);if(l)return l;const{path:h,stroke:u}=U8(e,t,t),p=t/s,m=[];ph.lineWidth=u,ph.lineJoin="round";for(let g=0;g<s;g++)for(let y=0;y<s;y++){const v=(y+.5)*p,x=(g+.5)*p;(ph.isPointInPath(h,v,x,"nonzero")||u>0&&ph.isPointInStroke(h,v,x))&&m.push({row:g,col:y,x:v,y:x})}return n_.set(r,m),m}const ci=b.memo(function({shape:t,color:s,tint:r,size:l=40,mood:h="idle",dark:u,style:p}){const m=b.useRef(null),g=vp()||u===!0,y=Qa(),v=r??_s(s);return b.useEffect(()=>{const x=m.current;if(!x)return;const S=window.devicePixelRatio||1;x.width=Math.round(l*S),x.height=Math.round(l*S);const w=x.getContext("2d"),C=h==="idle"||y;let j=0;const E=A=>{w.setTransform(S,0,0,S,0,0),w.clearRect(0,0,l,l),yp(w,{shape:t,fill:v,size:l,mood:h,dark:g,t:C?0:A/1e3%3600,still:C}),C||(j=requestAnimationFrame(E))};return E(performance.now()),()=>cancelAnimationFrame(j)},[t,v,l,h,g,y]),o.jsx("canvas",{ref:m,"aria-hidden":!0,style:{width:l,height:l,display:"block",flex:"none",...p}})});function yp(e,{shape:t,fill:s,size:r,mood:l,dark:h,t:u,still:p}){const m=r<18?7:r<28?9:13,g=m===7?[2,4]:m===9?[3,6]:[4,8],y=m===13?[4,5,6]:m===9?[3,4]:[2,3],v=r/m,x=P8(t,r,m),[S,w,C]=T6(h).text,j=parseInt(s.slice(1),16),[E,A,N]=[j>>16&255,j>>8&255,j&255],L=l==="working"?Math.round(Math.sin(u*2*Math.PI/3.2)*1.4):0,B=!p&&u/4.7%1<.035?y.slice(-1):y,I=g.map(M=>M+L),U=r/2,P=l==="working"?u*1.4:-.7,F=Math.sin(P)*.8,$=.55,z=Math.cos(P)*.5+.6,O=Math.hypot(F,$,z);for(const M of x){if(I.includes(M.col)&&B.includes(M.row))continue;const X=(M.x-U)/U,V=(U-M.y)/U,ie=Math.sqrt(Math.max(.2,1-X*X-V*V)),ee=Math.hypot(X,V,ie);let ce=.3+.7*Math.max(0,(X*F+V*$+ie*z)/(ee*O));if(l==="needsInput"){const xe=.5+.5*Math.sin(Math.hypot(X,V)*9-u*5);ce*=.6+.4*xe}const Y=v*.42*(.55+.45*ce),oe=m<13?.4+.4*ce:.2+.4*Math.min(1,ce/.7);e.beginPath(),e.arc(M.x,M.y,Y,0,Math.PI*2),e.fillStyle=`rgba(${S},${w},${C},${oe})`,e.fill(),ce>.6&&(e.fillStyle=`rgba(${E},${A},${N},${(ce-.6)/.4})`,e.fill())}}function Rx(e,t=!0){return t?pn(e)?"needsInput":mn(e)?"working":"idle":"idle"}function hi({bot:e,size:t=40,animated:s=!0}){return o.jsx(ci,{shape:e.avatarShape,color:e.avatarColor,size:t,mood:Rx(e,s)})}function No({members:e,size:t=40,animated:s=!0}){const r=(h,u,p)=>o.jsx("div",{style:{position:"absolute",...p},children:o.jsx(hi,{bot:h,size:u,animated:s})},h.id);let l;switch(e.length){case 0:l=o.jsx("div",{style:{display:"grid",placeItems:"center",width:"100%",height:"100%",color:"var(--secondary)"},children:o.jsx(se,{name:"person.2",size:t*.4})});break;case 1:l=o.jsx(hi,{bot:e[0],size:t,animated:s});break;case 2:l=[r(e[1],t*.66,{top:0,right:0}),r(e[0],t*.66,{bottom:0,left:0})];break;case 3:l=[r(e[0],t*.55,{top:0,left:(t-t*.55)/2}),r(e[1],t*.55,{bottom:0,left:0}),r(e[2],t*.55,{bottom:0,right:0})];break;default:l=[r(e[0],t*.5,{top:0,left:0}),r(e[1],t*.5,{top:0,right:0}),r(e[2],t*.5,{bottom:0,left:0}),e.length===4?r(e[3],t*.5,{bottom:0,right:0}):o.jsxs("div",{style:{position:"absolute",right:0,bottom:0,width:t*.5,height:t*.5,display:"grid",placeItems:"center",fontSize:t*.24,fontWeight:700,color:"var(--secondary)",fontFamily:"ui-rounded, var(--font)"},children:["+",e.length-3]},"more")]}return o.jsx("div",{"aria-hidden":!0,style:{position:"relative",width:t,height:t,flex:"none"},children:l})}function Lx({bot:e,members:t=[],size:s=44}){return o.jsxs("div",{style:{position:"relative",width:s,height:s,flex:"none"},children:[ft(e)?o.jsx(No,{members:t,size:s}):o.jsx(hi,{bot:e,size:s}),pn(e)?o.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:s*.36,height:s*.36,borderRadius:"50%",background:"var(--warning)",boxShadow:"0 0 0 2px var(--background)",display:"grid",placeItems:"center",color:"#fff"},children:o.jsx(se,{name:"exclamationmark",size:s*.2,weight:"black",scaled:!1})}):e.unread>0?o.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:s*.28,height:s*.28,borderRadius:"50%",background:"var(--accent-fill)",boxShadow:"0 0 0 2px var(--background)"}}):null]})}const q8={largeTitle:26,title:22,title2:17,title3:15,headline:13,body:13,callout:12,subheadline:11,footnote:10,caption:10,caption2:10,compactBody:12,compactSecondary:11},au=e=>`calc(${e}px * var(--scale))`,V8={light:300,regular:400,medium:500,semibold:600,bold:700,black:900};function R(e,t,s){const r=typeof e=="number"?e:q8[e],l=t??(e==="headline"?"bold":"regular");return{fontSize:au(r),fontWeight:V8[l],...s==="monospaced"?{fontFamily:"var(--mono)"}:s==="rounded"?{fontFamily:"ui-rounded, var(--font)"}:{}}}var lu=Mx();function Ps(e,t=300,s=!0){const[r,l]=b.useState(e),[h,u]=b.useState(e&&!s);return b.useLayoutEffect(()=>{if(c2()){l(e),u(e);return}if(e){l(!0);let m=0;const g=requestAnimationFrame(()=>{m=requestAnimationFrame(()=>u(!0))});return()=>{cancelAnimationFrame(g),cancelAnimationFrame(m)}}u(!1);const p=setTimeout(()=>l(!1),c2()?0:t);return()=>clearTimeout(p)},[e,t]),{mounted:r,shown:h}}const Bx=b.createContext(()=>{}),Ki=()=>b.useContext(Bx),eo=[];let $8=0;function _p(e,t){const s=b.useRef(t);s.current=t,b.useEffect(()=>{if(!e)return;const r=++$8;eo.push(r);const l=h=>{h.key==="Escape"&&eo[eo.length-1]===r&&(h.preventDefault(),h.stopPropagation(),s.current())};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0),eo.splice(eo.indexOf(r),1)}},[e])}function ht({open:e,onClose:t,width:s,height:r,dismissOnDim:l=!1,children:h}){const{mounted:u,shown:p}=Ps(e),m=b.useRef(h);return e&&(m.current=h),_p(e,t),u?lu.createPortal(o.jsx(Bx.Provider,{value:t,children:o.jsxs("div",{className:`modal-card ${p?"shown":""}`,role:"dialog","aria-modal":!0,children:[o.jsx("div",{className:"modal-dim",onClick:l?t:void 0}),o.jsx("div",{className:"modal-content",style:{width:s,height:r,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 48px)"},children:e?h:m.current})]})}),document.body):null}function cs({open:e,title:t,message:s,actions:r,cancel:l="Cancel",onClose:h}){const{mounted:u,shown:p}=Ps(e,120),m=b.useRef({title:t,message:s,actions:r});if(e&&(m.current={title:t,message:s,actions:r}),_p(e&&l!==null,h),!u)return null;const g=m.current;return lu.createPortal(o.jsxs("div",{className:`dialog ${p?"shown":""}`,role:"alertdialog","aria-modal":!0,children:[o.jsx("div",{className:"dialog-dim",onClick:()=>l!==null&&h()}),o.jsxs("div",{className:"dialog-card",children:[o.jsxs("div",{className:"dialog-text",children:[o.jsx("div",{style:R("headline"),children:g.title}),g.message?o.jsx("div",{style:{...R("compactSecondary"),color:"var(--secondary)"},children:g.message}):null]}),o.jsxs("div",{className:"dialog-buttons",children:[g.actions.map(y=>o.jsx("button",{className:`dialog-button ${y.destructive?"destructive":"prominent"}`,onClick:()=>{h(),y.action()},children:y.title},y.title)),l!==null?o.jsx("button",{className:"dialog-button",onClick:h,children:l}):null]})]})]}),document.body)}function W8({pick:e,dismiss:t,size:s=26}){return o.jsx("div",{style:{display:"flex"},children:e.emoji.map(r=>{const l=e.chosen.includes(r);return o.jsx("button",{className:`reaction-button ${l?"chosen":""}`,style:{width:s,height:s,borderRadius:s*.28},title:l?`Remove ${r}`:`React ${r}`,"aria-label":l?`Remove reaction ${r}`:`React ${r}`,onClick:()=>{t?.(),e.toggle(r)},children:o.jsx("span",{style:R(14),children:r})},r)})})}function F8({items:e,reactions:t,dismiss:s,maxHeight:r}){const[l,h]=b.useState(-1);return b.useEffect(()=>{const u=p=>{p.key==="ArrowDown"||p.key==="ArrowUp"?(p.preventDefault(),h(m=>(m+(p.key==="ArrowDown"?1:-1)+e.length)%e.length)):p.key==="Enter"&&l>=0&&(p.preventDefault(),s(),e[l]?.action())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e,l,s]),o.jsxs("div",{className:"menu-panel",style:{maxHeight:r},children:[t?o.jsx("div",{style:{paddingBottom:e.length?4:0},children:o.jsx(W8,{pick:t,dismiss:s})}):null,e.map((u,p)=>o.jsxs("div",{children:[u.divider?o.jsx("div",{className:"menu-divider"}):null,o.jsxs("button",{className:`menu-row ${u.destructive?"destructive":""} ${l===p?"highlight":""}`,title:u.title,onMouseEnter:()=>h(p),onClick:()=>{s(),u.action()},children:[u.icon?o.jsx("span",{className:"menu-icon",children:o.jsx(se,{name:u.icon,size:12})}):null,o.jsx("span",{className:"menu-title",children:u.title}),u.selected!==void 0?o.jsx("span",{style:{opacity:u.selected?1:0,display:"flex"},children:o.jsx(se,{name:"checkmark",size:10,weight:"semibold"})}):null]})]},`${u.title}-${p}`))]})}function Ka({open:e,onClose:t,anchor:s,point:r,items:l,reactions:h}){const{mounted:u,shown:p}=Ps(e,120),[m,g]=b.useState(null),y=b.useRef([]);if(e&&(y.current=l()),b.useLayoutEffect(()=>{e&&(r?g(new DOMRect(r.x,r.y,0,0)):s?.current&&g(s.current.getBoundingClientRect()))},[e,r,s]),_p(e,t),!u||!m)return null;const v=window.innerWidth,x=window.innerHeight,S=Math.max(0,x-m.bottom-14),w=Math.max(0,m.top-14),C=S>=w,j=m.left+m.width/2<v*.6,E=Math.min(320,v-16),A=Math.max(8,v-E-8),N={position:"absolute",[C?"top":"bottom"]:C?m.bottom+6:x-m.top+6,...j?{left:Math.min(Math.max(8,m.left),A)}:{right:Math.min(Math.max(8,v-m.right),A)},maxWidth:E,transformOrigin:`${C?"top":"bottom"} ${j?"left":"right"}`};return lu.createPortal(o.jsx("div",{className:`anchored ${p?"shown":""}`,onMouseDown:L=>L.target===L.currentTarget&&t(),onContextMenu:L=>{L.preventDefault(),t()},children:o.jsx("div",{className:"anchored-panel",style:N,children:o.jsx(F8,{items:y.current,reactions:h,dismiss:t,maxHeight:Math.min(420,C?S:w)})})}),document.body)}function K8(){const[e,t]=b.useState(null);return{point:e,open:e!==null,onContextMenu:s=>{s.preventDefault(),s.stopPropagation(),t({x:s.clientX,y:s.clientY})},close:()=>t(null)}}function ut({title:e,trailing:t}){const s=Ki();return o.jsxs("div",{className:"modal-header",children:[o.jsx("div",{style:{...R("compactBody","semibold"),flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t,o.jsx(xp,{title:"Close",icon:"xmark",onClick:s})]})}function xp({title:e,icon:t,onClick:s,selected:r=!1,size:l=28,disabled:h,className:u,buttonRef:p}){return o.jsx("button",{ref:p,className:`icon-button ${r?"selected":""} ${u??""}`,style:{width:l,height:l,borderRadius:l*.28},title:e,"aria-label":e,disabled:h,onClick:s,children:o.jsx(se,{name:t,size:l/2,weight:"medium"})})}const be=xp;function Ne({kind:e="primary",children:t,onClick:s,disabled:r,style:l,className:h,title:u}){return o.jsx("button",{className:`styled-button ${e} ${h??""}`,onClick:s,disabled:r,style:l,title:u,children:t})}function $e({size:e=14}){const t=Math.max(1.5,e/9),s=(e-t)/2,r=2*Math.PI*s;return o.jsx("svg",{className:"spinner",width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-label":"Loading",role:"img",children:o.jsx("circle",{cx:e/2,cy:e/2,r:s,fill:"none",stroke:"var(--secondary)",strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.7} ${r}`})})}function ys({on:e,onChange:t,children:s,disabled:r,style:l}){return o.jsxs("button",{className:"switch",role:"switch","aria-checked":e,disabled:r,onClick:()=>t(!e),style:l,children:[s!==void 0?o.jsx("span",{className:"switch-label",children:s}):null,o.jsx("span",{className:`switch-track ${e?"on":""}`,children:o.jsx("span",{className:"switch-knob"})})]})}function Ya({items:e,children:t,className:s,style:r,title:l}){const[h,u]=b.useState(!1),p=b.useRef(null);return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:p,className:s,style:r,title:l,onClick:()=>u(m=>!m),children:t}),o.jsx(Ka,{open:h,onClose:()=>u(!1),anchor:p,items:e})]})}function _i({selection:e,options:t,onChange:s,fill:r,fits:l=!1}){const h=t.find(u=>u.id===e)?.label??"Choose";return o.jsxs(Ya,{title:h,className:`choice-picker ${r?"":"outlined"}`,style:{background:r,width:l?"100%":void 0},items:()=>t.map(u=>({title:u.label,selected:u.id===e,action:()=>s(u.id)})),children:[o.jsx("span",{className:"choice-label",children:h}),o.jsx(se,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})}function Y8({selection:e,options:t,onChange:s}){const r=Math.max(0,t.findIndex(l=>l.id===e));return o.jsxs("div",{className:"segmented",children:[o.jsx("div",{className:"segmented-thumb",style:{width:`calc((100% - 6px - ${(t.length-1)*2}px) / ${t.length})`,transform:`translateX(calc(${r} * (100% + 2px)))`}}),t.map(l=>o.jsx("button",{className:`segmented-option ${l.id===e?"on":""}`,onClick:()=>s(l.id),"aria-pressed":l.id===e,children:l.label},l.id))]})}function G8({selection:e,options:t,onChange:s}){return o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.map(r=>o.jsxs("button",{className:"choice-row",onClick:()=>s(r.id),children:[o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[o.jsx("span",{style:{color:"var(--text)"},children:r.label}),r.detail?o.jsx("span",{style:{...R("compactSecondary"),color:"var(--secondary)"},children:r.detail}):null]}),o.jsx("span",{style:{opacity:r.id===e?1:0,display:"flex"},children:o.jsx(se,{name:"checkmark",size:10,weight:"semibold"})})]},r.id))})}function ui({children:e,style:t}){return o.jsx("div",{className:"card-form",style:t,children:o.jsx("div",{className:"card-form-content",children:e})})}function ke({title:e,footer:t,accessory:s,children:r}){const l=b.Children.toArray(r);return o.jsxs("section",{className:"card-section",children:[e?o.jsxs("div",{className:"card-section-title",children:[o.jsx("span",{style:{...R(13,"semibold"),color:"var(--text)"},children:e}),o.jsx("span",{style:{flex:1}}),s]}):null,o.jsx("div",{className:"card-section-rows",children:l.map((h,u)=>o.jsxs(b.Fragment,{children:[o.jsx("div",{className:"card-row",children:h}),u<l.length-1?o.jsx("div",{className:"hairline inset"}):null]},u))}),t?o.jsx("div",{className:"card-section-footer",children:t}):null]})}function Z8({style:e}){return o.jsx("div",{className:"hairline",style:e})}function ei({label:e,detail:t,children:s}){return o.jsxs("div",{className:"value-row",children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,minWidth:0},children:[o.jsx("span",{style:{color:"var(--text)"},children:e}),t?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),o.jsx("span",{style:{flex:1,minWidth:12}}),o.jsx("span",{style:{color:"var(--secondary)",display:"flex",alignItems:"center"},children:s})]})}function Ox({value:e,onChange:t,prompt:s="Search",inputRef:r}){return o.jsxs("div",{className:"search-field",children:[o.jsx(se,{name:"magnifyingglass",size:12,color:"var(--secondary)"}),o.jsx("input",{ref:r,value:e,placeholder:s,spellCheck:!1,onChange:l=>t(l.target.value)}),e?o.jsx("button",{"aria-label":"Clear search",onClick:()=>t(""),style:{display:"flex",color:"var(--tertiary)"},children:o.jsx(se,{name:"xmark.circle.fill",size:12})}):null]})}function wp({expanded:e,onToggle:t,label:s,children:r}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsxs("button",{className:"disclosure-label",onClick:t,"aria-expanded":e,children:[s,o.jsx("span",{style:{flex:1,minWidth:8}}),o.jsx("span",{style:{display:"flex",transform:`rotate(${e?90:0}deg)`,transition:"transform var(--layout)",color:"var(--secondary)"},children:o.jsx(se,{name:"chevron.right",size:10,weight:"semibold"})})]}),e?r:null]})}function zx({children:e,fill:t="var(--background)",outlined:s=!1,style:r}){return o.jsx("span",{className:"pill",style:{background:s?"transparent":t,boxShadow:s?"inset 0 0 0 1px var(--border)":void 0,...r},children:e})}class ws{#e=new Set;#i=0;#t=!1;changed(){this.#t||(this.#t=!0,queueMicrotask(()=>{this.#t=!1,this.#i++;for(const t of[...this.#e])t()}))}subscribe=t=>(this.#e.add(t),()=>{this.#e.delete(t)});getVersion=()=>this.#i}function di(e){return b.useSyncExternalStore(e?e.subscribe:X8,e?e.getVersion:Q8),e}const X8=()=>()=>{},Q8=()=>0;function Sp(e){const t=b.useRef({models:e,version:0});t.current.models=e,b.useSyncExternalStore(b.useCallback(s=>{const r=t.current.models.map(l=>l.subscribe(()=>{t.current.version++,s()}));return()=>r.forEach(l=>l())},[e.length,...e]),()=>t.current.version)}function Bt(e,t){const s=new Set;let r=(()=>{try{const l=localStorage.getItem(e);return l===null?t:JSON.parse(l)}catch{return t}})();return window.addEventListener("storage",l=>{if(l.key===e){try{r=l.newValue===null?t:JSON.parse(l.newValue)}catch{r=t}for(const h of s)h()}}),{get:()=>r,set(l){r=l;try{localStorage.setItem(e,JSON.stringify(l))}catch{}for(const h of s)h()},subscribe(l){return s.add(l),()=>{s.delete(l)}}}}function kt(e){return[b.useSyncExternalStore(e.subscribe,e.get),e.set]}const h2=[11,12,13,14,15,16,18],Wa=12;function J8(e,t){return(t?h2.find(s=>s>e):[...h2].reverse().find(s=>s<e))??e}const nt={textSize:Bt("conversationFontSize",Wa),sidebarCompact:Bt("sidebarCompact",!1),sidebarWidth:Bt("desktopSidebarWidth",266),hiddenComputers:Bt("hiddenComputers",""),computerOrder:Bt("computerOrder",[]),collapsedComputers:Bt("collapsedComputerSections",[]),usageIconStyle:Bt("usageIconStyle","character"),onboardingDone:Bt("macAccountOnboardingCompleted",!1),computerAccessSetup:Bt("computerAccessSetup",null),starAsk:Bt("githubStarAsk",{kind:"never"})};function Hx(e){const t=Number.isFinite(e)?Math.min(Math.max(e,11),18):Wa;document.documentElement.style.setProperty("--scale",String(t/Wa)),document.documentElement.style.setProperty("--conversation",`${t}px`),document.documentElement.style.setProperty("--chat",`${t}px`),document.documentElement.style.setProperty("--chat-scale",String(t/Wa))}nt.textSize.subscribe(()=>Hx(nt.textSize.get()));const Ix=b.createContext(null);function si(){const e=b.useContext(Ix);if(!e)throw new Error("AppContext missing");return di(e)}const hn=b.createContext(null);function Ae(){const e=b.useContext(hn);if(!e)throw new Error("StoreContext missing");return di(e)}function Pr(){const e=b.useContext(hn);if(!e)throw new Error("StoreContext missing");return e}class as extends Error{constructor(t,s){super(s),this.status=t}status;static unreachable(){return new as(0,"Can't reach your computer. Is it on and connected to the internet?")}get isTransient(){return this.status===0}}class bp{constructor(t,s){this.baseURL=t,this.token=s}baseURL;token;async call(t,s,r){try{return await window.codync.host.call(this.baseURL,this.token,t,s,r)}catch(l){const h=l;throw new as(h.status??0,h.status===401?"This device isn't allowed on that computer anymore.":h.message)}}stream(t,s,r){return window.codync.host.stream(`${this.baseURL}${t}`,this.token,s,l=>r(l?new as(l.status,l.message):null))}}function e7(e){let t;try{t=JSON.parse(e)}catch{return null}const s=t.type;switch(s){case"hello":return{type:s,hostId:t.hostId??"",rev:t.rev??0,usage:t.usage??{providers:[]},screen:qh(t.screen)};case"bot":{const r=t.bot;return!r||typeof r.id!="string"?{type:"undecodable",kind:"bot"}:r.deleted?{type:"botDeleted",id:r.id,rev:r.rev??0}:{type:s,bot:r2(r)}}case"entry":{const r=t.entry;return!r||typeof r.id!="string"||typeof r.botId!="string"?{type:"undecodable",kind:"entry"}:{type:s,entry:{...r,data:r.data??{}}}}case"usage":return t.usage?{type:s,usage:t.usage}:null;case"screen":{const r=qh(t.screen);return r?{type:s,screen:r}:null}case"accessRequests":return{type:s,requests:t.requests??[]};case"cloud":return t.cloud?{type:s,cloud:t.cloud}:null;case"resync":return{type:s};default:return null}}class Cp{constructor(t){this.transport=t}transport;readFile(t,s,r){return this.call("readFile",{entryId:t,fileId:s,offset:r})}call(t,s={},r=2e4){return this.transport.call(t,s,r)}events(t,s,r,l){const h=new URLSearchParams({since:String(t),client:s});return this.transport.stream(`/events?${h}`,u=>{const p=e7(u);p&&r(p)},l)}hello(){return this.call("hello").then(t=>({...t,backends:t.backends??[],screen:qh(t.screen)??void 0}))}async history(t,s,r=100){return(await this.call("history",{botId:t,beforeSeq:s,limit:r})).entries}async thread(t,s){return(await this.call("thread",{botId:t,rootId:s})).entries}async botConversation(t,s){return(await this.call("botConversation",{botId:t,peerId:s})).entries}async send(t,s,r,l,h){return(await this.call("send",{botId:t,text:s,clientNonce:r,threadId:l,attachments:h})).entry}static uploadChunk=384*1024;async upload(t,s,r,l){let h=0;do{const u=Math.min(h+Cp.uploadChunk,l.length);await this.call("upload",{botId:t,uploadId:s,name:r,data:Ux(l.subarray(h,u)),offset:h,done:u===l.length},6e4),h=u}while(h<l.length)}async readUpload(t,s){const r=[];let l=0;for(;;){const p=await this.call("readUpload",{botId:t,uploadId:s,offset:l},6e4),m=Px(p.data);if(!m.length||(r.push(m),l+=m.length,l>=p.size))break}const h=new Uint8Array(l);let u=0;for(const p of r)h.set(p,u),u+=p.length;return h}}function Ux(e){let t="";for(let s=0;s<e.length;s+=32768)t+=String.fromCharCode(...e.subarray(s,s+32768));return btoa(t)}function Px(e){const t=atob(e),s=new Uint8Array(t.length);for(let r=0;r<t.length;r++)s[r]=t.charCodeAt(r);return s}class t7 extends ws{isBusy=!1;isReady=!0;isConfigured=!1;errorMessage=null;user=null;cloudURL=null;get isSignedIn(){return this.user!==null}async start(){const t=await window.codync.account.state();this.apply(t),window.codync.account.onChange(s=>this.apply(s))}apply(t){this.isReady=t.ready,this.isConfigured=t.configured,this.isBusy=t.busy,this.errorMessage=t.error,this.user=t.user,this.cloudURL=t.cloudURL,this.changed()}async signIn(t){await window.codync.account.signIn(t)}async signOut(){await window.codync.account.signOut()}sessionToken(){return window.codync.account.token()}}const Ti=new t7;function Ja(){return di(Ti)}const r_=384*1024,i7=100*1024*1024;function s7(e){if(!Number.isSafeInteger(e.size)||e.size<0||e.size>i7||!/^[a-f0-9]{64}$/.test(e.sha256))throw new Error("Invalid file metadata");if(!e.name||e.name.length>200||/[/\\\x00-\x1f\x7f]/.test(e.name)||e.name==="."||e.name==="..")throw new Error("Invalid filename")}function n7(e,t,s){if(e.size!==t||typeof e.data!="string"||e.data.length>Math.ceil(r_/3)*4)throw new Error("Invalid download response");const r=Uint8Array.from(atob(e.data),l=>l.charCodeAt(0));if(r.length!==Math.min(r_,t-s))throw new Error("Download was truncated or changed");return r}class r7{states=new Map;jobs=new Map;retired=!1;changed;constructor(t){this.changed=t}cancel(t){const s=this.jobs.get(t);s&&(s.cancelled=!0,this.jobs.delete(t),this.states.delete(t),s.handle&&window.codync.files.cancel(s.handle).catch(console.error),this.changed())}retire(){this.retired=!0;for(const t of this.jobs.keys())this.cancel(t)}async save(t,s,r){if(this.retired||this.jobs.has(r.id))return;const l={cancelled:!1,handle:null},h=()=>!l.cancelled&&!this.retired;this.jobs.set(r.id,l),this.states.set(r.id,{kind:"downloading",received:0}),this.changed();try{if(s7(r),!t)throw new Error("Connect to this computer to download the file");if(l.handle=await window.codync.files.begin(r),!l.handle||!h())return;let u=0;do{const p=await t.readFile(s,r.id,u);if(!h())return;const m=n7(p,r.size,u);if(m.length&&await window.codync.files.write(l.handle,u,m),!h())return;u+=m.length,this.states.set(r.id,{kind:"downloading",received:u}),this.changed()}while(u<r.size);if(!h())return;await window.codync.files.finish(l.handle),h()&&this.states.set(r.id,{kind:"saved"})}catch(u){h()&&this.states.set(r.id,{kind:"failed",message:u instanceof Error?u.message:String(u)})}finally{l.handle&&await window.codync.files.cancel(l.handle).catch(console.error),this.jobs.get(r.id)===l&&(this.jobs.delete(r.id),this.states.get(r.id)?.kind==="downloading"&&this.states.delete(r.id),this.changed())}}}function a7(e,t){return!t&&e.some(s=>s.seq>0&&s.seq!==Number.MAX_SAFE_INTEGER)}function l7(e,t){let s;for(const r of e)r.threadId||r.seq<=0||r.id.startsWith("local-")||r.rev>t||(s=s===void 0?r.seq:Math.min(s,r.seq));return s}function o7(e,t){const s=new Map;if(t<=0)return s;for(const[r,l]of e){const h=l7(l,t);h!==void 0&&s.set(r,h)}return s}function c7(e,t,s){return e===void 0||t||s.threadId?!1:s.seq<e}const a_="2.12.0";function l_(e){let t=e.trim();t.startsWith("v")&&(t=t.slice(1)),t=t.split("-")[0].split("+")[0];const s=t.split(".");if(s.length<1||s.length>3)return null;const r=[];for(const l of s){if(!/^[0-9]+$/.test(l))return null;r.push(Number(l))}for(;r.length<3;)r.push(0);return r}function ko(e,t){const s=l_(e),r=l_(t);if(!s||!r)return!1;for(let l=0;l<3;l++)if(s[l]!==r[l])return s[l]<r[l];return!1}function h7(e,t,s){return s&&ko(e,s)?{kind:"updateApp",minimum:s}:ko(t,a_)?{kind:"updateHost",version:t,minimum:a_}:null}class u7{values=new Map;listeners=new Set;retired=!1;storage;key;onSaveError;constructor(t,s,r){this.storage=t,this.key=s,this.onSaveError=r;try{const l=JSON.parse(t.getItem(s)??"null");if(Array.isArray(l))for(const h of l)Array.isArray(h)&&h.length===2&&typeof h[0]=="string"&&typeof h[1]=="string"&&this.values.set(h[0],h[1])}catch{}}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});get(t,s=null){return this.values.get(JSON.stringify([t,s]))??""}set(t,s,r){if(this.retired)return;const l=JSON.stringify([t,s]);r?this.values.set(l,r):this.values.delete(l),this.save()}removeBot(t){if(!this.retired){for(const s of this.values.keys())try{JSON.parse(s)[0]===t&&this.values.delete(s)}catch{this.values.delete(s)}this.save()}}clear(){this.retired||(this.values.clear(),this.save())}retire(){this.retired=!0}save(){try{this.storage.setItem(this.key,JSON.stringify([...this.values]))}catch{this.onSaveError?.()}for(const t of this.listeners)t()}}class d7 extends ws{constructor(t,s,r,l=window.codync.appVersion,h="local"){super(),this.isLoopback=s,this.makeTransport=r,this.appVersion=l,this.contextId=h,this.computer=t,this.composerDrafts=new u7(localStorage,`codync-drafts-v1-${JSON.stringify([h,t.id])}`,()=>this.setError("Couldn't save the draft on this device. Your text is still here; keep this window open until you send or copy it.")),this.loadCache()}isLoopback;makeTransport;appVersion;contextId;computer;connection={kind:"connecting"};hostRoute=null;client=null;hello=null;hostVersion=null;bots=new Map;entries=new Map;usage={providers:[]};screen=null;accessRequests=[];cloud=null;historyComplete=new Set;routineDrafts=new Map;composerDrafts;lastError=null;selection=null;answering=new Map;onRosterChanged=null;onComputerChanged=null;waiting=0;rev=0;hostId=null;retired=!1;unreadable=!1;saveTimer=null;cacheStamp=null;get isOffline(){const t=this.connection.kind;return t==="computerOffline"||t==="offline"||t==="unauthorized"}get canQueue(){return!1}get shownConnection(){return this.waiting>0&&this.connection.kind==="online"?{kind:"connecting"}:this.connection}get hostName(){return this.hello?.name??this.computer.name}get mismatch(){if(!this.hostVersion)return null;const t=h7(this.appVersion,this.hostVersion.version,this.hostVersion.minApp);return t||(this.unreadable&&ko(this.appVersion,this.hostVersion.version)?{kind:"updateApp",minimum:this.hostVersion.version}:null)}get roster(){return[...this.bots.values()].filter(t=>!t.hidden).sort((t,s)=>Number(s.pinned)-Number(t.pinned)||t.position-s.position||s.lastAt-t.lastAt)}get hiddenBots(){return[...this.bots.values()].filter(t=>t.hidden).sort((t,s)=>t.name.localeCompare(s.name))}backendName(t){return this.hello?.backends.find(s=>s.id===t)?.name??f7(t)}chat(t){return(this.entries.get(t)??[]).filter(s=>!s.threadId)}allEntries(t){return this.entries.get(t)??[]}canLoadOlder(t){return a7(this.allEntries(t),this.historyComplete.has(t))}replies(t,s){return(this.entries.get(t)??[]).filter(r=>r.threadId===s)}members(t){return t.members.map(s=>this.bots.get(s)).filter(s=>!!s)}authorName(t){return t&&this.bots.get(t)?.name||"A deleted bot"}currentThinking(t,s){const r=this.allEntries(t);for(let l=r.length-1;l>=0;l--){const h=r[l];if((h.threadId??null)===s){if(h.kind==="user"||h.kind==="agent"&&h.data.final===!0)return null;if(h.kind==="thought"&&h.data.text)return h.data.text}}return null}get connectionLabel(){switch(this.shownConnection.kind){case"online":return this.mismatch?"Needs update":"Connected";case"connecting":return"Connecting…";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}}updateComputer(t){const s=t({...this.computer});JSON.stringify(s)!==JSON.stringify(this.computer)&&(this.computer=s,this.onComputerChanged?.(s),this.changed())}upsert(t){const s=[...this.entries.get(t.botId)??[]],r=s.findIndex(l=>l.id===t.id);if(r>=0){if(t.rev<s[r].rev)return;s[r]=t}else{const l=t.kind==="user"?t.data.clientNonce:void 0,h=l?s.filter(p=>p.id!==`local-${l}`):s,u=h[h.length-1];if(u&&u.seq>t.seq&&t.seq>0){const p=h.findIndex(m=>m.seq>t.seq);h.splice(p<0?h.length:p,0,t)}else h.push(t);this.entries.set(t.botId,h);return}this.entries.set(t.botId,s)}setError(t){this.lastError=t,this.changed()}get cacheKey(){return`codync-mirror-${this.contextId}-${this.computer.id}`}loadCache(){try{const t=localStorage.getItem(this.cacheKey);if(!t)return;const s=JSON.parse(t);this.cacheStamp=s.stamp??"",this.hostId=s.hostId??null,this.rev=s.rev,this.bots=new Map(s.bots.map(l=>[l.id,l]));const r=new Map;for(const l of s.entries)r.set(l.botId,[...r.get(l.botId)??[],l]);this.entries=r}catch{}}scheduleSave(){this.retired||(this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>this.saveCache(),2e3))}saveCache(){if(this.retired)return;const t=[];for(const r of this.entries.values())t.push(...r.filter(l=>!l.id.startsWith("local-")).slice(-200)),t.push(...r.filter(l=>l.id.startsWith("local-")&&l.data.status==="failed"));const s={stamp:`${this.appVersion}/${this.hello?.version??""}`,hostId:this.hostId,rev:this.rev,bots:[...this.bots.values()],entries:t};try{localStorage.setItem(this.cacheKey,JSON.stringify(s))}catch{}}}function f7(e){switch(e){case"claude":return"Claude Code";case"codex":return"Codex";case"opencode":return"OpenCode";case"grok":return"Grok Build";case"gemini":return"Gemini CLI";default:return"Custom agent"}}const p7=5e3,o_=1e3,c_=2e4,m7=3e4,qa=e=>new Promise(t=>setTimeout(t,e)),g7=(e,t)=>e.kind===t.kind&&JSON.stringify(e)===JSON.stringify(t);function h_(e,t){const s=new Map;for(const[r,l]of e){const h=l.filter(t);h.length&&s.set(r,h)}return s}class v7 extends d7{heldDrop=null;dropTimer=null;closeEvents=null;eventsLoop=0;rewound=!1;requestedSince=0;floors=new Map;readingViews=new Map;retire(){this.retired=!0,this.composerDrafts.retire(),this.stopTransport(),this.saveTimer&&clearTimeout(this.saveTimer),this.onRosterChanged=null,this.onComputerChanged=null,this.client=null,this.selection=null}start(){this.restartStream()}restartStream(){if(this.retired)return;this.stopTransport(),this.connection.kind!=="online"&&this.setConnection({kind:"connecting"});const t=this.makeTransport();this.client=new Cp(t),this.hostRoute=this.isLoopback?"loopback":null,this.runEvents(this.client)}stopTransport(){this.eventsLoop++,this.closeEvents?.(),this.closeEvents=null,this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null}setConnection(t){const s=t.kind==="connecting"||t.kind==="offline"||t.kind==="computerOffline",r=t.kind==="online"&&(this.connection.kind!=="online"||this.heldDrop!==null),l=this.connection.kind==="connecting"&&s&&t.kind!=="connecting";if(s&&(this.connection.kind==="online"||l)){const h=this.connection.kind==="online"?p7:o_;this.heldDrop=t,this.dropTimer||(this.dropTimer=setTimeout(()=>{this.dropTimer=null;const u=this.heldDrop;this.heldDrop=null,u&&!this.retired&&(this.connection=u,this.changed())},h));return}if(this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null,g7(t,this.connection)||(this.connection=t,this.changed()),r)for(const h of this.readingViews.values())this.markRead(h.botId,h.thread)}runEvents(t){const s=++this.eventsLoop;let r=1e3;const l=()=>s===this.eventsLoop&&!this.retired,h=async()=>{if(l()){try{if(await this.refreshHello(t),!l())return;if(this.mismatch)return this.setConnection({kind:"online"}),await qa(m7),void h();if(this.isLoopback){try{this.accessRequests=(await t.call("accessRequests")).requests}catch{}try{this.cloud=await t.call("cloudStatus")}catch{}this.changed()}if(!l())return;await new Promise((u,p)=>{this.requestedSince=this.rev,this.floors=new Map,this.closeEvents=t.events(this.requestedSince,"desktop",m=>{l()&&(this.setConnection({kind:"online"}),r=1e3,this.apply(m))},m=>m?p(m):u())})}catch(u){if(!l())return;const p=u instanceof Error?u.message:String(u);if(this.setConnection({kind:"offline",message:p}),u instanceof as&&u.status===401)return}l()&&(await qa(r),r=Math.min(r*2,2e4),h())}};h()}restartEvents(){this.client&&(this.closeEvents?.(),this.runEvents(this.client))}async refreshHello(t){const s=await t.hello();this.retired||(this.hello=s,this.noteHostVersion({version:s.version,minApp:s.minApp}),this.isLoopback&&this.updateComputer(r=>({...r,name:s.name,device:s.device??r.device})),this.changed())}noteHostVersion(t){(this.cacheStamp!==null&&this.cacheStamp!==`${this.appVersion}/${t.version}`||this.hostVersion&&this.hostVersion.version!==t.version)&&(this.refetchAll(),this.rewound=!1,this.unreadable=!1),this.cacheStamp=null,this.hostVersion=t}apply(t){switch(t.type){case"hello":this.hostId&&this.hostId!==t.hostId&&this.resetMirror(),this.hostId=t.hostId,this.usage=t.usage,this.screen=t.screen,t.rev<this.rev&&(this.rev=0),this.floors=o7(this.entries,this.rev===0?0:this.requestedSince);break;case"bot":this.bots.set(t.bot.id,t.bot),this.bump(t.bot.rev),this.onRosterChanged?.(),t.bot.unread>0&&this.acknowledgeVisible(t.bot.id);break;case"botDeleted":this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.floors.delete(t.id),this.bump(t.rev),this.selection===t.id&&(this.selection=null),this.onRosterChanged?.();break;case"entry":this.isBelowFloor(t.entry)||this.upsert(t.entry),this.bump(t.entry.rev),this.acknowledgeVisible(t.entry.botId,t.entry);break;case"usage":this.usage=t.usage;break;case"screen":this.screen=t.screen;break;case"accessRequests":this.accessRequests=t.requests;break;case"cloud":this.cloud=t.cloud;break;case"resync":this.restartEvents();break;case"undecodable":this.rewound?this.unreadable||(this.unreadable=!0,this.mismatch&&this.restartEvents()):(this.rewound=!0,this.refetchAll(),this.restartEvents());break}this.changed(),this.scheduleSave()}resetMirror(){this.composerDrafts.clear(),this.bots=new Map,this.entries=h_(this.entries,t=>t.id.startsWith("local-")),this.selection=null,this.onRosterChanged?.(),this.rev=0,this.hostId=null,this.historyComplete=new Set,this.floors=new Map,this.screen=null,this.saveCache()}refetchAll(){this.rev=0,this.entries=h_(this.entries,t=>!!t.threadId||t.id.startsWith("local-")),this.historyComplete=new Set}isBelowFloor(t){const s=this.allEntries(t.botId).some(r=>r.id===t.id);return c7(this.floors.get(t.botId),s,t)}bump(t){this.rev=Math.max(this.rev,t)}get live(){return this.connection.kind==="online"&&!this.heldDrop&&!this.retired?this.client:null}async ready(t=Date.now()+c_){let s=!1,r=!1;try{for(;!this.retired;){if(this.live)return this.live;switch(this.connection.kind){case"online":case"connecting":break;case"offline":if(!r){r=!0,this.restartStream();break}throw as.unreachable();case"unpaired":throw as.unreachable();case"computerOffline":throw new as(0,"Your computer is offline.");case"unauthorized":throw new as(401,this.connection.message)}if(Date.now()>=t)break;s||(s=!0,this.waiting++,this.changed()),await qa(100)}throw as.unreachable()}finally{s&&(this.waiting--,this.changed())}}async withLink(t,s=!1){const r=Date.now()+c_;for(;;){const l=await this.ready(r);try{return await t(l)}catch(h){if(s&&h instanceof as&&h.isTransient&&Date.now()<r){await qa(500);continue}throw h}}}perform(t,s=!1){this.withLink(t,s).catch(r=>{this.lastError=r instanceof Error?r.message:String(r),this.changed()})}setReading(t,s,r,l){l?(this.readingViews.set(t,{botId:s,thread:r}),this.connection.kind==="online"&&this.markRead(s,r)):this.readingViews.delete(t)}acknowledgeVisible(t,s){if(this.connection.kind!=="online")return;const r=new Set;for(const l of this.readingViews.values()){if(l.botId!==t||s&&(!Fa(s)||(s.threadId??null)!==l.thread))continue;const h=`${l.botId}/${l.thread}`;r.has(h)||(r.add(h),this.markRead(t,l.thread))}}markRead(t,s=null){(async()=>{this.live||await qa(o_);const r=this.live;if(r)try{await r.call("markRead",{botId:t,threadId:s,all:!1})}catch{}})()}}const y7=100*1024*1024,_7=["👍","❤️","😂","🎉","👀","✅"];class qx extends v7{fileDownloads=new r7(()=>this.changed());retire(){this.fileDownloads.retire(),super.retire()}outgoingFiles=new Map;send(t,s,r=null,l=[],h=crypto.randomUUID()){const u=t.trim();if(!u&&!l.length||this.retired)return;const p={text:u,status:"sending",clientNonce:h};l.length&&(p.attachments=l.map(m=>({id:m.id,name:m.name,size:m.data.length})),this.outgoingFiles.set(h,l)),this.upsert({id:`local-${h}`,seq:Number.MAX_SAFE_INTEGER,botId:s,threadId:r,rev:0,kind:"user",turn:0,data:p,createdAt:Date.now(),updatedAt:0}),this.changed(),(async()=>{try{const m=await this.withLink(async g=>{let y=null;const v=this.outgoingFiles.get(h);if(v){y=[];for(const x of v){const S=crypto.randomUUID();await g.upload(s,S,x.name,x.data),u_(S,x.data),y.push(S)}}return g.send(s,u,h,r,y)},!0);this.outgoingFiles.delete(h),this.upsert(m),this.changed()}catch(m){this.outgoingFiles.has(h)&&(this.lastError=`Couldn't send the files: ${m instanceof Error?m.message:m}`),this.markLocal(h,s,"failed")}})()}retry(t){const s=t.data.clientNonce&&this.outgoingFiles.get(t.data.clientNonce)||[],r=t.data.text??"";!r&&!s.length||(this.entries.set(t.botId,this.allEntries(t.botId).filter(l=>l.id!==t.id)),this.send(r,t.botId,t.threadId??null,s,t.data.clientNonce??crypto.randomUUID()))}discard(t){t.data.clientNonce&&this.outgoingFiles.delete(t.data.clientNonce),this.entries.set(t.botId,this.allEntries(t.botId).filter(s=>s.id!==t.id)),this.changed(),this.scheduleSave()}markLocal(t,s,r){const l=this.entries.get(s),h=l?.findIndex(p=>p.id===`local-${t}`)??-1;if(!l||h<0)return;const u=[...l];u[h]={...u[h],data:{...u[h].data,status:r}},this.entries.set(s,u),this.changed(),this.scheduleSave()}async attachmentData(t,s){const r=Vx.get(t);if(r)return r;const l=this.live;if(!l)return null;try{const h=await l.readUpload(s,t);return u_(t,h),h}catch{return null}}stop(t){this.perform(s=>s.call("stop",{botId:t}),!0)}newSession(t){this.perform(s=>s.call("newSession",{botId:t}))}logCall(t,s){this.perform(r=>r.call("logCall",{botId:t,seconds:s}))}screenTakeover(t){this.perform(async s=>{this.screen=await s.call("screenTakeover",{on:t}),this.changed()},!0)}async setScreenEnabled(t){this.screen=await(await this.ready()).call("setScreenEnabled",{enabled:t}),this.changed()}get analytics(){return this.hello?.analytics}async setAnalytics(t){const s=await(await this.ready()).call("setAnalytics",{enabled:t});this.hello&&(this.hello={...this.hello,analytics:s.enabled}),this.changed()}track(t){this.withLink(s=>s.call("track",{event:t})).catch(s=>console.warn(`track ${t} failed`,s))}react(t,s){const r=this.entries.get(t.botId),l=r?.findIndex(m=>m.id===t.id)??-1;if(!r||l<0)return;const h=[...r[l].data.reactions??[]],u=h.indexOf(s);u>=0?h.splice(u,1):h.push(s);const p=[...r];p[l]={...p[l],data:{...p[l].data,reactions:h}},this.entries.set(t.botId,p),this.changed(),this.perform(async m=>{const g=await m.call("react",{entryId:t.id,emoji:s});this.upsert(g.entry),this.changed()})}respond(t,s){this.answering.has(t.id)||(this.answering.set(t.id,s??""),this.changed(),(async()=>{try{await this.withLink(r=>r.call("respondPermission",{entryId:t.id,optionId:s}),!0),await qa(2e3)}catch(r){this.lastError=r instanceof Error?r.message:String(r)}this.answering.delete(t.id),this.changed()})())}markAllRead(t){const s=this.bots.get(t);!s||s.unread<=0||(this.bots.set(t,{...s,unread:0}),this.changed(),this.perform(r=>r.call("markRead",{botId:t,threadId:null,all:!0}),!0))}patchBot(t,s){const r=this.bots.get(t.id);r&&this.bots.set(t.id,{...r,...s}),this.changed(),this.perform(l=>l.call("updateBot",{...x7(t),...s}),!0)}setPinned(t,s){this.patchBot(t,{pinned:s})}setHidden(t,s){this.patchBot(t,{hidden:s})}reorder(t){t.forEach((s,r)=>{const l=this.bots.get(s);l&&this.bots.set(s,{...l,position:r})}),this.changed(),this.perform(s=>s.call("reorderBots",{ids:t}),!0)}delete(t){this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.onRosterChanged?.(),this.changed(),this.perform(s=>s.call("deleteBot",{botId:t.id}),!0)}async createGroup(t,s,r){const l={kind:"group",name:t,description:s,members:r},h=await(await this.ready()).call("createBot",l);return this.bots.set(h.bot.id,h.bot),this.selection=h.bot.id,this.onRosterChanged?.(),this.changed(),h.bot}async updateGroup(t){const s=await(await this.ready()).call("updateBot",t);this.bots.set(s.bot.id,s.bot),this.changed()}removeMember(t,s){const r=t.members.filter(p=>p!==s),l=p=>p.map(m=>this.bots.get(m)?.name).join(", "),h=t.name===l(t.members)?l(r):t.name;this.bots.set(t.id,{...t,name:h,members:r}),this.changed();const u={id:t.id,kind:"group",name:h,description:t.description,members:r,pinned:t.pinned};this.perform(p=>p.call("updateBot",u),!0)}async loadThread(t,s){if(this.client)try{for(const r of await this.client.thread(t,s))this.upsert(r);this.changed()}catch{}}async botConversation(t,s){return(await this.ready()).botConversation(t,s)}async save(t){const s=await this.ready(),r=t.id?await s.call("updateBot",{...t,model:t.model??null}):await s.call("createBot",t);return this.bots.set(r.bot.id,r.bot),this.onRosterChanged?.(),this.changed(),r.bot}async refreshBackends(){if(!(!this.client||!this.hello))try{const t=await this.client.call("refreshBackends",{},6e4);this.hello={...this.hello,backends:t.backends},this.changed()}catch{}}async listDirs(t){return(await this.ready()).call("listDirs",{path:t})}async refreshUsage(){if(!(this.retired||!this.client))try{this.usage=await this.client.call("usage",{refresh:!0}),this.changed()}catch{}}async loadOlder(t){if(!this.client||this.historyComplete.has(t))return;const s=this.chat(t).find(r=>r.seq>0&&r.seq!==Number.MAX_SAFE_INTEGER)?.seq??Number.MAX_SAFE_INTEGER;try{const r=await this.client.history(t,s,100);r.length<100&&this.historyComplete.add(t);for(const l of r)this.upsert(l);this.changed()}catch{}}setSelection(t){this.selection=t,this.changed()}consumeRoutineDraft(t){const s=this.routineDrafts.get(t);return s!==void 0&&(this.routineDrafts.delete(t),this.changed()),s}setRoutineDraft(t,s){this.routineDrafts.set(t,s),this.changed()}}function x7(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const Vx=new Map;function u_(e,t){Vx.set(e,t)}class $x extends Error{constructor(t,s,r){super(s==="requestExpired"?"The request expired. Ask again.":s==="accountDeleted"?"This account was deleted.":s==="rateLimited"?"Too many requests. Try again in a little while.":r??`Codync cloud error (${s})`),this.status=t,this.code=s}status;code;get isTransient(){return this.status===0||this.status>=500||this.status===429||this.status===401}}async function Ls(e,t,s,r=!1){const l=await window.codync.cloud.request(e,t,s,r);if(!l.ok)throw new $x(l.error.status,l.error.code,l.error.message);return l.value}const za=Bt("cloudDefaultApplied",[]),a0=Bt("claimedComputerIds",[]),l0=e=>Bt(`keptOutOfAccount.${e}`,[]);class w7 extends ws{constructor(t){super(),this.app=t,Ti.subscribe(()=>this.tick()),t.subscribe(()=>this.tick())}app;computers=[];registeredFor=null;enablingCloud=!1;autoClaiming=!1;fail(t,s=!1){s||t instanceof $x&&t.isTransient||this.app.setError(t instanceof Error?t.message:String(t))}get userId(){return Ti.user?.userId??null}tick(){const t=this.userId;if(!t){this.computers.length&&(this.computers=[],this.changed()),this.registeredFor=null;return}this.registeredFor!==t&&(this.registeredFor=t,(async()=>{try{await Ls("POST","v1/devices",{name:await S7(),platform:{darwin:"macos",linux:"linux",win32:"windows"}[window.codync.platform]},!0)}catch(s){this.fail(s)}await this.refresh()})()),this.applyCloudDefault(),this.autoClaim()}async refresh(){if(this.userId)try{const t=await Ls("GET","v1/computers",void 0,!0);this.computers=t.computers,this.changed()}catch(t){this.fail(t)}}applyCloudDefault(){const t=this.app.local;if(!Ti.cloudURL||!t||t.connection.kind!=="online"||!t.cloud)return;const s=t.computer.id;za.get().includes(s)||(za.set([...za.get(),s]),!(t.cloud.enabled||this.enablingCloud)&&(this.enablingCloud=!0,this.enableCloud(t).catch(()=>{}).finally(()=>this.enablingCloud=!1)))}autoClaim(){const t=this.userId,s=this.app.local;t&&s&&s.cloud?.owner?.userId===t&&a0.set([s.computer.id]);const r=this.autoClaimTarget;!r||this.autoClaiming||(this.autoClaiming=!0,(async()=>{let l=3e4;for(;!await this.claim(r,!0)&&(await new Promise(h=>setTimeout(h,l)),l=Math.min(l*2,6e5),this.autoClaimTarget?.computer.id===r.computer.id););this.autoClaiming=!1})())}get autoClaimTarget(){const t=this.userId,s=this.app.local;if(!t||!s||s.connection.kind!=="online")return null;const r=s.cloud;return!r?.enabled||r.owner||l0(t).get().includes(s.computer.id)?null:s}async claim(t,s=!1){const r=this.userId;if(!r||!t.client)return s||this.app.setError("Sign in first."),!1;const l=l0(r);l.set(l.get().filter(h=>h!==t.computer.id));try{const h=await t.ready();t.cloud?.enabled||await this.enableCloud(t);const u=await Ls("POST","v1/claims",{}),p=await h.call("claimSign",{claimId:u.claimId,nonce:u.nonce,userId:r});return await Ls("POST",`v1/claims/${u.claimId}/complete`,p),await this.refresh(),t===this.app.local&&await this.forgetEarlierIdentities(t.computer.id),!0}catch(h){return this.fail(h,s),!1}}async forgetEarlierIdentities(t){const s=new Set(a0.get().filter(r=>r!==t));for(const r of this.computers)s.has(r.computerId)&&!r.online&&await this.removeFromAccount(r.computerId);a0.set([t])}async unclaim(t){const s=this.userId;if(s){const r=l0(s);r.get().includes(t.computer.id)||r.set([...r.get(),t.computer.id])}try{await(await t.ready()).call("unclaim",{},3e4),await this.refresh()}catch(r){this.fail(r)}}async setCloud(t,s){za.get().includes(t.computer.id)||za.set([...za.get(),t.computer.id]);try{s?await this.enableCloud(t):await(await t.ready()).call("setCloud",{enabled:!1},3e4)}catch(r){this.fail(r)}}async enableCloud(t){return(await t.ready()).call("setCloud",{enabled:!0},3e4)}async removeFromAccount(t){try{await Ls("DELETE",`v1/computers/${t}`),await this.refresh()}catch(s){this.fail(s)}}isOlderCopy(t){return t.online?!1:this.app.computers.some(s=>s.id!==t.computerId&&s.name===t.name)||this.computers.some(s=>s.computerId!==t.computerId&&s.name===t.name&&(this.app.store(s.computerId)!==null||!!s.online))}devices(){return Ls("GET","v1/devices").then(t=>t.devices)}revokeDevice(t){return Ls("DELETE",`v1/devices/${t}`)}grants(t){return Ls("GET",`v1/computers/${t}/grants`).then(s=>s.grants)}revokeGrant(t,s){return Ls("DELETE",`v1/computers/${t}/grants/${s}`)}async renameComputer(t,s){await Ls("PATCH",`v1/computers/${t}`,{name:s}),await this.refresh()}}async function S7(){return window.codync.computerName||{darwin:"Mac",linux:"Linux",win32:"Windows"}[window.codync.platform]}function b7(e,t){const s=new Map(t.map((r,l)=>[r,l]));return[...e].sort((r,l)=>(s.get(r.id)??t.length)-(s.get(l.id)??t.length))}function kp(e,t,s){const r=e.indexOf(t),l=e.indexOf(s);if(r<0||l<0||r===l)return e;const h=[...e];return h.splice(r,1),h.splice(l,0,t),h}function C7(e,t){const s=e.map(l=>({computer:l,items:[]})),r=new Map(s.map(l=>[l.computer.id,l]));for(const l of t)r.get(l.ref.computerId)?.items.push(l);return s}class k7 extends ws{scope=null;saved=null;accounts=new Map;unsubscribe;constructor(){super(),Ti.subscribe(()=>this.updateAccount()),nt.computerOrder.subscribe(()=>{this.saved||this.changed()}),this.updateAccount()}get ids(){return this.saved?.get().ids??nt.computerOrder.get()}move(t,s,r){const l=[...new Set([...this.ids,...r])],h=kp(l,t,s);h!==l&&(this.saved?this.saved.set({ids:h}):nt.computerOrder.set(h))}updateAccount(){const t=Ti.user?.userId,s=t?`${Ti.cloudURL}/${t}`:null;if(s!==this.scope){if(this.unsubscribe?.(),this.scope=s,this.saved=null,s){const r=this.accounts.get(s)??Bt(`computerOrder.${s}`,{ids:[]});this.accounts.set(s,r),this.saved=r,this.unsubscribe=r.subscribe(()=>this.changed())}this.changed()}}}function j7(e,t,s,r){return!t||!s?"host":e==="win32"?s.computerUse?"ready":"host":e==="darwin"&&r?.available===!1?"unavailable":s.enabled?e==="darwin"&&r?.needsApproval?"background":e==="darwin"&&r?.registered===!1?"enable":s.connected?e==="linux"?s.capture&&s.input?"ready":"portal":s.capture?s.input?"ready":"input":"capture":"helper":"enable"}const E7={capture:"x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture",input:"x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility",background:"x-apple.systempreferences:com.apple.LoginItems-Settings.extension"};class M7 extends ws{screen=null;agent=null;busy=null;checkError=null;actionError=null;lastRequest=null;requested=new Set;refreshing=!1;app;constructor(t){super(),this.app=t}get step(){return j7(window.codync.platform,this.app.local?.connection.kind==="online",this.screen,this.agent)}get helperName(){return this.screen?.permissionApp||"Codync Screen"}get error(){return this.checkError??this.actionError}async refresh(){if(!this.refreshing){this.refreshing=!0;try{const t=this.app.local;this.agent=await window.codync.app.screenAgentState(),t?.client&&t.connection.kind==="online"?this.screen=qh(await t.client.call("screenStatus",{})):this.screen=null,this.checkError=null,((this.lastRequest==="portal"?this.screen?.capture&&this.screen.input:this.lastRequest&&this.screen?.[this.lastRequest])||this.step==="ready")&&(this.actionError=null)}catch(t){this.screen=null,this.checkError=o0(t)}finally{this.refreshing=!1,this.changed()}}}async enable(){if(!this.busy){this.busy="enable",this.actionError=null,this.changed();try{if(await this.app.setRemoteScreen(!0),this.app.screenError)throw new Error(this.app.screenError);await this.refresh()}catch(t){this.actionError=o0(t)}finally{this.busy=null,this.changed()}}}async request(t){const s=this.app.local?.client;if(!(!s||this.busy)){this.busy=t,this.actionError=null,this.lastRequest=t,this.requested.add(t),this.changed();try{await s.call("requestScreenPermission",{permission:t},125e3),await this.refresh()}catch(r){this.actionError=o0(r)}finally{this.busy=null,this.changed()}}}openSettings(t){window.codync.app.openSettings(E7[t])}}function o0(e){return e instanceof Error?e.message:e&&typeof e=="object"&&"message"in e?String(e.message):String(e)}const Do=e=>`${e.computerId}/${e.botId}`,mh=e=>{const t=e.indexOf("/");return t<0?null:{computerId:e.slice(0,t),botId:e.slice(t+1)}},Wx=(e,t)=>!!e&&!!t&&e.computerId===t.computerId&&e.botId===t.botId;class A7 extends ws{constructor(t=!0){super(),this.mirrors=t,this.computerAccess=new M7(this),this.computerOrder=new k7,this.cloud=new w7(this),Ti.subscribe(()=>this.noteAccount())}mirrors;host={state:{kind:"starting"},local:null,dev:!1,logPath:""};computers=[];stores=new Map;selection=null;lastError=null;screenNeedsApproval=!1;screenError=null;screenSynced=!1;opened=!1;signedIn=null;deferred=new Set;storeSubscriptions=new Map;computerAccess;computerOrder;cloud;setError(t){this.lastError=t,this.changed()}async start(){window.codync.host.onChange(t=>this.setHost(t)),this.setHost(await window.codync.host.snapshot())}setHost(t){const s=this.host.local;this.host=t;const r=t.local;if(!this.mirrors)return this.changed();if(r&&(s?.computerId!==r.computerId||s.token!==r.token||!this.stores.has(r.computerId))){s&&s.computerId!==r.computerId&&this.detach(s.computerId);const h=this.computers.find(p=>p.id===r.computerId)??{id:r.computerId,name:"This computer",signKey:"",urls:[]},u=new qx(h,!0,()=>new bp(r.baseURL,r.token));this.attach(h,u),u.subscribe(()=>{this.syncScreen(u),this.noteOpened(u)})}else!r&&s&&this.detach(s.computerId);this.changed()}get local(){return this.host.local?this.stores.get(this.host.local.computerId)??null:null}attach(t,s){this.detach(t.id),this.computers=[...this.computers.filter(r=>r.id!==t.id),t],this.stores.set(t.id,s),s.onComputerChanged=r=>{this.computers=this.computers.map(l=>l.id===r.id?r:l),this.changed()},s.onRosterChanged=()=>this.changed(),this.storeSubscriptions.set(t.id,s.subscribe(()=>{if(s.selection){const r=s.selection;s.selection=null,this.select({computerId:t.id,botId:r})}})),s.start(),this.changed()}detach(t){this.storeSubscriptions.get(t)?.(),this.storeSubscriptions.delete(t),this.stores.get(t)?.retire(),this.stores.delete(t),this.computers=this.computers.filter(s=>s.id!==t),this.selection?.computerId===t&&(this.selection=null),this.changed()}store(t){return this.stores.get(t)??null}get roster(){const t=[];for(const s of this.computers){const r=this.stores.get(s.id);if(r)for(const l of r.roster)t.push({ref:{computerId:s.id,botId:l.id},bot:l,computer:r.computer,store:r})}return t}select(t){this.selection=t,this.changed()}get selectedStore(){return this.selection?this.store(this.selection.computerId):null}get managedStores(){return[...this.stores.values()].filter(t=>t.isLoopback)}get approvals(){return this.managedStores.flatMap(t=>t.accessRequests.map(s=>({id:`${t.computer.id}/${s.requestId}`,store:t,request:s})))}get currentApproval(){return this.approvals.find(t=>!this.deferred.has(d_(t)))??null}deferApproval(t){this.deferred.add(d_(t)),this.changed()}reviewApprovals(){this.deferred.clear(),this.changed()}async decide(t,s){await(await t.store.ready()).call("decideAccessRequest",{requestId:t.request.requestId,approve:s},3e4)}get needsAttention(){return this.roster.some(t=>t.bot.status==="needsInput")||this.approvals.length>0}get working(){return this.roster.filter(t=>t.bot.status==="working"||t.bot.status==="needsInput").length}get errorMessage(){if(this.lastError)return this.lastError;for(const t of this.stores.values())if(t.lastError)return t.lastError;return null}async setRemoteScreen(t){const s=this.local;if(s){try{this.screenNeedsApproval=(await window.codync.app.setScreenAgent(t)).needsApproval,await s.setScreenEnabled(t),this.screenError=null}catch(r){this.screenError=r instanceof Error?r.message:String(r)}this.changed()}}syncScreen(t){this.screenSynced||!t.screen||(this.screenSynced=!0,window.codync.app.syncScreenAgent(t.screen.enabled).then(s=>{this.screenNeedsApproval=s.needsApproval,this.changed()}).catch(s=>{this.screenError=s instanceof Error?s.message:String(s),this.changed()}))}noteOpened(t){this.opened||!t.hello||(this.opened=!0,t.track("app_opened"))}noteAccount(){if(!Ti.isReady)return;const t=Ti.isSignedIn;this.signedIn!==null&&t!==this.signedIn&&this.local?.track(t?"signed_in":"signed_out"),this.signedIn=t}clearErrors(){this.lastError=null;for(const t of this.stores.values())t.lastError=null;this.changed()}}const d_=e=>`${e.id}/${e.request.code??""}`;function T7(e,t){const s=di(e.computerOrder).ids,[r,l]=kt(nt.collapsedComputers),h=b7(e.computers,s),u=C7(h.filter(m=>t.has(m.id)),e.roster).map(m=>({...m,store:e.store(m.computer.id)})).filter(m=>m.store!==null),p=u.length>1;return{sections:u,grouped:p,collapsed:r,items:u.flatMap(m=>m.items),navigable:u.flatMap(m=>p&&r.includes(m.computer.id)?[]:m.items),toggle(m){l(r.includes(m)?r.filter(g=>g!==m):[...r,m])},move(m,g){e.computerOrder.move(m,g,h.map(y=>y.id))},moveBot(m,g){const y=u.find(w=>w.computer.id===m.computerId),v=y?.items??[],x=v.findIndex(w=>w.bot.id===m.botId),S=v[x+g];!y||x<0||!S||S.bot.pinned!==v[x].bot.pinned||y.store.reorder(kp(v.map(w=>w.bot.id),m.botId,S.bot.id))}}}function Fx(e){const t=b.useRef(null);b.useLayoutEffect(()=>{const s=e.current,r=s?.parentElement;if(!s||!r)return;const l=s.offsetTop-(r.offsetParent===s.offsetParent?r.offsetTop:0);t.current!==null&&l!==t.current&&!c2()&&s.animate([{transform:`translateY(${t.current-l}px)`},{transform:"translateY(0)"}],{duration:300,easing:"ease-out"}),t.current=l})}function N7(e,t){const s=t<40;switch(e){case"working":return s?3.9:1.885;case"searching":return s?2.665:2.015;case"listening":return s?3.998:4.388;case"connecting":return s?6.63:3.315}}function jp(e,t,s,r){const l=Math.sin(e),h=Math.cos(e),u=Math.sin(t),p=Math.cos(t);return m=>{const g=m[0]*h+m[2]*l,y=-m[0]*l+m[2]*h;return[s/2+g*r,s/2-(m[1]*p-y*u)*r,m[1]*u+y*p]}}const un=(e,t)=>{const s=Math.sin(e*12.9898+t*78.233)*43758.5453;return s-Math.floor(s)};function c0(e,t){const s=Math.floor(e),r=Math.floor(t),l=e-s,h=t-r,u=l*l*(3-2*l),p=h*h*(3-2*h),m=un(s,r),g=un(s+1,r),y=un(s,r+1),v=un(s+1,r+1);return m+(g-m)*u+(y-m)*p+(m-g-y+v)*u*p}const Dh=e=>Math.hypot(e[0],e[1],e[2]),vs=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],u2=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],f_=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]];function D7(e,t){const s=e<40,r=e/2*.82,l=jp(t*.12,.3,e,1),h=Math.pow(e/300,.6),u=s?2.4:1,p=s?3:12,m=s?10:40,g=[];for(let y=0;y<p;y++){const v=un(y,1.7),x=un(y,5.2),S=un(y,8.9),w=r*(.45+.52*v),C=v*2*Math.PI,j=Math.acos(2*x-1),E=[Math.sin(j)*Math.cos(C),Math.cos(j),Math.sin(j)*Math.sin(C)];let A=[-E[1],E[0],0];A=vs(A,1/Math.max(1e-6,Dh(A)));const N=[-E[2]*A[1],E[2]*A[0],E[0]*A[1]-E[1]*A[0]],L=(.25+.55*S)*(S>.5?1:-1);for(let q=0;q<m;q++){const B=q/m*2*Math.PI,I=l(vs(u2(vs(A,Math.cos(B)),vs(N,Math.sin(B))),w)),U=(I[2]/w+1)/2;g.push({x:I[0],y:I[1],z:I[2],radius:.9*u*h,white:.72,alpha:.5*(.4+.6*U)})}for(let q=0;q<3;q++){const B=t*L+q/3*2*Math.PI+x*6,I=l(vs(u2(vs(A,Math.cos(B)),vs(N,Math.sin(B))),w)),U=(I[2]/w+1)/2;g.push({x:I[0],y:I[1],z:I[2],radius:(1.2+1.6*U)*u*h,white:.3-.22*U,alpha:1})}}return{dots:g,lines:[]}}function R7(e,t,s){const r=e<40,l=Math.pow(e/300,.6),h=s?r?5:9:r?6:11,u=s?r?13:23:r?14:29,p=s?r?1.6:1:r?1.75:1.15,m=e/2*(s?.874:.82),g=s?.38:.4+.06*Math.sin(t*.35),y=jp(t*(s?.18:.5),g,e,s?1:m),v=t*(.5+1.2*(r?4.335:4.08)),x=[];for(let S=0;S<=h;S++){const w=-Math.PI/2+S/h*Math.PI,C=Math.cos(w),j=Math.sin(w),E=.62*Math.sin(t*2.1-S*.52)+.38*Math.sin(t*1.27+S*.83),A=s?m*(.88+.105*E):1,N=Math.max(1,Math.round(Math.abs(C)*u));for(let L=0;L<N;L++){const q=L/N*2*Math.PI,B=y(vs([C*Math.cos(q),j,C*Math.sin(q)],A)),I=(B[2]/(s?m:1)+1)/2;if(s){const U=Math.max(0,E);x.push({x:B[0],y:B[1],z:B[2],radius:(.6+1.7*I)*p*(1+.4*U)*l,white:.66-.56*I-.1*U,alpha:1})}else{const U=q+t*.5-v,P=Math.atan2(Math.sin(U),Math.cos(U)),F=Math.exp(-(P*P)/.18)*Math.max(0,B[2]);x.push({x:B[0],y:B[1],z:B[2],radius:((.6+1.7*I)*p+F)*l,white:.62-.54*I,alpha:.45+.55*Math.min(1,F)})}}}return{dots:x,lines:[]}}function L7(e,t){const s=e<40,r=Math.pow(e/300,.6),l=s?8:41,h=s?1:7,u=s?1.52:.95,p=.72,m=jp(t*.12,.32,e,e/2*.8),g=Math.PI*(3-Math.sqrt(5)),y=[];for(let S=0;S<l;S++){const w=1-2*(S+.5)/l,C=Math.sqrt(1-w*w),j=S*g,E=[C*Math.cos(j),w,C*Math.sin(j)];E[0]+=.3*(c0(S*.31+9,t*.24)-.5)*2,E[1]+=.3*(c0(S*.53+27,t*.21)-.5)*2,E[2]+=.3*(c0(S*.77+55,t*.27)-.5)*2,y.push(vs(E,1/Dh(E)))}const v=[],x=[];for(let S=0;S<l;S++){for(let E=S+1;E<l;E++){const A=Dh(f_(y[S],y[E]));if(A>=p)continue;const N=m(y[S]),L=m(y[E]),q=((N[2]+L[2])/2+1)/2;x.push({x1:N[0],y1:N[1],x2:L[0],y2:L[1],white:.42,alpha:(1-A/p)*(.3+.55*q),width:Math.max(.6,.8*r)})}const w=m(y[S]),C=(w[2]+1)/2,j=1+.25*Math.sin(t*1.4+S*2.7);v.push({x:w[0],y:w[1],z:w[2],radius:(1.4+1.8*C)*u*j*r,white:.55-.45*C,alpha:1})}for(let S=0;S<h;S++){const w=Math.floor(t*.55+S*7.31),C=Math.floor(un(w,S*3.1+1.7)*l),j=Math.floor(un(w,S*5.7+4.2)*l);if(C===j)continue;const E=t*.55+S*7.31,A=E-Math.floor(E),N=u2(y[C],vs(f_(y[j],y[C]),A)),L=m(vs(N,1/Math.max(1e-6,Dh(N)))),q=(L[2]+1)/2;v.push({x:L[0],y:L[1],z:L[2],radius:(1.4*1.5+1.8*q)*u*r,white:.05,alpha:.5+.5*q})}return{dots:v,lines:x}}function B7(e,t,s){const r=e==="working"?D7(t,s):e==="connecting"?L7(t,s):R7(t,s,e==="listening");return{dots:r.dots.filter(l=>l.alpha>=.02).map(l=>({...l,radius:Math.max(.3,l.radius)})).sort((l,h)=>l.z-h.z),lines:r.lines.filter(l=>l.alpha>=.02)}}const p_=(e,t)=>(1-Math.min(1,Math.max(0,e)))*t;function xs({state:e="working",size:t=16,color:s="var(--text)",animated:r=!0}){const l=b.useRef(null),h=Qa(),u=vp();return b.useEffect(()=>{const p=l.current;if(!p)return;const m=window.devicePixelRatio||1;p.width=Math.round(t*m),p.height=Math.round(t*m);const g=p.getContext("2d"),y=getComputedStyle(p).color,v=r&&!h,x=performance.now();let S=0,w=0;const C=j=>{if(v&&j-w<1e3/30){S=requestAnimationFrame(C);return}w=j;const E=.6+(v?(j-x)/1e3*N7(e,t):0),A=B7(e,t,E);g.setTransform(m,0,0,m,0,0),g.clearRect(0,0,t,t),g.strokeStyle=y,g.fillStyle=y;for(const N of A.lines)g.globalAlpha=p_(N.white,N.alpha),g.lineWidth=N.width,g.beginPath(),g.moveTo(N.x1,N.y1),g.lineTo(N.x2,N.y2),g.stroke();for(const N of A.dots)g.globalAlpha=p_(N.white,N.alpha),g.beginPath(),g.arc(N.x,N.y,N.radius,0,Math.PI*2),g.fill();g.globalAlpha=1,v&&(S=requestAnimationFrame(C))};return S=requestAnimationFrame(C),()=>cancelAnimationFrame(S)},[e,t,r,h,s,u]),o.jsx("canvas",{ref:l,"aria-hidden":!0,style:{width:t,height:t,color:s,display:"block",flex:"none"}})}function m_(e){return(e.split(/\r?\n/).map(s=>s.trim()).find(Boolean)??"").replace(/^[#>\-* ]+/,"").replaceAll("**","").replaceAll("`","")}const O7=b.memo(function({bot:t,store:s,compact:r,usingComputer:l,members:h}){return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r?0:10,padding:"9px 0",width:"100%",justifyContent:r?"center":"flex-start"},children:[o.jsx(Lx,{bot:t,members:h,size:30}),o.jsxs("div",{"aria-hidden":r,style:{display:"flex",flexDirection:"column",gap:2,lineHeight:"calc(16px * var(--scale))",minWidth:0,overflow:"hidden",width:r?0:void 0,flex:r?"none":1,opacity:r?0:1,transition:"opacity var(--layout)"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:4,minWidth:0},children:[t.pinned?o.jsx(se,{name:"pin.fill",size:10,color:"var(--tertiary)"}):null,o.jsx("span",{style:{...R("body",t.unread>0?"semibold":"medium"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}),l?o.jsx(se,{name:"cursorarrow.motionlines",size:10,color:"var(--accent)",title:"Using the computer"}):null]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[o.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:o.jsx(z7,{bot:t,store:s})}),t.unread>0?o.jsx("span",{style:{...R("caption2","semibold"),color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:999,padding:"0 6px",minWidth:18,height:18,display:"grid",placeItems:"center",flex:"none"},children:t.unread}):null]})]})]})}),gh={...R("callout"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0};function z7({bot:e,store:t}){return pn(e)?o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--warning)",minWidth:0},children:[o.jsx(xs,{state:"listening",size:16,color:"var(--warning)"}),o.jsx("span",{style:gh,children:e.activity||"Needs your approval"})]}):mn(e)?o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--secondary)",minWidth:0},children:[o.jsx(xs,{size:13,color:"var(--secondary)"}),o.jsx("span",{style:gh,children:e.activity||"Working…"})]}):e.status==="error"?o.jsx("span",{style:{...gh,color:"var(--danger)"},children:m_(e.lastMessage??"Something went wrong")}):o.jsx("span",{style:{...gh,color:"var(--secondary)"},children:m_(e.lastMessage??(ft(e)?`${e.members.length} bots`:`${t.backendName(e.backend)} · ${ru(e)}`))})}const H7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23000'%20fill-rule='evenodd'%20d='M12%201.8C9%201.8%207.6%204.2%207.6%207c0%201.6-.6%202.8-1.6%204.2C4.8%2012.9%204%2014.8%204%2016.8c0%201.2.4%202.2%201%203l-1%201.7c-.2.5.2.9.7.8l3.8-.7c1.1.4%202.3.6%203.5.6s2.4-.2%203.5-.6l3.8.7c.5.1.9-.3.7-.8l-1-1.7c.6-.8%201-1.8%201-3%200-2-.8-3.9-2-5.6-1-1.4-1.6-2.6-1.6-4.2%200-2.8-1.4-5.2-4.4-5.2ZM12%2010.6c-2.4%200-4%202.7-4%205.6%200%202.4%201.7%203.8%204%203.8s4-1.4%204-3.8c0-2.9-1.6-5.6-4-5.6ZM10.4%205.3a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8Zm3.2%200a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8ZM10.9%208.1h2.2L12%209.5Z'/%3e%3c/svg%3e",I7=e=>({laptop:"laptopcomputer",macmini:"macmini",macstudio:"macstudio",imac:"desktopcomputer",macpro:"macpro.gen3"})[e??""]??"desktopcomputer";function Lr({computer:e,size:t=36}){const s=e?.color?_s(e.color):"var(--text)";return o.jsx("span",{"aria-hidden":!0,style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none",color:s},children:e?.device==="linux"?o.jsx("span",{style:{width:t*.55,height:t*.55,backgroundColor:s,WebkitMaskImage:`url("${H7}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):o.jsx(se,{name:I7(e?.device),size:t*.5,weight:"medium"})})}function U7({store:e,compact:t,collapsed:s,previous:r,next:l,dragged:h,setDragged:u,toggle:p,move:m,notice:g,children:y}){const v=b.useRef(null),x=e.computer.id;return Fx(v),o.jsxs("section",{ref:v,className:`computer-roster-section ${h===x?"dragging":""}`,"aria-label":e.hostName,onDragOver:S=>{!h||h===x||(S.preventDefault(),S.dataTransfer.dropEffect="move")},onDrop:S=>{h&&(S.preventDefault(),m(h,x),u(null))},children:[o.jsx("div",{className:"computer-roster-heading",children:o.jsxs("button",{className:"computer-roster-toggle",draggable:!0,"aria-expanded":!s,"aria-label":`${e.hostName}, ${e.connectionLabel}`,title:`${e.hostName} · ${e.connectionLabel}. Drag to reorder.`,onClick:p,onDragStart:S=>{S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",x),u(x)},onDragEnd:()=>u(null),onKeyDown:S=>{if(!S.altKey||!["ArrowUp","ArrowDown"].includes(S.key))return;S.preventDefault(),S.stopPropagation();const w=S.key==="ArrowUp"?r:l;w&&m(x,w)},children:[o.jsx(Lr,{computer:e.computer,size:20}),t?null:o.jsxs("span",{className:"computer-roster-label",children:[o.jsx("strong",{children:e.hostName}),o.jsx("span",{className:e.shownConnection.kind==="online"?"":"warning",children:e.connectionLabel})]}),o.jsx("span",{className:`computer-roster-chevron ${s?"collapsed":""}`,children:o.jsx(se,{name:"chevron.down",size:9})})]})}),g,o.jsx("div",{className:`computer-roster-content ${s?"collapsed":""}`,inert:s,"aria-hidden":s,children:o.jsx("div",{children:y})})]})}const g_={title(e,t){return e.kind==="updateApp"?"Update this app":`Update Codync on ${t}`},detail(e,t,s,r,l=!0){if(e.kind==="updateApp")return`${s?`${t} runs Codync ${s} and`:t} needs this app to be ${e.minimum} or newer. Your chats are safe on the computer.`;const h=r==="macos"?"Open Codync on that Mac and choose Check for Updates.":r==="linux"?"Run codync-host update there.":"Update Codync on that computer.",u=`${t} runs Codync ${e.version}; this app needs ${e.minimum} or newer.`;return l?`${u} ${h}`:u}};function Ep(){const e=si(),t=Ae(),s=t.mismatch;if(!s)return null;const r=s.kind==="updateApp"?["Update Codync",()=>window.codync.updates.check()]:t===e.local&&!e.host.dev&&window.codync.platform!=="linux"?[`Update ${t.hostName}`,()=>window.codync.host.restart()]:null;return o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12,padding:14,background:"var(--surface)",borderRadius:16},children:[o.jsx(se,{name:"arrow.down.circle",size:15,color:"var(--warning)"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[o.jsx("div",{style:{...R("subheadline","semibold"),color:"var(--text)"},children:g_.title(s,t.hostName)}),o.jsx("div",{style:{...R("footnote"),color:"var(--secondary)"},children:g_.detail(s,t.hostName,t.hostVersion?.version,t.hello?.os,r===null)}),r?o.jsx(Ne,{onClick:r[1],style:{marginTop:4,alignSelf:"flex-start"},children:r[0]}):null]})]})}function P7({roster:e,compact:t,onContext:s}){const r=si(),l=r.selection,[h,u]=b.useState(null),[p,m]=b.useState(null),[g,y]=b.useState(null),v=(C,j)=>{if(g?.item.ref.computerId!==C)return j;const E=new Map(j.map(A=>[A.bot.id,A]));return g.ids.flatMap(A=>E.get(A)??[])},x=(C,j)=>{!g||g.item.ref.computerId!==j.ref.computerId||(C.preventDefault(),C.dataTransfer.dropEffect="move",!(j.bot.id===g.item.bot.id||j.bot.pinned!==g.item.bot.pinned||C.currentTarget.getAnimations().length)&&y({...g,ids:kp(g.ids,g.item.bot.id,j.bot.id)}))},S=C=>{g&&(C.preventDefault(),g.ids.some((j,E)=>j!==g.item.store.roster[E]?.id)&&g.item.store.reorder(g.ids),y(null))},w=(C,j)=>{const E=Do(C.ref),A=Wx(C.ref,l),N=e.sections.length>1;return o.jsx(q7,{dragging:g?.item.bot.id===C.bot.id&&g.item.ref.computerId===C.ref.computerId,background:A?"var(--roster-selected)":h===E?"var(--bubble-agent)":"transparent",compact:t,label:N?`${C.bot.name}, on ${C.store.hostName}`:C.bot.name,title:N?`${C.bot.name} · ${C.store.hostName}`:C.bot.name,selected:A,onHover:L=>u(q=>L?E:q===E?null:q),onClick:()=>r.select(C.ref),onContext:(L,q)=>s(C.bot,C.store,L,q),onDragStart:()=>y({item:C,ids:j.map(L=>L.bot.id)}),onDragOver:L=>x(L,C),onDrop:S,onDragEnd:()=>y(null),children:o.jsx(O7,{bot:C.bot,store:C.store,compact:t,usingComputer:C.store.screen?.agentBot===C.bot.id,members:ft(C.bot)?C.store.members(C.bot):V7})},E)};return e.sections.map(({computer:C,store:j,items:E},A)=>{const N=j.mismatch&&!t?o.jsx(hn.Provider,{value:j,children:o.jsx(Ep,{})}):null,L=v(C.id,E).map(q=>w(q,E));return e.grouped?o.jsxs(U7,{store:j,compact:t,collapsed:e.collapsed.includes(C.id),toggle:()=>e.toggle(C.id),previous:e.sections[A-1]?.computer.id,next:e.sections[A+1]?.computer.id,dragged:p,setDragged:m,move:e.move,notice:N,children:[L,!E.length&&!j.mismatch&&!t?o.jsx("div",{className:"computer-roster-empty",children:j.shownConnection.kind==="online"?"No bots yet":j.connectionLabel}):null]},C.id):o.jsxs("div",{children:[N,L]},C.id)})}function q7({dragging:e,background:t,compact:s,label:r,title:l,selected:h,onHover:u,onClick:p,onContext:m,onDragStart:g,onDragOver:y,onDrop:v,onDragEnd:x,children:S}){const w=b.useRef(null);return Fx(w),o.jsx("button",{ref:w,className:`roster-row ${e?"dragging":""}`,style:{padding:s?0:"0 8px",background:t},"aria-label":r,"aria-selected":h,title:l,draggable:!0,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:p,onContextMenu:C=>{C.preventDefault(),m(C.clientX,C.clientY)},onDragStart:C=>{C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("application/x-codync-bot",r),g()},onDragEnter:y,onDragOver:y,onDrop:v,onDragEnd:x,children:S})}const V7=[],Kx="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%3e%3cpath%20fill='%23EA4335'%20d='M24%209.5c3.54%200%206.71%201.22%209.21%203.6l6.85-6.85C35.9%202.38%2030.47%200%2024%200%2014.62%200%206.51%205.38%202.56%2013.22l7.98%206.19C12.43%2013.72%2017.74%209.5%2024%209.5z'/%3e%3cpath%20fill='%234285F4'%20d='M46.98%2024.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58%202.96-2.26%205.48-4.78%207.18l7.73%206c4.51-4.18%207.09-10.36%207.09-17.65z'/%3e%3cpath%20fill='%23FBBC05'%20d='M10.53%2028.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92%2016.46%200%2020.12%200%2024c0%203.88.92%207.54%202.56%2010.78l7.97-6.19z'/%3e%3cpath%20fill='%2334A853'%20d='M24%2048c6.48%200%2011.93-2.13%2015.89-5.81l-7.73-6c-2.15%201.45-4.92%202.3-8.16%202.3-6.26%200-11.57-4.22-13.47-9.91l-7.98%206.19C6.51%2042.62%2014.62%2048%2024%2048z'/%3e%3c/svg%3e";function Yx(){const{user:e,isBusy:t}=Ja();return o.jsxs("span",{className:"profile-avatar","aria-hidden":!0,style:{position:"relative",overflow:"hidden"},children:[e?.avatarURL?o.jsx("img",{src:e.avatarURL,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):o.jsx(se,{name:"person.fill",size:15,weight:"medium",color:"var(--secondary)"}),t?o.jsx("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx($e,{size:14})}):null]})}function $7({compact:e,approvals:t,onDismiss:s,onUsage:r,onSettings:l}){const[h,u]=b.useState("main"),{user:p,isBusy:m,errorMessage:g}=Ja(),y=p!==null,v=y?[{title:m?"Please wait…":"Sign out",icon:"rectangle.portrait.and.arrow.right",disabled:m,action:()=>{s(),Ti.signOut()}}]:[{title:"Continue with Apple",icon:"apple.logo",disabled:m,action:()=>{s(),Ti.signIn("apple")}},{title:"Continue with Google",icon:"person.crop.circle.badge.plus",image:Kx,disabled:m,action:()=>{s(),Ti.signIn("google")}}],x=w=>{s(),window.codync.app.openExternal(w)},S=h==="support"?[{title:"Support",icon:"chevron.left",action:()=>u("main")},{title:"Help & documentation",icon:"book",chevron:!0,action:()=>x("https://github.com/leepokai/codync#readme")},{title:"Report an issue",icon:"bubble.left",chevron:!0,action:()=>x("https://github.com/leepokai/codync/issues")}]:[{title:"Usage",icon:"gauge.with.dots.needle.33percent",chevron:!0,action:r},{title:"Get Codync for mobile",icon:"iphone",action:()=>x("https://apps.apple.com/app/id6760984418")},{title:"Support",icon:"book.closed",chevron:!0,action:()=>u("support")},{title:"Settings",icon:"gearshape",detail:t>0?String(t):null,action:l},...v];return o.jsx("div",{className:"context-layer",onMouseDown:w=>w.target===w.currentTarget&&s(),children:o.jsxs("div",{className:"account-panel",style:{width:Math.min(260,window.innerWidth-32),left:16,bottom:e?68:64},children:[o.jsx(Gx,{items:S,onDismiss:s,after:w=>h==="main"&&w===3?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"panel-divider"}),o.jsxs("div",{className:"panel-identity",children:[o.jsx(se,{name:"person.crop.circle",size:15}),o.jsx("span",{style:{...R(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p?.email??"Account"}),y?null:o.jsx("span",{style:R(11),children:"Not signed in"})]})]}):h==="support"&&w===0?o.jsx("div",{className:"panel-divider"}):null}),h==="main"&&g?o.jsx("div",{style:{...R(12),color:"var(--warning)",padding:"8px 10px"},children:g}):null]})})}function Gx({items:e,onDismiss:t,after:s,dismissOnActivate:r=!1}){const[l,h]=b.useState(0);return b.useEffect(()=>{const u=p=>{if(p.key==="Escape")p.preventDefault(),t();else if(p.key==="ArrowDown"||p.key==="Tab"&&!p.shiftKey)p.preventDefault(),h(m=>(m+1)%e.length);else if(p.key==="ArrowUp"||p.key==="Tab"&&p.shiftKey)p.preventDefault(),h(m=>(m-1+e.length)%e.length);else if(p.key==="Enter"||p.key===" "){p.preventDefault();const m=e[l];m&&!m.disabled&&(r&&t(),m.action())}};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e,l,t,r]),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:e.map((u,p)=>o.jsxs("div",{children:[o.jsxs("button",{className:`panel-row ${l===p?"highlight":""}`,style:{color:u.destructive?"var(--danger)":"var(--text)"},disabled:u.disabled,onMouseEnter:()=>h(p),onClick:()=>{r&&t(),u.action()},children:[o.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:u.image?o.jsx("img",{src:u.image,alt:"",width:14,height:14}):o.jsx(se,{name:u.icon,size:14})}),o.jsx("span",{style:{...R(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:u.title}),u.detail?o.jsx("span",{style:{...R(13),color:"var(--secondary)"},children:u.detail}):null,u.chevron?o.jsx(se,{name:"chevron.right",size:11,color:"var(--secondary)"}):null]}),s?.(p)]},u.title))})}function W7({items:e,onDismiss:t,style:s}){const r=e.map(l=>({title:l.title,icon:l.icon??"circle",destructive:l.destructive,action:l.action}));return o.jsx("div",{className:"action-menu",style:s,children:o.jsx(Gx,{items:r,onDismiss:t,dismissOnActivate:!0,after:l=>e[l+1]?.divider?o.jsx("div",{className:"panel-divider"}):null})})}const F7="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACsElEQVR4Ae2WA6xcQRiFp7ZtBzX23rqdt65tO6xtM65t27Zt2+3dZ3v636R/sHi5mXUyX3LWON/uSTLEowgEAoHgVuXyo25WrvAY8vlmlQq3b1SpOOAyJVmJj2GXSc7U81m6pFzIejzlYtbXcL0/9UKWHsQVakkovR3C7HOjcoXzd6qWKUt8RNLZ7DWh8GMIsw/ILCLOuFmpwjgs7CK2WxUrWoiXgV95ABSNwcLOknwh2xDH6VSqcDkjAcxfg24Jo9Tjk1Jojby2dvX2qAU15DqxB8qlaBFQDBJEvh5GG3psUn/MupqKXnqufrZGgQhnAkyjAMb21yi7PSnFIA+AxODnahRg7gtg9NIinkmpk4H3b8bP8ZcA16QUWr8qvO8xhHlM4ETtxgq/gPZJwet64GR4Bd6cKfSV2GOcHxW+uUWfMA4BTZP6TGlOm1G3Gl/HK7D3ZLVf0p4uscQe/YJYZlgQkzq914rY61WqcAlgbAbpvEKlks4nwycQdT4nm3S4UaRuTxemxqkApv/o20mnajXkFcD8/mOSDA6T4RB4e7YQ67TfmqgW1ySgpu2M7ynbmvXgF+CKo8CRk5VZsz0d07C4JgGMcX502ryuS9NwUr4SwMnMPCIzLMwlgOk79t7fMzUb+EoAJ5OAZd0SwJjnRoRtoAM/eFtg94lqXxvt6YzlPSeAUfTyJPiiFM+Xl2MgQ7Cg1wQIoBgbNIMv/e6x8nCQUw90BPCJgMov2qAofPlpDwhsVs9FBPCpAIKT4pzMAIL4S4BrUkb5vWKS6hLEnwIck9qNkwkoAQ2TSrAZdCMIEogCyP8z0G/nkwlwAUQ9jaqnUueTCXwBboSAEOBGCMTFBI3A7s7Xnf0Dm4NFQNrduQexh85W8kLBSZDPASwQ0WBvl2X0Ms1KAIFAIBAI/gE4ZSpQR8vzCwAAAABJRU5ErkJggg==",K7="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAB3UlEQVR4Ae2WA4ydQRSFq7hxbdsOardhGTaqbdtug9q2G9bm2rZt79k9Se7anNmdL/mt8w3uew0MdRCDYdxeNJlwKGHPhEPxdtkLamJpvcS2yKXNEps3rRbbzSyXwMRDcSvkxbUtIEurxbYryizAlldLgIuNVXkEoJoAFyNgBIxALkagqkl736S0RWkBI2AEnlkkYcG1KEw/G4FFt6LxxzMVRREYnY4dz2Nx/0+iOgJ3fiaizYZgcOmwKXf71iYZeXnvmIx+u0PB62sfxqghEJ+ciZGHwtBrZwisfVORnJYJti5DTjgRDoGtLpJKCZC0DMArLD3fcfftIei8JQTC7PORmHwqnHLqCeSFPXDlawIYknNCCInNAMV+uqeoK7DsTjTY8gw45lg4GDo/GgjIJOWc+OScopeAwBLK8c9KFBGfob4AQ7K+52Xj4xgG5e+D2gIMxNaefzESeWHFYdBvrilqCxBWG4Zi6D0vY1n/eYxBe0NZlZQXYLWRFpeFxxxWek1i+4A0Vh4KmX+jWgsYgVZ7R6G0ZdjD2VW6hE4cXvIyafgZbQUkvJYCEl5LAQmvpYCE10yg8uFFIK52BCofXgRu1IKAhK88zfeOa9pq36gt2UG9akyA4esfBoMhCz+uoIWaiQpKAAAAAElFTkSuQmCC",Y7="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAERUlEQVR4Ae2WA5BcSxiFuyrLZ79lbCfD52XMwVNs27ZtG6vYySK2bZuLyax3O/3HGVz8o2BO1VdcfKer76kmzjjjjGUpFqn9wm/Y7/29+itPMnQMysXP/RXxjKOVxhdvS7cSF4fLS8NUO4vMrHge5MSwf+XXFzJiXKIcWkIarl7JoJIwdZbf0N8Fy9ccV4wy+RdEu4xziLwsTBMM8q8oPqeKIHm/AQp6Zs0XWSD/koy0zW6F7SofsDXAhUmfBPG3yTXqL94CnabnA2lDNtr56miagbAhpRdWp94DzMsXHCyl9zd6gLAx0S7l7SJfemWNb5hsPAibosCEELMFpi/wBVmTZEbnuGiXD5pJTgJRc0iWqKjPoN+M5H8bUZqmRLuCLBedbCovWaouzCQzQJSLItMqGBWIjvoeBPmIp1uJly1PPxoE+ZCEq7P9h72Z1X/GFwE5QWTG5Jhlm9MPU1UGOaGUmFc19dVsXl/vmQpyAslI3+Ja2hazeRHExJB3bGD88Lm57oOYSHZa+fQ13cTKA5Iw1cnUaBdMAbhK/1hFXhap9eKYTW7CVI0yYl0GIQtcpVuJh+UFwlWzEPLAUbh6TOILJnQXU4KV72WRvDxMLUXKU0mk9nfyMuw0a4EQghS6lfgRbOCpjCugCiMGYTJ7MSXSY1wXIV+bqn+Qp5+iDKuRmxgkPdpVCUIY4HfFzea8+h7SCPVNTAH2zB5EzAROE1nioLirE6Hqh5GH0lCemAk8E5iMDrlK9QTJKxar/OAaoE4/XFOL8ASWBYQQ3IVFI3yBDxAnr95LBAS2HTYeOavDCFdg+rCzCZNLBIa9/dXYWU3d6p6f67V5ECEPr895RGSYzFZkiZXWnk0dPDeIyMCLE16eVptVaYRmI6YAPPQILnCVpmEKwO8RwxQbN3hd4VEjbxYcPjGr0PCJlJvxaYXHjLhacvLguKChjwYFDdH3w1Bj+M0R9yYU2q0f4X1ZN8A/Lam/P+VCN8g3/ukor7P60T/PMSrg3ezEVgYVwy99H18JGvKUWkLftquuPgiWUZHMMy7Q/EQzMfL52l0EAYsJGZKUdbSqWlSB+yHy8kYFcte/6uHV9MRFIfI+zU7S3/o9yQYBa9ChY5yIAvKdxFy8mp6sLKRA0U7XOIRwRGtbCimQ8SBUVppwBK5SNJe8b4tTNGBQktUL/N/rPL0bouQrMIvw5efmx4sz0QxzBcr0uMMjg2dug1Fc8vEPAmReREjYtzDJlHyu1mdp4BCdzQpUHXCPXq4QYrLAw2BZJyI0uesf/YYJxxsWUPR5KEIIx+BWEcYFQuQXaUCAC+EO96wWaH8JJYSY1ewD1f/jn03e9N/q4t3s+FGQ92l+kv4xIDENIYSiWbcD+rcKrCXY/NjytBcrcLZk11sPcDJ4ltfqFQ+b/yCg2BfgYlGJgMG6xeyPptivgF73b58rEzjkP5Y444wzzwBU1GHMLo7wbgAAAABJRU5ErkJggg==";function G7({accountOpen:e,onAccount:t,onConnectApps:s}){return o.jsxs("div",{className:"sidebar-footer",children:[o.jsx("div",{className:"sidebar-footer-fade","aria-hidden":!0}),o.jsx("button",{className:`sidebar-account ${e?"active":""}`,"aria-label":"Open account menu for Account","aria-expanded":e,title:"Account menu",onClick:t,children:o.jsx(Yx,{})}),o.jsxs("button",{className:"connect-apps",onClick:s,children:[o.jsx("span",{children:"Connect apps"}),o.jsx("span",{className:"connect-apps-logos","aria-hidden":!0,children:[F7,K7,Y7].map(r=>o.jsx("img",{src:r,alt:"",draggable:!1},r))})]})]})}class Z7 extends ws{state={profiles:[],status:{},attachments:[]};started=!1;start(){this.started||(this.started=!0,window.codync.ssh.onChange(t=>this.apply(t)),window.codync.ssh.state().then(t=>this.apply(t)))}apply(t){this.state=t,this.changed()}status(t){return this.state.status[t]??{kind:"idle"}}isSSH(t){return this.state.attachments.some(s=>s.computer.id===t)}}const xo=new Z7;function Ro(){return b.useEffect(()=>xo.start(),[]),di(xo)}function X7(e){b.useEffect(()=>{xo.start();const t=new Map,s=()=>{const l=new Map(xo.state.attachments.map(h=>[h.computer.id,h]));for(const[h,u]of l){const p=`${u.baseURL}|${u.token}`;if(t.get(h)===p)continue;const m=e.computers.find(y=>y.id===h),g={...u.computer,urls:[],color:m?.color??null,device:m?.device??null};e.attach(g,new qx(g,!0,()=>new bp(u.baseURL,u.token))),t.set(h,p)}for(const h of[...t.keys()])l.has(h)||(t.delete(h),e.detach(h))};s();const r=xo.subscribe(s);return()=>{r();for(const l of t.keys())e.detach(l)}},[e])}function Zx(e,t){const s=new Set(t.split(",").filter(Boolean)),r=e.filter(u=>!s.has(u)),l=r.length?r:e,h=u=>[...u].sort().join(",");return{shown:l,toggling(u){if(!e.includes(u))return h(new Set(e.filter(m=>!l.includes(m))));const p=new Set(l);return p.has(u)?p.size>1&&p.delete(u):p.add(u),h(new Set(e.filter(m=>!p.has(m))))},only(u){return e.includes(u)?h(new Set(e.filter(p=>p!==u))):""}}}function Q7(e){if(!e.length)return"Computers";const t=e.filter(s=>s.kind==="online").length;return t===e.length?`${t} connected`:t>0?`${t}/${e.length} connected`:e.some(s=>s.kind==="connecting")?"Connecting…":e.every(s=>s.kind==="unauthorized")?"No access":e.every(s=>s.kind==="unpaired")?"Not paired":`${e.length} offline`}function v_({hidden:e,setHidden:t,manage:s,compact:r=!1}){const l=si(),h=Ro(),u=h.state.profiles.filter(w=>!h.state.attachments.some(C=>C.profileId===w.id)),p=A6(u.map(w=>h.status(w.id))),m=Zx(l.computers.map(w=>w.id),e),g=m.shown.map(w=>l.store(w)).filter(w=>!!w),y=g.filter(w=>w.shownConnection.kind==="online").length,v=p?`${y?`${y} connected · `:""}${p}`:Q7(g.map(w=>w.shownConnection)),x=w=>{const C=l.store(w.id);return C?`${C.hostName} · ${C.connectionLabel}`:w.name},S=()=>{const w=[{title:"All computers",selected:m.shown.length===l.computers.length,action:()=>t("")}];for(const C of l.computers)w.push({title:x(C),selected:m.shown.includes(C.id),action:()=>t(m.toggling(C.id))});for(const C of u){const j=h.status(C.id),E=Ax(j,!1);w.push({title:`${C.name||C.host} · ${E}`,action:s})}return l.computers.length>1&&l.computers.forEach((C,j)=>w.push({title:`Only ${C.name}`,divider:j===0,action:()=>t(m.only(C.id))})),g.length&&w.push({title:"Reconnect",icon:"arrow.clockwise",divider:!0,action:()=>g.forEach(C=>C.restartStream())}),l.host.state.kind==="notInstalled"&&w.push({title:`Install host on this ${window.codync.platform==="darwin"?"Mac":"computer"}`,icon:"desktopcomputer",action:()=>window.codync.host.install()}),l.host.state.kind==="failed"&&w.push({title:"Try again on this computer",icon:"arrow.clockwise",action:()=>window.codync.host.restart()}),w.push({title:"Manage computers",icon:"desktopcomputer",action:s}),w};return o.jsxs(Ya,{items:S,title:v,className:r?"computer-filter-action":void 0,style:{display:"flex",alignItems:"center",gap:4,minWidth:0,padding:r?"0 9px":"6px 0",...R(12,"medium"),color:"var(--secondary)"},children:[r?o.jsx(se,{name:"desktopcomputer",size:12,weight:"medium"}):o.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},"aria-label":`Computers, ${v}. Filter conversations`,children:v}),o.jsx(se,{name:"chevron.down",size:8,weight:"semibold"})]})}const J7=36e5;function e9(e,t){switch(e){case"completed":return{kind:"done"};case"failed":case"cancelled":return{kind:"failed",detail:t??""};default:return{kind:"pending"}}}function Xx(e){const{botMessage:t,status:s}=e.data;return e.kind!=="notice"||!t||typeof t.sourceBotId!="string"||typeof t.targetBotId!="string"||typeof t.text!="string"?null:{id:e.id,seq:e.seq,rev:e.rev,createdAt:e.createdAt,chat:e.botId,message:t,outcome:e9(s,t.detail)}}const Qx=e=>e.chat===e.message.sourceBotId,Fh=e=>Qx(e)?e.message.targetBotId:e.message.sourceBotId,t9=e=>Qx(e)?"Messaged":"Message from";function i9(e){const t=[];let s=null;for(const r of e){if(!Fa(r))continue;const l=Xx(r);l?s?.exchanges&&Fh(s.exchanges[0])===Fh(l)?s.exchanges.push(l):(s={entry:r,exchanges:[l]},t.push(s)):(t.push({entry:r,exchanges:null}),s=null)}return t}function s9(e){return{peerId:Fh(e[0]),count:e.length,failed:e.some(t=>t.outcome.kind==="failed")}}function n9(e,t,s){const r=new Map;for(const l of[...e,...t]){const h=Xx(l);if(!h)continue;const u=r.get(h.id);(!u||h.rev>=u.rev)&&r.set(h.id,h)}return[...r.values()].filter(l=>Fh(l)===s).sort((l,h)=>l.seq-h.seq)}function r9(e){const t=[];let s=null,r=null;const l=(h,u,p)=>{t.push({kind:"message",id:h,author:u,text:p,showsAuthor:u!==r}),r=u};for(const h of e)(s===null||h.createdAt-s>J7)&&(t.push({kind:"separator",id:`sep-${h.id}`,at:h.createdAt}),r=null),s=h.createdAt,l(`${h.id}-request`,h.message.sourceBotId,h.message.text),h.message.reply&&l(`${h.id}-reply`,h.message.targetBotId,h.message.reply),h.outcome.kind!=="done"&&(t.push({kind:"status",id:`${h.id}-status`,outcome:h.outcome,awaiting:h.message.targetBotId}),r=null);return t}function d2(e,t=!1){const s=[];let r=null,l=null;const h=t?i9(e):e.filter(Fa).map(u=>({entry:u,exchanges:null}));for(const{entry:u,exchanges:p}of h){const m=u.kind==="user"&&u.data.clientNonce?`user-${u.data.clientNonce}`:u.id;if((r===null||u.createdAt-r>36e5)&&(s.push({id:`sep-${m}`,kind:"separator",date:u.createdAt}),l=null),p){s.push({id:m,kind:"exchanges",entry:u,exchanges:p}),l=null,r=u.createdAt;continue}const g=u.kind==="user"?"user":u.kind==="agent"?`agent:${u.data.author??""}`:u.kind;s.push({id:m,kind:"entry",entry:u,groupStart:g!==l}),l=g==="user"||u.kind==="agent"?g:null,r=u.createdAt}return s}function Jx(e,t){const s=b.useRef(null),r=b.useRef(new Set);s.current===null&&(s.current=new Set(e));for(const l of e)s.current.has(l)||(s.current.add(l),t&&r.current.add(l));return r.current}function ew(e){return e.kind==="entry"&&e.entry.kind==="user"?"row-in mine":"row-in"}const h0=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}),u0=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),a9=new Intl.DateTimeFormat(void 0,{weekday:"long"}),vh=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Mp={time:e=>h0.format(new Date(e)),separator(e){const t=new Date(e),s=new Date,r=new Date(s.getTime()-864e5);return`${vh(t,s)?"Today":vh(t,r)?"Yesterday":u0.format(t)} ${h0.format(t)}`},day(e){const t=new Date(e),s=new Date;return vh(t,s)?h0.format(t):vh(t,new Date(s.getTime()-864e5))?"Yesterday":s.getTime()-e<6*864e5?a9.format(t):u0.format(t)},short(e){const t=Math.max(0,(Date.now()-e)/1e3);return t<60?"now":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:t<86400*7?`${Math.floor(t/86400)}d`:u0.format(new Date(e))}};function Ap(e){const t=e.split(".").pop()?.toLowerCase()??"";return["png","jpg","jpeg","heic","gif","webp","tiff","bmp"].includes(t)?"photo":t==="pdf"?"doc.richtext":["zip","gz","tar","7z"].includes(t)?"doc.zipper":["mov","mp4","m4v"].includes(t)?"film":["mp3","m4a","wav","aac"].includes(t)?"waveform":"doc"}function ho(e){if(e<1e3)return`${e} bytes`;const t=["KB","MB","GB"];let s=e/1e3,r=0;for(;s>=1e3&&r<t.length-1;)s/=1e3,r++;return`${s<10?s.toFixed(1):Math.round(s)} ${t[r]}`}function l9({attachments:e,botId:t}){const[s,r]=b.useState(null);return o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},children:[e.map(l=>Cx(l.name)?o.jsx("button",{"aria-label":l.name,onClick:()=>r(l),style:{borderRadius:16,overflow:"hidden",maxWidth:220,maxHeight:280,display:"flex"},children:o.jsx(y_,{file:l,botId:t,style:{maxWidth:220,maxHeight:280}})},l.id):o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:"var(--bubble-user)",borderRadius:16},children:[o.jsx(se,{name:Ap(l.name),size:16,color:"var(--secondary)"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[o.jsx("span",{style:{...R("subheadline"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:l.name}),o.jsx("span",{style:{...R("caption2"),color:"var(--tertiary)"},children:ho(l.size)})]})]},l.id)),o.jsx(ht,{open:s!==null,onClose:()=>r(null),width:720,height:560,children:s?o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:s.name}),o.jsx("div",{style:{flex:1,minHeight:0,padding:12,display:"grid",placeItems:"center"},children:o.jsx(y_,{file:s,botId:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})]}):null})]})}function y_({file:e,botId:t,style:s}){const r=Pr(),[l,h]=b.useState(null);return b.useEffect(()=>{let u=!1,p=null;return r.attachmentData(e.id,t).then(m=>{!m||u||(p=URL.createObjectURL(new Blob([m])),h(p))}),()=>{u=!0,p&&URL.revokeObjectURL(p)}},[r,e.id,t]),l?o.jsx("img",{src:l,alt:"",style:{display:"block",...s}}):o.jsx("div",{style:{width:160,height:120,borderRadius:16,background:"var(--bubble-user)",display:"grid",placeItems:"center"},children:o.jsx(se,{name:"photo",size:13,color:"var(--tertiary)"})})}function o9({entry:e,file:t}){const s=Ae(),r=s.fileDownloads.states.get(t.id),l=r?.kind==="downloading",h=l?"Cancel download":r?.kind==="failed"?"Retry download":r?.kind==="saved"?"Save again":"Download",u=l?`${ho(r.received)} of ${ho(t.size)}`:r?.kind==="failed"?r.message:r?.kind==="saved"?`${ho(t.size)} · Saved`:ho(t.size);return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:14,background:"var(--bubble-agent)",borderRadius:16,maxWidth:380},children:[o.jsx(se,{name:Ap(t.name),size:24,color:"var(--secondary)"}),o.jsxs("div",{style:{minWidth:0,flex:1},children:[o.jsx("div",{style:{...R("subheadline","semibold"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:t.name,children:t.name}),o.jsx("div",{role:r?.kind==="failed"?"alert":"status",style:{...R("caption2"),color:r?.kind==="failed"?"var(--danger)":"var(--secondary)",overflowWrap:"anywhere"},children:u})]}),o.jsx(xp,{title:h,icon:l?"xmark":"arrow.down.to.line",size:36,onClick:()=>l?s.fileDownloads.cancel(t.id):void s.fileDownloads.save(s.client,e.id,t)})]})}const c9=e=>e.includes("-")&&[...e].every(t=>"|-: ".includes(t)),__=e=>{let t=e;return t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(s=>s.trim())};function h9(e){const t=[];let s=[],r=[],l=null,h="";const u=()=>{s.length&&(t.push({kind:"paragraph",text:s.join(`
+`)}),s=[]),r.length&&(r.length>=2&&c9(r[1])?t.push({kind:"table",header:__(r[0]),rows:r.slice(2).map(__)}):t.push({kind:"paragraph",text:r.join(`
+`)}),r=[])};for(const p of e.split(`
+`)){const m=p.trim();if(m.startsWith("```")){l?(t.push({kind:"code",text:l.join(`
+`),language:h}),l=null):(u(),l=[],h=m.slice(3));continue}if(l){l.push(p);continue}if(m.startsWith("|")){s.length&&u(),r.push(m);continue}r.length&&u();const g=Math.min(Math.floor((/^[ \t]*/.exec(p)?.[0].length??0)/2),3),y=/^(#+) (.*)$/.exec(m),v=/^(\d+\.) (.*)$/.exec(m);m?m==="---"||m==="***"||m==="___"?(u(),t.push({kind:"rule"})):y?(u(),t.push({kind:"heading",text:y[2].trim(),level:y[1].length})):/^[-*+•] /.test(m)?(u(),t.push({kind:"bullet",text:m.slice(2),marker:g>0?"◦":"•",depth:g})):v?(u(),t.push({kind:"bullet",text:v[2],marker:v[1],depth:g})):m.startsWith(">")?(u(),t.push({kind:"quote",text:m.slice(1).trim()})):s.push(p):u()}return l&&t.push({kind:"code",text:l.join(`
+`),language:h}),u(),t}function Ha(e,t="i"){const s=[];return e.split(/(`[^`\n]+`)/).forEach((r,l)=>{r.length>2&&r.startsWith("`")&&r.endsWith("`")?s.push(o.jsx("code",{style:{fontFamily:"var(--mono)",background:"rgba(var(--text-rgb), 0.08)"},children:r.slice(1,-1)},`${t}${l}`)):r&&s.push(...uo(r,`${t}${l}-`))}),s}const u9=new RegExp("\\[([^\\]]+)\\]\\(([^)\\s]+)\\)|\\*\\*([^*]+)\\*\\*|__([^_]+)__|~~([^~]+)~~|\\*([^*\\n]+)\\*|(?<![\\w])_([^_\\n]+)_(?![\\w])");function uo(e,t){const s=[];let r=e,l=0;for(;r;){const h=u9.exec(r);if(!h){s.push(r);break}h.index>0&&s.push(r.slice(0,h.index));const u=`${t}${l++}`;if(h[1]!==void 0){const p=h[2];s.push(o.jsx("a",{href:p,onClick:m=>{m.preventDefault(),window.codync.app.openExternal(p)},style:{color:"var(--accent)",textDecoration:"none",cursor:"pointer"},children:uo(h[1],`${u}-`)},u))}else h[3]!==void 0||h[4]!==void 0?s.push(o.jsx("strong",{style:{fontWeight:600},children:uo(h[3]??h[4],`${u}-`)},u)):h[5]!==void 0?s.push(o.jsx("s",{children:uo(h[5],`${u}-`)},u)):s.push(o.jsx("em",{children:uo(h[6]??h[7],`${u}-`)},u));r=r.slice(h.index+h[0].length)}return s}const d9=e=>e===1?15:e===2?13:11,f2="calc(1.2em + 4px * var(--md-scale))",tw={lineHeight:f2,margin:"calc(-2px * var(--md-scale)) 0"},d0={color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",...tw},f9=b.memo(function({block:t}){switch(t.kind){case"paragraph":return o.jsx("div",{style:{...d0,fontSize:"var(--conversation)"},children:Ha(t.text)});case"heading":return o.jsx("div",{style:{...d0,fontSize:`calc(${d9(t.level)}px * var(--md-scale))`,fontWeight:t.level===2?600:700},children:Ha(t.text)});case"bullet":return o.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,fontSize:"var(--conversation)",paddingLeft:t.depth*16,...tw},children:[o.jsx("span",{style:{color:"var(--secondary)",fontVariantNumeric:"tabular-nums",flex:"none"},children:t.marker}),o.jsx("span",{style:{color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",minWidth:0},children:Ha(t.text)})]});case"rule":return o.jsx("div",{style:{height:1,background:"var(--border)",margin:"4px 0"}});case"table":{const s=Math.max(t.header.length,...t.rows.map(l=>l.length)),r=Array.from({length:s},(l,h)=>h);return o.jsx("div",{style:{overflowX:"auto"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${s}, max-content)`,columnGap:16,rowGap:7,fontSize:"var(--conversation)",color:"var(--text)",padding:"2px 0",width:"max-content",lineHeight:f2},children:[r.map(l=>o.jsx("span",{style:{fontWeight:600},children:Ha(t.header[l]??"",`h${l}`)},`h${l}`)),t.rows.map((l,h)=>[o.jsx("div",{style:{gridColumn:`1 / span ${s}`,height:1,background:"var(--border)"}},`l${h}`),...r.map(u=>o.jsx("span",{children:Ha(l[u]??"",`${h}-${u}`)},`${h}-${u}`))])]})})}case"quote":return o.jsx("div",{style:{...d0,fontSize:"var(--conversation)",color:"var(--secondary)",paddingLeft:10,boxShadow:"inset 3px 0 0 var(--border)"},children:Ha(t.text)});case"code":return o.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflowX:"auto"},children:o.jsx("pre",{style:{margin:0,padding:10,fontFamily:"var(--mono)",fontSize:"calc(10px * var(--md-scale))",color:"var(--text)",width:"max-content",lineHeight:f2},children:t.text})})}},(e,t)=>JSON.stringify(e.block)===JSON.stringify(t.block)),ou=b.memo(function({text:t}){const s=h9(t);return o.jsx("div",{className:"markdown selectable",style:{display:"flex",flexDirection:"column",gap:10,minWidth:0},children:s.map((r,l)=>o.jsx(f9,{block:r},l))})}),iw=e=>{switch(e){case"execute":return"Wants to run a command";case"edit":case"delete":case"move":return"Wants to change files";case"fetch":return"Wants to access the web";case"read":case"search":return"Wants to read files";default:return"Wants to use a tool"}},x_={allow_once:0,allow_always:1,reject_once:2,reject_always:3},sw=e=>[...e].sort((t,s)=>(x_[t.kind]??9)-(x_[s.kind]??9));function nw(e){switch(e.kind){case"allow_once":return"Allow once";case"allow_always":return"Always allow";case"reject_once":return"Deny";case"reject_always":return"Never";default:return e.name}}function p9({entry:e,hostName:t,answering:s,respond:r}){const[l,h]=b.useState(!1),u=e.data,p=u.status==="pending",m=!!u.command||!!u.detail||!!u.diffs?.length,g=sw(u.options??[]),y=u.cwd?` · ${u.cwd.split("/").filter(Boolean).pop()??u.cwd}`:"";return o.jsx("div",{style:{paddingRight:40},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:16,background:"var(--bubble-agent)",borderRadius:22},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx("span",{style:{...R("headline"),color:"var(--text)"},children:iw(u.toolKind)}),p?o.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--warning)"}}):null]}),o.jsx("div",{className:"selectable",style:{...R("subheadline",void 0,"monospaced"),color:"var(--secondary)",overflowWrap:"anywhere",...l?{}:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"}},children:u.title??""}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...R("caption"),color:"var(--tertiary)"},children:[o.jsx(se,{name:"desktopcomputer",size:10}),`Runs on ${t}${y}`]}),m?o.jsx(wp,{expanded:l,onToggle:()=>h(v=>!v),label:o.jsx("span",{style:{...R("caption","medium"),color:"var(--secondary)"},children:"Details"}),children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,paddingTop:6},children:[u.command?o.jsx(p2,{text:u.command}):null,u.detail?o.jsx(p2,{text:u.detail.slice(0,2e3)}):null,(u.diffs??[]).map((v,x)=>o.jsx(rw,{diff:v},x))]})}):null,p?o.jsx("div",{style:{background:"var(--background)",borderRadius:14,marginTop:4},children:g.map((v,x)=>o.jsxs("div",{children:[x>0?o.jsx("div",{style:{height:.5,background:"var(--border)"}}):null,o.jsxs("button",{disabled:s!==null,onClick:()=>r(v.optionId),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:46,padding:"0 14px",opacity:s===null||s===v.optionId?1:.4},children:[o.jsx("span",{style:{...R("body",v.kind==="allow_once"?"semibold":"regular"),color:v.kind.startsWith("allow")?"var(--text)":"var(--danger)",flex:1},children:nw(v)}),s===v.optionId?o.jsx($e,{size:14}):null]})]},v.optionId))}):o.jsx("div",{style:{...R("caption","medium"),color:"var(--secondary)"},children:m9(e)})]})})}function m9(e){const t=e.data;switch(t.status){case"answered":{const s=t.options?.find(r=>r.optionId===t.selected);switch(s?.kind){case"allow_once":return"Allowed once";case"allow_always":return"Always allowed";case"reject_once":return"Denied";case"reject_always":return"Never allowed";default:return s?.name??"Answered"}}case"cancelled":return"Cancelled";default:return"Expired — the agent moved on"}}function p2({text:e}){return o.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:240},children:o.jsx("pre",{className:"selectable",style:{margin:0,padding:8,fontFamily:"var(--mono)",fontSize:au(10),color:"var(--text)",width:"max-content"},children:e})})}function rw({diff:e}){const t=e.patch.split(`
+`).slice(0,80);return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...R("caption",void 0,"monospaced"),color:"var(--secondary)"},children:[o.jsx(se,{name:e.isNew?"doc.badge.plus":"doc.text",size:10}),o.jsx("span",{style:{flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.path.split("/").pop()}),o.jsxs("span",{style:{color:"var(--added)"},children:["+",e.added]}),o.jsxs("span",{style:{color:"var(--removed)"},children:["−",e.removed]})]}),o.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:260},children:o.jsx("div",{style:{padding:8,fontFamily:"var(--mono)",fontSize:au(10),width:"max-content"},children:t.map((s,r)=>o.jsx("div",{style:{whiteSpace:"pre",color:s.startsWith("+")?"var(--added)":s.startsWith("-")?"var(--removed)":"var(--secondary)"},children:s||" "},r))})})]})}const Ga=e=>e.auth==="signedOut",g9=e=>e.connection?.status==="active",st=e=>e*1e3,Re={connectors:async e=>(await e.call("connectors")).items,marketConnectors:async(e,t,s=null)=>{const r=await e.call("marketConnectors",{search:t,cursor:s??""},st(60));return{items:r.items,next:r.nextCursor||null}},installConnector:async(e,t,s,r)=>(await e.call("installConnector",{registryName:t,option:s,inputs:r},st(45))).connector,addConnector:async(e,t)=>(await e.call("installConnector",t,st(45))).connector,importConnectors:async(e,t)=>(await e.call("importConnectors",{config:t},st(60))).items,connectorSignIn:(e,t)=>e.call("connectorSignIn",{id:t},st(60)),finishConnectorSignIn:async(e,t,s,r)=>(await e.call("connectorSignInFinish",{state:t,code:s,error:r},st(60))).connector,removeConnector:(e,t)=>e.call("removeConnector",{id:t}),composioStatus:e=>e.call("composioStatus"),setComposioKey:(e,t)=>e.call("setComposioKey",{key:t},st(60)),composioApps:async(e,t)=>(await e.call("composioToolkits",{search:t},st(60))).items,composioConnect:(e,t)=>e.call("composioConnect",{toolkit:t},st(60)),composioConnectFields:(e,t,s,r)=>e.call("composioConnectFields",{toolkit:t,mode:s,fields:r},st(60)),composioConnection:(e,t)=>e.call("composioConnection",{id:t},st(30)),skills:async e=>(await e.call("skills")).items,marketSkills:async e=>(await e.call("marketSkills",{},st(60))).items,installSkill:(e,t)=>e.call("installSkill",{source:t},st(60)),addSkill:(e,t,s,r)=>e.call("installSkill",{name:t,description:s,instructions:r}),removeSkill:(e,t)=>e.call("removeSkill",{id:t}),skillDetails:async(e,t)=>(await e.call("skillDetails",t,st(60))).markdown,connectorInfo:(e,t)=>e.call("connectorInfo",{registryName:t},st(60)),verifyConnector:(e,t)=>e.call("connectorVerify",{id:t},st(120)),finishConnectionRequest:(e,t,s={})=>e.call("connectorRequestFinish",{entryId:t,connectorId:s.connectorId??null,value:s.value??null,username:s.username??null,cancel:s.cancel??!1},st(120)),logins:async e=>(await e.call("credentialLogins",{},st(60))).items,saveLogin:(e,t,s,r)=>e.call("credentialSaveLogin",{site:t,username:s,password:r},st(60)),removeLogin:(e,t)=>e.call("credentialRemoveLogin",{id:t},st(60)),credentialStatus:e=>e.call("credentialStatus",{},st(60)),setOnePasswordToken:(e,t)=>e.call("credentialSetOnePassword",{token:t},st(60)),updateConnectorCredentials:(e,t,s)=>e.call("credentialUpdateConnector",{id:t,fields:s},st(120)),agentSetup:async(e,t,s,r,l,h)=>(await e.call("agentSetup",{backend:t,step:s,method:r,cols:l,rows:h},st(300))).term,agentAuth:(e,t)=>e.call("agentAuth",{backend:t},st(300)),agentAuthenticate:(e,t,s)=>e.call("agentAuthenticate",{backend:t,method:s},st(660)),setAgentEnv:(e,t,s)=>e.call("setAgentEnv",{backend:t,vars:s},st(300)),termInput:(e,t,s)=>e.call("termInput",{term:t,data:s}),termResize:(e,t,s,r)=>e.call("termResize",{term:t,cols:s,rows:r}),termClose:(e,t)=>e.call("termClose",{term:t})},Kh=()=>({items:[],visibleCount:12});function aw(e,t,s){const r=new Set(e.items.map(s));return{...e,items:[...e.items,...t.filter(l=>!r.has(s(l))&&(r.add(s(l)),!0))]}}const lw=(e,t)=>aw(Kh(),e,t),m2=e=>({...e,visibleCount:Math.min(e.items.length,e.visibleCount+12)}),ow=e=>e.items.slice(0,e.visibleCount),g2=e=>e.items.length>e.visibleCount,tt=e=>e instanceof Error?e.message:String(e),cw=e=>new Promise(t=>setTimeout(t,e));function fo({title:e,children:t}){return o.jsxs("section",{className:"market-section",children:[o.jsx("div",{style:{...R("headline"),color:"var(--text)",paddingLeft:4},children:e}),t]})}function wo({children:e}){return o.jsx("div",{className:"item-grid",children:e})}const v2={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},y2=e=>({display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical",overflow:"hidden"});function Va({title:e,subtitle:t,added:s,busy:r=!1,addLabel:l="Add",icon:h,onAdd:u,onOpen:p}){const m=p??(s||r?void 0:u);return o.jsxs("div",{className:`market-row ${m?"openable":""}`,role:m?"button":void 0,tabIndex:m?0:void 0,onClick:m,onKeyDown:g=>{m&&g.target===g.currentTarget&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),m())},children:[o.jsx("div",{style:{width:46,height:46,flex:"none",display:"grid"},children:h}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[o.jsx("span",{style:{...R("body","medium"),color:"var(--text)",...v2},title:e,children:e}),o.jsx("span",{style:{...R("subheadline"),color:"var(--secondary)",...v2},title:t,children:t})]}),r?o.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none"},children:o.jsx(xs,{size:18,color:"var(--secondary)"})}):s?o.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none",color:"var(--secondary)"},"aria-label":"Added",title:"Added",children:o.jsx(se,{name:"checkmark",size:11,weight:"semibold"})}):o.jsx("button",{className:"capsule-action",style:R("subheadline","semibold"),onClick:g=>{g.stopPropagation(),u()},children:l})]})}function _2(){return o.jsx("div",{className:"item-grid skeleton",children:[0,1,2,3].map(e=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"10px 12px"},children:[o.jsx("div",{style:{width:46,height:46,borderRadius:12,background:"var(--bubble-agent)",flex:"none"}}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsx("div",{style:{width:120,height:12,borderRadius:6,background:"var(--bubble-agent)"}}),o.jsx("div",{style:{width:190,height:10,borderRadius:5,background:"var(--bubble-agent)"}})]})]},e))})}function v9({src:e,style:t}){const[s,r]=b.useState(!1);return o.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>r(!0),style:{...t,display:s?"block":"none"}})}function y9(e,t,s){if(e&&URL.canParse(e)){const h=new URL(e).hostname;if(h&&h!=="github.com")return h}const r=s?.split("/")[0];if(!r)return null;const l=r.split(".").filter(Boolean);return l.length<2||l[0]==="io"&&l[1]==="github"?t.toLowerCase().includes("github")?"github.com":null:`${l[1]}.${l[0]}`}function x2({website:e,name:t,registryName:s,size:r=46}){const l=y9(e,t,s),h=r*.26;return o.jsxs("div",{style:{position:"relative",width:r,height:r,borderRadius:h,overflow:"hidden",background:"var(--bubble-agent)",display:"grid",placeItems:"center",flex:"none"},children:[o.jsx("span",{style:{...R(r*.4,"semibold","rounded"),color:"var(--text)"},children:t.slice(0,1).toUpperCase()||"?"}),l?o.jsx(v9,{src:`https://www.google.com/s2/favicons?domain=${encodeURIComponent(l)}&sz=128`,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:r*.2,boxSizing:"border-box",background:"#fff"}}):null]})}function Tp({url:e,name:t,size:s=46}){const[r,l]=b.useState(!1);return o.jsxs("div",{"aria-hidden":!0,style:{position:"relative",width:s,height:s,flex:"none",borderRadius:s*.28,background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:[r?null:o.jsx("span",{style:{...R(s*.4,"semibold"),color:"var(--secondary)"},children:t.slice(0,1).toUpperCase()}),e?o.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>l(!0),style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:s*.18,boxSizing:"border-box",display:r?"block":"none"}}):null]})}function w2({name:e}){return o.jsx("div",{style:{width:"100%",height:"100%",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:o.jsx(se,{name:e,size:18,weight:"medium"})})}function hw({size:e}){return o.jsx("div",{style:{width:e??"100%",height:e??"100%",flex:"none",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:o.jsx(se,{name:"book.pages",size:13})})}function Np({title:e,url:t,style:s}){return o.jsx("button",{className:"plain-link",style:s,title:t,onClick:()=>window.codync.app.openExternal(t),children:e})}function cu({title:e,onBack:t,trailing:s}){return o.jsxs("div",{style:{position:"relative",height:44,padding:"0 12px",display:"flex",alignItems:"center",gap:6,flex:"none",background:"var(--background)"},children:[o.jsx("div",{style:{position:"absolute",left:60,right:60,textAlign:"center",...R("compactBody","semibold"),color:"var(--text)",...v2},children:e}),o.jsx(be,{title:"Back",icon:"chevron.left",onClick:t}),o.jsx("span",{style:{flex:1,minWidth:8}}),s]})}function uw({base:e,top:t}){const{mounted:s,shown:r}=Ps(t!==null),l=b.useRef(t);return t!==null&&(l.current=t),o.jsxs("div",{className:"market-stack",children:[o.jsx("div",{className:`market-layer ${r?"off-leading":""}`,inert:r,children:e}),s?o.jsx("div",{className:`market-layer ${r?"":"off-trailing"}`,children:t??l.current}):null]})}function ti({value:e,onChange:t,placeholder:s,secret:r=!1,lines:l,mono:h=!1,label:u}){const p=h?R("callout","regular","monospaced"):{};return l?o.jsx("textarea",{className:"market-field","aria-label":u??s,value:e,placeholder:s,spellCheck:!1,onChange:m=>t(m.target.value),style:{...p,lineHeight:1.3,minHeight:`${l[0]*1.3}em`,maxHeight:`${l[1]*1.3}em`}}):o.jsx("input",{className:"market-field","aria-label":u??s,type:r?"password":"text",value:e,placeholder:s,spellCheck:!1,autoComplete:"off",onChange:m=>t(m.target.value),style:p})}function Vs({text:e}){return o.jsx("span",{className:"selectable",style:{color:"var(--danger)"},children:e})}const Dp=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""));function _9(){const[e,t]=b.useState(window.innerHeight);return b.useEffect(()=>{const s=()=>t(window.innerHeight);return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),e}function os({open:e,onClose:t,width:s=520,height:r=600,children:l}){const h=_9();return o.jsx(ht,{open:e,onClose:t,width:s,height:Math.min(r,h-76),children:l})}class x9 extends ws{constructor(t){super(),this.store=t}store;installedConnectors=[];installedSkills=[];async refresh(){const t=this.store.client;if(!t)return;const[s,r]=await Promise.allSettled([Re.connectors(t),Re.skills(t)]);s.status==="fulfilled"&&(this.installedConnectors=s.value),r.status==="fulfilled"&&(this.installedSkills=r.value),this.changed()}async after(t){const s=await t;return await this.refresh(),s}async installConnector(t,s,r){return this.after(Re.installConnector(await this.store.ready(),t.name,s,r))}async addConnector(t){return this.after(Re.addConnector(await this.store.ready(),t))}async importConnectors(t){return this.after(Re.importConnectors(await this.store.ready(),t))}async finishConnectorSignIn(t,s,r){return this.after(Re.finishConnectorSignIn(await this.store.ready(),t,s,r))}async waitForSignIn(t){for(let s=0;s<150;s++){await cw(2e3),await this.refresh();const r=this.installedConnectors.find(l=>l.id===t);if(r&&!Ga(r))return}}async removeConnector(t){await this.after(Re.removeConnector(await this.store.ready(),t))}async installSkill(t){await this.after(Re.installSkill(await this.store.ready(),t))}async addSkill(t,s,r){await this.after(Re.addSkill(await this.store.ready(),t,s,r))}async removeSkill(t){await this.after(Re.removeSkill(await this.store.ready(),t))}async signIn(t){const s=await Re.connectorSignIn(await this.store.ready(),t);if(!URL.canParse(s.url))return;if(s.callback!=="app"){window.codync.app.openExternal(s.url),await this.waitForSignIn(t);return}let r;try{r=await window.codync.app.authenticate(s.url,window.codync.appScheme)}catch{return}const l=new URL(r).searchParams;await this.finishConnectorSignIn(l.get("state")??"",l.get("code"),l.get("error_description")??l.get("error"))}}const w_=new WeakMap;function hu(e){let t=w_.get(e);return t||w_.set(e,t=new x9(e)),t}const qr=e=>di(hu(e));function S_({query:e,searchToken:t}){const s=Ae(),[r,l]=b.useState(null),[h,u]=b.useState(Kh),[p,m]=b.useState(!0),[g,y]=b.useState(null),[v,x]=b.useState(!1),[S,w]=b.useState(null),C=b.useRef(0),j=b.useRef(e);j.current=e;const E=async()=>{const N=s.client;if(!N)return;const L=++C.current,q=j.current;m(!0);try{const B=await Re.composioStatus(N),I=B.configured?await Re.composioApps(N,q):[];if(C.current!==L)return;l(B),u(lw(I,U=>U.slug)),y(null)}catch(B){C.current===L&&y(tt(B))}finally{C.current===L&&m(!1)}};b.useEffect(()=>(E(),()=>{C.current++}),[t]);const A=r?.configured===!0;return o.jsxs(fo,{title:"Apps",children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[A?p?o.jsx(_2,{}):h.items.length===0?o.jsx("span",{style:{color:"var(--secondary)"},children:e?`No apps match “${e}”.`:"Couldn't load apps."}):o.jsx(wo,{children:ow(h).map(N=>o.jsx(Va,{title:N.name,subtitle:N.description??N.slug,added:g9(N),addLabel:"Connect",icon:o.jsx(Tp,{url:N.logo,name:N.name}),onAdd:()=>w(N)},N.slug))}):o.jsx(wo,{children:o.jsx(Va,{title:"Composio",subtitle:"Gmail, Slack, GitHub, Notion and 1,000 more apps",added:!1,busy:r===null&&p,addLabel:"Set up",icon:o.jsx(w2,{name:"square.grid.3x3"}),onAdd:()=>x(!0)})}),!p&&g2(h)&&A?o.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o.jsx(Ne,{kind:"secondary",onClick:()=>u(m2),children:"Load more apps"})}):null,g?o.jsx("span",{style:{...R("footnote"),color:"var(--danger)"},children:g}):null,A?o.jsxs("button",{style:{display:"flex",alignItems:"center",gap:4,alignSelf:"flex-start",...R("footnote"),color:"var(--tertiary)"},onClick:()=>x(!0),children:[o.jsx(se,{name:"key",size:10}),"Composio settings"]}):null]}),o.jsx(os,{open:v,onClose:()=>x(!1),children:o.jsx(w9,{status:r,done:N=>{l(N),E()}})}),o.jsx(os,{open:S!==null,onClose:()=>w(null),children:S?o.jsx(dw,{app:S,done:()=>{E(),hu(s).refresh()}},S.slug):null})]})}function w9({status:e,done:t}){const s=Ae(),r=Ki(),[l,h]=b.useState(""),[u,p]=b.useState(!1),[m,g]=b.useState(null),y=async x=>{const S=s.client;if(S){p(!0);try{t(await Re.setComposioKey(S,x)),r()}catch(w){g(tt(w))}p(!1)}},v=e?.keyUrl??"https://platform.composio.dev";return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:"Composio",trailing:u?o.jsx($e,{}):o.jsx(be,{title:"Save",icon:"checkmark",disabled:!l.trim(),onClick:()=>{y(l)}})}),o.jsxs(ui,{children:[o.jsxs(ke,{title:"Composio API key",footer:`Composio signs you in to apps like Gmail and Slack and runs their tools for your bots. The key stays on ${s.hostName}.`,children:[o.jsx(ti,{label:"API key",value:l,onChange:h,secret:!0,placeholder:e?.configured?"Saved (paste to replace)":"ak_…"}),URL.canParse(v)?o.jsx(Np,{title:"Get a key from Composio",url:v,style:R("footnote")}):null]}),e?.configured?o.jsx(ke,{footer:"Bots lose the apps you connected until you add a key again.",children:o.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{y("")},children:"Remove key"})}):null,m?o.jsx(ke,{children:o.jsx(Vs,{text:m})}):null]})]})}function dw({app:e,requestId:t,done:s}){const r=Ae(),l=Ki(),[h,u]=b.useState(null),[p,m]=b.useState({}),[g,y]=b.useState(!1),[v,x]=b.useState(!1),[S,w]=b.useState(null),C=b.useRef(!1),j=b.useRef(s);j.current=s;const E=()=>{m({}),C.current=!0,y(!0)};b.useEffect(()=>{let B=!1;return(async()=>{const I=r.client;if(I)try{const U=await Re.composioConnect(I,e.slug);if(B||(u(U),U.status!=="redirect"||!U.connection))return;U.url&&URL.canParse(U.url)&&window.codync.app.openExternal(U.url);for(let P=0;P<300;P++){if(await cw(2e3),B)return;const F=await Re.composioConnection(I,U.connection).catch(()=>null);if(B)return;if(F){if(F.status==="active"){if(t)try{await Re.finishConnectionRequest(I,t,{connectorId:`composio-${e.slug}`})}catch($){B||w(tt($));return}B||E();return}if(F.status==="failed"||F.status==="expired"){w(`Signing in to ${e.name} didn't work (${F.status}). Close and try again.`);return}}}w("Timed out waiting for the sign-in.")}catch(U){B||w(tt(U))}})(),()=>{B=!0,C.current&&j.current()}},[r,e.slug,e.name,t]);const A=async()=>{const B=r.client,I=h?.mode;if(!(!B||!I)){x(!0);try{const U=await Re.composioConnectFields(B,e.slug,I,Dp(p));U.status==="active"?(t&&await Re.finishConnectionRequest(B,t,{connectorId:`composio-${e.slug}`}),E()):w(`${e.name} says the connection is ${U.status}.`)}catch(U){w(tt(U))}x(!1)}},N=h?.status==="needsFields",L=g?o.jsx(be,{title:"Done",icon:"checkmark",onClick:l}):N?v?o.jsx($e,{}):o.jsx(be,{title:"Connect",icon:"checkmark",disabled:h?.fields?.some(B=>B.required&&!p[B.name])??!0,onClick:()=>{A()}}):null,q=B=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx($e,{}),o.jsx("span",{style:{color:"var(--secondary)"},children:B})]});return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:`Connect ${e.name}`,trailing:L}),o.jsxs(ui,{children:[o.jsx(ke,{children:o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[o.jsx(Tp,{url:e.logo,name:e.name,size:52}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[o.jsx("span",{style:R("title3","semibold"),children:e.name}),e.description?o.jsx("span",{style:{...R("subheadline"),color:"var(--secondary)",...y2(3)},children:e.description}):null]})]})}),g?o.jsx(ke,{footer:`Turn ${e.name} on for a bot in the bot's settings, under Connectors.`,children:o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--added)"},children:[o.jsx(se,{name:"checkmark.circle.fill",size:12}),"Connected"]})}):N?o.jsx(ke,{footer:`Sent to Composio, which keeps it for ${e.name}.`,children:(h?.fields??[]).map(B=>o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsx(ti,{label:B.label,value:p[B.name]??"",secret:B.secret,placeholder:B.label,onChange:I=>m(U=>({...U,[B.name]:I}))}),B.description?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:B.description+(B.required?"":" (optional)")}):null]},B.name))}):h?.status==="redirect"?o.jsxs(ke,{footer:"Sign in on the page that opened. This updates by itself when you're done.",children:[h.url&&URL.canParse(h.url)?o.jsx("div",{children:o.jsxs(Ne,{kind:"secondary",onClick:()=>window.codync.app.openExternal(h.url),children:[o.jsx(se,{name:"safari",size:11}),"Open the sign-in page"]})}):null,q("Waiting for you to finish signing in…")]}):S===null?o.jsx(ke,{children:q("Asking Composio…")}):null,S?o.jsx(ke,{children:o.jsx(Vs,{text:S})}):null]})]})}const Rp={display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"};function fw({item:e,requestId:t,done:s}){const r=Ae(),l=qr(r),h=Ki(),[u,p]=b.useState(e.options[0]?.id??""),[m,g]=b.useState({}),[y,v]=b.useState(null),[x,S]=b.useState(!1),[w,C]=b.useState(null),j=b.useRef(!1),E=e.options.find(q=>q.id===u)??e.options[0],A=q=>m[q.name]??"",N=async()=>{if(E){S(!0),C(null);try{const q=await r.ready();let B;y?B=(await Re.connectors(q)).find(I=>I.id===y.id)??y:(B=await l.installConnector(e,E.id,m),v(B),g({})),Ga(B)&&await l.signIn(B.id),t?await Re.finishConnectionRequest(q,t,{connectorId:B.id}):await Re.verifyConnector(q,B.id),await l.refresh(),s(),h()}catch(q){C(tt(q))}S(!1)}};b.useEffect(()=>{j.current||(j.current=!0,e.options.length===1&&e.options[0].inputs.length===0&&N())},[]);const L=!E||E.inputs.some(q=>q.required&&!(m[q.name]??q.default??""));return o.jsxs("div",{style:Rp,children:[o.jsx(ut,{title:"Add connector",trailing:x?o.jsx($e,{}):o.jsx(be,{title:"Add",icon:"plus",disabled:y===null&&L,onClick:()=>{N()}})}),o.jsxs(ui,{children:[o.jsx(ke,{children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 0"},children:[o.jsx("span",{style:R("title3","semibold"),children:e.title}),e.description?o.jsx("span",{style:{color:"var(--secondary)"},children:e.description}):null,e.website&&URL.canParse(e.website)?o.jsx(Np,{title:e.website,url:e.website,style:{...R("footnote"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}):null]})}),e.options.length>1?o.jsx(ke,{title:"Runs",children:o.jsx(G8,{selection:u,onChange:p,options:e.options.map(q=>({id:q.id,label:q.kind==="remote"?`Hosted by ${e.title}`:`On ${r.hostName} (${q.kind})`}))})}):null,E?o.jsxs(ke,{title:"Setup",footer:`Keys are saved on ${r.hostName} only.`,children:[E.inputs.length===0?o.jsx("span",{style:{color:"var(--secondary)"},children:E.kind==="remote"?`No keys needed here. If ${e.title} wants you to sign in, its sign-in page opens next.`:"No setup needed."}):null,E.inputs.map(q=>o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsx(ti,{label:q.name,value:A(q),secret:q.secret,placeholder:q.secret?q.name:q.default??q.placeholder??q.name,onChange:B=>g(I=>({...I,[q.name]:B}))}),q.description?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:q.description+(q.required?"":" (optional)")}):null]},q.name))]}):null,w?o.jsx(ke,{children:o.jsx(Vs,{text:w})}):null]})]})}function S9(){const e=Ae(),t=qr(e),s=Ki(),[r,l]=b.useState(""),[h,u]=b.useState("command"),[p,m]=b.useState(""),[g,y]=b.useState(""),[v,x]=b.useState(""),[S,w]=b.useState(!1),[C,j]=b.useState(null),E=h==="config"?v.trim()!=="":r.trim()!==""&&p.trim()!=="",A={command:`Runs on ${e.hostName} in the bot's project folder. Quotes work like in a shell.`,url:"A remote MCP server, streamable HTTP or SSE.",config:`Paste the MCP config from a README or another app (Claude, Cursor, VS Code). Every server in it is added. Saved on ${e.hostName} only.`}[h],N=async()=>{w(!0),j(null);const L=h==="url",q={};for(const B of g.split(`
+`)){const I=B.indexOf(L?":":"=");if(I<0)continue;const U=B.slice(0,I).trim();U&&(q[U]=B.slice(I+1).trim())}try{const B=h==="config"?await t.importConnectors(v):[await t.addConnector({name:r,command:L?null:p,url:L?p:null,env:L?{}:q,headers:L?q:{}})];for(const I of B)Ga(I)&&await t.signIn(I.id);s()}catch(B){j(tt(B))}w(!1)};return o.jsxs("div",{style:Rp,children:[o.jsx(ut,{title:"Custom connector",trailing:S?o.jsx($e,{}):o.jsx(be,{title:"Add",icon:"plus",disabled:!E,onClick:()=>{N()}})}),o.jsxs(ui,{children:[o.jsxs(ke,{footer:A,children:[o.jsx(Y8,{selection:h,onChange:u,options:[{id:"command",label:"Command"},{id:"url",label:"URL"},{id:"config",label:"Config"}]}),h==="config"?o.jsx(ti,{value:v,onChange:x,placeholder:'{ "mcpServers": { … } }',lines:[6,16],mono:!0}):null,h!=="config"?o.jsx(ti,{value:r,onChange:l,placeholder:"Name"}):null,h!=="config"?o.jsx(ti,{value:p,onChange:m,placeholder:h==="url"?"https://example.com/mcp":"npx -y @scope/server",mono:!0}):null]}),h==="url"?o.jsx(ke,{title:"Headers",footer:`Optional, one Name: value per line. Leave empty if the service has you sign in. Saved on ${e.hostName} only.`,children:o.jsx(ti,{value:g,onChange:y,placeholder:"Authorization: Bearer …",lines:[2,6],mono:!0})}):h==="command"?o.jsx(ke,{title:"Environment",footer:`One KEY=value per line. Saved on ${e.hostName} only.`,children:o.jsx(ti,{value:g,onChange:y,placeholder:"API_KEY=…",lines:[2,6],mono:!0})}):null,C?o.jsx(ke,{children:o.jsx(Vs,{text:C})}):null]})]})}function b9(){const e=Ae(),t=qr(e),s=Ki(),[r,l]=b.useState(""),[h,u]=b.useState(""),[p,m]=b.useState(""),[g,y]=b.useState(!1),[v,x]=b.useState(null),S=async()=>{y(!0);try{await t.addSkill(r,h,p),s()}catch(w){x(tt(w))}y(!1)};return o.jsxs("div",{style:Rp,children:[o.jsx(ut,{title:"New skill",trailing:g?o.jsx($e,{}):o.jsx(be,{title:"Save",icon:"checkmark",disabled:!r.trim()||!p.trim(),onClick:()=>{S()}})}),o.jsxs(ui,{children:[o.jsxs(ke,{footer:"The bot sees the name and when to use it, and reads the instructions only when a task fits.",children:[o.jsx(ti,{value:r,onChange:l,placeholder:"Name"}),o.jsx(ti,{value:h,onChange:u,placeholder:"When to use it",lines:[2,4]})]}),o.jsx(ke,{title:"Instructions",children:o.jsx(ti,{value:p,onChange:m,placeholder:"Step by step, in plain words…",lines:[6,20]})}),v?o.jsx(ke,{children:o.jsx(Vs,{text:v})}):null]})]})}const f0={...R("caption"),color:"var(--secondary)"};function C9({entry:e}){const t=Ae(),s=e.data.connectionRequest,[r,l]=b.useState(null),[h,u]=b.useState(null),[p,m]=b.useState(""),[g,y]=b.useState(""),[v,x]=b.useState(!1),[S,w]=b.useState(null),C=s.kind==="login",j=s.kind==="secret",E=async()=>{const N=t.client;if(N){x(!0),w(null);try{if(s.kind==="app"&&s.toolkit)l({slug:s.toolkit,name:s.title});else if(C)await Re.finishConnectionRequest(N,e.id,{value:p,username:g}),m("");else if(j)await Re.finishConnectionRequest(N,e.id,{value:p}),m("");else if(s.connectorId){const L=s.connectorId,q=(await Re.connectors(N)).find(B=>B.id===L);q&&Ga(q)&&await hu(t).signIn(L),await Re.finishConnectionRequest(N,e.id,{connectorId:L})}else s.registryName&&u(await Re.connectorInfo(N,s.registryName))}catch(L){w(tt(L))}x(!1)}},A=async()=>{const N=t.client;if(N){x(!0);try{await Re.finishConnectionRequest(N,e.id,{cancel:!0}),m("")}catch(L){w(tt(L))}x(!1)}};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16,background:"var(--surface)",borderRadius:18},children:[o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...R("headline")},children:[o.jsx(se,{name:"lock.shield",size:13}),s.title]}),e.data.text?o.jsx("span",{style:{color:"var(--secondary)"},children:e.data.text}):null,s.status==="pending"?o.jsxs(o.Fragment,{children:[C?o.jsxs(o.Fragment,{children:[o.jsx(ti,{value:g,onChange:y,placeholder:"Username or email"}),o.jsx(ti,{value:p,onChange:m,placeholder:"Password or op:// reference",secret:!0}),o.jsx("span",{style:f0,children:"Saved securely on this computer. The bot types it into the sign-in page but never sees it."})]}):j?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:f0,children:`${s.field??"Credential"} · ${s.location??""}`}),o.jsx(ti,{value:p,onChange:m,placeholder:"Credential or op:// reference",secret:!0}),o.jsx("span",{style:f0,children:"Saved securely on this computer. Never added to the conversation."})]}):null,o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx(Ne,{disabled:v||(j||C)&&!p,onClick:()=>{E()},children:C?"Save login":j?"Save and connect":"Connect"}),o.jsx(Ne,{kind:"secondary",disabled:v,onClick:()=>{A()},children:"Cancel"}),v?o.jsx($e,{}):null]})]}):o.jsx("span",{style:{color:"var(--secondary)"},children:s.status==="ready"?C?"Saved":"Connected":"Cancelled"}),S?o.jsx("span",{style:{...R("footnote"),color:"var(--danger)"},children:S}):null,o.jsx(os,{open:h!==null,onClose:()=>u(null),children:h?o.jsx(fw,{item:h,requestId:e.id,done:()=>u(null)}):null}),o.jsx(os,{open:r!==null,onClose:()=>l(null),children:r?o.jsx(dw,{app:r,requestId:e.id,done:()=>l(null)}):null})]})}function Yh(e,t){return{emoji:_7,chosen:t.data.reactions??[],toggle:s=>e.react(t,s)}}const S2=b.memo(function({entry:t,groupStart:s,chat:r,openTrace:l,openThread:h}){const u=h?()=>h(t):void 0,p=t.data.thread&&t.data.thread.count>0&&h?o.jsx(j9,{summary:t.data.thread,open:()=>h(t)}):null;switch(t.kind){case"user":return o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,paddingTop:s?12:4},children:[o.jsx(E9,{entry:t,botWorking:!!r&&mn(r),reply:u}),o.jsx(b_,{entry:t}),p]});case"agent":return o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,paddingTop:s?12:4},children:[r&&ft(r)&&s?o.jsx(b2,{botId:t.data.author}):null,o.jsx(A9,{entry:t,openTrace:l,reply:u}),o.jsxs("div",{style:{paddingLeft:r&&ft(r)?34:0,display:"flex",flexDirection:"column",gap:4},children:[o.jsx(b_,{entry:t}),p]})]});case"permission":return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingTop:12},children:[r&&ft(r)?o.jsx(b2,{botId:t.data.author}):null,o.jsx(k9,{entry:t})]});default:return t.data.connectionRequest?o.jsx("div",{style:{paddingTop:12},children:o.jsx(C9,{entry:t})}):o.jsx("div",{style:{paddingTop:10},children:o.jsx(T9,{entry:t})})}});function k9({entry:e}){const t=Ae();return o.jsx(p9,{entry:e,hostName:t.hostName,answering:t.answering.get(e.id)??null,respond:s=>t.respond(e,s)})}function b2({botId:e}){const t=Pr(),s=e?t.bots.get(e):void 0;return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s?o.jsx(hi,{bot:s,size:26,animated:!1}):null,o.jsx("span",{style:{...R("subheadline","medium"),color:s?_s(s.avatarColor):"var(--secondary)"},children:t.authorName(e)})]})}function j9({summary:e,open:t}){const s=Pr(),r=e.authors.map(h=>s.bots.get(h)).filter(h=>!!h).slice(0,3),l=e.unread??0;return o.jsxs("button",{className:"press thread-chip",onClick:t,title:"View thread","aria-label":`View thread, ${e.count} ${e.count===1?"reply":"replies"}${l>0?`, ${l} new`:""}`,children:[r.length?o.jsx("span",{style:{display:"flex"},children:r.map((h,u)=>o.jsx("span",{style:{marginLeft:u?-6:0},children:o.jsx(hi,{bot:h,size:18,animated:!1})},h.id))}):null,o.jsx("span",{style:{...R("footnote","semibold"),color:"var(--accent)"},children:e.count===1?"1 reply":`${e.count} replies`}),l>0?o.jsxs("span",{style:{...R("footnote","semibold"),color:"var(--text)"},children:[l," new"]}):o.jsx("span",{style:{...R("footnote"),color:"var(--tertiary)"},children:Mp.day(e.lastAt)}),o.jsx(se,{name:"chevron.right",size:10,color:"var(--tertiary)"})]})}function Lp({className:e,items:t,reactions:s,children:r}){const l=K8();return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:e,onContextMenu:l.onContextMenu,children:r}),o.jsx(Ka,{open:l.open,onClose:l.close,point:l.point,items:t,reactions:s})]})}function pw({date:e}){return o.jsx("div",{style:{...R("footnote"),color:"var(--tertiary)",textAlign:"center",padding:"18px 0 6px"},children:Mp.separator(e)})}const mw=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function E9({entry:e,botWorking:t,reply:s}){const r=Pr(),[l,h]=b.useState(!1),u=e.data.status,p=()=>e.data.text&&window.codync.app.copy(e.data.text);return o.jsx("div",{className:"message user",title:mw.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:o.jsxs("div",{className:"message-body",children:[e.data.attachments?.length?o.jsx(l9,{attachments:e.data.attachments,botId:e.botId}):null,e.data.text?o.jsx(Lp,{className:"bubble user selectable",reactions:Yh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:p},...s?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:s}]:[]],children:e.data.text}):null,u&&u!=="sent"?o.jsx(M9,{entry:e,botWorking:t,hovering:l}):null,o.jsx(vw,{className:"leading",visible:l,reactions:Yh(r,e),reply:s,copy:p})]})})}function M9({entry:e,botWorking:t,hovering:s}){const r=Pr(),l={...R("caption2"),color:"var(--tertiary)"};switch(e.data.status){case"sending":return o.jsx("span",{style:l,children:"Sending…"});case"queued":return o.jsx("span",{style:l,children:t?"Queued until this response finishes":"Queued"});case"failed":return o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10,...R("caption2","semibold")},children:[o.jsx("span",{style:{color:"var(--danger)"},children:"Failed to send"}),o.jsx("button",{title:"Resend","aria-label":"Resend",style:{display:"flex"},onClick:()=>r.retry(e),children:o.jsx(se,{name:"arrow.clockwise",size:10,weight:"semibold"})}),o.jsx("button",{title:"Delete","aria-label":"Delete",style:{display:"flex"},onClick:()=>r.discard(e),children:o.jsx(se,{name:"trash",size:10,weight:"semibold"})})]});case"cancelled":return o.jsx("span",{style:l,children:"Not sent — stopped"});default:return o.jsx("span",{style:{...R(10),color:"var(--tertiary)",opacity:s?1:0,transition:"opacity var(--hover)"},children:Mp.time(e.createdAt)})}}function A9({entry:e,openTrace:t,reply:s}){const r=Pr(),[l,h]=b.useState(!1),u=()=>e.data.text&&window.codync.app.copy(e.data.text);return o.jsx("div",{className:"message agent",title:mw.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:o.jsxs("div",{className:"message-body",children:[o.jsx(Lp,{className:e.data.files?.length?"file-message":"bubble agent",reactions:Yh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:u},...s?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:s}]:[],{title:"Show what it did",icon:"list.bullet",action:t}],children:e.data.files?.length?o.jsx("div",{style:{display:"grid",gap:6},children:e.data.files.map(p=>o.jsx(o9,{entry:e,file:p},p.id))}):o.jsx(ou,{text:e.data.text??""})}),o.jsx(vw,{className:"trailing",visible:l,reactions:Yh(r,e),reply:s,trace:t,copy:u})]})})}function T9({entry:e}){const t=e.data.text??"";if(e.data.callSeconds!==void 0){const s=e.data.callSeconds;return o.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:6,...R("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--secondary)"},children:[o.jsx(se,{name:"waveform",size:10}),`${t} · ${String(Math.floor(s/60)).padStart(2,"0")}:${String(s%60).padStart(2,"0")}`]})}switch(e.data.style){case"divider":return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 0"},children:[o.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}}),o.jsx("span",{style:{...R("caption2"),color:"var(--tertiary)",textAlign:"center",maxWidth:260},children:t}),o.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]});case"error":return o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:12,borderRadius:12,background:"color-mix(in srgb, var(--danger) 12%, transparent)"},children:[o.jsx(se,{name:"exclamationmark.triangle.fill",size:10,color:"var(--danger)"}),o.jsx("span",{className:"selectable",style:{...R("footnote"),color:"var(--text)"},children:t})]});default:return o.jsx("div",{style:{...R("footnote"),color:"var(--secondary)",textAlign:"center"},children:t})}}function gw({bot:e,thinking:t}){const[s,r]=b.useState(!1),l=pn(e);return o.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,paddingRight:40},children:o.jsxs("button",{className:"working",disabled:!t,onClick:()=>r(h=>!h),"aria-expanded":t?s:void 0,children:[o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx(xs,{state:l?"listening":"working",size:16,color:l?"var(--warning)":"var(--secondary)"}),o.jsx("span",{style:{...R("subheadline"),color:l?"var(--warning)":"var(--secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.activity||"Working…"}),e.startedAt?o.jsx(N9,{since:e.startedAt}):null,t?o.jsx("span",{style:{display:"flex",transform:`rotate(${s?180:0}deg)`,transition:"transform var(--layout)"},children:o.jsx(se,{name:"chevron.down",size:10,weight:"semibold",color:"var(--tertiary)"})}):null]}),s&&t?o.jsx("div",{className:"selectable thinking",style:{...R("footnote"),color:"var(--secondary)"},ref:h=>{h&&(h.scrollTop=h.scrollHeight)},children:t}):null]})})}function N9({since:e}){const[t,s]=b.useState(Date.now());b.useEffect(()=>{const p=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(p)},[]);const r=Math.max(0,Math.floor((t-e)/1e3)),l=Math.floor(r/3600),h=Math.floor(r%3600/60),u=String(r%60).padStart(2,"0");return o.jsx("span",{style:{...R("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--tertiary)"},children:l?`${l}:${String(h).padStart(2,"0")}:${u}`:`${h}:${u}`})}function b_({entry:e}){const t=Pr(),s=e.data.reactions;return s?.length?o.jsx("div",{style:{display:"flex",gap:4},children:s.map(r=>o.jsx("button",{className:"press reaction-chip",title:`Remove ${r}`,"aria-label":`Remove reaction ${r}`,onClick:()=>t.react(e,r),children:o.jsx("span",{style:{fontSize:au(13)},children:r})},r))}):null}function vw({visible:e,className:t,reactions:s,reply:r,trace:l,copy:h}){const[u,p]=b.useState(null),m=b.useRef(null),g=b.useRef(null),y=e||u!==null;return o.jsxs("div",{className:`message-actions ${t}`,style:{opacity:y?1:0,pointerEvents:y?"auto":"none"},"aria-hidden":!y,children:[o.jsx("button",{ref:m,className:"message-action",title:"Add reaction","aria-label":"Add reaction",onClick:()=>p("reactions"),children:o.jsx(se,{name:"face.smiling",size:14})}),r?o.jsx(be,{title:"Reply in thread",icon:"arrowshape.turn.up.left",size:26,onClick:r}):null,o.jsx("button",{ref:g,className:"message-action",title:"More message actions","aria-label":"More message actions",onClick:()=>p("more"),children:o.jsx(se,{name:"ellipsis",size:14})}),o.jsx(Ka,{open:u==="reactions",onClose:()=>p(null),anchor:m,items:()=>[],reactions:s}),o.jsx(Ka,{open:u==="more",onClose:()=>p(null),anchor:g,items:()=>[{title:"Copy",icon:"square.on.square",action:h},...l?[{title:"Show what it did",icon:"list.bullet",action:l}]:[]]})]})}function D9({exchanges:e,open:t}){const s=Ae(),{peerId:r,count:l,failed:h}=s9(e),u=s.bots.get(r),p=s.authorName(r),m=l>1?`${l} messages with`:t9(e[0]);return o.jsxs("button",{className:"press bot-message-row",onClick:()=>t(r),title:"Open conversation","aria-label":`${m} ${p}${h?", failed":""}`,style:{...R("footnote"),color:h?"var(--danger)":"var(--secondary)"},children:[h?o.jsx(se,{name:"exclamationmark.triangle.fill",size:10,color:"var(--danger)"}):null,o.jsx("span",{children:m}),u?o.jsx(hi,{bot:u,size:18,animated:!1}):null,o.jsx("span",{style:{...R("footnote","semibold"),color:h?"var(--danger)":"var(--text)"},children:p}),o.jsx(se,{name:"chevron.right",size:10,color:"var(--tertiary)"})]})}function R9({botId:e,peerId:t}){const s=Ae(),r=l=>o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[s.bots.get(l)?o.jsx(hi,{bot:s.bots.get(l),size:20,animated:!1}):null,o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:s.authorName(l)})]});return o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},"aria-label":`${s.authorName(e)} and ${s.authorName(t)}`,children:[r(e),o.jsx(se,{name:"arrow.left.arrow.right",size:11,color:"var(--tertiary)"}),r(t)]})}function L9({botId:e,peerId:t}){const s=Ae(),[r,l]=b.useState(null),[h,u]=b.useState(null),p=b.useRef(null),m=r9(n9(r??[],s.chat(e),t));return b.useEffect(()=>{let g=!0;return s.botConversation(e,t).then(y=>{g&&l(y)},y=>{console.warn("botConversation failed",y),g&&(l([]),u(y instanceof Error?y.message:String(y)))}),()=>{g=!1}},[s,e,t]),b.useEffect(()=>{const g=p.current;g&&(g.scrollTop=g.scrollHeight)},[m.length,m[m.length-1]?.id]),o.jsxs("div",{className:"bot-conversation",children:[o.jsx(ut,{title:o.jsx(R9,{botId:e,peerId:t})}),o.jsx("div",{className:"bot-conversation-scroll",ref:p,children:o.jsxs("div",{className:"bot-conversation-rows",children:[h?o.jsx("div",{style:{...R("footnote"),color:"var(--danger)",textAlign:"center",paddingTop:24},children:h}):null,!h&&r&&m.length===0?o.jsx("div",{style:{...R("footnote"),color:"var(--tertiary)",textAlign:"center",paddingTop:24},children:"No messages yet."}):null,m.map(g=>o.jsx(B9,{row:g},g.id))]})})]})}function B9({row:e}){const t=Ae();switch(e.kind){case"separator":return o.jsx(pw,{date:e.at});case"message":return o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,paddingTop:e.showsAuthor?12:4},children:[e.showsAuthor?o.jsx(b2,{botId:e.author}):null,o.jsx("div",{className:"message agent",children:o.jsx("div",{className:"message-body",children:o.jsx(Lp,{className:"bubble agent selectable",items:()=>[{title:"Copy",icon:"square.on.square",action:()=>window.codync.app.copy(e.text)}],children:o.jsx(ou,{text:e.text})})})})]});case"status":{const s=e.outcome.kind==="failed",r=e.outcome.kind==="failed"?e.outcome.detail||"Didn't complete.":`Waiting for ${t.authorName(e.awaiting)}…`;return o.jsx("div",{className:"selectable",style:{...R("footnote"),color:s?"var(--danger)":"var(--secondary)",padding:"6px 12px"},children:r})}}}function O9(e){return e.key!=="Enter"||e.isComposing||e.keyCode===229?"ignore":e.shiftKey||e.altKey?"newline":e.repeat?"ignore":"send"}function z9({file:e,remove:t}){const[s,r]=b.useState(null),[l,h]=b.useState(!1);return b.useEffect(()=>{if(!Cx(e.name))return;const u=URL.createObjectURL(new Blob([e.data]));return r(u),()=>URL.revokeObjectURL(u)},[e]),s&&!l?o.jsxs("span",{className:"attachment-tile","aria-label":`Image attachment: ${e.name}`,title:e.name,children:[o.jsx("img",{src:s,alt:"",onError:()=>h(!0)}),o.jsx("button",{className:"press attachment-remove","aria-label":`Remove ${e.name}`,title:"Remove",onClick:t,children:o.jsx(se,{name:"xmark",size:11,weight:"bold",color:"#fff"})})]}):o.jsxs("span",{className:"file-chip",children:[o.jsx(se,{name:Ap(e.name),size:10,color:"var(--secondary)"}),o.jsx("span",{style:{...R("footnote"),color:"var(--text)",maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),o.jsx("button",{"aria-label":`Remove ${e.name}`,title:"Remove",style:{display:"flex"},onClick:t,children:o.jsx(se,{name:"xmark",size:10,weight:"bold",color:"var(--secondary)"})})]})}const yw="2.14.1";function H9(e){return/^\/\S*$/.test(e)?e.slice(1):null}function I9(e,t,s){const r=s.toLowerCase();return e.filter(l=>t.includes(l.id)&&(l.id.includes(r)||l.name.toLowerCase().includes(r)))}function _w({botId:e,thread:t=null,onCall:s,onInterrupt:r}){const l=Ae();return o.jsx(U9,{botId:e,thread:t,onCall:s,onInterrupt:r},JSON.stringify([l.contextId,l.computer.id,e,t]))}function U9({botId:e,thread:t,onCall:s,onInterrupt:r}){const l=Ae(),h=di(hu(l)),u=l.bots.get(e)??null,p=l.composerDrafts,m=b.useSyncExternalStore(p.subscribe,()=>p.get(e,t)),g=Y=>p.set(e,t,Y),[y,v]=b.useState([]),x=b.useRef(null),S=b.useRef(null),w=b.useRef(!1),C=!!u&&pp(u,e,t),E=!(!m.trim()&&!y.length)&&(l.connection.kind==="online"||l.canQueue&&!y.length),A=!!u,N=t?"Reply…":u&&ft(u)?"Message everyone · @ to ask one bot":C?`Queue a message for ${u?.name??""}`:`Ask ${u?.name??""}`,L=l.routineDrafts.get(e);b.useEffect(()=>{if(t||L===void 0)return;const Y=l.consumeRoutineDraft(e);if(Y===void 0)return;const oe=p.get(e,t);p.set(e,t,oe?`${oe}
+${Y}`:Y),x.current?.focus()},[L,t,e,l,p]),b.useLayoutEffect(()=>{const Y=x.current,oe=S.current;if(!Y||!oe)return;const xe=()=>{const D=getComputedStyle(Y),J=parseFloat(D.lineHeight),le=parseFloat(D.paddingTop)+parseFloat(D.paddingBottom),he=Math.min(oe.getBoundingClientRect().height,J*8+le);Y.style.height=`${he}px`};xe();const we=new ResizeObserver(xe);return we.observe(oe),()=>we.disconnect()},[]);const q=(()=>{if(!u||!ft(u))return null;const Y=m.lastIndexOf("@");if(Y<0||Y>0&&!/\s/.test(m[Y-1]))return null;const oe=m.slice(Y+1);return/\n/.test(oe)||oe.length>24?null:oe})(),B=q!==null&&u?l.members(u).filter(Y=>!q||Y.name.toLowerCase().includes(q.toLowerCase())):[],I=Y=>{const oe=m.lastIndexOf("@");oe<0||(g(`${m.slice(0,oe)}@${Y.name} `),x.current?.focus())},U=!!u&&!ft(u)&&!ko(l.hello?.version??"",yw),P=U?H9(m):null,F=P===null||!u?[]:I9(h.installedSkills,u.skills,P),$=Y=>{g(`/${Y} `),x.current?.focus()},z=Y=>{if(!A)return;const oe=[];for(const xe of Y){if(xe.data.length>y7){l.setError(`${xe.name} is larger than 100 MB.`);continue}oe.push({id:crypto.randomUUID(),name:xe.name,data:xe.data})}v(xe=>[...xe,...oe])},O=()=>{E&&(l.send(m,e,t,y),g(""),v([]),x.current?.focus())},M=r&&!m&&!y.length?"interrupt":C&&!m&&!y.length?"stop":s&&!m&&!y.length?"call":"send",[X,V]={interrupt:["stop.fill","Interrupt"],stop:["stop.fill","Stop"],call:["waveform","Call"],send:["arrow.up","Send"]}[M],ie=M==="interrupt"?"var(--danger)":M==="send"?E?"var(--accent-fill)":"var(--accent-dim)":"var(--accent-fill)",ee=M==="interrupt"?"#fff":M==="send"?E?"var(--on-accent)":"var(--tertiary)":"var(--on-accent)",ce=M!=="send"||E;return o.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[o.jsx(C_,{open:B.length>0||F.length>0,children:o.jsxs("div",{className:"mentions",children:[B.map(Y=>o.jsxs("button",{className:"press mention",onClick:()=>I(Y),children:[o.jsx(hi,{bot:Y,size:18,animated:!1}),o.jsx("span",{style:{...R("subheadline"),color:"var(--text)"},children:Y.name})]},Y.id)),F.map(Y=>o.jsxs("button",{className:"press mention",title:Y.description||Y.name,onClick:()=>$(Y.id),children:[o.jsx(se,{name:"book.pages",size:12,color:"var(--secondary)"}),o.jsx("span",{style:{...R("subheadline"),color:"var(--text)"},children:Y.name})]},Y.id))]})}),o.jsx("div",{className:"composer",onDragOver:Y=>{A&&Y.dataTransfer.types.includes("Files")&&Y.preventDefault()},onDrop:Y=>{A&&(Y.preventDefault(),Promise.all([...Y.dataTransfer.files].map(async oe=>({name:oe.name,data:new Uint8Array(await oe.arrayBuffer())}))).then(z))},children:o.jsxs("div",{className:"composer-surface",children:[o.jsx(C_,{open:y.length>0,children:o.jsx("div",{className:"file-chips",children:y.map(Y=>o.jsx(z9,{file:Y,remove:()=>v(oe=>oe.filter(xe=>xe.id!==Y.id))},Y.id))})}),o.jsxs("div",{className:"composer-box",children:[A?o.jsx("button",{className:"press composer-add","aria-label":"Add files",title:"Add files",onClick:()=>{window.codync.app.pickFiles().then(z)},children:o.jsx(se,{name:"plus",size:13,weight:"medium",color:"var(--text)"})}):null,o.jsxs("div",{className:"composer-field",children:[o.jsx("div",{ref:S,className:"composer-measure","aria-hidden":"true",children:m+"​"}),o.jsx("textarea",{ref:x,rows:1,value:m,placeholder:N,spellCheck:!0,"aria-label":t?"Reply":"Message","aria-keyshortcuts":"Enter Shift+Enter",onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onChange:Y=>{g(Y.target.value),U&&Y.target.value==="/"&&h.refresh()},onKeyDown:Y=>{const oe=O9({key:Y.key,shiftKey:Y.shiftKey,altKey:Y.altKey,repeat:Y.repeat,isComposing:w.current||Y.nativeEvent.isComposing,keyCode:Y.keyCode});Y.key==="Enter"&&Y.repeat&&!Y.shiftKey&&!Y.altKey&&Y.preventDefault(),oe==="send"&&(Y.preventDefault(),O())},onPaste:Y=>{if(!A)return;const oe=[...Y.clipboardData.types];!oe.includes("Files")||oe.includes("text/plain")&&!Y.clipboardData.files.length||(Y.preventDefault(),window.codync.app.readClipboardFiles().then(we=>we.length?z(we):Promise.all([...Y.clipboardData.files].map(async D=>({name:D.name||`pasted-${Date.now()}.png`,data:new Uint8Array(await D.arrayBuffer())}))).then(z)))}})]}),o.jsx("button",{className:"press composer-send",disabled:!ce,"aria-label":V,title:V,style:{background:ie,color:ee},onClick:()=>{M==="interrupt"?r?.():M==="stop"?l.stop(e):M==="call"?s?.():O()},children:["stop.fill","waveform","arrow.up"].map(Y=>o.jsx("span",{"aria-hidden":"true",className:`composer-symbol ${Y===X?"active":""}`,children:o.jsx(se,{name:Y,size:Y==="stop.fill"?12:Y==="waveform"?15:14,weight:"bold"})},Y))})]})]})})]})}function C_({open:e,children:t}){const{mounted:s,shown:r}=Ps(e),l=b.useRef(t);return e&&(l.current=t),o.jsx("div",{className:`composer-reveal ${r?"shown":""}`,inert:!e,children:o.jsx("div",{children:s?e?t:l.current:null})})}function P9({open:e,width:t,children:s}){const{mounted:r,shown:l}=Ps(e,300,!1),h=b.useRef({width:t,children:s});e&&(h.current={width:t,children:s});const u=e?{width:t,children:s}:h.current;return o.jsx("div",{className:`side-panel ${l?"shown":""}`,inert:!e,style:{width:l?u.width+1:0},children:r?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"side-panel-border"}),o.jsx("div",{style:{width:u.width,height:"100%",flex:"none"},children:u.children})]}):null})}const q9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3ccircle%20cx='8'%20cy='8'%20r='7'%20stroke='currentColor'%20stroke-width='1.5'/%3e%3cpath%20d='M5.5%2010.5L8%204L10.5%2010.5'%20stroke='currentColor'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='6.25'%20y1='8.75'%20x2='9.75'%20y2='8.75'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'/%3e%3c/svg%3e",V9="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.9197%2013.61L17.3816%2026.566L14.242%2027.4049L11.2645%2016.2643L0.119926%2013.2906L0.957817%2010.15L13.9197%2013.61Z'%20fill='currentColor'/%3e%3cpath%20d='M13.7391%2016.0892L4.88169%2024.9056L2.58872%2022.6019L11.4461%2013.7865L13.7391%2016.0892Z'%20fill='currentColor'/%3e%3cpath%20d='M18.9386%208.58315L22.4005%2021.5392L19.2609%2022.3781L16.2833%2011.2374L5.13879%208.26381L5.97668%205.12318L18.9386%208.58315Z'%20fill='currentColor'/%3e%3cpath%20d='M23.9803%203.55632L27.4422%2016.5124L24.3025%2017.3512L21.325%206.21062L10.1805%203.23698L11.0183%200.0963593L23.9803%203.55632Z'%20fill='currentColor'/%3e%3c/svg%3e",$9="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.1452%2014.6818C14.9937%2015.3182%2016.2664%2014.894%2015.0997%2013.7273C11.5998%2010.3333%2012.3421%201%207.99366%201C3.64518%201%204.3876%2010.3333%200.887603%2013.7273C-0.385123%2015%200.993664%2015.3182%201.84215%2014.6818C5.13002%2012.4545%204.9179%208.5303%207.99366%208.5303C11.0694%208.5303%2010.8573%2012.4545%2014.1452%2014.6818Z'%20fill='currentColor'/%3e%3c/svg%3e",W9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M9.972%2013.193h2.577q.187%200%20.277-.09t.091-.294V10.47q0-.324.133-.59.135-.27.36-.424a1%201%200%200%201%20.099-.06%201%201%200%200%201-.1-.058%201.1%201.1%200%200%201-.359-.424%201.3%201.3%200%200%201-.133-.59v-2.33q0-.202-.091-.293t-.277-.089H9.972a.38.38%200%200%201-.294-.124.4.4%200%200%201-.108-.281q.002-.176.131-.293a.46.46%200%200%201%20.313-.111h2.775c.36%200%20.642.097.836.288q.293.29.294.832V8.24q0%20.39.152.562.148.168.555.178a.4.4%200%200%201%20.27.128.41.41%200%200%201%20.104.287.44.44%200%200%201-.1.282.34.34%200%200%201-.277.132c-.266.006-.452.066-.55.177q-.151.174-.152.573v2.318c0%20.235-.043.44-.128.607a.85.85%200%200%201-.389.387%201.3%201.3%200%200%201-.534.124V14h-2.854a.45.45%200%200%201-.315-.118.38.38%200%200%201-.129-.286q0-.164.109-.282a.38.38%200%200%201%20.293-.123zM1.103%209.108a.4.4%200%200%201%20.276-.128q.4-.008.55-.177.15-.173.151-.562V5.923q.002-.543.294-.832c.195-.191.477-.288.836-.288h2.775q.188%200%20.313.111a.37.37%200%200%201%20.131.293.4.4%200%200%201-.108.281.38.38%200%200%201-.293.123H3.45q-.186%200-.277.09t-.092.292v2.33c0%20.213-.044.413-.133.59a1.1%201.1%200%200%201-.359.424%201%201%200%200%201-.1.059%201%201%200%200%201%20.1.059q.225.156.359.423t.133.59v2.34q0%20.203.092.293.088.09.277.089h2.577a.38.38%200%200%201%20.294.123q.108.12.108.281a.38.38%200%200%201-.13.286.45.45%200%200%201-.314.118l-2.775-.003a1.4%201.4%200%200%201-.613-.126.87.87%200%200%201-.388-.387%201.34%201.34%200%200%201-.129-.608v-2.318q0-.4-.151-.572-.151-.168-.55-.177a.35.35%200%200%201-.278-.132.42.42%200%200%201-.102-.28q0-.173.103-.287'/%3e%3cpath%20fill='currentColor'%20d='M5.437%2010.36a.986.986%200%200%201-.994-.975c0-.538.446-.976.994-.976s.994.438.994.976a.986.986%200%200%201-.994.976M10.562%208.41c.548%200%20.994.437.994.975a.986.986%200%200%201-.994.976.986.986%200%200%201-.994-.976c0-.538.446-.976.994-.976M8.74%202c.37%200%20.446.15.446.275v.034q0%20.034-.009.201-.01.162-.017.549-.018.378-.044%201.06c0%20.106-.065.233-.375.233-.311%200-.376-.126-.376-.23l-.07-1.835v-.003c0-.13.078-.284.446-.284M7.256%202c.369%200%20.446.15.446.275v.034q0%20.034-.01.201-.007.162-.017.549-.017.378-.043%201.06c0%20.106-.065.233-.376.233-.31%200-.375-.126-.375-.23l-.07-1.835v-.003C6.81%202.154%206.887%202%207.256%202'/%3e%3c/svg%3e",F9="/demo/desktop/assets/autohand-bkvwPcbN.svg",K9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%201200%201200'%3e%3cpath%20fill='currentColor'%20d='M%20233.959793%20800.214905%20L%20468.644287%20668.536987%20L%20472.590637%20657.100647%20L%20468.644287%20650.738403%20L%20457.208069%20650.738403%20L%20417.986633%20648.322144%20L%20283.892639%20644.69812%20L%20167.597321%20639.865845%20L%2054.926208%20633.825623%20L%2026.577238%20627.785339%20L%203.3e-05%20592.751709%20L%202.73832%20575.27533%20L%2026.577238%20559.248352%20L%2060.724873%20562.228149%20L%20136.187973%20567.382629%20L%20249.422867%20575.194763%20L%20331.570496%20580.026978%20L%20453.261841%20592.671082%20L%20472.590637%20592.671082%20L%20475.328857%20584.859009%20L%20468.724915%20580.026978%20L%20463.570557%20575.194763%20L%20346.389313%20495.785217%20L%20219.543671%20411.865906%20L%20153.100723%20363.543762%20L%20117.181267%20339.060425%20L%2099.060455%20316.107361%20L%2091.248367%20266.01355%20L%20123.865784%20230.093994%20L%20167.677887%20233.073853%20L%20178.872513%20236.053772%20L%20223.248367%20270.201477%20L%20318.040283%20343.570496%20L%20441.825592%20434.738342%20L%20459.946411%20449.798706%20L%20467.194672%20444.64447%20L%20468.080597%20441.020203%20L%20459.946411%20427.409485%20L%20392.617493%20305.718323%20L%20320.778564%20181.932983%20L%20288.80542%20130.630859%20L%20280.348999%2099.865845%20C%20277.369171%2087.221436%20275.194641%2076.590698%20275.194641%2063.624268%20L%20312.322174%2013.20813%20L%20332.8591%206.604126%20L%20382.389313%2013.20813%20L%20403.248352%2031.328979%20L%20434.013519%20101.71814%20L%20483.865753%20212.537048%20L%20561.181274%20363.221497%20L%20583.812134%20407.919434%20L%20595.892639%20449.315491%20L%20600.40271%20461.959839%20L%20608.214783%20461.959839%20L%20608.214783%20454.711609%20L%20614.577271%20369.825623%20L%20626.335632%20265.61084%20L%20637.771851%20131.516846%20L%20641.718201%2093.745117%20L%20660.402832%2048.483276%20L%20697.530334%2024.000122%20L%20726.52356%2037.852417%20L%20750.362549%2072%20L%20747.060486%2094.067139%20L%20732.886047%20186.201416%20L%20705.100708%20330.52356%20L%20686.979919%20427.167847%20L%20697.530334%20427.167847%20L%20709.61084%20415.087341%20L%20758.496704%20350.174561%20L%20840.644348%20247.490051%20L%20876.885925%20206.738342%20L%20919.167847%20161.71814%20L%20946.308838%20140.29541%20L%20997.61084%20140.29541%20L%201035.38269%20196.429626%20L%201018.469849%20254.416199%20L%20965.637634%20321.422852%20L%20921.825562%20378.201538%20L%20859.006714%20462.765259%20L%20819.785278%20530.41626%20L%20823.409424%20535.812073%20L%20832.75177%20534.92627%20L%20974.657776%20504.724915%20L%201051.328979%20490.872559%20L%201142.818848%20475.167786%20L%201184.214844%20494.496582%20L%201188.724854%20514.147644%20L%201172.456421%20554.335693%20L%201074.604126%20578.496765%20L%20959.838989%20601.449829%20L%20788.939636%20641.879272%20L%20786.845764%20643.409485%20L%20789.261841%20646.389343%20L%20866.255127%20653.637634%20L%20899.194702%20655.409424%20L%20979.812134%20655.409424%20L%201129.932861%20666.604187%20L%201169.154419%20692.537109%20L%201192.671265%20724.268677%20L%201188.724854%20748.429688%20L%201128.322144%20779.194641%20L%201046.818848%20759.865845%20L%20856.590759%20714.604126%20L%20791.355774%20698.335754%20L%20782.335693%20698.335754%20L%20782.335693%20703.731567%20L%20836.69812%20756.885986%20L%20936.322205%20846.845581%20L%201061.073975%20962.81897%20L%201067.436279%20991.490112%20L%201051.409424%201014.120911%20L%201034.496704%201011.704712%20L%20924.885986%20929.234924%20L%20882.604126%20892.107544%20L%20786.845764%20811.48999%20L%20780.483276%20811.48999%20L%20780.483276%20819.946289%20L%20802.550415%20852.241699%20L%20919.087341%201027.409424%20L%20925.127625%201081.127686%20L%20916.671204%201098.604126%20L%20886.469849%201109.154419%20L%20853.288696%201103.114136%20L%20785.073914%201007.355835%20L%20714.684631%20899.516785%20L%20657.906067%20802.872498%20L%20650.979858%20806.81897%20L%20617.476624%201167.704834%20L%20601.771851%201186.147705%20L%20565.530212%201200%20L%20535.328857%201177.046997%20L%20519.302124%201139.919556%20L%20535.328857%201066.550537%20L%20554.657776%20970.792053%20L%20570.362488%20894.68457%20L%20584.536926%20800.134277%20L%20592.993347%20768.724976%20L%20592.429626%20766.630859%20L%20585.503479%20767.516968%20L%20514.22821%20865.369263%20L%20405.825531%201011.865906%20L%20320.053711%201103.677979%20L%20299.516815%201111.812256%20L%20263.919525%201093.369263%20L%20267.221497%201060.429688%20L%20287.114136%201031.114136%20L%20405.825531%20880.107361%20L%20477.422913%20786.52356%20L%20523.651062%20732.483276%20L%20523.328918%20724.671265%20L%20520.590698%20724.671265%20L%20205.288605%20929.395935%20L%20149.154434%20936.644409%20L%20124.993355%20914.01355%20L%20127.973183%20876.885986%20L%20139.409409%20864.80542%20L%20234.201385%20799.570435%20L%20233.879227%20799.8927%20Z'/%3e%3c/svg%3e",Y9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2092%2096'%20fill='currentColor'%3e%3cpath%20d='M65.45%2016.3c10.89%200%2019.71%208.86%2019.71%2019.8v6.6l5.74%2011.46a4.48%204.48%200%200%201-.01%203.6L85.16%2069.1v6.6c0%2010.94-8.83%2019.8-19.71%2019.8H26.02c-10.89%200-19.71-8.86-19.71-19.8v-6.6L.45%2057.8a4.48%204.48%200%200%201-.01-3.67L6.31%2042.7v-6.6c0-10.94%208.83-19.8%2019.71-19.8h39.43zm-2.52%205.7H29.19c-9.32%200-16.87%207.56-16.87%2016.88v5.62l-4.88%209.46a4.48%204.48%200%200%200%20.01%203.68l4.87%209.36v5.62c0%209.32%207.55%2016.88%2016.87%2016.88h33.74c9.32%200%2016.87-7.55%2016.87-16.88V67l4.77-9.39a4.48%204.48%200%200%200%200-3.61L79.8%2044.5v-5.62C79.8%2029.56%2072.25%2022%2062.93%2022z'%20fill-rule='nonzero'/%3e%3ccircle%20cx='45.73'%20cy='11'%20r='11'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='31'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='55'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3c/svg%3e",G9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M12.13%201.25c.15-.14.16-.14.28-.15.18%200%20.36.08.64.34.68.62%201.61%201.89%202.2%202.97l.22.42.32.16c.3.16.81.48%201.02.65.09.08.11.08.21.04.45-.18%201.09.05%201.65.6.51.49%201%201.33%201.18%202.03.03.11.06.36.07.54.04.64-.16%201.14-.55%201.37-.08.04-.08.06-.08.26.02.95-.23%201.89-.74%202.82-.58%201.04-1.6%202.11-2.98%203.12-.74.55-2.5%201.58-3.3%201.95-1.9.86-3.43%201.2-4.76%201.03-.79-.09-1.69-.41-2.22-.77-.14-.1-.16-.1-.27-.07-.57.16-1.31-.18-1.94-.88-.25-.28-.66-.98-.79-1.35-.3-.87-.25-1.65.16-2.12.11-.12.09-.33.09-.33-.04-.33-.05-.82-.04-1.14v-.3l-.43-.79c-.68-1.23-1.12-2.25-1.28-3.04-.09-.43-.09-.62.02-.77.07-.09.28-.18.54-.22.66-.12%202.09-.01%203.69.27l.16.03.36-.32c.61-.54%201.01-.84%201.75-1.31.77-.48%201.64-.89%202.62-1.2l.32-.1.17-.46c.62-1.65%201.25-2.86%201.71-3.27h0Zm-5.19%208.45c-.7.41-1.05.61-1.3.84-1.04.93-1.43%202.39-.99%203.71.11.33.31.68.71%201.39.41.71.61%201.06.83%201.32.92%201.05%202.37%201.45%203.68%201%20.32-.11.68-.31%201.38-.72l4.02-2.34c.7-.41%201.05-.61%201.3-.84%201.04-.93%201.43-2.39.99-3.71-.11-.33-.31-.68-.71-1.39s-.61-1.06-.83-1.32c-.92-1.05-2.37-1.45-3.68-1-.32.11-.67.31-1.38.72l-4.02%202.34Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M8.02%2012.13c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.88-.29%201.09-.38.22-.86.09-1.09-.29l-.86-1.5c-.22-.38-.09-.87.29-1.09Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M12.31%209.64c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.87-.29%201.09s-.87.09-1.09-.29l-.86-1.5c-.22-.38-.09-.88.29-1.09Z'/%3e%3c/svg%3e",Z9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.676l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v2.999l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e",X9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20362%20362'%20overflow='hidden'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M1562.63,107.07h-4.18v5.15h4.18c1.94,0,3.21-.87,3.21-2.53,0-1.75-1.17-2.62-3.21-2.62ZM1553.3,102.31h9.42c5.15,0,8.55,2.82,8.55,7.19,0,2.72-1.36,4.76-3.4,6.02l3.69,5.34v1.07h-5.34l-3.59-5.15h-4.18v5.15h-5.15v-19.62ZM1579.63,112.51c0-10.49-6.99-18.46-17.68-18.46s-17.49,7.58-17.49,18.46,6.99,18.46,17.49,18.46,17.68-7.97,17.68-18.46ZM1584,112.51c0,12.34-8.26,22.63-22.05,22.63s-21.86-10.39-21.86-22.63,8.16-22.63,21.86-22.63,22.05,10.3,22.05,22.63ZM348.21,156.4l-42.55,24.61,42.55,24.54c10.75,6.22,14.42,19.9,8.21,30.67-6.2,10.7-19.92,14.37-30.63,8.18l-76.21-44c-5.08-2.96-8.61-7.59-10.18-12.8-.74-2.4-1.09-4.87-1-7.31.04-1.76.3-3.53.79-5.29,1.52-5.48,5.1-10.38,10.39-13.46l76.21-43.97c10.71-6.19,24.43-2.51,30.63,8.22,6.22,10.72,2.54,24.41-8.21,30.61ZM307.93,275.68l-76.19-43.94c-4.09-2.38-8.63-3.3-12.99-2.93-11.62.83-20.75,10.53-20.75,22.34v87.98c0,12.4,10,22.45,22.42,22.45s22.45-10.05,22.45-22.45v-49.21l42.66,24.63c10.72,6.23,24.43,2.54,30.61-8.17,6.17-10.74,2.53-24.5-8.21-30.7ZM220.01,189.61l-31.67,31.63c-.91.93-2.65,1.69-3.98,1.69h-9.31c-1.28,0-3.06-.76-3.98-1.69l-31.66-31.63c-.91-.89-1.64-2.68-1.64-3.94v-9.33c0-1.29.73-3.09,1.64-3.99l31.66-31.63c.92-.93,2.7-1.66,3.98-1.66h9.31c1.29,0,3.07.73,3.98,1.66l31.67,31.63c.9.9,1.63,2.7,1.63,3.99v9.33c0,1.26-.73,3.05-1.63,3.94ZM194.7,180.83c0-1.28-.77-3.06-1.68-4l-9.17-9.13c-.9-.9-2.68-1.65-3.96-1.65h-.36c-1.28,0-3.05.75-3.94,1.65l-9.17,9.13c-.92.95-1.62,2.73-1.62,4v.36c0,1.26.7,3.03,1.62,3.95l9.17,9.16c.9.9,2.67,1.65,3.94,1.65h.36c1.28,0,3.06-.75,3.96-1.65l9.17-9.16c.9-.92,1.68-2.68,1.68-3.95v-.36ZM51.48,86.28l76.21,43.99c4.09,2.35,8.64,3.29,13.01,2.93,11.6-.86,20.75-10.58,20.75-22.37V22.84c0-12.37-10.06-22.41-22.42-22.41s-22.45,10.05-22.45,22.41v49.23l-42.7-24.66c-10.71-6.2-24.4-2.53-30.61,8.2-6.19,10.76-2.53,24.47,8.2,30.67ZM218.75,133.19c4.36.36,8.9-.57,12.99-2.93l76.19-43.99c10.74-6.2,14.38-19.91,8.21-30.67-6.18-10.72-19.89-14.4-30.61-8.2l-42.66,24.66V22.84c0-12.37-10.03-22.41-22.45-22.41s-22.42,10.05-22.42,22.41v87.98c0,11.8,9.13,21.51,20.75,22.37ZM140.71,228.8c-4.38-.37-8.92.54-13.01,2.93l-76.21,43.94c-10.72,6.2-14.38,19.96-8.2,30.7,6.22,10.71,19.91,14.4,30.61,8.17l42.7-24.63v49.21c0,12.4,10.03,22.45,22.45,22.45s22.42-10.05,22.42-22.45v-87.98c0-11.81-9.16-21.51-20.75-22.34ZM120.04,187.6c.76-2.4,1.08-4.87,1.02-7.31-.09-1.76-.32-3.53-.82-5.29-1.51-5.48-5.08-10.38-10.44-13.46l-76.15-43.97c-10.75-6.19-24.45-2.51-30.63,8.22-6.23,10.72-2.55,24.41,8.2,30.61l42.55,24.61-42.55,24.54c-10.75,6.22-14.41,19.9-8.2,30.67,6.17,10.7,19.88,14.37,30.63,8.18l76.15-44c5.14-2.96,8.63-7.59,10.23-12.8Z'/%3e%3c/svg%3e",Q9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2012%2012'%3e%3cg%20transform='matrix(0.00160555,0,0,-0.0014599,-0.26812129,11.08482)'%20fill='currentColor'%3e%3cpath%20d='m%20297,6493%20c%20-4,-3%20-7,-1357%20-7,-3008%200,-2390%203,-3005%2012,-3012%2013,-10%201199,-9%201224,1%2011,4%2013,61%2010,295%20-2,159%20-7,294%20-10,299%20-4,7%20-112,11%20-312,11%20-168,0%20-309,3%20-314,6%20-12,7%20-13,4775%20-2,4792%206,10%2085,13%20317,15%20l%20310,3%20v%20600%20l%20-611,3%20c%20-336,1%20-614,-1%20-617,-5%20z'/%3e%3cpath%20d='m%206287,6493%20c%20-4,-3%20-7,-136%20-7,-294%200,-219%203,-290%2013,-296%206,-4%20152,-10%20322,-13%20l%20310,-5%203,-2394%20c%201,-1545%20-1,-2398%20-8,-2405%20-6,-6%20-127,-9%20-316,-7%20-246,2%20-309,0%20-315,-11%20-5,-7%20-9,-145%20-9,-305%20V%20470%20l%2023,-1%20c%20158,-4%201192,-2%201200,3%2014,9%2022,5964%207,6002%20l%20-10,26%20h%20-603%20c%20-332,0%20-607,-3%20-610,-7%20z'/%3e%3cg%20transform='matrix(1.0249,0,0,1.0566,-429.39,51.322)'%3e%3cpath%20d='m%202476.7,5111.6%20c%20-64.95,-6.2305%20-71.077,-28.66%20-73.528,-325.23%20-3.6765,-261.68%204.9018,-351.4%2036.764,-371.34%207.3528,-4.9844%20583.32,-12.461%201276.9,-16.199%20l%201262.2,-6.2306%2073.528,-34.891%20c%20191.17,-90.966%20300.24,-292.84%20284.31,-527.1%20-15.931,-223.05%20-134.8,-392.52%20-314.95,-449.85%20-61.274,-19.938%20-133.58,-21.184%20-727.93,-18.692%20-607.83,3.7384%20-661.75,2.4922%20-682.59,-17.446%20-22.058,-19.938%20-23.284,-43.614%20-23.284,-331.47%200,-190.65%204.9019,-320.25%2012.255,-335.2%2011.029,-21.184%2026.96,-23.676%20123.77,-23.676%20h%20110.29%20l%2066.176,-63.552%20c%2036.764,-34.891%20125,-125.86%20198.53,-201.87%2072.303,-76.013%20322.3,-333.96%20555.14,-571.96%20l%20424.01,-434.89%20519.6,3.7383%20c%20390.93,2.4922%20520.83,7.4767%20520.83,18.692%200,7.4766%20-223.04,249.22%20-496.32,534.58%20-562.49,589.41%20-666.66,701.56%20-660.53,707.79%202.451,2.4922%2052.695,8.7227%20111.52,13.707%20322.3,24.922%20593.13,194.39%20790.43,495.95%20129.9,199.38%20187.5,391.28%20196.08,660.44%208.5783,245.48%20-14.706,368.85%20-116.42,600.63%20-123.77,286.61%20-328.43,492.21%20-596.8,601.87%20-232.84,95.95%20-167.89,92.212%20-1574.7,93.458%20-691.17,1.2462%20-1274.5,1.2462%20-1295.3,-1.2461%20z'/%3e%3cpath%20d='m%202430.1,3942.7%20c%20-24.509,-18.692%20-24.509,-33.645%20-24.509,-1254.8%200,-1163.9%201.2255,-1238.6%2022.058,-1271%20l%2020.833,-33.645%20h%20337%20c%20289.21,0%20338.23,2.4922%20354.16,19.938%2018.382,17.446%2019.608,145.79%2018.382,1267.3%20-1.2255,1115.3%20-2.4509,1251.1%20-19.608,1271%20-18.382,18.692%20-50.244,21.184%20-351.71,21.184%20-276.96,-1.2461%20-335.78,-3.7383%20-356.61,-19.938%20z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",J9="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%20366%20368'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='currentColor'%20d='m%2026,275.93574%20c%200.65,-9.32%208.46,-15.43%2015,-20.96%2015.43,-13.04%2035.67,-21.92%2053,-32.71%2020.67,-12.88%2061.58,-40.31%2080,-55.03%200,0%2021,-18.39%2021,-18.39%200,0%2028,-23.91%2028,-23.91%2010,-8.33%2014.1,-11.65%2025,-18.92%207.42,-4.94%2019.07,-12.550001%2024.52,-19.330001%207.17,-8.93%204.16,-18.82%20-4.53,-25.45%20-5.67,-4.32%20-23.5,-8.94%20-30.99,-10.66%20-3.1,-0.72%20-11.45,-1.57%20-13.38,-3.62%20-3.22,-3.43%201.67,-6.99%204.38,-8.45%206.61,-3.54%2017.51,-5.73%2025,-5.82%200,0%204,0%204,0%2016.51,-0.2%2018.85,-12.47%2040,-11.99%209.26,0.21%2021.16,2.48%2029,7.54%207.87,5.07%2012.2,11.73%2017.05,19.45%206.31,10.05%2012.35,21.16%2014.49,33%201.42,7.88%20-0.45,13.62%20-0.54,21.000001%20-0.28,24.26%206.68,37.92%20-2.44,63%20-5.9,16.24%20-14.87,35.36%20-23.98,50%20-9.34,15%20-20.81,30.64%20-35.58,40.64%200,0%20-16,9.36%20-16,9.36%20-3.3,1.9%20-6.18,2.94%20-6.64,7.04%20-0.68,2.83%20-0.16,7.11%200,9.96%200,0%201.29,8%201.29,8%201.62,5.16%208.51,12.15%2012.35,16%203.36,3.37%206.84,7.82%2012,7.89%204.2,0.06%208.14,-2.87%2012,-4.44%205.24,-2.13%2011.35,-3.55%2017,-3.94%206.33,-0.43%2017.05,1.85%2014,10.49%20-2.84,-3.54%20-6.09,-6.36%20-11,-5.57%20-2.47,0.4%20-10.06,3.6%20-8.09,7.08%201.19,2.08%207.67,3.01%2010.09,3.88%206.26,2.25%2010.83,5.76%2014,11.61%200,0%20-17,-6.33%20-17,-6.33%20-9.74,-2.08%20-18.73,0.62%20-28,3.33%205.49,3.71%208.06,5.51%2012,11%20-8.23,-1.96%20-13.6,-7.46%20-26,-6.96%20-9.64,0.39%20-11.89,4.13%20-27,3.96%20-9.42,-0.11%20-17.78,-4.36%20-27,-3.96%20-9.45,0.41%20-13.16,5.64%20-21,8.96%203.16,-14.88%2019.73,-16%2032,-16%20-7.31,-10.21%20-20.46,-18.11%20-23.28,-26%20-0.7,-1.97%20-0.69,-3.94%20-0.71,-6%200,0%200,-14%200,-14%200.23,-2.35%201.13,-5.62%200,-7.73%20-1.66,-2.77%20-8.94,-4.64%20-12.01,-5.55%20-20.1,-5.96%20-24.58,-0.84%20-43,2.01%200,0%20-14,2.11%20-14,2.11%20-9.78,1.06%20-18.83,0.92%20-28,5.02%200,0%20-15,7.88%20-15,7.88%20-16.76,8.6%20-42.02,22.27%20-59,27.93%20-9.14,3.04%20-16.2,6.24%20-26,6.33%200,0%205,-10%205,-10%20-3.92,0.18%20-15.76,3.08%20-17.92,-0.51%20-2.44,-4.07%205.28,-9.01%207.92,-10.91%200,0%2036,-24.58%2036,-24.58%200,0%20-19,3.25%20-19,3.25%20z%20m%20227,1.75%20c%20-2.98,0.84%20-11.45,3.61%20-12.96,6.27%20-0.95,1.89%20-0.18,5.54%200,7.73%200.04,2.47%20-0.13,4.56%200.61,7%201.52,5.07%2011.84,17.33%2016.35,19.88%203.38,1.91%2015.93,0.11%2020,-0.88%20-4.12,-8.71%20-16.66,-15.05%20-21.99,-24%20-3.43,-5.75%20-0.8,-10.06%20-2.01,-16%20z'%20/%3e%3c/svg%3e",ek="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20466.73%20532.09'%3e%3cpath%20fill='currentColor'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",tk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20128%20128'%3e%3cpath%20fill='currentColor'%20d='M40.1024%2085.0722C47.6207%2077.5537%2051.8469%2067.3453%2051.8469%2056.7136C51.8469%2046.0818%2047.617%2035.8734%2040.1024%2028.355L11.7446%200C4.22995%207.5185%200%2017.7269%200%2028.3586C0%2038.9903%204.22995%2049.1987%2011.7446%2056.7172L40.0987%2085.0722H40.1024Z'/%3e%3cpath%20fill='currentColor'%20d='M99.4385%2087.698C91.9239%2080.1832%2081.7121%2075.9531%2071.0844%2075.9531C60.4566%2075.9531%2050.2448%2080.1832%2042.7266%2087.698L71.0844%20116.057C78.599%20123.571%2088.8107%20127.802%2099.4421%20127.802C110.074%20127.802%20120.282%20123.571%20127.8%20116.057L99.4421%2087.698H99.4385Z'/%3e%3cpath%20fill='currentColor'%20d='M11.8146%20115.987C19.3329%20123.502%2029.541%20127.732%2040.1724%20127.732V87.6289H0.0664062C0.0700559%2098.2606%204.29635%20108.469%2011.8146%20115.987Z'/%3e%3cpath%20fill='currentColor'%20d='M110.387%2045.7684C102.869%2038.2535%2092.6608%2034.0198%2082.0258%2034.0234C71.3943%2034.0234%2061.1863%2038.2535%2053.668%2045.772L82.0258%2074.1306L110.387%2045.7684Z'/%3e%3c/svg%3e",ik="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20263%20300'%3e%3cpath%20fill='currentColor'%20d='M1.84577e-10%20100.797V38.6224C1.88813e-05%2035.8899%201.45777%2033.365%203.82414%2031.9988L57.6539%200.920185C60.0203%20-0.446051%2062.9358%20-0.446051%2065.3022%200.920185L119.132%2031.9988C121.498%2033.3651%20122.956%2035.8899%20122.956%2038.6224V70.375C123.192%2080.9262%20128.769%2091.103%20138.577%2096.7655C148.384%20102.428%20159.986%20102.169%20169.242%2097.0979L196.74%2081.2217C199.107%2079.8554%20202.022%2079.8554%20204.388%2081.2217L258.218%20112.3C260.585%20113.667%20262.042%20116.191%20262.042%20118.924V181.081C262.042%20183.814%20260.585%20186.339%20258.218%20187.705L204.388%20218.783C202.022%20220.15%20199.107%20220.15%20196.74%20218.783L169.464%20203.036C160.173%20197.847%20148.465%20197.536%20138.579%20203.244C128.772%20208.906%20123.195%20219.083%20122.959%20229.634V261.378C122.959%20264.111%20121.501%20266.635%20119.135%20268.002L65.3048%20299.08C62.9384%20300.447%2060.0229%20300.447%2057.6566%20299.08L3.82673%20268.002C1.46036%20266.635%200.00260562%20264.111%200.00260562%20261.378V199.221C0.0026245%20196.488%201.46038%20193.963%203.82675%20192.597L57.6565%20161.519C60.0229%20160.152%2062.9384%20160.152%2065.3048%20161.519L92.8656%20177.431C102.11%20182.467%20113.679%20182.711%20123.463%20177.062C133.349%20171.355%20138.934%20161.06%20139.086%20150.419C138.85%20139.868%20133.274%20128.601%20123.466%20122.938C113.658%20117.276%20102.056%20117.534%2092.8007%20122.606L65.1758%20138.645C62.7991%20140.025%2059.8649%20140.024%2057.4894%20138.642L3.80216%20107.407C1.44816%20106.038%20-1.88809e-05%20103.52%201.84577e-10%20100.797Z'/%3e%3c/svg%3e",sk="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.12109%2011.0078H1.99902V5.49316H3.12109V11.0078ZM3.7041%205.49316C4.91979%205.49316%205.31142%205.57449%205.80762%205.7373C6.50208%205.97365%206.85299%206.40958%206.86133%207.04492V9.45605C6.86125%2010.207%206.37767%2010.6797%205.41016%2010.874C4.95546%2010.9633%204.69632%2011.0078%203.7041%2011.0078V10.6064C4.72131%2010.6064%204.95994%2010.5507%205.34863%2010.4404C5.91072%2010.2671%206.19576%209.93907%206.2041%209.45605V7.04492C6.20402%206.4883%205.83211%206.13886%205.08789%205.99707C4.74057%205.93405%204.58897%205.89978%203.7041%205.89453V5.49316ZM9.16797%205.49316V11.0078H8.0459V5.49316H9.16797ZM14%206.79297V11.0078H12.8779V8.0791L13.8877%206.79297H14ZM14%205.49316V5.7373L11.3594%208.97852H10.7852L9.74219%206.94531V6.07812H9.86719L11.0723%208.33203L13.4258%205.49316H14Z'%20fill='currentColor'/%3e%3c/svg%3e",nk="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJjdXJyZW50Q29sb3IiPgogIDx0ZXh0IHg9IjgiIHk9IjEwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LXNpemU9IjEwLjUiIGZvbnQtZmFtaWx5PSJHZW9yZ2lhLCBzZXJpZiIgZm9udC1zdHlsZT0iaXRhbGljIiBmaWxsPSJjdXJyZW50Q29sb3IiPs60PC90ZXh0PgogIDxsaW5lIHgxPSIxIiB5MT0iMTQiIHgyPSIxNSIgeTI9IjE0IiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLW9wYWNpdHk9IjAuNCIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8bGluZSB4MT0iOCIgeTE9IjE0IiB4Mj0iOCIgeTI9IjEyIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8Y2lyY2xlIGN4PSI4IiBjeT0iMTEuNSIgcj0iMC43IiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+Cg==",rk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20900%20900'%20fill='none'%3e%3cpath%20fill='currentColor'%20d='M622.037%20192.524a10.58%2010.58%200%200%201-4.056-2.001%2010.573%2010.573%200%200%201-3.98-7.89%2010.595%2010.595%200%200%201%20.804-4.452c20.214-49.194%2029.134-88.555%2014.74-105.033-38.123-43.716-191.004%2043.219-239.75%2072.663a10.596%2010.596%200%200%201-10.841.041%2010.576%2010.576%200%200%201-4.396-5.07c-20.491-49.089-42.031-83.233-63.865-84.714-57.871-3.96-104.516%20165.624-118.17%20220.895a10.574%2010.574%200%200%201-1.993%204.057%2010.572%2010.572%200%200%201-7.884%203.977%2010.586%2010.586%200%200%201-4.447-.802c-49.194-20.215-88.572-29.134-105.033-14.74-43.717%2038.123%2043.202%20191.005%2072.644%20239.75a10.553%2010.553%200%200%201%201.454%204.279%2010.573%2010.573%200%200%201-6.481%2010.958c-49.072%2020.491-83.216%2042.031-84.715%2063.864-3.944%2057.871%20165.624%20104.516%20220.913%20118.171a10.566%2010.566%200%200%201%205.658%203.601%2010.57%2010.57%200%200%201%202.355%206.281%2010.58%2010.58%200%200%201-.799%204.442c-20.214%2049.194-29.134%2088.572-14.739%20105.033%2038.121%2043.717%20191.021-43.202%20239.767-72.644a10.566%2010.566%200%200%201%2015.238%205.027c20.489%2049.072%2042.013%2083.216%2063.862%2084.715%2057.871%203.944%20104.516-165.624%20118.153-220.913a10.603%2010.603%200%200%201%209.895-8.021%2010.566%2010.566%200%200%201%204.449.808c49.193%2020.214%2088.553%2029.116%20105.032%2014.738%2043.718-38.121-43.219-191.022-72.663-239.767a10.602%2010.602%200%200%201%201.326-12.655%2010.604%2010.604%200%200%201%203.703-2.582c49.089-20.49%2083.233-42.031%2084.714-63.863%203.96-57.871-165.624-104.516-220.895-118.153Zm-66.394-55.478c11.123%2019.938-46.196%20152.797-88.83%20245.724a8.36%208.36%200%200%201-8.239%204.855%208.374%208.374%200%200%201-7.412-6.043c-17.219-60.42-36.899-131.411-57.957-191.675a10.557%2010.557%200%200%201%204.924-12.759c52.586-28.721%20142.568-66.86%20157.514-40.102ZM303.635%20153.49c21.953%206.233%2075.365%20140.709%20110.92%20236.564a8.364%208.364%200%200%201-2.394%209.249%208.364%208.364%200%200%201-9.504.978c-54.943-30.493-119.013-66.824-176.522-94.546a10.565%2010.565%200%200%201-5.528-12.501c16.926-57.44%2053.532-148.095%2083.028-139.744ZM137.064%20343.322c19.921-11.123%20152.795%2046.197%20245.707%2088.83a8.369%208.369%200%200%201-1.189%2015.652c-60.401%2017.219-131.411%2036.899-191.675%2057.957a10.552%2010.552%200%200%201-12.742-4.925c-28.668-52.584-66.876-142.568-40.101-157.514Zm16.443%20252.009c6.217-21.953%20140.709-75.365%20236.564-110.921a8.368%208.368%200%200%201%2010.227%2011.898c-30.511%2054.945-66.842%20119.014-94.563%20176.507a10.548%2010.548%200%200%201-5.229%205.075%2010.544%2010.544%200%200%201-7.271.468c-57.441-16.822-148.095-53.531-139.728-83.027ZM343.34%20761.902c-11.14-19.922%2046.197-152.796%2088.829-245.707a8.383%208.383%200%200%201%205.713-4.66%208.38%208.38%200%200%201%207.182%201.664%208.371%208.371%200%200%201%202.758%204.184c17.217%2060.403%2036.898%20131.412%2057.957%20191.675a10.558%2010.558%200%200%201-4.942%2012.743c-52.568%2028.668-142.568%2066.875-157.445%2040.101h-.052Zm252.009-16.443c-21.971-6.216-75.383-140.709-110.939-236.564a8.37%208.37%200%200%201%2011.916-10.228c54.926%2030.494%20119.014%2066.842%20176.506%2094.563a10.538%2010.538%200%200%201%205.527%2012.502c-16.909%2057.526-53.515%20148.094-83.01%20139.727Zm166.57-189.834c-19.938%2011.141-152.796-46.197-245.724-88.83a8.367%208.367%200%200%201-2.993-12.892%208.378%208.378%200%200%201%204.182-2.759c60.419-17.218%20131.41-36.899%20191.675-57.958a10.577%2010.577%200%200%201%2012.758%204.943c28.652%2052.568%2066.86%20142.569%2040.102%20157.496Zm-16.444-252.009c-6.232%2021.971-140.709%2075.383-236.562%20110.94a8.371%208.371%200%200%201-10.229-11.917c30.495-54.926%2066.825-119.012%2094.547-176.505a10.555%2010.555%200%200%201%2012.5-5.528c57.441%2016.909%20148.096%2053.516%20139.744%2083.01Z'/%3e%3c/svg%3e",ak="/demo/desktop/assets/fast-agent-C0GPnwYP.svg",lk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M11.04%2019.32Q12%2021.51%2012%2024q0-2.49.93-4.68.96-2.19%202.58-3.81t3.81-2.55Q21.51%2012%2024%2012q-2.49%200-4.68-.93a12.3%2012.3%200%200%201-3.81-2.58%2012.3%2012.3%200%200%201-2.58-3.81Q12%202.49%2012%200q0%202.49-.96%204.68-.93%202.19-2.55%203.81a12.3%2012.3%200%200%201-3.81%202.58Q2.49%2012%200%2012q2.49%200%204.68.96%202.19.93%203.81%202.55t2.55%203.81'/%3e%3c/svg%3e",ok="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.99816%2014.2779C12.0678%2014.2779%2014.9997%2011.6274%2014.9997%2010.9574V9.3189C14.939%208.77306%2014.4165%207.82349%2013.6074%207.48636C13.5959%207.42498%2013.5859%207.36153%2013.5756%207.29542C13.5506%207.13548%2013.5231%206.95977%2013.4649%206.75954C13.6409%206.31508%2013.6873%205.81187%2013.6873%205.31135C13.6873%204.54947%2013.5757%203.76321%2013.0811%203.13712C12.5745%202.4959%2011.7737%202.15372%2010.6972%202.03411C9.64215%201.91688%208.71828%202.06409%208.12157%202.70342C8.07827%202.74981%208.0345%202.79812%207.99655%202.84746C7.95861%202.79812%207.91805%202.74981%207.87475%202.70342C7.27804%202.06409%206.35416%201.91688%205.29908%202.03411C4.22263%202.15372%203.42181%202.4959%202.91521%203.13712C2.42057%203.76321%202.30905%204.54947%202.30905%205.31135C2.30905%205.81187%202.35539%206.31508%202.53142%206.75954C2.47323%206.95977%202.44574%207.13542%202.42072%207.29536C2.41037%207.3615%202.40044%207.42496%202.38893%207.48636C1.57983%207.82349%201.05728%208.77306%200.996582%209.3189V10.9574C0.996582%2011.6274%203.92849%2014.2779%207.99816%2014.2779ZM10.5523%203.33859C9.63863%203.23707%209.25001%203.41798%209.0811%203.59896C8.90273%203.79007%208.76738%204.19254%208.86971%205.0112C8.94909%205.64627%209.13423%206.08757%209.41018%206.36929C9.67188%206.63645%2010.0966%206.8426%2010.8435%206.8426C11.6506%206.8426%2011.9631%206.66867%2012.1051%206.51046C12.2619%206.33577%2012.3748%206.00462%2012.3748%205.31135C12.3748%204.64141%2012.2675%204.22455%2012.0513%203.95077C11.8469%203.69214%2011.4446%203.43773%2010.5523%203.33859ZM6.91639%203.59896C6.74748%203.41798%206.35886%203.23707%205.44518%203.33859C4.55289%203.43773%204.15058%203.69214%203.94624%203.95077C3.72994%204.22455%203.62271%204.64141%203.62271%205.31135C3.62271%206.00462%203.73563%206.33577%203.89239%206.51046C4.03436%206.66867%204.34693%206.8426%205.15396%206.8426C5.90092%206.8426%206.32561%206.63645%206.58731%206.36929C6.86326%206.08757%207.0484%205.64627%207.12778%205.0112C7.23011%204.19254%207.09476%203.79007%206.91639%203.59896ZM7.99818%2012.9788C9.99307%2012.9788%2012.0088%2012.0076%2012.3748%2011.7248V8.00133L12.3546%207.90026C11.9257%208.08369%2011.4142%208.1551%2010.8435%208.1551C9.84049%208.1551%209.04148%207.86851%208.47257%207.28773C8.28092%207.09208%208.12536%206.87308%207.99978%206.6378C7.8742%206.87308%207.71544%207.09208%207.52378%207.28773C6.95488%207.86851%206.15587%208.1551%205.15283%208.1551C4.58212%208.1551%204.07068%208.08369%203.6418%207.90026L3.62158%208.00133V11.7248C3.98755%2012.0076%206.00329%2012.9788%207.99818%2012.9788Z'%20fill='currentColor'/%3e%3cpath%20d='M6.46854%209.0301C6.83097%209.0301%207.12479%209.32391%207.12479%209.68635V10.9988C7.12479%2011.3613%206.83097%2011.6551%206.46854%2011.6551C6.1061%2011.6551%205.81229%2011.3613%205.81229%2010.9988V9.68635C5.81229%209.32391%206.1061%209.0301%206.46854%209.0301Z'%20fill='currentColor'/%3e%3cpath%20d='M10.1873%209.68635C10.1873%209.32391%209.89347%209.0301%209.53104%209.0301C9.1686%209.0301%208.87479%209.32391%208.87479%209.68635V10.9988C8.87479%2011.3613%209.1686%2011.6551%209.53104%2011.6551C9.89347%2011.6551%2010.1873%2011.3613%2010.1873%2010.9988V9.68635Z'%20fill='currentColor'/%3e%3c/svg%3e",ck="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='currentColor'%20fill-rule='evenodd'%3e%3ctitle%3eZ.ai%3c/title%3e%3cpath%20d='M8.07%201.333L6.618%203.302H.435L1.887%201.333h6.184zM15.503%2012.699L14.052%2014.667h-6.161l1.449-1.968h6.163zM16%201.333L6.176%2014.667H0L9.824%201.333H16z'/%3e%3c/svg%3e",hk="/demo/desktop/assets/goose-y93b4F4V.svg",uk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M0.58392448,14.9254204%20L0.8326,14.66295%20C2.004465,13.42985%203.1678,12.2082%202.45814,10.48105%20C1.50813,8.1701%202.061355,5.4619%203.820575,3.70057%20C5.6495,1.8709%208.3431,1.40957%2010.59295,2.336505%20C11.0907,2.52161%2011.5245,2.785025%2011.86295,3.02993%20L9.98425,3.89849%20C8.235,3.163775%206.23115,3.66355%205.0081,4.88809%20C3.354105,6.5426%203.019895,9.4117%204.95835,11.2656%20L-0.335,15.99995%20C-0.066496,15.62975%200.2538896,15.275934%200.58392448,14.9254204%20Z%20M14.0391,2.288155%20L16.33165,2.57749377e-12%20L16.20795,0.172288%20C14.4658,2.574355%2013.6153,3.749045%2014.29795,6.6879%20C14.76445,8.68415%2014.261,10.90255%2012.63545,12.53005%20C10.5861,14.58325%207.3066,15.0403%204.6059,13.19215%20L6.48885,12.3193%20C8.2125,12.99705%2010.0983,12.69945%2011.4536,11.34255%20C12.80895,9.9856%2013.1133,8.00925%2012.4321,6.3647%20C12.30265,6.05285%2011.9144,5.97455%2011.64275,6.1753%20L6.102,10.27035%20L14.0391,2.288155%20Z'/%3e%3c/svg%3e",dk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M11.2%201.4%2014.6%204.8a1%201%200%200%201%200%201.4l-1.5%201.5-4.8-4.8%201.5-1.5a1%201%200%200%201%201.4%200ZM7.6%203.6l4.8%204.8-6.9%206.9a1%201%200%200%201-.5.27l-3.4.73a.6.6%200%200%201-.71-.71l.73-3.4a1%201%200%200%201%20.27-.5l5.6-5.6Zm-4.5%208.1-.4%201.9%201.9-.4-1.5-1.5Z'/%3e%3c/svg%3e",fk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%20fill='none'%3e%3cpath%20d='M25%2015H35V16.75C35%2029%2030.5001%2035%2016.5001%2035H15V25H16.5001C22.6251%2025%2025%2022.875%2025%2016.75V15Z'%20fill='currentColor'/%3e%3crect%20x='5'%20y='15'%20width='10'%20height='10'%20fill='currentColor'/%3e%3crect%20x='15'%20y='5'%20width='10'%20height='10'%20fill='currentColor'/%3e%3c/svg%3e",pk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M27.9998324,34.6666921h6.6666279v5.3333023h-8.3809037l-3.6190266-3.6190266v-8.3809037h5.3333023v6.6666279ZM39.9997627,26.2857884l-3.6190266-3.6190266h-8.3809037v5.3333023h6.6666279v6.6666279h5.3333023v-8.3809037ZM17.3332326,22.6667578h-5.3333023v5.3333023h5.3333023v-5.3333023ZM0,36.3809638l3.6190266,3.6190266h13.714206v-5.3333023H5.3333023v-11.9999302H0v13.714206ZM33.9600959,11.9999247V3.619021L30.3410693-.0000056h-7.6745392v5.3333023h5.9602634v6.6666279h-5.9602634v5.3333023h17.3332326v-5.3333023h-6.0396668ZM5.3333023,0H0v17.3332326h5.3333023v-5.9999651h6.6666279v5.9999651h5.3333023v-5.9999651l-5.3333023-5.3333023h-6.6666279V0ZM17.3332326,0h-5.3333023v5.9999651h5.3333023V0Z'/%3e%3c/svg%3e",mk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M3%201h2.5v5.5L9%201h3L8.5%206.5%2012.5%2013H9.5L6%208v5H3V1z'/%3e%3c/svg%3e",gk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M19.514%207.342C19.711%207.862%2019.814%208.413%2019.816%208.969C19.816%2012.494%2015.998%2014.697%2012.946%2012.934C11.529%2012.116%2010.657%2010.605%2010.657%208.969C10.657%205.646%2014.085%203.431%2017.115%204.793C15.26%203.373%2012.99%202.607%2010.655%202.612C4.772%202.614%200.005%207.381%200%2013.265C0.002%2019.148%204.772%2023.918%2010.655%2023.92C16.538%2023.916%2021.306%2019.147%2021.31%2013.265C21.312%2011.155%2020.687%209.095%2019.514%207.342ZM14.841%204.666C14.841%208.191%2018.657%2010.395%2021.709%208.632C23.127%207.814%2024%206.302%2024%204.666C24%201.14%2020.184-1.061%2017.13%200.699C15.714%201.519%2014.841%203.03%2014.841%204.666'/%3e%3c/svg%3e",vk="data:image/svg+xml,%3csvg%20width='1200'%20height='1200'%20viewBox='0%200%201200%201200'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='1200'%20height='1200'%20rx='260'%20fill='%239046FF'/%3e%3cmask%20id='mask0_1106_4856'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='272'%20y='202'%20width='655'%20height='796'%3e%3cpath%20d='M926.578%20202.793H272.637V997.857H926.578V202.793Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1106_4856)'%3e%3cpath%20d='M398.554%20818.914C316.315%201001.03%20491.477%201046.74%20620.672%20940.156C658.687%201059.66%20801.052%20970.473%20852.234%20877.795C964.787%20673.567%20919.318%20465.357%20907.64%20422.374C827.637%20129.443%20427.623%20128.946%20358.8%20423.865C342.651%20475.544%20342.402%20534.18%20333.458%20595.051C328.986%20625.86%20325.507%20645.488%20313.83%20677.785C306.873%20696.424%20297.68%20712.819%20282.773%20740.645C259.915%20783.881%20269.604%20867.113%20387.87%20823.883L399.051%20818.914H398.554Z'%20fill='white'/%3e%3cpath%20d='M636.123%20549.353C603.328%20549.353%20598.359%20510.097%20598.359%20486.742C598.359%20465.623%20602.086%20448.977%20609.293%20438.293C615.504%20428.852%20624.697%20424.131%20636.123%20424.131C647.555%20424.131%20657.492%20428.852%20664.447%20438.541C672.398%20449.474%20676.623%20466.12%20676.623%20486.742C676.623%20525.998%20661.471%20549.353%20636.375%20549.353H636.123Z'%20fill='black'/%3e%3cpath%20d='M771.24%20549.353C738.445%20549.353%20733.477%20510.097%20733.477%20486.742C733.477%20465.623%20737.203%20448.977%20744.41%20438.293C750.621%20428.852%20759.814%20424.131%20771.24%20424.131C782.672%20424.131%20792.609%20428.852%20799.564%20438.541C807.516%20449.474%20811.74%20466.12%20811.74%20486.742C811.74%20525.998%20796.588%20549.353%20771.492%20549.353H771.24Z'%20fill='black'/%3e%3c/g%3e%3c/svg%3e",yk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M2%203h3l3%205%203-5h3v10h-2V6.5l-4%206-4-6V13H2V3Z'/%3e%3c/svg%3e",_k="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3crect%20fill='none'%20stroke='currentColor'%20stroke-width='1.1'%20x='4.5'%20y='2.5'%20width='7'%20height='10'%20rx='3.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='1'%20x1='3'%20y1='5.5'%20x2='13'%20y2='5.5'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='6.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='9.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='currentColor'%20cx='6.8'%20cy='5.6'%20r='0.55'/%3e%3ccircle%20fill='currentColor'%20cx='9.8'%20cy='5.6'%20r='0.55'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.6'%20stroke-linecap='round'%20d='M7%208.3%20Q8%209%209%208.3'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M4.5%208%20L3%209.5'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M11.5%208%20L13%209.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20x1='5'%20y1='9.5'%20x2='11'%20y2='9.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='6.5'%20y1='12.5'%20x2='6.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='9.5'%20y1='12.5'%20x2='9.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='6.5'%20y1='14'%20x2='5.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='9.5'%20y1='14'%20x2='10.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='7.3'%20y2='0.8'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8'%20y2='0.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8.7'%20y2='0.8'/%3e%3c/svg%3e",xk="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.8147%205.35803H5.35791V8.46914H8.8147V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%205.35803H19.1851V8.46914H22.6419V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M15.7283%2015.7284H12.2715V18.8395H15.7283V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M8.8147%2015.7284H5.35791V18.8395H8.8147V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2015.7284H19.1851V18.8395H22.6419V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2715%208.81482H5.35791V11.9259H12.2715V8.81482Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2718%2019.1852H1.90137V22.2963H12.2718V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M26.0989%2019.1852H15.7285V22.2963H26.0989V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2012.2716H5.35791V15.3827H22.6419V12.2716Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6421%208.81482H15.7285V11.9259H22.6421V8.81482Z'%20fill='currentColor'/%3e%3c/svg%3e",wk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3ccircle%20cx='8'%20cy='8'%20r='6'%20fill='none'%20stroke='currentColor'%20stroke-width='1'/%3e%3ccircle%20cx='8'%20cy='8'%20r='4.5'%20fill='none'%20stroke='currentColor'%20stroke-width='0.3'%20opacity='0.5'/%3e%3cline%20x1='8'%20y1='8'%20x2='13.5'%20y2='13.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='14.5,14.5%2012.3,13.5%2013.5,12.3'%20fill='currentColor'/%3e%3cline%20x1='8'%20y1='8'%20x2='2.5'%20y2='2.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='1.5,1.5%203.7,2.5%202.5,3.7'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='1.3'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='0.6'%20fill='none'%20stroke='currentColor'%20stroke-width='0.5'%20opacity='0.7'/%3e%3c/svg%3e",Sk="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%2014H3V2H13V14ZM10.5%204.4H5.5V11.6H10.5V4.4Z'%20fill='currentColor'/%3e%3c/svg%3e",bk="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1%201H11.7692V7.9999H8.17942V11.4999H4.58982V15H1V1ZM4.58982%204.50005V7.9999H8.17942V4.50005H4.58982Z'%20fill='currentColor'/%3e%3cpath%20d='M11.7692%207.46154H15V15H11.7692V7.46154Z'%20fill='currentColor'/%3e%3c/svg%3e",Ck="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.63653%205.50522L2.18735%205.28559C2.09852%205.46726%202.12787%205.68456%202.26172%205.83616C2.39558%205.98775%202.60757%206.04379%202.79884%205.97814L2.63653%205.50522ZM5.83578%206.94285L5.3732%207.13265L5.5645%207.59886L6.02919%207.40392L5.83578%206.94285ZM10.7441%209.44034L10.2614%209.57083L10.393%2010.0573L10.8784%209.92198L10.7441%209.44034ZM2.5%208.24963C2.4998%207.97349%202.27577%207.74979%201.99963%207.75C1.72349%207.75021%201.4998%207.97423%201.5%208.25037L2.5%208.24963ZM13.4143%2010.7751C12.0197%2013.6273%208.57701%2014.8089%205.72485%2013.4143L5.28559%2014.3126C8.63389%2015.9498%2012.6754%2014.5627%2014.3126%2011.2144L13.4143%2010.7751ZM3.08571%205.72485C4.48031%202.87269%207.92299%201.69111%2010.7751%203.08571L11.2144%202.18735C7.86611%200.550151%203.82455%201.93728%202.18735%205.28559L3.08571%205.72485ZM10.7751%203.08571C13.6273%204.48031%2014.8089%207.92299%2013.4143%2010.7751L14.3126%2011.2144C15.9498%207.86611%2014.5627%203.82455%2011.2144%202.18735L10.7751%203.08571ZM2.79884%205.97814C3.02201%205.90155%203.54835%205.84926%204.09141%206.00587C4.61256%206.15616%205.10736%206.48476%205.3732%207.13265L6.29835%206.75304C5.89213%205.76303%205.11508%205.26032%204.3685%205.04503C3.64385%204.83605%202.9066%204.8839%202.47422%205.0323L2.79884%205.97814ZM6.02919%207.40392C6.25314%207.30998%206.55771%207.25841%206.85281%207.36034C7.13062%207.45631%207.49214%207.72014%207.78743%208.4398L8.71257%208.0602C8.3358%207.14195%207.79046%206.62626%207.17931%206.41515C6.58544%206.21001%206.01893%206.32381%205.64236%206.48177L6.02919%207.40392ZM6.26827%207.19375C6.80493%206.26869%208.18817%204.18684%2011.1653%203.10654L10.8242%202.16652C7.53166%203.36127%205.99463%205.67263%205.40329%206.69195L6.26827%207.19375ZM14.3364%2010.8325C14.1845%2010.39%2013.7564%209.79897%2013.14%209.37995C12.504%208.94759%2011.6302%208.67426%2010.6099%208.9587L10.8784%209.92198C11.5634%209.73102%2012.1368%209.90713%2012.5779%2010.207C13.0385%2010.5201%2013.3174%2010.9441%2013.3905%2011.1571L14.3364%2010.8325ZM11.2268%209.30984C11.1236%208.92833%2010.8783%208.39265%2010.3638%208.02453C9.82769%207.6409%209.08331%207.49864%208.11574%207.76836L8.38426%208.73164C9.1221%208.52595%209.53979%208.66454%209.78189%208.83777C10.0457%209.02651%2010.1946%209.32371%2010.2614%209.57083L11.2268%209.30984ZM11.216%209.60556C11.6225%208.44463%2012.4244%205.47936%2011.4712%202.48487L10.5183%202.78819C11.3726%205.47172%2010.6545%208.18331%2010.2722%209.27512L11.216%209.60556ZM7.80082%208.03037L5.05604%2013.6438L5.9544%2014.0831L8.69918%208.46963L7.80082%208.03037ZM5.72485%2013.4143C3.68742%2012.4181%202.50158%2010.3763%202.5%208.24963L1.5%208.25037C1.50185%2010.7441%202.89229%2013.1424%205.28559%2014.3126L5.72485%2013.4143Z'%20fill='currentColor'/%3e%3c/svg%3e",kk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M8%201C4.134%201%201%204.134%201%208s3.134%207%207%207c1.5%200%202.9-.47%204.05-1.28l1.12%201.12a.75.75%200%201%200%201.06-1.06l-1.12-1.12A6.97%206.97%200%200%200%2015%208c0-3.866-3.134-7-7-7Zm0%202c2.761%200%205%202.239%205%205s-2.239%205-5%205-5-2.239-5-5%202.239-5%205-5Z'/%3e%3c/svg%3e",jk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20data-name='图层%202'%20viewBox='0%200%20141.38%20140'%20width='16'%20height='16'%3e%3cpath%20fill='currentColor'%20d='m140.93%2085-16.35-28.33-1.93-3.34%208.66-15a3.323%203.323%200%200%200%200-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33%203.33%200%200%200-2.89-1.67H51.43c-.59%200-1.17.16-1.66.45-.5.29-.92.71-1.22%201.22L32.19%2029.98l-1.92%203.33H12.96c-.59%200-1.17.16-1.66.45-.5.29-.93.71-1.22%201.22L.45%2051.66a3.323%203.323%200%200%200%200%203.34l18.28%2031.67-8.66%2015a3.32%203.32%200%200%200%200%203.34l9.62%2016.67c.3.51.72.93%201.22%201.22s1.07.45%201.67.45h36.56l8.66%2015a3.35%203.35%200%200%200%202.89%201.67h19.25a3.34%203.34%200%200%200%202.89-1.67l18.28-31.67h17.32c.6%200%201.17-.16%201.67-.45s.92-.71%201.22-1.22l9.62-16.67a3.323%203.323%200%200%200%200-3.34ZM51.44%203.33%2061.07%2020l-9.63%2016.66h76.98l-9.62%2016.66H45.67l-11.54-20zM57.21%20120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62%2016.67L68.78%20100l-11.55%2020Zm61.59-33.34-9.62-16.67-38.49%2066.67-9.63-16.67%209.63-16.66%2026.94-46.67h23.1l17.32%2030z'%20data-name='图层%201'/%3e%3c/svg%3e",Ek="/demo/desktop/assets/sigit-DPmZBS3L.svg",Mk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M6.53%204.412h5.883v3.587H9.471v3.588H3.588V7.999H6.53Z'/%3e%3c/svg%3e",Ak="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMC41IDUuNUwyLjUgOCAwLjUgMTAuNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KICA8dGV4dCB4PSIzLjIiIHk9IjExLjUiIGZvbnQtZmFtaWx5PSInU0YgTW9ubycsICdGaXJhIENvZGUnLCAnQ29uc29sYXMnLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMTAiIGZvbnQtd2VpZ2h0PSI2MDAiIGxldHRlci1zcGFjaW5nPSItMC41IiBmaWxsPSJjdXJyZW50Q29sb3IiPlZUPC90ZXh0Pgo8L3N2Zz4=",Tk=Object.assign({"../assets/agents/agoragentic-acp.svg":q9,"../assets/agents/amp-acp.svg":V9,"../assets/agents/antigravity-acp.svg":$9,"../assets/agents/auggie.svg":W9,"../assets/agents/autohand.svg":F9,"../assets/agents/claude-acp.svg":K9,"../assets/agents/cline.svg":Y9,"../assets/agents/codebuddy-code.svg":G9,"../assets/agents/codex-acp.svg":Z9,"../assets/agents/cortex-code.svg":X9,"../assets/agents/corust-agent.svg":Q9,"../assets/agents/crow-cli.svg":J9,"../assets/agents/cursor.svg":ek,"../assets/agents/deepagents.svg":tk,"../assets/agents/devin.svg":ik,"../assets/agents/dimcode.svg":sk,"../assets/agents/dirac.svg":nk,"../assets/agents/factory-droid.svg":rk,"../assets/agents/fast-agent.svg":ak,"../assets/agents/gemini.svg":lk,"../assets/agents/github-copilot-cli.svg":ok,"../assets/agents/glm-acp-agent.svg":ck,"../assets/agents/goose.svg":hk,"../assets/agents/grok-build.svg":uk,"../assets/agents/harn.svg":dk,"../assets/agents/junie.svg":fk,"../assets/agents/kilo.svg":pk,"../assets/agents/kimchi.svg":mk,"../assets/agents/kimi.svg":gk,"../assets/agents/kiro.svg":vk,"../assets/agents/minimax-code.svg":yk,"../assets/agents/minion-code.svg":_k,"../assets/agents/mistral-vibe.svg":xk,"../assets/agents/nova.svg":wk,"../assets/agents/opencode.svg":Sk,"../assets/agents/pi-acp.svg":bk,"../assets/agents/poolside.svg":Ck,"../assets/agents/qoder.svg":kk,"../assets/agents/qwen-code.svg":jk,"../assets/agents/sigit.svg":Ek,"../assets/agents/stakpak.svg":Mk,"../assets/agents/vtcode.svg":Ak}),Nk=new Map(Object.entries(Tk).map(([e,t])=>[e.split("/").pop().replace(".svg",""),t]));function Bp(e){return e?Nk.get(e)??null:null}function xw({registry:e,size:t,color:s="currentColor"}){const r=Bp(e);return r?o.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",backgroundColor:s,WebkitMaskImage:`url("${r}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):o.jsx(se,{name:"terminal",size:t*.8,scaled:!1,color:s})}const k_=e=>e[Math.floor(Math.random()*e.length)];function Dk(){return{name:"",description:"",avatarColor:k_($h).id,avatarShape:k_(Nx),backend:"claude",cwd:"",permission:"auto"}}const C2=e=>!e.id||e.name.trim()!=="",ww=e=>e.backend==="custom"?e:{...e,command:null};function k2(e,t,s){const r={...t},l=e.hello?.backends??[],h=l.find(u=>u.available&&u.curated===!0);return l.find(u=>u.id===r.backend)?.available!==!0&&h&&(r.backend=h.id),r.connectors===void 0&&s.connectors.length&&(r.connectors=s.connectors.map(u=>u.id)),r.skills===void 0&&s.skills.length&&(r.skills=s.skills.map(u=>u.id)),r}async function Sw(e){const t=e.client;if(!t)return{connectors:[],skills:[]};const[s,r]=await Promise.allSettled([t.call("connectors"),t.call("skills")]);return{connectors:s.status==="fulfilled"?s.value.items:[],skills:r.status==="fulfilled"?r.value.items:[]}}function bw(e){const[t,s]=b.useState(null),r=e.connection.kind==="online";return b.useEffect(()=>{let l=!0;return Sw(e).then(h=>l&&s(h)),()=>{l=!1}},[e,r]),t}async function Rk(e){const t=await e.save(k2(e,Dk(),await Sw(e)));return e.setSelection(t.id),t}const Op=e=>e.split("/").filter(Boolean).pop()??e,Br=e=>e instanceof Error?e.message:String(e);function Lk({backend:e,selection:t,onChange:s}){const r=Ae(),l=r.connection.kind==="online",[h,u]=b.useState(null),p=b.useRef(null),[m,g]=b.useState(!1),[y,v]=b.useState(null),[x,S]=b.useState(0),w=e==="custom",C=b.useRef(e);b.useEffect(()=>{C.current!==e&&(C.current=e,s(null))},[e,s]),b.useEffect(()=>{const I=`${r.computer.id}/${e}`;if(p.current!==I&&(u(null),p.current=I),v(null),g(!1),w)return;const U=r.client;if(!l||!U){v("Connect to this computer to load its models. You can still enter a model ID.");return}let P=!1;return g(!0),U.call("agentModels",{backend:e},3e5).then(F=>!P&&u(F)).catch(F=>!P&&v(`Couldn't load models: ${Br(F)}`)).finally(()=>!P&&g(!1)),()=>{P=!0}},[r.computer.id,r.client,e,l,x,w]);const j=h?.models.find(I=>I.name.toLowerCase().startsWith("default")),E=(h?.models??[]).filter(I=>I.id!==j?.id),A=E.find(I=>I.id===h?.currentModelId)?.name,N=[{id:"",label:j?.name??(A?`Default · ${A}`:"Default")},...E.map(I=>({id:I.id,label:I.name}))];t&&t!==j?.id&&!E.some(I=>I.id===t)&&N.push({id:t,label:t});const L=t===j?.id?"":t??"",q=I=>s(I||null),B=h?.models.length===0;return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap"},children:"Model"}),o.jsx("span",{style:{flex:1}}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[w?null:o.jsxs("div",{style:{width:28,height:28,display:"grid",placeItems:"center",flex:"none"},children:[o.jsx("div",{style:{gridArea:"1 / 1",opacity:m?0:1,transition:"opacity var(--fade)",pointerEvents:m?"none":void 0},children:o.jsx(be,{title:y?"Retry model list":"Refresh model list",icon:"arrow.clockwise",disabled:m,onClick:()=>S(I=>I+1)})}),m?o.jsx("div",{className:"fade-in",style:{gridArea:"1 / 1",display:"flex"},"aria-label":"Loading available models",children:o.jsx($e,{size:12})}):null]}),w||!m&&(!h||B)?o.jsx(zx,{outlined:!0,style:{minWidth:0,maxWidth:160},children:o.jsx("input",{value:L,placeholder:"Default",spellCheck:!1,onChange:I=>q(I.target.value),style:{textAlign:"right",width:142,maxWidth:"100%",minWidth:0,color:"var(--text)",userSelect:"text"}})}):o.jsx("div",{style:{display:"flex",minWidth:0},children:o.jsx(_i,{selection:L,options:N,onChange:q})})]})]}),!w&&!m&&y?o.jsx("span",{style:{...R("caption"),color:"var(--warning)"},children:y}):!w&&!m&&B?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:"This agent doesn't advertise a model list. Leave Default or enter a model ID."}):null,o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:"Changing the model starts a new agent session. Chat history is kept."})]})}function zp({skill:e}){const t=Ae(),s=qr(t),[r,l]=b.useState(null),[h,u]=b.useState(null),[p,m]=b.useState(!1),g=e.source!==void 0?{source:e.source}:{id:e.id},y=e.source??null,v=y===null||e.installed===!0||s.installedSkills.some(C=>C.id===y.toLowerCase()),x=!ko(t.hello?.version??"",yw);b.useEffect(()=>{if(!x)return;let C=!0;return t.ready().then(j=>Re.skillDetails(j,g)).then(j=>C&&l(j),j=>C&&u(tt(j))),()=>{C=!1}},[]);const S=async()=>{if(y){m(!0),u(null);try{await s.installSkill(y)}catch(C){u(tt(C))}m(!1)}},w=v?o.jsx("span",{title:"Added","aria-label":"Added",style:{width:32,display:"grid",placeItems:"center",color:"var(--secondary)"},children:o.jsx(se,{name:"checkmark",size:13,weight:"semibold"})}):p?o.jsx($e,{}):o.jsx(be,{title:"Add",icon:"plus",onClick:()=>{S()}});return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:e.name,trailing:w}),o.jsxs(ui,{children:[e.description?o.jsx(ke,{children:o.jsx("span",{style:{...R("subheadline"),color:"var(--secondary)"},children:e.description})}):null,x?o.jsx(ke,{title:"Instructions",footer:v?"Bots read these before using the skill.":"Add it to let bots use these instructions.",children:r?o.jsx(ou,{text:r}):r===""?o.jsx("span",{style:{color:"var(--secondary)"},children:"No instructions."}):h?null:o.jsx($e,{})}):null,h?o.jsx(ke,{children:o.jsx(Vs,{text:h})}):null]})]})}class Bk extends ws{constructor(t,s){super(),this.botId=t,this.client=s}botId;client;facts=[];query="";filter="all";total=0;nextOffset=null;loaded=!1;busy=!1;error=null;detail=null;backup="";request=0;detailRequest=0;searchTimer;async load(t=!1){const s=++this.request,r=t?this.nextOffset:0;if(r!==null){this.error=null,this.changed();try{const l=await(await this.client()).call("memory",{botId:this.botId,query:this.query,filter:this.filter,offset:r},24e4);if(s!==this.request)return;this.facts=t?[...this.facts,...l.facts]:l.facts,this.total=l.total,this.nextOffset=l.nextOffset,this.loaded=!0}catch(l){s===this.request&&(this.error=yh(l))}this.changed()}}search(t,s=this.filter){this.query=t,this.filter=s,++this.request,this.changed(),clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>{this.load()},250)}async mutate(t,s={}){return this.busy?!1:this.perform(async()=>{await(await this.client()).call(t,{botId:this.botId,...s},24e4)})}async perform(t){if(this.busy)return!1;this.busy=!0,this.error=null,this.changed();try{return await t(),await this.load(),!0}catch(s){return this.error=yh(s),!1}finally{this.busy=!1,this.changed()}}async inspect(t,s){const r=++this.detailRequest;this.error=null,s||(this.detail=null),this.changed();try{const l=await(await this.client()).call("memoryDetail",{botId:this.botId,id:t.id,...s?{historyCursor:s}:{}},24e4);r===this.detailRequest&&(this.detail=l)}catch(l){r===this.detailRequest&&(this.error=yh(l))}this.changed()}async export(){this.error=null,this.backup="",this.changed();try{const t=await this.client(),s=await t.call("exportMemory",{botId:this.botId},24e4);this.backup=s.uploadId?new TextDecoder("utf-8",{fatal:!0}).decode(await t.readUpload(this.botId,s.uploadId)):s.json??""}catch(t){this.error=yh(t)}this.changed()}async import(t){try{JSON.parse(t)}catch{return this.error="Enter a valid Engram JSON backup.",this.changed(),!1}return this.perform(async()=>{const s=new TextEncoder().encode(t),r=await this.client();if(s.length<=384*1024)await r.call("importMemory",{botId:this.botId,json:t},24e4);else{const l=crypto.randomUUID();await r.upload(this.botId,l,"engram-backup.json",s),await r.call("importMemory",{botId:this.botId,uploadId:l},24e4)}})}}function yh(e){return e instanceof Error?e.message:String(e)}const Ok=[{id:"all",label:"All"},{id:"profile",label:"About you"},{id:"pinned",label:"Pinned"},{id:"review",label:"Needs review"}];function zk({botId:e}){const t=Ae(),s=di(b.useMemo(()=>new Bk(e,()=>t.ready()),[e,t])),[r,l]=b.useState(null),[h,u]=b.useState(!1),[p,m]=b.useState(null),[g,y]=b.useState(""),[v,x]=b.useState(!1);b.useEffect(()=>{s.load()},[s]);const S=w=>l({id:w?.id,title:w?.title??"",content:w?.content??"",scope:w?.scope??"project",memoryType:w?.memoryType??"learning",topicKey:w?.topicKey??""});return o.jsxs(o.Fragment,{children:[o.jsxs(ke,{title:"Memory",accessory:o.jsxs("div",{className:"memory-header-actions",children:[o.jsx(be,{title:"Add memory",icon:"plus",onClick:()=>S(),disabled:s.busy}),o.jsx(Ya,{className:"icon-button memory-menu",title:"More",items:()=>[{title:"Refresh",icon:"arrow.clockwise",action:()=>{s.load()}},{title:"Export",icon:"square.and.arrow.up",action:()=>{m("export"),s.export()}},{title:"Import",icon:"arrow.down.circle",action:()=>m("import")},{title:"Forget everything",icon:"trash",destructive:!0,divider:!0,action:()=>x(!0)}],children:o.jsx(se,{name:"ellipsis",size:14,weight:"medium"})})]}),children:[o.jsxs("div",{className:"memory-search",children:[o.jsx(Ox,{prompt:"Search memories",value:s.query,onChange:w=>s.search(w)}),o.jsx(_i,{selection:s.filter,options:Ok,fill:"var(--bubble-agent)",onChange:w=>s.search(s.query,w)})]}),s.error&&o.jsx("p",{role:"alert",className:"memory-error",children:s.error}),!s.loaded&&!s.error&&o.jsx("p",{className:"memory-muted",children:"Loading memory…"}),s.loaded&&!s.facts.length&&o.jsxs("div",{className:"memory-empty",children:[o.jsx(se,{name:"brain",size:20,color:"var(--tertiary)"}),o.jsx("span",{children:s.query||s.filter!=="all"?"No matching memories.":"Nothing yet. Important details are remembered as you chat."})]}),s.facts.map(w=>o.jsxs("div",{className:"memory-item fade-in",children:[o.jsxs("button",{className:"press memory-content",onClick:()=>S(w),children:[o.jsxs("strong",{children:[w.pinned&&o.jsx(se,{name:"pin.fill",size:10,color:"var(--secondary)"}),w.title]}),o.jsx("span",{children:w.content}),o.jsxs("small",{children:[w.kind==="profile"?"About you":w.memoryType," · ",new Date(w.createdAt).toLocaleDateString()," · ",w.revisionCount," revisions"]})]}),o.jsx(Ya,{className:"icon-button memory-menu",title:"Memory actions",items:()=>[{title:w.pinned?"Unpin":"Pin",icon:w.pinned?"pin.slash":"pin",action:()=>{s.mutate("pinMemory",{id:w.id,pinned:!w.pinned})}},{title:"History",icon:"clock.arrow.circlepath",action:()=>{u(!0),s.inspect(w)}},...w.reviewAfter?[{title:"Mark reviewed",icon:"checkmark.circle",action:()=>{s.mutate("reviewMemory",{id:w.id})}}]:[],{title:"Forget",icon:"trash",destructive:!0,divider:!0,action:()=>{s.mutate("forgetMemory",{id:w.id})}}],children:o.jsx(se,{name:"ellipsis",size:14,weight:"medium"})})]},w.id)),s.nextOffset!==null&&o.jsxs("button",{className:"press memory-more",onClick:()=>{s.load(!0)},children:["Load more (",s.total,")"]})]}),o.jsxs(ht,{open:r!==null,onClose:()=>l(null),width:560,children:[o.jsx(ut,{title:r?.id?"Edit memory":"Add memory"}),r&&o.jsxs("div",{className:"memory-editor",children:[o.jsxs("label",{children:["Title",o.jsx("input",{value:r.title,onChange:w=>l({...r,title:w.target.value})})]}),o.jsxs("label",{children:["Memory",o.jsx("textarea",{rows:8,value:r.content,onChange:w=>l({...r,content:w.target.value})})]}),o.jsx("div",{className:"memory-actions",children:["project","personal","global"].map(w=>o.jsx("button",{className:"press","aria-pressed":r.scope===w,onClick:()=>l({...r,scope:w}),children:w==="personal"?"About you":w==="global"?"General":"Work"},w))}),o.jsxs("label",{children:["Category",o.jsx("input",{value:r.memoryType,onChange:w=>l({...r,memoryType:w.target.value})})]}),o.jsxs("label",{children:["Topic (optional)",o.jsx("input",{value:r.topicKey,onChange:w=>l({...r,topicKey:w.target.value})})]}),s.error&&o.jsx("p",{role:"alert",className:"memory-error",children:s.error}),o.jsx(Ne,{disabled:s.busy||!r.title.trim()||!r.content.trim(),onClick:()=>{s.mutate("saveMemory",r).then(w=>{w&&l(null)})},children:s.busy?"Saving…":"Save"})]})]}),o.jsxs(ht,{open:h,onClose:()=>u(!1),width:620,children:[o.jsx(ut,{title:"Memory history"}),o.jsxs("div",{className:"memory-editor",children:[s.error&&o.jsx("p",{className:"memory-error",children:s.error}),s.detail?o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"memory-history",children:s.detail.history.result}),s.detail.history.history_cursor&&o.jsx("button",{className:"press",onClick:()=>{s.inspect(s.detail.fact,s.detail.history.history_cursor)},children:"Older versions"}),o.jsx("h4",{children:"Session timeline"}),o.jsx("pre",{className:"memory-history",children:s.detail.timeline.result})]}):o.jsx("p",{children:"Loading history…"})]})]}),o.jsxs(ht,{open:p!==null,onClose:()=>m(null),width:620,children:[o.jsx(ut,{title:p==="export"?"Export memories":"Import memories"}),o.jsxs("div",{className:"memory-editor",children:[o.jsx("p",{children:p==="export"?"Copy this Engram backup to keep or import your memories.":"Paste an Engram JSON backup. Import merges memories and preserves newer changes. A backup is saved first."}),o.jsx("textarea",{"aria-label":"Memory backup",rows:14,readOnly:p==="export",value:p==="export"?s.backup:g,onChange:w=>y(w.target.value)}),s.error&&o.jsx("p",{className:"memory-error",children:s.error}),p==="import"&&o.jsx(Ne,{disabled:s.busy||!g.trim(),onClick:()=>{s.import(g).then(w=>{w&&m(null)})},children:"Import"})]})]}),o.jsx(cs,{open:v,title:"Forget everything this bot remembers?",actions:[{title:"Forget everything",destructive:!0,action:()=>{s.mutate("clearMemory")}}],onClose:()=>x(!1)})]})}function j_({label:e,detail:t,children:s}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[o.jsx("span",{style:{color:"var(--text)"},children:e}),t?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),s]})}function j2({title:e,detail:t,on:s,onChange:r}){return o.jsx(ys,{on:s,onChange:r,children:o.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:3},children:[o.jsx("span",{style:{color:"var(--text)"},children:e}),t?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]})})}function Hp({value:e,onChange:t,placeholder:s,minRows:r,maxRows:l,className:h,onKeyDown:u}){const p=b.useRef(null);return b.useLayoutEffect(()=>{const m=p.current;if(!m)return;const g=getComputedStyle(m),y=parseFloat(g.lineHeight)||15,v=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom);m.style.height="0px",m.style.height=`${Math.min(Math.max(m.scrollHeight,y*r+v),y*l+v)}px`},[e,r,l]),o.jsx("textarea",{ref:p,rows:r,className:h,value:e,placeholder:s,onChange:m=>t(m.target.value),onKeyDown:u})}function Hk({bot:e,onRemove:t}){return o.jsxs("span",{className:"bot-chip",children:[o.jsx(hi,{bot:e,size:20,animated:!1}),o.jsx("span",{style:{...R("body"),color:"var(--text)",maxWidth:220,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),o.jsx("button",{style:{width:18,height:18,display:"grid",placeItems:"center"},"aria-label":`Remove ${e.name}`,title:`Remove ${e.name}`,onClick:t,children:o.jsx(se,{name:"xmark",size:10,weight:"semibold",color:"var(--secondary)"})})]})}function Ik({open:e,onClose:t,anchor:s,children:r}){const{mounted:l,shown:h}=Ps(e,120),[u,p]=b.useState(null);if(b.useLayoutEffect(()=>{e&&s.current&&p(s.current.getBoundingClientRect())},[e,s]),b.useEffect(()=>{if(!e)return;const S=w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),t())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[e,t]),!l||!u)return null;const m=window.innerWidth,g=window.innerHeight,y=g-u.bottom>=u.top,v=u.left+u.width/2<m*.6,x=Math.max(8,m-Math.min(320,m-16)-8);return lu.createPortal(o.jsx("div",{className:`anchored ${h?"shown":""}`,onMouseDown:S=>S.target===S.currentTarget&&t(),children:o.jsx("div",{className:"anchored-panel",style:{position:"absolute",[y?"top":"bottom"]:y?u.bottom+6:g-u.top+6,...v?{left:Math.min(Math.max(8,u.left),x)}:{right:Math.min(Math.max(8,m-u.right),x)},transformOrigin:`${y?"top":"bottom"} ${v?"left":"right"}`},children:r})}),document.body)}function Uk({draft:e}){const t=Ae(),s=Ki(),r=bw(t),l=!e.id,[h,u]=b.useState(()=>l?k2(t,e,{connectors:[],skills:[]}):e),[p,m]=b.useState(!1),[g,y]=b.useState(null),v=t.connection.kind==="online";b.useEffect(()=>{l&&r&&u(S=>k2(t,S,r))},[l,r,t]);const x=()=>{!C2(h)||p||!v||(m(!0),y(null),t.save(ww(h)).then(S=>{s(),l&&t.setSelection(S.id)}).catch(S=>y(Br(S))).finally(()=>m(!1)))};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:l?"New bot":"Settings",trailing:p?o.jsx($e,{}):o.jsx(be,{title:l?"Create":"Save",icon:"checkmark",disabled:!C2(h)||p||!v,onClick:x})}),o.jsx("div",{style:{flex:1,minHeight:0},children:o.jsx(Cw,{draft:h,onChange:u,error:g,plugins:r})})]})}function Pk({botId:e}){const t=Ae(),s=bw(t),[r,l]=b.useState(null),[h,u]=b.useState(null),p=b.useCallback(m=>l(g=>g&&m(g)),[]);return b.useEffect(()=>{const m=t.bots.get(e);l(m?Co(m):null)},[e]),b.useEffect(()=>{const m=t.bots.get(e);if(!r||!m||JSON.stringify(r)===JSON.stringify(Co(m))||!C2(r))return;const g=setTimeout(()=>{t.save(ww(r)).then(()=>u(null)).catch(y=>u(Br(y)))},600);return()=>clearTimeout(g)},[r]),r?o.jsx(Cw,{draft:r,onChange:p,error:h,plugins:s}):null}function Cw({draft:e,onChange:t,error:s,plugins:r}){const l=Ae(),[h,u]=b.useState(!1),[p,m]=b.useState(!1),[g,y]=b.useState(null),v=b.useRef(null),x=(A,N)=>t(L=>({...L,[A]:N})),S=b.useCallback(A=>t(N=>({...N,model:A})),[t]),w=l.hello?.backends??[],C=w.find(A=>A.id===e.backend),j=r?.connectors??[],E=r?.skills??[];return o.jsxs("div",{className:"bot-form",children:[o.jsxs("div",{className:"bot-form-content",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[o.jsx("button",{ref:v,className:"avatar-button",title:"Edit Bot avatar","aria-label":"Edit Bot avatar",onClick:()=>u(A=>!A),children:o.jsx(ci,{shape:e.avatarShape,color:e.avatarColor,size:56})}),o.jsx(Ik,{open:h,onClose:()=>u(!1),anchor:v,children:o.jsx("div",{style:{padding:14,width:300},children:o.jsx(qk,{shape:e.avatarShape,color:e.avatarColor,onShape:A=>x("avatarShape",A),onColor:A=>x("avatarColor",A)})})})]}),o.jsxs(ke,{title:"Profile",children:[e.id?o.jsx(j_,{label:"Name",children:o.jsx("input",{className:"field-box",value:e.name,placeholder:"Name",onChange:A=>x("name",A.target.value)})}):null,o.jsx(j_,{label:"Standing instructions",detail:"Rules that always apply. Put task-specific requests in the chat instead.",children:o.jsx(Hp,{className:"field-box",value:e.description,placeholder:"e.g. Reviews PRs. Never pushes without asking.",minRows:3,maxRows:8,onChange:A=>x("description",A)})})]}),o.jsxs(ke,{title:"Agent",children:[o.jsx(ei,{label:"Computer",children:o.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.hostName})}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsx(ei,{label:"Agent",children:o.jsx(_i,{selection:e.backend,options:[...w.map(A=>({id:A.id,label:A.available?A.name:`${A.name} (not installed)`})),{id:"custom",label:"Custom command"}],onChange:A=>x("backend",A)})}),C&&!C.available?o.jsx("span",{style:{...R("caption"),color:"var(--warning)"},children:C.installHint}):null,e.backend==="custom"?o.jsx("input",{className:"field-box fade-in",style:R("callout",void 0,"monospaced"),value:e.command??"",placeholder:"ACP command, e.g. my-agent --acp",spellCheck:!1,onChange:A=>x("command",A.target.value||null)}):null]}),o.jsx(Lk,{backend:e.backend,selection:e.model,onChange:S}),o.jsx(ei,{label:"Workspace",detail:e.cwd?"This project is the default starting folder. The bot can work elsewhere when you ask.":"This bot has its own space for files. It can work in other folders when you ask.",children:o.jsx(Ya,{title:e.cwd||"A persistent workspace allocated for this bot",items:()=>[{title:"Personal workspace",selected:!e.cwd,action:()=>x("cwd","")},{title:"Choose project folder…",selected:!!e.cwd,action:()=>m(!0)}],children:o.jsxs(zx,{outlined:!0,style:{gap:6,color:"var(--text)"},children:[o.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:160},children:e.cwd?Op(e.cwd):"Personal"}),o.jsx(se,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})})}),o.jsx(ei,{label:"Permissions",detail:e.permission==="auto"?"Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply.":"You'll get an approval card and a notification whenever the agent asks.",children:o.jsx(_i,{selection:e.permission,options:[{id:"ask",label:"Ask me"},{id:"auto",label:"Approve automatically"}],onChange:A=>x("permission",A)})})]}),o.jsxs(ke,{title:"Activity",children:[o.jsx(j2,{title:"Notifications",detail:"Get notified when this bot finishes or needs you",on:e.notify??!0,onChange:A=>x("notify",A)}),l.screen?o.jsx(j2,{title:"Use the computer",detail:l.screen.platform!=="windows"&&!(l.screen.enabled&&l.screen.connected&&l.screen.capture&&l.screen.input)?"Let this bot use apps. On that computer, open Codync → Settings → Computer access to set up permissions first.":l.screen.enabled?"Let this bot see the screen and use the mouse and keyboard. You can watch and take over from your phone.":l.screen.computerUse?"Let this bot see the screen and use the mouse and keyboard.":"Let this bot see the screen and use the mouse and keyboard. On that computer, open Codync → Settings → Computer access to set up permissions first.",on:e.computer??!1,onChange:A=>x("computer",A)}):null]}),o.jsx(E_,{title:"Connectors",empty:"No connectors yet. Add GitHub, Linear, Notion and more from Plugins.",items:j.map(A=>({id:A.id,name:A.name,detail:A.command??A.url??""})),selection:e.connectors??[],onChange:A=>x("connectors",A)}),o.jsx(E_,{title:"Skills",empty:"No skills yet. Get some from Plugins, or write your own.",items:E.map(A=>({id:A.id,name:A.name,detail:A.description})),selection:e.skills??[],onChange:A=>x("skills",A),onInfo:A=>y({id:A.id,name:A.name,description:A.detail})}),e.id?o.jsx(zk,{botId:e.id}):null,s?o.jsx("span",{className:"fade-in",style:{...R("footnote"),color:"var(--danger)"},children:s}):null]}),o.jsx(os,{open:g!==null,onClose:()=>y(null),children:g?o.jsx(zp,{skill:g},g.name):null}),o.jsx(ht,{open:p,onClose:()=>m(!1),width:460,height:520,children:o.jsx(Vk,{start:e.cwd||l.hello?.home||null,onPick:A=>{x("cwd",A),m(!1)}})})]})}function E_({title:e,empty:t,items:s,selection:r,onChange:l,onInfo:h}){return o.jsxs(ke,{title:e,children:[s.length?null:o.jsx("span",{style:{color:"var(--secondary)"},children:t}),s.map(u=>{const p=o.jsx(j2,{title:u.name,detail:u.detail||null,on:r.includes(u.id),onChange:m=>l([...r.filter(g=>g!==u.id),...m?[u.id]:[]])},u.id);return h?o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[o.jsx("div",{style:{flex:1,minWidth:0},children:p}),o.jsx(be,{title:`About ${u.name}`,icon:"info.circle",onClick:()=>h(u)})]},u.id):p})]})}function qk({shape:e,color:t,onShape:s,onColor:r}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[o.jsx("div",{className:"swatch-row",children:Nx.map(l=>o.jsx("button",{className:`swatch ${l===e?"on":""}`,"aria-label":`${l} shape`,"aria-pressed":l===e,onClick:()=>s(l),children:o.jsx(ci,{shape:l,color:t,size:36})},l))}),o.jsx("div",{className:"swatch-row",children:$h.map(l=>o.jsx("button",{className:`swatch ${l.id===t?"on":""}`,"aria-label":l.label,"aria-pressed":l.id===t,onClick:()=>r(l.id),children:o.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:l.hex,display:"block"}})},l.id))})]})}function Vk({start:e,onPick:t}){const[s,r]=b.useState([e]),[l,h]=b.useState(!0),u=s[s.length-1]??null;return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[s.length>1?o.jsx("div",{className:"fade-in",style:{paddingLeft:10,display:"flex"},children:o.jsx(be,{title:"Back",icon:"chevron.left",onClick:()=>{h(!1),r(p=>p.slice(0,-1))}})}):null,o.jsx("div",{style:{flex:1,minWidth:0},children:o.jsx(ut,{title:u?Op(u):"Folders"})})]}),o.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:o.jsx($k,{path:u,forward:l,onPick:t,onOpen:p=>{h(!0),r(m=>[...m,p])}},s.length)})]})}function $k({path:e,forward:t,onPick:s,onOpen:r}){const l=Ae(),[h,u]=b.useState(null),[p,m]=b.useState(null),[g,y]=b.useState("");b.useEffect(()=>{let x=!0;return l.listDirs(e).then(S=>x&&u(S)).catch(S=>x&&m(Br(S))),()=>{x=!1}},[l,e]);const v=h?.dirs.filter(x=>!g||x.name.toLowerCase().includes(g.toLowerCase()))??[];return o.jsx("div",{className:`bot-form level-slide ${t?"from-trailing":"from-leading"}`,children:o.jsxs("div",{className:"bot-form-content",style:{gap:14},children:[o.jsx(Ox,{value:g,onChange:y}),h?o.jsxs(o.Fragment,{children:[o.jsx(ke,{footer:h.path,children:o.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,...R("headline"),color:"var(--accent)"},onClick:()=>s(h.path),children:[o.jsx(se,{name:"checkmark.circle.fill",size:13}),o.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`Use “${Op(h.path)}”`})]})}),v.length?o.jsx(ke,{children:v.map(x=>o.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:10},onClick:()=>r(x.path),children:[o.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:o.jsx(se,{name:x.isGit?"arrow.triangle.branch":"folder",size:12,color:x.isGit?"var(--accent)":"var(--secondary)"})}),o.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:x.name}),o.jsx(se,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},x.path))}):null]}):p?o.jsx("span",{style:{color:"var(--danger)"},children:p}):o.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o.jsx($e,{size:20})})]})})}const Wk=e=>["pending","starting","running","recovering"].includes(e.status),Fk=()=>({kind:"cron",amount:"1",unit:3600,calendarStyle:"daily",weekday:1,selectedDays:[],monthDay:1,minuteStep:15,hour:9,minute:0,at:0,expression:"",zone:"",original:[]}),M_=(e,t)=>!!e&&!!t&&JSON.stringify(e)===JSON.stringify(t),Jn=e=>e instanceof Error?e.message:String(e);function Xn({label:e,detail:t,children:s}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[o.jsx("span",{style:{color:"var(--text)"},children:e}),t?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)",lineHeight:1.4},children:t}):null]}),s]})}function Kk({botId:e,routineId:t}){const s=Ae(),[r,l]=b.useState(null),[h,u]=b.useState(null),[p,m]=b.useState(!1),[g,y]=b.useState(null),[v,x]=b.useState(!1),[S,w]=b.useState(!1),C=async A=>{w(A);try{const N=await(await s.ready()).call("routineWebhook",{botId:e,id:t,rotate:A});l(N),A&&(y(null),m(!0)),u(null)}catch(N){u(Jn(N))}finally{w(!1)}};b.useEffect(()=>{C(!1)},[t]);const j=(A,N,L)=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 6px 8px 12px",background:"var(--bubble-user)",borderRadius:12},children:[o.jsx("span",{style:{...R("callout",void 0,"monospaced"),flex:1,minWidth:0,userSelect:"text",wordBreak:"break-all",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:A}),L,o.jsx(be,{title:g===N?"Copied":"Copy",icon:g===N?"checkmark":"doc.on.doc",onClick:()=>{r&&(window.codync.app.copy(N==="key"?r.key:r.url??r.localUrl),y(N))}})]}),E={...R("caption"),paddingLeft:4,lineHeight:1.4};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[r?o.jsxs(o.Fragment,{children:[o.jsx(Xn,{label:r.url?"URL":"Local URL",children:j(r.url??r.localUrl,"url")}),o.jsx(Xn,{label:"Key",children:j(p?r.key:"•".repeat(16),"key",o.jsxs(o.Fragment,{children:[o.jsx(be,{title:p?"Hide key":"Show key",icon:p?"eye.slash":"eye",onClick:()=>m(A=>!A)}),o.jsx(be,{title:"Replace key",icon:"arrow.triangle.2.circlepath",disabled:S||s.isOffline,onClick:()=>x(!0)})]}))}),o.jsx("span",{style:{...E,color:"var(--secondary)"},children:r.url?"POST with Authorization: Bearer <key>. For GitHub, use content type application/json and the key as the secret. Deliveries wait up to 72 hours while this computer is off. They pass through the Codync cloud, which can read them.":"The Codync cloud is off, so only this computer can send to it."})]}):h?o.jsx("span",{style:{...E,color:"var(--danger)"},children:h}):o.jsx("span",{style:{...E,color:"var(--secondary)"},children:"Loading webhook…"}),o.jsx(cs,{open:v,title:"Replace the key?",message:"Senders using the current key stop working until they get the new one.",actions:[{title:"Replace key",destructive:!0,action:()=>{C(!0)}}],onClose:()=>x(!1)})]})}const p0={...R("caption"),paddingLeft:4,lineHeight:1.4};function Yk({botId:e,routine:t,saved:s}){const r=Ae(),[l,h]=b.useState(t?.name??""),[u,p]=b.useState(t?.instruction??""),[m,g]=b.useState(Fk),[y,v]=b.useState(String(t?.timeoutSeconds??3600)),[x,S]=b.useState(!1),[w,C]=b.useState(null),[j,E]=b.useState(!1),[A,N]=b.useState(!1),[L,q]=b.useState(null),[B,I]=b.useState(null),[U,P]=b.useState(null),[F,$]=b.useState(!1),[z,O]=b.useState(!1),M=b.useRef(m);M.current=m;const X=t?t.triggers.length===1?!["cron","webhook"].includes(t.triggers[0].type):t.triggers.length>0:!1,V=[...t&&X?[{id:"keep",label:t.triggerDescriptions.join(" · ")}]:[],{id:"cron",label:"Schedule"},{id:"webhook",label:"Webhook"}],ie=!!l.trim()&&!!u.trim()&&!r.isOffline&&!x&&A&&M_(U,m)&&B===null,ee=async()=>{try{const le=await(await r.ready()).call("routineSchedule",{triggers:t?.triggers??[],timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}),he={...le.draft,calendarStyle:"custom"};["cron","webhook"].includes(he.kind)||(he.kind="keep"),g(he),q(le),P(le.draft),N(!0),C(null)}catch(J){C(Jn(J))}},ce=async()=>{const J=M.current;q(null),I(null),P(null);try{const le=await(await r.ready()).call("routineSchedule",{draft:J});if(M.current!==J)return;q(le),P(J)}catch(le){if(M.current!==J)return;I(Jn(le))}};b.useEffect(()=>{ee()},[]),b.useEffect(()=>{if(!A)return;const J=setTimeout(()=>{ce()},300);return()=>clearTimeout(J)},[m]);const Y=async()=>{if(ie){document.activeElement?.blur(),S(!0),C(null);try{const le=await(await r.ready()).call("saveRoutine",{botId:e,id:t?.id??null,name:l,instruction:u,schedule:m,timeoutSeconds:y});s(le.routine)}catch(J){C(Jn(J))}finally{S(!1)}}},oe=b.useRef(Y);oe.current=Y,b.useEffect(()=>{const J=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),oe.current())};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[]);const xe=J=>g(le=>({...le,...J})),we=M_(U,m)?L:null,D=()=>{switch(m.kind){case"cron":return o.jsxs("div",{className:"routine-cron",style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsxs("div",{className:"routine-cron-fields",children:[o.jsx(Xn,{label:"Cron",children:o.jsx("input",{className:"routine-input",style:R("body",void 0,"monospaced"),value:m.expression,placeholder:"0 9 * * 1-5",spellCheck:!1,autoCorrect:"off",onChange:J=>xe({expression:J.target.value})})}),o.jsx(Xn,{label:"Time zone",children:o.jsx("input",{className:"routine-input",value:m.zone,placeholder:"Asia/Taipei",spellCheck:!1,autoCorrect:"off",onChange:J=>xe({zone:J.target.value})})})]}),o.jsx("div",{style:{paddingLeft:4},children:B?o.jsx("span",{style:{...R("caption"),color:"var(--danger)",lineHeight:1.4},children:B}):we?o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[o.jsx("span",{style:R("caption","medium"),children:we.summary}),we.nextRunAt?o.jsxs("span",{style:{...R("caption"),color:"var(--secondary)"},children:["Next ",new Date(we.nextRunAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})]}):null,we.warning?o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:we.warning}):null]}):o.jsx("span",{style:{...R("caption",void 0,"monospaced"),color:"var(--tertiary)",whiteSpace:"pre"},children:"minute hour day month weekday"})})]});case"webhook":return t&&t.triggers.some(J=>J.type==="webhook"||J.type==="event")?o.jsx(Kk,{botId:e,routineId:t.id}):o.jsx("span",{style:{...p0,color:"var(--secondary)"},children:"Runs each time something is posted to its URL. Save to get the URL and key."});default:return o.jsx("span",{style:{...p0,color:"var(--secondary)"},children:"Set up by the bot. Pick Schedule or Webhook to replace it."})}};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",maxHeight:700,minHeight:0,background:"var(--background)",color:"var(--text)",...R(13)},children:[o.jsx(ut,{title:t?"Edit routine":"Set up a routine"}),o.jsx("fieldset",{className:"routine-form",disabled:x||!A,style:{flex:"1 1 auto",minHeight:0,overflowY:"auto"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,padding:20},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[o.jsx(Xn,{label:"Name",children:o.jsx("input",{className:"routine-input",value:l,placeholder:"e.g. Morning summary",onChange:J=>h(J.target.value)})}),o.jsx(Xn,{label:"Instruction",children:o.jsx("textarea",{className:"routine-input",value:u,placeholder:"Describe what this bot should do each time it runs.",onChange:J=>p(J.target.value)})})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[o.jsx(Xn,{label:"When to run",children:o.jsx(_i,{selection:m.kind,options:V,onChange:J=>xe({kind:J}),fits:!0})}),A?D():o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--secondary)"},children:[o.jsx(se,{name:"clock",size:12}),"Loading schedule…"]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[o.jsxs("button",{className:"press","aria-expanded":j,onClick:()=>E(J=>!J),style:{display:"flex",alignItems:"center",gap:6,paddingLeft:4,...R("compactSecondary"),color:"var(--secondary)",width:"100%"},children:["Run settings",o.jsx("span",{style:{display:"flex",transform:`rotate(${j?180:0}deg)`,transition:"transform var(--layout)"},children:o.jsx(se,{name:"chevron.down",size:10,weight:"semibold"})}),o.jsx("span",{style:{flex:1}}),j?null:o.jsxs("span",{style:{color:"var(--tertiary)"},children:["Timeout ",y,"s"]})]}),j?o.jsxs("div",{className:"routine-fade",style:{display:"flex",flexDirection:"column",gap:12},children:[o.jsx(Xn,{label:"Timeout (seconds)",children:o.jsx("input",{className:"routine-input",value:y,placeholder:"3600",onChange:J=>v(J.target.value)})}),o.jsx("span",{style:{...p0,color:"var(--secondary)"},children:"A run is stopped after this long. 1 second to 24 hours."})]}):null]})]})}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:20,flex:"none"},children:[B!==null?o.jsx("button",{className:"press",style:{alignSelf:"flex-start"},disabled:r.isOffline,onClick:()=>{ce()},children:"Check schedule again"}):null,!A&&w!==null?o.jsx("button",{className:"press",style:{alignSelf:"flex-start"},onClick:()=>{ee()},children:"Retry loading schedule"}):null,m.kind!=="cron"&&B?o.jsx("span",{style:{...R("caption"),color:"var(--danger)"},children:B}):null,w?o.jsxs("span",{style:{display:"flex",gap:6,alignItems:"flex-start",...R("callout"),color:"var(--danger)",userSelect:"text"},children:[o.jsx(se,{name:"exclamationmark.circle",size:12,style:{marginTop:1}}),w]}):null,r.isOffline?o.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center",...R("caption"),color:"var(--danger)"},children:[o.jsx(se,{name:"wifi.slash",size:10}),"Connect to this computer to save your routine."]}):null,o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[t?o.jsxs(o.Fragment,{children:[o.jsx(be,{title:"Delete routine",icon:"trash",onClick:()=>$(!0)}),o.jsx(be,{title:z?"Started":"Test run",icon:z?"checkmark":"play.circle",disabled:z||r.isOffline,onClick:async()=>{try{await(await r.ready()).call("runRoutine",{botId:e,id:t.id}),O(!0)}catch(J){C(Jn(J))}}})]}):null,o.jsx("span",{style:{flex:1}}),o.jsxs(Ne,{disabled:!ie,onClick:()=>{Y()},title:"Save (⌘S)",children:[x?o.jsx($e,{size:12}):null,x?"Saving…":t?"Save changes":"Create routine"]})]})]}),o.jsx(cs,{open:F,title:"Delete routine?",message:"This deletes the routine and stops its future runs. This can't be undone.",actions:[{title:"Delete routine",destructive:!0,action:async()=>{if(t)try{await(await r.ready()).call("deleteRoutine",{botId:e,id:t.id}),s(null)}catch(J){C(Jn(J))}}}],onClose:()=>$(!1)})]})}function A_(e){switch(e.status){case"pending":return"Queued";case"starting":return"Starting";case"running":return"Running";case"recovering":return"Resuming after restart";case"failed":return"Failed";case"interrupted":return"Interrupted";default:return e.status.charAt(0).toUpperCase()+e.status.slice(1)}}function Gk({botId:e,initialId:t,onClose:s}){const r=Ae(),[l,h]=b.useState([]),[u,p]=b.useState([]),[m,g]=b.useState(null),[y,v]=b.useState(!1),[x,S]=b.useState(!1),[w,C]=b.useState(null),[j,E]=b.useState(null),A=b.useRef(e);A.current=e;const N=F=>g({id:crypto.randomUUID(),routineId:F}),L=async()=>{const F=e;try{const $=await(await r.ready()).call("routines",{botId:F});if(A.current!==F)return;h($.routines),p($.runs),v(!0),E(null)}catch($){A.current===F&&E(Jn($))}};b.useEffect(()=>{t&&N(t)},[t]),b.useEffect(()=>{h([]),p([]),v(!1);let F=!1,$;const z=async()=>{await L(),F||($=setTimeout(z,3e3))};return z(),()=>{F=!0,clearTimeout($)}},[e]);const q=async(F,$,z)=>{if(!x){S(!0);try{await(await r.ready()).call(F,{botId:e,id:$.id,enabled:z??null}),C(null),await L()}catch(O){C(Jn(O))}finally{S(!1)}}},B=F=>{const $=u.find(O=>O.routineId===F.id&&Wk(O));if($)return A_($);if(F.lastError)return"Schedule needs attention";const z=u.find(O=>O.routineId===F.id);return z&&["failed","interrupted"].includes(z.status)?`Last run ${A_(z).toLowerCase()}`:F.triggerDescriptions.join(" · ")},I=(F,$)=>{$&&h(z=>z.some(O=>O.id===$.id)?z.map(O=>O.id===$.id?$:O):[...z,$]),F.routineId===null&&$&&$.triggers.some(z=>z.type==="webhook")?g({id:F.id,routineId:$.id}):g(null),L()},U=l.find(F=>F.id===m?.routineId)??null,P={background:"var(--surface)",borderRadius:16};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:s?16:10,color:"var(--text)",...R(13)},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o.jsx("span",{style:{...R(13,"semibold"),paddingLeft:2},children:"Routines"}),o.jsx("span",{style:{flex:1}}),o.jsx(be,{title:"Ask the bot for a routine",icon:"text.bubble",disabled:r.isOffline,onClick:()=>{r.setRoutineDraft(e,"I want a routine that "),s?.()}}),o.jsx(be,{title:"Set up a routine",icon:"plus",disabled:r.isOffline,onClick:()=>N(null)}),s?o.jsx(be,{title:"Close routines",icon:"xmark",onClick:s}):null]}),j?o.jsx("span",{style:{...R("caption"),color:"var(--danger)"},children:j}):null,w?o.jsx("span",{style:{...R("caption"),color:"var(--danger)",userSelect:"text"},children:w}):null,l.length===0?o.jsx("div",{style:{...P,...R(12),lineHeight:1.45,color:"var(--secondary)",padding:14},children:y?"No routines yet. Ask the bot for one, or set it up yourself with +.":"Loading routines…"}):o.jsx("div",{style:{...P,padding:"0 14px"},children:l.map((F,$)=>o.jsxs(b.Fragment,{children:[$>0?o.jsx(Z8,{}):null,o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[o.jsxs("button",{className:"routine-row",onClick:()=>N(F.id),children:[o.jsx("span",{style:{color:"var(--text)"},children:F.name}),o.jsx("span",{style:{...R("caption"),color:F.lastError?"var(--danger)":"var(--secondary)"},children:B(F)})]}),o.jsx("span",{"aria-label":F.name,style:{display:"flex"},children:o.jsx(ys,{on:F.enabled,disabled:x||r.isOffline,onChange:z=>{q("setRoutineEnabled",F,z)}})})]})]},F.id))}),o.jsx(ht,{open:m!==null&&(m.routineId===null||U!==null),onClose:()=>g(null),width:540,children:m?o.jsx(Yk,{botId:e,routine:U,saved:F=>I(m,F)},m.id):null})]})}function Ip({title:e,icon:t,onClick:s,direction:r=[0,0],size:l=32,className:h}){return o.jsx("button",{className:`mac-chat-button ${h??""}`,title:e,"aria-label":e,onClick:s,style:{width:l,height:l,"--dx":r[0],"--dy":r[1]},children:o.jsx(se,{name:t,size:l/2,weight:"medium"})})}const T_=window.codync.platform==="darwin";function Zk({botId:e,routineId:t,editing:s,setEditing:r,editGroup:l,share:h,close:u}){const m=Ae().bots.get(e)??null,[g,y]=b.useState(!1);let v;return s?v=o.jsxs(o.Fragment,{children:[o.jsx(_h,{label:"Back to details",symbol:"chevron.left",action:()=>{y(!0),r(!1)}}),o.jsx(m0,{children:"Settings"}),o.jsx("span",{style:{flex:1}})]}):m&&ft(m)?v=o.jsxs(o.Fragment,{children:[o.jsx(m0,{children:"Members"}),o.jsx("span",{style:{...R(13),color:"var(--tertiary)",flex:1},children:m.members.length})]}):v=o.jsxs(o.Fragment,{children:[o.jsx(m0,{children:"Details"}),o.jsx("span",{style:{flex:1}}),o.jsx(_h,{label:"Create template",symbol:"square.and.arrow.up",action:h}),o.jsx(_h,{label:"Bot settings",symbol:"gearshape",action:()=>r(!0)})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:54,padding:"0 12px",flex:"none"},children:[v,o.jsx(_h,{label:"Close details",symbol:"chevron.right.2",action:u})]}),o.jsx("div",{style:{flex:1,minHeight:0,position:"relative",overflow:"hidden"},children:m&&ft(m)?o.jsx(Xk,{group:m,editGroup:l}):s?o.jsx("div",{className:"panel-slide from-trailing",style:{height:"100%"},children:o.jsx(Pk,{botId:e})}):o.jsx("div",{className:g?"panel-slide from-leading":void 0,style:{height:"100%",overflowY:"auto"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28,padding:"4px 16px 24px"},children:[o.jsx(Qk,{botId:e}),o.jsx(Gk,{botId:e,initialId:t}),m?o.jsx(Jk,{bot:m}):null]})})})]})}function m0({children:e}){return o.jsx("span",{style:{...R(15,"semibold"),color:"var(--text)",paddingLeft:4},children:e})}function _h({label:e,symbol:t,action:s}){return o.jsx(Ip,{title:e,icon:t,direction:t==="chevron.right.2"?[1,0]:[0,0],onClick:s})}function Xk({group:e,editGroup:t}){const s=Ae();return o.jsxs("div",{style:{height:"100%",overflowY:"auto",padding:"0 20px"},children:[s.members(e).map(r=>o.jsxs("div",{className:"member-row removable",children:[o.jsxs("button",{className:"member-open press",title:`Open ${r.name}'s own chat`,onClick:()=>s.setSelection(r.id),children:[o.jsx(hi,{bot:r,size:32}),o.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0,flex:1},children:[o.jsx("span",{className:"member-name",children:r.name}),mn(r)?o.jsx("span",{className:"member-name",style:{...R("compactSecondary"),color:"var(--secondary)"},children:r.activity||"Working…"}):null]})]}),e.members.length>1?o.jsx(be,{title:`Remove ${r.name} from the group`,icon:"xmark",onClick:()=>s.removeMember(e,r.id)}):null]},r.id)),o.jsxs("button",{className:"member-row press",onClick:t,children:[o.jsx("span",{style:{width:32,display:"grid",placeItems:"center"},children:o.jsx(se,{name:"plus",size:16,color:"var(--secondary)"})}),o.jsx("span",{className:"member-name",style:{color:"var(--secondary)"},children:"Add Member"})]})]})}function Qk({botId:e}){const t=Ae(),s=t.screen,r=!t.isOffline&&!!s?.enabled&&s.connected&&s.capture,l=s?.enabled?s.connected?s.capture?s.agentBot===e?"cursorarrow.motionlines":"checkmark.circle":"exclamationmark.circle":"arrow.triangle.2.circlepath":"power",h=s?.enabled?s.connected?s.capture?s.agentBot===e?`This bot is using your ${T_?"Mac":"computer"}`:"Ready to connect":"Screen recording permission needed":"Connecting to computer…":"Remote screen is off";return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:16,background:"var(--surface)",borderRadius:16},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[o.jsx(Lr,{computer:t.computer,size:32}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[o.jsx("span",{style:{...R(15,"medium"),color:"var(--text)",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:t.hostName}),o.jsx("span",{style:{...R(13),color:"var(--secondary)"},children:"Remote screen"})]})]}),t.isOffline?null:o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...R(13),color:"var(--text)"},children:[o.jsx(se,{name:l,size:13}),h]}),r?o.jsxs("div",{style:{...R(12),color:"var(--secondary)",marginTop:-8},children:["View and control this ",T_?"Mac":"computer"," from your iPhone."]}):null]})}function g0({label:e,children:t,title:s}){return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,...R(13)},children:[o.jsx("span",{style:{color:"var(--secondary)"},children:e}),o.jsx("span",{style:{flex:1,minWidth:8}}),o.jsx("span",{title:s,style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:6,minWidth:0},children:t})]})}function Jk({bot:e}){const t=Ae();return o.jsxs(ke,{title:"Agent",footer:e.description||null,children:[o.jsxs(g0,{label:"Runtime",children:[o.jsx(xw,{registry:t.hello?.backends.find(s=>s.id===e.backend)?.registry,size:14}),o.jsx("span",{children:t.backendName(e.backend)})]}),o.jsx(g0,{label:e.managedWorkspace?"Workspace":"Folder",title:e.managedWorkspace?"Personal workspace, managed by Codync":e.cwd,children:e.managedWorkspace?"Personal":ru(e)}),e.model?o.jsx(g0,{label:"Model",children:e.model}):null]})}function kw({botId:e,thread:t=null}){const s=Ae(),r=new Map;for(const u of s.allEntries(e))(u.threadId??null)===t&&r.set(u.turn,[...r.get(u.turn)??[],u]);const l=[...r.entries()].sort((u,p)=>u[0]-p[0]),h=b.useRef(null);return b.useLayoutEffect(()=>{const u=h.current;u&&(u.scrollTop=u.scrollHeight)},[]),o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:"Full conversation"}),o.jsx("div",{ref:h,style:{flex:1,overflowY:"auto"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,padding:14,fontSize:"calc(12px * var(--scale))"},children:[l.length===0?o.jsx("span",{style:{color:"var(--tertiary)"},children:"Nothing yet."}):null,l.map(([u,p])=>o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsx("div",{style:{...R("compactSecondary","semibold"),color:"var(--text)",paddingLeft:4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.find(m=>m.kind==="user")?.data.text??`Turn ${u}`}),o.jsx(ke,{children:p.map(m=>o.jsx(ej,{entry:m},m.id))})]},u))]})})]})}function xh({icon:e,children:t,style:s}){return o.jsxs("span",{style:{display:"flex",alignItems:"flex-start",gap:6,...s},children:[o.jsx("span",{style:{display:"flex",alignItems:"center",minHeight:"1.25em"},children:e}),o.jsx("span",{style:{minWidth:0},children:t})]})}function ej({entry:e}){const[t,s]=b.useState(!1),r=e.data;switch(e.kind){case"user":return o.jsx(xh,{icon:o.jsx(se,{name:"person.fill",size:11,color:"var(--secondary)"}),style:R("subheadline"),children:o.jsx("span",{style:{color:"var(--text)"},children:r.text??""})});case"agent":return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsx("span",{style:{...R("caption2","semibold"),color:"var(--tertiary)"},children:r.final?"Reply":"Said"}),o.jsx(ou,{text:r.text??""})]});case"thought":return o.jsx(wp,{expanded:t,onToggle:()=>s(l=>!l),label:o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...R("subheadline"),color:"var(--secondary)"},children:[o.jsx(xs,{size:16,color:"var(--secondary)",animated:!1}),"Thinking"]}),children:o.jsx("div",{className:"selectable",style:{...R("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:r.text??""})});case"tool":return o.jsx(ij,{data:r});case"plan":return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[o.jsx(xh,{icon:o.jsx(se,{name:"checklist",size:11,weight:"bold"}),style:R("subheadline","bold"),children:"Plan"}),(r.entries??[]).map((l,h)=>o.jsx(xh,{style:R("footnote"),icon:o.jsx(se,{name:l.status==="completed"?"checkmark.circle.fill":l.status==="in_progress"?"circle.dotted":"circle",size:10,color:l.status==="completed"?"var(--accent)":"var(--tertiary)"}),children:o.jsx("span",{style:{color:"var(--text)",textDecoration:l.status==="completed"?"line-through":void 0},children:l.content})},h))]});case"permission":return o.jsx(xh,{icon:o.jsx(se,{name:"hand.raised",size:11}),style:{...R("subheadline"),color:"var(--secondary)"},children:r.title??"Approval"});default:return o.jsx("span",{style:{...R("footnote"),color:"var(--tertiary)"},children:r.text??""})}}const tj=e=>({read:"doc.text",edit:"pencil",delete:"trash",move:"arrow.right.doc.on.clipboard",search:"magnifyingglass",execute:"terminal",think:"brain",fetch:"globe"})[e??""]??"wrench.and.screwdriver";function ij({data:e}){const[t,s]=b.useState(!1),r=!!e.output||!!e.diffs?.length,l=o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8,...R("caption"),flex:1,minWidth:0},children:[o.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:o.jsx(se,{name:tj(e.toolKind),size:10})}),o.jsx("span",{style:{...R("subheadline"),color:"var(--text)",flex:1,minWidth:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.title??"Tool"}),e.status==="completed"?o.jsx(se,{name:"checkmark",size:10,color:"var(--accent)"}):e.status==="failed"?o.jsx(se,{name:"xmark",size:10,color:"var(--danger)"}):o.jsx(xs,{state:e.toolKind==="search"?"searching":e.toolKind==="fetch"?"connecting":"working",size:16,color:"var(--secondary)"})]});return r?o.jsx(wp,{expanded:t,onToggle:()=>s(h=>!h),label:l,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(e.diffs??[]).map((h,u)=>o.jsx(rw,{diff:h},u)),e.output?o.jsx(p2,{text:e.output}):null]})}):l}function jw(e,t,s){const r=b.useId(),l=e.connection.kind;b.useEffect(()=>{const h=()=>e.setReading(r,t,s,document.visibilityState==="visible"&&document.hasFocus());return h(),window.addEventListener("focus",h),window.addEventListener("blur",h),document.addEventListener("visibilitychange",h),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",h),document.removeEventListener("visibilitychange",h),e.setReading(r,t,s,!1)}},[e,r,t,s,l])}function N_({botId:e,rootId:t,close:s}){const r=Ae(),l=r.bots.get(e)??null,h=r.allEntries(e).find(w=>w.id===t),u=r.replies(e,t),p=!!l&&pp(l,e,t)&&!r.isOffline,m=d2(u),g=Jx([...m.map(w=>w.id),...p?["working"]:[]],!0),[y,v]=b.useState(!1),x=b.useRef(null);jw(r,e,t),b.useEffect(()=>{r.loadThread(e,t)},[r,e,t]),b.useLayoutEffect(()=>{const w=x.current;w&&(w.scrollTop=w.scrollHeight)},[u.length,u[u.length-1]?.data.text,p]);const S=()=>v(!0);return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:48,padding:"0 10px 0 16px",flex:"none"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[o.jsx("span",{style:{...R("compactBody","semibold"),color:"var(--text)"},children:"Thread"}),o.jsx("span",{style:{...R("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l?.name??""})]}),o.jsx(be,{title:"Close thread",icon:"xmark",onClick:s})]}),o.jsx("div",{style:{height:.5,background:"var(--border)",flex:"none"}}),o.jsx("div",{ref:x,style:{flex:1,overflowY:"auto"},children:o.jsxs("div",{style:{padding:"8px 16px 0"},children:[h?o.jsxs(o.Fragment,{children:[o.jsx(S2,{entry:h,groupStart:!0,chat:l,openTrace:S}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 0"},children:[o.jsx("span",{style:{...R("caption"),color:"var(--tertiary)",whiteSpace:"nowrap"},children:sj(h.data.thread?.count??0)}),o.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]})]}):null,m.map(w=>w.kind==="entry"?o.jsx("div",{className:g.has(w.id)?ew(w):void 0,children:o.jsx(S2,{entry:w.entry,groupStart:w.groupStart,chat:l,openTrace:S})},w.id):null),l&&p?o.jsx("div",{className:g.has("working")?"row-in":void 0,style:{paddingTop:6},children:o.jsx(gw,{bot:l,thinking:r.currentThinking(e,t)})}):null,o.jsx("div",{style:{height:8}})]})}),o.jsx("div",{style:{flex:"none"},children:r.mismatch?o.jsx("div",{style:{padding:"0 16px 8px"},children:o.jsx(Ep,{})}):o.jsx(_w,{botId:e,thread:t})}),o.jsx(ht,{open:y,onClose:()=>v(!1),width:620,height:560,children:o.jsx(kw,{botId:e,thread:t})})]})}function sj(e){return e===0?"No replies yet":e===1?"1 reply":`${e} replies`}function nj({group:e,members:t=[]}){const s=Ae(),r=Ki(),l=e?.id??null,[h,u]=b.useState(e?.name??""),[p,m]=b.useState(e?.description??""),[g,y]=b.useState(e?.members??t),[v,x]=b.useState(""),[S,w]=b.useState(e===null&&t.length===0),[C,j]=b.useState(!1),[E,A]=b.useState(null),[N,L]=b.useState(null),q=g.map(M=>s.bots.get(M)).filter(M=>!!M),B=v.trim().toLowerCase(),I=s.roster.filter(M=>!ft(M)&&!g.includes(M.id)&&(!B||M.name.toLowerCase().includes(B))),U=l===null,P=g.length>0&&!C,F=q.length?q.map(M=>M.name).join(", "):"Name",$=l?s.bots.get(l):void 0,z=M=>{y(X=>X.includes(M)?X.filter(V=>V!==M):[...X,M]),x("")},O=()=>{j(!0),A(null);const X=h.trim()||F,V=p.trim(),ie=l?s.updateGroup({id:l,kind:"group",name:X,description:V,members:g,pinned:s.bots.get(l)?.pinned}):s.createGroup(X,V,g);Promise.resolve(ie).then(()=>r()).catch(ee=>A(Br(ee))).finally(()=>j(!1))};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:U?"New group chat":"Group chat",trailing:C?o.jsx($e,{}):o.jsx(be,{title:U?"Create":"Save",icon:"checkmark",disabled:!P,onClick:O})}),o.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto"},children:o.jsxs("div",{className:"group-form",children:[o.jsxs("div",{className:"group-identity",children:[o.jsx(No,{members:q,size:84}),o.jsx("input",{className:"group-name",value:h,placeholder:F,"aria-label":"Name",onChange:M=>u(M.target.value)}),o.jsx(Hp,{className:"group-about",value:p,placeholder:"What this group works on",minRows:1,maxRows:4,onChange:m})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[o.jsx("div",{className:"group-section-title",children:"Members"}),q.map(M=>o.jsxs("div",{className:"member-row fade-in",children:[o.jsx(hi,{bot:M,size:32,animated:!1}),o.jsx("span",{className:"member-name",children:M.name}),o.jsx(be,{title:`Remove ${M.name}`,icon:"xmark",onClick:()=>z(M.id)})]},M.id)),S?o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"field-box fade-in",style:{margin:"6px 0",background:"var(--surface)"},autoFocus:!0,value:v,placeholder:"Search bots",onChange:M=>x(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.nativeEvent.isComposing&&I[0]&&z(I[0].id),M.key==="Escape"&&w(!1)}}),I.map(M=>o.jsxs("button",{className:"member-row press fade-in","aria-label":`Add ${M.name}`,onClick:()=>z(M.id),children:[o.jsx(hi,{bot:M,size:32,animated:!1}),o.jsx("span",{className:"member-name",style:{color:"var(--secondary)"},children:M.name}),o.jsx(se,{name:"plus.circle",size:18,color:"var(--secondary)"})]},M.id))]}):I.length?o.jsxs("button",{className:"member-row press",onClick:()=>w(!0),children:[o.jsx("span",{style:{width:32,display:"grid",placeItems:"center"},children:o.jsx(se,{name:"plus",size:16,color:"var(--secondary)"})}),o.jsx("span",{className:"member-name",style:{color:"var(--secondary)"},children:"Add Member"})]}):null,o.jsx("div",{style:{...R("caption"),color:"var(--tertiary)",padding:"10px 0 0"},children:"Everyone answers in turn unless you @mention someone."})]}),E?o.jsx("span",{className:"fade-in",style:{...R("footnote"),color:"var(--danger)"},children:E}):null,$?o.jsx("button",{className:"press",style:{...R("body"),color:"var(--danger)",alignSelf:"flex-start"},onClick:()=>L($),children:"Delete group chat"}):null]})}),o.jsx(rj,{bot:N,onClose:()=>L(null),onDeleted:r})]})}function rj({bot:e,onClose:t,onDeleted:s}){const r=Ae();return o.jsx(cs,{open:e!==null,title:`Delete ${e?.name??"bot"}?`,message:e&&ft(e)?"Its bots and their own chats stay.":"Files it changed on your computer stay as they are.",actions:[{title:"Delete bot and its conversation",destructive:!0,action:()=>{e&&r.delete(e),s()}}],onClose:t})}function aj(e){const{id:t,pinned:s,hidden:r,...l}=e,h=Object.fromEntries(Object.entries(l).filter(([,u])=>u!=null).sort(([u],[p])=>u<p?-1:u>p?1:0));return JSON.stringify(h,null,2).replace(/^(\s*"(?:[^"\\]|\\.)*"): /gm,"$1 : ")}function lj({draft:e}){const t=b.useMemo(()=>aj(e),[e]),[s,r]=b.useState(!1),l=()=>{navigator.clipboard.writeText(t).then(()=>r(!0))};return b.useEffect(()=>{const h=u=>{u.key==="Enter"&&!u.isComposing&&(u.preventDefault(),l())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)}),o.jsxs("div",{style:{width:560,height:540,display:"flex",flexDirection:"column",background:"var(--background)"},children:[o.jsx(ut,{title:"Create template"}),o.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",gap:20,padding:"0 24px 24px"},children:[o.jsx("span",{style:{...R("subheadline"),color:"var(--secondary)"},children:e.name}),o.jsx("span",{style:{...R("callout"),color:"var(--secondary)"},children:"Copy this bot’s settings to reuse as a template. Conversation history and conversation ID are excluded."}),o.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",background:"var(--surface)",borderRadius:12},children:o.jsx("pre",{className:"selectable",style:{...R(12,"regular","monospaced"),margin:0,padding:16,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx("span",{style:{...R("caption"),color:"var(--secondary)",flex:1},children:"Includes workspace preferences and agent configuration."}),o.jsxs("button",{className:"press",style:{...R(13,"semibold"),display:"flex",alignItems:"center",gap:6,padding:"9px 14px",color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:9},onClick:l,children:[o.jsx(se,{name:s?"checkmark":"square.on.square",size:13,weight:"semibold",className:"fade-in"},s?"checkmark":"square.on.square"),s?"Copied":"Copy template"]})]})]})]})}const oj=["openai","gemini"],ir={openai:{name:"OpenAI",keyPage:"https://platform.openai.com/api-keys",keyPrompt:"sk-…",defaults:{realtime:"gpt-realtime-2.1",transcribe:"gpt-transcribe",speech:"gpt-4o-mini-tts"},voices:["marin","cedar","alloy","ash","ballad","coral","echo","sage","shimmer","verse"]},gemini:{name:"Gemini",keyPage:"https://aistudio.google.com/apikey",keyPrompt:"AIza…",defaults:{realtime:"gemini-3.8-live",transcribe:"gemini-3.8-flash",speech:"gemini-3.8-flash-tts"},voices:["Kore","Puck","Charon","Fenrir","Aoede","Leda","Orus","Zephyr"]}},Ew=e=>e==="openai"||e==="gemini",v0=(e,t)=>e.providers.some(s=>s.provider===t&&s.configured),Mw=Bt("callEngine","device"),Aw=.5,Tw=Bt("callRate",Aw),E2=Bt("callPause",1.5),Nw=Bt("callLanguage","");function cj(e){const t=new Intl.DisplayNames([navigator.language],{type:"language"}),s=r=>{try{return t.of(r.replace("_","-"))??r}catch{return r}};return[{id:"",label:"System"},...e.map(r=>({id:r,label:s(r)})).sort((r,l)=>r.label.localeCompare(l.label))]}const y0=new Map;function fn(e,t){return y0.has(e)||y0.set(e,Bt(e,t)),y0.get(e)}const Up=e=>fn(`callMode.${e}`,"realtime"),Dw=e=>fn(`callVoice.${e}`,null),Rw=e=>fn(`callDefaults.${e}`,null),D_=e=>fn(`callModels.${e}`,null),Lw={realtime:e=>fn(`callModel.${e}`,null),transcribe:e=>fn(`callSpeechToText.${e}`,null),speech:e=>fn(`callSpeechModel.${e}`,null)},Bw=e=>Rw(e).get()??ir[e].defaults;function Ow(e,t){t&&Rw(e).set(t)}function zw(e){for(const t of e.providers)Ow(t.provider,t.defaults)}const cn=(e,t)=>Lw[t](e).get()??Bw(e)[t];function hj(e,t,s){Lw[t](e).set(!s||s===Bw(e)[t]?null:s)}function Hw(e){const t=Dw(e).get();return t&&ir[e].voices.includes(t)?t:ir[e].voices[0]}const uj=(e,t)=>Dw(e).set(t),Iw=(e,t)=>`callUsage.${e}.${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}`;function dj(e,t,s=new Date){if(e<=0)return;const r=fn(Iw(t,s),0);r.set(r.get()+e)}const fj=(e,t=new Date)=>Math.floor((fn(Iw(e,t),0).get()+59)/60),pj=e=>e.call("voiceStatus"),R_=(e,t,s)=>e.call("setVoiceKey",{provider:t,key:s},3e4),mj=async(e,t,s,r)=>(await e.call("voiceSession",{provider:t,model:s,voice:r},3e4)).credential,gj=(e,t)=>e.call("voiceModels",{provider:t},3e4),vj=(e,t,s,r,l)=>e.call("voiceSpeak",{provider:t,model:s,voice:r,text:l},9e4),wh=e=>ir[e].name,yj={openai:600,gemini:150},L_=()=>window.codync.speech.available,Gh=()=>window.codync.platform==="darwin"?"On-device speech isn't available in this build.":`On-device speech isn't available on ${window.codync.platform==="win32"?"Windows":"Linux"}.`,rs={provider:()=>{const e=Mw.get();return Ew(e)?e:null},model:e=>cn(e,"realtime"),transcribeModel:e=>cn(e,"transcribe"),speechModel:e=>cn(e,"speech"),voice:Hw,isSpeechMode:e=>Up(e).get()==="speech",remember:zw,pause:()=>E2.get()>0?E2.get():1.5,rate:()=>Tw.get(),language:()=>Nw.get()},_j=(e,t)=>dj(Math.floor(e),t);class uu extends ws{phase="starting";failure=null;level=0;onActivityChanged=null;ended=!1;mutedValue=!1;get isActive(){return this.phase==="listening"||this.phase==="speaking"}get muted(){return this.mutedValue}set muted(t){t!==this.mutedValue&&(this.mutedValue=t,this.mutedChanged(t),this.changed())}mutedChanged(t){}setPhase(t){this.phase=t,this.changed(),this.onActivityChanged?.(!this.ended&&this.isActive)}fail(t){this.end(),this.failure=t,this.setPhase("failed")}}const er=e=>e instanceof Error?e.message:String(e),xj="Allow the microphone for Codync in Settings to talk to your bots.";async function Uw(){try{return await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(e){throw e instanceof DOMException&&(e.name==="NotAllowedError"||e.name==="SecurityError")?new Error(xj):new Error(`Couldn't use the microphone: ${er(e)}`)}}async function Pw(e){const t=await Uw(),s=new AudioContext({sampleRate:16e3}),r=s.createMediaStreamSource(t),l=s.createScriptProcessor(2048,1,1);return l.onaudioprocess=h=>{const u=h.inputBuffer.getChannelData(0),p=new Int16Array(u.length);let m=0;for(let g=0;g<u.length;g++){const y=Math.max(-1,Math.min(1,u[g]));p[g]=y<0?y*32768:y*32767,m+=y*y}e(p,wj(m,u.length))},r.connect(l),l.connect(s.destination),s.state==="suspended"&&await s.resume(),()=>{l.onaudioprocess=null,r.disconnect(),l.disconnect();for(const h of t.getTracks())h.stop();s.close()}}function wj(e,t){const s=10*Math.log10(Math.max(e/Math.max(t,1),1e-10));return Math.min(1,Math.max(0,(s+50)/50))}function Sj(e){const t=e.reduce((u,p)=>u+p.length,0),s=new Uint8Array(44+t*2),r=new DataView(s.buffer),l=(u,p)=>[...p].forEach((m,g)=>r.setUint8(u+g,m.charCodeAt(0)));l(0,"RIFF"),r.setUint32(4,36+t*2,!0),l(8,"WAVEfmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,16e3,!0),r.setUint32(28,32e3,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),l(36,"data"),r.setUint32(40,t*2,!0);let h=44;for(const u of e)for(let p=0;p<u.length;p++,h+=2)r.setInt16(h,u[p],!0);return s}function qw(e){let t="";for(let s=0;s<e.length;s+=32768)t+=String.fromCharCode(...e.subarray(s,s+32768));return btoa(t)}function Vw(e){const t=atob(e),s=new Uint8Array(t.length);for(let r=0;r<t.length;r++)s[r]=t.charCodeAt(r);return s}function Zh(e){const t=[[/```[\s\S]*?```/g,""],[/!?\[([^\]]*)\]\([^)]*\)/g,"$1"],[/`([^`]*)`/g,"$1"],[/^\s{0,3}(#{1,6}|>|[-*+]|\d+\.)\s+/gm,""],[/(\*\*|\*|~~)(\S[^\n]*?)\1/g,"$2"],[/^[ \t]*\|?[ \t:|-]{3,}\|?[ \t]*$/gm,""],[/^[ \t]*\|[ \t]*|[ \t]*\|[ \t]*$/gm,""],[/[ \t]*\|[ \t]*/g,", "],[/\n{2,}/g,`
+`]];let s=e;for(const[r,l]of t)s=s.replace(r,l);return s.trim()}const $w=window.codync.platform==="darwin",So=$w?"this Mac":"this computer";function Ww(e){return e==="ios"?"iphone":e==="macos"?"laptopcomputer":"desktopcomputer"}function Za({show:e,children:t,style:s}){const{mounted:r,shown:l}=Ps(e);return r?o.jsx("div",{className:`settings-reveal ${l?"shown":""}`,style:s,children:o.jsx("div",{children:t})}):null}function B_({title:e,children:t}){return o.jsxs("div",{className:"settings-section-header",children:[o.jsx("span",{role:"heading","aria-level":3,style:{...R(13,"semibold"),color:"var(--text)"},children:e}),o.jsx("span",{style:{flex:1}}),t]})}const Or=e=>e instanceof Error?e.message:typeof e=="object"&&e&&"message"in e?String(e.message):String(e);function Fw(e,t=new Date){const s=l=>new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime(),r=Math.round((s(t)-s(e))/864e5);return r===0?e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):r===1?"Yesterday":t.getTime()-e.getTime()<6*864e5?e.toLocaleDateString(void 0,{weekday:"long"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function M2(e){const t=e.connection;switch(t.kind){case"online":return e.mismatch?"Needs update":"Online";case"connecting":return"Connecting…";case"computerOffline":return t.lastSeen?`Offline · seen ${Fw(new Date(t.lastSeen))}`:"Offline";case"offline":return"Can't reach";case"unauthorized":return t.message;case"unpaired":return"Not paired"}}const Xh=e=>e.connection.kind==="online"?e.client:null,bj=e=>e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e;function Pp({showsHeader:e=!0}){const[t,s]=kt(Mw),[r,l]=kt(Tw),[h,u]=kt(Nw),p=b.useMemo(()=>cj(window.codync.speech.locales()),[]),m=Ew(t)?t:null,[g,y]=kt(Up(m??"openai")),v=m?`Your own ${ir[m].name} key, billed by ${ir[m].name}. Applies from the next call.`:window.codync.speech.available?"On-device speech, on this computer. Applies from the next call.":Gh();return o.jsxs("div",{style:{display:"flex",flexDirection:"column",background:"var(--background)",width:e?440:void 0,height:e?600:"100%"},children:[e?o.jsx(ut,{title:"Voice chat"}):null,o.jsx("div",{style:{flex:1,minHeight:0},children:o.jsxs(ui,{children:[o.jsx(ke,{title:"Voice",footer:v,children:[o.jsx(ei,{label:"Engine",children:o.jsx(_i,{selection:t,options:[...window.codync.speech.available||t==="device"?[{id:"device",label:"On device"}]:[],...oj.map(x=>({id:x,label:ir[x].name}))],onChange:s})},"engine"),...m?[o.jsx(ei,{label:"Mode",detail:g==="speech"?"Sent when you pause, replies read aloud.":"A live conversation. Talk over replies.",children:o.jsx(_i,{selection:g,options:[{id:"realtime",label:"Realtime"},{id:"speech",label:"Speech"}],onChange:y})},"mode"),...g==="speech"?[o.jsx(O_,{},"pause")]:[]]:[o.jsx(ei,{label:"Language",detail:"The language you speak in calls.",children:o.jsx(_i,{selection:h,options:p,onChange:u})},"language"),o.jsx(ei,{label:"Reading speed",children:o.jsx(_i,{selection:r,options:[{id:.42,label:"Slower"},{id:Aw,label:"Normal"},{id:.56,label:"Faster"}],onChange:l})},"rate"),o.jsx(O_,{},"pause")]]}),m?o.jsx(Cj,{provider:m},m):null]})})]})}function O_(){const[e,t]=kt(E2);return o.jsx("div",{className:"settings-appear",children:o.jsx(ei,{label:"Send after a pause of",detail:"Longer leaves time to think mid-sentence.",children:o.jsx(_i,{selection:e,options:[{id:1,label:"1 s"},{id:1.5,label:"1.5 s"},{id:2.5,label:"2.5 s"}],onChange:t})})})}function Cj({provider:e}){const t=Ae(),s=ir[e],[r]=kt(Up(e)),[l,h]=b.useState(null),[u,p]=b.useState(!1),[m,g]=b.useState(""),[y,v]=b.useState(!1),[x,S]=b.useState(null),[w,C]=b.useState(()=>Hw(e)),[j,E]=b.useState(()=>cn(e,"realtime")),[A,N]=b.useState(()=>cn(e,"transcribe")),[L,q]=b.useState(()=>cn(e,"speech")),[B,I]=b.useState(()=>D_(e).get()??{models:[],transcribe:[],speech:[]}),U=b.useRef(!1),P=r==="speech",F=l===!0,$={ok:!1,text:`Not connected to ${t.hostName}.`},z=async Y=>{let oe;try{oe=await gj(Y,e)}catch{return}I(oe),Ow(e,oe.defaults),E(cn(e,"realtime")),N(cn(e,"transcribe")),q(cn(e,"speech")),D_(e).set(oe)};b.useEffect(()=>{let Y=!1;return(async()=>{const oe=Xh(t);if(!oe)return h(!1),S($);let xe;try{const we=await pj(oe);zw(we),xe=v0(we,e)}catch(we){return Y?void 0:(h(!1),S({ok:!1,text:Or(we)}))}Y||(h(xe),xe&&await z(oe))})(),()=>{Y=!0}},[e]);const O=(Y,oe)=>xe=>{oe(xe),hj(e,Y,xe)},M=Y=>{if(U.current)return;const oe=Xh(t);if(!oe)return S($);U.current=!0,v(!0),S(null),Y(oe).catch(xe=>S({ok:!1,text:Or(xe)})).finally(()=>{U.current=!1,v(!1)})},X=()=>{const Y=m.trim();!Y&&!F||M(async oe=>{!Y||!u&&F?(P?await vj(oe,e,L,w,"OK"):await mj(oe,e,j,w),S({ok:!0,text:"Key works"})):(h(v0(await R_(oe,e,Y),e)),g(""),p(!1),S({ok:!0,text:`Key works and is saved on ${t.hostName}`})),await z(oe)})},V=()=>M(async Y=>{h(v0(await R_(Y,e,""),e)),S(null)}),ie=(Y,oe,xe)=>{const we=oe.includes(Y)?oe:[Y,...oe];return o.jsx(_i,{selection:Y,options:we.map(D=>({id:D,label:D})),onChange:xe})},ee={opacity:F?1:.55,pointerEvents:F?void 0:"none",transition:"opacity var(--layout)"},ce=o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[F&&!u?o.jsxs("div",{className:"settings-row",children:[o.jsx(se,{name:"key.fill",size:13,color:"var(--secondary)"}),o.jsxs("div",{className:"settings-stack",style:{flex:1},children:[o.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Key saved"}),o.jsxs("span",{style:{...R("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["Stays on ",t.hostName]})]}),y?o.jsx($e,{}):o.jsxs(o.Fragment,{children:[o.jsx(be,{title:"Test key",icon:"checkmark.seal",onClick:X}),o.jsx(be,{title:"Replace key",icon:"pencil",onClick:()=>{p(!0),S(null)}}),o.jsx(be,{title:"Remove key",icon:"trash",onClick:V})]})]}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[o.jsxs("div",{className:"settings-row",style:{gap:8},children:[o.jsx("input",{type:"password","aria-label":"API key",placeholder:s.keyPrompt,value:m,spellCheck:!1,autoComplete:"off",style:{flex:1,minWidth:0},onChange:Y=>g(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&X()}),y?o.jsx($e,{}):o.jsx(Ne,{onClick:X,disabled:!m.trim(),children:"Save"})]}),o.jsxs("div",{className:"settings-row",style:R("footnote"),children:[o.jsxs("button",{style:{color:"var(--text)",textDecoration:"underline"},onClick:()=>window.codync.app.openExternal(s.keyPage),children:["Get a key from ",s.name]}),o.jsx("span",{style:{flex:1}}),u?o.jsx("button",{style:{color:"var(--secondary)"},onClick:()=>{p(!1),g(""),S(null)},children:"Cancel"}):null]})]}),o.jsx(Za,{show:x!==null,children:x?o.jsxs("span",{style:{...R("footnote"),display:"flex",alignItems:"center",gap:5,color:x.ok?"var(--secondary)":"var(--danger)"},children:[o.jsx(se,{name:x.ok?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10}),x.text]}):null})]},"key");return o.jsx(ke,{title:s.name,footer:F?null:`Add a key to choose from ${s.name}'s models.`,children:[ce,...P?[o.jsx("div",{style:ee,children:o.jsx(ei,{label:"Speech to text",children:ie(A,B.transcribe,O("transcribe",N))})},"stt"),o.jsx("div",{style:ee,children:o.jsx(ei,{label:"Text to speech",children:ie(L,B.speech,O("speech",q))})},"tts")]:[o.jsx("div",{style:ee,children:o.jsx(ei,{label:"Model",children:ie(j,B.models,O("realtime",E))})},"model")],o.jsx("div",{style:ee,children:o.jsx(ei,{label:"Voice",children:o.jsx(_i,{selection:w,options:s.voices.map(Y=>({id:Y,label:Y})),onChange:Y=>{C(Y),uj(e,Y)}})})},"voice"),o.jsx("div",{style:ee,children:o.jsxs(ei,{label:"This month",children:["≈ ",fj(e)," min"]})},"minutes")]})}const Kw=[{name:"send_to_bot",description:"Send a message to the bot on the computer, exactly as if the user typed it. Its reply arrives later.",parameters:{type:"object",properties:{text:{type:"string",description:"The message"}},required:["text"]}},{name:"bot_status",description:"Whether the bot is idle or working, what it is doing, and any approval it is waiting for.",parameters:{type:"object",properties:{}}},{name:"recent_messages",description:"The latest messages in the chat with the bot, oldest first.",parameters:{type:"object",properties:{count:{type:"integer",description:"How many, 1–20"}}}},{name:"answer_approval",description:"Answer the bot's pending approval request with one of its options.",parameters:{type:"object",properties:{option:{type:"string",description:"The option's name"}},required:["option"]}}];class kj{constructor(t,s){this.store=t,this.botId=s}store;botId;get instructions(){const t=this.store.bots.get(this.botId),s=t?.name??"the bot",r=t?.description?` (${t.description})`:"";return[`You are the voice on a phone call between the user and ${t&&ft(t)?`the group chat ${s}${r} on the user's computer, where the bots ${this.store.members(t).map(h=>h.name).join(", ")} answer in turn (a message that @-mentions one of them asks just that bot). The bots do all the actual work; you relay`:`${s}${r}, a coding agent running on the user's computer. ${s} does all the actual work; you relay`}.`,"- When the user asks for something to be done, changed, checked or answered about their code or computer, call send_to_bot with their request in their own words (keep details, names and code terms exactly). Don't do the work or invent results yourself.",'- Use bot_status and recent_messages for "what are you doing?" or "what did it say?".',"- Call answer_approval only after the user has clearly said which option to pick.",`- Messages starting with [${s} replied] or [Notice] come from the computer: tell the user what they say, shortened for speech (no code blocks, no long lists, no URLs).`,"- Reply in the user's language. Keep spoken answers short and natural."].join(`
+`)}call(t,s){let r;switch(t){case"send_to_bot":r=this.send(typeof s.text=="string"?s.text:"");break;case"bot_status":r=this.status();break;case"recent_messages":r=this.recent(typeof s.count=="number"?Math.trunc(s.count):6);break;case"answer_approval":r=this.answer(typeof s.option=="string"?s.option:"");break;default:r={error:`Unknown tool ${t}.`}}return JSON.stringify(r)}reply(t){return`[${this.store.bots.get(this.botId)?.name??"Bot"} replied] ${Zh(t)}`}notice(t){return`[Notice] ${t}`}send(t){const s=t.trim();return s?(this.store.send(s,this.botId),{sent:!0,note:"The bot's reply will arrive as a separate message."}):{error:"Nothing to send."}}status(){const t=this.store.bots.get(this.botId);if(!t)return{error:"The bot isn't available."};const s={status:t.status,activity:t.activity},r=this.pendingApproval;return r&&(s.approval={request:r.data.title??r.data.command??"",options:(r.data.options??[]).map(l=>l.name)}),s}recent(t){const s=this.store.bots.get(this.botId)?.name??"bot",r=Math.min(Math.max(t,1),20);return{messages:this.store.chat(this.botId).filter(Fa).slice(-r).map(h=>({from:h.kind==="user"?"user":h.kind==="agent"?h.data.author&&this.store.bots.get(h.data.author)?.name||s:h.kind==="permission"?"approval request":"notice",text:Zh(h.data.text??h.data.title??"")}))}}answer(t){const s=this.pendingApproval;if(!s)return{error:"Nothing is waiting for approval."};const r=s.data.options??[],l=t.toLowerCase(),h=r.find(u=>u.name.toLowerCase()===l||u.optionId===t)??r.find(u=>u.name.toLowerCase().includes(l)||l.includes(u.name.toLowerCase()));return h?(this.store.respond(s,h.optionId),{answered:h.name}):{error:"No such option.",options:r.map(u=>u.name)}}get pendingApproval(){return this.store.chat(this.botId).findLast(t=>t.kind==="permission"&&t.data.status==="pending")}}const jj=.3,Ej=16e3*3/10,Mj=16e3*20,Aj=16e3*4/10;function Tj(e,t){const s=[];let r="",l="";const h=()=>{const p=r.trim();p&&s.push(p),r=""},u=p=>{[...r].length+[...p].length>t&&h();let m=[...p];for(;m.length>t;)s.push(m.slice(0,t).join("")),m=m.slice(t);r+=m.join("")};for(const p of e)l+=p,`.!?。!?
+`.includes(p)&&(u(l),l="");return u(l),h(),s}class Nj extends uu{constructor(t,s){super(),this.provider=t,this.speech=s,this.chunk=yj[t]}provider;speech;stopMic=null;chunk;preroll=[];prerollSamples=0;utterance=[];utteranceSamples=0;speaking=!1;quietSince=null;voiced=0;deafUntil=0;transcribing=Promise.resolve();queue=[];player=null;next=null;speakGeneration=0;async start(){try{const t=await Pw((s,r)=>this.heard(s,r));if(this.ended)return t();this.stopMic=t}catch(t){return this.fail(er(t))}this.setPhase("listening")}end(){this.ended=!0,this.onActivityChanged?.(!1),this.stopSpeaking(),this.stopMic?.(),this.stopMic=null}mutedChanged(t){t&&this.dropUtterance()}interrupt(){this.phase==="speaking"&&(this.stopSpeaking(),this.setPhase("listening"))}speak(t){this.say(Zh(t))}announce(t){this.say(t)}heard(t,s){if(!(this.ended||this.muted||this.phase!=="listening"||Date.now()<this.deafUntil))if(this.level=s,s>jj?(this.speaking=!0,this.quietSince=null,this.voiced+=t.length):this.speaking&&this.quietSince===null&&(this.quietSince=Date.now()),this.speaking)this.utterance.push(t),this.utteranceSamples+=t.length,(this.quietSince!==null&&Date.now()-this.quietSince>=rs.pause()*1e3||this.utteranceSamples>=Mj)&&this.submit();else for(this.preroll.push(t),this.prerollSamples+=t.length;this.preroll.length>1&&this.prerollSamples-this.preroll[0].length>=Ej;)this.prerollSamples-=this.preroll.shift().length}submit(){const t=Sj([...this.preroll,...this.utterance]),s=this.voiced>=Aj;this.dropUtterance(),s&&(this.transcribing=this.transcribing.then(async()=>{try{const r=(await this.speech.transcribe(t)).trim();!this.ended&&r&&this.speech.send(r)}catch(r){console.error("transcribe:",er(r)),this.ended||this.fail(er(r))}}))}dropUtterance(){this.preroll=[],this.prerollSamples=0,this.utterance=[],this.utteranceSamples=0,this.speaking=!1,this.quietSince=null,this.voiced=0,this.level=0}say(t){this.ended||this.phase==="failed"||this.phase==="starting"||!t||(this.queue.push(...Tj(t,this.chunk)),!this.player&&!this.next&&this.playNext())}playNext(){if(this.ended)return;const t=this.speakGeneration,s=this.next??this.fetch(this.queue.shift()??null);this.next=null,s.then(r=>{if(!(t!==this.speakGeneration||this.ended)){if(!r)return this.finishedSpeaking();this.play(r),this.queue.length&&(this.next=this.fetch(this.queue.shift()))}})}async fetch(t){if(t===null)return null;try{return await this.speech.speak(t)}catch(s){return console.error("speak:",er(s)),null}}play(t){const s=t.format==="aac"?"audio/aac":t.format==="wav"?"audio/wav":`audio/${t.format}`,r=URL.createObjectURL(new Blob([t.audio],{type:s})),l=new Audio(r),h=this.speakGeneration;let u=!1;const p=()=>{u||(u=!0,URL.revokeObjectURL(r),this.played(h))};l.onended=p,l.onerror=()=>{console.error("play: unreadable clip"),p()},this.player=l,this.dropUtterance(),this.setPhase("speaking"),l.play().catch(()=>l.onerror?.(new Event("error")))}played(t){t===this.speakGeneration&&(this.player=null,!this.queue.length&&!this.next?this.finishedSpeaking():this.playNext())}finishedSpeaking(){this.player=null,this.deafUntil=Date.now()+400,this.phase==="speaking"&&this.setPhase("listening")}stopSpeaking(){this.speakGeneration++,this.queue=[],this.next=null,this.player&&(this.player.onended=null,this.player.onerror=null,this.player.pause(),URL.revokeObjectURL(this.player.src)),this.player=null}}const Dj="wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained";function Yw(e){const t={};for(const[s,r]of Object.entries(e))s==="type"&&typeof r=="string"?t[s]=r.toUpperCase():s==="properties"&&r&&typeof r=="object"?t[s]=Object.fromEntries(Object.entries(r).map(([l,h])=>[l,Yw(h)])):t[s]=r;return t}class Rj extends uu{constructor(t,s,r,l){super(),this.model=t,this.voice=s,this.credential=r,this.op=l}model;voice;credential;op;provider="gemini";socket=null;ready=!1;resumeHandle=null;reconnects=0;stopMic=null;output=null;sources=new Set;nextStart=0;queued=0;playGeneration=0;turnDone=!0;dropping=!1;pending=[];async start(){await this.connect()}async connect(){try{const t=await this.credential();if(this.ended)return;const s=new WebSocket(`${Dj}?access_token=${encodeURIComponent(t)}`);s.binaryType="arraybuffer",this.socket=s,this.ready=!1,s.onopen=()=>this.sendSetup(s),s.onmessage=r=>{this.socket===s&&this.received(typeof r.data=="string"?r.data:new TextDecoder().decode(r.data))},s.onclose=r=>this.closed(s,r.reason)}catch(t){this.ended||this.fail(er(t))}}sendSetup(t){const s=Kw.map(l=>({name:l.name,description:l.description,...Object.keys(l.parameters.properties).length?{parameters:Yw(l.parameters)}:{}})),r={model:`models/${this.model}`,generationConfig:{responseModalities:["AUDIO"],speechConfig:{voiceConfig:{prebuiltVoiceConfig:{voiceName:this.voice}}}},systemInstruction:{parts:[{text:this.op.instructions}]},tools:[{functionDeclarations:s}],contextWindowCompression:{slidingWindow:{}},sessionResumption:this.resumeHandle?{handle:this.resumeHandle}:{}};this.send({setup:r},t)}end(){this.ended=!0,this.onActivityChanged?.(!1);const t=this.socket;this.socket=null,t?.close(1e3),this.stopPlayback(),this.stopMic?.(),this.stopMic=null,this.output?.close(),this.output=null}mutedChanged(t){this.level=0,t&&this.send({realtimeInput:{audioStreamEnd:!0}})}interrupt(){this.phase==="speaking"&&(this.stopPlayback(),this.dropping=!this.turnDone,this.setPhase("listening"))}speak(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.reply(t)),this.flush())}announce(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.notice(t)),this.flush())}closed(t,s){this.ended||this.socket!==t||(this.socket=null,this.ready=!1,this.resumeHandle&&this.reconnects<3?(this.reconnects++,this.connect()):this.fail(s||"Lost the connection to Gemini."))}received(t){if(this.ended)return;let s;try{s=JSON.parse(t)}catch{return}s.setupComplete!==void 0&&(this.ready=!0,this.reconnects=0,this.stopMic||this.startAudio(),this.phase==="starting"&&this.setPhase("listening"),this.flush());const r=s.serverContent;if(r){r.interrupted===!0&&(this.stopPlayback(),this.dropping=!1,this.phase==="speaking"&&this.setPhase("listening"));const u=r.modelTurn?.parts;if(Array.isArray(u)){this.turnDone=!1;for(const p of u){const m=p?.inlineData?.data;typeof m=="string"&&!this.dropping&&this.play(m)}}r.turnComplete===!0&&(this.turnDone=!0,this.dropping=!1,this.queued===0&&this.phase==="speaking"&&this.setPhase("listening"),this.flush())}const l=s.toolCall?.functionCalls;if(Array.isArray(l)){const u=l.filter(p=>typeof p?.id=="string"&&typeof p?.name=="string").map(p=>{const m=this.op.call(p.name,p.args??{});return{id:p.id,name:p.name,response:{result:JSON.parse(m)}}});this.send({toolResponse:{functionResponses:u}})}const h=s.sessionResumptionUpdate;h?.resumable===!0&&typeof h.newHandle=="string"&&(this.resumeHandle=h.newHandle),s.goAway!==void 0&&this.socket?.close(1e3)}send(t,s){const r=s??(this.ready?this.socket:null);r?.readyState===WebSocket.OPEN&&r.send(JSON.stringify(t))}flush(){if(!this.ready||!this.turnDone||this.queued!==0||!this.pending.length)return;const t=this.pending.join(`
+
+`);this.pending=[],this.turnDone=!1,this.send({clientContent:{turns:[{role:"user",parts:[{text:t}]}],turnComplete:!0}})}async startAudio(){try{this.output=new AudioContext({sampleRate:24e3});const t=await Pw((s,r)=>this.captured(s,r));if(this.ended)return t();this.stopMic=t}catch(t){this.ended||this.fail(er(t))}}captured(t,s){this.ended||this.muted||!this.isActive||(this.level=this.phase==="speaking"?0:s,this.send({realtimeInput:{audio:{data:qw(new Uint8Array(t.buffer)),mimeType:"audio/pcm;rate=16000"}}}))}play(t){const s=this.output;if(!s)return;const r=Vw(t),l=r.length>>1;if(!l)return;const h=new DataView(r.buffer),u=s.createBuffer(1,l,24e3),p=u.getChannelData(0);for(let y=0;y<l;y++)p[y]=h.getInt16(y*2,!0)/32768;const m=s.createBufferSource();m.buffer=u,m.connect(s.destination),this.nextStart=Math.max(this.nextStart,s.currentTime),m.start(this.nextStart),this.nextStart+=u.duration,this.sources.add(m),this.queued++,this.level=0,this.phase!=="speaking"&&this.setPhase("speaking");const g=this.playGeneration;m.onended=()=>{this.sources.delete(m),this.played(g)}}played(t){t!==this.playGeneration||this.ended||(this.queued=Math.max(0,this.queued-1),!(this.queued!==0||!this.turnDone)&&(this.phase==="speaking"&&this.setPhase("listening"),this.flush()))}stopPlayback(){this.playGeneration++,this.queued=0,this.nextStart=0;for(const t of this.sources){t.onended=null;try{t.stop()}catch{}}this.sources.clear()}}function Lj(e){const t=l=>e.match(l)?.length??0,s=t(/[A-Za-z]/g),r=navigator.language;if(t(/[぀-ヿ]/g)>0)return"ja";if(t(/[가-힯]/g)>s/3)return"ko";if(t(new RegExp("\\p{Script=Han}","gu"))>s/3){const l=navigator.languages.find(h=>h.startsWith("zh"));return l?/Hant|TW|HK|MO/.test(l)?/HK/.test(l)?"zh-HK":"zh-TW":"zh-CN":"zh-TW"}return/^(zh|ja|ko)/.test(r)?"en":r.split("-")[0]}function Bj(e){const t=Lj(e),s=speechSynthesis.getVoices().filter(l=>l.lang.replace("_","-").startsWith(t)),r=l=>(l.lang.replace("_","-")===navigator.language?4:0)+(/premium|enhanced/i.test(l.name)?2:0)+(l.localService?1:0);return s.sort((l,h)=>r(h)-r(l))[0]??null}class Oj extends uu{constructor(t){super(),this.send=t}send;provider=null;heard="";recognizing=!1;started=!1;everStarted=!1;lastRestart=0;silence=null;offEvents=null;speakGeneration=0;async start(){if(!window.codync.speech.available)return this.fail(Gh());speechSynthesis.getVoices(),this.offEvents=window.codync.speech.onEvent(t=>this.event(t)),this.listen()}end(){this.ended=!0,this.onActivityChanged?.(!1),this.stopListening(),this.offEvents?.(),this.offEvents=null,this.speakGeneration++,speechSynthesis.cancel()}mutedChanged(t){this.phase==="listening"&&(t?this.stopListening():this.listen())}speak(t){const s=Zh(t);if(this.ended||!s||this.phase==="starting"||this.phase==="failed")return;this.stopListening(),this.setPhase("speaking");const r=++this.speakGeneration;speechSynthesis.cancel();const l=new SpeechSynthesisUtterance(s),h=Bj(s);h&&(l.voice=h,l.lang=h.lang);const u=rs.rate();l.rate=u>0?Math.min(10,Math.max(.1,u/.5)):1,l.onend=()=>r===this.speakGeneration&&this.finishedSpeaking(),l.onerror=()=>r===this.speakGeneration&&this.finishedSpeaking(),speechSynthesis.speak(l)}announce(t){this.speak(t)}interrupt(){this.phase==="speaking"&&(this.speakGeneration++,speechSynthesis.cancel(),this.listen())}listen(){this.heard="",this.phase!=="listening"&&this.everStarted&&this.setPhase("listening"),!(this.muted||this.ended)&&(this.recognizing=!0,this.started=!1,window.codync.speech.start(rs.language()||null))}stopListening(){this.silence&&clearTimeout(this.silence),this.silence=null,this.recognizing&&window.codync.speech.stop(),this.recognizing=!1,this.started=!1,this.level=0}event(t){if(!(this.ended||!this.recognizing))switch(t.type){case"started":this.started=!0,this.everStarted||(this.everStarted=!0,this.setPhase("listening"));break;case"level":this.phase==="listening"&&(this.level=t.value);break;case"partial":case"final":this.recognized(t.text,t.type==="final");break;case"error":if(!this.started)return this.fail(t.message);this.restart(t.message);break;case"stopped":if(!this.started)return this.fail("Speech recognition stopped.");this.restart("Speech recognition stopped.");break}}restart(t){if(Date.now()-this.lastRestart<1e3)return this.fail(t);this.lastRestart=Date.now(),this.submit()}recognized(t,s){if(this.phase==="listening"){if(this.heard=t,this.silence&&clearTimeout(this.silence),s)return this.submit();this.silence=setTimeout(()=>this.submit(),rs.pause()*1e3)}}submit(){const t=this.heard.trim();this.stopListening(),t&&this.send(t),this.listen()}finishedSpeaking(){this.phase==="speaking"&&this.listen()}fail(t){this.stopListening(),this.failure=t,this.setPhase("failed")}}class zj extends uu{constructor(t,s){super(),this.credential=t,this.op=s}credential;op;provider="openai";pc=null;events=null;stream=null;audio=null;responding=!1;pending=[];dropTimer=null;async start(){try{if(this.stream=await Uw(),this.ended)return this.release();const t=await this.credential();if(this.ended)return;await this.connect(t)}catch(t){this.ended||this.fail(er(t))}}async connect(t){const s=new RTCPeerConnection({bundlePolicy:"max-bundle"});this.pc=s;const r=this.stream.getAudioTracks()[0];if(!r)throw new Error("Couldn't start the call audio.");r.enabled=!this.muted,s.addTrack(r,this.stream);const l=new Audio;l.autoplay=!0,this.audio=l,s.ontrack=g=>{l.srcObject=g.streams[0]??new MediaStream([g.track])},s.oniceconnectionstatechange=()=>this.iceChanged(s.iceConnectionState);const h=s.createDataChannel("oai-events");h.onopen=()=>this.opened(),h.onmessage=g=>typeof g.data=="string"&&this.received(g.data),this.events=h;const u=await s.createOffer();await s.setLocalDescription(u);const p=await fetch("https://api.openai.com/v1/realtime/calls",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"},body:u.sdp,signal:AbortSignal.timeout(15e3)}),m=await p.text();if(!this.ended){if(!p.ok){let g;try{g=JSON.parse(m).error?.message}catch{}throw new Error(g??`OpenAI answered ${p.status}.`)}await s.setRemoteDescription({type:"answer",sdp:m}),this.dropTimer=setTimeout(()=>{!this.ended&&this.phase==="starting"&&this.fail("Couldn't reach OpenAI.")},15e3)}}release(){for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null}end(){this.ended=!0,this.onActivityChanged?.(!1),this.dropTimer&&clearTimeout(this.dropTimer),this.events?.close(),this.pc?.close(),this.events=null,this.pc=null,this.release(),this.audio&&(this.audio.srcObject=null,this.audio=null)}mutedChanged(t){for(const s of this.stream?.getAudioTracks()??[])s.enabled=!t;t&&(this.level=0)}interrupt(){this.phase==="speaking"&&(this.send({type:"response.cancel"}),this.send({type:"output_audio_buffer.clear"}),this.setPhase("listening"))}speak(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.reply(t)),this.flush())}announce(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.notice(t)),this.flush())}opened(){this.ended||(this.dropTimer&&clearTimeout(this.dropTimer),this.send({type:"session.update",session:{type:"realtime",instructions:this.op.instructions,tools:Kw.map(t=>({type:"function",name:t.name,description:t.description,parameters:t.parameters})),audio:{input:{turn_detection:{type:"semantic_vad"}}}}}),this.setPhase("listening"),this.flush())}received(t){if(this.ended)return;let s;try{s=JSON.parse(t)}catch{return}switch(s.type){case"input_audio_buffer.speech_started":this.level=this.muted?0:.7;break;case"input_audio_buffer.speech_stopped":this.level=0;break;case"output_audio_buffer.started":this.setPhase("speaking");break;case"output_audio_buffer.stopped":case"output_audio_buffer.cleared":this.phase==="speaking"&&this.setPhase("listening");break;case"response.created":this.responding=!0;break;case"response.done":this.responding=!1,this.flush();break;case"response.function_call_arguments.done":{if(typeof s.call_id!="string"||typeof s.name!="string")return;let r={};try{typeof s.arguments=="string"&&(r=JSON.parse(s.arguments))}catch{}const l=this.op.call(s.name,r);this.send({type:"conversation.item.create",item:{type:"function_call_output",call_id:s.call_id,output:l}}),this.pending.push("");break}case"error":console.error("realtime:",s.error?.message??"?");break}}iceChanged(t){if(!this.ended)switch(t){case"connected":case"completed":this.dropTimer&&clearTimeout(this.dropTimer);break;case"disconnected":this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=setTimeout(()=>!this.ended&&this.fail("Lost the connection to OpenAI."),5e3);break;case"failed":this.fail("Lost the connection to OpenAI.");break}}flush(){if(!(this.responding||!this.isActive||this.events?.readyState!=="open"||!this.pending.length)){for(const t of this.pending)t&&this.send({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:t}]}});this.pending=[],this.responding=!0,this.send({type:"response.create"})}}send(t){this.events?.readyState==="open"&&this.events.send(JSON.stringify(t))}}function Hj(e,t,s){let r=0;for(const m of e.bots.values())r=Math.max(r,m.rev);for(const m of e.entries.values())for(const g of m)r=Math.max(r,g.rev);const l=new Set(e.allEntries(t).filter(m=>m.data.final).map(m=>m.id));let h=(()=>{const m=e.bots.get(t);return m?pn(m):!1})();const u=new Set(e.allEntries(t).filter(m=>m.kind==="permission").map(m=>m.id)),p=m=>m?e.bots.get(m)?.name:void 0;return e.subscribe(()=>{const m=e.bots.get(t),g=!!m&&ft(m);for(const x of e.allEntries(t)){if(g&&x.kind==="permission"&&!u.has(x.id)&&(u.add(x.id),x.data.status==="pending"&&x.rev>r&&s.announce(`${p(x.data.author)??"A bot"} needs your approval in the chat.`)),!x.data.final||l.has(x.id)||(l.add(x.id),x.kind!=="agent"||x.threadId||x.rev<=r||!x.data.text))continue;const S=g?p(x.data.author):void 0;s.speak(S?`${S}: ${x.data.text}`:x.data.text)}const y=e.bots.get(t),v=y?pn(y):!1;y&&v&&!h&&s.announce(`${y.name} needs your approval in the chat.`),h=v})}const Gw=b.createContext(null);function Ij({botId:e,onSpeaking:t,interrupt:s,onEnd:r}){const l=Ae(),[h,u]=b.useState(null);di(h);const[p,m]=b.useState(null),[g,y]=b.useState(null),[v,x]=b.useState(!1),S=b.useContext(Gw),w=b.useRef(null),C=b.useRef(null),j=b.useRef(!1),E=l.bots.get(e),A=E?_s(E.avatarColor):null,N=()=>{const M=w.current?.provider;!M||C.current===null||(_j((Date.now()-C.current)/1e3,M),C.current=null)},L=(M,X,V)=>async()=>(await(await l.ready()).call("voiceSession",{provider:M,model:X,voice:V},3e4)).credential,q=M=>{if(j.current)return;if(!M&&!L_())return void I();const X=new kj(l,e),V=ce=>l.send(ce,e);let ie;if(M&&rs.isSpeechMode(M)){const ce=rs.transcribeModel(M),Y=rs.speechModel(M),oe=rs.voice(M);ie=new Nj(M,{transcribe:async xe=>(await(await l.ready()).call("voiceTranscribe",{provider:M,model:ce,audio:qw(xe)},6e4)).text,speak:async xe=>{const we=await(await l.ready()).call("voiceSpeak",{provider:M,model:Y,voice:oe,text:xe},9e4);return{audio:Vw(we.audio),format:we.format}},send:V}),C.current=Date.now()}else if(M){const ce=rs.model(M),Y=rs.voice(M);ie=M==="openai"?new zj(L(M,ce,Y),X):new Rj(ce,Y,L(M,ce,Y),X),C.current=Date.now()}else ie=new Oj(V);M&&B();let ee=null;ie.onActivityChanged=ce=>{ce&&!ee?ee=Hj(l,e,{speak:Y=>ie.speak(Y),announce:Y=>ie.announce(Y)}):!ce&&ee&&(ee(),ee=null)},w.current=ie,u(ie),ie.start()},B=async()=>{try{const M=await(await l.ready()).call("voiceStatus");return rs.remember(M),M}catch{return null}},I=async()=>{const M=(await B())?.providers.find(X=>X.configured)?.provider;j.current||(M?(m(`${Gh()} Using ${wh(M)}.`),q(M)):y(`${Gh()} Add an OpenAI or Gemini key in call settings.`))};b.useEffect(()=>{const M=Date.now();return q(rs.provider()),()=>{j.current=!0,w.current?.end(),N(),t(!1),s.current=null,l.logCall(e,Math.floor((Date.now()-M)/1e3))}},[]);const U=h?.phase??null;b.useEffect(()=>{h&&(t(U==="speaking"),s.current=U==="speaking"?()=>h.interrupt():null,U==="failed"&&h.provider&&L_()&&(N(),m(`${wh(h.provider)} isn't available (${h.failure}). Using on-device voice.`),q(null)))},[h,U]);const P=U==="speaking",F=h?.muted===!0,$=E?mn(E):!1,z=U===null||U==="starting"?"Connecting":U==="speaking"?"Speaking":U==="failed"?"Can't listen":F?"Muted":$?"Working, listening":"Listening",O=g??(U==="failed"?h?.failure:null);return o.jsxs("div",{className:"call",children:[o.jsxs("div",{className:"call-bar",children:[o.jsx("button",{className:`call-avatar ${P?"speaking":""}`,disabled:!P,"aria-label":P?"Interrupt":E?.name??"",title:P?"Interrupt":void 0,onClick:()=>h?.interrupt(),children:E?o.jsx(hi,{bot:E,size:34}):o.jsx("span",{style:{width:34,height:34}})}),o.jsx(Uj,{engine:h,working:$,color:A,label:z}),h?.provider?o.jsx("span",{style:{...R("caption2","semibold"),color:"var(--secondary)"},"aria-label":`Voice by ${wh(h.provider)}`,children:wh(h.provider)}):null,o.jsx("button",{className:"call-round",title:"Call settings","aria-label":"Call settings",onClick:()=>S?S():x(!0),children:o.jsx(se,{name:"gearshape",size:16,weight:"medium",scaled:!1})}),o.jsx("button",{className:`call-round ${F?"on":""}`,title:F?"Unmute":"Mute","aria-label":F?"Unmute":"Mute",onClick:()=>h&&(h.muted=!h.muted),children:o.jsx(se,{name:F?"mic.slash":"mic",size:16,weight:"medium",scaled:!1})}),o.jsx("button",{className:"call-round end",title:"End call","aria-label":"End call",onClick:r,children:o.jsx(se,{name:"xmark",size:16,weight:"semibold",scaled:!1})})]}),O?o.jsx("div",{className:"call-line",style:{color:"var(--danger)"},children:O},"failure"):p?o.jsx("div",{className:"call-line",style:{color:"var(--secondary)"},children:p},p):null,o.jsx(ht,{open:v,onClose:()=>x(!1),children:o.jsx(Pp,{})})]})}const Sh=120,to=16;function Uj({engine:e,working:t,color:s,label:r}){const l=b.useRef(null),h=vp(),u=Qa(),p=b.useRef({engine:e,working:t,color:s,dark:h,reduceMotion:u});return p.current={engine:e,working:t,color:s,dark:h,reduceMotion:u},b.useEffect(()=>{const m=l.current,g=m?.getContext("2d");if(!m||!g)return;const y=window.devicePixelRatio||1;m.width=Sh*y,m.height=to*y;let v=0;const x=S=>{const{engine:w,working:C,color:j,dark:E,reduceMotion:A}=p.current,N=A?0:S/1e3,L=w?.phase==="speaking",q=w?.level??0,B=E?"#ffffff":"#000000",I=L?B:j??B;g.setTransform(y,0,0,y,0,0),g.clearRect(0,0,Sh,to);const U=8,P=Math.max(1,Math.floor(Sh/U));for(let F=0;F<P;F++){const $=F*U+U/2,z=(Math.sin(F*.55-N*6)+1)/2,O=L?.5+.5*z:q>.05?Math.max(.2,q)*(.45+.55*z):C?.25*((Math.sin(N*2.4)+1)/2):.08,M=4+O*(to-4);g.fillStyle=Rr(I,.5+.5*O),g.beginPath(),g.roundRect($-1.25,(to-M)/2,2.5,M,1.25),g.fill()}v=requestAnimationFrame(x)};return v=requestAnimationFrame(x),()=>cancelAnimationFrame(v)},[]),o.jsx("canvas",{ref:l,role:"img","aria-label":r,style:{width:Sh,height:to,flex:"none"}})}const Pj=680;function qj({botId:e}){const t=Ae(),s=t.bots.get(e)??null,[r,l]=b.useState(!1),[h,u]=b.useState(null),[p,m]=b.useState(null),[g,y]=b.useState(!1),[v,x]=b.useState(null),[S,w]=b.useState(!1),[C,j]=b.useState(!1),[E,A]=b.useState(!1),[N,L]=b.useState(!1),[q,B]=b.useState(!1),I=b.useRef(null),[U,P]=b.useState(null),[F,$]=b.useState(0),z=b.useRef(null),O=b.useRef(null),[M,X]=b.useState(800);jw(t,e,null),b.useLayoutEffect(()=>{const we=z.current;if(!we)return;const D=new ResizeObserver(([le])=>X(le.contentRect.width));D.observe(we);const J=new ResizeObserver(([le])=>we.style.setProperty("--composer-height",`${Math.ceil(le.borderBoxSize[0].blockSize)}px`));return O.current&&J.observe(O.current),()=>{D.disconnect(),J.disconnect()}},[]);const V=M>=Pj;b.useEffect(()=>{V&&A(!1)},[V]);const ie=b.useCallback(()=>{V?h?(u(null),w(!0)):w(we=>!we):(u(null),A(we=>!we))},[V,h]);b.useEffect(()=>window.codync.app.onCommand(we=>{we.kind==="toggleDetails"&&ie()}),[ie]);const ee=b.useCallback(()=>l(!0),[]),ce=b.useCallback(we=>u(we.id),[]),Y=b.useCallback(()=>u(null),[]),oe=we=>{P(we),$(D=>D+1),j(!1),u(null),w(!0),V||A(!0)},xe=o.jsx(Zk,{botId:e,routineId:U,editing:C,setEditing:j,editGroup:()=>y(!0),share:()=>{A(!1),s&&x(Co(s))},close:()=>{w(!1),A(!1)}},F);return o.jsxs("div",{className:"thread-view",ref:z,children:[o.jsxs("div",{className:"conversation",children:[o.jsxs("div",{className:"top-chrome",children:[o.jsx(Vj,{}),o.jsxs("div",{className:"top-chrome-row",children:[o.jsx("span",{style:{flex:1}}),(!S||h||!V)&&!E?o.jsx(Ip,{title:"Conversation details",icon:"chevron.left.2",direction:[-1,0],onClick:ie}):null]}),o.jsxs("button",{className:`title-pill ${N?"hidden-by-call":""}`,inert:N,onClick:ie,"aria-label":"View conversation details",title:"View conversation details",children:[o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7},children:[s?ft(s)?o.jsx(No,{members:t.members(s),size:22}):o.jsx(hi,{bot:s,size:22}):null,o.jsx("span",{style:{...R(13,"medium"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s?.name??""})]}),t.shownConnection.kind!=="online"||t.mismatch?o.jsx($j,{}):null]})]}),o.jsx(Wj,{botId:e,openTrace:ee,openThread:ce,openRoutine:oe,openBotChat:m}),o.jsxs("div",{className:"composer-dock",ref:O,children:[o.jsx("div",{className:"composer-fade"}),t.mismatch?o.jsx("div",{style:{padding:"0 16px 8px"},children:o.jsx(Ep,{})}):o.jsx(_w,{botId:e,onCall:!N&&s?()=>L(!0):null,onInterrupt:q?()=>I.current?.():null})]}),N?o.jsx("div",{className:"call-overlay",children:o.jsx(Ij,{botId:e,onSpeaking:B,interrupt:I,onEnd:()=>L(!1)})}):null]}),o.jsx(P9,{open:V&&(!!h||S),width:h?Math.min(420,M*.45):292,children:h?o.jsx(N_,{botId:e,rootId:h,close:Y},h):xe}),o.jsx(ht,{open:E,onClose:()=>A(!1),width:340,height:600,children:xe}),o.jsx(ht,{open:h!==null&&!V,onClose:Y,width:440,height:600,children:h?o.jsx(N_,{botId:e,rootId:h,close:Y}):null}),o.jsx(ht,{open:p!==null,onClose:()=>m(null),width:620,height:560,children:p?o.jsx(L9,{botId:e,peerId:p}):null}),o.jsx(ht,{open:r,onClose:()=>l(!1),width:620,height:560,children:o.jsx(kw,{botId:e})}),o.jsx(ht,{open:v!==null,onClose:()=>x(null),children:v?o.jsx(lj,{draft:v}):null}),o.jsx(ht,{open:g,onClose:()=>y(!1),width:420,height:560,children:o.jsx(nj,{group:s})})]})}function Vj(){return o.jsx("div",{className:"top-fade"})}function $j(){const e=Ae(),t=e.shownConnection.kind==="connecting",s=e.connection.kind!=="online"?"wifi.slash":e.hostRoute==="relay"?"cloud":e.hostRoute==="direct"?"wifi":e.hostRoute==="loopback"?"desktopcomputer":"network",r=(()=>{switch(e.shownConnection.kind){case"connecting":return"Connecting";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}return e.mismatch?"Needs update":e.hostRoute==="relay"?"Connected through Cloudflare":e.hostRoute==="direct"?"Connected over Wi-Fi or Tailscale":e.hostRoute==="loopback"?"Connected locally":"Connected"})();return o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...R(10,"medium"),color:"var(--secondary)"},title:`${e.hostName} · ${r}`,"aria-label":`${e.hostName}, ${r}`,children:[o.jsx("span",{style:{width:12,display:"flex",justifyContent:"center"},children:t?o.jsx($e,{size:8}):o.jsx(se,{name:s,size:8,weight:"medium"})}),o.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.connectionLabel})]})}const z_=40;function Wj({botId:e,openTrace:t,openThread:s,openRoutine:r,openBotChat:l}){const h=Ae(),u=h.bots.get(e)??null,p=h.chat(e),m=!!u&&pp(u,e,null)&&!h.isOffline,g=d2(p,!0),[y,v]=b.useState(null),[x,S]=b.useState(!1),w=y?g.findIndex(O=>O.id===y):-1,C=w>=0?w:Math.max(0,g.length-z_),j=g.slice(C),E=C>0||h.canLoadOlder(e),[A,N]=b.useState(!0),L=b.useRef(!0);L.current=A;const q=b.useRef(null),B=b.useRef(0),I=b.useRef(null),U=j[j.length-1],P=Jx([...j.map(O=>O.id),...m?["working"]:[]],A),F=(O=!1)=>{const M=q.current;M&&M.scrollTo({top:M.scrollHeight,behavior:O?"smooth":"auto"})};b.useEffect(()=>{!y&&j[0]&&v(j[0].id)},[y,j]);const $=async()=>{if(x)return;S(!0);const O=q.current;I.current=O?O.scrollHeight-O.scrollTop:null;let M=g,X=C;if(X===0){const V=M[0]?.id;await h.loadOlder(e),M=d2(h.chat(e),!0),X=V?Math.max(0,M.findIndex(ie=>ie.id===V)):0}X>0&&v(M[Math.max(0,X-z_)].id),S(!1)};b.useLayoutEffect(()=>{const O=q.current;O&&(I.current!==null&&!L.current?(O.scrollTop=O.scrollHeight-I.current,I.current=null):L.current&&F())});const z=U?.kind==="entry"&&U.entry.kind==="user";return b.useEffect(()=>{z&&N(!0)},[U?.id,z]),b.useEffect(()=>{const O=q.current;if(!O)return;const M=new ResizeObserver(()=>{L.current&&F()});return M.observe(O.firstElementChild),M.observe(O),()=>M.disconnect()},[]),o.jsxs("div",{className:"transcript-frame",children:[o.jsx("div",{className:"transcript",ref:q,onScroll:O=>{const M=O.currentTarget,X=M.scrollHeight-M.scrollTop-M.clientHeight<8;M.scrollTop<B.current-1&&!X?N(!1):X&&N(!0),B.current=M.scrollTop,E&&M.scrollTop<200&&!x&&$()},children:o.jsxs("div",{className:"transcript-content",children:[E?o.jsx("button",{className:"load-earlier",disabled:x,onClick:()=>{$()},children:x?o.jsx($e,{size:14}):"Load earlier messages"}):null,j.length===0&&u?o.jsx("div",{style:{paddingTop:40},children:ft(u)?o.jsx(Kj,{group:u}):o.jsx(Yj,{bot:u})}):null,j.map(O=>o.jsx("div",{className:P.has(O.id)?ew(O):void 0,children:o.jsx(Fj,{item:O,chat:u,openTrace:t,openThread:s,openRoutine:r,openBotChat:l})},O.id)),u&&m?o.jsx("div",{className:P.has("working")?"row-in":void 0,style:{paddingTop:6},children:o.jsx(gw,{bot:u,thinking:h.currentThinking(e,null)})}):null,o.jsx("div",{style:{height:8}})]})}),!A&&j.length?o.jsx("div",{className:"jump-to-latest",style:{bottom:"calc(var(--composer-height, 70px) + 10px)"},children:o.jsx(Ip,{title:"Jump to latest",icon:"arrow.down",direction:[0,1],onClick:()=>{N(!0),F(!0)}})}):null]})}function Fj({item:e,chat:t,openTrace:s,openThread:r,openRoutine:l,openBotChat:h}){if(e.kind==="separator")return o.jsx(pw,{date:e.date});if(e.kind==="exchanges")return o.jsx(D9,{exchanges:e.exchanges,open:h});const u=e.entry;return u.kind==="notice"&&u.data.routineId?o.jsxs("button",{onClick:()=>l(u.data.routineId),style:{display:"flex",alignItems:"center",gap:6,...R("footnote"),color:"var(--secondary)",padding:"10px 0",margin:"0 auto"},children:[o.jsx(se,{name:"clock.arrow.circlepath",size:10}),u.data.text??"Routine"]}):o.jsx(S2,{entry:u,groupStart:e.groupStart,chat:t,openTrace:s,openThread:r})}function Kj({group:e}){const s=Ae().members(e),r=s.map(l=>l.name);return o.jsxs("div",{className:"intro-card",children:[o.jsx(No,{members:s,size:72}),o.jsx("div",{style:{...R("title2","semibold"),color:"var(--text)"},children:e.name}),e.name!==r.join(", ")?o.jsx("div",{style:{...R("subheadline"),color:"var(--secondary)"},children:r.join(" · ")}):null,e.description?o.jsx("div",{style:{...R("subheadline"),color:"var(--secondary)"},children:e.description}):null,o.jsx("div",{style:{...R("callout"),color:"var(--secondary)",paddingTop:4,lineHeight:1.5,maxWidth:360,textWrap:"balance"},children:"Everyone answers in turn. @mention a bot to ask just that one."})]})}function Yj({bot:e}){const t=Ae();return o.jsxs("div",{className:"intro-card",children:[o.jsx(hi,{bot:e,size:72}),o.jsx("div",{style:{...R("title2","semibold"),color:"var(--text)"},children:e.name}),o.jsx("div",{style:{...R("callout"),color:"var(--secondary)",overflowWrap:"anywhere"},children:e.managedWorkspace?`${t.backendName(e.backend)} · Personal workspace`:`${t.backendName(e.backend)} in ${e.cwd}`}),e.description?o.jsx("div",{style:{...R("subheadline"),color:"var(--secondary)"},children:e.description}):null,o.jsx("div",{style:{...R("callout"),color:"var(--secondary)",paddingTop:4,lineHeight:1.5},children:"Tell it what you need. You'll get a notification when it's done or needs you."})]})}function Gj({group:e,onClose:t}){const s=Ae(),[r,l]=b.useState(""),[h,u]=b.useState(""),[p,m]=b.useState([]),[g,y]=b.useState(!1),v=b.useRef(null),x=b.useRef(null),S=r.trim().toLowerCase(),w=s.roster.filter(P=>!p.includes(P.id)&&!(ft(P)&&(e||p.length>0))&&(!S||P.name.toLowerCase().includes(S))),C=p.map(P=>s.bots.get(P)).filter(P=>!!P),j=e?p.length<2?"Add bots to the group":"Add another bot":p.length?"Add another bot":"Search or create bots",E=e?C.length<2?"Pick at least two bots":"Message the group":C.length===0?"Message Bot":`Message ${C.map(P=>P.name).join(", ")}`;b.useEffect(()=>{v.current?.focus()},[]),b.useLayoutEffect(()=>{const P=x.current;P&&P.scrollTo({left:P.scrollWidth,behavior:"smooth"})},[p]);const A=P=>{const F=h.trim();s.setSelection(P),F&&s.send(F,P),t()},N=P=>{if(ft(P))return A(P.id);m(F=>[...F,P.id]),l(""),v.current?.focus()},L=P=>m(F=>F.filter($=>$!==P)),q=()=>{if(p.length!==0){if(p.length===1){e||A(p[0]);return}s.createGroup(C.map(P=>P.name).join(", "),"",p).then(P=>A(P.id)).catch(P=>s.setError(Br(P)))}},B=()=>{if(g)return;y(!0);const P=r.trim(),F=p.length===0&&!e;(async()=>{try{let $=await Rk(s);P&&($=await s.save({...Co($),name:P})),F?A($.id):(s.setSelection(null),N($))}catch($){s.setError(Br($))}y(!1)})()},I=()=>{S?w[0]?N(w[0]):B():q()},U=b.useRef({create:B,choose:N,matches:w,onClose:t});return U.current={create:B,choose:N,matches:w,onClose:t},b.useEffect(()=>{const P=F=>{if(F.key==="Escape"){F.preventDefault(),U.current.onClose();return}if(!F.metaKey||F.shiftKey||F.altKey||F.ctrlKey)return;const $=Number(F.key);if(!(!Number.isInteger($)||$<1||$>9))if(F.preventDefault(),$===1)U.current.create();else{const z=U.current.matches[$-2];z&&U.current.choose(z)}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[]),o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px",...R("title3")},children:[o.jsx("span",{style:{color:"var(--secondary)",flex:"none"},children:"To:"}),o.jsxs("div",{ref:x,className:"chip-row",style:{flex:1},children:[C.map(P=>o.jsx(Hk,{bot:P,onRemove:()=>L(P.id)},P.id)),o.jsx("input",{ref:v,value:r,placeholder:j,style:{minWidth:200,flex:1,color:"var(--text)",userSelect:"text"},onChange:P=>l(P.target.value),onKeyDown:P=>{P.nativeEvent.isComposing||P.keyCode===229||(P.key==="Enter"?(P.preventDefault(),I()):P.key==="Backspace"&&!r&&p.length&&(P.preventDefault(),L(p[p.length-1])))}})]}),o.jsx(be,{title:"Close",icon:"xmark",onClick:t})]}),o.jsx("div",{className:"hairline"}),o.jsxs("div",{className:"compose-list",children:[o.jsx(H_,{shortcut:1,onClick:B,icon:o.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:o.jsx(se,{name:g?"hourglass":"plus",size:13,weight:"medium",className:"fade-in"},g?"hourglass":"plus")}),children:r?`Create “${r}”`:"Create new Bot"}),w.map((P,F)=>o.jsx(H_,{shortcut:F+2<=9?F+2:null,onClick:()=>N(P),icon:ft(P)?o.jsx(No,{members:s.members(P),size:26,animated:!1}):o.jsx(hi,{bot:P,size:26,animated:!1}),children:P.name},P.id))]}),o.jsx("div",{style:{flex:1}}),o.jsx("div",{className:"compose-box",children:o.jsx(Hp,{value:h,onChange:u,placeholder:E,minRows:1,maxRows:6,onKeyDown:P=>{P.key==="Enter"&&!P.shiftKey&&!P.nativeEvent.isComposing&&P.keyCode!==229&&(P.preventDefault(),q())}})})]})}function H_({shortcut:e,onClick:t,icon:s,children:r}){return o.jsxs("button",{className:"press pick-row hover fade-in",onClick:t,children:[s,o.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r}),e!==null?o.jsxs("span",{style:{display:"flex",gap:3},children:[o.jsx("span",{className:"key-cap",children:"⌘"}),o.jsx("span",{className:"key-cap",children:e})]}):null]})}var Zj=2,Xj=1,Qj=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),l=Math.max(0,parseInt(s.getPropertyValue("width"))),h=window.getComputedStyle(this._terminal.element),u={top:parseInt(h.getPropertyValue("padding-top")),bottom:parseInt(h.getPropertyValue("padding-bottom")),right:parseInt(h.getPropertyValue("padding-right")),left:parseInt(h.getPropertyValue("padding-left"))},p=u.top+u.bottom,m=u.right+u.left,g=r-p,y=l-m-t;return{cols:Math.max(Zj,Math.floor(y/e.css.cell.width)),rows:Math.max(Xj,Math.floor(g/e.css.cell.height))}}};var Jj=class{constructor(t,s,r,l={}){this._terminal=t,this._regex=s,this._handler=r,this._options=l}provideLinks(t,s){let r=tE.computeLink(t,this._regex,this._terminal,this._handler);s(this._addCallbacks(r))}_addCallbacks(t){return t.map(s=>(s.leave=this._options.leave,s.hover=(r,l)=>{if(this._options.hover){let{range:h}=s;this._options.hover(r,l,h)}},s))}};function eE(e){try{let t=new URL(e),s=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}var tE=class Rh{static computeLink(t,s,r,l){let h=new RegExp(s.source,(s.flags||"")+"g"),[u,p]=Rh._getWindowedLineStrings(t-1,r),m=u.join(""),g,y=[];for(;g=h.exec(m);){let v=g[0];if(!eE(v))continue;let[x,S]=Rh._mapStrIdx(r,p,0,g.index),[w,C]=Rh._mapStrIdx(r,x,S,v.length);if(x===-1||S===-1||w===-1||C===-1)continue;let j={start:{x:S+1,y:x+1},end:{x:C,y:w+1}};y.push({range:j,text:v,activate:l})}return y}static _getWindowedLineStrings(t,s){let r,l=t,h=t,u=0,p="",m=[];if(r=s.buffer.active.getLine(t)){let g=r.translateToString(!0);if(r.isWrapped&&g[0]!==" "){for(u=0;(r=s.buffer.active.getLine(--l))&&u<2048&&(p=r.translateToString(!0),u+=p.length,m.push(p),!(!r.isWrapped||p.indexOf(" ")!==-1)););m.reverse()}for(m.push(g),u=0;(r=s.buffer.active.getLine(++h))&&r.isWrapped&&u<2048&&(p=r.translateToString(!0),u+=p.length,m.push(p),p.indexOf(" ")===-1););}return[m,l]}static _mapStrIdx(t,s,r,l){let h=t.buffer.active,u=h.getNullCell(),p=r;for(;l;){let m=h.getLine(s);if(!m)return[-1,-1];for(let g=p;g<m.length;++g){m.getCell(g,u);let y=u.getChars();if(u.getWidth()&&(l-=y.length||1,g===m.length-1&&y==="")){let v=h.getLine(s+1);v&&v.isWrapped&&(v.getCell(0,u),u.getWidth()===2&&(l+=1))}if(l<0)return[s,g]}s++,p=0}return[s,p]}},iE=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function sE(e,t){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var nE=class{constructor(t=sE,s={}){this._handler=t,this._options=s}activate(t){this._terminal=t;let s=this._options,r=s.urlRegex||iE;this._linkProvider=this._terminal.registerLinkProvider(new Jj(this._terminal,r,this._handler,s))}dispose(){this._linkProvider?.dispose()}};var Zw=Object.defineProperty,rE=Object.getOwnPropertyDescriptor,aE=(e,t)=>{for(var s in t)Zw(e,s,{get:t[s],enumerable:!0})},St=(e,t,s,r)=>{for(var l=r>1?void 0:r?rE(t,s):t,h=e.length-1,u;h>=0;h--)(u=e[h])&&(l=(r?u(t,s,l):u(l))||l);return r&&l&&Zw(t,s,l),l},ve=(e,t)=>(s,r)=>t(s,r,e),I_="Terminal input",A2={get:()=>I_,set:e=>I_=e},U_="Too much output to announce, navigate to rows manually to read",T2={get:()=>U_,set:e=>U_=e};function lE(e){return e.replace(/\r?\n/g,"\r")}function oE(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function cE(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function hE(e,t,s,r){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");Xw(l,t,s,r)}}function Xw(e,t,s,r){e=lE(e),e=oE(e,s.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function Qw(e,t,s){let r=s.getBoundingClientRect(),l=e.clientX-r.left-10,h=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${h}px`,t.style.zIndex="1000",t.focus()}function P_(e,t,s,r,l){Qw(e,t,s),l&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Qn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function du(e,t=0,s=e.length){let r="";for(let l=t;l<s;++l){let h=e[l];h>65535?(h-=65536,r+=String.fromCharCode((h>>10)+55296)+String.fromCharCode(h%1024+56320)):r+=String.fromCharCode(h)}return r}var uE=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let r=0,l=0;if(this._interim){let h=e.charCodeAt(l++);56320<=h&&h<=57343?t[r++]=(this._interim-55296)*1024+h-56320+65536:(t[r++]=this._interim,t[r++]=h),this._interim=0}for(let h=l;h<s;++h){let u=e.charCodeAt(h);if(55296<=u&&u<=56319){if(++h>=s)return this._interim=u,r;let p=e.charCodeAt(h);56320<=p&&p<=57343?t[r++]=(u-55296)*1024+p-56320+65536:(t[r++]=u,t[r++]=p);continue}u!==65279&&(t[r++]=u)}return r}},dE=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let r=0,l,h,u,p,m=0,g=0;if(this.interim[0]){let x=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,C;for(;(C=this.interim[++w]&63)&&w<4;)S<<=6,S|=C;let j=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,E=j-w;for(;g<E;){if(g>=s)return 0;if(C=e[g++],(C&192)!==128){g--,x=!0;break}else this.interim[w++]=C,S<<=6,S|=C&63}x||(j===2?S<128?g--:t[r++]=S:j===3?S<2048||S>=55296&&S<=57343||S===65279||(t[r++]=S):S<65536||S>1114111||(t[r++]=S)),this.interim.fill(0)}let y=s-4,v=g;for(;v<s;){for(;v<y&&!((l=e[v])&128)&&!((h=e[v+1])&128)&&!((u=e[v+2])&128)&&!((p=e[v+3])&128);)t[r++]=l,t[r++]=h,t[r++]=u,t[r++]=p,v+=4;if(l=e[v++],l<128)t[r++]=l;else if((l&224)===192){if(v>=s)return this.interim[0]=l,r;if(h=e[v++],(h&192)!==128){v--;continue}if(m=(l&31)<<6|h&63,m<128){v--;continue}t[r++]=m}else if((l&240)===224){if(v>=s)return this.interim[0]=l,r;if(h=e[v++],(h&192)!==128){v--;continue}if(v>=s)return this.interim[0]=l,this.interim[1]=h,r;if(u=e[v++],(u&192)!==128){v--;continue}if(m=(l&15)<<12|(h&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[r++]=m}else if((l&248)===240){if(v>=s)return this.interim[0]=l,r;if(h=e[v++],(h&192)!==128){v--;continue}if(v>=s)return this.interim[0]=l,this.interim[1]=h,r;if(u=e[v++],(u&192)!==128){v--;continue}if(v>=s)return this.interim[0]=l,this.interim[1]=h,this.interim[2]=u,r;if(p=e[v++],(p&192)!==128){v--;continue}if(m=(l&7)<<18|(h&63)<<12|(u&63)<<6|p&63,m<65536||m>1114111)continue;t[r++]=m}}return r}},Jw="",tr=" ",Lo=class eS{constructor(){this.fg=0,this.bg=0,this.extended=new Qh}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new eS;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Qh=class tS{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new tS(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},hs=class iS extends Lo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Qh,this.combinedData=""}static fromCharData(t){let s=new iS;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Qn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(r-55296)*1024+l-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},q_="di$target",N2="di$dependencies",_0=new Map;function fE(e){return e[N2]||[]}function Wt(e){if(_0.has(e))return _0.get(e);let t=function(s,r,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");pE(t,s,l)};return t._id=e,_0.set(e,t),t}function pE(e,t,s){t[q_]===t?t[N2].push({id:e,index:s}):(t[N2]=[{id:e,index:s}],t[q_]=t)}var xi=Wt("BufferService"),sS=Wt("CoreMouseService"),Vr=Wt("CoreService"),mE=Wt("CharsetService"),qp=Wt("InstantiationService"),nS=Wt("LogService"),wi=Wt("OptionsService"),rS=Wt("OscLinkService"),gE=Wt("UnicodeService"),Bo=Wt("DecorationService"),D2=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let r=[],l=this._optionsService.rawOptions.linkHandler,h=new hs,u=s.getTrimmedLength(),p=-1,m=-1,g=!1;for(let y=0;y<u;y++)if(!(m===-1&&!s.hasContent(y))){if(s.loadCell(y,h),h.hasExtendedAttrs()&&h.extended.urlId)if(m===-1){m=y,p=h.extended.urlId;continue}else g=h.extended.urlId!==p;else m!==-1&&(g=!0);if(g||m!==-1&&y===u-1){let v=this._oscLinkService.getLinkData(p)?.uri;if(v){let x={start:{x:m+1,y:e},end:{x:y+(!g&&y===u-1?1:0),y:e}},S=!1;if(!l?.allowNonHttpProtocols)try{let w=new URL(v);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||r.push({text:v,range:x,activate:(w,C)=>l?l.activate(w,C,x):vE(w,C),hover:(w,C)=>l?.hover?.(w,C,x),leave:(w,C)=>l?.leave?.(w,C,x)})}g=!1,h.hasExtendedAttrs()&&h.extended.urlId?(m=y,p=h.extended.urlId):(m=-1,p=-1)}}t(r)}};D2=St([ve(0,xi),ve(1,wi),ve(2,rS)],D2);function vE(e,t){if(confirm(`Do you want to navigate to ${t}?
+
+WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var fu=Wt("CharSizeService"),gn=Wt("CoreBrowserService"),Vp=Wt("MouseService"),vn=Wt("RenderService"),yE=Wt("SelectionService"),aS=Wt("CharacterJoinerService"),el=Wt("ThemeService"),lS=Wt("LinkProviderService"),_E=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?V_.isErrorNoTelemetry(e)?new V_(e.message+`
+
+`+e.stack):new Error(e.message+`
+
+`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},xE=new _E;function Lh(e){wE(e)||xE.onUnexpectedError(e)}var R2="Canceled";function wE(e){return e instanceof SE?!0:e instanceof Error&&e.name===R2&&e.message===R2}var SE=class extends Error{constructor(){super(R2),this.name=this.message}};function bE(e){return new Error(`Illegal argument: ${e}`)}var V_=class L2 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof L2)return t;let s=new L2;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},B2=class oS extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,oS.prototype)}};function $i(e,t=0){return e[e.length-(1+t)]}var CE;(e=>{function t(h){return h<0}e.isLessThan=t;function s(h){return h<=0}e.isLessThanOrEqual=s;function r(h){return h>0}e.isGreaterThan=r;function l(h){return h===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(CE||={});function kE(e,t){let s=this,r=!1,l;return function(){return r||(r=!0,t||(l=e.apply(s,arguments))),l}}var cS;(e=>{function t(L){return L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function r(){return s}e.empty=r;function*l(L){yield L}e.single=l;function h(L){return t(L)?L:l(L)}e.wrap=h;function u(L){return L||s}e.from=u;function*p(L){for(let q=L.length-1;q>=0;q--)yield L[q]}e.reverse=p;function m(L){return!L||L[Symbol.iterator]().next().done===!0}e.isEmpty=m;function g(L){return L[Symbol.iterator]().next().value}e.first=g;function y(L,q){let B=0;for(let I of L)if(q(I,B++))return!0;return!1}e.some=y;function v(L,q){for(let B of L)if(q(B))return B}e.find=v;function*x(L,q){for(let B of L)q(B)&&(yield B)}e.filter=x;function*S(L,q){let B=0;for(let I of L)yield q(I,B++)}e.map=S;function*w(L,q){let B=0;for(let I of L)yield*q(I,B++)}e.flatMap=w;function*C(...L){for(let q of L)yield*q}e.concat=C;function j(L,q,B){let I=B;for(let U of L)I=q(I,U);return I}e.reduce=j;function*E(L,q,B=L.length){for(q<0&&(q+=L.length),B<0?B+=L.length:B>L.length&&(B=L.length);q<B;q++)yield L[q]}e.slice=E;function A(L,q=Number.POSITIVE_INFINITY){let B=[];if(q===0)return[B,L];let I=L[Symbol.iterator]();for(let U=0;U<q;U++){let P=I.next();if(P.done)return[B,e.empty()];B.push(P.value)}return[B,{[Symbol.iterator](){return I}}]}e.consume=A;async function N(L){let q=[];for await(let B of L)q.push(B);return Promise.resolve(q)}e.asyncToArray=N})(cS||={});function zr(e){if(cS.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function jE(...e){return pt(()=>zr(e))}function pt(e){return{dispose:kE(()=>{e()})}}var hS=class uS{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{zr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?uS.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};hS.DISABLE_DISPOSED_WARNING=!1;var sr=hS,Ie=class{constructor(){this._store=new sr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ie.None=Object.freeze({dispose(){}});var Xa=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},dn=typeof window=="object"?window:globalThis,O2=class z2{constructor(t){this.element=t,this.next=z2.Undefined,this.prev=z2.Undefined}};O2.Undefined=new O2(void 0);var vt=O2,$_=class{constructor(){this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===vt.Undefined}clear(){let e=this._first;for(;e!==vt.Undefined;){let t=e.next;e.prev=vt.Undefined,e.next=vt.Undefined,e=t}this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new vt(e);if(this._first===vt.Undefined)this._first=s,this._last=s;else if(t){let l=this._last;this._last=s,s.prev=l,l.next=s}else{let l=this._first;this._first=s,s.next=l,l.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==vt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==vt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==vt.Undefined&&e.next!==vt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===vt.Undefined&&e.next===vt.Undefined?(this._first=vt.Undefined,this._last=vt.Undefined):e.next===vt.Undefined?(this._last=this._last.prev,this._last.next=vt.Undefined):e.prev===vt.Undefined&&(this._first=this._first.next,this._first.prev=vt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==vt.Undefined;)yield e.element,e=e.next}},EE=globalThis.performance&&typeof globalThis.performance.now=="function",ME=class dS{static create(t){return new dS(t)}constructor(t){this._now=EE&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ii;(e=>{e.None=()=>Ie.None;function t(z,O){return v(z,()=>{},0,void 0,!0,void 0,O)}e.defer=t;function s(z){return(O,M=null,X)=>{let V=!1,ie;return ie=z(ee=>{if(!V)return ie?ie.dispose():V=!0,O.call(M,ee)},null,X),V&&ie.dispose(),ie}}e.once=s;function r(z,O,M){return g((X,V=null,ie)=>z(ee=>X.call(V,O(ee)),null,ie),M)}e.map=r;function l(z,O,M){return g((X,V=null,ie)=>z(ee=>{O(ee),X.call(V,ee)},null,ie),M)}e.forEach=l;function h(z,O,M){return g((X,V=null,ie)=>z(ee=>O(ee)&&X.call(V,ee),null,ie),M)}e.filter=h;function u(z){return z}e.signal=u;function p(...z){return(O,M=null,X)=>{let V=jE(...z.map(ie=>ie(ee=>O.call(M,ee))));return y(V,X)}}e.any=p;function m(z,O,M,X){let V=M;return r(z,ie=>(V=O(V,ie),V),X)}e.reduce=m;function g(z,O){let M,X={onWillAddFirstListener(){M=z(V.fire,V)},onDidRemoveLastListener(){M?.dispose()}},V=new de(X);return O?.add(V),V.event}function y(z,O){return O instanceof Array?O.push(z):O&&O.add(z),z}function v(z,O,M=100,X=!1,V=!1,ie,ee){let ce,Y,oe,xe=0,we,D={leakWarningThreshold:ie,onWillAddFirstListener(){ce=z(le=>{xe++,Y=O(Y,le),X&&!oe&&(J.fire(Y),Y=void 0),we=()=>{let he=Y;Y=void 0,oe=void 0,(!X||xe>1)&&J.fire(he),xe=0},typeof M=="number"?(clearTimeout(oe),oe=setTimeout(we,M)):oe===void 0&&(oe=0,queueMicrotask(we))})},onWillRemoveListener(){V&&xe>0&&we?.()},onDidRemoveLastListener(){we=void 0,ce.dispose()}},J=new de(D);return ee?.add(J),J.event}e.debounce=v;function x(z,O=0,M){return e.debounce(z,(X,V)=>X?(X.push(V),X):[V],O,void 0,!0,void 0,M)}e.accumulate=x;function S(z,O=(X,V)=>X===V,M){let X=!0,V;return h(z,ie=>{let ee=X||!O(ie,V);return X=!1,V=ie,ee},M)}e.latch=S;function w(z,O,M){return[e.filter(z,O,M),e.filter(z,X=>!O(X),M)]}e.split=w;function C(z,O=!1,M=[],X){let V=M.slice(),ie=z(Y=>{V?V.push(Y):ce.fire(Y)});X&&X.add(ie);let ee=()=>{V?.forEach(Y=>ce.fire(Y)),V=null},ce=new de({onWillAddFirstListener(){ie||(ie=z(Y=>ce.fire(Y)),X&&X.add(ie))},onDidAddFirstListener(){V&&(O?setTimeout(ee):ee())},onDidRemoveLastListener(){ie&&ie.dispose(),ie=null}});return X&&X.add(ce),ce.event}e.buffer=C;function j(z,O){return(M,X,V)=>{let ie=O(new A);return z(function(ee){let ce=ie.evaluate(ee);ce!==E&&M.call(X,ce)},void 0,V)}}e.chain=j;let E=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(M=>(O(M),M)),this}filter(O){return this.steps.push(M=>O(M)?M:E),this}reduce(O,M){let X=M;return this.steps.push(V=>(X=O(X,V),X)),this}latch(O=(M,X)=>M===X){let M=!0,X;return this.steps.push(V=>{let ie=M||!O(V,X);return M=!1,X=V,ie?V:E}),this}evaluate(O){for(let M of this.steps)if(O=M(O),O===E)break;return O}}function N(z,O,M=X=>X){let X=(...ce)=>ee.fire(M(...ce)),V=()=>z.on(O,X),ie=()=>z.removeListener(O,X),ee=new de({onWillAddFirstListener:V,onDidRemoveLastListener:ie});return ee.event}e.fromNodeEventEmitter=N;function L(z,O,M=X=>X){let X=(...ce)=>ee.fire(M(...ce)),V=()=>z.addEventListener(O,X),ie=()=>z.removeEventListener(O,X),ee=new de({onWillAddFirstListener:V,onDidRemoveLastListener:ie});return ee.event}e.fromDOMEventEmitter=L;function q(z){return new Promise(O=>s(z)(O))}e.toPromise=q;function B(z){let O=new de;return z.then(M=>{O.fire(M)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}e.fromPromise=B;function I(z,O){return z(M=>O.fire(M))}e.forward=I;function U(z,O,M){return O(M),z(X=>O(X))}e.runAndSubscribe=U;class P{constructor(O,M){this._observable=O,this._counter=0,this._hasChanged=!1;let X={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new de(X),M&&M.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,M){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(z,O){return new P(z,O).emitter.event}e.fromObservable=F;function $(z){return(O,M,X)=>{let V=0,ie=!1,ee={beginUpdate(){V++},endUpdate(){V--,V===0&&(z.reportChanges(),ie&&(ie=!1,O.call(M)))},handlePossibleChange(){},handleChange(){ie=!0}};z.addObserver(ee),z.reportChanges();let ce={dispose(){z.removeObserver(ee)}};return X instanceof sr?X.add(ce):Array.isArray(X)&&X.push(ce),ce}}e.fromObservableLight=$})(ii||={});var H2=class I2{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${I2._idPool++}`,I2.all.add(this)}start(t){this._stopWatch=new ME,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};H2.all=new Set,H2._idPool=0;var AE=H2,TE=-1,fS=class pS{constructor(t,s,r=(pS._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let r=this.threshold;if(r<=0||s<r)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[h,u]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${u}):`;console.warn(p),console.warn(h);let m=new RE(p,h);this._errorHandler(m)}return()=>{let h=this._stacks.get(t.value)||0;this._stacks.set(t.value,h-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[r,l]of this._stacks)(!t||s<l)&&(t=[r,l],s=l);return t}};fS._idPool=1;var NE=fS,DE=class mS{constructor(t){this.value=t}static create(){let t=new Error;return new mS(t.stack??"")}print(){console.warn(this.value.split(`
+`).slice(2).join(`
+`))}},RE=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},LE=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},BE=0,x0=class{constructor(e){this.value=e,this.id=BE++}},OE=2,zE,de=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new NE(e?.onListenerError??Lh,this._options?.leakWarningThreshold??TE):void 0,this._perfMon=this._options?._profName?new AE(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new LE(`${u}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Lh)(m),Ie.None}if(this._disposed)return Ie.None;t&&(e=e.bind(t));let r=new x0(e),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=DE.create(),l=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof x0?(this._deliveryQueue??=new HE,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let h=pt(()=>{l?.(),this._removeListener(r)});return s instanceof sr?s.add(h):Array.isArray(s)&&s.push(h),h},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*OE<=t.length){let l=0;for(let h=0;h<t.length;h++)t[h]?t[l++]=t[h]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||Lh;if(!s){e.value(t);return}try{e.value(t)}catch(r){s(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof x0)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},HE=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},U2=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new de,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new de,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let r=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let r=this.getWindowId(s);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};U2.INSTANCE=new U2;var $p=U2;function IE(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}$p.INSTANCE.onDidChangeZoomLevel;function UE(e){return $p.INSTANCE.getZoomFactor(e)}$p.INSTANCE.onDidChangeFullscreen;var tl=typeof navigator=="object"?navigator.userAgent:"",P2=tl.indexOf("Firefox")>=0,PE=tl.indexOf("AppleWebKit")>=0,Wp=tl.indexOf("Chrome")>=0,qE=!Wp&&tl.indexOf("Safari")>=0;tl.indexOf("Electron/")>=0;tl.indexOf("Android")>=0;var w0=!1;if(typeof dn.matchMedia=="function"){let e=dn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=dn.matchMedia("(display-mode: fullscreen)");w0=e.matches,IE(dn,e,({matches:s})=>{w0&&t.matches||(w0=s)})}var $a="en",q2=!1,V2=!1,Bh=!1,gS=!1,bh,Oh=$a,W_=$a,VE,on,Dr=globalThis,Fi;typeof Dr.vscode<"u"&&typeof Dr.vscode.process<"u"?Fi=Dr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Fi=process);var $E=typeof Fi?.versions?.electron=="string",WE=$E&&Fi?.type==="renderer";if(typeof Fi=="object"){q2=Fi.platform==="win32",V2=Fi.platform==="darwin",Bh=Fi.platform==="linux",Bh&&Fi.env.SNAP&&Fi.env.SNAP_REVISION,Fi.env.CI||Fi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,bh=$a,Oh=$a;let e=Fi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);bh=t.userLocale,W_=t.osLocale,Oh=t.resolvedLanguage||$a,VE=t.languagePack?.translationsConfigFile}catch{}gS=!0}else typeof navigator=="object"&&!WE?(on=navigator.userAgent,q2=on.indexOf("Windows")>=0,V2=on.indexOf("Macintosh")>=0,(on.indexOf("Macintosh")>=0||on.indexOf("iPad")>=0||on.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Bh=on.indexOf("Linux")>=0,on?.indexOf("Mobi")>=0,Oh=globalThis._VSCODE_NLS_LANGUAGE||$a,bh=navigator.language.toLowerCase(),W_=bh):console.error("Unable to resolve platform.");var vS=q2,Us=V2,FE=Bh,F_=gS,qs=on,Kn=Oh,KE;(e=>{function t(){return Kn}e.value=t;function s(){return Kn.length===2?Kn==="en":Kn.length>=3?Kn[0]==="e"&&Kn[1]==="n"&&Kn[2]==="-":!1}e.isDefaultVariant=s;function r(){return Kn==="en"}e.isDefault=r})(KE||={});var YE=typeof Dr.postMessage=="function"&&!Dr.importScripts;(()=>{if(YE){let e=[];Dr.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let r=0,l=e.length;r<l;r++){let h=e[r];if(h.id===s.data.vscodeScheduleAsyncWork){e.splice(r,1),h.callback();return}}});let t=0;return s=>{let r=++t;e.push({id:r,callback:s}),Dr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var GE=!!(qs&&qs.indexOf("Chrome")>=0);qs&&qs.indexOf("Firefox")>=0;!GE&&qs&&qs.indexOf("Safari")>=0;qs&&qs.indexOf("Edg/")>=0;qs&&qs.indexOf("Android")>=0;var Ia=typeof navigator=="object"?navigator:{};F_||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ia&&Ia.clipboard&&Ia.clipboard.writeText,F_||Ia&&Ia.clipboard&&Ia.clipboard.readText;var Fp=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},S0=new Fp,K_=new Fp,Y_=new Fp,ZE=new Array(230),yS;(e=>{function t(p){return S0.keyCodeToStr(p)}e.toString=t;function s(p){return S0.strToKeyCode(p)}e.fromString=s;function r(p){return K_.keyCodeToStr(p)}e.toUserSettingsUS=r;function l(p){return Y_.keyCodeToStr(p)}e.toUserSettingsGeneral=l;function h(p){return K_.strToKeyCode(p)||Y_.strToKeyCode(p)}e.fromUserSettings=h;function u(p){if(p>=98&&p<=113)return null;switch(p){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return S0.keyCodeToStr(p)}e.toElectronAccelerator=u})(yS||={});var XE=class _S{constructor(t,s,r,l,h){this.ctrlKey=t,this.shiftKey=s,this.altKey=r,this.metaKey=l,this.keyCode=h}equals(t){return t instanceof _S&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",s=this.shiftKey?"1":"0",r=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${s}${r}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new QE([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},QE=class{constructor(e){if(e.length===0)throw bE("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function JE(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return yS.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(P2)switch(t){case 59:return 85;case 60:if(FE)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Us)return 57;break}else if(PE&&(Us&&t===93||!Us&&t===92))return 57;return ZE[t]||0}var eM=Us?256:2048,tM=512,iM=1024,sM=Us?2048:256,G_=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=JE(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=eM),this.altKey&&(t|=tM),this.shiftKey&&(t|=iM),this.metaKey&&(t|=sM),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new XE(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Z_=new WeakMap;function nM(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var rM=class{static getSameOriginWindowChain(e){let t=Z_.get(e);if(!t){t=[],Z_.set(e,t);let s=e,r;do r=nM(s),r?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=r;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,r=0,l=this.getSameOriginWindowChain(e);for(let h of l){let u=h.window.deref();if(s+=u?.scrollY??0,r+=u?.scrollX??0,u===t||!h.iframeElement)break;let p=h.iframeElement.getBoundingClientRect();s+=p.top,r+=p.left}return{top:s,left:r}}},Ch=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=rM.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},X_=class{constructor(e,t=0,s=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let r=!1;if(Wp){let l=navigator.userAgent.match(/Chrome\/(\d+)/);r=(l?parseInt(l[1]):123)<=122}if(e){let l=e,h=e,u=e.view?.devicePixelRatio||1;if(typeof l.wheelDeltaY<"u")r?this.deltaY=l.wheelDeltaY/(120*u):this.deltaY=l.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?P2&&!Us?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")qE&&vS?this.deltaX=-(l.wheelDeltaX/120):r?this.deltaX=l.wheelDeltaX/(120*u):this.deltaX=l.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?P2&&!Us?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},xS=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),aM;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof lM?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ii.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:xS})})(aM||={});var lM=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?xS:(this._emitter||(this._emitter=new de),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Kp=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new B2("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new B2("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},oM=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new B2("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},t);this.disposable=pt(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},cM;(e=>{async function t(r){let l,h=await Promise.all(r.map(u=>u.then(p=>p,p=>{l||(l=p)})));if(typeof l<"u")throw l;return h}e.settled=t;function s(r){return new Promise(async(l,h)=>{try{await r(l,h)}catch(u){h(u)}})}e.withAsyncBody=s})(cM||={});var Q_=class ns{static fromArray(t){return new ns(s=>{s.emitMany(t)})}static fromPromise(t){return new ns(async s=>{s.emitMany(await t)})}static fromPromises(t){return new ns(async s=>{await Promise.all(t.map(async r=>s.emitOne(await r)))})}static merge(t){return new ns(async s=>{await Promise.all(t.map(async r=>{for await(let l of r)s.emitOne(l)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new de,queueMicrotask(async()=>{let r={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(r)),this.resolve()}catch(l){this.reject(l)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ii.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new ns(async r=>{for await(let l of t)r.emitOne(s(l))})}map(t){return ns.map(this,t)}static filter(t,s){return new ns(async r=>{for await(let l of t)s(l)&&r.emitOne(l)})}filter(t){return ns.filter(this,t)}static coalesce(t){return ns.filter(t,s=>!!s)}coalesce(){return ns.coalesce(this)}static async toPromise(t){let s=[];for await(let r of t)s.push(r);return s}toPromise(){return ns.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Q_.EMPTY=Q_.fromArray([]);var{getWindow:Is,getWindowId:hM,onDidRegisterWindow:uM}=(function(){let e=new Map,t={window:dn,disposables:new sr};e.set(dn.vscodeWindowId,t);let s=new de,r=new de,l=new de;function h(u,p){return(typeof u=="number"?e.get(u):void 0)??(p?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:r.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Ie.None;let p=new sr,m={window:u,disposables:p.add(new sr)};return e.set(u.vscodeWindowId,m),p.add(pt(()=>{e.delete(u.vscodeWindowId),r.fire(u)})),p.add(Te(u,Pt.BEFORE_UNLOAD,()=>{l.fire(u)})),s.fire(m),p},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:h,getWindow(u){let p=u;if(p?.ownerDocument?.defaultView)return p.ownerDocument.defaultView.window;let m=u;return m?.view?m.view.window:dn},getDocument(u){return Is(u).document}}})(),dM=class{constructor(e,t,s,r){this._node=e,this._type=t,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Te(e,t,s,r){return new dM(e,t,s,r)}var J_=function(e,t,s,r){return Te(e,t,s,r)},Yp,fM=class extends oM{constructor(e){super(),this.defaultTarget=e&&Is(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},e3=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Lh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,r=new Map,l=h=>{s.set(h,!1);let u=e.get(h)??[];for(t.set(h,u),e.set(h,[]),r.set(h,!0);u.length>0;)u.sort(e3.sort),u.shift().execute();r.set(h,!1)};Yp=(h,u,p=0)=>{let m=hM(h),g=new e3(u,p),y=e.get(m);return y||(y=[],e.set(m,y)),y.push(g),s.get(m)||(s.set(m,!0),h.requestAnimationFrame(()=>l(m))),g}})();function pM(e){let t=e.getBoundingClientRect(),s=Is(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var Pt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},mM=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ai(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ai(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ai(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ai(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ai(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ai(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ai(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ai(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ai(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ai(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ai(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ai(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ai(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ai(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ai(e){return typeof e=="number"?`${e}px`:e}function bo(e){return new mM(e)}var wS=class{constructor(){this._hooks=new sr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,r,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=l;let h=e;try{e.setPointerCapture(t),this._hooks.add(pt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{h=Is(e)}this._hooks.add(Te(h,Pt.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Te(h,Pt.POINTER_UP,u=>this.stopMonitoring(!0)))}};function gM(e,t,s){let r=null,l=null;if(typeof s.value=="function"?(r="value",l=s.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(r="get",l=s.get),!l)throw new Error("not supported");let h=`$memoize$${t}`;s[r]=function(...u){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,u)}),this[h]}}var Hs;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Hs||={});var po=class oi extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new $_,this.ignoreTargets=new $_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ii.runAndSubscribe(uM,({window:t,disposables:s})=>{s.add(Te(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),s.add(Te(t.document,"touchend",r=>this.onTouchEnd(t,r))),s.add(Te(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:dn,disposables:this._store}))}static addTarget(t){if(!oi.isTouchDevice())return Ie.None;oi.INSTANCE||(oi.INSTANCE=new oi);let s=oi.INSTANCE.targets.push(t);return pt(s)}static ignoreTarget(t){if(!oi.isTouchDevice())return Ie.None;oi.INSTANCE||(oi.INSTANCE=new oi);let s=oi.INSTANCE.ignoreTargets.push(t);return pt(s)}static isTouchDevice(){return"ontouchstart"in dn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,l=t.targetTouches.length;r<l;r++){let h=t.targetTouches.item(r);this.activeTouches[h.identifier]={id:h.identifier,initialTarget:h.target,initialTimeStamp:s,initialPageX:h.pageX,initialPageY:h.pageY,rollingTimestamps:[s],rollingPageX:[h.pageX],rollingPageY:[h.pageY]};let u=this.newGestureEvent(Hs.Start,h.target);u.pageX=h.pageX,u.pageY=h.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let r=Date.now(),l=Object.keys(this.activeTouches).length;for(let h=0,u=s.changedTouches.length;h<u;h++){let p=s.changedTouches.item(h);if(!this.activeTouches.hasOwnProperty(String(p.identifier))){console.warn("move of an UNKNOWN touch",p);continue}let m=this.activeTouches[p.identifier],g=Date.now()-m.initialTimeStamp;if(g<oi.HOLD_DELAY&&Math.abs(m.initialPageX-$i(m.rollingPageX))<30&&Math.abs(m.initialPageY-$i(m.rollingPageY))<30){let y=this.newGestureEvent(Hs.Tap,m.initialTarget);y.pageX=$i(m.rollingPageX),y.pageY=$i(m.rollingPageY),this.dispatchEvent(y)}else if(g>=oi.HOLD_DELAY&&Math.abs(m.initialPageX-$i(m.rollingPageX))<30&&Math.abs(m.initialPageY-$i(m.rollingPageY))<30){let y=this.newGestureEvent(Hs.Contextmenu,m.initialTarget);y.pageX=$i(m.rollingPageX),y.pageY=$i(m.rollingPageY),this.dispatchEvent(y)}else if(l===1){let y=$i(m.rollingPageX),v=$i(m.rollingPageY),x=$i(m.rollingTimestamps)-m.rollingTimestamps[0],S=y-m.rollingPageX[0],w=v-m.rollingPageY[0],C=[...this.targets].filter(j=>m.initialTarget instanceof Node&&j.contains(m.initialTarget));this.inertia(t,C,r,Math.abs(S)/x,S>0?1:-1,y,Math.abs(w)/x,w>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(Hs.End,m.initialTarget)),delete this.activeTouches[p.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=s,r.tapCount=0,r}dispatchEvent(t){if(t.type===Hs.Tap){let s=new Date().getTime(),r=0;s-this._lastSetTapCountTime>oi.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=s,t.tapCount=r}else(t.type===Hs.Change||t.type===Hs.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let s=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let l=0,h=t.initialTarget;for(;h&&h!==r;)l++,h=h.parentElement;s.push([l,r])}s.sort((r,l)=>r[0]-l[0]);for(let[r,l]of s)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,r,l,h,u,p,m,g){this.handle=Yp(t,()=>{let y=Date.now(),v=y-r,x=0,S=0,w=!0;l+=oi.SCROLL_FRICTION*v,p+=oi.SCROLL_FRICTION*v,l>0&&(w=!1,x=h*l*v),p>0&&(w=!1,S=m*p*v);let C=this.newGestureEvent(Hs.Change);C.translationX=x,C.translationY=S,s.forEach(j=>j.dispatchEvent(C)),w||this.inertia(t,s,y,l,h,u+x,p,m,g+S)})}onTouchMove(t){let s=Date.now();for(let r=0,l=t.changedTouches.length;r<l;r++){let h=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("end of an UNKNOWN touch",h);continue}let u=this.activeTouches[h.identifier],p=this.newGestureEvent(Hs.Change,u.initialTarget);p.translationX=h.pageX-$i(u.rollingPageX),p.translationY=h.pageY-$i(u.rollingPageY),p.pageX=h.pageX,p.pageY=h.pageY,this.dispatchEvent(p),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(h.pageX),u.rollingPageY.push(h.pageY),u.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};po.SCROLL_FRICTION=-.005,po.HOLD_DELAY=700,po.CLEAR_TAP_COUNT_TIME=400,St([gM],po,"isTouchDevice",1);var vM=po,Gp=class extends Ie{onclick(e,t){this._register(Te(e,Pt.CLICK,s=>t(new Ch(Is(e),s))))}onmousedown(e,t){this._register(Te(e,Pt.MOUSE_DOWN,s=>t(new Ch(Is(e),s))))}onmouseover(e,t){this._register(Te(e,Pt.MOUSE_OVER,s=>t(new Ch(Is(e),s))))}onmouseleave(e,t){this._register(Te(e,Pt.MOUSE_LEAVE,s=>t(new Ch(Is(e),s))))}onkeydown(e,t){this._register(Te(e,Pt.KEY_DOWN,s=>t(new G_(s))))}onkeyup(e,t){this._register(Te(e,Pt.KEY_UP,s=>t(new G_(s))))}oninput(e,t){this._register(Te(e,Pt.INPUT,t))}onblur(e,t){this._register(Te(e,Pt.BLUR,t))}onfocus(e,t){this._register(Te(e,Pt.FOCUS,t))}onchange(e,t){this._register(Te(e,Pt.CHANGE,t))}ignoreGesture(e){return vM.ignoreTarget(e)}},t3=11,yM=class extends Gp{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=t3+"px",this.domNode.style.height=t3+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new wS),this._register(J_(this.bgDomNode,Pt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(J_(this.domNode,Pt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new fM),this._pointerdownScheduleRepeatTimer=this._register(new Kp)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Is(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},_M=class $2{constructor(t,s,r,l,h,u,p){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,r=r|0,l=l|0,h=h|0,u=u|0,p=p|0),this.rawScrollLeft=l,this.rawScrollTop=p,s<0&&(s=0),l+s>r&&(l=r-s),l<0&&(l=0),h<0&&(h=0),p+h>u&&(p=u-h),p<0&&(p=0),this.width=s,this.scrollWidth=r,this.scrollLeft=l,this.height=h,this.scrollHeight=u,this.scrollTop=p}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,s){return new $2(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new $2(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,s){let r=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,h=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,p=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:l,scrollLeftChanged:h,heightChanged:u,scrollHeightChanged:p,scrollTopChanged:m}}},xM=class extends Ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new _M(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let r;t?r=new s3(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=s3.start(this._state,s,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},i3=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function b0(e,t){let s=t-e;return function(r){return e+s*bM(r)}}function wM(e,t,s){return function(r){return r<s?e(r/s):t((r-s)/(1-s))}}var s3=class W2{constructor(t,s,r,l){this.from=t,this.to=s,this.duration=l,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,s,r){if(Math.abs(t-s)>2.5*r){let l,h;return t<s?(l=t+.75*r,h=s-.75*r):(l=t-.75*r,h=s+.75*r),wM(b0(t,l),b0(h,s),.33)}return b0(t,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let s=(t-this.startTime)/this.duration;if(s<1){let r=this.scrollLeft(s),l=this.scrollTop(s);return new i3(r,l,!1)}return new i3(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,r){return W2.start(t,s,r)}static start(t,s,r){r=r+10;let l=Date.now()-10;return new W2(t,s,l,r)}};function SM(e){return Math.pow(e,3)}function bM(e){return 1-SM(1-e)}var CM=class extends Ie{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Kp)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},kM=140,SS=class extends Gp{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new CM(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new wS),this._shouldRender=!0,this.domNode=bo(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Te(this.domNode.domNode,Pt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new yM(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,r){this.slider=bo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,Pt.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,s=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),l=this._sliderPointerPosition(e);s<=l&&l<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let l=pM(this.domNode.domNode);t=e.pageX-l.left,s=e.pageY-l.top}let r=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,l=>{let h=this._sliderOrthogonalPointerPosition(l),u=Math.abs(h-s);if(vS&&u>kM){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let p=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(p))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},bS=class F2{constructor(t,s,r,l,h,u){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=h,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new F2(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,r,l,h){let u=Math.max(0,r-t),p=Math.max(0,u-2*s),m=l>0&&l>r;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(p),computedSliderRatio:0,computedSliderPosition:0};let g=Math.round(Math.max(20,Math.floor(r*p/l))),y=(p-g)/(l-r),v=h*y;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(g),computedSliderRatio:y,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=F2._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,r=this._scrollPosition;return s<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},jM=class extends SS{constructor(e,t,s){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new bS(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,l.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},EM=class extends SS{constructor(e,t,s){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new bS(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,l.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},MM=500,n3=50,AM=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},K2=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,s=0,r=1,l=this._rear;do{let h=l===this._front?t:Math.pow(2,-r);if(t-=h,s+=this._memory[l].score*h,l===this._front)break;l=(this._capacity+l-1)%this._capacity,r++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(Wp){let s=Is(t.browserEvent),r=UE(s);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,r){let l=null,h=new AM(t,s,r);this._front===-1&&this._rear===-1?(this._memory[0]=h,this._front=0,this._rear=0):(l=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=h),h.score=this._computeScore(h,l)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),s){let l=Math.abs(t.deltaX),h=Math.abs(t.deltaY),u=Math.abs(s.deltaX),p=Math.abs(s.deltaY),m=Math.max(Math.min(l,u),1),g=Math.max(Math.min(h,p),1),y=Math.max(l,u),v=Math.max(h,p);y%m===0&&v%g===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};K2.INSTANCE=new K2;var TM=K2,NM=class extends Gp{constructor(e,t,s){super(),this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new de),this.onWillScroll=this._onWillScroll.event,this._options=RM(t),this._scrollable=s,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let r={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new EM(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new jM(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=bo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=bo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=bo(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new Kp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=zr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Us&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new X_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=zr(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new X_(s))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Pt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=TM.INSTANCE;t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+l===0?h=l=0:Math.abs(l)>=Math.abs(h)?h=0:l=0),this._options.flipAxes&&([l,h]=[h,l]);let u=!Us&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!h&&(h=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),m={};if(l){let g=n3*l,y=p.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(m,y)}if(h){let g=n3*h,y=p.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(m,y)}m=this._scrollable.validateScrollPosition(m),(p.scrollLeft!==m.scrollLeft||p.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),s=!0)}let r=s;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,s=e.scrollLeft>0,r=s?" left":"",l=t?" top":"",h=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${h}${l}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),MM)}},DM=class extends NM{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function RM(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Us&&(t.className+=" mac"),t}var Y2=class extends Ie{constructor(e,t,s,r,l,h,u,p){super(),this._bufferService=s,this._optionsService=u,this._renderService=p,this._onRequestScrollLines=this._register(new de),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new xM({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:g=>Yp(r.window,g)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new DM(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(g=>{this._scrollableElement.updateOptions({handleMouseWheel:!(g&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ii.runAndSubscribe(h.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=h.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(pt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(pt(()=>this._styleElement.remove())),this._register(ii.runAndSubscribe(h.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${h.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${h.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${h.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
+`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(g=>this._handleScroll(g)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Y2=St([ve(2,xi),ve(3,gn),ve(4,sS),ve(5,el),ve(6,wi),ve(7,vn)],Y2);var G2=class extends Ie{constructor(e,t,s,r,l){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=r,this._renderService=l,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(h=>this._removeDecoration(h))),this._register(pt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};G2=St([ve(1,xi),ve(2,gn),ve(3,Bo),ve(4,vn)],G2);var LM=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Bs={full:0,left:0,center:0,right:0},Yn={full:0,left:0,center:0,right:0},io={full:0,left:0,center:0,right:0},Jh=class extends Ie{constructor(e,t,s,r,l,h,u,p){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=r,this._renderService=l,this._optionsService=h,this._themeService=u,this._coreBrowserService=p,this._colorZoneStore=new LM,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(pt(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Yn.full=this._canvas.width,Yn.left=e,Yn.center=t,Yn.right=e,this._refreshDrawHeightConstants(),io.full=1,io.left=1,io.center=1+Yn.left,io.right=1+Yn.left+Yn.center}_refreshDrawHeightConstants(){Bs.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Bs.left=t,Bs.center=t,Bs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bs.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(io[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Bs[e.position||"full"]/2),Yn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Bs[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Jh=St([ve(2,xi),ve(3,Bo),ve(4,vn),ve(5,wi),ve(6,el),ve(7,gn)],Jh);var ae;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
+`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ae||={});var zh;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(zh||={});var CS;(e=>e.ST=`${ae.ESC}\\`)(CS||={});var Z2=class{constructor(e,t,s,r,l,h){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=r,this._coreService=l,this._renderService=h,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ae.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Z2=St([ve(2,xi),ve(3,wi),ve(4,Vr),ve(5,vn)],Z2);var qt=0,Vt=0,$t=0,wt=0,r3={css:"#00000000",rgba:0},Nt;(e=>{function t(l,h,u,p){return p!==void 0?`#${Mr(l)}${Mr(h)}${Mr(u)}${Mr(p)}`:`#${Mr(l)}${Mr(h)}${Mr(u)}`}e.toCss=t;function s(l,h,u,p=255){return(l<<24|h<<16|u<<8|p)>>>0}e.toRgba=s;function r(l,h,u,p){return{css:e.toCss(l,h,u,p),rgba:e.toRgba(l,h,u,p)}}e.toColor=r})(Nt||={});var ct;(e=>{function t(m,g){if(wt=(g.rgba&255)/255,wt===1)return{css:g.css,rgba:g.rgba};let y=g.rgba>>24&255,v=g.rgba>>16&255,x=g.rgba>>8&255,S=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;qt=S+Math.round((y-S)*wt),Vt=w+Math.round((v-w)*wt),$t=C+Math.round((x-C)*wt);let j=Nt.toCss(qt,Vt,$t),E=Nt.toRgba(qt,Vt,$t);return{css:j,rgba:E}}e.blend=t;function s(m){return(m.rgba&255)===255}e.isOpaque=s;function r(m,g,y){let v=Hh.ensureContrastRatio(m.rgba,g.rgba,y);if(v)return Nt.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=r;function l(m){let g=(m.rgba|255)>>>0;return[qt,Vt,$t]=Hh.toChannels(g),{css:Nt.toCss(qt,Vt,$t),rgba:g}}e.opaque=l;function h(m,g){return wt=Math.round(g*255),[qt,Vt,$t]=Hh.toChannels(m.rgba),{css:Nt.toCss(qt,Vt,$t,wt),rgba:Nt.toRgba(qt,Vt,$t,wt)}}e.opacity=h;function u(m,g){return wt=m.rgba&255,h(m,wt*g/255)}e.multiplyOpacity=u;function p(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=p})(ct||={});var yt;(e=>{let t,s;try{let l=document.createElement("canvas");l.width=1,l.height=1;let h=l.getContext("2d",{willReadFrequently:!0});h&&(t=h,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function r(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return qt=parseInt(l.slice(1,2).repeat(2),16),Vt=parseInt(l.slice(2,3).repeat(2),16),$t=parseInt(l.slice(3,4).repeat(2),16),Nt.toColor(qt,Vt,$t);case 5:return qt=parseInt(l.slice(1,2).repeat(2),16),Vt=parseInt(l.slice(2,3).repeat(2),16),$t=parseInt(l.slice(3,4).repeat(2),16),wt=parseInt(l.slice(4,5).repeat(2),16),Nt.toColor(qt,Vt,$t,wt);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let h=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(h)return qt=parseInt(h[1]),Vt=parseInt(h[2]),$t=parseInt(h[3]),wt=Math.round((h[5]===void 0?1:parseFloat(h[5]))*255),Nt.toColor(qt,Vt,$t,wt);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[qt,Vt,$t,wt]=t.getImageData(0,0,1,1).data,wt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Nt.toRgba(qt,Vt,$t,wt),css:l}}e.toColor=r})(yt||={});var yi;(e=>{function t(r){return s(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function s(r,l,h){let u=r/255,p=l/255,m=h/255,g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),y=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),v=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return g*.2126+y*.7152+v*.0722}e.relativeLuminance2=s})(yi||={});var Hh;(e=>{function t(u,p){if(wt=(p&255)/255,wt===1)return p;let m=p>>24&255,g=p>>16&255,y=p>>8&255,v=u>>24&255,x=u>>16&255,S=u>>8&255;return qt=v+Math.round((m-v)*wt),Vt=x+Math.round((g-x)*wt),$t=S+Math.round((y-S)*wt),Nt.toRgba(qt,Vt,$t)}e.blend=t;function s(u,p,m){let g=yi.relativeLuminance(u>>8),y=yi.relativeLuminance(p>>8);if(ln(g,y)<m){if(y<g){let S=r(u,p,m),w=ln(g,yi.relativeLuminance(S>>8));if(w<m){let C=l(u,p,m),j=ln(g,yi.relativeLuminance(C>>8));return w>j?S:C}return S}let v=l(u,p,m),x=ln(g,yi.relativeLuminance(v>>8));if(x<m){let S=r(u,p,m),w=ln(g,yi.relativeLuminance(S>>8));return x>w?v:S}return v}}e.ensureContrastRatio=s;function r(u,p,m){let g=u>>24&255,y=u>>16&255,v=u>>8&255,x=p>>24&255,S=p>>16&255,w=p>>8&255,C=ln(yi.relativeLuminance2(x,S,w),yi.relativeLuminance2(g,y,v));for(;C<m&&(x>0||S>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=ln(yi.relativeLuminance2(x,S,w),yi.relativeLuminance2(g,y,v));return(x<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=r;function l(u,p,m){let g=u>>24&255,y=u>>16&255,v=u>>8&255,x=p>>24&255,S=p>>16&255,w=p>>8&255,C=ln(yi.relativeLuminance2(x,S,w),yi.relativeLuminance2(g,y,v));for(;C<m&&(x<255||S<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=ln(yi.relativeLuminance2(x,S,w),yi.relativeLuminance2(g,y,v));return(x<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=l;function h(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=h})(Hh||={});function Mr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ln(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var BM=class extends Lo{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},eu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new hs}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],r=t.translateToString(!0),l=0,h=0,u=0,p=t.getFg(0),m=t.getBg(0);for(let g=0;g<t.getTrimmedLength();g++)if(t.loadCell(g,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==m){if(g-l>1){let y=this._getJoinedRanges(r,u,h,t,l);for(let v=0;v<y.length;v++)s.push(y[v])}l=g,u=h,p=this._workCell.fg,m=this._workCell.bg}h+=this._workCell.getChars().length||tr.length}if(this._bufferService.cols-l>1){let g=this._getJoinedRanges(r,u,h,t,l);for(let y=0;y<g.length;y++)s.push(g[y])}return s}_getJoinedRanges(e,t,s,r,l){let h=e.substring(t,s),u=[];try{u=this._characterJoiners[0].handler(h)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let m=this._characterJoiners[p].handler(h);for(let g=0;g<m.length;g++)eu._mergeRanges(u,m[g])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,r,l),u}_stringRangesToCellRanges(e,t,s){let r=0,l=!1,h=0,u=e[r];if(u){for(let p=s;p<this._bufferService.cols;p++){let m=t.getWidth(p),g=t.getString(p).length||tr.length;if(m!==0){if(!l&&u[0]<=h&&(u[0]=p,l=!0),u[1]<=h){if(u[1]=p,u=e[++r],!u)break;u[0]<=h?(u[0]=p,l=!0):l=!1}h+=g}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let r=0;r<e.length;r++){let l=e[r];if(s){if(t[1]<=l[0])return e[r-1][1]=t[1],e;if(t[1]<=l[1])return e[r-1][1]=Math.max(t[1],l[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=l[0])return e.splice(r,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};eu=St([ve(0,xi)],eu);function OM(e){return 57508<=e&&e<=57558}function zM(e){return 9472<=e&&e<=9631}function HM(e){return OM(e)||zM(e)}function IM(){return{css:{canvas:kh(),cell:kh()},device:{canvas:kh(),cell:kh(),char:{width:0,height:0,left:0,top:0}}}}function kh(){return{width:0,height:0}}var X2=class{constructor(e,t,s,r,l,h,u){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=r,this._coreService=l,this._decorationService=h,this._themeService=u,this._workCell=new hs,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,r,l,h,u,p,m,g,y){let v=[],x=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();s&&w<h+1&&(w=h+1);let C,j=0,E="",A=0,N=0,L=0,q=0,B=!1,I=0,U=!1,P=0,F=0,$=[],z=g!==-1&&y!==-1;for(let O=0;O<w;O++){e.loadCell(O,this._workCell);let M=this._workCell.getWidth();if(M===0)continue;let X=!1,V=O>=F,ie=O,ee=this._workCell;if(x.length>0&&O===x[0][0]&&V){let Le=x.shift(),ni=this._isCellInSelection(Le[0],t);for(A=Le[0]+1;A<Le[1];A++)V&&=ni===this._isCellInSelection(A,t);V&&=!s||h<Le[0]||h>=Le[1],V?(X=!0,ee=new BM(this._workCell,e.translateToString(!0,Le[0],Le[1]),Le[1]-Le[0]),ie=Le[1]-1,M=ee.getWidth()):F=Le[1]}let ce=this._isCellInSelection(O,t),Y=s&&O===h,oe=z&&O>=g&&O<=y,xe=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,Le=>{xe=!0});let we=ee.getChars()||tr;if(we===" "&&(ee.isUnderline()||ee.isOverline())&&(we=" "),P=M*p-m.get(we,ee.isBold(),ee.isItalic()),!C)C=this._document.createElement("span");else if(j&&(ce&&U||!ce&&!U&&ee.bg===N)&&(ce&&U&&S.selectionForeground||ee.fg===L)&&ee.extended.ext===q&&oe===B&&P===I&&!Y&&!X&&!xe&&V){ee.isInvisible()?E+=tr:E+=we,j++;continue}else j&&(C.textContent=E),C=this._document.createElement("span"),j=0,E="";if(N=ee.bg,L=ee.fg,q=ee.extended.ext,B=oe,I=P,U=ce,X&&h>=O&&h<=ie&&(h=O),!this._coreService.isCursorHidden&&Y&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&$.push("xterm-cursor-blink"),$.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(ee.isBold()&&$.push("xterm-bold"),ee.isItalic()&&$.push("xterm-italic"),ee.isDim()&&$.push("xterm-dim"),ee.isInvisible()?E=tr:E=ee.getChars()||tr,ee.isUnderline()&&($.push(`xterm-underline-${ee.extended.underlineStyle}`),E===" "&&(E=" "),!ee.isUnderlineColorDefault()))if(ee.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${Lo.toColorRGB(ee.getUnderlineColor()).join(",")})`;else{let Le=ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ee.isBold()&&Le<8&&(Le+=8),C.style.textDecorationColor=S.ansi[Le].css}ee.isOverline()&&($.push("xterm-overline"),E===" "&&(E=" ")),ee.isStrikethrough()&&$.push("xterm-strikethrough"),oe&&(C.style.textDecoration="underline");let D=ee.getFgColor(),J=ee.getFgColorMode(),le=ee.getBgColor(),he=ee.getBgColorMode(),je=!!ee.isInverse();if(je){let Le=D;D=le,le=Le;let ni=J;J=he,he=ni}let pe,Ee,me=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,Le=>{Le.options.layer!=="top"&&me||(Le.backgroundColorRGB&&(he=50331648,le=Le.backgroundColorRGB.rgba>>8&16777215,pe=Le.backgroundColorRGB),Le.foregroundColorRGB&&(J=50331648,D=Le.foregroundColorRGB.rgba>>8&16777215,Ee=Le.foregroundColorRGB),me=Le.options.layer==="top")}),!me&&ce&&(pe=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,le=pe.rgba>>8&16777215,he=50331648,me=!0,S.selectionForeground&&(J=50331648,D=S.selectionForeground.rgba>>8&16777215,Ee=S.selectionForeground)),me&&$.push("xterm-decoration-top");let _e;switch(he){case 16777216:case 33554432:_e=S.ansi[le],$.push(`xterm-bg-${le}`);break;case 50331648:_e=Nt.toColor(le>>16,le>>8&255,le&255),this._addStyle(C,`background-color:#${a3((le>>>0).toString(16),"0",6)}`);break;default:je?(_e=S.foreground,$.push("xterm-bg-257")):_e=S.background}switch(pe||ee.isDim()&&(pe=ct.multiplyOpacity(_e,.5)),J){case 16777216:case 33554432:ee.isBold()&&D<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(D+=8),this._applyMinimumContrast(C,_e,S.ansi[D],ee,pe,void 0)||$.push(`xterm-fg-${D}`);break;case 50331648:let Le=Nt.toColor(D>>16&255,D>>8&255,D&255);this._applyMinimumContrast(C,_e,Le,ee,pe,Ee)||this._addStyle(C,`color:#${a3(D.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(C,_e,S.foreground,ee,pe,Ee)||je&&$.push("xterm-fg-257")}$.length&&(C.className=$.join(" "),$.length=0),!Y&&!X&&!xe&&V?j++:C.textContent=E,P!==this.defaultSpacing&&(C.style.letterSpacing=`${P}px`),v.push(C),O=ie}return C&&j&&(C.textContent=E),v}_applyMinimumContrast(e,t,s,r,l,h){if(this._optionsService.rawOptions.minimumContrastRatio===1||HM(r.getCode()))return!1;let u=this._getContrastCache(r),p;if(!l&&!h&&(p=u.getColor(t.rgba,s.rgba)),p===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);p=ct.ensureContrastRatio(l||t,h||s,m),u.setColor((l||t).rgba,(h||s).rgba,p??null)}return p?(this._addStyle(e,`color:${p.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&t>=s[1]&&e<r[0]&&t<=r[1]:e<s[0]&&t>=s[1]&&e>=r[0]&&t<=r[1]:t>s[1]&&t<r[1]||s[1]===r[1]&&t===s[1]&&e>=s[0]&&e<r[0]||s[1]<r[1]&&t===r[1]&&e<r[0]||s[1]<r[1]&&t===s[1]&&e>=s[0]}};X2=St([ve(1,aS),ve(2,wi),ve(3,gn),ve(4,Vr),ve(5,Bo),ve(6,el)],X2);function a3(e,t,s){for(;e.length<s;)e=t+e;return e}var UM=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let h=e.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[s,r,l,h],this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(l),this._container.appendChild(h),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,r){e===this._font&&t===this._fontSize&&s===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,s){let r=0;if(!t&&!s&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let u=this._measure(e,0);return u>0&&(this._flat[r]=u),u}let l=e;t&&(l+="B"),s&&(l+="I");let h=this._holey.get(l);if(h===void 0){let u=0;t&&(u|=1),s&&(u|=2),h=this._measure(e,u),h>0&&this._holey.set(l,h)}return h}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},PM=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,r=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let l=e.buffers.active.ydisp,h=t[1]-l,u=s[1]-l,p=Math.max(h,0),m=Math.min(u,e.rows-1);if(p>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=h,this.viewportEndRow=u,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function qM(){return new PM}var C0="xterm-dom-renderer-owner-",ss="xterm-rows",jh="xterm-fg-",l3="xterm-bg-",so="xterm-focus",Eh="xterm-selection",VM=1,Q2=class extends Ie{constructor(e,t,s,r,l,h,u,p,m,g,y,v,x,S){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=r,this._viewportElement=l,this._helperContainer=h,this._linkifier2=u,this._charSizeService=m,this._optionsService=g,this._bufferService=y,this._coreService=v,this._coreBrowserService=x,this._themeService=S,this._terminalClass=VM++,this._rowElements=[],this._selectionRenderModel=qM(),this.onRequestRedraw=this._register(new de).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ss),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Eh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=IM(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(X2,document),this._element.classList.add(C0+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(pt(()=>{this._element.classList.remove(C0+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new UM(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ss} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ss} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ss} .xterm-dim { color: ${ct.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ss}.${so} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ss}.${so} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ss}.${so} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${ss} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ss} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ss} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ss} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ss} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Eh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Eh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Eh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[h,u]of e.ansi.entries())t+=`${this._terminalSelector} .${jh}${h} { color: ${u.css}; }${this._terminalSelector} .${jh}${h}.xterm-dim { color: ${ct.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${l3}${h} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${jh}257 { color: ${ct.opaque(e.background).css}; }${this._terminalSelector} .${jh}257.xterm-dim { color: ${ct.multiplyOpacity(ct.opaque(e.background),.5).css}; }${this._terminalSelector} .${l3}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(so),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(so),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,l=this._selectionRenderModel.viewportEndRow,h=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(s){let m=e[0]>t[0];p.appendChild(this._createSelectionElement(h,m?t[0]:e[0],m?e[0]:t[0],u-h+1))}else{let m=r===h?e[0]:0,g=h===l?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(h,m,g));let y=u-h-1;if(p.appendChild(this._createSelectionElement(h+1,0,this._bufferService.cols,y)),h!==u){let v=l===u?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(u,0,v))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,s,r=1){let l=this._document.createElement("div"),h=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(s-t);return h+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-h),l.style.height=`${r*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${h}px`,l.style.width=`${u}px`,l}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,r=s.ybase+s.y,l=Math.min(s.x,this._bufferService.cols-1),h=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let g=m+s.ydisp,y=this._rowElements[m],v=s.lines.get(g);if(!y||!v)break;y.replaceChildren(...this._rowFactory.createRow(v,g,g===r,u,p,l,h,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C0}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,r,l,h){s<0&&(e=0),r<0&&(t=0);let u=this._bufferService.rows-1;s=Math.max(Math.min(s,u),0),r=Math.max(Math.min(r,u),0),l=Math.min(l,this._bufferService.cols);let p=this._bufferService.buffer,m=p.ybase+p.y,g=Math.min(p.x,l-1),y=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=s;S<=r;++S){let w=S+p.ydisp,C=this._rowElements[S],j=p.lines.get(w);if(!C||!j)break;C.replaceChildren(...this._rowFactory.createRow(j,w,w===m,v,x,g,y,this.dimensions.css.cell.width,this._widthCache,h?S===s?e:0:-1,h?(S===r?t:l)-1:-1))}}};Q2=St([ve(7,qp),ve(8,fu),ve(9,wi),ve(10,xi),ve(11,Vr),ve(12,gn),ve(13,el)],Q2);var J2=class extends Ie{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new de),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new WM(this._optionsService))}catch{this._measureStrategy=this._register(new $M(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};J2=St([ve(2,wi)],J2);var kS=class extends Ie{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},$M=class extends kS{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},WM=class extends kS{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},FM=class extends Ie{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new KM(this._window)),this._onDprChange=this._register(new de),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new de),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(ii.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},KM=class extends Ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Xa),this._onDprChange=this._register(new de),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(pt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},YM=class extends Ie{constructor(){super(),this.linkProviders=[],this._register(pt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Zp(e,t,s){let r=s.getBoundingClientRect(),l=e.getComputedStyle(s),h=parseInt(l.getPropertyValue("padding-left")),u=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-r.left-h,t.clientY-r.top-u]}function GM(e,t,s,r,l,h,u,p,m){if(!h)return;let g=Zp(e,t,s);if(g)return g[0]=Math.ceil((g[0]+(m?u/2:0))/u),g[1]=Math.ceil(g[1]/p),g[0]=Math.min(Math.max(g[0],1),r+(m?1:0)),g[1]=Math.min(Math.max(g[1],1),l),g}var ep=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,r,l){return GM(window,e,t,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let s=Zp(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};ep=St([ve(0,vn),ve(1,fu)],ep);var ZM=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},jS={};aE(jS,{getSafariVersion:()=>QM,isChromeOS:()=>TS,isFirefox:()=>ES,isIpad:()=>JM,isIphone:()=>eA,isLegacyEdge:()=>XM,isLinux:()=>Xp,isMac:()=>tu,isNode:()=>pu,isSafari:()=>MS,isWindows:()=>AS});var pu=typeof process<"u"&&"title"in process,Oo=pu?"node":navigator.userAgent,zo=pu?"node":navigator.platform,ES=Oo.includes("Firefox"),XM=Oo.includes("Edge"),MS=/^((?!chrome|android).)*safari/i.test(Oo);function QM(){if(!MS)return 0;let e=Oo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var tu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(zo),JM=zo==="iPad",eA=zo==="iPhone",AS=["Windows","Win16","Win32","WinCE"].includes(zo),Xp=zo.indexOf("Linux")>=0,TS=/\bCrOS\b/.test(Oo),NS=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,s=0,r=e.timeRemaining(),l=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),l=e.timeRemaining(),s*1.5>l){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=l}this.clear()}},tA=class extends NS{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},iA=class extends NS{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},iu=!pu&&"requestIdleCallback"in window?iA:tA,sA=class{constructor(){this._queue=new iu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},tp=class extends Ie{constructor(e,t,s,r,l,h,u,p,m){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=l,this._coreBrowserService=p,this._renderer=this._register(new Xa),this._pausedResizeTask=new sA,this._observerDisposable=this._register(new Xa),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new de),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new de),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new de),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new ZM((g,y)=>this._renderRows(g,y),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new nA(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(pt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(h.onDecorationRegistered(()=>this._fullRefresh())),this._register(h.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(g=>this._registerIntersectionObserver(g,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=pt(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};tp=St([ve(2,wi),ve(3,fu),ve(4,Vr),ve(5,Bo),ve(6,xi),ve(7,gn),ve(8,el)],tp);var nA=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function rA(e,t,s,r){let l=s.buffer.x,h=s.buffer.y;if(!s.buffer.hasScrollback)return oA(l,h,e,t,s,r)+mu(h,t,s,r)+cA(l,h,e,t,s,r);let u;if(h===t)return u=l>e?"D":"C",Eo(Math.abs(l-e),jo(u,r));u=h>t?"D":"C";let p=Math.abs(h-t),m=lA(h>t?e:l,s)+(p-1)*s.cols+1+aA(h>t?l:e);return Eo(m,jo(u,r))}function aA(e,t){return e-1}function lA(e,t){return t.cols-e}function oA(e,t,s,r,l,h){return mu(t,r,l,h).length===0?"":Eo(RS(e,t,e,t-Hr(t,l),!1,l).length,jo("D",h))}function mu(e,t,s,r){let l=e-Hr(e,s),h=t-Hr(t,s),u=Math.abs(l-h)-hA(e,t,s);return Eo(u,jo(DS(e,t),r))}function cA(e,t,s,r,l,h){let u;mu(t,r,l,h).length>0?u=r-Hr(r,l):u=t;let p=r,m=uA(e,t,s,r,l,h);return Eo(RS(e,u,s,p,m==="C",l).length,jo(m,h))}function hA(e,t,s){let r=0,l=e-Hr(e,s),h=t-Hr(t,s);for(let u=0;u<Math.abs(l-h);u++){let p=DS(e,t)==="A"?-1:1;s.buffer.lines.get(l+p*u)?.isWrapped&&r++}return r}function Hr(e,t){let s=0,r=t.buffer.lines.get(e),l=r?.isWrapped;for(;l&&e>=0&&e<t.rows;)s++,r=t.buffer.lines.get(--e),l=r?.isWrapped;return s}function uA(e,t,s,r,l,h){let u;return mu(s,r,l,h).length>0?u=r-Hr(r,l):u=t,e<s&&u<=r||e>=s&&u<r?"C":"D"}function DS(e,t){return e>t?"A":"B"}function RS(e,t,s,r,l,h){let u=e,p=t,m="";for(;(u!==s||p!==r)&&p>=0&&p<h.buffer.lines.length;)u+=l?1:-1,l&&u>h.cols-1?(m+=h.buffer.translateBufferLineToString(p,!1,e,u),u=0,e=0,p++):!l&&u<0&&(m+=h.buffer.translateBufferLineToString(p,!1,0,e+1),u=h.cols-1,e=u,p--);return m+h.buffer.translateBufferLineToString(p,!1,e,u)}function jo(e,t){let s=t?"O":"[";return ae.ESC+s+e}function Eo(e,t){e=Math.floor(e);let s="";for(let r=0;r<e;r++)s+=t;return s}var dA=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function o3(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var k0=50,fA=15,pA=50,mA=500,gA=" ",vA=new RegExp(gA,"g"),ip=class extends Ie{constructor(e,t,s,r,l,h,u,p,m){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=r,this._coreService=l,this._mouseService=h,this._optionsService=u,this._renderService=p,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new hs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new de),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new de),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new de),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=g=>this._handleMouseMove(g),this._mouseUpListener=g=>this._handleMouseUp(g),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(g=>this._handleTrim(g)),this._register(this._bufferService.buffers.onBufferActivate(g=>this._handleBufferActivate(g))),this.enable(),this._model=new dA(this._bufferService),this._activeSelectionMode=0,this._register(pt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(g=>{g.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let l=e[0]<t[0]?e[0]:t[0],h=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let p=s.translateBufferLineToString(u,!0,l,h);r.push(p)}}else{let l=e[1]===t[1]?t[0]:void 0;r.push(s.translateBufferLineToString(e[1],!0,e[0],l));for(let h=e[1]+1;h<=t[1]-1;h++){let u=s.lines.get(h),p=s.translateBufferLineToString(h,!0);u?.isWrapped?r[r.length-1]+=p:r.push(p)}if(e[1]!==t[1]){let h=s.lines.get(t[1]),u=s.translateBufferLineToString(t[1],!0,0,t[0]);h&&h.isWrapped?r[r.length-1]+=u:r.push(u)}}return r.map(l=>l.replace(vA," ")).join(AS?`\r
+`:`
+`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Xp&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!t?!1:this._areCoordsInSelection(t,s,r)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,t],s,r)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=o3(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Zp(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-k0),k0),t/=k0,t/Math.abs(t)+Math.round(t*(fA-1)))}shouldForceSelection(e){return tu?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),pA)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(tu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let r=s.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<mA&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let r=rA(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let r=0;t>=r;r++){let l=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:l>1&&t!==r&&(s+=l-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let l=this._bufferService.buffer,h=l.lines.get(e[1]);if(!h)return;let u=l.translateBufferLineToString(e[1],!1),p=this._convertViewportColToCharacterIndex(h,e[0]),m=p,g=e[0]-p,y=0,v=0,x=0,S=0;if(u.charAt(p)===" "){for(;p>0&&u.charAt(p-1)===" ";)p--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let j=e[0],E=e[0];h.getWidth(j)===0&&(y++,j--),h.getWidth(E)===2&&(v++,E++);let A=h.getString(E).length;for(A>1&&(S+=A-1,m+=A-1);j>0&&p>0&&!this._isCharWordSeparator(h.loadCell(j-1,this._workCell));){h.loadCell(j-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(y++,j--):N>1&&(x+=N-1,p-=N-1),p--,j--}for(;E<h.length&&m+1<u.length&&!this._isCharWordSeparator(h.loadCell(E+1,this._workCell));){h.loadCell(E+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,E++):N>1&&(S+=N-1,m+=N-1),m++,E++}}m++;let w=p+g-y+x,C=Math.min(this._bufferService.cols,m-p+y+v-x-S);if(!(!t&&u.slice(p,m).trim()==="")){if(s&&w===0&&h.getCodePoint(0)!==32){let j=l.lines.get(e[1]-1);if(j&&h.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){let E=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(E){let A=this._bufferService.cols-E.start;w-=A,C+=A}}}if(r&&w+C===this._bufferService.cols&&h.getCodePoint(this._bufferService.cols-1)!==32){let j=l.lines.get(e[1]+1);if(j?.isWrapped&&j.getCodePoint(0)!==32){let E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(C+=E.length)}}return{start:w,length:C}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=o3(s,this._bufferService.cols)}};ip=St([ve(3,xi),ve(4,Vr),ve(5,Vp),ve(6,wi),ve(7,vn),ve(8,gn)],ip);var c3=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},h3=class{constructor(){this._color=new c3,this._css=new c3}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Rt=Object.freeze((()=>{let e=[yt.toColor("#2e3436"),yt.toColor("#cc0000"),yt.toColor("#4e9a06"),yt.toColor("#c4a000"),yt.toColor("#3465a4"),yt.toColor("#75507b"),yt.toColor("#06989a"),yt.toColor("#d3d7cf"),yt.toColor("#555753"),yt.toColor("#ef2929"),yt.toColor("#8ae234"),yt.toColor("#fce94f"),yt.toColor("#729fcf"),yt.toColor("#ad7fa8"),yt.toColor("#34e2e2"),yt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let r=t[s/36%6|0],l=t[s/6%6|0],h=t[s%6];e.push({css:Nt.toCss(r,l,h),rgba:Nt.toRgba(r,l,h)})}for(let s=0;s<24;s++){let r=8+s*10;e.push({css:Nt.toCss(r,r,r),rgba:Nt.toRgba(r,r,r)})}return e})()),Ar=yt.toColor("#ffffff"),mo=yt.toColor("#000000"),u3=yt.toColor("#ffffff"),d3=mo,no={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},yA=Ar,sp=class extends Ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new h3,this._halfContrastCache=new h3,this._onChangeColors=this._register(new de),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ar,background:mo,cursor:u3,cursorAccent:d3,selectionForeground:void 0,selectionBackgroundTransparent:no,selectionBackgroundOpaque:ct.blend(mo,no),selectionInactiveBackgroundTransparent:no,selectionInactiveBackgroundOpaque:ct.blend(mo,no),scrollbarSliderBackground:ct.opacity(Ar,.2),scrollbarSliderHoverBackground:ct.opacity(Ar,.4),scrollbarSliderActiveBackground:ct.opacity(Ar,.5),overviewRulerBorder:Ar,ansi:Rt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=et(e.foreground,Ar),t.background=et(e.background,mo),t.cursor=ct.blend(t.background,et(e.cursor,u3)),t.cursorAccent=ct.blend(t.background,et(e.cursorAccent,d3)),t.selectionBackgroundTransparent=et(e.selectionBackground,no),t.selectionBackgroundOpaque=ct.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=et(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ct.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?et(e.selectionForeground,r3):void 0,t.selectionForeground===r3&&(t.selectionForeground=void 0),ct.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ct.opacity(t.selectionBackgroundTransparent,.3)),ct.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ct.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=et(e.scrollbarSliderBackground,ct.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=et(e.scrollbarSliderHoverBackground,ct.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=et(e.scrollbarSliderActiveBackground,ct.opacity(t.foreground,.5)),t.overviewRulerBorder=et(e.overviewRulerBorder,yA),t.ansi=Rt.slice(),t.ansi[0]=et(e.black,Rt[0]),t.ansi[1]=et(e.red,Rt[1]),t.ansi[2]=et(e.green,Rt[2]),t.ansi[3]=et(e.yellow,Rt[3]),t.ansi[4]=et(e.blue,Rt[4]),t.ansi[5]=et(e.magenta,Rt[5]),t.ansi[6]=et(e.cyan,Rt[6]),t.ansi[7]=et(e.white,Rt[7]),t.ansi[8]=et(e.brightBlack,Rt[8]),t.ansi[9]=et(e.brightRed,Rt[9]),t.ansi[10]=et(e.brightGreen,Rt[10]),t.ansi[11]=et(e.brightYellow,Rt[11]),t.ansi[12]=et(e.brightBlue,Rt[12]),t.ansi[13]=et(e.brightMagenta,Rt[13]),t.ansi[14]=et(e.brightCyan,Rt[14]),t.ansi[15]=et(e.brightWhite,Rt[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)t.ansi[r+16]=et(e.extendedAnsi[r],Rt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};sp=St([ve(0,wi)],sp);function et(e,t){if(e!==void 0)try{return yt.toColor(e)}catch{}return t}var _A=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},xA=class{constructor(){this._services=new _A,this._services.set(qp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=fE(e).sort((h,u)=>h.index-u.index),r=[];for(let h of s){let u=this._services.get(h.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${h.id._id}.`);r.push(u)}let l=s.length>0?s[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},wA={trace:0,debug:1,info:2,warn:3,error:4,off:5},SA="xterm.js: ",np=class extends Ie{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=wA[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":SA)+t,...s)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};np=St([ve(0,wi)],np);var f3=class extends Ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new de),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new de),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new de),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let l=t-1;l>=0;l--)this.set(e+l+s,this.get(e+l));let r=e+t+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},He=3,Tt=Object.freeze(new Lo),Mh=0,j0=2,go=class LS{constructor(t,s,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*He);let l=s||hs.fromCharData([0,Jw,1,0]);for(let h=0;h<t;++h)this.setCell(h,l);this.length=t}get(t){let s=this._data[t*He+0],r=s&2097151;return[this._data[t*He+1],s&2097152?this._combined[t]:r?Qn(r):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,s){this._data[t*He+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*He+0]=t|2097152|s[2]<<22):this._data[t*He+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*He+0]>>22}hasWidth(t){return this._data[t*He+0]&12582912}getFg(t){return this._data[t*He+1]}getBg(t){return this._data[t*He+2]}hasContent(t){return this._data[t*He+0]&4194303}getCodePoint(t){let s=this._data[t*He+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*He+0]&2097152}getString(t){let s=this._data[t*He+0];return s&2097152?this._combined[t]:s&2097151?Qn(s&2097151):""}isProtected(t){return this._data[t*He+2]&536870912}loadCell(t,s){return Mh=t*He,s.content=this._data[Mh+0],s.fg=this._data[Mh+1],s.bg=this._data[Mh+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*He+0]=s.content,this._data[t*He+1]=s.fg,this._data[t*He+2]=s.bg}setCellFromCodepoint(t,s,r,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*He+0]=s|r<<22,this._data[t*He+1]=l.fg,this._data[t*He+2]=l.bg}addCodepointToCell(t,s,r){let l=this._data[t*He+0];l&2097152?this._combined[t]+=Qn(s):l&2097151?(this._combined[t]=Qn(l&2097151)+Qn(s),l&=-2097152,l|=2097152):l=s|1<<22,r&&(l&=-12582913,l|=r<<22),this._data[t*He+0]=l}insertCells(t,s,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length-t){let l=new hs;for(let h=this.length-t-s-1;h>=0;--h)this.setCell(t+s+h,this.loadCell(t+h,l));for(let h=0;h<s;++h)this.setCell(t+h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,s,r){if(t%=this.length,s<this.length-t){let l=new hs;for(let h=0;h<this.length-t-s;++h)this.setCell(t+h,this.loadCell(t+s+h,l));for(let h=this.length-s;h<this.length;++h)this.setCell(h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,s,r,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,r);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,r);t<s&&t<this.length;)this.setCell(t++,r)}resize(t,s){if(t===this.length)return this._data.length*4*j0<this._data.buffer.byteLength;let r=t*He;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let l=new Uint32Array(r);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,s)}else{this._data=this._data.subarray(0,r);let l=Object.keys(this._combined);for(let u=0;u<l.length;u++){let p=parseInt(l[u],10);p>=t&&delete this._combined[p]}let h=Object.keys(this._extendedAttrs);for(let u=0;u<h.length;u++){let p=parseInt(h[u],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,r*4*j0<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*j0<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new LS(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303)return t+(this._data[t*He+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303||this._data[t*He+2]&50331648)return t+(this._data[t*He+0]>>22);return 0}copyCellsFrom(t,s,r,l,h){let u=t._data;if(h)for(let m=l-1;m>=0;m--){for(let g=0;g<He;g++)this._data[(r+m)*He+g]=u[(s+m)*He+g];u[(s+m)*He+2]&268435456&&(this._extendedAttrs[r+m]=t._extendedAttrs[s+m])}else for(let m=0;m<l;m++){for(let g=0;g<He;g++)this._data[(r+m)*He+g]=u[(s+m)*He+g];u[(s+m)*He+2]&268435456&&(this._extendedAttrs[r+m]=t._extendedAttrs[s+m])}let p=Object.keys(t._combined);for(let m=0;m<p.length;m++){let g=parseInt(p[m],10);g>=s&&(this._combined[g-s+r]=t._combined[g])}}translateToString(t,s,r,l){s=s??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),l&&(l.length=0);let h="";for(;s<r;){let u=this._data[s*He+0],p=u&2097151,m=u&2097152?this._combined[s]:p?Qn(p):tr;if(h+=m,l)for(let g=0;g<m.length;++g)l.push(s);s+=u>>22||1}return l&&l.push(s),h}};function bA(e,t,s,r,l,h){let u=[];for(let p=0;p<e.length-1;p++){let m=p,g=e.get(++m);if(!g.isWrapped)continue;let y=[e.get(p)];for(;m<e.length&&g.isWrapped;)y.push(g),g=e.get(++m);if(!h&&r>=p&&r<m){p+=y.length-1;continue}let v=0,x=Mo(y,v,t),S=1,w=0;for(;S<y.length;){let j=Mo(y,S,t),E=j-w,A=s-x,N=Math.min(E,A);y[v].copyCellsFrom(y[S],w,x,N,!1),x+=N,x===s&&(v++,x=0),w+=N,w===j&&(S++,w=0),x===0&&v!==0&&y[v-1].getWidth(s-1)===2&&(y[v].copyCellsFrom(y[v-1],s-1,x++,1,!1),y[v-1].setCell(s-1,l))}y[v].replaceCells(x,s,l);let C=0;for(let j=y.length-1;j>0&&(j>v||y[j].getTrimmedLength()===0);j--)C++;C>0&&(u.push(p+y.length-C),u.push(C)),p+=y.length-1}return u}function CA(e,t){let s=[],r=0,l=t[r],h=0;for(let u=0;u<e.length;u++)if(l===u){let p=t[++r];e.onDeleteEmitter.fire({index:u-h,amount:p}),u+=p-1,h+=p,l=t[++r]}else s.push(u);return{layout:s,countRemoved:h}}function kA(e,t){let s=[];for(let r=0;r<t.length;r++)s.push(e.get(t[r]));for(let r=0;r<s.length;r++)e.set(r,s[r]);e.length=t.length}function jA(e,t,s){let r=[],l=e.map((m,g)=>Mo(e,g,t)).reduce((m,g)=>m+g),h=0,u=0,p=0;for(;p<l;){if(l-p<s){r.push(l-p);break}h+=s;let m=Mo(e,u,t);h>m&&(h-=m,u++);let g=e[u].getWidth(h-1)===2;g&&h--;let y=g?s-1:s;r.push(y),p+=y}return r}function Mo(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,l=e[t+1].getWidth(0)===2;return r&&l?s-1:s}var BS=class OS{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=OS._nextId++,this._onDispose=this.register(new de),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),zr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};BS._nextId=1;var EA=BS,Ot={},Tr=Ot.B;Ot[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Ot.A={"#":"£"};Ot.B=void 0;Ot[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ot.C=Ot[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ot.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ot.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ot.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ot.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ot.E=Ot[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ot.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ot.H=Ot[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ot["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var p3=4294967295,m3=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Tt.clone(),this.savedCharset=Tr,this.markers=[],this._nullCell=hs.fromCharData([0,Jw,1,0]),this._whitespaceCell=hs.fromCharData([0,tr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new iu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f3(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Qh),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Qh),this._whitespaceCell}getBlankLine(e,t){return new go(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>p3?p3:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Tt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f3(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(Tt),r=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)r+=+this.lines.get(u).resize(e,s);let h=0;if(this._rows<t)for(let u=this._rows;u<t;u++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new go(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+h+1?(this.ybase--,h++,this.ydisp>0&&this.ydisp--):this.lines.push(new go(e,s)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){let u=this.lines.length-l;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),h&&(this.y+=h),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let h=0;h<this.lines.length;h++)r+=+this.lines.get(h).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,r=bA(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Tt),s);if(r.length>0){let l=CA(this.lines,r);kA(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let r=this.getNullCell(Tt),l=s;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new go(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Tt),l=[],h=0;for(let u=this.lines.length-1;u>=0;u--){let p=this.lines.get(u);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;let m=[p];for(;p.isWrapped&&u>0;)p=this.lines.get(--u),m.unshift(p);if(!s){let N=this.ybase+this.y;if(N>=u&&N<u+m.length)continue}let g=m[m.length-1].getTrimmedLength(),y=jA(m,this._cols,e),v=y.length-m.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+v):x=Math.max(0,this.lines.length-this.lines.maxLength+v);let S=[];for(let N=0;N<v;N++){let L=this.getBlankLine(Tt,!0);S.push(L)}S.length>0&&(l.push({start:u+m.length+h,newLines:S}),h+=S.length),m.push(...S);let w=y.length-1,C=y[w];C===0&&(w--,C=y[w]);let j=m.length-v-1,E=g;for(;j>=0;){let N=Math.min(E,C);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[j],E-N,C-N,N,!0),C-=N,C===0&&(w--,C=y[w]),E-=N,E===0){j--;let L=Math.max(j,0);E=Mo(m,L,this._cols)}}for(let N=0;N<m.length;N++)y[N]<e&&m[N].setCell(y[N],r);let A=v-x;for(;A-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+h)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+t-1)}if(l.length>0){let u=[],p=[];for(let C=0;C<this.lines.length;C++)p.push(this.lines.get(C));let m=this.lines.length,g=m-1,y=0,v=l[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);let x=0;for(let C=Math.min(this.lines.maxLength-1,m+h-1);C>=0;C--)if(v&&v.start>g+x){for(let j=v.newLines.length-1;j>=0;j--)this.lines.set(C--,v.newLines[j]);C++,u.push({index:g+1,amount:v.newLines.length}),x+=v.newLines.length,v=l[++y]}else this.lines.set(C,p[g--]);let S=0;for(let C=u.length-1;C>=0;C--)u[C].index+=S,this.lines.onInsertEmitter.fire(u[C]),S+=u[C].amount;let w=Math.max(0,m+h-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,s=0,r){let l=this.lines.get(e);return l?l.translateToString(t,s,r):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new EA(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},MA=class extends Ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new de),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new m3(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m3(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},zS=2,HS=1,rp=class extends Ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,zS),this.rows=Math.max(e.rawOptions.rows||0,HS),this.buffers=this._register(new MA(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=s.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let l=s.ybase+s.scrollTop,h=s.ybase+s.scrollBottom;if(s.scrollTop===0){let u=s.lines.isFull;h===s.lines.length-1?u?s.lines.recycle().copyFrom(r):s.lines.push(r.clone()):s.lines.splice(h+1,0,r.clone()),u?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let u=h-l+1;s.lines.shiftElements(l+1,u-1,-1),s.lines.set(h,r.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};rp=St([ve(0,wi)],rp);var Ua={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:tu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},AA=["normal","bold","100","200","300","400","500","600","700","800","900"],TA=class extends Ie{constructor(e){super(),this._onOptionChange=this._register(new de),this.onOptionChange=this._onOptionChange.event;let t={...Ua};for(let s in e)if(s in t)try{let r=e[s];t[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(pt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in Ua))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,r)=>{if(!(s in Ua))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ua[e]),!NA(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ua[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=AA.includes(t)?t:Ua[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function NA(e){return e==="block"||e==="underline"||e==="bar"}function vo(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let r in e)s[r]=t<=1?e[r]:e[r]&&vo(e[r],t-1);return s}var g3=Object.freeze({insertMode:!1}),v3=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ap=class extends Ie{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new de),this.onData=this._onData.event,this._onUserInput=this._register(new de),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new de),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=vo(g3),this.decPrivateModes=vo(v3)}reset(){this.modes=vo(g3),this.decPrivateModes=vo(v3)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};ap=St([ve(0,xi),ve(1,nS),ve(2,wi)],ap);var y3={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function E0(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var M0=String.fromCharCode,_3={DEFAULT:e=>{let t=[E0(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${M0(t[0])}${M0(t[1])}${M0(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${E0(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${E0(e,!0)};${e.x};${e.y}${t}`}},lp=class extends Ie{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new de),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(y3))this.addProtocol(r,y3[r]);for(let r of Object.keys(_3))this.addEncoding(r,_3[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let r=t/s,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=r+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,s){if(s){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};lp=St([ve(0,xi),ve(1,Vr),ve(2,wi)],lp);var A0=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],DA=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Lt;function RA(e,t){let s=0,r=t.length-1,l;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(l=s+r>>1,e>t[l][1])s=l+1;else if(e<t[l][0])r=l-1;else return!0;return!1}var LA=class{constructor(){if(this.version="6",!Lt){Lt=new Uint8Array(65536),Lt.fill(1),Lt[0]=0,Lt.fill(0,1,32),Lt.fill(0,127,160),Lt.fill(2,4352,4448),Lt[9001]=2,Lt[9002]=2,Lt.fill(2,11904,42192),Lt[12351]=1,Lt.fill(2,44032,55204),Lt.fill(2,63744,64256),Lt.fill(2,65040,65050),Lt.fill(2,65072,65136),Lt.fill(2,65280,65377),Lt.fill(2,65504,65511);for(let e=0;e<A0.length;++e)Lt.fill(0,A0[e][0],A0[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Lt[e]:RA(e,DA)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),r=s===0&&t!==0;if(r){let l=Nr.extractWidth(t);l===0?r=!1:l>s&&(s=l)}return Nr.createPropertyValue(0,s,r)}},Nr=class Ih{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new de,this.onChange=this._onChange.event;let t=new LA;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,r=!1){return(t&16777215)<<3|(s&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,r=0,l=t.length;for(let h=0;h<l;++h){let u=t.charCodeAt(h);if(55296<=u&&u<=56319){if(++h>=l)return s+this.wcwidth(u);let g=t.charCodeAt(h);56320<=g&&g<=57343?u=(u-55296)*1024+g-56320+65536:s+=this.wcwidth(g)}let p=this.charProperties(u,r),m=Ih.extractWidth(p);Ih.extractShouldJoin(p)&&(m-=Ih.extractWidth(r)),s+=m,r=p}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},BA=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function x3(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var ro=2147483647,OA=256,IS=class op{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>OA)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new op;if(!t.length)return s;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let l=t[r];if(Array.isArray(l))for(let h=0;h<l.length;++h)s.addSubParam(l[h]);else s.addParam(l)}return s}clone(){let t=new op(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let r=this._subParamsIdx[s]>>8,l=this._subParamsIdx[s]&255;l-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,l))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ro?ro:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>ro?ro:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-s>0?this._subParams.subarray(s,r):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let r=this._subParamsIdx[s]>>8,l=this._subParamsIdx[s]&255;l-r>0&&(t[s]=this._subParams.slice(r,l))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,l=r[s-1];r[s-1]=~l?Math.min(l*10+t,ro):t}},ao=[],zA=class{constructor(){this._state=0,this._active=ao,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ao}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=ao,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ao,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,s){if(!this._active.length)this._handlerFb(this._id,"PUT",du(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&s-t>0&&this._put(e,t,s)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=ao,this._id=-1,this._state=0}}},Wi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=du(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},lo=[],HA=class{constructor(){this._handlers=Object.create(null),this._active=lo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=lo}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=lo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||lo,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",du(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=lo,this._ident=0}},yo=new IS;yo.addParam(0);var w3=class{constructor(e){this._handler=e,this._data="",this._params=yo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():yo,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=du(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(s=>(this._params=yo,this._data="",this._hitLimit=!1,s));return this._params=yo,this._data="",this._hitLimit=!1,t}},IA=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,r){this.table[t<<8|e]=s<<4|r}addMany(e,t,s,r){for(let l=0;l<e.length;l++)this.table[t<<8|e[l]]=s<<4|r}},ls=160,UA=(function(){let e=new IA(4095),t=Array.apply(null,Array(256)).map((p,m)=>m),s=(p,m)=>t.slice(p,m),r=s(32,127),l=s(0,24);l.push(25),l.push.apply(l,s(28,32));let h=s(0,14),u;e.setDefault(1,0),e.addMany(r,0,2,0);for(u in h)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ls,0,2,0),e.add(ls,8,5,8),e.add(ls,6,0,6),e.add(ls,11,0,11),e.add(ls,13,13,13),e})(),PA=class extends Ie{constructor(e=UA){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new IS,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(pt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new zA),this._dcsParser=this._register(new HA),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let l=0;l<e.intermediates.length;++l){let h=e.intermediates.charCodeAt(l);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=h}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=r,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,r,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=l}parse(e,t,s){let r=0,l=0,h=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,h=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let p=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&m>-1){for(;m>=0&&(u=p[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&m>-1){for(;m>=0&&(u=p[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(r!==24&&r!==26,s),u)return u;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],u=this._oscParser.end(r!==24&&r!==26,s),u)return u;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,h=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let p=h;p<t;++p){switch(r=e[p],l=this._transitions.table[this.currentState<<8|(r<160?r:ls)],l>>4){case 2:for(let x=p+1;;++x){if(x>=t||(r=e[x])<32||r>126&&r<ls){this._printHandler(e,p,x),p=x-1;break}if(++x>=t||(r=e[x])<32||r>126&&r<ls){this._printHandler(e,p,x),p=x-1;break}if(++x>=t||(r=e[x])<32||r>126&&r<ls){this._printHandler(e,p,x),p=x-1;break}if(++x>=t||(r=e[x])<32||r>126&&r<ls){this._printHandler(e,p,x),p=x-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:p,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|r],g=m?m.length-1:-1;for(;g>=0&&(u=m[g](this._params),u!==!0);g--)if(u instanceof Promise)return this._preserveStack(3,m,g,l,p),u;g<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++p<t&&(r=e[p])>47&&r<60);p--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let y=this._escHandlers[this._collect<<8|r],v=y?y.length-1:-1;for(;v>=0&&(u=y[v](),u!==!0);v--)if(u instanceof Promise)return this._preserveStack(4,y,v,l,p),u;v<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let x=p+1;;++x)if(x>=t||(r=e[x])===24||r===26||r===27||r>127&&r<ls){this._dcsParser.put(e,p,x),p=x-1;break}break;case 14:if(u=this._dcsParser.unhook(r!==24&&r!==26),u)return this._preserveStack(6,[],0,l,p),u;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let x=p+1;;x++)if(x>=t||(r=e[x])<32||r>127&&r<ls){this._oscParser.put(e,p,x),p=x-1;break}break;case 6:if(u=this._oscParser.end(r!==24&&r!==26),u)return this._preserveStack(5,[],0,l,p),u;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},qA=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,VA=/^[\da-f]+$/;function S3(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=qA.exec(t);if(s){let r=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/r*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/r*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),VA.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,r=[0,0,0];for(let l=0;l<3;++l){let h=parseInt(t.slice(s*l,s*l+s),16);r[l]=s===1?h<<4:s===2?h:s===3?h>>4:h>>8}return r}}function T0(e,t){let s=e.toString(16),r=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function $A(e,t=16){let[s,r,l]=e;return`rgb:${T0(s,t)}/${T0(r,t)}/${T0(l,t)}`}var WA={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Gn=131072,b3=10;function C3(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var k3=5e3,j3=0,FA=class extends Ie{constructor(e,t,s,r,l,h,u,p,m=new PA){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=r,this._optionsService=l,this._oscLinkService=h,this._coreMouseService=u,this._unicodeService=p,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new uE,this._utf8Decoder=new dE,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Tt.clone(),this._eraseAttrDataInternal=Tt.clone(),this._onRequestBell=this._register(new de),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new de),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new de),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new de),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new de),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new de),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new de),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new de),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new de),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new cp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(g=>this._activeBuffer=g.activeBuffer)),this._parser.setCsiHandlerFallback((g,y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(g),params:y.toArray()})}),this._parser.setEscHandlerFallback(g=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(g)})}),this._parser.setExecuteHandlerFallback(g=>{this._logService.debug("Unknown EXECUTE code: ",{code:g})}),this._parser.setOscHandlerFallback((g,y,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:g,action:y,data:v})}),this._parser.setDcsHandlerFallback((g,y,v)=>{y==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(g),action:y,payload:v})}),this._parser.setPrintHandler((g,y,v)=>this.print(g,y,v)),this._parser.registerCsiHandler({final:"@"},g=>this.insertChars(g)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},g=>this.scrollLeft(g)),this._parser.registerCsiHandler({final:"A"},g=>this.cursorUp(g)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},g=>this.scrollRight(g)),this._parser.registerCsiHandler({final:"B"},g=>this.cursorDown(g)),this._parser.registerCsiHandler({final:"C"},g=>this.cursorForward(g)),this._parser.registerCsiHandler({final:"D"},g=>this.cursorBackward(g)),this._parser.registerCsiHandler({final:"E"},g=>this.cursorNextLine(g)),this._parser.registerCsiHandler({final:"F"},g=>this.cursorPrecedingLine(g)),this._parser.registerCsiHandler({final:"G"},g=>this.cursorCharAbsolute(g)),this._parser.registerCsiHandler({final:"H"},g=>this.cursorPosition(g)),this._parser.registerCsiHandler({final:"I"},g=>this.cursorForwardTab(g)),this._parser.registerCsiHandler({final:"J"},g=>this.eraseInDisplay(g,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},g=>this.eraseInDisplay(g,!0)),this._parser.registerCsiHandler({final:"K"},g=>this.eraseInLine(g,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},g=>this.eraseInLine(g,!0)),this._parser.registerCsiHandler({final:"L"},g=>this.insertLines(g)),this._parser.registerCsiHandler({final:"M"},g=>this.deleteLines(g)),this._parser.registerCsiHandler({final:"P"},g=>this.deleteChars(g)),this._parser.registerCsiHandler({final:"S"},g=>this.scrollUp(g)),this._parser.registerCsiHandler({final:"T"},g=>this.scrollDown(g)),this._parser.registerCsiHandler({final:"X"},g=>this.eraseChars(g)),this._parser.registerCsiHandler({final:"Z"},g=>this.cursorBackwardTab(g)),this._parser.registerCsiHandler({final:"`"},g=>this.charPosAbsolute(g)),this._parser.registerCsiHandler({final:"a"},g=>this.hPositionRelative(g)),this._parser.registerCsiHandler({final:"b"},g=>this.repeatPrecedingCharacter(g)),this._parser.registerCsiHandler({final:"c"},g=>this.sendDeviceAttributesPrimary(g)),this._parser.registerCsiHandler({prefix:">",final:"c"},g=>this.sendDeviceAttributesSecondary(g)),this._parser.registerCsiHandler({final:"d"},g=>this.linePosAbsolute(g)),this._parser.registerCsiHandler({final:"e"},g=>this.vPositionRelative(g)),this._parser.registerCsiHandler({final:"f"},g=>this.hVPosition(g)),this._parser.registerCsiHandler({final:"g"},g=>this.tabClear(g)),this._parser.registerCsiHandler({final:"h"},g=>this.setMode(g)),this._parser.registerCsiHandler({prefix:"?",final:"h"},g=>this.setModePrivate(g)),this._parser.registerCsiHandler({final:"l"},g=>this.resetMode(g)),this._parser.registerCsiHandler({prefix:"?",final:"l"},g=>this.resetModePrivate(g)),this._parser.registerCsiHandler({final:"m"},g=>this.charAttributes(g)),this._parser.registerCsiHandler({final:"n"},g=>this.deviceStatus(g)),this._parser.registerCsiHandler({prefix:"?",final:"n"},g=>this.deviceStatusPrivate(g)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},g=>this.softReset(g)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},g=>this.setCursorStyle(g)),this._parser.registerCsiHandler({final:"r"},g=>this.setScrollRegion(g)),this._parser.registerCsiHandler({final:"s"},g=>this.saveCursor(g)),this._parser.registerCsiHandler({final:"t"},g=>this.windowOptions(g)),this._parser.registerCsiHandler({final:"u"},g=>this.restoreCursor(g)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},g=>this.insertColumns(g)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},g=>this.deleteColumns(g)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},g=>this.selectProtected(g)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},g=>this.requestMode(g,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},g=>this.requestMode(g,!1)),this._parser.setExecuteHandler(ae.BEL,()=>this.bell()),this._parser.setExecuteHandler(ae.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ae.BS,()=>this.backspace()),this._parser.setExecuteHandler(ae.HT,()=>this.tab()),this._parser.setExecuteHandler(ae.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ae.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(zh.IND,()=>this.index()),this._parser.setExecuteHandler(zh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(zh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Wi(g=>(this.setTitle(g),this.setIconName(g),!0))),this._parser.registerOscHandler(1,new Wi(g=>this.setIconName(g))),this._parser.registerOscHandler(2,new Wi(g=>this.setTitle(g))),this._parser.registerOscHandler(4,new Wi(g=>this.setOrReportIndexedColor(g))),this._parser.registerOscHandler(8,new Wi(g=>this.setHyperlink(g))),this._parser.registerOscHandler(10,new Wi(g=>this.setOrReportFgColor(g))),this._parser.registerOscHandler(11,new Wi(g=>this.setOrReportBgColor(g))),this._parser.registerOscHandler(12,new Wi(g=>this.setOrReportCursorColor(g))),this._parser.registerOscHandler(104,new Wi(g=>this.restoreIndexedColor(g))),this._parser.registerOscHandler(110,new Wi(g=>this.restoreFgColor(g))),this._parser.registerOscHandler(111,new Wi(g=>this.restoreBgColor(g))),this._parser.registerOscHandler(112,new Wi(g=>this.restoreCursorColor(g))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let g in Ot)this._parser.registerEscHandler({intermediates:"(",final:g},()=>this.selectCharset("("+g)),this._parser.registerEscHandler({intermediates:")",final:g},()=>this.selectCharset(")"+g)),this._parser.registerEscHandler({intermediates:"*",final:g},()=>this.selectCharset("*"+g)),this._parser.registerEscHandler({intermediates:"+",final:g},()=>this.selectCharset("+"+g)),this._parser.registerEscHandler({intermediates:"-",final:g},()=>this.selectCharset("-"+g)),this._parser.registerEscHandler({intermediates:".",final:g},()=>this.selectCharset("."+g)),this._parser.registerEscHandler({intermediates:"/",final:g},()=>this.selectCharset("/"+g));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(g=>(this._logService.error("Parsing error: ",g),g)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new w3((g,y)=>this.requestStatusString(g,y)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),k3))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${k3} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,r=this._activeBuffer.x,l=this._activeBuffer.y,h=0,u=this._parseStack.paused;if(u){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;r=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Gn&&(h=this._parseStack.position+Gn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,g=>String.fromCharCode(g)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(g=>g.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Gn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Gn))),u||this._dirtyRowTracker.clearRange(),e.length>Gn)for(let g=h;g<e.length;g+=Gn){let y=g+Gn<e.length?g+Gn:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(g,y),this._parseBuffer):this._utf8Decoder.decode(e.subarray(g,y),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,v))return this._preserveStack(r,l,v,g),this._logSlowResolvingAsync(s),s}else if(!u){let g=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,g))return this._preserveStack(r,l,g,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==r||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let p=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(p,this._bufferService.rows-1)})}print(e,t,s){let r,l,h=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,p=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,g=this._coreService.modes.insertMode,y=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,y);let x=this._parser.precedingJoinState;for(let S=t;S<s;++S){if(r=e[S],r<127&&h){let E=h[String.fromCharCode(r)];E&&(r=E.charCodeAt(0))}let w=this._unicodeService.charProperties(r,x);l=Nr.extractWidth(w);let C=Nr.extractShouldJoin(w),j=C?Nr.extractWidth(x):0;if(x=w,u&&this._onA11yChar.fire(Qn(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-j>p){if(m){let E=v,A=this._activeBuffer.x-j;for(this._activeBuffer.x=j,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),j>0&&v instanceof go&&v.copyCellsFrom(E,A,0,j,!1);A<p;)E.setCellFromCodepoint(A++,0,1,y)}else if(this._activeBuffer.x=p-1,l===2)continue}if(C&&this._activeBuffer.x){let E=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-E,r,l);for(let A=l-j;--A>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,y);continue}if(g&&(v.insertCells(this._activeBuffer.x,l-j,this._activeBuffer.getNullCell(y)),v.getWidth(p-1)===2&&v.setCellFromCodepoint(p-1,0,1,y)),v.setCellFromCodepoint(this._activeBuffer.x++,r,l,y),l>0)for(;--l;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,y)}this._parser.precedingJoinState=x,this._activeBuffer.x<p&&s-t>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>C3(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new w3(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Wi(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,s,r=!1,l=!1){let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);h.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),l),r&&(h.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(l-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Tt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,r=Nr.extractWidth(t),l=this._activeBuffer.x-r,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),u=new Uint32Array(h.length*s),p=0;for(let g=0;g<h.length;){let y=h.codePointAt(g)||0;u[p++]=y,g+=y>65535?2:1}let m=p;for(let g=1;g<s;++g)u.copyWithin(m,0,p),m+=p;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ae.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ae.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ae.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ae.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ae.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Tr),this._charsetService.setgCharset(1,Tr),this._charsetService.setgCharset(2,Tr),this._charsetService.setgCharset(3,Tr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let s;(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let r=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:h}=this._coreMouseService,u=this._coreService,{buffers:p,cols:m}=this._bufferService,{active:g,alt:y}=p,v=this._optionsService.rawOptions,x=(C,j)=>(u.triggerDataEvent(`${ae.ESC}[${t?"":"?"}${C};${j}$y`),!0),S=C=>C?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,S(u.modes.insertMode)):w===12?x(w,3):w===20?x(w,S(v.convertEol)):x(w,0):w===1?x(w,S(r.applicationCursorKeys)):w===3?x(w,v.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?x(w,S(r.origin)):w===7?x(w,S(r.wraparound)):w===8?x(w,3):w===9?x(w,S(l==="X10")):w===12?x(w,S(v.cursorBlink)):w===25?x(w,S(!u.isCursorHidden)):w===45?x(w,S(r.reverseWraparound)):w===66?x(w,S(r.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,S(l==="VT200")):w===1002?x(w,S(l==="DRAG")):w===1003?x(w,S(l==="ANY")):w===1004?x(w,S(r.sendFocus)):w===1005?x(w,4):w===1006?x(w,S(h==="SGR")):w===1015?x(w,4):w===1016?x(w,S(h==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,S(g===y)):w===2004?x(w,S(r.bracketedPasteMode)):w===2026?x(w,S(r.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,s,r,l){return t===2?(e|=50331648,e&=-16777216,e|=Lo.fromColorRGB([s,r,l])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let r=[0,0,-1,0,0,0],l=0,h=0;do{if(r[h+l]=e.params[t+h],e.hasSubParams(t+h)){let u=e.getSubParams(t+h),p=0;do r[1]===5&&(l=1),r[h+p+1+l]=u[p];while(++p<u.length&&p+h+1+l<r.length);break}if(r[1]===5&&h+l>=2||r[1]===2&&h+l>=5)break;r[1]&&(l=1)}while(++h+t<e.length&&h+l<r.length);for(let u=2;u<r.length;++u)r[u]===-1&&(r[u]=0);switch(r[0]){case 38:s.fg=this._updateAttrColor(s.fg,r[1],r[3],r[4],r[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,r[1],r[3],r[4],r[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,r[1],r[3],r[4],r[5])}return h}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Tt.fg,e.bg=Tt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,s,r=this._curAttrData;for(let l=0;l<t;l++)s=e.params[l],s>=30&&s<=37?(r.fg&=-50331904,r.fg|=16777216|s-30):s>=40&&s<=47?(r.bg&=-50331904,r.bg|=16777216|s-40):s>=90&&s<=97?(r.fg&=-50331904,r.fg|=16777216|s-90|8):s>=100&&s<=107?(r.bg&=-50331904,r.bg|=16777216|s-100|8):s===0?this._processSGR0(r):s===1?r.fg|=134217728:s===3?r.bg|=67108864:s===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[0]:1,r)):s===5?r.fg|=536870912:s===7?r.fg|=67108864:s===8?r.fg|=1073741824:s===9?r.fg|=2147483648:s===2?r.bg|=134217728:s===21?this._processUnderline(2,r):s===22?(r.fg&=-134217729,r.bg&=-134217729):s===23?r.bg&=-67108865:s===24?(r.fg&=-268435457,this._processUnderline(0,r)):s===25?r.fg&=-536870913:s===27?r.fg&=-67108865:s===28?r.fg&=-1073741825:s===29?r.fg&=2147483647:s===39?(r.fg&=-67108864,r.fg|=Tt.fg&16777215):s===49?(r.bg&=-67108864,r.bg|=Tt.bg&16777215):s===38||s===48||s===58?l+=this._extractColor(e,l,r):s===53?r.bg|=1073741824:s===55?r.bg&=-1073741825:s===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):s===100?(r.fg&=-67108864,r.fg|=Tt.fg&16777215,r.bg&=-67108864,r.bg|=Tt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ae.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ae.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ae.ESC}[?${t};${s}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Tt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!C3(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ae.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>b3&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>b3&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],s=e.split(";");for(;s.length>1;){let r=s.shift(),l=s.shift();if(/^\d+$/.exec(r)){let h=parseInt(r);if(E3(h))if(l==="?")t.push({type:0,index:h});else{let u=S3(l);u&&t.push({type:1,index:h,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(s,r):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),r,l=s.findIndex(h=>h.startsWith("id="));return l!==-1&&(r=s[l].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let s=e.split(";");for(let r=0;r<s.length&&!(t>=this._specialColors.length);++r,++t)if(s[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=S3(s[r]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],s=e.split(";");for(let r=0;r<s.length;++r)if(/^\d+$/.exec(s[r])){let l=parseInt(s[r]);E3(l)&&t.push({type:2,index:l})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Tr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(WA[e[0]],Ot[e[1]]||Tr),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Tt.clone(),this._eraseAttrDataInternal=Tt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new hs;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(s);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=u=>(this._coreService.triggerDataEvent(`${ae.ESC}${u}${ae.ESC}\\`),!0),r=this._bufferService.buffer,l=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},cp=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(j3=e,e=t,t=j3),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};cp=St([ve(0,xi)],cp);function E3(e){return 0<=e&&e<256}var KA=5e7,M3=12,YA=50,GA=class extends Ie{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new de),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>KA)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],l=this._action(r,t);if(l){let u=p=>performance.now()-s>=M3?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(s,p);l.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(u);return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=M3)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>YA&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},hp=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let p=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(m,p)),this._dataByLinkId.set(m.id,m),m.id}let s=e,r=this._getEntryIdKey(s),l=this._entriesWithId.get(r);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let h=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(u,h)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};hp=St([ve(0,xi)],hp);var A3=!1,ZA=class extends Ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Xa),this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onData=this._register(new de),this.onData=this._onData.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new de),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new de),this._instantiationService=new xA,this.optionsService=this._register(new TA(e)),this._instantiationService.setService(wi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(rp)),this._instantiationService.setService(xi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(np)),this._instantiationService.setService(nS,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ap)),this._instantiationService.setService(Vr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(lp)),this._instantiationService.setService(sS,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Nr)),this._instantiationService.setService(gE,this.unicodeService),this._charsetService=this._instantiationService.createInstance(BA),this._instantiationService.setService(mE,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(hp),this._instantiationService.setService(rS,this._oscLinkService),this._inputHandler=this._register(new FA(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ii.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ii.forward(this._bufferService.onResize,this._onResize)),this._register(ii.forward(this.coreService.onData,this._onData)),this._register(ii.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new GA((t,s)=>this._inputHandler.parse(t,s))),this._register(ii.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new de),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!A3&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A3=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,zS),t=Math.max(t,HS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(x3.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(x3(this._bufferService),!1))),this._windowsWrappingHeuristics.value=pt(()=>{for(let t of e)t.dispose()})}}},XA={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function QA(e,t,s,r){let l={type:0,cancel:!1,key:void 0},h=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?l.key=ae.ESC+"OA":l.key=ae.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=ae.ESC+"OD":l.key=ae.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=ae.ESC+"OC":l.key=ae.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=ae.ESC+"OB":l.key=ae.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":ae.DEL,e.altKey&&(l.key=ae.ESC+l.key);break;case 9:if(e.shiftKey){l.key=ae.ESC+"[Z";break}l.key=ae.HT,l.cancel=!0;break;case 13:l.key=e.altKey?ae.ESC+ae.CR:ae.CR,l.cancel=!0;break;case 27:l.key=ae.ESC,e.altKey&&(l.key=ae.ESC+ae.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;h?l.key=ae.ESC+"[1;"+(h+1)+"D":t?l.key=ae.ESC+"OD":l.key=ae.ESC+"[D";break;case 39:if(e.metaKey)break;h?l.key=ae.ESC+"[1;"+(h+1)+"C":t?l.key=ae.ESC+"OC":l.key=ae.ESC+"[C";break;case 38:if(e.metaKey)break;h?l.key=ae.ESC+"[1;"+(h+1)+"A":t?l.key=ae.ESC+"OA":l.key=ae.ESC+"[A";break;case 40:if(e.metaKey)break;h?l.key=ae.ESC+"[1;"+(h+1)+"B":t?l.key=ae.ESC+"OB":l.key=ae.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=ae.ESC+"[2~");break;case 46:h?l.key=ae.ESC+"[3;"+(h+1)+"~":l.key=ae.ESC+"[3~";break;case 36:h?l.key=ae.ESC+"[1;"+(h+1)+"H":t?l.key=ae.ESC+"OH":l.key=ae.ESC+"[H";break;case 35:h?l.key=ae.ESC+"[1;"+(h+1)+"F":t?l.key=ae.ESC+"OF":l.key=ae.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=ae.ESC+"[5;"+(h+1)+"~":l.key=ae.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=ae.ESC+"[6;"+(h+1)+"~":l.key=ae.ESC+"[6~";break;case 112:h?l.key=ae.ESC+"[1;"+(h+1)+"P":l.key=ae.ESC+"OP";break;case 113:h?l.key=ae.ESC+"[1;"+(h+1)+"Q":l.key=ae.ESC+"OQ";break;case 114:h?l.key=ae.ESC+"[1;"+(h+1)+"R":l.key=ae.ESC+"OR";break;case 115:h?l.key=ae.ESC+"[1;"+(h+1)+"S":l.key=ae.ESC+"OS";break;case 116:h?l.key=ae.ESC+"[15;"+(h+1)+"~":l.key=ae.ESC+"[15~";break;case 117:h?l.key=ae.ESC+"[17;"+(h+1)+"~":l.key=ae.ESC+"[17~";break;case 118:h?l.key=ae.ESC+"[18;"+(h+1)+"~":l.key=ae.ESC+"[18~";break;case 119:h?l.key=ae.ESC+"[19;"+(h+1)+"~":l.key=ae.ESC+"[19~";break;case 120:h?l.key=ae.ESC+"[20;"+(h+1)+"~":l.key=ae.ESC+"[20~";break;case 121:h?l.key=ae.ESC+"[21;"+(h+1)+"~":l.key=ae.ESC+"[21~";break;case 122:h?l.key=ae.ESC+"[23;"+(h+1)+"~":l.key=ae.ESC+"[23~";break;case 123:h?l.key=ae.ESC+"[24;"+(h+1)+"~":l.key=ae.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=ae.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=ae.DEL:e.keyCode===219?l.key=ae.ESC:e.keyCode===220?l.key=ae.FS:e.keyCode===221&&(l.key=ae.GS);else if((!s||r)&&e.altKey&&!e.metaKey){let u=XA[e.keyCode]?.[e.shiftKey?1:0];if(u)l.key=ae.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(p);e.shiftKey&&(m=m.toUpperCase()),l.key=ae.ESC+m}else if(e.keyCode===32)l.key=ae.ESC+(e.ctrlKey?ae.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),l.key=ae.ESC+p,l.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=ae.US),e.key==="@"&&(l.key=ae.NUL));break}return l}var Ct=0,JA=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new iu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new iu,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((l,h)=>this._getKey(l)-this._getKey(h)),t=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<r.length;l++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(r[l]=e[t],t++):r[l]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Ct=this._search(t),Ct===-1)||this._getKey(this._array[Ct])!==t)return!1;do if(this._array[Ct]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ct),!0;while(++Ct<this._array.length&&this._getKey(this._array[Ct])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,h)=>l-h),t=0,s=new Array(this._array.length-e.length),r=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:s[r++]=this._array[l];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ct=this._search(e),!(Ct<0||Ct>=this._array.length)&&this._getKey(this._array[Ct])===e))do yield this._array[Ct];while(++Ct<this._array.length&&this._getKey(this._array[Ct])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ct=this._search(e),!(Ct<0||Ct>=this._array.length)&&this._getKey(this._array[Ct])===e))do t(this._array[Ct]);while(++Ct<this._array.length&&this._getKey(this._array[Ct])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let r=t+s>>1,l=this._getKey(this._array[r]);if(l>e)s=r-1;else if(l<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},N0=0,T3=0,eT=class extends Ie{constructor(){super(),this._decorations=new JA(e=>e?.marker.line),this._onDecorationRegistered=this._register(new de),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new de),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(pt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new tT(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,s){let r=0,l=0;for(let h of this._decorations.getKeyIterator(t))r=h.options.x??0,l=r+(h.options.width??1),e>=r&&e<l&&(!s||(h.options.layer??"bottom")===s)&&(yield h)}forEachDecorationAtCell(e,t,s,r){this._decorations.forEachByKey(t,l=>{N0=l.options.x??0,T3=N0+(l.options.width??1),e>=N0&&e<T3&&(!s||(l.options.layer??"bottom")===s)&&r(l)})}},tT=class extends sr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new de),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new de),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=yt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=yt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},iT=1e3,sT=class{constructor(e,t=iT){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=r-this._lastRefreshMs,h=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},h)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},N3=20,su=class extends Ie{constructor(e,t,s,r){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let h=0;h<this._terminal.rows;h++)this._rowElements[h]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[h]);if(this._topBoundaryFocusListener=h=>this._handleBoundaryFocus(h,0),this._bottomBoundaryFocusListener=h=>this._handleBoundaryFocus(h,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new sT(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(h=>this._handleResize(h.rows))),this._register(this._terminal.onRender(h=>this._refreshRows(h.start,h.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(h=>this._handleChar(h))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
+`))),this._register(this._terminal.onA11yTab(h=>this._handleTab(h))),this._register(this._terminal.onKey(h=>this._handleKey(h.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(l,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(pt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<N3+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
+`&&(this._liveRegionLineCount++,this._liveRegionLineCount===N3+1&&(this._liveRegion.textContent+=T2.get())))}_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){let s=this._terminal.buffer,r=s.lines.length.toString();for(let l=e;l<=t;l++){let h=s.lines.get(s.ydisp+l),u=[],p=h?.translateToString(!0,void 0,void 0,u)||"",m=(s.ydisp+l+1).toString(),g=this._rowElements[l];g&&(p.length===0?(g.textContent=" ",this._rowColumns.set(g,[0,1])):(g.textContent=p,this._rowColumns.set(g,u)),g.setAttribute("aria-posinset",m),g.setAttribute("aria-setsize",r),this._alignRowWidth(g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],l=s.getAttribute("aria-posinset"),h=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===h||e.relatedTarget!==r)return;let u,p;if(t===0?(u=s,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(u=this._rowElements.shift(),p=s,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}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(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,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;let r=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let l=({node:p,offset:m})=>{let g=p instanceof Text?p.parentNode:p,y=parseInt(g?.getAttribute("aria-posinset"),10)-1;if(isNaN(y))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(g);if(!v)return console.warn("columns is null. Race condition?"),null;let x=m<v.length?v[m]:v.slice(-1)[0]+1;return x>=this._terminal.cols&&(++y,x=0),{row:y,column:x}},h=l(t),u=l(s);if(!(!h||!u)){if(h.row>u.row||h.row===u.row&&h.column>=u.column)throw new Error("invalid range");this._terminal.select(h.column,h.row,(u.row-h.row)*this._terminal.cols-h.column+u.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(){let 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){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}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]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let r=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};su=St([ve(1,qp),ve(2,gn),ve(3,vn)],su);var up=class extends Ie{constructor(e,t,s,r,l){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=r,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new de),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new de),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(pt(()=>{zr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let r=0;r<s.length;r++){let l=s[r];if(l.classList.contains("xterm"))break;if(l.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(r=>{r?.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[r,l]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(s=this._checkLinkProviderResult(r,e,s)):l.provideLinks(e.y,h=>{if(this._isMouseOut)return;let u=h?.map(p=>({link:p}));this._activeProviderReplies?.set(r,u),s=this._checkLinkProviderResult(r,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let r=0;r<t.size;r++){let l=t.get(r);if(l)for(let h=0;h<l.length;h++){let u=l[h],p=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let g=p;g<=m;g++){if(s.has(g)){l.splice(h--,1);break}s.add(g)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let r=this._activeProviderReplies.get(e),l=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(l=!0);if(!l&&r){let h=r.find(u=>this._linkAtPosition(u.link,t));h&&(s=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let h=0;h<this._activeProviderReplies.size;h++){let u=this._activeProviderReplies.get(h)?.find(p=>this._linkAtPosition(p.link,t));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&nT(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,zr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let r=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(r,l),this._lastMouseEvent)){let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._askForLink(h,!1)}})))}_linkHover(e,t,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,r=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-r-1,s.end.x,s.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,t,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,l=t.y*this._bufferService.cols+t.x;return s<=l&&l<=r}_positionFromMouseEvent(e,t,s){let r=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,r,l){return{x1:e,y1:t,x2:s,y2:r,cols:this._bufferService.cols,fg:l}}};up=St([ve(1,Vp),ve(2,vn),ve(3,xi),ve(4,lS)],up);function nT(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var rT=class extends ZA{constructor(e={}){super(e),this._linkifier=this._register(new Xa),this.browser=jS,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Xa),this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new de),this.onKey=this._onKey.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new de),this.onBell=this._onBell.event,this._onFocus=this._register(new de),this._onBlur=this._register(new de),this._onA11yCharEmitter=this._register(new de),this._onA11yTabEmitter=this._register(new de),this._onWillOpen=this._register(new de),this._setup(),this._decorationService=this._instantiationService.createInstance(eT),this._instantiationService.setService(Bo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(YM),this._instantiationService.setService(lS,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(D2)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(ii.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ii.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ii.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ii.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(pt(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let s,r="";switch(t.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+t.index}switch(t.type){case 0:let l=ct.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${ae.ESC}]${r};${$A(l)}${CS.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(h=>h.ansi[t.index]=Nt.toColor(...t.color));else{let h=s;this._themeService.modifyColors(u=>u[h]=Nt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(su,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ae.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ae.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,l=t.getWidth(s),h=this._renderService.dimensions.css.cell.width*l,u=this.buffer.y*this._renderService.dimensions.css.cell.height,p=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=p+"px",this.textarea.style.top=u+"px",this.textarea.style.width=h+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&cE(t,this._selectionService)}));let e=t=>hE(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),ES?this._register(Te(this.element,"mousedown",t=>{t.button===2&&P_(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{P_(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Xp&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&Qw(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Te(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",A2.get()),TS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(FM,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(gn,this._coreBrowserService),this._register(Te(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(J2,this._document,this._helperContainer),this._instantiationService.setService(fu,this._charSizeService),this._themeService=this._instantiationService.createInstance(sp),this._instantiationService.setService(el,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(eu),this._instantiationService.setService(aS,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(tp,this.rows,this.screenElement)),this._instantiationService.setService(vn,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Z2,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ep),this._instantiationService.setService(Vp,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(up,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Y2,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ip,this.element,this.screenElement,r)),this._instantiationService.setService(yE,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(ii.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(G2,this.screenElement)),this._register(Te(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(su,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Jh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Jh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Q2,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(h){let u=e._mouseService.getMouseReportCoords(h,e.screenElement);if(!u)return!1;let p,m;switch(h.overrideType||h.type){case"mousemove":m=32,h.buttons===void 0?(p=3,h.button!==void 0&&(p=h.button<3?h.button:3)):p=h.buttons&1?0:h.buttons&4?1:h.buttons&2?2:3;break;case"mouseup":m=0,p=h.button<3?h.button:3;break;case"mousedown":m=1,p=h.button<3?h.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(h)===!1)return!1;let g=h.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;m=g<0?0:1,p=4;break;default:return!1}return m===void 0||p===void 0||p>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:p,action:m,ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:h=>(s(h),h.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(h)),wheel:h=>(s(h),this.cancel(h,!0)),mousedrag:h=>{h.buttons&&s(h)},mousemove:h=>{h.buttons||s(h)}};this._register(this.coreMouseService.onProtocolChange(h=>{h?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(h)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),h&8?r.mousemove||(t.addEventListener("mousemove",l.mousemove),r.mousemove=l.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),h&16?r.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),r.wheel=l.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),h&2?r.mouseup||(r.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),h&4?r.mousedrag||(r.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",h=>{if(h.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(h)))return s(h),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(h)})),this._register(Te(t,"wheel",h=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(h)===!1)return!1;if(!this.buffer.hasScrollback){if(h.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(h,!0);let u=ae.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(h.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(h,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Xw(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,s){this._selectionService.setSelection(e,t,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=QA(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===ae.ETX||s.key===ae.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(aT(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Tt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(ae.ESC+"[I"):this.coreService.triggerDataEvent(ae.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ae.ESC}[4;${s};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ae.ESC}[6;${l};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function aT(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var lT=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},oT=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new hs)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},D3=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new oT(t)}getNullCell(){return new hs}},cT=class extends Ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new de),this.onBufferChange=this._onBufferChange.event,this._normal=new D3(this._core.buffers.normal,"normal"),this._alternate=new D3(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},hT=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,r)=>t(s,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},uT=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},dT=["cols","rows"],Os=0,fT=class extends Ie{constructor(e){super(),this._core=this._register(new rT(e)),this._addonManager=this._register(new lT),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],s=(r,l)=>{this._checkReadonlyOptions(r),this._core.options[r]=l};for(let r in this._core.options){let l={get:t.bind(this,r),set:s.bind(this,r)};Object.defineProperty(this._publicOptions,r,l)}}_checkReadonlyOptions(e){if(dT.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new hT(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new uT(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new cT(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
+`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return A2.get()},set promptLabel(e){A2.set(e)},get tooMuchOutput(){return T2.get()},set tooMuchOutput(e){T2.set(e)}}}_verifyIntegers(...e){for(Os of e)if(Os===1/0||isNaN(Os)||Os%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Os of e)if(Os&&(Os===1/0||isNaN(Os)||Os%1!==0||Os<0))throw new Error("This API only accepts positive integers")}};const R3=e=>{/^https?:/i.test(e)&&window.codync.app.openExternal(e)};function L3({backend:e,step:t,method:s,back:r}){const l=Ae(),h=b.useRef(null),[u,p]=b.useState(null),[m,g]=b.useState(null);b.useEffect(()=>{const v=h.current;if(!v)return;const x=getComputedStyle(document.documentElement),S=parseFloat(x.getPropertyValue("--scale"))||1,w=new fT({fontFamily:x.getPropertyValue("--mono").trim()||"monospace",fontSize:12*S,cursorBlink:!0,allowTransparency:!0,theme:{background:x.getPropertyValue("--background").trim(),foreground:x.getPropertyValue("--text").trim(),cursor:x.getPropertyValue("--text").trim(),selectionBackground:`rgba(${x.getPropertyValue("--text-rgb").trim()}, 0.2)`},linkHandler:{activate:(M,X)=>R3(X)}}),C=new Qj;w.loadAddon(C),w.loadAddon(new nE((M,X)=>R3(X))),w.open(v),C.fit(),w.focus();let j=!1,E=null,A=null,N={cols:w.cols,rows:w.rows},L={cols:0,rows:0},q=null,B=Promise.resolve();const I=new TextEncoder,U=()=>{const M=l.client;!M||!A||N.cols===L.cols&&N.rows===L.rows||(L=N,Re.termResize(M,A,N.cols,N.rows).catch(()=>{}))},P=M=>{const X=l.client;if(E!==null||!X||!A)return;const V=A;B=B.then(()=>Re.termInput(X,V,Ux(M)).then(()=>{},()=>{}))},F=[w.onData(M=>P(I.encode(M))),w.onBinary(M=>P(Uint8Array.from(M,X=>X.charCodeAt(0)&255))),w.onResize(({cols:M,rows:X})=>{N={cols:M,rows:X},U()})],$=new ResizeObserver(()=>C.fit());$.observe(v);let z=0;const O=(M,X)=>new Promise(V=>{w.reset(),q=M.transport.stream(`/term/${encodeURIComponent(X)}`,ie=>{z=0;let ee;try{ee=JSON.parse(ie)}catch{return}ee.type==="output"&&ee.data?w.write(Px(ee.data)):ee.type==="exit"&&(E=ee.code??-1,p(E))},ie=>{q=null,ie?.status===404?(g(ie.message),V("done")):ie?(z+=1,z>5?(g(ie.message),V("done")):V("retry")):V("retry")})});return(async()=>{try{const M=await l.ready(),X=await Re.agentSetup(M,e.id,t,s?.id??null,N.cols,N.rows);if(j){Re.termClose(M,X).catch(()=>{});return}for(A=X,L=N,U();E===null&&!j&&await O(M,X)!=="done";)E===null&&!j&&await new Promise(V=>setTimeout(V,1e3))}catch(M){j||g(M instanceof as?M.message:tt(M));return}j||await l.refreshBackends()})(),()=>{j=!0,$.disconnect(),F.forEach(X=>X.dispose()),q?.();const M=l.client;E===null&&M&&A&&Re.termClose(M,A).catch(()=>{}),w.dispose()}},[l,e.id,t,s?.id]);const y=t==="install"?`Install ${e.name}`:s?.name??`Sign in to ${e.name}`;return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(cu,{title:y,onBack:r}),o.jsx("div",{className:"setup-terminal",children:o.jsx("div",{ref:h,style:{width:"100%",height:"100%"}})}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 16px",...R("footnote")},children:[m?o.jsx("span",{style:{color:"var(--danger)",...D0},children:m}):u!==null?o.jsxs(o.Fragment,{children:[o.jsx(se,{name:u===0?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10,color:u===0?"var(--added)":"var(--warning)"}),o.jsx("span",{style:{color:"var(--secondary)",...D0},children:u===0?"Finished.":`Ended with an error (${u}).`})]}):o.jsxs(o.Fragment,{children:[o.jsx(xs,{size:14,color:"var(--secondary)"}),o.jsxs("span",{style:{color:"var(--secondary)",...D0},children:["Running on ",l.hostName,". Links open on this device."]})]}),o.jsx("span",{style:{flex:1}}),u!==null?o.jsx(Ne,{className:"fade-in",onClick:r,children:"Done"}):null]})]})}const D0={display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"};function pT(e){switch(e){case"claude-acp":return"rgb(217, 120, 87)";case"gemini":return"linear-gradient(to top right, rgb(71, 150, 227), rgb(145, 120, 199), rgb(201, 102, 115))";case"antigravity-acp":return"rgb(66, 133, 245)";case"mistral-vibe":return"rgb(250, 82, 15)";case"qwen-code":return"rgb(97, 92, 237)";case"amp-acp":return"rgb(242, 79, 64)";case"kiro":return"rgb(143, 69, 255)";case"cortex-code":return"rgb(41, 181, 232)";default:return"var(--text)"}}function US({registry:e,icon:t,tile:s,radius:r}){return o.jsx("div",{style:{width:s,height:s,flex:"none",borderRadius:r,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:o.jsx(mT,{registry:e,size:t})})}function mT({registry:e,size:t}){const s=Bp(e);return s?o.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",background:pT(e),WebkitMaskImage:`url("${s}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):o.jsx(se,{name:"terminal",size:t*.8,scaled:!1})}function gT({initial:e}){const t=Ae(),[s,r]=b.useState(null),[l,h]=b.useState(null),[u,p]=b.useState(!1),[m,g]=b.useState(null),[y,v]=b.useState(null),x=b.useRef(!1),S=t.hello?.backends.find($=>$.id===e.id)??e,w=S.installed===!0,C=S.curated===!0,j=l?.signedIn??S.signedIn??null,E=t.hostName,A=async()=>{const $=t.client;if(!(!$||x.current)){x.current=!0,p(!0);try{h(await Re.agentAuth($,S.id)),v(null)}catch(z){v(tt(z))}x.current=!1,p(!1),await t.refreshBackends()}},N=async $=>{const z=t.client;if(z){g($.id);try{h(await Re.agentAuthenticate(z,S.id,$.id)),v(null)}catch(O){v(tt(O))}g(null),await t.refreshBackends()}};b.useEffect(()=>{S.signedIn!==!0&&A()},[]);const L=b.useRef(!1);b.useEffect(()=>{s===null&&L.current&&A(),L.current=s!==null},[s]);const q=()=>r(null),B=s===null?null:s.kind==="install"?o.jsx(L3,{backend:S,step:"install",back:q}):s.kind==="terminal"?o.jsx(L3,{backend:S,step:"login",method:s.method,back:q}):o.jsx(vT,{backend:S,method:s.method,saved:l?.savedEnv??[],back:q,done:h}),I=u?l===null?`Checking with ${S.name}… The first check can download it.`:"Checking…":j===!0?"Signed in.":j===!1?"Not signed in yet.":`Couldn't tell. Skip this if you've already signed in on ${E}.`,U=($,z,O,M,X,V=!1)=>o.jsxs("button",{className:"option-row",disabled:m!==null,onClick:X,children:[o.jsx("span",{"aria-hidden":!0,style:{width:26,display:"flex",justifyContent:"center",color:"var(--secondary)",flex:"none"},children:o.jsx(se,{name:M,size:13})}),o.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[o.jsx("span",{style:{...R("body","medium"),color:"var(--text)"},children:z}),o.jsx("span",{style:{...R("subheadline"),color:"var(--secondary)",...y2(3)},children:O})]}),o.jsx("span",{style:{minWidth:8}}),V?o.jsx(xs,{size:16,color:"var(--secondary)"}):o.jsx(se,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},$),P=[];if(j!==!0&&!u){l?.login&&P.push(U("login","Sign in",`In a terminal on ${E}. Links open here.`,"terminal",()=>r({kind:"terminal",method:null})));for(const $ of l?.methods??[])$.kind==="terminal"?P.push(U($.id,$.name,$.description??`In a terminal on ${E}.`,"terminal",()=>r({kind:"terminal",method:$}))):$.kind==="envVar"?P.push(U($.id,$.name,$.description??`Saved on ${E} only.`,"key",()=>r({kind:"keys",method:$}))):P.push(U($.id,$.name,m===$.id?`Finish signing in in the browser on ${E}…`:$.description??`Opens a browser on ${E}.`,"safari",()=>{N($)},m===$.id))}const F=o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:S.name}),o.jsxs(ui,{children:[o.jsx(ke,{children:o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[o.jsx(US,{registry:S.registry,icon:30,tile:52,radius:14}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[o.jsx("span",{style:R("title3","semibold"),children:S.name}),S.description?o.jsx("span",{style:{...R("subheadline"),color:"var(--secondary)",...y2(3)},children:S.description}):null]})]})}),C?o.jsx(ke,{children:o.jsx(B3,{number:1,title:"Install",detail:w?`Installed on ${E}.`:S.canInstall?`Runs the official installer on ${E}.`:S.installHint,done:w,action:w||!S.canInstall?null:{label:"Install",run:()=>r({kind:"install"})}})}):null,o.jsxs(ke,{footer:j!==!0&&l?.methods.some($=>$.kind==="agent")?`Browser sign-ins open on ${E} itself. Away from it? Use Remote screen to finish there.`:null,children:[o.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o.jsx("div",{style:{flex:1,minWidth:0},children:o.jsx(B3,{number:C?2:1,title:"Sign in",detail:I,done:j===!0,action:null})}),u?o.jsx(xs,{state:"connecting",size:16,color:"var(--secondary)"}):o.jsx("button",{title:"Check again","aria-label":"Check again",style:{display:"flex",color:"var(--secondary)"},onClick:()=>{A()},children:o.jsx(se,{name:"arrow.clockwise",size:13})})]}),j!==!0&&l?.detail?o.jsx("span",{className:"selectable",style:{...R("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:l.detail}):null,P]}),y?o.jsx(ke,{children:o.jsx(Vs,{text:y})}):null]})]});return o.jsx(uw,{base:F,top:B})}function vT({backend:e,method:t,saved:s,back:r,done:l}){const h=Ae(),[u,p]=b.useState({}),[m,g]=b.useState(!1),[y,v]=b.useState(null),x=t.vars??[],S=async C=>{const j=h.client;if(j){g(!0);try{l(await Re.setAgentEnv(j,e.id,C)),r()}catch(E){v(tt(E))}g(!1)}},w=x.some(C=>!C.optional&&!u[C.name]&&!s.includes(C.name));return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(cu,{title:t.name,onBack:r,trailing:m?o.jsx($e,{}):o.jsx(be,{title:"Save",icon:"checkmark",disabled:w,onClick:()=>{S(Dp(u))}})}),o.jsxs(ui,{children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[o.jsx(ke,{title:t.name,children:x.map(C=>o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsx(ti,{label:C.label,value:u[C.name]??"",secret:C.secret,placeholder:s.includes(C.name)?"Saved (type to replace)":C.name,onChange:j=>p(E=>({...E,[C.name]:j}))}),o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:C.label+(C.optional?" (optional)":"")})]},C.name))}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"0 4px",...R("caption"),color:"var(--tertiary)"},children:[t.description?o.jsx("span",{children:t.description}):null,o.jsxs("span",{children:["Saved on ",h.hostName," only and given to ",e.name," when it starts."]}),t.link&&URL.canParse(t.link)?o.jsx(Np,{title:"Get a key",url:t.link}):null]})]}),s.length?o.jsx(ke,{children:o.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{S(Object.fromEntries(x.map(C=>[C.name,""])))},children:"Remove saved keys"})}):null,y?o.jsx(ke,{children:o.jsx(Vs,{text:y})}):null]})]})}function B3({number:e,title:t,detail:s,done:r,action:l}){return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"4px 0"},"aria-label":`${t}. ${s}${r?". Done":""}`,children:[o.jsx("span",{"aria-hidden":!0,style:{width:26,height:26,borderRadius:"50%",flex:"none",display:"grid",placeItems:"center",background:r?"var(--accent-fill)":"var(--bubble-agent)",transition:"background-color var(--fade)"},children:r?o.jsx(se,{name:"checkmark",size:10,weight:"bold",color:"var(--on-accent)"}):o.jsx("span",{style:{...R("caption","semibold"),color:"var(--secondary)"},children:e})}),o.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[o.jsx("span",{style:{...R("body","medium"),color:"var(--text)"},children:t}),o.jsx("span",{className:"selectable",style:{...R("subheadline"),color:"var(--secondary)"},children:s})]}),o.jsx("span",{style:{minWidth:8}}),l?o.jsx("button",{className:"capsule-action",style:{...R("subheadline","semibold"),padding:"7px 14px"},onClick:l.run,children:l.label}):null]})}const dp={...R("caption"),color:"var(--secondary)"};function yT({onBack:e}){const t=Ki(),s=Ae(),r=qr(s),[l,h]=b.useState(null),[u,p]=b.useState(""),[m,g]=b.useState(null),[y,v]=b.useState(!1),[x,S]=b.useState(null);b.useEffect(()=>{(async()=>{await r.refresh();const C=s.client;if(C)try{g(await Re.credentialStatus(C))}catch(j){S(tt(j))}})()},[r,s]);const w=async C=>{const j=s.client;if(j){v(!0),S(null);try{g(await Re.setOnePasswordToken(j,C)),p("")}catch(E){S(tt(E))}v(!1)}};return o.jsxs("div",{className:"credentials-page",children:[o.jsx(cu,{title:"Credentials",onBack:e,trailing:o.jsx(be,{title:"Close",icon:"xmark",onClick:t})}),o.jsxs(ui,{children:[o.jsx(ke,{title:"Storage",children:o.jsxs("div",{className:"credential-storage",children:[o.jsx(se,{name:"lock.shield",size:20}),o.jsxs("div",{children:[o.jsx("strong",{children:m?.provider??"System credential store"}),o.jsx("p",{children:"Encrypted on the connected computer."})]})]})}),o.jsxs(ke,{title:"Saved connections",children:[r.installedConnectors.filter(C=>C.keys.length>0).map(C=>o.jsxs("button",{className:"plain-row-button",onClick:()=>h(C),children:[o.jsx("span",{style:{flex:1},children:C.name}),o.jsx(se,{name:"chevron.right",size:10})]},C.id)),r.installedConnectors.some(C=>C.keys.length>0)?null:o.jsx("span",{style:dp,children:"No saved connection credentials yet."}),o.jsx("span",{style:dp,children:"Values stay hidden. Select a connection to replace its credentials."})]}),o.jsx(_T,{}),o.jsxs(ke,{title:"1Password",footer:"Use a service account with read access only to a dedicated shared vault. The 1Password CLI must be installed on the computer.",children:[o.jsx("span",{children:m?.onePasswordConnected?"Connected":"Connect a shared vault"}),o.jsx(Uh,{label:"Service account token",value:u,onChange:p,placeholder:"Paste your token",secret:!0}),o.jsx("div",{children:o.jsx(Ne,{disabled:y||!u,onClick:()=>{w(u)},children:"Connect"})}),m?.onePasswordConnected?o.jsx("div",{children:o.jsx(Ne,{kind:"secondary",disabled:y,onClick:()=>{w("")},children:"Disconnect"})}):null,o.jsx("span",{style:{...R("footnote"),color:"var(--secondary)"},children:"Use op://vault/item/field in a connector's credential field. Codync retrieves the value when the connector runs."})]}),y?o.jsx($e,{}):null,x?o.jsx(Vs,{text:x}):null]}),o.jsx(os,{open:l!==null,onClose:()=>h(null),children:l?o.jsx(xT,{connector:l},l.id):null})]})}function _T(){const e=Ae(),[t,s]=b.useState([]),[r,l]=b.useState(""),[h,u]=b.useState(""),[p,m]=b.useState(""),[g,y]=b.useState(!1),[v,x]=b.useState(null),S=async()=>{const j=e.client;try{s(j?await Re.logins(j):[])}catch(E){x(tt(E))}};b.useEffect(()=>{S()},[]);const w=async()=>{const j=e.client;if(j){y(!0),x(null);try{await Re.saveLogin(j,r,h,p),l(""),u(""),m(""),await S()}catch(E){x(tt(E))}y(!1)}},C=async j=>{const E=e.client;if(E)try{await Re.removeLogin(E,j.id),s(A=>A.filter(N=>N.id!==j.id))}catch(A){x(tt(A))}};return o.jsxs(ke,{title:"Sign-ins",footer:"Bots type these into the matching website or app and never see the password. You can use an op:// reference.",children:[t.map(j=>o.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[o.jsx("span",{children:j.site}),j.username?o.jsx("span",{style:dp,children:j.username}):null]}),o.jsx(be,{title:"Remove",icon:"trash",onClick:()=>{C(j)}})]},j.id)),o.jsx(Uh,{label:"Website or app",value:r,onChange:l,placeholder:"github.com"}),o.jsx(Uh,{label:"Username or email",value:h,onChange:u,placeholder:"[email protected]"}),o.jsx(Uh,{label:"Password",value:p,onChange:m,placeholder:"Password or op:// reference",secret:!0}),o.jsx("div",{children:o.jsx(Ne,{disabled:g||!r||!p,onClick:()=>{w()},children:"Save sign-in"})}),v?o.jsx("span",{style:{...R("footnote"),color:"var(--danger)"},children:v}):null]})}function xT({connector:e}){const t=Ae(),s=Ki(),[r,l]=b.useState({}),[h,u]=b.useState(!1),[p,m]=b.useState(null),g=async()=>{const y=t.client;if(y){u(!0),m(null);try{await Re.updateConnectorCredentials(y,e.id,Dp(r)),l({}),s()}catch(v){m(tt(v))}u(!1)}};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(ut,{title:e.name,trailing:h?o.jsx($e,{}):o.jsx(be,{title:"Save credentials",icon:"checkmark",disabled:Object.values(r).every(y=>!y),onClick:()=>{g()}})}),o.jsxs(ui,{children:[o.jsx(ke,{footer:"Enter only the values you want to replace. You can use an op:// reference.",children:e.keys.map(y=>o.jsx(ti,{label:y,value:r[y]??"",placeholder:y,secret:!0,onChange:v=>l(x=>({...x,[y]:v}))},y))}),p?o.jsx(Vs,{text:p}):null]})]})}function Uh({label:e,...t}){return o.jsxs("label",{className:"credential-field",children:[o.jsx("span",{children:e}),o.jsx(ti,{...t,label:e})]})}const O3=e=>e.name;function wT({computers:e,computer:t,onComputer:s,appsFirst:r=!1}){const l=Ae(),h=qr(l),u=Ki(),[p,m]=b.useState(""),[g,y]=b.useState(0),[v,x]=b.useState(Kh),[S,w]=b.useState(null),[C,j]=b.useState(!1),[E,A]=b.useState([]),[N,L]=b.useState(!0),[q,B]=b.useState(!0),[I,U]=b.useState(null),[P,F]=b.useState(null),[$,z]=b.useState(null),[O,M]=b.useState(!1),[X,V]=b.useState(!1),[ie,ee]=b.useState(null),[ce,Y]=b.useState(null),[oe,xe]=b.useState(10),[we,D]=b.useState(!1),[J,le]=b.useState(!1),he=b.useRef(0),je=b.useRef(""),pe=p.trim(),Ee=ge=>(ge??"").toLowerCase().includes(pe.toLowerCase()),me=(l.hello?.backends??[]).filter(ge=>ge.available||ge.installed===!0||ge.curated===!0),_e=pe?me.filter(ge=>Ee(ge.name)):me,Le=pe?E.filter(ge=>Ee(ge.name)||Ee(ge.description)):E,ni=h.installedConnectors.length+h.installedSkills.length,ri=async(ge=pe)=>{const ot=++he.current;je.current=ge,L(!0),j(!1);try{const ai=await Re.marketConnectors(await l.ready(),ge);if(he.current!==ot)return;x(lw(ai.items,O3)),w(ai.next),U(null)}catch(ai){if(he.current!==ot)return;x(Kh()),w(null),U(tt(ai))}finally{he.current===ot&&L(!1)}},fi=async()=>{if(C||N)return;if(g2(v)){x(m2);return}if(!S)return;const ge=he.current;j(!0);try{const ot=await Re.marketConnectors(await l.ready(),je.current,S);if(he.current!==ge)return;x(ai=>m2(aw(ai,ot.items,O3))),w(ot.next),U(null)}catch(ot){he.current===ge&&U(tt(ot))}finally{he.current===ge&&j(!1)}};b.useEffect(()=>(h.refresh(),l.refreshBackends(),ri(""),(async()=>{try{A(await Re.marketSkills(await l.ready()))}catch(ge){U(tt(ge))}B(!1)})(),()=>{he.current++}),[]);const mt=ge=>{y(ot=>ot+1),ri(ge)},Ye=async ge=>{z(ge.source);try{await h.installSkill(ge.source)}catch(ot){U(tt(ot))}z(null)},Si=o.jsxs("div",{className:"market-heading",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[o.jsx(Lr,{computer:l.computer,size:32}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,whiteSpace:"nowrap"},children:[o.jsx("span",{style:{...R("title","semibold"),color:"var(--text)"},children:r?"Connect apps":"Marketplace"}),e.length>1?o.jsxs(Ya,{title:"Switch computer",style:{display:"flex",alignItems:"center",gap:4,...R("subheadline"),color:"var(--secondary)",minWidth:0},items:()=>e.map(ge=>({title:ge.name,selected:ge.id===t,action:()=>s(ge.id)})),children:[o.jsx("span",{"aria-label":`Computer: ${l.hostName}`,style:{overflow:"hidden",textOverflow:"ellipsis"},children:l.hostName}),o.jsx(se,{name:"chevron.down",size:10,weight:"semibold"})]}):o.jsx("span",{style:{...R("subheadline"),color:"var(--secondary)",overflow:"hidden",textOverflow:"ellipsis"},children:l.hostName})]})]}),o.jsx("span",{style:{flex:1}}),o.jsxs(Ne,{kind:"secondary",onClick:()=>le(!0),children:[o.jsx(se,{name:"lock.shield",size:12}),"Credentials"]}),ni>0?o.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,flex:"none"},onClick:()=>D(!0),children:[o.jsx("span",{style:{display:"flex"},children:h.installedConnectors.slice(0,3).map((ge,ot)=>o.jsx("span",{style:{marginLeft:ot?-8:0,display:"flex"},children:o.jsx(x2,{name:ge.name,registryName:ge.registryName,size:26})},ge.id))}),o.jsxs("span",{style:{color:"var(--secondary)",whiteSpace:"nowrap"},children:[ni," installed"]}),o.jsx(se,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]}):null]}),Ni=o.jsxs("div",{className:"market-search",children:[o.jsx(se,{name:"magnifyingglass",size:13,color:"var(--secondary)"}),o.jsx("input",{value:p,placeholder:"Search agents, connectors and skills","aria-label":"Search agents, connectors and skills",spellCheck:!1,onChange:ge=>{m(ge.target.value),xe(10)},onKeyDown:ge=>{ge.key==="Enter"&&!ge.nativeEvent.isComposing&&mt(p.trim())}}),p?o.jsx("button",{"aria-label":"Clear search",title:"Clear search",style:{display:"flex",color:"var(--tertiary)"},onClick:()=>{m(""),xe(10),mt("")},children:o.jsx(se,{name:"xmark.circle.fill",size:13})}):null]}),Di=ge=>o.jsx("div",{style:{display:"flex",justifyContent:"center"},children:ge}),yn=o.jsxs("div",{className:"market-page",children:[o.jsx("div",{className:"market-scroll",children:o.jsxs("div",{className:"market-page-content",children:[Si,Ni,r?o.jsx(S_,{query:pe,searchToken:g}):null,_e.length>0?o.jsxs(fo,{title:pe?`Agents matching “${pe}”`:"Agents",children:[o.jsx("div",{className:"agent-grid",children:_e.slice(0,oe).map(ge=>o.jsx(ST,{backend:ge,onClick:()=>Y(ge)},ge.id))}),_e.length>oe?Di(o.jsx(Ne,{kind:"secondary",onClick:()=>xe(ge=>ge+10),children:"Load more agents"})):null]}):null,o.jsx(fo,{title:"Connectors",children:N?o.jsx(_2,{}):v.items.length===0?o.jsx("span",{style:{color:"var(--secondary)"},children:pe?`No connectors match “${pe}”.`:"Couldn't load connectors."}):o.jsxs(o.Fragment,{children:[o.jsx(wo,{children:ow(v).map(ge=>o.jsx(Va,{title:ge.title,subtitle:ge.description??ge.name,added:ge.installed,icon:o.jsx(x2,{website:ge.website,name:ge.title,registryName:ge.name}),onAdd:()=>F(ge)},ge.name))}),g2(v)||S?Di(o.jsx(Ne,{kind:"secondary",disabled:C,onClick:()=>{fi()},children:C?"Loading…":"Load more connectors"})):null]})}),r?null:o.jsx(S_,{query:pe,searchToken:g}),o.jsx(fo,{title:"Skills",children:q?o.jsx(_2,{}):o.jsx(wo,{children:Le.map(ge=>o.jsx(Va,{title:ge.name,subtitle:ge.description,added:ge.installed||h.installedSkills.some(ot=>ot.id===ge.source.toLowerCase()),busy:$===ge.source,icon:o.jsx(hw,{}),onAdd:()=>{Ye(ge)},onOpen:()=>ee(ge)},ge.source))})}),o.jsx(fo,{title:"Make your own",children:o.jsxs(wo,{children:[o.jsx(Va,{title:"Custom connector",subtitle:"Any MCP server: a command or a URL",added:!1,addLabel:"New",icon:o.jsx(w2,{name:"point.3.connected.trianglepath.dotted"}),onAdd:()=>M(!0)}),o.jsx(Va,{title:"Your own skill",subtitle:"Write instructions a bot can follow",added:!1,addLabel:"New",icon:o.jsx(w2,{name:"square.and.pencil"}),onAdd:()=>V(!0)})]})}),I?o.jsx("span",{style:{...R("footnote"),color:"var(--danger)"},children:I}):null,o.jsxs("span",{style:{...R("footnote"),color:"var(--tertiary)"},children:["Connectors come from the official MCP Registry, apps through Composio, skills from Anthropic, agents from the ACP registry. Everything installs on ",l.hostName,"."]})]})}),o.jsx("div",{className:"market-close",children:o.jsx(be,{title:"Close",icon:"xmark",onClick:u})})]});return o.jsxs(o.Fragment,{children:[o.jsx(uw,{base:yn,top:J?o.jsx(yT,{onBack:()=>le(!1)}):we?o.jsx(bT,{back:()=>D(!1)}):null}),o.jsx(os,{open:P!==null,onClose:()=>F(null),children:P?o.jsx(fw,{item:P,done:()=>{ri(je.current)}},P.name):null}),o.jsx(os,{open:O,onClose:()=>M(!1),children:o.jsx(S9,{})}),o.jsx(os,{open:X,onClose:()=>V(!1),children:o.jsx(b9,{})}),o.jsx(os,{open:ie!==null,onClose:()=>ee(null),children:ie?o.jsx(zp,{skill:ie},ie.name):null}),o.jsx(os,{open:ce!==null,onClose:()=>Y(null),width:560,height:560,children:ce?o.jsx(gT,{initial:ce},ce.id):null})]})}function ST({backend:e,onClick:t}){const s=e.installed===!0?e.signedIn===!1?"Not signed in":"Installed":e.curated===!0?"Not installed":"Sets up on first use";return o.jsxs("button",{className:"agent-card",title:e.name,onClick:t,children:[o.jsx(US,{registry:e.registry,icon:24,tile:40,radius:11}),o.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:3,minWidth:0},children:[o.jsx("span",{style:{...R("subheadline","semibold"),color:"var(--text)",...nu},children:e.name}),o.jsx("span",{style:{...R("caption"),color:"var(--secondary)",...nu},children:s})]})]})}const nu={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"};function bT({back:e}){const t=Ae(),s=qr(t),[r,l]=b.useState(null),[h,u]=b.useState(null),[p,m]=b.useState(null),g=s.installedConnectors.length===0&&s.installedSkills.length===0,y=async x=>{u(x);try{await s.signIn(x)}catch(S){t.setError(tt(S))}u(null)},v=async x=>{try{x.isSkill?await s.removeSkill(x.id):await s.removeConnector(x.id)}catch(S){t.setError(tt(S))}};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[o.jsx(cu,{title:"Installed",onBack:e}),o.jsx("div",{style:{flex:1,minHeight:0},children:o.jsxs(ui,{children:[g?o.jsx(CT,{icon:"shippingbox",title:"Nothing installed",detail:"Connectors and skills you add show up here."}):null,s.installedConnectors.length?o.jsx(ke,{title:"Connectors",children:s.installedConnectors.map(x=>o.jsx(z3,{title:x.name,subtitle:Ga(x)?"Sign in so bots can use it":x.command??x.url??x.description,icon:x.kind==="composio"?o.jsx(Tp,{url:x.logo,name:x.name,size:32}):o.jsx(x2,{name:x.name,registryName:x.registryName,size:32}),accessory:h===x.id?o.jsx($e,{}):Ga(x)?o.jsx(Ne,{onClick:()=>{y(x.id)},children:"Sign in"}):null,onRemove:()=>l({id:x.id,name:x.name,isSkill:!1})},x.id))}):null,s.installedSkills.length?o.jsx(ke,{title:"Skills",children:s.installedSkills.map(x=>o.jsx(z3,{title:x.name,subtitle:x.description,icon:o.jsx(hw,{size:32}),onOpen:()=>m({id:x.id,name:x.name,description:x.description}),onRemove:()=>l({id:x.id,name:x.name,isSkill:!0})},x.id))}):null]})}),o.jsx(cs,{open:r!==null,title:`Remove ${r?.name??""}?`,message:r?r.isSkill?"Bots stop using this skill.":"Bots lose this connector, and the keys saved for it are deleted.":null,actions:r?[{title:"Remove",destructive:!0,action:()=>{v(r)}}]:[],onClose:()=>l(null)}),o.jsx(os,{open:p!==null,onClose:()=>m(null),children:p?o.jsx(zp,{skill:p},p.name):null})]})}function CT({icon:e,title:t,detail:s}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"40px 0",textAlign:"center"},children:[o.jsx(se,{name:e,size:28,color:"var(--tertiary)"}),o.jsx("span",{style:{...R("compactBody","semibold"),color:"var(--text)"},children:t}),o.jsx("span",{style:{...R("compactSecondary"),color:"var(--secondary)"},children:s})]})}function z3({title:e,subtitle:t,icon:s,accessory:r,onOpen:l,onRemove:h}){const u=o.jsxs(o.Fragment,{children:[s,o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0,textAlign:"left"},children:[o.jsx("span",{style:{color:"var(--text)",...nu},children:e}),o.jsx("span",{style:{...R("caption"),color:"var(--secondary)",...nu},children:t})]})]});return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},title:t,children:[l?o.jsx("button",{className:"press",style:{display:"flex",alignItems:"center",gap:12,flex:1,minWidth:0},onClick:l,children:u}):u,o.jsx("span",{style:{minWidth:12}}),r,o.jsx("button",{title:"Remove","aria-label":`Remove ${e}`,style:{minWidth:44,minHeight:44,display:"grid",placeItems:"center",color:"var(--secondary)",margin:"-8px 0"},onClick:h,children:o.jsx(se,{name:"trash",size:13})})]})}const kT=5200,jT=640,ET={overview:196,empty:150,approval:206,finished:170,failed:190,message:156,usage:196},MT=26,Ir=e=>e.status==="working"||e.status==="needsInput",AT=e=>e!=="hidden"&&e!=="peek"&&e!=="compact";function TT(e,{open:t,peek:s,tab:r,deferred:l,notice:h}){if(!t)return e.permissions.some(u=>!l.has(u.entryId))?"approval":h?h.kind:s?"peek":e.bots.some(Ir)?"compact":"hidden";if(r==="message"||r==="usage")return r;if(r==="auto"){if(e.permissions.length)return"approval";if(h)return h.kind}return e.bots.some(Ir)?"overview":"empty"}function NT(e,t){return t.flatMap(s=>{const r=e.get(s.ref);return r!=="working"&&r!=="needsInput"?[]:s.status==="idle"?[{kind:"finished",ref:s.ref}]:s.status==="error"?[{kind:"failed",ref:s.ref}]:[]})}function DT(e){return e.find(t=>t.status==="needsInput")??e.find(Ir)??e[0]??null}function RT(e,t,s){const r=e.filter(l=>l.ref!==t?.ref);return[...r.filter(Ir),...r.filter(l=>!Ir(l))].slice(0,s)}const PS=e=>36+Math.max(0,(e.notch?.height??32)-32);function LT(e,t){const s=t.notch,r=s?.height??MT,l=s?14:r/2;switch(e){case"hidden":return s?{width:s.width,height:s.height,radius:l}:{width:160,height:0,radius:0};case"peek":return{width:s?s.width+64:120,height:r,radius:l};case"compact":return{width:s?s.width+104:240,height:r,radius:l};default:return{width:jT,height:ET[e]+PS(t)-36,radius:30}}}function BT(e,t){return{x:(t-e.width)/2,y:0,width:e.width,height:e.height}}const OT=e=>e==="darwin"?"Show in notch":"Show at top of screen";var Pa={},R0,H3;function zT(){return H3||(H3=1,R0=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),R0}var L0={},Zn={},I3;function $r(){if(I3)return Zn;I3=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Zn.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},Zn.getSymbolTotalCodewords=function(r){return t[r]},Zn.getBCHDigit=function(s){let r=0;for(;s!==0;)r++,s>>>=1;return r},Zn.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},Zn.isKanjiModeEnabled=function(){return typeof e<"u"},Zn.toSJIS=function(r){return e(r)},Zn}var B0={},U3;function Qp(){return U3||(U3=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+s)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,l){if(e.isValid(r))return r;try{return t(r)}catch{return l}}})(B0)),B0}var O0,P3;function HT(){if(P3)return O0;P3=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const s=Math.floor(t/8);return(this.buffer[s]>>>7-t%8&1)===1},put:function(t,s){for(let r=0;r<s;r++)this.putBit((t>>>s-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const s=Math.floor(this.length/8);this.buffer.length<=s&&this.buffer.push(0),t&&(this.buffer[s]|=128>>>this.length%8),this.length++}},O0=e,O0}var z0,q3;function IT(){if(q3)return z0;q3=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,s,r,l){const h=t*this.size+s;this.data[h]=r,l&&(this.reservedBit[h]=!0)},e.prototype.get=function(t,s){return this.data[t*this.size+s]},e.prototype.xor=function(t,s,r){this.data[t*this.size+s]^=r},e.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},z0=e,z0}var H0={},V3;function UT(){return V3||(V3=1,(function(e){const t=$r().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const l=Math.floor(r/7)+2,h=t(r),u=h===145?26:Math.ceil((h-13)/(2*l-2))*2,p=[h-7];for(let m=1;m<l-1;m++)p[m]=p[m-1]-u;return p.push(6),p.reverse()},e.getPositions=function(r){const l=[],h=e.getRowColCoords(r),u=h.length;for(let p=0;p<u;p++)for(let m=0;m<u;m++)p===0&&m===0||p===0&&m===u-1||p===u-1&&m===0||l.push([h[p],h[m]]);return l}})(H0)),H0}var I0={},$3;function PT(){if($3)return I0;$3=1;const e=$r().getSymbolSize,t=7;return I0.getPositions=function(r){const l=e(r);return[[0,0],[l-t,0],[0,l-t]]},I0}var U0={},W3;function qT(){return W3||(W3=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const h=l.size;let u=0,p=0,m=0,g=null,y=null;for(let v=0;v<h;v++){p=m=0,g=y=null;for(let x=0;x<h;x++){let S=l.get(v,x);S===g?p++:(p>=5&&(u+=t.N1+(p-5)),g=S,p=1),S=l.get(x,v),S===y?m++:(m>=5&&(u+=t.N1+(m-5)),y=S,m=1)}p>=5&&(u+=t.N1+(p-5)),m>=5&&(u+=t.N1+(m-5))}return u},e.getPenaltyN2=function(l){const h=l.size;let u=0;for(let p=0;p<h-1;p++)for(let m=0;m<h-1;m++){const g=l.get(p,m)+l.get(p,m+1)+l.get(p+1,m)+l.get(p+1,m+1);(g===4||g===0)&&u++}return u*t.N2},e.getPenaltyN3=function(l){const h=l.size;let u=0,p=0,m=0;for(let g=0;g<h;g++){p=m=0;for(let y=0;y<h;y++)p=p<<1&2047|l.get(g,y),y>=10&&(p===1488||p===93)&&u++,m=m<<1&2047|l.get(y,g),y>=10&&(m===1488||m===93)&&u++}return u*t.N3},e.getPenaltyN4=function(l){let h=0;const u=l.data.length;for(let m=0;m<u;m++)h+=l.data[m];return Math.abs(Math.ceil(h*100/u/5)-10)*t.N4};function s(r,l,h){switch(r){case e.Patterns.PATTERN000:return(l+h)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return h%3===0;case e.Patterns.PATTERN011:return(l+h)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(h/3))%2===0;case e.Patterns.PATTERN101:return l*h%2+l*h%3===0;case e.Patterns.PATTERN110:return(l*h%2+l*h%3)%2===0;case e.Patterns.PATTERN111:return(l*h%3+(l+h)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(l,h){const u=h.size;for(let p=0;p<u;p++)for(let m=0;m<u;m++)h.isReserved(m,p)||h.xor(m,p,s(l,m,p))},e.getBestMask=function(l,h){const u=Object.keys(e.Patterns).length;let p=0,m=1/0;for(let g=0;g<u;g++){h(g),e.applyMask(g,l);const y=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(g,l),y<m&&(m=y,p=g)}return p}})(U0)),U0}var Ah={},F3;function qS(){if(F3)return Ah;F3=1;const e=Qp(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Ah.getBlocksCount=function(l,h){switch(h){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},Ah.getTotalCodewordsCount=function(l,h){switch(h){case e.L:return s[(l-1)*4+0];case e.M:return s[(l-1)*4+1];case e.Q:return s[(l-1)*4+2];case e.H:return s[(l-1)*4+3];default:return}},Ah}var P0={},oo={},K3;function VT(){if(K3)return oo;K3=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let l=0;l<255;l++)e[l]=r,t[r]=l,r<<=1,r&256&&(r^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),oo.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},oo.exp=function(r){return e[r]},oo.mul=function(r,l){return r===0||l===0?0:e[t[r]+t[l]]},oo}var Y3;function $T(){return Y3||(Y3=1,(function(e){const t=VT();e.mul=function(r,l){const h=new Uint8Array(r.length+l.length-1);for(let u=0;u<r.length;u++)for(let p=0;p<l.length;p++)h[u+p]^=t.mul(r[u],l[p]);return h},e.mod=function(r,l){let h=new Uint8Array(r);for(;h.length-l.length>=0;){const u=h[0];for(let m=0;m<l.length;m++)h[m]^=t.mul(l[m],u);let p=0;for(;p<h.length&&h[p]===0;)p++;h=h.slice(p)}return h},e.generateECPolynomial=function(r){let l=new Uint8Array([1]);for(let h=0;h<r;h++)l=e.mul(l,new Uint8Array([1,t.exp(h)]));return l}})(P0)),P0}var q0,G3;function WT(){if(G3)return q0;G3=1;const e=$T();function t(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(r.length+this.degree);l.set(r);const h=e.mod(l,this.genPoly),u=this.degree-h.length;if(u>0){const p=new Uint8Array(this.degree);return p.set(h,u),p}return h},q0=t,q0}var V0={},$0={},W0={},Z3;function VS(){return Z3||(Z3=1,W0.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),W0}var zs={},X3;function $S(){if(X3)return zs;X3=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let s="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";s=s.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
+]))+`;zs.KANJI=new RegExp(s,"g"),zs.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),zs.BYTE=new RegExp(r,"g"),zs.NUMERIC=new RegExp(e,"g"),zs.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+s+"$"),h=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return zs.testKanji=function(m){return l.test(m)},zs.testNumeric=function(m){return h.test(m)},zs.testAlphanumeric=function(m){return u.test(m)},zs}var Q3;function Wr(){return Q3||(Q3=1,(function(e){const t=VS(),s=$S();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(h,u){if(!h.ccBits)throw new Error("Invalid mode: "+h);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?h.ccBits[0]:u<27?h.ccBits[1]:h.ccBits[2]},e.getBestModeForData=function(h){return s.testNumeric(h)?e.NUMERIC:s.testAlphanumeric(h)?e.ALPHANUMERIC:s.testKanji(h)?e.KANJI:e.BYTE},e.toString=function(h){if(h&&h.id)return h.id;throw new Error("Invalid mode")},e.isValid=function(h){return h&&h.bit&&h.ccBits};function r(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(h,u){if(e.isValid(h))return h;try{return r(h)}catch{return u}}})($0)),$0}var J3;function FT(){return J3||(J3=1,(function(e){const t=$r(),s=qS(),r=Qp(),l=Wr(),h=VS(),u=7973,p=t.getBCHDigit(u);function m(x,S,w){for(let C=1;C<=40;C++)if(S<=e.getCapacity(C,w,x))return C}function g(x,S){return l.getCharCountIndicator(x,S)+4}function y(x,S){let w=0;return x.forEach(function(C){const j=g(C.mode,S);w+=j+C.getBitsLength()}),w}function v(x,S){for(let w=1;w<=40;w++)if(y(x,w)<=e.getCapacity(w,S,l.MIXED))return w}e.from=function(S,w){return h.isValid(S)?parseInt(S,10):w},e.getCapacity=function(S,w,C){if(!h.isValid(S))throw new Error("Invalid QR Code version");typeof C>"u"&&(C=l.BYTE);const j=t.getSymbolTotalCodewords(S),E=s.getTotalCodewordsCount(S,w),A=(j-E)*8;if(C===l.MIXED)return A;const N=A-g(C,S);switch(C){case l.NUMERIC:return Math.floor(N/10*3);case l.ALPHANUMERIC:return Math.floor(N/11*2);case l.KANJI:return Math.floor(N/13);case l.BYTE:default:return Math.floor(N/8)}},e.getBestVersionForData=function(S,w){let C;const j=r.from(w,r.M);if(Array.isArray(S)){if(S.length>1)return v(S,j);if(S.length===0)return 1;C=S[0]}else C=S;return m(C.mode,C.getLength(),j)},e.getEncodedBits=function(S){if(!h.isValid(S)||S<7)throw new Error("Invalid QR Code version");let w=S<<12;for(;t.getBCHDigit(w)-p>=0;)w^=u<<t.getBCHDigit(w)-p;return S<<12|w}})(V0)),V0}var F0={},ex;function KT(){if(ex)return F0;ex=1;const e=$r(),t=1335,s=21522,r=e.getBCHDigit(t);return F0.getEncodedBits=function(h,u){const p=h.bit<<3|u;let m=p<<10;for(;e.getBCHDigit(m)-r>=0;)m^=t<<e.getBCHDigit(m)-r;return(p<<10|m)^s},F0}var K0={},Y0,tx;function YT(){if(tx)return Y0;tx=1;const e=Wr();function t(s){this.mode=e.NUMERIC,this.data=s.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let l,h,u;for(l=0;l+3<=this.data.length;l+=3)h=this.data.substr(l,3),u=parseInt(h,10),r.put(u,10);const p=this.data.length-l;p>0&&(h=this.data.substr(l),u=parseInt(h,10),r.put(u,p*3+1))},Y0=t,Y0}var G0,ix;function GT(){if(ix)return G0;ix=1;const e=Wr(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(r){this.mode=e.ALPHANUMERIC,this.data=r}return s.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(l){let h;for(h=0;h+2<=this.data.length;h+=2){let u=t.indexOf(this.data[h])*45;u+=t.indexOf(this.data[h+1]),l.put(u,11)}this.data.length%2&&l.put(t.indexOf(this.data[h]),6)},G0=s,G0}var Z0,sx;function ZT(){if(sx)return Z0;sx=1;const e=Wr();function t(s){this.mode=e.BYTE,typeof s=="string"?this.data=new TextEncoder().encode(s):this.data=new Uint8Array(s)}return t.getBitsLength=function(r){return r*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(s){for(let r=0,l=this.data.length;r<l;r++)s.put(this.data[r],8)},Z0=t,Z0}var X0,nx;function XT(){if(nx)return X0;nx=1;const e=Wr(),t=$r();function s(r){this.mode=e.KANJI,this.data=r}return s.getBitsLength=function(l){return l*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(r){let l;for(l=0;l<this.data.length;l++){let h=t.toSJIS(this.data[l]);if(h>=33088&&h<=40956)h-=33088;else if(h>=57408&&h<=60351)h-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`
+Make sure your charset is UTF-8`);h=(h>>>8&255)*192+(h&255),r.put(h,13)}},X0=s,X0}var Q0={exports:{}},rx;function QT(){return rx||(rx=1,(function(e){var t={single_source_shortest_paths:function(s,r,l){var h={},u={};u[r]=0;var p=t.PriorityQueue.make();p.push(r,0);for(var m,g,y,v,x,S,w,C,j;!p.empty();){m=p.pop(),g=m.value,v=m.cost,x=s[g]||{};for(y in x)x.hasOwnProperty(y)&&(S=x[y],w=v+S,C=u[y],j=typeof u[y]>"u",(j||C>w)&&(u[y]=w,p.push(y,w),h[y]=g))}if(typeof l<"u"&&typeof u[l]>"u"){var E=["Could not find a path from ",r," to ",l,"."].join("");throw new Error(E)}return h},extract_shortest_path_from_predecessor_list:function(s,r){for(var l=[],h=r;h;)l.push(h),s[h],h=s[h];return l.reverse(),l},find_path:function(s,r,l){var h=t.single_source_shortest_paths(s,r,l);return t.extract_shortest_path_from_predecessor_list(h,l)},PriorityQueue:{make:function(s){var r=t.PriorityQueue,l={},h;s=s||{};for(h in r)r.hasOwnProperty(h)&&(l[h]=r[h]);return l.queue=[],l.sorter=s.sorter||r.default_sorter,l},default_sorter:function(s,r){return s.cost-r.cost},push:function(s,r){var l={value:s,cost:r};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Q0)),Q0.exports}var ax;function JT(){return ax||(ax=1,(function(e){const t=Wr(),s=YT(),r=GT(),l=ZT(),h=XT(),u=$S(),p=$r(),m=QT();function g(E){return unescape(encodeURIComponent(E)).length}function y(E,A,N){const L=[];let q;for(;(q=E.exec(N))!==null;)L.push({data:q[0],index:q.index,mode:A,length:q[0].length});return L}function v(E){const A=y(u.NUMERIC,t.NUMERIC,E),N=y(u.ALPHANUMERIC,t.ALPHANUMERIC,E);let L,q;return p.isKanjiModeEnabled()?(L=y(u.BYTE,t.BYTE,E),q=y(u.KANJI,t.KANJI,E)):(L=y(u.BYTE_KANJI,t.BYTE,E),q=[]),A.concat(N,L,q).sort(function(I,U){return I.index-U.index}).map(function(I){return{data:I.data,mode:I.mode,length:I.length}})}function x(E,A){switch(A){case t.NUMERIC:return s.getBitsLength(E);case t.ALPHANUMERIC:return r.getBitsLength(E);case t.KANJI:return h.getBitsLength(E);case t.BYTE:return l.getBitsLength(E)}}function S(E){return E.reduce(function(A,N){const L=A.length-1>=0?A[A.length-1]:null;return L&&L.mode===N.mode?(A[A.length-1].data+=N.data,A):(A.push(N),A)},[])}function w(E){const A=[];for(let N=0;N<E.length;N++){const L=E[N];switch(L.mode){case t.NUMERIC:A.push([L,{data:L.data,mode:t.ALPHANUMERIC,length:L.length},{data:L.data,mode:t.BYTE,length:L.length}]);break;case t.ALPHANUMERIC:A.push([L,{data:L.data,mode:t.BYTE,length:L.length}]);break;case t.KANJI:A.push([L,{data:L.data,mode:t.BYTE,length:g(L.data)}]);break;case t.BYTE:A.push([{data:L.data,mode:t.BYTE,length:g(L.data)}])}}return A}function C(E,A){const N={},L={start:{}};let q=["start"];for(let B=0;B<E.length;B++){const I=E[B],U=[];for(let P=0;P<I.length;P++){const F=I[P],$=""+B+P;U.push($),N[$]={node:F,lastCount:0},L[$]={};for(let z=0;z<q.length;z++){const O=q[z];N[O]&&N[O].node.mode===F.mode?(L[O][$]=x(N[O].lastCount+F.length,F.mode)-x(N[O].lastCount,F.mode),N[O].lastCount+=F.length):(N[O]&&(N[O].lastCount=F.length),L[O][$]=x(F.length,F.mode)+4+t.getCharCountIndicator(F.mode,A))}}q=U}for(let B=0;B<q.length;B++)L[q[B]].end=0;return{map:L,table:N}}function j(E,A){let N;const L=t.getBestModeForData(E);if(N=t.from(A,L),N!==t.BYTE&&N.bit<L.bit)throw new Error('"'+E+'" cannot be encoded with mode '+t.toString(N)+`.
+ Suggested mode is: `+t.toString(L));switch(N===t.KANJI&&!p.isKanjiModeEnabled()&&(N=t.BYTE),N){case t.NUMERIC:return new s(E);case t.ALPHANUMERIC:return new r(E);case t.KANJI:return new h(E);case t.BYTE:return new l(E)}}e.fromArray=function(A){return A.reduce(function(N,L){return typeof L=="string"?N.push(j(L,null)):L.data&&N.push(j(L.data,L.mode)),N},[])},e.fromString=function(A,N){const L=v(A,p.isKanjiModeEnabled()),q=w(L),B=C(q,N),I=m.find_path(B.map,"start","end"),U=[];for(let P=1;P<I.length-1;P++)U.push(B.table[I[P]].node);return e.fromArray(S(U))},e.rawSplit=function(A){return e.fromArray(v(A,p.isKanjiModeEnabled()))}})(K0)),K0}var lx;function eN(){if(lx)return L0;lx=1;const e=$r(),t=Qp(),s=HT(),r=IT(),l=UT(),h=PT(),u=qT(),p=qS(),m=WT(),g=FT(),y=KT(),v=Wr(),x=JT();function S(B,I){const U=B.size,P=h.getPositions(I);for(let F=0;F<P.length;F++){const $=P[F][0],z=P[F][1];for(let O=-1;O<=7;O++)if(!($+O<=-1||U<=$+O))for(let M=-1;M<=7;M++)z+M<=-1||U<=z+M||(O>=0&&O<=6&&(M===0||M===6)||M>=0&&M<=6&&(O===0||O===6)||O>=2&&O<=4&&M>=2&&M<=4?B.set($+O,z+M,!0,!0):B.set($+O,z+M,!1,!0))}}function w(B){const I=B.size;for(let U=8;U<I-8;U++){const P=U%2===0;B.set(U,6,P,!0),B.set(6,U,P,!0)}}function C(B,I){const U=l.getPositions(I);for(let P=0;P<U.length;P++){const F=U[P][0],$=U[P][1];for(let z=-2;z<=2;z++)for(let O=-2;O<=2;O++)z===-2||z===2||O===-2||O===2||z===0&&O===0?B.set(F+z,$+O,!0,!0):B.set(F+z,$+O,!1,!0)}}function j(B,I){const U=B.size,P=g.getEncodedBits(I);let F,$,z;for(let O=0;O<18;O++)F=Math.floor(O/3),$=O%3+U-8-3,z=(P>>O&1)===1,B.set(F,$,z,!0),B.set($,F,z,!0)}function E(B,I,U){const P=B.size,F=y.getEncodedBits(I,U);let $,z;for($=0;$<15;$++)z=(F>>$&1)===1,$<6?B.set($,8,z,!0):$<8?B.set($+1,8,z,!0):B.set(P-15+$,8,z,!0),$<8?B.set(8,P-$-1,z,!0):$<9?B.set(8,15-$-1+1,z,!0):B.set(8,15-$-1,z,!0);B.set(P-8,8,1,!0)}function A(B,I){const U=B.size;let P=-1,F=U-1,$=7,z=0;for(let O=U-1;O>0;O-=2)for(O===6&&O--;;){for(let M=0;M<2;M++)if(!B.isReserved(F,O-M)){let X=!1;z<I.length&&(X=(I[z]>>>$&1)===1),B.set(F,O-M,X),$--,$===-1&&(z++,$=7)}if(F+=P,F<0||U<=F){F-=P,P=-P;break}}}function N(B,I,U){const P=new s;U.forEach(function(M){P.put(M.mode.bit,4),P.put(M.getLength(),v.getCharCountIndicator(M.mode,B)),M.write(P)});const F=e.getSymbolTotalCodewords(B),$=p.getTotalCodewordsCount(B,I),z=(F-$)*8;for(P.getLengthInBits()+4<=z&&P.put(0,4);P.getLengthInBits()%8!==0;)P.putBit(0);const O=(z-P.getLengthInBits())/8;for(let M=0;M<O;M++)P.put(M%2?17:236,8);return L(P,B,I)}function L(B,I,U){const P=e.getSymbolTotalCodewords(I),F=p.getTotalCodewordsCount(I,U),$=P-F,z=p.getBlocksCount(I,U),O=P%z,M=z-O,X=Math.floor(P/z),V=Math.floor($/z),ie=V+1,ee=X-V,ce=new m(ee);let Y=0;const oe=new Array(z),xe=new Array(z);let we=0;const D=new Uint8Array(B.buffer);for(let pe=0;pe<z;pe++){const Ee=pe<M?V:ie;oe[pe]=D.slice(Y,Y+Ee),xe[pe]=ce.encode(oe[pe]),Y+=Ee,we=Math.max(we,Ee)}const J=new Uint8Array(P);let le=0,he,je;for(he=0;he<we;he++)for(je=0;je<z;je++)he<oe[je].length&&(J[le++]=oe[je][he]);for(he=0;he<ee;he++)for(je=0;je<z;je++)J[le++]=xe[je][he];return J}function q(B,I,U,P){let F;if(Array.isArray(B))F=x.fromArray(B);else if(typeof B=="string"){let X=I;if(!X){const V=x.rawSplit(B);X=g.getBestVersionForData(V,U)}F=x.fromString(B,X||40)}else throw new Error("Invalid data");const $=g.getBestVersionForData(F,U);if(!$)throw new Error("The amount of data is too big to be stored in a QR Code");if(!I)I=$;else if(I<$)throw new Error(`
+The chosen QR Code version cannot contain this amount of data.
+Minimum version required to store current data is: `+$+`.
+`);const z=N(I,U,F),O=e.getSymbolSize(I),M=new r(O);return S(M,I),w(M),C(M,I),E(M,U,0),I>=7&&j(M,I),A(M,z),isNaN(P)&&(P=u.getBestMask(M,E.bind(null,M,U))),u.applyMask(P,M),E(M,U,P),{modules:M,version:I,errorCorrectionLevel:U,maskPattern:P,segments:F}}return L0.create=function(I,U){if(typeof I>"u"||I==="")throw new Error("No input text");let P=t.M,F,$;return typeof U<"u"&&(P=t.from(U.errorCorrectionLevel,t.M),F=g.from(U.version),$=u.from(U.maskPattern),U.toSJISFunc&&e.setToSJISFunction(U.toSJISFunc)),q(I,F,P,$)},L0}var J0={},e2={},ox;function WS(){return ox||(ox=1,(function(e){function t(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let r=s.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+s);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(h){return[h,h]}))),r.length===6&&r.push("F","F");const l=parseInt(r.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const l=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,h=r.width&&r.width>=21?r.width:void 0,u=r.scale||4;return{width:h,scale:h?4:u,margin:l,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,l){return l.width&&l.width>=r+l.margin*2?l.width/(r+l.margin*2):l.scale},e.getImageWidth=function(r,l){const h=e.getScale(r,l);return Math.floor((r+l.margin*2)*h)},e.qrToImageData=function(r,l,h){const u=l.modules.size,p=l.modules.data,m=e.getScale(u,h),g=Math.floor((u+h.margin*2)*m),y=h.margin*m,v=[h.color.light,h.color.dark];for(let x=0;x<g;x++)for(let S=0;S<g;S++){let w=(x*g+S)*4,C=h.color.light;if(x>=y&&S>=y&&x<g-y&&S<g-y){const j=Math.floor((x-y)/m),E=Math.floor((S-y)/m);C=v[p[j*u+E]?1:0]}r[w++]=C.r,r[w++]=C.g,r[w++]=C.b,r[w]=C.a}}})(e2)),e2}var cx;function tN(){return cx||(cx=1,(function(e){const t=WS();function s(l,h,u){l.clearRect(0,0,h.width,h.height),h.style||(h.style={}),h.height=u,h.width=u,h.style.height=u+"px",h.style.width=u+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(h,u,p){let m=p,g=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(g=r()),m=t.getOptions(m);const y=t.getImageWidth(h.modules.size,m),v=g.getContext("2d"),x=v.createImageData(y,y);return t.qrToImageData(x.data,h,m),s(v,g,y),v.putImageData(x,0,0),g},e.renderToDataURL=function(h,u,p){let m=p;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const g=e.render(h,u,m),y=m.type||"image/png",v=m.rendererOpts||{};return g.toDataURL(y,v.quality)}})(J0)),J0}var t2={},hx;function iN(){if(hx)return t2;hx=1;const e=WS();function t(l,h){const u=l.a/255,p=h+'="'+l.hex+'"';return u<1?p+" "+h+'-opacity="'+u.toFixed(2).slice(1)+'"':p}function s(l,h,u){let p=l+h;return typeof u<"u"&&(p+=" "+u),p}function r(l,h,u){let p="",m=0,g=!1,y=0;for(let v=0;v<l.length;v++){const x=Math.floor(v%h),S=Math.floor(v/h);!x&&!g&&(g=!0),l[v]?(y++,v>0&&x>0&&l[v-1]||(p+=g?s("M",x+u,.5+S+u):s("m",m,0),m=0,g=!1),x+1<h&&l[v+1]||(p+=s("h",y),y=0)):m++}return p}return t2.render=function(h,u,p){const m=e.getOptions(u),g=h.modules.size,y=h.modules.data,v=g+m.margin*2,x=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+v+"v"+v+'H0z"/>':"",S="<path "+t(m.color.dark,"stroke")+' d="'+r(y,g,m.margin)+'"/>',w='viewBox="0 0 '+v+" "+v+'"',j='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+w+' shape-rendering="crispEdges">'+x+S+`</svg>
+`;return typeof p=="function"&&p(null,j),j},t2}var ux;function sN(){if(ux)return Pa;ux=1;const e=zT(),t=eN(),s=tN(),r=iN();function l(h,u,p,m,g){const y=[].slice.call(arguments,1),v=y.length,x=typeof y[v-1]=="function";if(!x&&!e())throw new Error("Callback required as last argument");if(x){if(v<2)throw new Error("Too few arguments provided");v===2?(g=p,p=u,u=m=void 0):v===3&&(u.getContext&&typeof g>"u"?(g=m,m=void 0):(g=m,m=p,p=u,u=void 0))}else{if(v<1)throw new Error("Too few arguments provided");return v===1?(p=u,u=m=void 0):v===2&&!u.getContext&&(m=p,p=u,u=void 0),new Promise(function(S,w){try{const C=t.create(p,m);S(h(C,u,m))}catch(C){w(C)}})}try{const S=t.create(p,m);g(null,h(S,u,m))}catch(S){g(S)}}return Pa.create=t.create,Pa.toCanvas=l.bind(null,s.render),Pa.toDataURL=l.bind(null,s.renderToDataURL),Pa.toString=l.bind(null,function(h,u,p){return r.render(h,p)}),Pa}var nN=sN();const FS=y6(nN),dx="brew install leepokai/codync/codync-host && codync-host install",rN=(e=19222)=>({id:crypto.randomUUID(),host:"",port:null,user:null,identityFile:null,remotePort:e,computerId:null,name:""});function KS({profile:e,status:t,edit:s,attached:r=!0}){const l=window.codync.ssh,h=window.codync.appScheme==="codync-dev",u=`${e.user?`${e.user}@`:""}${e.host}${e.port!==null?`:${e.port}`:""}`,p=(()=>{switch(t.kind){case"idle":return`${u} · Not connected`;case"connecting":return t.step;case"confirmHostKey":return`${u} · Confirm the host key`;case"connected":return`${u} · ${Ax(t,r)}`;case"retrying":return`${t.message} Retrying…`;case"failed":return t.message;case"notInstalled":return h?`Install Codync Dev on ${e.host} and open it once. On Linux, install the development host as ~/.local/bin/codync-dev-host.`:`codync-host isn't installed on ${e.host}. Install it there:`}})(),m=t.kind==="retrying"||t.kind==="failed"||t.kind==="notInstalled",g=t.kind==="connected"||t.kind==="connecting"||t.kind==="retrying";return o.jsxs("div",{className:"settings-card settings-appear",children:[o.jsxs("div",{className:"settings-row",children:[o.jsx("span",{style:{width:22,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:o.jsx(se,{name:"terminal",size:13})}),o.jsxs("div",{className:"settings-stack",style:{flex:1},children:[o.jsx("span",{style:R("callout","medium"),children:e.name||e.host}),o.jsx("span",{style:{...R("caption"),color:m?"var(--warning)":"var(--secondary)"},children:p})]}),g?o.jsx(be,{title:"Disconnect",icon:"stop.circle",onClick:()=>l.disconnect(e.id)}):o.jsx(be,{title:"Connect",icon:"arrow.clockwise",onClick:()=>l.connect(e.id)}),o.jsx(be,{title:"Edit",icon:"pencil",onClick:s}),o.jsx(be,{title:"Remove",icon:"trash",onClick:()=>l.remove(e.id)})]}),o.jsx(Za,{show:t.kind==="confirmHostKey",children:t.kind==="confirmHostKey"?o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[o.jsxs("span",{style:{...R("caption"),color:"var(--secondary)"},children:["First connection to ",t.name,". Check that its host key fingerprint matches what the computer's owner sees (",o.jsx("code",{style:{fontFamily:"var(--mono)"},children:"ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub"}),")."]}),t.fingerprints.map(y=>o.jsx("span",{className:"selectable",style:R("caption",void 0,"monospaced"),children:y},y)),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx(Ne,{onClick:()=>l.trustHostKey(e.id),children:"Trust and connect"}),o.jsx(Ne,{kind:"secondary",onClick:()=>l.disconnect(e.id),children:"Cancel"})]})]}):null}),o.jsx(Za,{show:t.kind==="notInstalled"&&!h,children:o.jsxs("div",{className:"settings-row",style:{gap:6},children:[o.jsx("span",{className:"settings-code selectable",children:dx}),o.jsx(be,{title:"Copy install command",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(dx)})]})})]})}function aN(){const e=si(),t=Ja(),s=Ro(),r=di(e.cloud),[l,h]=b.useState(null),u=e.managedStores,p=new Set(u.map(y=>y.computer.id)),m=e.computers.filter(y=>!p.has(y.id)),g=r.computers.filter(y=>!p.has(y.computerId)&&!m.some(v=>v.id===y.computerId));return o.jsxs("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:26,padding:"14px 14px 20px"},children:[u.map(y=>o.jsx(cN,{store:y,ssh:s.isSSH(y.computer.id)},y.computer.id)),o.jsxs("div",{children:[o.jsx(B_,{title:"Over SSH",children:o.jsx(be,{title:"Add SSH computer",icon:"plus",onClick:()=>h({profile:rN(window.codync.hostPort),isNew:!0})})}),o.jsx(Za,{show:s.state.profiles.length===0,children:o.jsxs("div",{style:{...R("callout"),color:"var(--secondary)"},children:["Run bots on another computer you reach with SSH. It needs codync-host installed; your SSH keys stay on ",So,"."]})}),s.state.profiles.map(y=>o.jsx(KS,{profile:y,status:s.status(y.id),edit:()=>h({profile:y,isNew:!1})},y.id))]}),o.jsxs("div",{children:[o.jsx(B_,{title:"In your account",children:t.isSignedIn?o.jsx(be,{title:"Refresh",icon:"arrow.clockwise",onClick:()=>{r.refresh()}}):null}),t.isSignedIn?m.length===0&&g.length===0?o.jsx("div",{style:{...R("callout"),color:"var(--secondary)"},children:"No other computers in your account yet."}):null:o.jsxs("div",{style:{...R("callout"),color:"var(--secondary)"},children:["Sign in to reach the other computers in your account from ",So,"."]}),m.map(y=>{const v=e.store(y.id);if(!v)return null;const x=r.computers.find(w=>w.computerId===y.id),S=!!x&&r.isOlderCopy(x)&&v.connection.kind!=="unauthorized";return o.jsx("div",{className:"settings-card settings-appear",children:o.jsxs("div",{className:"settings-row",children:[o.jsx(Lr,{computer:v.computer,size:22}),o.jsxs("div",{className:"settings-stack",children:[o.jsx("span",{style:R("callout","medium"),children:v.hostName}),o.jsx("span",{style:{...R("caption"),color:S?"var(--warning)":"var(--secondary)"},children:S?`Older copy of this computer · ${M2(v)}`:M2(v)})]}),o.jsx(lN,{store:v}),o.jsx("span",{style:{flex:1}}),o.jsx(be,{title:`Remove from ${So}`,icon:"minus.circle",onClick:()=>e.detach(y.id)})]})},y.id)}),g.map(y=>o.jsx("div",{className:"settings-card settings-appear",children:o.jsxs("div",{className:"settings-row",children:[o.jsx(Lr,{computer:{id:y.computerId,name:y.name,signKey:y.signKey,urls:[],device:y.device??null},size:22}),o.jsxs("div",{className:"settings-stack",children:[o.jsx("span",{style:R("callout","medium"),children:y.name}),o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:y.online?"Online":"Offline"})]})]})},y.computerId))]})]}),o.jsx(ht,{open:l!==null,onClose:()=>h(null),width:460,children:l?o.jsx(dN,{profile:l.profile,isNew:l.isNew},l.profile.id):null})]})}function lN({store:e}){if(e.connection.kind!=="online"||!e.hostRoute||e.hostRoute==="loopback")return null;const t=e.hostRoute==="relay";return o.jsx("span",{title:t?"Through Cloudflare (encrypted)":"Direct: Wi-Fi or Tailscale","aria-label":t?"Through Cloudflare":"Wi-Fi or Tailscale",style:{display:"flex",color:"var(--tertiary)"},children:o.jsx(se,{name:t?"cloud":"wifi",size:12})})}const oN=So==="this Mac"?"This Mac":"This computer";function cN({store:e,ssh:t}){const s=si(),r=Ja();di(e);const[l,h]=b.useState(null),[u,p]=b.useState(!1),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[x,S]=b.useState(null),[w,C]=b.useState(!1),[j,E]=b.useState(!1),A=e.cloud,N=A?.approval==="auto",L=e.connection.kind==="online",q=e.hostName,B=z=>{p(!0),z().finally(()=>p(!1))},I=b.useCallback(async()=>{const z=Xh(e);if(z)try{h((await z.call("devices")).devices)}catch{}},[e]);b.useEffect(()=>{I()},[I,L,e.accessRequests.length]);const U=z=>B(async()=>{try{await(await e.ready()).call("setApproval",{approval:z})}catch(O){e.setError(Or(O))}}),P=A?.enabled?A.lastError??(A.connected?"Reachable from anywhere through Cloudflare (encrypted).":"Connecting to Cloudflare…"):"Off: only Wi-Fi and Tailscale reach it, nothing goes through Cloudflare.",F=A?.owner??null,$=o.jsxs("div",{className:"settings-row",style:{gap:8},children:[o.jsx(se,{name:F?"person.crop.circle.badge.checkmark":"person.crop.circle.badge.plus",size:13,color:"var(--secondary)"}),o.jsx("span",{style:{...R("callout"),flex:1},children:F?F.userId===r.user?.userId?"In your account":`In ${F.email??"another"} account`:r.isSignedIn?"Not in your account":"Sign in to add it to your account"}),F?o.jsx(Ne,{kind:"secondary",onClick:()=>C(!0),disabled:u||!L,children:"Remove from account"}):r.isSignedIn?o.jsx(Ne,{kind:"secondary",onClick:()=>B(async()=>{await s.cloud.claim(e)}),disabled:u||!L,children:u?"Adding…":"Add to account"}):null]});return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28},children:[o.jsx(ke,{children:[o.jsxs("div",{className:"settings-row",children:[o.jsx(Lr,{computer:e.computer,size:26}),o.jsxs("div",{className:"settings-stack",style:{flex:1},children:[o.jsx("span",{style:R("headline"),children:q}),o.jsxs("span",{style:{...R("caption"),color:"var(--secondary)"},children:[t?"Over SSH":oN," · ",M2(e)]})]}),t?o.jsx(be,{title:"Voice chat",icon:"waveform",selected:y,disabled:!L,onClick:()=>v(z=>!z)}):null,o.jsx(be,{title:"Pair iPhone",icon:"qrcode",selected:m,disabled:!L,onClick:()=>g(z=>!z)})]},"header"),o.jsx(ys,{on:A?.enabled??!1,disabled:u||!L,onChange:z=>B(()=>s.cloud.setCloud(e,z)),children:o.jsxs("span",{className:"settings-stack",children:[o.jsx("span",{children:"Reach from anywhere"}),o.jsx("span",{style:{...R("caption"),color:A?.lastError?"var(--warning)":"var(--secondary)"},children:P})]})},"cloud"),$,...F?[o.jsx(ys,{on:N,disabled:u||!L,onChange:z=>z?E(!0):U("code"),children:o.jsxs("span",{className:"settings-stack settings-appear",children:[o.jsx("span",{children:"Skip the 6-digit check"}),o.jsx("span",{style:{...R("caption"),color:N?"var(--warning)":"var(--secondary)"},children:N?"Devices on your account get in on their own.":"Each new device shows a code you approve here."})]})},"approval")]:[]]}),o.jsx(ke,{title:`Devices that can use ${q}`,children:l===null?[o.jsx($e,{},"loading")]:[...l.length===0?[o.jsx("span",{style:{color:"var(--secondary)"},children:"None yet. Pair an iPhone, or approve one from your account."},"none")]:[],...l.map(z=>o.jsxs("div",{className:"settings-row settings-appear",style:{gap:8},children:[o.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:o.jsx(se,{name:Ww(z.platform),size:13})}),o.jsxs("div",{className:"settings-stack",style:{flex:1},children:[o.jsx("span",{children:z.name}),o.jsx("span",{style:{...R("caption"),color:"var(--tertiary)"},children:hN(z)})]}),o.jsx(be,{title:"Revoke access",icon:"xmark.circle",onClick:()=>S(z)})]},z.key))]}),o.jsx(ht,{open:y,onClose:()=>v(!1),children:o.jsx(hn.Provider,{value:e,children:o.jsx(Pp,{})})}),o.jsxs(ht,{open:m,onClose:()=>g(!1),width:340,children:[o.jsx(ut,{title:`Pair iPhone with ${q}`}),o.jsx(uN,{store:e})]}),o.jsx(cs,{open:x!==null,title:`Revoke ${x?.name??"device"}?`,message:"It disconnects right away and has to pair or ask again.",actions:x?[{title:"Revoke access",destructive:!0,action:()=>B(async()=>{try{await(await e.ready()).call("revokeDevice",{key:x.key})}catch(z){e.setError(Or(z))}await I()})}]:[],onClose:()=>S(null)}),o.jsx(cs,{open:j,title:"Let account devices in without a code?",message:`Any device signed in to your account gets full control of ${q}: its files, terminals and bots, with no check here. If someone gets into your account, or Codync's cloud is ever compromised, they could add their own device and you'd have no chance to stop it. Devices paired with a QR code aren't affected.`,actions:[{title:"Skip the check",destructive:!0,action:()=>U("auto")}],onClose:()=>E(!1)}),o.jsx(cs,{open:w,title:`Remove ${q} from the account?`,message:"Devices that were approved through the account lose access. Devices paired with a QR code keep it.",actions:[{title:"Remove from account",destructive:!0,action:()=>B(()=>s.cloud.unclaim(e))}],onClose:()=>C(!1)})]})}function hN(e){const t=[e.source==="account"?"Approved through the account":"Paired with a QR code"];return e.connected?t.push("connected"):e.lastSeenAt&&t.push(`seen ${Fw(new Date(e.lastSeenAt))}`),t.join(" · ")}function uN({store:e}){di(e);const[t,s]=b.useState(null),[r,l]=b.useState(null),[h,u]=b.useState(null),p=e.hostName,m=b.useCallback(async()=>{const y=Xh(e);if(!y)return u(`${e.hostName} isn't connected.`);try{const v=await y.call("pairing");l(await FS.toDataURL(v.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),s(v),u(null)}catch(v){u(Or(v))}},[e]);b.useEffect(()=>{m()},[m]),b.useEffect(()=>{if(!t?.expiresAt)return;const y=setTimeout(()=>{m()},Math.max(1e3,t.expiresAt-Date.now()));return()=>clearTimeout(y)},[t?.expiresAt,m]);const g={...R("caption"),textAlign:"center"};return o.jsx("div",{style:{padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:t&&r?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"settings-appear",style:{padding:10,background:"#fff",borderRadius:12},children:o.jsx("img",{src:r,alt:`Pairing code for ${p}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),o.jsx("div",{style:{...g,color:"var(--secondary)"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),e.cloud?.enabled!==!0?o.jsx("div",{style:{...g,color:"var(--warning)"},children:t.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${p} on the same network.`}):null,o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.expiresAt?o.jsxs("span",{style:{...R("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(t.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,o.jsx(be,{title:"New code",icon:"arrow.clockwise",onClick:()=>{m()}}),o.jsx(be,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(t.pairingUrl)})]})]}):h?o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{...g,color:"var(--danger)"},children:h}),o.jsx(be,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{m()}})]}):o.jsx($e,{size:20})})}function dN({profile:e,isNew:t}){const s=Ki(),[r,l]=b.useState(e),[h,u]=b.useState(e.port?.toString()??""),[p,m]=b.useState(String(e.remotePort)),[g,y]=b.useState(e.user??""),[v,x]=b.useState(null),S=window.codync.ssh,w=async()=>{const j=B=>/^-?\d+$/.test(B),E=h.trim();if(E&&!j(E))return x("The SSH port must be a number.");const A=p.trim();if(!j(A))return x("The Codync port must be a number.");const N=g.trim(),L={...r,host:r.host.trim(),name:r.name.trim(),user:N||null,port:E?Number(E):null,remotePort:Number(A)},q=await S.save(L);if(q)return x(q);s()},C=(j,E,A,N)=>o.jsxs("div",{className:"settings-row",style:{gap:12},children:[o.jsx("span",{style:{color:"var(--text)"},children:j}),o.jsx("input",{className:"settings-field","aria-label":j,placeholder:N,value:E,spellCheck:!1,onChange:L=>A(L.target.value)})]});return o.jsxs("div",{style:{width:460,display:"flex",flexDirection:"column"},onKeyDown:j=>j.key==="Enter"&&j.target instanceof HTMLInputElement&&void w(),children:[o.jsx(ut,{title:t?"Add SSH computer":"Edit SSH computer",trailing:o.jsx(be,{title:t?"Add":"Save",icon:"checkmark",onClick:()=>{w()}})}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"4px 20px 20px"},children:[o.jsxs(ke,{children:[C("Name",r.name,j=>l({...r,name:j}),"Optional"),C("Host",r.host,j=>l({...r,host:j}),"SSH alias or hostname"),C("User",g,y,"From SSH config"),C("SSH port",h,u,"From SSH config"),o.jsxs("div",{className:"settings-row",children:[o.jsx("span",{children:"Key"}),o.jsx("span",{style:{flex:1}}),o.jsx("span",{style:{color:"var(--secondary)"},children:r.identityFile?.split("/").pop()??"ssh-agent / SSH config"}),o.jsx(be,{title:"Choose key file",icon:"key",onClick:()=>{S.chooseKey().then(j=>j&&l(E=>({...E,identityFile:j})))}}),r.identityFile?o.jsx("span",{className:"settings-appear",style:{display:"flex"},children:o.jsx(be,{title:"Use ssh-agent",icon:"xmark.circle",onClick:()=>l({...r,identityFile:null})})}):null]}),C("Codync port",p,m,"")]}),o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:"Codync opens an SSH tunnel to codync-host on that computer's loopback. It uses your SSH config and ssh-agent; agent forwarding stays off."}),o.jsx(Za,{show:v!==null,children:o.jsx("span",{style:{...R("caption"),color:"var(--danger)"},children:v})})]})]})}function YS(e){return e==="claude"?"#D97757":To()?"#FFFFFF":"#000000"}const gu=e=>e==="claude"?"#D97757":"var(--accent)",GS=e=>["claude","codex"].includes(e)?`${e}-acp`:e,ZS=e=>e==="codex"?"hex":"blob",Jp=e=>e.windows.reduce((t,s)=>!t||s.percent>t.percent?s:t,null);function Ao(e){return e.label==="5-hour"?"Session":e.label.split(" · ")[1]??e.label}const fN=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function pN(e,t=new Date){const s=/^(?:(\w{3}) (\d{1,2}) at )?(\d{1,2})(?::(\d{2}))?(am|pm)(?: \(([^)]+)\))?$/.exec(e);if(!s)return null;const r=s[6],l=mN(t,r);let h=l.month,u=l.day;if(s[1]){const v=fN.indexOf(s[1]);if(v<0)return null;h=v+1,u=Number(s[2])}const p=Number(s[3])%12+(s[5]==="pm"?12:0),m=s[4]?Number(s[4]):0,g=(v,x,S)=>gN(v,x,S,p,m,r);let y=g(l.year,h,u);return(y.getTime()<t.getTime()-864e5||!s[1]&&y<t)&&(y=s[1]?g(l.year+1,h,u):new Date(y.getTime()+864e5)),y}function mN(e,t){try{const s=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric"}),r=Object.fromEntries(s.formatToParts(e).map(l=>[l.type,l.value]));return{year:Number(r.year),month:Number(r.month),day:Number(r.day)}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}}function gN(e,t,s,r,l,h){const u=Date.UTC(e,t-1,s,r,l);try{const p=new Intl.DateTimeFormat("en-US",{timeZone:h,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}),m=Object.fromEntries(p.formatToParts(new Date(u)).map(y=>[y.type,y.value])),g=Date.UTC(Number(m.year),Number(m.month)-1,Number(m.day),Number(m.hour),Number(m.minute));return new Date(u-(g-u))}catch{return new Date(e,t-1,s,r,l)}}function XS(e){return e.resetsAt?new Date(e.resetsAt):e.resetsText?pN(e.resetsText):null}function QS(e,t=new Date){const s=Math.max(0,(e.getTime()-t.getTime())/1e3),r=Math.floor(s/3600),l=Math.floor(s%3600/60);return r>=48?`${Math.floor(r/24)}d`:r>0?`${r}h ${l}m`:`${l}m`}function e1(e){const t=XS(e);return t?`resets in ${QS(t)}`:e.resetsText?`resets ${e.resetsText.replace(/ \(.*\)$/,"")}`:null}function vN({provider:e,size:t,style:s="character"}){const r=(Jp(e)?.percent??0)>=90;return s==="original"?o.jsx("span",{style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none"},children:o.jsx(xw,{registry:GS(e.id),size:t*.84,color:gu(e.id)})}):o.jsxs("span",{style:{position:"relative",width:t,height:t,flex:"none",display:"block"},children:[o.jsx(ci,{shape:ZS(e.id),color:"",tint:YS(e.id),size:t,mood:r?"needsInput":"idle"}),r?o.jsx("span",{style:{position:"absolute",top:-t*.12,right:-t*.12,display:"flex",color:"var(--danger)",background:"#fff",borderRadius:"50%"},children:o.jsx(se,{name:"exclamationmark.circle.fill",size:t*.34,weight:"bold",scaled:!1})}):null]})}const fx=new Map;function JS(e,t,s,r){const h=document.createElement("canvas");h.width=t*2,h.height=t*2;const u=h.getContext("2d");u.scale(2,2);const p=e.id==="claude"?"#D97757":r?"#FFFFFF":"#000000";if(s==="original"){const g=Bp(GS(e.id));if(!g)return null;const y=fx.get(g);if(!y){const x=new Image;return x.src=g,x.onload=()=>fx.set(g,x),null}const v=t*.08;return u.drawImage(y,v,v,t-v*2,t-v*2),u.globalCompositeOperation="source-in",u.fillStyle=p,u.fillRect(0,0,t,t),h.toDataURL("image/png")}const m=(Jp(e)?.percent??0)>=90;return yp(u,{shape:ZS(e.id),fill:p,size:t,mood:m?"needsInput":"idle",dark:r,t:0,still:!0}),m&&(u.beginPath(),u.arc(t*.92,t*.08,t*.17,0,Math.PI*2),u.fillStyle=r?"#F0A7A7":"#C23A2B",u.fill()),h.toDataURL("image/png")}function yN({usage:e}){const[t]=kt(nt.usageIconStyle);return o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:18},children:e.providers.map(s=>o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx(vN,{provider:s,size:18,style:t}),o.jsx("span",{style:{...R(13,"semibold"),color:"var(--text)"},children:s.name})]}),s.windows.map(r=>o.jsxs("div",{style:{...R(12),display:"flex",alignItems:"center",gap:10,whiteSpace:"nowrap"},children:[o.jsx("span",{style:{width:64,flex:"none",overflow:"hidden",textOverflow:"ellipsis",color:"var(--text)"},children:Ao(r)}),o.jsx(t1,{percent:r.percent,tint:gu(s.id)}),o.jsxs("span",{style:{width:36,flex:"none",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text)"},children:[Math.round(r.percent),"%"]}),o.jsx("span",{style:{width:130,flex:"none",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",color:"var(--secondary)"},children:e1(r)??""})]},r.id))]},s.id))})}function t1({percent:e,tint:t}){const s=e>=90?"var(--danger)":e>=70?"var(--warning)":t;return o.jsx("span",{style:{flex:1,minWidth:0,height:6,borderRadius:3,background:"var(--bubble-agent)",overflow:"hidden"},children:o.jsx("span",{style:{display:"block",height:"100%",borderRadius:3,background:s,width:`${Math.min(1,Math.max(.02,e/100))*100}%`,transition:"width var(--layout)"}})})}function _N(){const e=di(si().computerAccess);return b.useEffect(()=>{const t=()=>{e.refresh()};t();const s=window.setInterval(t,2e3);return window.addEventListener("focus",t),()=>{window.clearInterval(s),window.removeEventListener("focus",t)}},[e]),e}const xN="/demo/desktop/assets/icon-Cw_ov8Nx.png";function fp({onContinue:e}){const t=_N(),{screen:s,step:r,busy:l}=t,h=window.codync.platform==="darwin",u=window.codync.platform==="win32",p=r==="ready",m=["capture","input","portal","ready"].includes(r),g=s?.enabled===!0&&s.connected&&r!=="background",y=u?Number(p):Number(g)+(h?+(s?.capture===!0)+ +(s?.input===!0):Number(s?.capture===!0&&s.input)),v=(x,S)=>o.jsx(Ne,{kind:r===x?"primary":"secondary",disabled:!m||l!==null,onClick:()=>{t.request(x)},children:l===x?o.jsxs(o.Fragment,{children:[o.jsx($e,{})," Waiting for permission…"]}):S});return o.jsx("section",{className:`computer-access ${e?"onboarding":""}`,"aria-label":"Computer access setup",children:o.jsxs("div",{className:"computer-access-content",children:[o.jsxs("header",{className:"computer-access-header",children:[o.jsxs("div",{className:"computer-access-identity",children:[o.jsx("img",{src:xN,width:40,height:40,alt:"Codync"}),o.jsxs("div",{children:[o.jsx("span",{children:"This computer"}),o.jsx("strong",{children:window.codync.computerName||"Your computer"})]})]}),o.jsx("h1",{children:p?"Your computer is ready":"Computer access"}),o.jsx("p",{children:u?"Let a bot work in your apps. You choose which bots can use this computer.":"Work in your apps with a bot, or access your screen from your phone. You choose which bots can use this computer."})]}),r==="host"?o.jsx(i2,{title:"Waiting for your computer",icon:"desktopcomputer",children:"Start or restart the host from Codync’s menu to continue. We’ll check again automatically."}):null,r==="unavailable"?o.jsx(i2,{title:"Codync Screen is missing",icon:"desktopcomputer.trianglebadge.exclamationmark",children:"Install the full Codync desktop app to finish setup."}):null,t.error?o.jsx(i2,{title:"Couldn’t finish setup",icon:"exclamationmark.circle",error:!0,children:t.error}):null,o.jsxs("div",{className:"computer-access-section-label",children:[o.jsx("span",{children:u?"Availability":"Permissions"}),o.jsx("span",{children:p?"All set":`${y} of ${h?3:u?1:2} ready`})]}),o.jsx("div",{className:"computer-access-steps",children:u?o.jsx(co,{title:"Computer control",icon:"cursorarrow.motionlines",detail:"Bots can use apps on this computer. Remote screen viewing from your phone isn’t available on Windows yet.",done:p}):o.jsxs(o.Fragment,{children:[o.jsxs(co,{title:"Codync Screen",icon:"desktopcomputer",detail:"Runs in the background to share your screen and connect your controls.",done:g,active:["enable","helper","background"].includes(r),status:r==="background"?"Needs approval":void 0,children:[["enable","helper"].includes(r)?o.jsx(Ne,{disabled:l!==null,onClick:()=>{t.enable()},children:l==="enable"?o.jsxs(o.Fragment,{children:[o.jsx($e,{})," Starting…"]}):r==="helper"?"Start again":"Enable Codync Screen"}):null,r==="background"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"computer-access-inline-note",children:"Allow Codync to run in the background in Login Items."}),o.jsxs(Ne,{onClick:()=>t.openSettings("background"),children:["Open Login Items ",o.jsx(se,{name:"arrow.up.right.square",size:10})]})]}):null]}),h?o.jsxs(o.Fragment,{children:[o.jsxs(co,{title:"Screen recording",icon:"record.circle",detail:"Lets Codync see your screen, including anything visible in your apps.",done:s?.capture===!0,active:r==="capture",children:[m?v("capture","Allow screen recording"):null,t.requested.has("capture")?o.jsx(px,{action:()=>t.openSettings("capture")}):null]}),o.jsxs(co,{title:"Control apps",icon:"cursorarrow.motionlines",detail:"Lets Codync click, type and interact with apps on your behalf.",done:s?.input===!0,active:r==="input",children:[m?v("input","Allow computer control"):null,t.requested.has("input")?o.jsx(px,{action:()=>t.openSettings("input")}):null]})]}):o.jsx(co,{title:"Screen sharing & control",icon:"cursorarrow.motionlines",detail:"Choose a screen and allow mouse and keyboard access. You can stop sharing at any time.",done:s?.capture===!0&&s.input,active:r==="portal",children:m?v("portal","Choose screen and allow control"):null})]})}),h&&!p?o.jsxs("div",{className:"computer-access-help",children:[o.jsx(se,{name:"info.circle",size:13}),o.jsxs("p",{children:["In System Settings, look for ",o.jsx("strong",{children:t.helperName}),". Computer control may be called ",o.jsx("strong",{children:"Device Control and Data Access"})," or ",o.jsx("strong",{children:"Accessibility"}),". Return here after granting access; if asked, allow the helper to restart."]})]}):null,o.jsxs("div",{className:"computer-access-reassurance",children:[o.jsx(se,{name:"lock.shield",size:13}),o.jsxs("p",{children:["Permissions stay on this computer. ",e?"You can change them later in Settings → Computer access.":"Your other computers keep their own permissions."]})]}),o.jsxs("footer",{className:"computer-access-footer",children:[o.jsxs(Ne,{kind:"secondary",onClick:()=>{t.refresh()},children:[o.jsx(se,{name:"arrow.clockwise",size:12})," Check again"]}),e?o.jsxs(Ne,{kind:p?"primary":"secondary",onClick:()=>e(p),children:[p?"Continue":"Set up later",p?o.jsx(se,{name:"arrow.right",size:12}):null]}):null]}),o.jsx("p",{className:"computer-access-phone-note",children:"On iPhone, connect with a QR code or Ask Access. No SSH setup needed."})]})})}function co({title:e,icon:t,detail:s,done:r,active:l=!1,status:h,children:u}){return o.jsxs("div",{className:`computer-access-row ${r?"granted":l?"current":"waiting"}`,children:[o.jsx("span",{className:"computer-access-row-icon",children:o.jsx(se,{name:t,size:17})}),o.jsxs("div",{className:"computer-access-row-body",children:[o.jsxs("div",{className:"computer-access-row-heading",children:[o.jsx("h2",{children:e}),o.jsx("span",{className:"computer-access-status",children:r?o.jsxs(o.Fragment,{children:[o.jsx(se,{name:"checkmark",size:10,weight:"semibold"})," Ready"]}):h??(l?"Needs access":"Waiting")})]}),o.jsx("p",{children:s}),r?null:o.jsx("div",{className:"computer-access-actions",children:u})]})]})}function i2({title:e,icon:t,error:s=!1,children:r}){return o.jsxs("div",{className:`computer-access-notice ${s?"error":""}`,role:s?"alert":"status",children:[o.jsx(se,{name:t,size:16}),o.jsxs("div",{children:[o.jsx("strong",{children:e}),o.jsx("p",{children:r})]})]})}function px({action:e}){return o.jsxs(Ne,{kind:"secondary",onClick:e,children:["Open System Settings ",o.jsx(se,{name:"arrow.up.right.square",size:10})]})}const Ph=$w?"This Mac":"This computer",mx=[{id:"general",title:"General",group:"Personal",icon:"gearshape"},{id:"computers",title:"Computers & devices",label:"Computers",group:Ph,icon:"desktopcomputer"},{id:"access",title:"Computer access",group:Ph,icon:"hand.raised"},{id:"voice",title:"Voice chat",group:"Personal",icon:"waveform"},{id:"usage",title:"Usage",group:"Personal",icon:"gauge.with.dots.needle.33percent"},{id:"updates",title:"Updates",group:Ph,icon:"arrow.down.circle"}];function wN({page:e}){const[t,s]=b.useState(e),r=si(),l=Ki(),h=mx.find(u=>u.id===t);return o.jsxs("div",{className:"settings",children:[o.jsx("nav",{className:"settings-sidebar",children:["Personal",Ph].map(u=>o.jsxs("div",{style:{display:"contents"},children:[o.jsx("div",{className:"settings-group",style:{paddingTop:u==="Personal"?0:16},children:u}),mx.filter(p=>p.group===u).map(p=>o.jsxs("button",{className:`settings-item ${p.id===t?"selected":""}`,"aria-selected":p.id===t,onClick:()=>s(p.id),children:[o.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:o.jsx(se,{name:p.icon,size:13})}),o.jsx("span",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.label??p.title}),p.id==="computers"&&r.approvals.length>0?o.jsx("span",{style:{...R(11,"semibold"),color:"var(--secondary)"},children:r.approvals.length}):null]},p.id))]},u))}),o.jsx("div",{className:"settings-divider"}),o.jsxs("div",{className:"settings-main",children:[o.jsx("div",{style:{...R(24,"semibold"),color:"var(--text)",padding:"30px 32px 8px"},children:h.title}),o.jsx("div",{className:"settings-page",children:o.jsx(SN,{page:t})},t)]}),o.jsx("span",{className:"settings-close",children:o.jsx(be,{title:"Close",icon:"xmark",onClick:l})})]})}function SN({page:e}){const t=si();switch(e){case"access":return o.jsx(fp,{});case"general":return o.jsx(bN,{});case"computers":return o.jsx(aN,{});case"voice":return t.local?o.jsx(hn.Provider,{value:t.local,children:o.jsx(Pp,{showsHeader:!1})}):o.jsx(ui,{children:o.jsxs("span",{style:{color:"var(--secondary)"},children:["Voice keys are kept by ",So,"'s host, which isn't running."]})});case"usage":return o.jsx(ui,{children:o.jsx(kN,{})});case"updates":return o.jsx(jN,{})}}function bN(){const e=Ja(),[t,s]=kt(nt.textSize),[r,l]=kt(nt.usageIconStyle),[h,u]=kt(nt.sidebarCompact),[p,m]=b.useState(!0);b.useEffect(()=>{window.codync.app.showInDock().then(m)},[]);const[g,y]=b.useState(!1);b.useEffect(()=>{window.codync.app.launchAtLogin().then(y)},[]);const[v,x]=b.useState(!1);return b.useEffect(()=>{window.codync.island.enabled().then(x)},[]),o.jsxs(ui,{children:[o.jsx(ke,{title:"Account",footer:e.errorMessage,children:o.jsxs("div",{className:"settings-row",children:[o.jsx(se,{name:"person.crop.circle",size:26,color:"var(--secondary)"}),o.jsxs("div",{className:"settings-stack",style:{flex:1},children:[o.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.isSignedIn?e.user?.email??"Signed in":"Not signed in"}),o.jsx("span",{style:{...R("caption"),color:"var(--secondary)"},children:e.isSignedIn?"Reach your computers from anywhere":"Sign in to reach your computers from anywhere"})]}),e.isSignedIn?o.jsx(Ne,{kind:"secondary",onClick:()=>{e.signOut()},disabled:e.isBusy,children:e.isBusy?"Please wait…":"Sign out"}):o.jsxs(o.Fragment,{children:[o.jsx(Ne,{kind:"secondary",onClick:()=>{e.signIn("apple")},disabled:e.isBusy,children:"Apple"}),o.jsx(Ne,{kind:"secondary",onClick:()=>{e.signIn("google")},disabled:e.isBusy,children:"Google"})]})]})}),o.jsxs(ke,{title:"Appearance",children:[o.jsx(ei,{label:"Text size",children:o.jsx(_i,{selection:t,options:h2.map(S=>({id:S,label:S===Wa?`${S} pt (Default)`:`${S} pt`})),onChange:s})}),o.jsx(ei,{label:"Usage icons",children:o.jsx(_i,{selection:r,options:[{id:"character",label:"Character"},{id:"original",label:"Original"}],onChange:l})}),o.jsx(ys,{on:h,onChange:u,children:"Compact sidebar"})]}),o.jsxs(ke,{title:"System",children:[window.codync.platform==="darwin"?o.jsx(ys,{on:p,onChange:S=>{window.codync.app.setShowInDock(S).then(m)},children:"Show in Dock"}):null,window.codync.island.supported?o.jsx(ys,{on:v,onChange:S=>{window.codync.island.setEnabled(S).then(x)},children:OT(window.codync.platform)}):null,o.jsx(ys,{on:g,onChange:S=>{window.codync.app.setLaunchAtLogin(S).then(y)},children:"Open at login"})]}),o.jsx(CN,{})]})}function CN(){const e=si(),t=di(e.local),s=t!==null&&t.connection.kind==="online",r=l=>{t?.setAnalytics(l).catch(h=>e.setError(Or(h)))};return o.jsx(ke,{title:"Privacy",footer:"Which features you use, never your messages, code or files. Helps us spot bugs sooner and make Codync better for you.",children:o.jsx(ys,{on:t?.analytics===!0,onChange:r,disabled:!s,children:"Share usage analytics"})})}function kN(){const e=si(),t=e.computers.flatMap(r=>e.store(r.id)??[]),s=t.filter(r=>r.usage.providers.length>0);return s.length===0?o.jsx("span",{style:{color:"var(--secondary)"},children:"No usage information yet."}):o.jsx(o.Fragment,{children:s.flatMap(r=>[t.length>1?o.jsxs("div",{style:{...R("headline"),display:"flex",alignItems:"center",gap:6},children:[o.jsx(Lr,{computer:r.computer,size:16}),r.hostName]},`${r.computer.id}-label`):null,o.jsx(yN,{usage:r.usage},r.computer.id)])})}function jN(){const[e,t]=b.useState(null);if(b.useEffect(()=>(window.codync.updates.state().then(t),window.codync.updates.onChange(t)),[]),!e)return null;const s=e.supported?e.waitingForApp?`Waiting for iPhone app ${e.waitingForApp} to pass App Store review.`:null:"Updates are available in release builds.",r=e.lastCheck?`Last checked ${new Date(e.lastCheck).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}`:null;return o.jsx(ui,{children:o.jsx(ke,{title:"Codync",footer:s,children:[o.jsx(ei,{label:"Version",detail:r,children:o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsx("span",{children:window.codync.appVersion}),o.jsx(Ne,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:!e.supported&&!e.staged,children:e.availableVersion?`Update to ${e.availableVersion}`:"Check for updates"})]})},"version"),o.jsx(ys,{on:e.autoCheck,onChange:l=>window.codync.updates.setAutoCheck(l),disabled:!e.supported,children:"Automatically check for updates"},"check"),o.jsx(ys,{on:e.autoDownload,onChange:l=>window.codync.updates.setAutoDownload(l),disabled:!e.supported,children:"Automatically download and install"},"download"),...e.error?[o.jsxs("div",{className:"settings-row settings-appear",children:[o.jsx("span",{style:{flex:1,color:"var(--warning)"},children:e.error}),o.jsx(Ne,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:e.checking,children:"Retry"})]},"error")]:[]]})})}function EN({approval:e}){const t=si(),[s,r]=b.useState(!1),[l,h]=b.useState(null),u=e.request,p=async g=>{r(!0);try{await t.decide(e,g),t.deferApproval(e)}catch(y){h(Or(y))}finally{r(!1)}},m={textAlign:"center"};return o.jsxs("div",{style:{width:420,display:"flex",flexDirection:"column"},children:[o.jsx(ut,{title:"Access request"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,padding:"0 24px 24px"},children:[o.jsx(se,{name:Ww(u.platform),size:40,weight:"light",color:"var(--secondary)"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[o.jsxs("div",{style:{...R("title3","semibold"),...m},children:[u.deviceName," wants to use ",e.store.hostName]}),u.email?o.jsxs("div",{style:{...R("callout"),color:"var(--secondary)"},children:["Signed in as ",u.email]}):null]}),u.code?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"selectable settings-appear",style:{...R(48,"semibold","monospaced"),color:"var(--text)"},"aria-label":`Code ${u.code.split("").join(" ")}`,children:bj(u.code)}),o.jsxs("div",{style:{...R("callout"),color:"var(--secondary)",...m},children:["Approve only if ",u.deviceName," shows exactly this code. If it doesn't, deny: someone may be trying to get in."]})]}):o.jsxs(o.Fragment,{children:[o.jsx($e,{}),o.jsxs("div",{style:{...R("callout"),color:"var(--secondary)"},children:["Waiting for ",u.deviceName," to show its code…"]})]}),o.jsx(Za,{show:l!==null,children:o.jsx("div",{style:{...R("caption"),color:"var(--danger)",...m},children:l})}),o.jsxs("div",{style:{display:"flex",gap:12},children:[o.jsx(Ne,{kind:"secondary",onClick:()=>{p(!1)},disabled:s,children:"Deny"}),o.jsx(Ne,{onClick:()=>{p(!0)},disabled:s||!u.code,children:"Approve"})]})]})]})}const eb=window.codync.platform==="darwin",MN=eb?"⌘":"Ctrl+";function AN(e,t){const s=t.trim().toLowerCase();return s?e.filter(({bot:r})=>[r.name,r.description,r.lastMessage??""].some(l=>l.toLowerCase().includes(s))):e}function TN({open:e,items:t,onPick:s,onClose:r}){return o.jsx(ht,{open:e,onClose:r,width:640,dismissOnDim:!0,children:e?o.jsx(NN,{items:t,onPick:s,onClose:r}):null})}function NN({items:e,onPick:t,onClose:s}){const[r,l]=b.useState(""),[h,u]=b.useState(0),p=b.useRef(null),m=AN(e,r),g=v=>{v&&(t(v.ref),s())};b.useEffect(()=>u(0),[r]),b.useEffect(()=>{p.current?.children[h]?.scrollIntoView({block:"nearest"})},[h]);const y=v=>{if(v.nativeEvent.isComposing)return;const x=Number(v.key);if((eb?v.metaKey:v.ctrlKey)&&x>=1&&x<=9)v.preventDefault(),g(m[x-1]);else if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault();const S=v.key==="ArrowDown"?1:-1;u(w=>m.length?(w+S+m.length)%m.length:0)}else v.key==="Enter"&&(v.preventDefault(),g(m[h]))};return o.jsxs("div",{className:"palette",onKeyDown:y,children:[o.jsxs("div",{className:"palette-field",children:[o.jsx(se,{name:"magnifyingglass",size:15,color:"var(--secondary)"}),o.jsx("input",{autoFocus:!0,value:r,placeholder:"Search","aria-label":"Search bots",spellCheck:!1,onChange:v=>l(v.target.value)})]}),o.jsxs("div",{className:"palette-list",ref:p,role:"listbox",children:[m.map((v,x)=>o.jsxs("button",{role:"option","aria-selected":x===h,className:`palette-row ${x===h?"active":""}`,onMouseMove:()=>u(x),onClick:()=>g(v),children:[o.jsx(Lx,{bot:v.bot,members:ft(v.bot)?v.store.members(v.bot):[],size:32}),o.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:2},children:[o.jsx("span",{className:"palette-line",style:{...R("body"),color:"var(--text)"},children:v.bot.name}),gx(v)?o.jsx("span",{className:"palette-line",style:{...R("subheadline"),color:"var(--secondary)"},children:gx(v)}):null]}),x<9?o.jsx("span",{className:"key-cap palette-key",children:`${MN}${x+1}`}):null]},Do(v.ref))),m.length===0?o.jsx("div",{className:"palette-empty",children:"No matching bots"}):null]})]})}function gx({bot:e,store:t}){if(!ft(e)||e.description)return e.description;const s=t.members(e).map(r=>r.name).join(", ");return s===e.name?"":s}const s2=window.codync.platform==="darwin"?"Mac":"computer";function DN({onContinue:e}){const t=Ja(),s=Qa(),[r,l]=b.useState(s?4:0);if(b.useEffect(()=>{t.isSignedIn&&e()},[t.isSignedIn,e]),b.useEffect(()=>{if(s)return l(4);const u=[150,430,710,990].map((p,m)=>setTimeout(()=>l(m+1),p));return()=>u.forEach(clearTimeout)},[s]),!t.isReady)return o.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14},children:[o.jsx($e,{size:24}),o.jsx("div",{style:{...R("callout"),color:"var(--secondary)"},children:"Checking for a saved account…"}),o.jsxs("button",{style:{color:"var(--secondary)"},onClick:e,children:["Continue on this ",s2]})]});const h=u=>({opacity:u?1:0,transform:u?"none":"translateY(14px)",transition:"opacity 0.6s cubic-bezier(0.34, 1.3, 0.64, 1), transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"});return o.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:o.jsxs("div",{style:{minHeight:"100%",maxWidth:480,margin:"0 auto",display:"flex",flexDirection:"column",padding:"0 24px 12px"},children:[o.jsx("div",{style:{flex:1,minHeight:24}}),o.jsx(LN,{shown:r>=1}),o.jsx("div",{style:{flex:1,minHeight:24}}),o.jsx("div",{style:{paddingBottom:24},children:o.jsx(BN,{shown:r>=2})}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=3)},children:[o.jsxs("div",{style:{fontSize:34,fontWeight:600,letterSpacing:-.6,color:"var(--text)",lineHeight:1.15},children:["Your coding agents,",o.jsx("br",{}),"as teammates."]}),o.jsx("div",{style:{...R("body"),color:"var(--secondary)"},children:"Give each one a name and a project. They work on your computer while you're away."})]}),o.jsx("div",{style:{flex:1,minHeight:32}}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=4)},children:[o.jsxs(Ne,{onClick:e,style:{...R("headline"),minHeight:50,width:"100%"},children:["Continue on this ",s2]}),o.jsx(Ne,{onClick:()=>{t.signIn("apple")},disabled:!t.isConfigured||t.isBusy,style:{...R("headline"),minHeight:50,width:"100%"},children:t.isBusy?o.jsx($e,{size:18}):o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsx(se,{name:"apple.logo",size:20}),"Continue with Apple"]})}),o.jsx(Ne,{kind:"secondary",onClick:()=>{t.signIn("google")},disabled:!t.isConfigured||t.isBusy,style:{...R("headline"),minHeight:50,width:"100%"},children:t.isBusy?o.jsx($e,{size:18}):o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsx("img",{src:Kx,alt:"",width:20,height:20}),"Continue with Google"]})}),t.isConfigured?null:o.jsxs("div",{style:{...R("footnote"),color:"var(--tertiary)"},children:["Sign-in isn't configured in this build. You can still use Codync on this ",s2,"."]}),t.errorMessage?o.jsx("div",{style:{...R("footnote"),color:"var(--warning)"},children:t.errorMessage}):null]})]})})}const RN=[{shape:"blob",color:"blue",size:92,x:0,y:0,mood:"working"},{shape:"squircle",color:"orange",size:64,x:-104,y:-34,mood:"idle"},{shape:"teardrop",color:"violet",size:58,x:100,y:-46,mood:"working"},{shape:"hex",color:"green",size:48,x:-76,y:64,mood:"idle"},{shape:"cloud",color:"magenta",size:52,x:84,y:58,mood:"needsInput"}];function LN({shown:e}){const t=Qa(),[s,r]=b.useState(0);return b.useEffect(()=>{if(t||!e)return;let l=0;const h=u=>{r(u/1e3),l=requestAnimationFrame(h)};return l=requestAnimationFrame(h),()=>cancelAnimationFrame(l)},[t,e]),o.jsx("div",{"aria-hidden":!0,style:{position:"relative",height:170},children:RN.map((l,h)=>o.jsx("div",{style:{position:"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${l.x}px), calc(-50% + ${l.y+(t?0:Math.sin(s*1.3+h*1.7)*5)}px)) scale(${e?1:.3})`,opacity:e?1:0,transition:`opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s, scale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s`},children:o.jsx(ci,{shape:l.shape,color:l.color,size:l.size,mood:l.mood})},l.shape))})}function BN({shown:e}){const t=Qa(),[s,r]=b.useState(!1);b.useEffect(()=>{if(!e)return;const h=setTimeout(()=>r(!0),t?0:1600);return()=>clearTimeout(h)},[e,t]);const l={opacity:e?1:0,transform:e?"none":"translateY(14px)",transition:"opacity 0.6s, transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"};return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",...l},children:o.jsx("span",{style:{...R("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-user)",borderRadius:18},children:"Fix the flaky login test"})}),o.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,...l},children:[o.jsx(ci,{shape:"blob",color:"blue",size:28,mood:s?"idle":"working"}),s?o.jsx("span",{style:{...R("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-agent)",borderRadius:18,animation:"bubble-in 0.45s cubic-bezier(0.34, 1.3, 0.64, 1) both",transformOrigin:"bottom left"},children:"Done. It raced the session refresh; tests pass on fix/login."}):o.jsx("span",{style:{...R("subheadline"),color:"var(--tertiary)"},children:"Working…"})]}),o.jsx("style",{children:"@keyframes bubble-in { from { opacity: 0; transform: scale(0.92) } }"})]})}const vx=window.codync.platform==="darwin";function tb({compact:e=!1}){const s=si().host.state;switch(s.kind){case"notInstalled":return o.jsx(Th,{compact:e,icon:"desktopcomputer",title:`Set up this ${vx?"Mac":"computer"}`,message:`Codync runs your coding agents through the host, a small background service on this ${vx?"Mac":"computer"}.`,action:["Install host",()=>window.codync.host.install()]});case"missingBinary":return o.jsx(Th,{compact:e,icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host is missing",message:window.codync.appScheme==="codync-dev"?"Rebuild Codync Dev with its development host, then open it again.":"This copy of Codync doesn't include codync-host. Download Codync again from codync.dev or GitHub."});case"failed":return o.jsx(Th,{compact:e,icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host isn't running",message:s.message,action:["Try again",()=>window.codync.host.restart()]});default:return o.jsx(Th,{compact:e,icon:"desktopcomputer",title:"Starting the host…",message:"This takes a few seconds."})}}function Th({icon:e,title:t,message:s,action:r,compact:l=!1}){return o.jsxs("div",{className:`empty-state ${l?"local-recovery":""}`,children:[o.jsx(se,{name:e,size:l?22:36,weight:"light",color:"var(--tertiary)"}),o.jsx("div",{style:{...R(l?"callout":"title3","semibold"),color:"var(--text)"},children:t}),o.jsx("div",{style:{...R("callout"),color:"var(--secondary)",textAlign:l?"left":"center",maxWidth:360},children:s}),r?o.jsx(Ne,{kind:l?"secondary":"primary",onClick:r[1],style:{marginTop:4},children:r[0]}):null]})}function ON({manage:e}){const t=si(),s=Ro(),r=s.state.profiles.some(l=>gp(s.status(l.id)));return o.jsx("div",{className:"startup-recovery",children:o.jsxs("div",{className:"startup-recovery-content",children:[o.jsxs("div",{className:"startup-recovery-title",role:"status",children:[r?o.jsx($e,{size:22}):o.jsx(se,{name:"desktopcomputer",size:22,color:"var(--secondary)"}),o.jsx("span",{style:R("title2","semibold"),children:r?"Connecting to your computers…":"Your remote computers"})]}),o.jsx("div",{style:{color:"var(--secondary)"},children:"Your bots will appear once a computer is connected."}),o.jsx("div",{className:"startup-recovery-profiles",children:s.state.profiles.map(l=>o.jsx(KS,{profile:l,status:s.status(l.id),attached:s.state.attachments.some(h=>h.profileId===l.id),edit:e},l.id))}),o.jsx(Ne,{kind:"secondary",onClick:e,children:"Manage computers"}),t.host.state.kind!=="running"?o.jsx(tb,{compact:!0}):null]})})}const zN=10080*60*1e3;function HN(e,t){switch(e.kind){case"never":return"first";case"asked":return t-e.at>=zN?"second":null;case"done":return null}}function IN(e,t,s){return t||e.kind!=="never"?{kind:"done"}:{kind:"asked",at:s}}const UN="https://github.com/leepokai/Codync",PN={first:{title:"Star Codync on GitHub",message:"Codync is free and open source. A star on GitHub is how other people find it."},second:{title:"Enjoying Codync?",message:"You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it."}};function qN(){const e=si(),t=di(e.local),[s]=kt(nt.onboardingDone),[r,l]=kt(nt.starAsk),[h,u]=b.useState(!1),p=HN(r,Date.now()),m=p!==null&&s&&!h&&t?.connection.kind==="online",g=v=>{h||(u(!0),l(IN(r,v,Date.now())),v&&window.codync.app.openExternal(UN))},y=PN[p??"first"];return o.jsx(ht,{open:m,onClose:()=>g(!1),children:o.jsxs("div",{style:{width:420,display:"flex",flexDirection:"column"},children:[o.jsx(ut,{title:y.title}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,padding:"0 24px 24px"},children:[o.jsx(se,{name:"star",size:36,weight:"light",color:"var(--secondary)"}),o.jsx("div",{style:{...R("callout"),color:"var(--secondary)",textAlign:"center"},children:y.message}),o.jsxs("div",{style:{display:"flex",gap:12},children:[o.jsx(Ne,{kind:"secondary",onClick:()=>g(!1),children:"Not now"}),o.jsx(Ne,{onClick:()=>g(!0),children:"Star on GitHub"})]})]})]})})}const VN=window.codync.platform==="darwin",yx=new Map;function ib(e,t,s,r){const l=`${e}|${To()}`,h=yx.get(l);if(h)return h;const u=2,p=document.createElement("canvas");p.width=t*u,p.height=s*u;const m=p.getContext("2d");m.scale(u,u),r(m);const g=p.toDataURL("image/png");return yx.set(l,g),g}function $N(e){const t=`bot|${e.id}|${e.avatarShape}|${e.avatarColor}|${e.status}|${e.unread>0}`;return ib(t,20,20,s=>{const r=To();yp(s,{shape:e.avatarShape,fill:_s(e.avatarColor),size:20,mood:Rx(e,!1),dark:r,t:0,still:!0});const l=pn(e)?"#F0A030":e.unread>0?r?"#FFFFFF":"#000000":null;if(l){const h=pn(e)?3.6:2.8;s.beginPath(),s.arc(20-h,20-h,h+1,0,Math.PI*2),s.fillStyle=r?"#1e1e1e":"#f2f2f2",s.fill(),s.beginPath(),s.arc(20-h,20-h,h,0,Math.PI*2),s.fillStyle=l,s.fill()}})}function sb(e){return pn(e)?"Needs your response":mn(e)?e.activity||"Working…":e.lastMessage??ru(e)}function WN(e,t){const s=Math.round(t.percent);return ib(`bar|${e}|${s}`,60,16,r=>{const l=To(),h=t.percent>=90?l?"#F0A7A7":"#C23A2B":t.percent>=70?"#F0A030":YS(e);r.fillStyle=l?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.12)",r.beginPath(),r.roundRect(0,5.5,60,5,2.5),r.fill(),t.percent>0&&(r.fillStyle=h,r.beginPath(),r.roundRect(0,5.5,Math.max(5,60*Math.min(1,t.percent/100)),5,2.5),r.fill())})}function FN(e){const t=XS(e);return`${Ao(e)} · ${Math.round(e.percent)}%${t?` · resets in ${QS(t)}`:""}`}function KN(e){const t=[...e.stores.values()];Sp(t);const[s]=kt(nt.textSize),[r]=kt(nt.usageIconStyle);b.useEffect(()=>{const l=setTimeout(()=>{const h=e.local,u=e.roster.filter(y=>!ft(y.bot)),p=e.approvals.length?"A device asks for access":e.needsAttention?"A bot needs you":e.working>0?`${e.working} bot${e.working===1?"":"s"} working`:"Connected",m=h?.screen,g={status:p,canPair:!!h,approval:e.approvals[0]?.request.deviceName??null,bots:u.map(y=>({ref:`${y.ref.computerId}/${y.ref.botId}`,name:e.computers.length>1?`${y.bot.name} · ${y.computer.name}`:y.bot.name,detail:sb(y.bot),working:mn(y.bot),avatar:$N(y.bot)})),usage:(h?.usage.providers??[]).map(y=>({name:y.name,icon:JS(y,16,r,To()),lines:y.windows.map(v=>({title:FN(v),bar:WN(y.id,v)}))})),screen:m?{enabled:m.enabled,subtitle:YN(e),error:e.screenError}:null,version:h?.hello?.version??null,needsAttention:e.needsAttention,textSize:s,usageIconStyle:r};window.codync.app.setTraySummary(g)},150);return()=>clearTimeout(l)})}function YN(e){const t=e.local,s=t?.screen;if(!t||!s||!s.enabled)return`Control this ${VN?"Mac":"computer"} from your iPhone`;if(e.screenNeedsApproval)return"Needs approval in System Settings";if(!s.connected)return"Starting Codync Screen…";if(!s.capture||!s.input)return"Needs permission";if(s.viewers>0)return s.viewers===1?"Your iPhone is viewing":`${s.viewers} viewers`;const r=s.agentBot?t.bots.get(s.agentBot):null;if(r)return`${r.name} is using it`;const l=s.displays.find(h=>h.main)?.name??s.displays[0]?.name;return l?`Ready · ${l}`:"Ready"}let _x="",n2=null;function GN(e){Sp([...e.stores.values()]),b.useEffect(()=>{n2||(n2=setTimeout(()=>{n2=null;const t=ZN(e),s=JSON.stringify(t);s!==_x&&(_x=s,window.codync.island.setSummary(t))},150))})}function ZN(e){const t=e.computers.length>1;return{bots:e.roster.filter(s=>!ft(s.bot)).map(s=>XN(s.store,s.bot,Do(s.ref),t?`${s.bot.name} · ${s.computer.name}`:s.bot.name)),permissions:e.roster.flatMap(JN),usage:e.local?.usage.providers??[]}}function XN(e,t,s,r){const l=e.allEntries(t.id);return{ref:s,name:r,shape:t.avatarShape,color:t.avatarColor,status:t.status,backend:e.backendName(t.backend),folder:ru(t),detail:sb(t),steps:mn(t)?l.filter(h=>h.kind==="tool").slice(-3).map(h=>({title:h.data.title||"Use a tool",kind:h.data.toolKind??"other"})):[],error:t.status==="error"?QN(l)??null:null}}const QN=e=>e.findLast(t=>t.kind==="notice"&&t.data.style==="error")?.data.text;function JN({ref:e,bot:t,store:s}){return s.allEntries(t.id).filter(r=>r.kind==="permission"&&r.data.status==="pending").map(r=>{const l=(r.data.author?s.bots.get(r.data.author):void 0)??t;return{ref:Do(e),entryId:r.id,bot:{name:l.name,shape:l.avatarShape,color:l.avatarColor,backend:s.backendName(l.backend)},headline:iw(r.data.toolKind),title:r.data.title??"",options:sw(r.data.options??[]).map(h=>({id:h.optionId,label:nw(h),kind:h.kind})),answering:s.answering.get(r.id)??null}})}const eD=window.codync.platform==="darwin";function tD(){const e=si(),[t,s]=kt(nt.onboardingDone),[r,l]=kt(nt.computerAccessSetup),[h,u]=b.useState(!1),[p,m]=b.useState(!1);KN(e),GN(e),X7(e);const g=Ro(),y=M6(e.host.state.kind,e.computers.length,g.state);b.useEffect(()=>window.codync.app.onCommand(x=>{switch(x.kind){case"computerAccess":return u(!0);case"confirmReset":return m(!0);case"reviewApprovals":return e.reviewApprovals();case"setTextSize":return nt.textSize.set(x.size);case"stepTextSize":return nt.textSize.set(x.up===null?Wa:J8(nt.textSize.get(),x.up));case"setUsageIconStyle":return nt.usageIconStyle.set(x.style);case"openBot":{const S=mh(x.ref);S&&e.select(S);return}case"stopBot":{const S=mh(x.ref);S&&e.store(S.computerId)?.stop(S.botId);return}case"setRemoteScreen":e.setRemoteScreen(x.on);return;case"respondPermission":{const S=mh(x.ref),w=S?e.store(S.computerId):null,C=S?w?.allEntries(S.botId).find(j=>j.id===x.entryId):void 0;w&&C&&w.respond(C,x.optionId);return}case"sendMessage":{const S=mh(x.ref);S&&e.store(S.computerId)?.send(x.text,S.botId);return}}}),[e]);const v=e.currentApproval;return o.jsxs("div",{className:"chat-window",children:[t?r===null?o.jsx(fp,{onContinue:x=>l(x?"ready":"later")}):y?o.jsx(iD,{}):o.jsx(tb,{}):o.jsx(DN,{onContinue:()=>{s(!0),e.local?.track("onboarding_completed")}}),t&&r!==null?o.jsx(qN,{}):null,o.jsxs(ht,{open:h,onClose:()=>u(!1),width:660,height:Math.min(820,window.innerHeight-80),children:[o.jsx(ut,{title:"Computer access"}),o.jsx(fp,{onContinue:x=>{l(x?"ready":"later"),u(!1)}})]}),o.jsx(cs,{open:p,title:"Reset all data?",message:"Signs out every account and deletes this computer's bots, conversations, keys and settings. Codync then starts over from the welcome screen.",actions:[{title:"Reset everything",destructive:!0,action:()=>{window.codync.app.resetAllData()}}],onClose:()=>m(!1)}),o.jsx(ht,{open:v!==null,onClose:()=>v&&e.deferApproval(v),children:v?o.jsx(EN,{approval:v},v.id):null})]})}function iD(){const e=si(),t=Ro(),s=t.state.profiles.some(ue=>gp(t.status(ue.id)))||[...e.stores.values()].some(ue=>ue.shownConnection.kind==="connecting"),[r,l]=kt(nt.sidebarCompact),[h,u]=kt(nt.sidebarWidth),[p,m]=kt(nt.hiddenComputers),[g,y]=b.useState(!1),[v,x]=b.useState(!1),[S,w]=b.useState(!1),[C,j]=b.useState(null),E=b.useRef(null),[A,N]=b.useState(!1),[L,q]=b.useState(!1),[B,I]=b.useState(null),[U,P]=b.useState(null),[F,$]=b.useState(null),[z,O]=b.useState(null),[M,X]=b.useState(null),[V,ie]=b.useState(null),ee=b.useCallback(()=>ie("voice"),[]),[ce,Y]=b.useState(!1),[oe,xe]=b.useState({width:window.innerWidth,height:window.innerHeight}),we=b.useRef(null),D=b.useRef(null),J=b.useRef(null);Sp([...e.stores.values()]),b.useEffect(()=>{const ue=()=>{xe({width:window.innerWidth,height:window.innerHeight}),u(Math.min(nt.sidebarWidth.get(),Math.max(260,window.innerWidth-420)))};return window.addEventListener("resize",ue),()=>window.removeEventListener("resize",ue)},[u]);const le=Math.max(420,oe.height-76),he=e.computers.map(ue=>e.store(ue.id)).filter(ue=>!!ue),je=new Set(Zx(e.computers.map(ue=>ue.id),p).shown),pe=he.filter(ue=>je.has(ue.computer.id)&&ue.connection.kind==="online"&&!ue.mismatch),Ee=e.selectedStore,me=C?e.store(C):null,_e=T7(e,je),Le=_e.items,ni=(ue=!1)=>{w(ue);const rt=[Ee,e.local].find(Ft=>Ft&&pe.includes(Ft))??pe[0];rt&&(v||(E.current=e.selection),j(rt.computer.id),e.select(null),x(!0))};b.useEffect(()=>{e.selection&&x(!1)},[e.selection]),b.useEffect(()=>window.codync.app.onCommand(ue=>{ue.kind==="newChat"&&pe.length&&ni(),ue.kind==="search"&&y(!0),ue.kind==="toggleSidebar"&&l(!nt.sidebarCompact.get())}));const ri=b.useRef(!1);b.useEffect(()=>{const ue=window.codync.debugOpen;if(!(!ue||ri.current))if(ue==="compose"||ue==="group"){if(!pe.length)return;ri.current=!0,ni(ue==="group")}else if(ue==="plugins"){if(!e.local)return;ri.current=!0,X(e.local.computer.id)}else if(ue==="computers")ri.current=!0,ie("computers");else{const rt=e.roster.find(Ft=>Ft.bot.name===ue);if(!rt)return;ri.current=!0,e.select(rt.ref)}});const fi=()=>[{title:"New chat",icon:"square.and.pencil",action:()=>ni()},{title:"New group chat",icon:"person.2",action:()=>ni(!0)}],mt=()=>X((Ee??e.local??pe[0])?.computer.id??null),Ye=(ue,rt)=>[{title:ue.pinned?"Unpin":"Pin",icon:"pin",action:()=>rt.setPinned(ue,!ue.pinned)},{title:"Mark as Read",icon:"bell.badge",action:()=>rt.markAllRead(ue.id)},{title:"Edit Profile…",icon:"square.and.pencil",divider:!0,action:()=>P({id:crypto.randomUUID(),draft:Co(ue),store:rt})},{title:"Copy conversation ID",icon:"square.on.square",divider:!0,action:()=>window.codync.app.copy(ue.id)},{title:"New session",icon:"arrow.counterclockwise",action:()=>O({bot:ue,store:rt})},{title:"Hide from sidebar",icon:"eye.slash",divider:!0,action:()=>rt.setHidden(ue,!0)},{title:"Delete",icon:"trash",destructive:!0,action:()=>$({bot:ue,store:rt})}],Si=ue=>{if(ue.key!=="ArrowUp"&&ue.key!=="ArrowDown"||ue.target instanceof HTMLElement&&ue.target.closest(".computer-roster-heading"))return;if(ue.altKey){ue.preventDefault(),e.selection&&_e.moveBot(e.selection,ue.key==="ArrowUp"?-1:1);return}const rt=_e.navigable.map(Kr=>Kr.ref);if(!rt.length)return;ue.preventDefault();const Ft=rt.findIndex(Kr=>Wx(Kr,e.selection)),sl=ue.key==="ArrowDown"?Math.min(Ft+1,rt.length-1):Math.max(Ft-1,0);e.select(rt[sl])},Ni=b.useRef(null),Di=ue=>{ue.target.setPointerCapture(ue.pointerId),Ni.current={x:ue.clientX,width:r?76:h}},yn=ue=>{if(!Ni.current)return;const rt=Ni.current.width+ue.clientX-Ni.current.x,Ft=rt<180;Ft!==r&&l(Ft),Ft||u(Math.min(Math.max(260,rt),Math.min(420,window.innerWidth-420)))},ge=e.errorMessage,ot=he.filter(ue=>je.has(ue.computer.id)&&ue.mismatch),ai=e.selection,Fr=ai&&Ee?.bots.get(ai.botId);let $s;v&&me?$s=o.jsxs("div",{className:"detail-column",children:[pe.length>1?o.jsx(sD,{stores:pe,value:me.computer.id,onChange:j}):null,o.jsx(hn.Provider,{value:me,children:o.jsx(Gj,{group:S,onClose:()=>{x(!1),e.selection||e.select(E.current)}})})]},`${me.computer.id}-${S}`):ai&&Ee&&Fr?$s=o.jsx(hn.Provider,{value:Ee,children:o.jsx(qj,{botId:ai.botId},Do(ai))}):!pe.length&&t.state.profiles.length?$s=o.jsx(ON,{manage:()=>ie("computers")}):$s=o.jsxs("div",{className:"empty-detail",children:[o.jsxs("div",{style:{display:"flex"},children:[o.jsx(ci,{shape:"blob",color:"blue",size:60,mood:"working"}),o.jsx(ci,{shape:"squircle",color:"orange",size:60,style:{marginLeft:-10}}),o.jsx(ci,{shape:"teardrop",color:"violet",size:60,mood:"working",style:{marginLeft:-10}})]}),o.jsx("div",{style:R("title2","semibold"),children:s?"Connecting to your computers…":"Your coding agents, as teammates."}),o.jsx("div",{style:{color:"var(--secondary)",textAlign:"center",maxWidth:420},children:s?"Your bots will appear once connected. Manage computers to see connection progress.":"Pick a bot, or create one for each kind of work and point it at a project."}),o.jsx(Ne,{onClick:()=>ni(),disabled:!pe.length,children:"New Bot"})]});const il=r?76:h;return o.jsxs("div",{className:"split",style:{pointerEvents:ce||B?"none":void 0},children:[o.jsxs("aside",{className:`sidebar ${r?"compact":""}`,style:{width:il},children:[o.jsxs("div",{className:"sidebar-header drag",style:{paddingLeft:r?0:eD?80:18,opacity:r?0:1,pointerEvents:r?"none":void 0},"aria-hidden":r,children:[o.jsx("span",{style:{flex:1}}),o.jsxs("div",{className:"no-drag",style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx(v_,{hidden:p,setHidden:m,manage:()=>ie("computers"),compact:!0}),o.jsx(be,{title:"Search",icon:"magnifyingglass",size:32,className:"sidebar-header-action",onClick:()=>y(!0)}),o.jsx(be,{title:"New",icon:"plus",size:32,className:"sidebar-header-action",buttonRef:we,onClick:()=>N(ue=>!ue),disabled:!pe.length})]}),o.jsx(Ka,{open:A,onClose:()=>N(!1),anchor:we,items:fi})]}),r?o.jsx("div",{style:{width:70,alignSelf:"center"},className:"drag",children:o.jsx("div",{className:"no-drag",style:{display:"flex",justifyContent:"center"},children:o.jsx(v_,{hidden:p,setHidden:m,manage:()=>ie("computers"),compact:!0})})}):null,o.jsxs("div",{className:"roster",ref:J,tabIndex:0,onKeyDown:Si,children:[o.jsx(P7,{roster:_e,compact:r,onContext:(ue,rt,Ft,sl)=>I({target:{bot:ue,store:rt},x:Ft,y:sl})}),Le.length===0&&!_e.grouped&&!r&&ot.length===0?o.jsxs("div",{className:"roster-empty",children:[o.jsx("div",{style:R(13,"medium"),children:pe.length?"No bots yet":"Waiting for a computer"}),pe.length?o.jsx("div",{style:{...R(12),color:"var(--secondary)"},children:"Use + to start a new chat."}):null]}):null]}),r?o.jsxs("div",{className:"rail-actions",children:[o.jsx(be,{title:"Search",icon:"magnifyingglass",onClick:()=>y(!0)}),o.jsx(be,{title:"New",icon:"plus",size:36,buttonRef:D,disabled:!pe.length,onClick:()=>q(ue=>!ue)}),o.jsx(Ka,{open:L,onClose:()=>q(!1),anchor:D,items:fi}),o.jsx(be,{title:"Connect apps",icon:"square.grid.2x2",size:36,onClick:mt}),o.jsx("button",{className:"rail-profile",style:{background:ce?"var(--bubble-agent)":void 0},"aria-label":"Open account menu for Account",title:"Account",onClick:()=>Y(ue=>!ue),children:o.jsx(Yx,{})})]}):o.jsx(G7,{accountOpen:ce,onAccount:()=>Y(ue=>!ue),onConnectApps:mt})]}),o.jsx("div",{className:"sidebar-divider",onPointerDown:Di,onPointerMove:yn,onPointerUp:()=>Ni.current=null,role:"separator","aria-label":"Resize sidebar","aria-valuenow":il}),o.jsx("main",{className:"detail",children:o.jsx(Gw.Provider,{value:ee,children:$s})}),ce?o.jsx($7,{compact:r,approvals:e.approvals.length,onDismiss:()=>Y(!1),onUsage:()=>{Y(!1),ie("usage")},onSettings:()=>{Y(!1),ie("general")}}):null,B?o.jsx("div",{className:"context-layer",onMouseDown:ue=>ue.target===ue.currentTarget&&I(null),children:o.jsx(W7,{items:Ye(B.target.bot,B.target.store),onDismiss:()=>I(null),style:{left:Math.min(Math.max(8,B.x),oe.width-268),top:Math.min(Math.max(8,B.y),Math.max(8,oe.height-344))}})}):null,o.jsx(TN,{open:g,items:Le,onPick:ue=>e.select(ue),onClose:()=>y(!1)}),o.jsx(ht,{open:U!==null,onClose:()=>P(null),width:520,height:Math.min(680,le),children:U?o.jsx(hn.Provider,{value:U.store,children:o.jsx(Uk,{draft:U.draft},U.id)}):null}),o.jsx(ht,{open:M!==null,onClose:()=>X(null),width:Math.min(920,oe.width-80),height:le,children:M&&e.store(M)?o.jsx(hn.Provider,{value:e.store(M),children:o.jsx(wT,{appsFirst:!0,computers:pe.map(ue=>({id:ue.computer.id,name:ue.hostName})),computer:M,onComputer:X},M)}):null}),o.jsx(ht,{open:V!==null,onClose:()=>ie(null),width:Math.min(800,oe.width-80),height:Math.min(620,le),children:V?o.jsx(wN,{page:V}):null}),o.jsx(cs,{open:z!==null,title:"Start a new session?",message:"The conversation stays here, but the agent starts with a fresh context.",actions:z?[{title:"New session",action:()=>z.store.newSession(z.bot.id)}]:[],onClose:()=>O(null)}),o.jsx(cs,{open:F!==null,title:`Delete ${F?.bot.name??"bot"}?`,message:"Files it changed on your computer stay as they are.",actions:F?[{title:"Delete bot and its conversation",destructive:!0,action:()=>F.store.delete(F.bot)}]:[],onClose:()=>$(null)}),o.jsx(cs,{open:ge!==null,title:"Something went wrong",message:ge,actions:[],cancel:"OK",onClose:()=>e.clearErrors()})]})}function sD({stores:e,value:t,onChange:s}){const r=b.useMemo(()=>e.map(l=>({id:l.computer.id,label:l.hostName})),[e]);return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px 0",...R("callout")},children:[o.jsx("span",{style:{color:"var(--secondary)"},children:"On"}),o.jsx(_i,{selection:t,options:r,onChange:s})]})}function nD(){const t=si().host.local,[s,r]=b.useState(null),[l,h]=b.useState(null),[u,p]=b.useState(null),[m,g]=b.useState("this computer"),[y,v]=b.useState(null),x=b.useCallback(async()=>{if(!t)return v("This computer's host isn't connected.");const S=new bp(t.baseURL,t.token);try{const[w,C,j]=await Promise.all([S.call("pairing",{},2e4),S.call("cloudStatus",{},2e4).catch(()=>null),S.call("hello",{},2e4).catch(()=>null)]);r(w),p(C),j?.name&&g(j.name),h(await FS.toDataURL(w.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),v(null)}catch(w){v(w instanceof Error?w.message:String(w))}},[t]);return b.useEffect(()=>(x(),window.codync.app.onCommand(S=>S.kind==="reviewApprovals"&&void x())),[x]),b.useEffect(()=>{if(!s?.expiresAt)return;const S=setTimeout(()=>{x()},Math.max(1e3,s.expiresAt-Date.now()));return()=>clearTimeout(S)},[s?.expiresAt,x]),o.jsx("div",{style:{width:340,padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:s&&l?o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{padding:10,background:"#fff",borderRadius:12},children:o.jsx("img",{src:l,alt:`Pairing code for ${m}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),o.jsx("div",{style:{...R("caption"),color:"var(--secondary)",textAlign:"center"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),u?.enabled!==!0?o.jsx("div",{style:{...R("caption"),color:"var(--warning)",textAlign:"center"},children:s.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${m} on the same network.`}):null,o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[s.expiresAt?o.jsxs("span",{style:{...R("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(s.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,o.jsx(be,{title:"New code",icon:"arrow.clockwise",onClick:()=>{x()}}),o.jsx(be,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(s.pairingUrl)})]})]}):y?o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{...R("caption"),color:"var(--danger)",textAlign:"center"},children:y}),o.jsx(be,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{x()}})]}):o.jsx($e,{size:20})})}const rD=650,aD=200,lD=600,oD=800,nb=1e4;class cD extends ws{summary={bots:[],permissions:[],usage:[]};screen={notch:null};open=!1;tab="auto";notice=null;closing=!1;messageRef=null;growing=!0;peek=!1;pinned=!1;hovering=!1;deferred=new Set;statuses=null;hoverTimer;noticeTimer;shape={width:0,height:0};keys=!1;start(){const t=window.codync.island;t.onSummary(s=>this.apply(s)),t.onScreen(s=>this.update(()=>this.screen=s)),t.onHover(s=>this.hover(s)),t.onKey(s=>this.answerByKey(s)),window.addEventListener("blur",()=>{this.tab==="message"&&this.close()}),window.codync.platform==="linux"&&(document.documentElement.addEventListener("mouseenter",()=>this.hover(!0)),document.documentElement.addEventListener("mouseleave",()=>this.hover(!1))),t.state().then(({screen:s,summary:r})=>{this.screen=s,this.apply(r)})}get mode(){return TT(this.summary,{open:this.open,peek:this.peek,tab:this.tab,deferred:this.deferred,notice:this.notice})}get frame(){return LT(this.mode,this.screen)}get permission(){const t=this.summary.permissions;return t.find(s=>!this.deferred.has(s.entryId))??t[0]??null}get focus(){return DT(this.summary.bots)}others(t){return RT(this.summary.bots,this.focus,t)}get activeCount(){return this.summary.bots.filter(Ir).length}bot(t){return this.summary.bots.find(s=>s.ref===t)??null}get noticeBot(){return this.bot(this.notice?.ref??null)}get messageBot(){return this.bot(this.messageRef)??this.focus}openNow(){this.update(()=>{this.open=!0,this.pinned=!0,this.peek=!1}),this.foldWhenAway()}setTab(t){const s=this.tab==="message";this.update(()=>{if(t==="bots")for(const r of this.summary.permissions)this.deferred.add(r.entryId);t==="message"&&!this.messageRef&&(this.messageRef=this.focus?.ref??null),this.tab=t,this.open=!0,this.pinned=!0}),s!==(t==="message")&&window.codync.island.setFocusable(t==="message"),this.foldWhenAway()}nextMessageBot(){const t=this.summary.bots;if(!t.length)return;const s=t.findIndex(r=>r.ref===this.messageBot?.ref);this.update(()=>this.messageRef=t[(s+1)%t.length].ref)}send(t){const s=this.messageBot;!s||!t.trim()||(window.codync.island.send(s.ref,t),this.close())}respond(t,s){window.codync.island.respond(t.ref,t.entryId,s),this.open&&this.close()}openBot(t){window.codync.island.openBot(t),this.dismissNotice(),this.close()}newBot(){window.codync.island.newBot(),this.close()}openApp(){window.codync.island.openApp(),this.close()}dismissNotice(){clearTimeout(this.noticeTimer),this.update(()=>this.notice=null)}close(){clearTimeout(this.hoverTimer);const t=this.tab==="message";this.update(()=>{this.open=!1,this.pinned=!1,this.peek=!1,this.closing=!1,this.tab="auto"}),t&&window.codync.island.setFocusable(!1)}answerByKey(t){const s=this.mode==="approval"?this.permission:null,r=s?.options.find(l=>l.kind===(t==="allow"?"allow_once":"reject_once"));s&&r&&s.answering===null&&this.respond(s,r.id)}apply(t){const s=this.statuses?NT(this.statuses,t.bots):[];this.statuses=new Map(t.bots.map(r=>[r.ref,r.status])),this.update(()=>{this.summary=t;for(const h of this.deferred)t.permissions.some(u=>u.entryId===h)||this.deferred.delete(h);const r=this.notice?t.bots.find(h=>h.ref===this.notice?.ref):void 0;r&&Ir(r)&&(this.notice=null);const l=s.at(-1);l&&this.showNotice(l)})}showNotice(t){clearTimeout(this.noticeTimer),this.notice=t,t.kind==="finished"&&(this.noticeTimer=setTimeout(()=>this.update(()=>this.notice=null),kT))}hover(t){this.hovering=t,clearTimeout(this.hoverTimer);const s=this.mode;if(t){this.closing&&this.update(()=>this.closing=!1),s==="hidden"?(this.update(()=>this.peek=!0),this.hoverTimer=setTimeout(()=>this.openByHover(),rD)):(s==="peek"||s==="compact")&&(this.hoverTimer=setTimeout(()=>this.openByHover(),aD));return}this.open?this.pinned?this.foldWhenAway():this.hoverTimer=setTimeout(()=>this.close(),oD):this.peek&&(this.hoverTimer=setTimeout(()=>this.update(()=>this.peek=!1),lD))}foldWhenAway(){clearTimeout(this.hoverTimer);const t=this.open&&!this.hovering&&this.tab!=="message";t!==this.closing&&this.update(()=>this.closing=t),t&&(this.hoverTimer=setTimeout(()=>this.close(),nb))}openByHover(){this.hovering&&this.update(()=>{this.open=!0,this.peek=!1})}update(t){t();const s=this.frame;(s.width!==this.shape.width||s.height!==this.shape.height)&&(this.growing=s.width*s.height>=this.shape.width*this.shape.height,this.shape={width:s.width,height:s.height},window.codync.island.setShape(BT(s,window.innerWidth)));const r=this.mode==="approval";r!==this.keys&&(this.keys=r,window.codync.island.setKeys(r)),this.changed()}}const Ho="#F0A030",i1="#34D399",vu="#F4505E",Ur=e=>e.status==="needsInput"?"needsInput":e.status==="working"?"working":"idle",rb=e=>e.status==="needsInput"?"needsInput":e.status==="working"?"working":e.status==="error"?"failed":null;function hD(e,t){switch(e){case"needsInput":return Ho;case"finished":return i1;case"failed":return vu;case"working":return _s(t);case null:return null}}function yu({bot:e,size:t,mood:s,badge:r,onOpen:l}){const h=hD(r,e.color),u=o.jsxs(o.Fragment,{children:[h?o.jsx("span",{"aria-hidden":!0,className:"island-glow",style:{background:`radial-gradient(circle, ${Rr(h,.36)}, ${Rr(h,0)} 68%)`}}):null,o.jsx(ci,{shape:e.shape,color:e.color,size:t,mood:s,dark:!0}),o.jsx(ab,{badge:r})]}),p={width:t,height:t};return l?o.jsx("button",{className:"island-big",style:p,onClick:l,title:"Open conversation","aria-label":"Open conversation",children:u}):o.jsx("span",{className:"island-big",style:p,children:u})}function ab({badge:e,small:t=!1}){if(!e)return null;if(e==="working"&&!t)return o.jsx("span",{className:"island-badge orb","aria-label":"Working",children:o.jsx(xs,{size:14,color:"#F5F6F8"})});if(e==="working")return o.jsxs("span",{className:`island-badge dots ${t?"small":""}`,"aria-label":"Working",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]});const s=e==="needsInput"?Ho:e==="finished"?i1:vu,r=e==="needsInput"?"Needs you":e==="finished"?"Done":"Failed";return o.jsx("span",{className:`island-badge ${t?"small":""}`,style:{background:s},"aria-label":r,children:o.jsx(se,{name:e==="finished"?"checkmark":"exclamationmark",size:t?5:8,weight:"black",scaled:!1})})}function s1({color:e,name:t,subtitle:s}){return o.jsxs("div",{className:"island-agent",children:[o.jsx("span",{className:"island-dot",style:{background:_s(e)}}),o.jsx("span",{className:"island-agent-name",children:t}),o.jsx("span",{className:"island-agent-subtitle",children:s})]})}function n1({bots:e,onOpen:t}){return o.jsx("div",{className:"island-minis",children:e.map(s=>o.jsxs("button",{className:"island-mini",title:s.name,"aria-label":`Open ${s.name}`,onClick:()=>t(s.ref),children:[o.jsx(ci,{shape:s.shape,color:s.color,size:18,mood:Ur(s),dark:!0}),o.jsx(r1,{bot:s})]},s.ref))})}function r1({bot:e}){const t=e.status==="needsInput"?Ho:e.status==="working"?"#F5F6F8":e.status==="error"?vu:null;return t?o.jsx("span",{className:"island-status-dot",style:{background:t}}):null}const xx=({keys:e})=>o.jsx("span",{"aria-hidden":!0,className:"island-key",children:e});function uD(e){switch(e){case"execute":return"terminal";case"edit":case"delete":case"move":return"pencil";case"read":return"doc.text";case"search":return"magnifyingglass";case"fetch":return"globe";default:return"ellipsis"}}const lb=(e,t)=>`radial-gradient(120% 90% at 50% 130%, ${Rr(e,t)}, ${Rr(e,0)} 70%)`;function dD({model:e,peek:t}){const s=e.focus,r=e.others(4);if(!s)return null;const l=s.status==="needsInput"?"Needs you":`${e.activeCount} working`;return o.jsxs("div",{className:`island-wings ${t?"peeking":""}`,children:[e.screen.notch||t?null:o.jsx("span",{className:"island-wings-label",children:l}),o.jsx("span",{className:"island-wing-left",children:o.jsxs("span",{className:"island-wing-avatar",children:[o.jsx(ci,{shape:s.shape,color:s.color,size:t?18:20,mood:Ur(s),dark:!0}),t?null:o.jsx(ab,{badge:rb(s),small:!0})]})}),t?null:o.jsx("span",{className:"island-wing-right",children:r.length?o.jsx("span",{className:"island-cluster",children:r.map(h=>o.jsxs("span",{className:"island-cluster-bot",children:[o.jsx(ci,{shape:h.shape,color:h.color,size:11,mood:Ur(h),dark:!0}),h.status==="needsInput"?o.jsx(r1,{bot:h}):null]},h.ref))}):s.status==="needsInput"?o.jsx("span",{className:"island-dot",style:{background:Ho}}):o.jsx(xs,{size:14,color:"#F5F6F8"})})]})}function fD({model:e}){const t=e.focus,s=e.others(4);if(!t)return null;const r=t.steps.length?t.steps:[{title:t.detail,kind:"other"}];return o.jsxs("div",{className:"island-row-cards",children:[o.jsxs("button",{className:"island-card island-focus",style:s.length?{width:322}:{flex:1},onClick:()=>e.openBot(t.ref),title:"Open conversation",children:[o.jsx(yu,{bot:t,size:70,mood:Ur(t),badge:rb(t)}),o.jsxs("span",{className:"island-focus-text",children:[o.jsx(s1,{color:t.color,name:t.name,subtitle:t.backend}),r.map((l,h)=>o.jsxs("span",{className:`island-step ${h===r.length-1?"current":""}`,children:[o.jsx(se,{name:uD(l.kind),size:h===r.length-1?13:12,scaled:!1}),o.jsx("span",{className:"island-ellipsis",children:l.title})]},`${h}-${l.title}`))]})]}),s.length?o.jsx("div",{className:"island-card island-pills",children:s.map(l=>o.jsxs("button",{className:"island-pill",style:{background:Rr(_s(l.color),.16),color:`color-mix(in srgb, ${_s(l.color)} 55%, white)`},onClick:()=>e.openBot(l.ref),title:l.detail,children:[o.jsxs("span",{className:"island-pill-bot",children:[o.jsx(ci,{shape:l.shape,color:l.color,size:24,mood:Ur(l),dark:!0}),o.jsx(r1,{bot:l})]}),o.jsx("span",{className:"island-ellipsis",children:l.name})]},l.ref))}):null]})}function pD({model:e}){const t=e.focus;return o.jsxs("div",{className:"island-card island-empty",children:[t?o.jsx(yu,{bot:t,size:62,mood:"idle",badge:null}):null,o.jsxs("span",{className:"island-empty-text",children:[o.jsx("span",{className:"island-title",children:"Nothing running right now."}),o.jsx("span",{className:"island-subtitle",children:t?"Your bots are idle. Message one from here, or open Codync.":"Create a bot in Codync to get started."})]}),t?o.jsx(Ne,{onClick:()=>e.setTab("message"),children:"Message a bot"}):o.jsx(Ne,{onClick:()=>e.newBot(),children:"New bot"})]})}const wx=e=>({reject_always:0,reject_once:1,allow_always:2,allow_once:3})[e]??1.5;function mD({model:e,card:t}){const s=[...t.options].sort((r,l)=>wx(r.kind)-wx(l.kind));return o.jsxs("div",{className:"island-with-minis",children:[o.jsxs("div",{className:"island-card island-alert",style:{background:`${lb(Ho,.42)}, var(--island-card)`},children:[o.jsx(yu,{bot:t.bot,size:56,mood:"needsInput",badge:"needsInput",onOpen:()=>e.openBot(t.ref)}),o.jsxs("div",{className:"island-alert-text",children:[o.jsx(s1,{color:t.bot.color,name:t.bot.name,subtitle:`${t.bot.backend} ${t.headline.charAt(0).toLowerCase()}${t.headline.slice(1)}`}),t.title?o.jsx("div",{className:"island-code",children:t.title}):null,o.jsx("div",{className:"island-buttons",children:s.map(r=>o.jsxs(Ne,{kind:r.kind==="allow_once"?"primary":"secondary",disabled:t.answering!==null,onClick:()=>e.respond(t,r.id),children:[t.answering===r.id?o.jsx($e,{size:12}):null,r.label,r.kind==="allow_once"?o.jsx(xx,{keys:"⌥Y"}):r.kind==="reject_once"?o.jsx(xx,{keys:"⌥N"}):null]},r.id))})]})]}),o.jsx(n1,{bots:e.others(3).filter(r=>r.ref!==t.ref),onOpen:r=>e.openBot(r)})]})}function gD({model:e,bot:t,failed:s}){return o.jsxs("div",{className:"island-with-minis",children:[o.jsxs("div",{className:"island-card island-alert",style:{background:`${lb(s?vu:i1,s?.5:.42)}, var(--island-card)`},children:[o.jsx(yu,{bot:t,size:58,mood:"idle",badge:s?"failed":"finished",onOpen:()=>e.openBot(t.ref)}),o.jsxs("div",{className:"island-alert-text",children:[o.jsx(s1,{color:t.color,name:t.name,subtitle:s?t.backend:`${t.backend} is done`}),s?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"island-title",children:`${t.name} stopped.`}),o.jsx("div",{className:"island-error",children:t.error??t.detail})]}):o.jsx("div",{className:"island-title island-ellipsis",children:t.detail}),o.jsxs("div",{className:"island-buttons start",children:[o.jsx(Ne,{onClick:()=>e.openBot(t.ref),children:"Open conversation"}),o.jsx(Ne,{kind:"secondary",onClick:()=>e.dismissNotice(),children:"OK"})]})]})]}),o.jsx(n1,{bots:e.others(3).filter(r=>r.ref!==t.ref),onOpen:r=>e.openBot(r)})]})}function vD({model:e}){const[t,s]=b.useState(""),r=e.messageBot;return r?o.jsxs("div",{className:"island-with-minis",children:[o.jsxs("div",{className:"island-card island-message",children:[o.jsx(ci,{shape:r.shape,color:r.color,size:44,mood:Ur(r),dark:!0}),o.jsxs("div",{className:"island-message-body",children:[o.jsxs("div",{className:"island-agent",children:[o.jsxs("button",{className:"island-chip",style:{background:Rr(_s(r.color),.16),color:`color-mix(in srgb, ${_s(r.color)} 55%, white)`},onClick:()=>e.nextMessageBot(),title:"Choose a bot",children:[o.jsx(ci,{shape:r.shape,color:r.color,size:18,mood:Ur(r),dark:!0}),r.name,o.jsx(se,{name:"chevron.down",size:8,weight:"bold",scaled:!1})]}),o.jsx("span",{className:"island-agent-subtitle",children:`${r.backend} · ${r.folder}`})]}),o.jsxs("form",{className:"island-field",onSubmit:l=>{l.preventDefault(),e.send(t),s("")},children:[o.jsx("input",{autoFocus:!0,"aria-label":`Message ${r.name}`,placeholder:`Message ${r.name}…`,value:t,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Escape"&&e.close()}}),o.jsx("button",{type:"submit",className:"island-send","aria-label":"Send",title:"Send",disabled:!t.trim(),children:o.jsx(se,{name:"arrow.up",size:12,weight:"bold",scaled:!1})})]})]})]}),o.jsx(n1,{bots:e.others(3).filter(l=>l.ref!==r.ref),onOpen:l=>e.openBot(l)})]}):null}function ob({provider:e,size:t}){const[s]=kt(nt.usageIconStyle),r=JS(e,t,s,!0);return r?o.jsx("img",{src:r,alt:"",width:t,height:t,style:{flex:"none"}}):null}function yD(e){let t=null;for(const s of e){const r=Jp(s);r&&(!t||r.percent>t.window.percent)&&(t={provider:s,window:r})}return t}function _D({model:e}){const t=yD(e.summary.usage);if(!t)return null;const{provider:s,window:r}=t,l=e1(r);return o.jsxs("button",{className:"island-meter",title:`${s.name} · ${Ao(r)} · ${Math.round(r.percent)}%${l?` · ${l}`:""}`,"aria-label":`Usage: ${s.name} ${Ao(r)} ${Math.round(r.percent)} percent`,onClick:()=>e.setTab("usage"),children:[o.jsx(ob,{provider:s,size:15}),o.jsx("span",{className:"island-meter-bar",children:o.jsx(t1,{percent:r.percent,tint:gu(s.id)})}),o.jsx("span",{className:"island-meter-value",children:`${Math.round(r.percent)}%`})]})}function xD({model:e}){const t=e.summary.usage;return t.length?o.jsx("div",{className:"island-row-cards",children:t.slice(0,2).map(s=>o.jsxs("div",{className:"island-card island-usage",children:[o.jsxs("div",{className:"island-agent",children:[o.jsx(ob,{provider:s,size:20}),o.jsx("span",{className:"island-agent-name",children:s.name})]}),s.windows.slice(0,3).map(r=>o.jsxs("div",{className:"island-usage-row",children:[o.jsx("span",{className:"island-usage-title",children:Ao(r)}),o.jsx(t1,{percent:r.percent,tint:gu(s.id)}),o.jsx("span",{className:"island-usage-value",children:`${Math.round(r.percent)}%`}),o.jsx("span",{className:"island-usage-reset",children:e1(r)?.replace("resets ","")??""})]},r.id))]},s.id))}):o.jsx("div",{className:"island-card island-empty",children:o.jsxs("span",{className:"island-empty-text",children:[o.jsx("span",{className:"island-title",children:"No usage yet."}),o.jsx("span",{className:"island-subtitle",children:"Claude Code and Codex limits show up here once a bot has used them."})]})})}const Sx=340;function wD({model:e}){di(e);const{mode:t,frame:s}=e,r=AT(t),l=t==="compact"||t==="peek",h=l||t==="hidden",u=b.useRef(t),p=b.useRef(t);r&&(u.current=t),l&&(p.current=t);const m=Ps(r,Sx,!1),g=Ps(l,Sx,!1);return o.jsxs("div",{className:`island ${e.growing?"growing":"shrinking"} ${e.screen.notch?"":"edge"}`,"data-mode":t,style:{width:s.width,height:s.height},role:h?"button":void 0,"aria-label":h?"Show bots":void 0,onClick:h?()=>e.openNow():void 0,children:[o.jsx("span",{className:"island-ear left"}),o.jsx("span",{className:"island-ear right"}),o.jsxs("div",{className:"island-body",style:{borderBottomLeftRadius:s.radius,borderBottomRightRadius:s.radius},children:[g.mounted?o.jsx("div",{className:`island-layer ${g.shown?"":"leaving"}`,children:o.jsx(dD,{model:e,peek:p.current==="peek"})}):null,m.mounted?o.jsxs("div",{className:`island-layer ${m.shown?"":"leaving"}`,children:[o.jsx(CD,{model:e,mode:u.current}),o.jsx("div",{className:"island-content",style:{top:PS(e.screen)},children:o.jsx(SD,{model:e,mode:u.current})},u.current)]}):null,r&&e.closing?o.jsx("span",{className:"island-countdown",style:{animationDuration:`${nb}ms`}}):null]})]})}function SD({model:e,mode:t}){switch(t){case"overview":return o.jsx(fD,{model:e});case"empty":return o.jsx(pD,{model:e});case"approval":return e.permission?o.jsx(mD,{model:e,card:e.permission}):null;case"finished":case"failed":return e.noticeBot?o.jsx(gD,{model:e,bot:e.noticeBot,failed:t==="failed"}):null;case"message":return o.jsx(vD,{model:e});case"usage":return o.jsx(xD,{model:e});default:return null}}const bD=[{tab:"bots",icon:"house.fill",label:"Bots"},{tab:"message",icon:"bubble.left.fill",label:"Message a bot"},{tab:"usage",icon:"gauge.with.dots.needle.33percent",label:"Usage"}];function CD({model:e,mode:t}){const s=t==="message"||t==="usage"?t:t==="overview"||t==="empty"?"bots":null,r=e.activeCount;return o.jsxs("div",{className:"island-header",children:[o.jsxs("div",{className:"island-tabs",children:[bD.map(l=>o.jsx("button",{className:`island-tab ${s===l.tab?"selected":""}`,title:l.label,"aria-label":l.label,onClick:()=>e.setTab(l.tab),children:o.jsx(se,{name:l.icon,size:13,scaled:!1})},l.tab)),o.jsx("button",{className:"island-tab",title:"New bot","aria-label":"New bot",onClick:()=>e.newBot(),children:o.jsx(se,{name:"plus",size:13,weight:"semibold",scaled:!1})})]}),o.jsxs("div",{className:"island-tabs",children:[r?o.jsx("span",{className:"island-count",children:`${r} working`}):null,o.jsx(_D,{model:e}),o.jsx("button",{className:"island-tab",title:"Open Codync","aria-label":"Open Codync",onClick:()=>e.openApp(),children:o.jsx(se,{name:"arrow.up.right.square",size:13,scaled:!1})})]})]})}const _o=new URLSearchParams(location.search).get("window")??"chat";document.title=window.codync.appName;document.documentElement.dataset.platform=window.codync.platform;document.documentElement.dataset.window=_o;Hx(nt.textSize.get());const bx=E6.createRoot(document.getElementById("root"));if(_o==="island"){const e=new cD;e.start(),bx.render(o.jsx(wD,{model:e}))}else{const e=new A7(_o!=="pairing");e.start(),_o!=="pairing"&&Ti.start(),bx.render(o.jsx(Ix.Provider,{value:e,children:_o==="pairing"?o.jsx(nD,{}):o.jsx(tD,{})}))}
diff --git a/web/public/demo/desktop/assets/index-DJ5oPlCe.js b/web/public/demo/desktop/assets/index-DJ5oPlCe.js
deleted file mode 100644
index b155cefa..00000000
--- a/web/public/demo/desktop/assets/index-DJ5oPlCe.js
+++ /dev/null
@@ -1,56 +0,0 @@
-(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const h of l)if(h.type==="childList")for(const d of h.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(l){const h={};return l.integrity&&(h.integrity=l.integrity),l.referrerPolicy&&(h.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?h.credentials="include":l.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function r(l){if(l.ep)return;l.ep=!0;const h=n(l);fetch(l.href,h)}})();function Of(e){const t=e.createdAt??0;return{id:e.id,kind:e.kind??"agent",members:e.members??[],name:e.name??"Bot",description:e.description??"",avatarColor:e.avatarColor??"blue",avatarShape:e.avatarShape??"blob",backend:e.backend??"custom",command:e.command??null,cwd:e.cwd??"",managedWorkspace:e.managedWorkspace??!1,permission:e.permission??"auto",model:e.model??null,pinned:e.pinned??!1,hidden:e.hidden??!1,notify:e.notify??null,connectors:e.connectors??[],skills:e.skills??[],computer:e.computer??!1,autoName:e.autoName??!1,createdAt:t,rev:e.rev??0,status:e.status??"idle",activity:e.activity??"",startedAt:e.startedAt??null,workingChat:e.workingChat??null,workingThread:e.workingThread??null,unread:e.unread??0,lastMessage:e.lastMessage??null,lastAt:e.lastAt??t}}const At=e=>e.kind==="group",Jn=e=>e.status==="working"||e.status==="needsInput",ln=e=>e.status==="needsInput",$2=(e,t,n)=>Jn(e)&&(e.workingChat??e.id)===t&&(e.workingThread??null)===(n??null),bo=e=>e.managedWorkspace?"Personal workspace":e.cwd.split("/").filter(Boolean).pop()??e.cwd,O3=e=>["png","jpg","jpeg","heic","gif","webp","tiff","bmp"].includes(e.split(".").pop()?.toLowerCase()??"");function _o(e){switch(e.kind){case"user":case"permission":case"notice":return!0;case"agent":return e.data.final===!0;default:return!1}}function zf(e){return e?{enabled:e.enabled??!1,connected:e.connected??!1,platform:e.platform??"",capture:e.capture??!1,input:e.input??!1,displays:e.displays??[],userControl:e.userControl??!1,agentBot:e.agentBot??null,viewers:e.viewers??0}:null}function yo(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const Dh="demo-mac",z3="MacBook Pro",H3="/Users/demo/code/pace",tb=[{id:"pacer",name:"Pacer",description:"Owns the pace math",avatarColor:"orange",avatarShape:"squircle",backend:"claude",model:"opus",permission:"ask",status:"needsInput",activity:"Needs approval: Edit src/pace.js",unread:1},{id:"scout",name:"Scout",description:"Finds things in the repo and builds them",avatarColor:"green",avatarShape:"cloud",backend:"codex",model:null,unread:1},{id:"reviewer",name:"Reviewer",description:"Reviews every change before it ships",avatarColor:"violet",avatarShape:"blob",backend:"claude",model:"sonnet",unread:1},{id:"relay",name:"Relay",description:"Writes the release notes",avatarColor:"blue",avatarShape:"tablet",backend:"codex",model:null,unread:1},{id:"ship",kind:"group",members:["pacer","scout","reviewer"],name:"Ship room",description:"Getting weeklyTotals out",avatarColor:"gray",avatarShape:"blob",backend:"",model:null}],D0=H3,Er=(e,t,n,r,l)=>({id:e,botId:t,kind:"user",at:n,data:{text:r,status:"sent"},threadId:l}),Un=(e,t,n,r,l,h)=>({id:e,botId:t,kind:"agent",at:r,data:{text:l,final:!0,author:n},threadId:h}),Kv=(e,t,n,r)=>({id:e,botId:t,kind:"thought",at:n,data:{text:r,author:t}}),nh=(e,t,n,r,l,h="")=>({id:e,botId:t,kind:"tool",at:n,data:{title:r,toolKind:l,status:"completed",output:h,author:t}}),ib=["@@ -18,3 +18,15 @@ export function isoWeek(date) {"," ","+export function weeklyTotals(runs) {","+ const weeks = {}","+ for (const run of runs) {","+ const key = isoWeek(run.date)","+ const week = (weeks[key] ??= { distance: 0, time: 0 })","+ week.distance += run.distance","+ week.time += run.time","+ }","+ return weeks","+}"].join(`
-`),sb=["@@ -4,9 +4,10 @@ export function isoWeek(date) {"," const d = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()))","- const year = d.getUTCFullYear()"," d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7))","+ // The ISO year is the year of the Thursday of this week.","+ const year = d.getUTCFullYear()"," const start = new Date(Date.UTC(year, 0, 1))"," const week = Math.ceil(((d - start) / 86400000 + 1) / 7)",' return `${year}-W${String(week).padStart(2, "0")}`'].join(`
-`),nb=[Er("s1","scout",58,"Add a weeklyTotals(runs) helper that sums distance and time per ISO week, with a test."),Kv("s2","scout",58,"isoWeek already lives in src/pace.js, so weeklyTotals can key on it and stay small."),nh("s3","scout",57,"Read src/pace.js","read"),{id:"s4",botId:"scout",kind:"tool",at:57,data:{title:"Edit src/pace.js",toolKind:"edit",status:"completed",author:"scout",diffs:[{path:"src/pace.js",added:10,removed:0,isNew:!1,startLine:18,patch:ib}]}},{id:"s5",botId:"scout",kind:"tool",at:56,data:{title:"npm test",toolKind:"execute",command:"npm test",status:"completed",output:`✓ isoWeek: mid year
-✓ isoWeek: first week
-✓ weeklyTotals: sums one week
-✓ weeklyTotals: week that crosses into 2027
-
-4 passing (12ms)`,author:"scout"}},Un("s6","scout","scout",55,'I added `weeklyTotals(runs)` to `src/pace.js`. It takes runs shaped like `{ date, distance, time }`, groups them by ISO week in UTC (keys like `"2026-W53"`) and sums distance and time. The new test covers the week that crosses into 2027. All 4 tests pass and nothing is committed yet.'),Er("r1","reviewer",50,"Review weeklyTotals before we ship it."),nh("r2","reviewer",49,"Read src/pace.js","read"),nh("r3","reviewer",49,"Read test/pace.test.js","read"),Un("r4","reviewer","reviewer",48,`I found no blockers. The ISO week math is right, including the New Year edge.
-
-Two small things:
-- A bad date becomes a \`"NaN-WNaN"\` bucket instead of an error.
-- Weeks are grouped in UTC, so a late evening run west of UTC can land in the next week.`),Er("l1","relay",41,"Summarize what changed in pace today for the team channel."),Un("l2","relay","relay",40,"Added `weeklyTotals` to group run distance and time by ISO week, with a test for the 2026 to 2027 rollover. Reviewer found no blockers. An invalid-date guard is being added in Ship room."),Er("l3","relay",38,"Make it one line for the changelog.","l2"),Un("l4","relay","relay",38,"Pace now shows your weekly distance and time totals.","l2"),Er("g1","ship",22,"Is weeklyTotals ready to ship? One short sentence each."),Un("g2","ship","reviewer",21,'Almost: the week math is right and all 4 tests pass, but a bad date gets bucketed as `"NaN-WNaN"` instead of raising an error. @Scout, can you add an invalid-date guard?'),Un("g3","ship","scout",19,"Added the guard: `weeklyTotals` now throws a `RangeError` on an invalid date, and all 5 tests pass. Weeks are still grouped in UTC, so say if they should follow the runner's local time instead."),Er("g4","ship",17,"UTC is right, keep it.","g3"),Un("g5","ship","scout",17,"Got it, UTC stays. I left a comment above `weeklyTotals` so nobody flips it later.","g3"),Un("g6","ship","pacer",15,"Ship it once my `isoWeek` New Year fix lands. Dec 30, 2024 still comes out as 2024-W01 instead of 2025-W01."),Er("p1","pacer",9,"Fix the isoWeek New Year bug you mentioned."),Kv("p2","pacer",9,"The year is read before moving to the Thursday of the week, so late December dates get the wrong ISO year."),nh("p3","pacer",8,"Read src/pace.js","read"),{id:"p4",botId:"pacer",kind:"agent",at:7,data:{text:"Found it: the year comes from the date itself, not from the Thursday of its week.",final:!1,author:"pacer"}},{id:"p5",botId:"pacer",kind:"permission",at:6,data:{title:"Edit src/pace.js",toolKind:"edit",cwd:H3,status:"pending",selected:void 0,author:"pacer",diffs:[{path:"src/pace.js",added:2,removed:1,isNew:!1,startLine:4,patch:sb}],options:[{optionId:"allow",name:"Allow",kind:"allow_once"},{optionId:"always",name:"Always allow",kind:"allow_always"},{optionId:"deny",name:"Deny",kind:"reject_once"}]}}],rb={pacer:["Sure. I'll keep it inside `src/pace.js` and rerun `npm test` when it's done.","Makes sense. The week math is the risky part, so I'll add a test for it first.","Good call. Nothing else imports that function, so it's a one-file change."],scout:["On it. I'll grep the repo first so we know what else touches it.","Done a quick pass: only `src/pace.js` and its test use it, so the change stays small.","Sure. I'll write the test first, then make it pass."],reviewer:["I'll look at the diff once it lands and flag anything that isn't a nit.","Looks fine to me. Just keep the test for the New Year week, that's where it broke before.","One thing to watch: dates without a time zone are read as UTC. Worth a comment."],relay:[`Here's a draft: "Pace now groups your runs by week, with totals for distance and time."`,"Noted. I'll fold that into the release notes for the next version.","Short version for the channel: weekly totals are in, a New Year week fix is next."]},ab="I'm still waiting on your approval for the `isoWeek` edit. Once you allow it, I'll keep going.",lb="Fixed: `isoWeek` now takes the year from the Thursday of the week, so Dec 30, 2024 is 2025-W01. I added a test for it and all 6 tests pass.",ob="OK, I left `src/pace.js` alone. Want me to explain the fix so you can make it yourself?";function Yv(e){const t=n=>e+n*36e5;return{providers:[{id:"claude",name:"Claude",source:"statusline",updatedAt:e,windows:[{id:"five_hour",label:"5-hour",percent:38,resetsAt:t(2.4)},{id:"seven_day",label:"Weekly",percent:61,resetsAt:t(70)}]},{id:"codex",name:"Codex",source:"sessions",updatedAt:e,windows:[{id:"primary",label:"5-hour",percent:22,resetsAt:t(3.1)},{id:"secondary",label:"Weekly",percent:47,resetsAt:t(95)}]}]}}const Gv=1500,Rh="Not available in the web demo. Install Codync to use this.";class cb{constructor(t,n=Date.now()){this.version=t;for(const r of tb)this.bots.set(r.id,Of({...r,cwd:r.kind==="group"?"":D0,createdAt:n-864e5,permission:r.permission??"auto"}));for(const r of nb)this.add({botId:r.botId,threadId:r.threadId??null,kind:r.kind,data:r.data},r.id,n-r.at*6e4,!1);for(const r of this.bots.values())this.refreshPreview(r),r.rev=++this.rev}version;hostId="demo-host";rev=0;seq=0;bots=new Map;entries=[];listeners=new Set;turns=new Map;nextReply=new Map;subscribe(t,n){const r=[...[...this.bots.values()].filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"bot",rev:p.rev,bot:this.botJSON(p)}})),...this.entries.filter(p=>p.rev>t).map(p=>({rev:p.rev,line:{type:"entry",rev:p.rev,entry:p}}))].sort((p,g)=>p.rev-g.rev),l={type:"hello",hostId:this.hostId,computerId:Dh,rev:this.rev,usage:Yv(Date.now()),screen:null};let h=!0;const d=p=>h&&n(p);return setTimeout(()=>{if(h){for(const p of[{line:l},...r])n(JSON.stringify(p.line));this.listeners.add(d)}},0),()=>{h=!1,this.listeners.delete(d)}}emit(t){const n=JSON.stringify(t);for(const r of this.listeners)r(n)}emitBot(t){if(t.rev=++this.rev,this.emit({type:"bot",rev:t.rev,bot:this.botJSON(t)}),t.kind!=="group")for(const n of this.bots.values())n.kind==="group"&&n.members.includes(t.id)&&this.emitBot(n)}emitEntry(t){t.rev=++this.rev,t.updatedAt=Date.now(),this.emit({type:"entry",rev:t.rev,entry:t})}botJSON(t){if(t.kind!=="group")return t;const n=t.members.map(r=>this.bots.get(r)).find(r=>r&&r.status!=="idle"&&r.workingChat===t.id);return n?{...t,status:n.status,activity:n.activity,startedAt:n.startedAt,workingChat:t.id,workingThread:n.workingThread}:t}add(t,n=crypto.randomUUID(),r=Date.now(),l=!0){const h={...t,id:n,seq:++this.seq,rev:++this.rev,turn:1,createdAt:r,updatedAt:r};if(this.entries.push(h),h.threadId&&this.summarize(h.botId,h.threadId,l),l){this.emit({type:"entry",rev:h.rev,entry:h});const d=this.bots.get(h.botId);d&&!h.threadId&&_o(h)&&(this.refreshPreview(d),h.kind!=="user"&&d.unread++,this.emitBot(d))}return h}summarize(t,n,r){const l=this.entries.find(p=>p.id===n);if(!l)return;const h=this.entries.filter(p=>p.botId===t&&p.threadId===n&&_o(p)),d=[];for(const p of h){const g=p.kind==="user"?"user":p.data.author??t;d.includes(g)||d.push(g)}l.data={...l.data,thread:{count:h.length,lastAt:h.at(-1)?.createdAt??0,authors:d,unread:0}},r&&this.emitEntry(l)}refreshPreview(t){const n=this.entries.filter(l=>l.botId===t.id&&!l.threadId&&(l.kind==="user"||l.kind==="agent"&&l.data.final)).at(-1);if(!n)return;const r=n.data.text??"";t.lastAt=n.createdAt,t.lastMessage=n.kind==="user"?`You: ${r}`:t.kind==="group"?`${this.bots.get(n.data.author??"")?.name??"A bot"}: ${r}`:r}setStatus(t,n,r="",l=null,h=null){const d=this.bots.get(t);d&&(Object.assign(d,{status:n,activity:r,startedAt:n==="idle"?null:Date.now(),workingChat:l,workingThread:h}),this.emitBot(d))}pending(t){return this.entries.find(n=>n.kind==="permission"&&n.data.author===t&&n.data.status==="pending")??null}settle(t){const n=this.pending(t);n?this.setStatus(t,"needsInput",`Needs approval: ${n.data.title??""}`,n.botId):this.setStatus(t,"idle")}async answer(t,n,r,l){const h=(this.turns.get(t)??0)+1;this.turns.set(t,h),this.setStatus(t,"working","Typing…",n,r),await Zv(Gv+Math.random()*600),this.turns.get(t)===h&&(this.add({botId:n,threadId:r,kind:"agent",data:{text:l,final:!0,author:t}}),this.settle(t))}replyText(t){if(this.pending(t))return ab;const n=rb[t]??["Got it. I'll take a look and report back."],r=this.nextReply.get(t)??0;return this.nextReply.set(t,r+1),n[r%n.length]}async converse(t,n,r){let l=[t.id];if(t.kind==="group"){const h=t.members.filter(g=>this.bots.has(g)),d=h.filter(g=>r.toLowerCase().includes(`@${this.bots.get(g).name.toLowerCase()}`)),p=n?this.entries.find(g=>g.id===n)?.data.author:void 0;l=d.length?d:p&&h.includes(p)?[p]:h.slice(0,2)}for(const h of l)await this.answer(h,t.id,n,this.replyText(h))}async call(t,n){const r=l=>typeof n[l]=="string"?n[l]:"";switch(t){case"hello":return{hostId:this.hostId,computerId:Dh,signKey:"",boxKey:"",cloud:null,name:z3,version:this.version,minApp:this.version,os:"macos",device:"MacBookPro",home:"/Users/demo",rev:this.rev,urls:[],backends:[{id:"claude",name:"Claude Code",available:!0,installed:!0,signedIn:!0,command:"claude",installHint:""},{id:"codex",name:"Codex",available:!0,installed:!0,signedIn:!0,command:"codex",installHint:""}]};case"accessRequests":return{requests:[]};case"cloudStatus":return{enabled:!1};case"usage":return Yv(Date.now());case"history":return{entries:[]};case"thread":return{entries:this.entries.filter(l=>l.botId===r("botId")&&l.threadId===r("rootId"))};case"send":{const l=this.bots.get(r("botId"));if(!l)throw R0("That bot was deleted.");const h=r("threadId")||null,d=this.add({botId:l.id,threadId:h,kind:"user",data:{text:r("text"),status:"sent",clientNonce:r("clientNonce")}});return this.converse(l,h,r("text")),{entry:d}}case"markRead":{const l=this.bots.get(r("botId"));return l&&l.unread>0&&(l.unread=0,this.emitBot(l)),{}}case"respondPermission":return this.respond(r("entryId"),r("optionId")||null);case"react":{const l=this.entries.find(d=>d.id===r("entryId"));if(!l)throw R0("That message is gone.");const h=new Set(l.data.reactions??[]);return h.delete(r("emoji"))||h.add(r("emoji")),l.data={...l.data,reactions:[...h]},this.emitEntry(l),{entry:l}}case"stop":{const l=r("botId");return this.turns.set(l,(this.turns.get(l)??0)+1),this.settle(l),{}}case"newSession":return this.add({botId:r("botId"),threadId:null,kind:"notice",data:{text:"New session",style:"divider"}}),{};case"createBot":case"updateBot":return{bot:this.saveBot(n)};case"deleteBot":{const l=r("botId");return this.bots.delete(l),this.emit({type:"bot",rev:++this.rev,bot:{id:l,rev:this.rev,deleted:!0}}),{}}case"refreshBackends":return{backends:(await this.call("hello",{})).backends};case"listDirs":return{path:"/Users/demo/code",parent:"/Users/demo",isGit:!1,dirs:[{name:"pace",path:D0,isGit:!0}]};case"memory":return{location:"",facts:[]};case"routines":return{routines:[],runs:[]};case"skills":case"connectors":case"marketSkills":case"marketConnectors":case"credentialLogins":case"composioToolkits":return{items:[]};case"devices":return{devices:[]};case"voiceStatus":return{providers:[]};case"composioStatus":return{configured:!1,keyUrl:""};case"credentialStatus":return{provider:"",onePasswordConnected:!1};default:throw R0(Rh)}}async respond(t,n){const r=this.entries.find(p=>p.id===t);if(!r||r.data.status!=="pending")return{};const l=r.data.options?.find(p=>p.optionId===n),h=!!l&&l.kind.startsWith("allow");r.data={...r.data,status:n?"answered":"cancelled",selected:n??void 0},this.emitEntry(r);const d=r.data.author??r.botId;return(async()=>(this.setStatus(d,"working",h?"Editing src/pace.js":"Typing…",r.botId),await Zv(Gv),this.add({botId:r.botId,threadId:r.threadId??null,kind:"agent",data:{text:h?lb:ob,final:!0,author:d}}),this.settle(d)))(),{}}saveBot(t){const n=t.id?this.bots.get(t.id):void 0,r=Of({...n??{createdAt:Date.now(),cwd:"cwd"in t?t.cwd||D0:""},...t,id:n?.id??crypto.randomUUID()});n&&Object.assign(n,r);const l=n??r;return this.bots.set(l.id,l),this.emitBot(l),this.botJSON(l)}}function R0(e){return{status:400,message:e}}const Zv=e=>new Promise(t=>setTimeout(t,e)),I3="2.8.0",Xv=new cb(I3),Ra=()=>()=>{},rh=()=>Promise.reject(new Error(Rh)),hb={state:{kind:"running"},local:{computerId:Dh,baseURL:"http://demo.invalid",token:"demo"},dev:!1,logPath:""},ub={ready:!0,configured:!1,busy:!1,error:null,user:null,cloudURL:null},db={supported:!1,canCheck:!1,checking:!1,availableVersion:null,staged:!1,autoCheck:!1,autoDownload:!1,lastCheck:null,error:null,waitingForApp:null},fb={platform:"darwin",appVersion:I3,computerName:z3,debugOpen:"Ship room",host:{snapshot:async()=>hb,onChange:Ra,install(){},restart(){},uninstall(){},openLog(){},async call(e,t,n,r){await new Promise(l=>setTimeout(l,30));try{return await Xv.call(n,r??{})}catch(l){throw l.status?l:{status:500,message:String(l)}}},stream(e,t,n){const r=Number(new URL(e).searchParams.get("since")??0);return Xv.subscribe(r,n)},health:async()=>({computerId:Dh,busy:!1})},account:{state:async()=>ub,onChange:Ra,signIn:rh,signOut:async()=>{},token:rh},speech:{available:!1,locales:()=>[],start(){},stop(){},onEvent:Ra},ssh:{state:async()=>({profiles:[],status:{},attachments:[]}),onChange:Ra,save:async()=>Rh,remove(){},connect(){},disconnect(){},trustHostKey(){},chooseKey:async()=>null},cloud:{request:async()=>({ok:!1,error:{status:503,code:"demo",message:Rh}})},updates:{state:async()=>db,onChange:Ra,check(){},setAutoCheck(){},setAutoDownload(){}},app:{openExternal:e=>{window.open(e,"_blank","noopener")},copy:e=>{navigator.clipboard?.writeText(e).catch(()=>{})},pickFiles:async()=>[],readClipboardFiles:async()=>[],setTraySummary(){},onCommand:Ra,openPairing(){},quit(){},resetAllData:async()=>{},setLaunchAtLogin:async()=>!1,showInDock:async()=>!0,setShowInDock:async()=>!0,launchAtLogin:async()=>!1,openSettings(){},authenticate:rh,setScreenAgent:rh,syncScreenAgent:async()=>({needsApproval:!1})}};try{for(const e of Object.keys(localStorage))e.startsWith("codync-")&&localStorage.removeItem(e);localStorage.setItem("macAccountOnboardingCompleted","true")}catch{}const pb=window.matchMedia.bind(window);window.matchMedia=e=>pb(e.includes("prefers-color-scheme: dark")?"all":e);window.codync=fb;function gb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A0={exports:{}},Fl={};var Qv;function mb(){if(Qv)return Fl;Qv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,h){var d=null;if(h!==void 0&&(d=""+h),l.key!==void 0&&(d=""+l.key),"key"in l){h={};for(var p in l)p!=="key"&&(h[p]=l[p])}else h=l;return l=h.ref,{$$typeof:e,type:r,key:d,ref:l!==void 0?l:null,props:h}}return Fl.Fragment=t,Fl.jsx=n,Fl.jsxs=n,Fl}var Jv;function vb(){return Jv||(Jv=1,A0.exports=mb()),A0.exports}var c=vb(),N0={exports:{}},Kl={},L0={exports:{}},B0={};var e_;function _b(){return e_||(e_=1,(function(e){function t(P,te){var Q=P.length;P.push(te);e:for(;0<Q;){var ce=Q-1>>>1,re=P[ce];if(0<l(re,te))P[ce]=te,P[Q]=re,Q=ce;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var te=P[0],Q=P.pop();if(Q!==te){P[0]=Q;e:for(var ce=0,re=P.length,de=re>>>1;ce<de;){var Ce=2*(ce+1)-1,je=P[Ce],D=Ce+1,J=P[D];if(0>l(je,Q))D<re&&0>l(J,je)?(P[ce]=J,P[D]=Q,ce=D):(P[ce]=je,P[Ce]=Q,ce=Ce);else if(D<re&&0>l(J,Q))P[ce]=J,P[D]=Q,ce=D;else break e}}return te}function l(P,te){var Q=P.sortIndex-te.sortIndex;return Q!==0?Q:P.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var g=[],m=[],v=1,_=null,S=3,w=!1,b=!1,k=!1,E=!1,j=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function z(P){for(var te=n(m);te!==null;){if(te.callback===null)r(m);else if(te.startTime<=P)r(m),te.sortIndex=te.expirationTime,t(g,te);else break;te=n(m)}}function F(P){if(k=!1,z(P),!b)if(n(g)!==null)b=!0,R||(R=!0,M());else{var te=n(m);te!==null&&O(F,te.startTime-P)}}var R=!1,I=-1,q=5,U=-1;function Y(){return E?!0:!(e.unstable_now()-U<q)}function $(){if(E=!1,R){var P=e.unstable_now();U=P;var te=!0;try{e:{b=!1,k&&(k=!1,V(I),I=-1),w=!0;var Q=S;try{t:{for(z(P),_=n(g);_!==null&&!(_.expirationTime>P&&Y());){var ce=_.callback;if(typeof ce=="function"){_.callback=null,S=_.priorityLevel;var re=ce(_.expirationTime<=P);if(P=e.unstable_now(),typeof re=="function"){_.callback=re,z(P),te=!0;break t}_===n(g)&&r(g),z(P)}else r(g);_=n(g)}if(_!==null)te=!0;else{var de=n(m);de!==null&&O(F,de.startTime-P),te=!1}}break e}finally{_=null,S=Q,w=!1}te=void 0}}finally{te?M():R=!1}}}var M;if(typeof A=="function")M=function(){A($)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,L=N.port2;N.port1.onmessage=$,M=function(){L.postMessage(null)}}else M=function(){j($,0)};function O(P,te){I=j(function(){P(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(P){switch(S){case 1:case 2:case 3:var te=3;break;default:te=S}var Q=S;S=te;try{return P()}finally{S=Q}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(P,te){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var Q=S;S=P;try{return te()}finally{S=Q}},e.unstable_scheduleCallback=function(P,te,Q){var ce=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ce+Q:ce):Q=ce,P){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=Q+re,P={id:v++,callback:te,priorityLevel:P,startTime:Q,expirationTime:re,sortIndex:-1},Q>ce?(P.sortIndex=Q,t(m,P),n(g)===null&&P===n(m)&&(k?(V(I),I=-1):k=!0,O(F,Q-ce))):(P.sortIndex=re,t(g,P),b||w||(b=!0,R||(R=!0,M()))),P},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(P){var te=S;return function(){var Q=S;S=te;try{return P.apply(this,arguments)}finally{S=Q}}}})(B0)),B0}var t_;function yb(){return t_||(t_=1,L0.exports=_b()),L0.exports}var O0={exports:{}},De={};var i_;function Sb(){if(i_)return De;i_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.for("react.view_transition"),w=Symbol.iterator;function b(D){return D===null||typeof D!="object"?null:(D=w&&D[w]||D["@@iterator"],typeof D=="function"?D:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,j={};function V(D,J,le){this.props=D,this.context=J,this.refs=j,this.updater=le||k}V.prototype.isReactComponent={},V.prototype.setState=function(D,J){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,J,"setState")},V.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function A(){}A.prototype=V.prototype;function z(D,J,le){this.props=D,this.context=J,this.refs=j,this.updater=le||k}var F=z.prototype=new A;F.constructor=z,E(F,V.prototype),F.isPureReactComponent=!0;var R=Array.isArray;function I(){}var q={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Y(D,J,le){var he=le.ref;return{$$typeof:e,type:D,key:J,ref:he!==void 0?he:null,props:le}}function $(D,J){return Y(D.type,J,D.props)}function M(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function N(D){var J={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(le){return J[le]})}var L=/\/+/g;function O(D,J){return typeof D=="object"&&D!==null&&D.key!=null?N(""+D.key):J.toString(36)}function P(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(I,I):(D.status="pending",D.then(function(J){D.status==="pending"&&(D.status="fulfilled",D.value=J)},function(J){D.status==="pending"&&(D.status="rejected",D.reason=J)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function te(D,J,le,he,we){var xe=typeof D;(xe==="undefined"||xe==="boolean")&&(D=null);var be=!1;if(D===null)be=!0;else switch(xe){case"bigint":case"string":case"number":be=!0;break;case"object":switch(D.$$typeof){case e:case t:be=!0;break;case v:return be=D._init,te(be(D._payload),J,le,he,we)}}if(be)return we=we(D),be=he===""?"."+O(D,0):he,R(we)?(le="",be!=null&&(le=be.replace(L,"$&/")+"/"),te(we,J,le,"",function(Re){return Re})):we!=null&&(M(we)&&(we=$(we,le+(we.key==null||D&&D.key===we.key?"":(""+we.key).replace(L,"$&/")+"/")+be)),J.push(we)),1;be=0;var pe=he===""?".":he+":";if(R(D))for(var _e=0;_e<D.length;_e++)he=D[_e],xe=pe+O(he,_e),be+=te(he,J,le,xe,we);else if(_e=b(D),typeof _e=="function")for(D=_e.call(D),_e=0;!(he=D.next()).done;)he=he.value,xe=pe+O(he,_e++),be+=te(he,J,le,xe,we);else if(xe==="object"){if(typeof D.then=="function")return te(P(D),J,le,he,we);throw J=String(D),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return be}function Q(D,J,le){if(D==null)return D;var he=[],we=0;return te(D,he,"","",function(xe){return J.call(le,xe,we++)}),he}function ce(D){if(D._status===-1){var J=D._result,le=J();le.then(function(he){(D._status===0||D._status===-1)&&(D._status=1,D._result=he,le.status===void 0&&(le.status="fulfilled",le.value=he))},function(he){(D._status===0||D._status===-1)&&(D._status=2,D._result=he,le.status===void 0&&(le.status="rejected",le.reason=he))}),D._status===-1&&(D._status=0,D._result=le)}if(D._status===1)return D._result.default;throw D._result}var re=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function de(D){var J=q.T,le={};le.types=J!==null?J.types:null,q.T=le;try{var he=D(),we=q.S;we!==null&&we(le,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(I,re)}catch(xe){re(xe)}finally{J!==null&&le.types!==null&&(J.types=le.types),q.T=J}}function Ce(D){var J=q.T;if(J!==null){var le=J.types;le===null?J.types=[D]:le.indexOf(D)===-1&&le.push(D)}else de(Ce.bind(null,D))}var je={map:Q,forEach:function(D,J,le){Q(D,function(){J.apply(this,arguments)},le)},count:function(D){var J=0;return Q(D,function(){J++}),J},toArray:function(D){return Q(D,function(J){return J})||[]},only:function(D){if(!M(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return De.Activity=_,De.Children=je,De.Component=V,De.Fragment=n,De.Profiler=l,De.PureComponent=z,De.StrictMode=r,De.Suspense=g,De.ViewTransition=S,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,De.__COMPILER_RUNTIME={__proto__:null,c:function(D){return q.H.useMemoCache(D)}},De.addTransitionType=Ce,De.cache=function(D){return function(){return D.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(D,J,le){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var he=E({},D.props),we=D.key;if(J!=null)for(xe in J.key!==void 0&&(we=""+J.key),J)!U.call(J,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&J.ref===void 0||(he[xe]=J[xe]);var xe=arguments.length-2;if(xe===1)he.children=le;else if(1<xe){for(var be=Array(xe),pe=0;pe<xe;pe++)be[pe]=arguments[pe+2];he.children=be}return Y(D.type,we,he)},De.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:h,_context:D},D},De.createElement=function(D,J,le){var he,we={},xe=null;if(J!=null)for(he in J.key!==void 0&&(xe=""+J.key),J)U.call(J,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(we[he]=J[he]);var be=arguments.length-2;if(be===1)we.children=le;else if(1<be){for(var pe=Array(be),_e=0;_e<be;_e++)pe[_e]=arguments[_e+2];we.children=pe}if(D&&D.defaultProps)for(he in be=D.defaultProps,be)we[he]===void 0&&(we[he]=be[he]);return Y(D,xe,we)},De.createRef=function(){return{current:null}},De.forwardRef=function(D){return{$$typeof:p,render:D}},De.isValidElement=M,De.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:ce}},De.memo=function(D,J){return{$$typeof:m,type:D,compare:J===void 0?null:J}},De.startTransition=de,De.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},De.use=function(D){return q.H.use(D)},De.useActionState=function(D,J,le){return q.H.useActionState(D,J,le)},De.useCallback=function(D,J){return q.H.useCallback(D,J)},De.useContext=function(D){return q.H.useContext(D)},De.useDebugValue=function(){},De.useDeferredValue=function(D,J){return q.H.useDeferredValue(D,J)},De.useEffect=function(D,J){return q.H.useEffect(D,J)},De.useEffectEvent=function(D){return q.H.useEffectEvent(D)},De.useId=function(){return q.H.useId()},De.useImperativeHandle=function(D,J,le){return q.H.useImperativeHandle(D,J,le)},De.useInsertionEffect=function(D,J){return q.H.useInsertionEffect(D,J)},De.useLayoutEffect=function(D,J){return q.H.useLayoutEffect(D,J)},De.useMemo=function(D,J){return q.H.useMemo(D,J)},De.useOptimistic=function(D,J){return q.H.useOptimistic(D,J)},De.useReducer=function(D,J,le){return q.H.useReducer(D,J,le)},De.useRef=function(D){return q.H.useRef(D)},De.useState=function(D){return q.H.useState(D)},De.useSyncExternalStore=function(D,J,le){return q.H.useSyncExternalStore(D,J,le)},De.useTransition=function(){return q.H.useTransition()},De.version="19.3.0",De}var s_;function W2(){return s_||(s_=1,O0.exports=Sb()),O0.exports}var z0={exports:{}},Qt={};var n_;function xb(){if(n_)return Qt;n_=1;var e=W2();function t(v){var _="https://react.dev/errors/"+v;if(1<arguments.length){_+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)_+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+v+"; visit "+_+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},l=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),d=Symbol.for("react.optimistic_key");function p(v,_,S){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:w==null?null:w===d?d:""+w,children:v,containerInfo:_,implementation:S}}var g=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(v,_){if(v==="font")return"";if(typeof _=="string")return _==="use-credentials"?_:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Qt.browser=function(v){return{$$typeof:h,_reason:v}},Qt.createPortal=function(v,_){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)throw Error(t(299));return p(v,_,null,S)},Qt.flushSync=function(v){var _=g.T,S=r.p;try{if(g.T=null,r.p=2,v)return v()}finally{g.T=_,r.p=S,r.d.f()}},Qt.preconnect=function(v,_){typeof v=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(v,_))},Qt.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},Qt.preinit=function(v,_){if(typeof v=="string"&&_&&typeof _.as=="string"){var S=_.as,w=m(S,_.crossOrigin),b=typeof _.integrity=="string"?_.integrity:void 0,k=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;S==="style"?r.d.S(v,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:w,integrity:b,fetchPriority:k}):S==="script"&&r.d.X(v,{crossOrigin:w,integrity:b,fetchPriority:k,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},Qt.preinitModule=function(v,_){if(typeof v=="string")if(typeof _=="object"&&_!==null){if(_.as==null||_.as==="script"){var S=m(_.as,_.crossOrigin);r.d.M(v,{crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}}else _==null&&r.d.M(v)},Qt.preload=function(v,_){if(typeof v=="string"&&typeof _=="object"&&_!==null&&typeof _.as=="string"){var S=_.as,w=m(S,_.crossOrigin);r.d.L(v,S,{crossOrigin:w,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,type:typeof _.type=="string"?_.type:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0,referrerPolicy:typeof _.referrerPolicy=="string"?_.referrerPolicy:void 0,imageSrcSet:typeof _.imageSrcSet=="string"?_.imageSrcSet:void 0,imageSizes:typeof _.imageSizes=="string"?_.imageSizes:void 0,media:typeof _.media=="string"?_.media:void 0})}},Qt.preloadModule=function(v,_){if(typeof v=="string")if(_){var S=m(_.as,_.crossOrigin);r.d.m(v,{as:typeof _.as=="string"&&_.as!=="script"?_.as:void 0,crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}else r.d.m(v)},Qt.requestFormReset=function(v){r.d.r(v)},Qt.unstable_batchedUpdates=function(v,_){return v(_)},Qt.useFormState=function(v,_,S){return g.H.useFormState(v,_,S)},Qt.useFormStatus=function(){return g.H.useHostTransitionStatus()},Qt.version="19.3.0",Qt}var r_;function U3(){if(r_)return z0.exports;r_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),z0.exports=xb(),z0.exports}var a_;function wb(){if(a_)return Kl;a_=1;var e=yb(),t=W2(),n=U3();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function h(i){for(var s=i,a=s;a&&!a.alternate;)s=a,(s.flags&4098)!==0&&(i=s.return),a=s.return;for(;s.return;)s=s.return;return s.tag===3?i:null}function d(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function g(i){if(h(i)!==i)throw Error(r(188))}function m(i){var s=i.alternate;if(!s){if(s=h(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,o=s;;){var u=a.return;if(u===null)break;var f=u.alternate;if(f===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===a)return g(u),i;if(f===o)return g(u),s;f=f.sibling}throw Error(r(188))}if(a.return!==o.return)a=u,o=f;else{for(var y=!1,C=u.child;C;){if(C===a){y=!0,a=u,o=f;break}if(C===o){y=!0,o=u,a=f;break}C=C.sibling}if(!y){for(C=f.child;C;){if(C===a){y=!0,a=f,o=u;break}if(C===o){y=!0,o=f,a=u;break}C=C.sibling}if(!y)throw Error(r(189))}}if(a.alternate!==o)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:s}function v(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=v(i),s!==null)return s;i=i.sibling}return null}function _(i,s,a,o,u,f){for(;i!==null;){if((i.tag===5||i.tag===27||i.tag===6)&&a(i,o,u,f)||(i.tag!==22||i.memoizedState===null)&&(s||i.tag!==5&&i.tag!==27)&&_(i.child,s,a,o,u,f))return!0;i=i.sibling}return!1}function S(i){for(i=i.return;i!==null;){if(i.tag===3||i.tag===5||i.tag===27)return i;i=i.return}return null}function w(i){var s=!1;for(i=i.return;i!==null&&(i.tag===4&&(s=!0),!(i.tag===3||i.tag===5||i.tag===27));)i=i.return;return s}function b(i){var s=[null,null],a=S(i);return a===null||k(s,i,a.child,{foundSelf:!1}),s}function k(i,s,a,o){for(;a!==null;){if(a===s)o.foundSelf=!0;else if(a.tag===5||a.tag===27||a.tag===6){if(o.foundSelf)return i[1]=a,!0;i[0]=a}else if((a.tag!==22||a.memoizedState===null)&&k(i,s,a.child,o))return!0;a=a.sibling}return!1}function E(i){switch(i.tag){case 5:case 27:case 6:return i.stateNode;case 3:return i.stateNode.containerInfo;default:throw Error(r(559))}}var j=null,V=null;function A(i,s,a){return i===a?!0:i===s?(j=i,!0):!1}function z(i,s,a){return i===a?(V=i,!1):i===s?(V!==null&&(j=i),!0):!1}function F(i){if(i===null)return null;do i=i===null?null:i.return;while(i&&i.tag!==5&&i.tag!==27&&i.tag!==3);return i||null}function R(i,s,a){for(var o=0,u=i;u;u=a(u))o++;u=0;for(var f=s;f;f=a(f))u++;for(;0<o-u;)i=a(i),o--;for(;0<u-o;)s=a(s),u--;for(;o--;){if(i===s||s!==null&&i===s.alternate)return i;i=a(i),s=a(s)}return null}var I=Object.assign,q=Symbol.for("react.element"),U=Symbol.for("react.transitional.element"),Y=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),O=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),Ce=Symbol.for("react.legacy_hidden"),je=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),J=Symbol.for("react.recoverable"),le=Symbol.iterator;function he(i){return i===null||typeof i!="object"?null:(i=le&&i[le]||i["@@iterator"],typeof i=="function"?i:null)}var we=Symbol.for("react.client.reference");function xe(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===we?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case $:return"Fragment";case N:return"Profiler";case M:return"StrictMode";case te:return"Suspense";case Q:return"SuspenseList";case de:return"Activity";case D:return"ViewTransition"}if(typeof i=="object")switch(i.$$typeof){case Y:return"Portal";case O:return i.displayName||"Context";case L:return(i._context.displayName||"Context")+".Consumer";case P:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ce:return s=i.displayName||null,s!==null?s:xe(i.type)||"Memo";case re:s=i._payload,i=i._init;try{return xe(i(s))}catch{}}return null}var be=Array.isArray,pe=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re={pending:!1,data:null,method:null,action:null},fi=[],pi=-1;function Bt(i){return{current:i}}function pt(i){0>pi||(i.current=fi[pi],fi[pi]=null,pi--)}function $e(i,s){pi++,fi[pi]=i.current,i.current=s}var gi=Bt(null),ge=Bt(null),Ke=Bt(null),ki=Bt(null);function Ur(i,s){switch($e(Ke,s),$e(ge,i),$e(gi,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?iv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=iv(s),i=sv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}pt(gi),$e(gi,i)}function Bs(){pt(gi),pt(ge),pt(Ke)}function Pr(i){var s=i.memoizedState;s!==null&&(ja._currentValue=s.memoizedState,$e(ki,i)),s=gi.current;var a=sv(s,i.type);s!==a&&($e(ge,i),$e(gi,a))}function rs(i){ge.current===i&&(pt(gi),pt(ge)),ki.current===i&&(pt(ki),ja._currentValue=Re)}var Qa,tr;function as(i){if(Qa===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);Qa=s&&s[1]||"",tr=-1<a.stack.indexOf(`
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
-`+Qa+i+tr}var oe=!1;function Ze(i,s){if(!i||oe)return"";oe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(s){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(fe){var W=fe}Reflect.construct(i,[],se)}else{try{se.call()}catch(fe){W=fe}se=!1;try{var X=Object.getOwnPropertyDescriptor(i.prototype,"props");Object.defineProperty(i.prototype,"props",{configurable:!0,set:function(){throw Error()}}),se=!0,new i}finally{se&&(X!==void 0?Object.defineProperty(i.prototype,"props",X):delete i.prototype.props)}}}else{try{throw Error()}catch(fe){W=fe}(se=i())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(fe){if(fe&&W&&typeof fe.stack=="string")return[fe.stack,W.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=o.DetermineComponentFrameRoot(),y=f[0],C=f[1];if(y&&C){var T=y.split(`
-`),G=C.split(`
-`);for(u=o=0;o<T.length&&!T[o].includes("DetermineComponentFrameRoot");)o++;for(;u<G.length&&!G[u].includes("DetermineComponentFrameRoot");)u++;if(o===T.length||u===G.length)for(o=T.length-1,u=G.length-1;1<=o&&0<=u&&T[o]!==G[u];)u--;for(;1<=o&&0<=u;o--,u--)if(T[o]!==G[u]){if(o!==1||u!==1)do if(o--,u--,0>u||T[o]!==G[u]){var ee=`
-`+T[o].replace(" at new "," at ");return i.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",i.displayName)),ee}while(1<=o&&0<=u);break}}}finally{oe=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?as(a):""}function ti(i,s){switch(i.tag){case 26:case 27:case 5:return as(i.type);case 16:return as("Lazy");case 13:return i.child!==s&&s!==null?as("Suspense Fallback"):as("Suspense");case 19:return as("SuspenseList");case 0:case 15:return Ze(i.type,!1);case 11:return Ze(i.type.render,!1);case 1:return Ze(i.type,!0);case 31:return as("Activity");case 30:return as("ViewTransition");default:return""}}function ls(i){try{var s="",a=null;do s+=ti(i,a),a=i,i=i.return;while(i);return s}catch(o){return`
-Error generating stack: `+o.message+`
-`+o.stack}}var ir=Object.prototype.hasOwnProperty,tu=e.unstable_scheduleCallback,iu=e.unstable_cancelCallback,aw=e.unstable_shouldYield,lw=e.unstable_requestPaint,Ei=e.unstable_now,ow=e.unstable_getCurrentPriorityLevel,k1=e.unstable_ImmediatePriority,E1=e.unstable_UserBlockingPriority,Ro=e.unstable_NormalPriority,cw=e.unstable_LowPriority,M1=e.unstable_IdlePriority,hw=e.log,uw=e.unstable_setDisableYieldValue,Ja=null,Mi=null;function fn(i){if(typeof hw=="function"&&uw(i),Mi&&typeof Mi.setStrictMode=="function")try{Mi.setStrictMode(Ja,i)}catch{}}var ji=Math.clz32?Math.clz32:pw,dw=Math.log,fw=Math.LN2;function pw(i){return i>>>=0,i===0?32:31-(dw(i)/fw|0)|0}var Ao=256,No=262144,Lo=4194304;function sr(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&-i;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Bo(i,s,a){var o=i.pendingLanes;if(o===0)return 0;var u=0,f=i.suspendedLanes,y=i.pingedLanes;i=i.warmLanes;var C=o&134217727;return C!==0?(o=C&~f,o!==0?u=sr(o):(y&=C,y!==0?u=sr(y):a||(a=C&~i,a!==0&&(u=sr(a))))):(C=o&~f,C!==0?u=sr(C):y!==0?u=sr(y):a||(a=o&~i,a!==0&&(u=sr(a)))),u===0?0:s!==0&&s!==u&&(s&f)===0&&(f=u&-u,a=s&-s,f>=a||f===32&&(a&4194048)!==0)?s:u}function el(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function j1(i,s){(s&8)!==0&&(s|=s&32);var a=i.entangledLanes;if(a!==0)for(i=i.entanglements,a&=s;0<a;){var o=31-ji(a),u=1<<o;s|=i[o],a&=~u}return s}function gw(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function T1(){var i=Lo;return Lo<<=1,(Lo&62914560)===0&&(Lo=4194304),i}function su(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function tl(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function mw(i,s,a,o,u,f){var y=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var C=i.entanglements,T=i.expirationTimes,G=i.hiddenUpdates;for(a=y&~a;0<a;){var ee=31-ji(a),se=1<<ee;C[ee]=0,T[ee]=-1;var W=G[ee];if(W!==null)for(G[ee]=null,ee=0;ee<W.length;ee++){var X=W[ee];X!==null&&(X.lane&=-536870913)}a&=~se}o!==0&&D1(i,o,0),f!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=f&~(y&~s))}function D1(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var o=31-ji(s);i.entangledLanes|=s,i.entanglements[o]=i.entanglements[o]|1073741824|a&261930}function R1(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var o=31-ji(a),u=1<<o;u&s|i[o]&s&&(i[o]|=s),a&=~u}}function A1(i,s){var a=s&-s;return a=(a&42)!==0?1:nu(a),(a&(i.suspendedLanes|s))!==0?0:a}function nu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function ru(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function N1(){var i=_e.p;return i!==0?i:(i=window.event,i===void 0?32:Uv(i.type))}function L1(i,s){var a=_e.p;try{return _e.p=i,s()}finally{_e.p=a}}var Os=Math.random().toString(36).slice(2),Ft="__reactFiber$"+Os,mi="__reactProps$"+Os,qr="__reactContainer$"+Os,B1="__reactEvents$"+Os,vw="__reactListeners$"+Os,_w="__reactHandles$"+Os,O1="__reactResources$"+Os,il="__reactMarker$"+Os,Oo="__reactLoad$"+Os;function zo(i){delete i[Ft],delete i[mi],delete i[vw],delete i[_w]}function nr(i){var s;if(s=i[Ft])return s;for(var a=i.parentNode;a;){if(s=a[qr]||a[Ft]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(i=Sv(i);i!==null;){if(a=i[Ft])return a;i=Sv(i)}return s}i=a,a=i.parentNode}return null}function Vr(i){if(i=i[Ft]||i[qr]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function sl(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function $r(i){var s=i[O1];return s||(s=i[O1]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ot(i){i[il]=!0}function z1(i){i[Oo]=void 0}var H1=new Set,I1={};function rr(i,s){Wr(i,s),Wr(i+"Capture",s)}function Wr(i,s){for(I1[i]=s,i=0;i<s.length;i++)H1.add(s[i])}var yw=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),U1={},P1={};function Sw(i){return ir.call(P1,i)?!0:ir.call(U1,i)?!1:yw.test(i)?P1[i]=!0:(U1[i]=!0,!1)}var We=!1;function q1(){var i=We;return We=!1,i}function Ho(i,s,a){if(Sw(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,a)}}function Io(i,s,a){if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,a)}}function zs(i,s,a,o){if(o===null)i.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,o)}}function Ti(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function V1(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function xw(i,s,a){var o=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,f=o.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(y){a=""+y,f.call(this,y)}}),Object.defineProperty(i,s,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function au(i){if(!i._valueTracker){var s=V1(i)?"checked":"value";i._valueTracker=xw(i,s,""+i[s])}}function $1(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),o="";return i&&(o=V1(i)?i.checked?"true":"false":i.value),i=o,i!==a?(s.setValue(i),!0):!1}var ww=/[\n"\\]/g;function Pi(i){return i.replace(ww,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function lu(i,s,a,o,u,f,y,C){i.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?i.type=y:i.removeAttribute("type"),s!=null?y==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Ti(s)):i.value!==""+Ti(s)&&(i.value=""+Ti(s)):y!=="submit"&&y!=="reset"||i.removeAttribute("value"),s!=null?y==="number"&&i.value==s?ou(i,Ti(i.value)):ou(i,Ti(s)):a!=null?ou(i,Ti(a)):o!=null&&i.removeAttribute("value"),u==null&&f!=null&&(i.defaultChecked=!!f),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?i.name=""+Ti(C):i.removeAttribute("name")}function W1(i,s,a,o,u,f,y,C){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(i.type=f),s!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||s!=null)){au(i);return}a=a!=null?""+Ti(a):"",s=s!=null?""+Ti(s):a,C||s===i.value||(i.value=s),i.defaultValue=s}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,i.checked=C?i.checked:!!o,i.defaultChecked=!!o,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.name=y),au(i)}function ou(i,s){i.defaultValue!==""+s&&(i.defaultValue=""+s)}function Fr(i,s,a,o){if(i=i.options,s){s={};for(var u=0;u<a.length;u++)s["$"+a[u]]=!0;for(a=0;a<i.length;a++)u=s.hasOwnProperty("$"+i[a].value),i[a].selected!==u&&(i[a].selected=u),u&&o&&(i[a].defaultSelected=!0)}else{for(a=""+Ti(a),s=null,u=0;u<i.length;u++){if(i[u].value===a){i[u].selected=!0,o&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function F1(i,s,a){if(s!=null&&(s=""+Ti(s),s!==i.value&&(i.value=s),a==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=a!=null?""+Ti(a):""}function K1(i,s,a,o){if(s==null){if(o!=null){if(a!=null)throw Error(r(92));if(be(o)){if(1<o.length)throw Error(r(93));o=o[0]}a=o}a==null&&(a=""),s=a}a=Ti(s),i.defaultValue=a,o=i.textContent,o===a&&o!==""&&o!==null&&(i.value=o),au(i)}function Kr(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var bw=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Y1(i,s,a){var o=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":o?i.setProperty(s,a):typeof a!="number"||a===0||bw.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function G1(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?i.setProperty(o,""):o==="float"?i.cssFloat="":i[o]="",We=!0);for(var u in s)o=s[u],s.hasOwnProperty(u)&&a[u]!==o&&(Y1(i,u,o),We=!0)}else for(var f in s)s.hasOwnProperty(f)&&Y1(i,f,s[f])}function cu(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Cw=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),kw=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Uo(i){return kw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function gs(){}var hu=null;function uu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Yr=null,Gr=null;function Z1(i){var s=Vr(i);if(s&&(i=s.stateNode)){var a=i[mi]||null;e:switch(i=s.stateNode,s.type){case"input":if(lu(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Pi(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var o=a[s];if(o!==i&&o.form===i.form){var u=o[mi]||null;if(!u)throw Error(r(90));lu(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<a.length;s++)o=a[s],o.form===i.form&&$1(o)}break e;case"textarea":F1(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&Fr(i,!!a.multiple,s,!1)}}}var du=!1;function X1(i,s,a){if(du)return i(s,a);du=!0;try{var o=i(s);return o}finally{if(du=!1,(Yr!==null||Gr!==null)&&(Uc(),Yr&&(s=Yr,i=Gr,Gr=Yr=null,Z1(s),i)))for(s=0;s<i.length;s++)Z1(i[s])}}function nl(i,s){var a=i.stateNode;if(a===null)return null;var o=a[mi]||null;if(o===null)return null;a=o[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(i=i.type,o=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!o;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Hs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fu=!1;if(Hs)try{var rl={};Object.defineProperty(rl,"passive",{get:function(){fu=!0}}),window.addEventListener("test",rl,rl),window.removeEventListener("test",rl,rl)}catch{fu=!1}var pn=null,pu=null,Po=null;function Q1(){if(Po)return Po;var i,s=pu,a=s.length,o,u="value"in pn?pn.value:pn.textContent,f=u.length;for(i=0;i<a&&s[i]===u[i];i++);var y=a-i;for(o=1;o<=y&&s[a-o]===u[f-o];o++);return Po=u.slice(i,1<o?1-o:void 0)}function qo(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Vo(){return!0}function J1(){return!1}function ri(i){function s(a,o,u,f,y){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var C in i)i.hasOwnProperty(C)&&(a=i[C],this[C]=a?a(f):f[C]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Vo:J1,this.isPropagationStopped=J1,this}return I(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Vo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Vo)},persist:function(){},isPersistent:Vo}),s}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$o=ri(gn),al=I({},gn,{view:0,detail:0}),Ew=ri(al),gu,mu,ll,Wo=I({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_u,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==ll&&(ll&&i.type==="mousemove"?(gu=i.screenX-ll.screenX,mu=i.screenY-ll.screenY):mu=gu=0,ll=i),gu)},movementY:function(i){return"movementY"in i?i.movementY:mu}}),ep=ri(Wo),Mw=I({},Wo,{dataTransfer:0}),jw=ri(Mw),Tw=I({},al,{relatedTarget:0}),vu=ri(Tw),Dw=I({},gn,{animationName:0,elapsedTime:0,pseudoElement:0}),Rw=ri(Dw),Aw=I({},gn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Nw=ri(Aw),Lw=I({},gn,{data:0}),tp=ri(Lw),Bw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ow={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},zw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hw(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=zw[i])?!!s[i]:!1}function _u(){return Hw}var Iw=I({},al,{key:function(i){if(i.key){var s=Bw[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=qo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Ow[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_u,charCode:function(i){return i.type==="keypress"?qo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?qo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Uw=ri(Iw),Pw=I({},Wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ip=ri(Pw),qw=I({},gn,{submitter:0}),Vw=ri(qw),$w=I({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_u}),Ww=ri($w),Fw=I({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kw=ri(Fw),Yw=I({},Wo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Gw=ri(Yw),Zw=I({},gn,{newState:0,oldState:0,source:0}),Xw=ri(Zw),Qw=[9,13,27,32],yu=Hs&&"CompositionEvent"in window,ol=null;Hs&&"documentMode"in document&&(ol=document.documentMode);var Jw=Hs&&"TextEvent"in window&&!ol,sp=Hs&&(!yu||ol&&8<ol&&11>=ol),np=" ",rp=!1;function ap(i,s){switch(i){case"keyup":return Qw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lp(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Zr=!1;function e4(i,s){switch(i){case"compositionend":return lp(s);case"keypress":return s.which!==32?null:(rp=!0,np);case"textInput":return i=s.data,i===np&&rp?null:i;default:return null}}function t4(i,s){if(Zr)return i==="compositionend"||!yu&&ap(i,s)?(i=Q1(),Po=pu=pn=null,Zr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return sp&&s.locale!=="ko"?null:s.data;default:return null}}var i4={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function op(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!i4[i.type]:s==="textarea"}function cp(i,s,a,o){Yr?Gr?Gr.push(o):Gr=[o]:Yr=o,s=Fc(s,"onChange"),0<s.length&&(a=new $o("onChange","change",null,a,o),i.push({event:a,listeners:s}))}var cl=null,hl=null;function s4(i){Zm(i,0)}function Fo(i){var s=sl(i);if($1(s))return i}function hp(i,s){if(i==="change")return s}var up=!1;if(Hs){var Su;if(Hs){var xu="oninput"in document;if(!xu){var dp=document.createElement("div");dp.setAttribute("oninput","return;"),xu=typeof dp.oninput=="function"}Su=xu}else Su=!1;up=Su&&(!document.documentMode||9<document.documentMode)}function fp(){cl&&(cl.detachEvent("onpropertychange",pp),hl=cl=null)}function pp(i){if(i.propertyName==="value"&&Fo(hl)){var s=[];cp(s,hl,i,uu(i)),X1(s4,s)}}function n4(i,s,a){i==="focusin"?(fp(),cl=s,hl=a,cl.attachEvent("onpropertychange",pp)):i==="focusout"&&fp()}function r4(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Fo(hl)}function a4(i,s){if(i==="click")return Fo(s)}function l4(i,s){if(i==="input"||i==="change")return Fo(s)}function o4(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Di=typeof Object.is=="function"?Object.is:o4;function ul(i,s){if(Di(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),o=Object.keys(s);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!ir.call(s,u)||!Di(i[u],s[u]))return!1}return!0}function wu(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function gp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function mp(i,s){var a=gp(i);i=0;for(var o;a;){if(a.nodeType===3){if(o=i+a.textContent.length,i<=s&&o>=s)return{node:a,offset:s-i};i=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=gp(a)}}function vp(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?vp(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function _p(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=wu(i.document);s instanceof i.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)i=s.contentWindow;else break;s=wu(i.document)}return s}function bu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var c4=Hs&&"documentMode"in document&&11>=document.documentMode,Xr=null,Cu=null,dl=null,ku=!1;function yp(i,s,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ku||Xr==null||Xr!==wu(o)||(o=Xr,"selectionStart"in o&&bu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),dl&&ul(dl,o)||(dl=o,o=Fc(Cu,"onSelect"),0<o.length&&(s=new $o("onSelect","select",null,s,a),i.push({event:s,listeners:o}),s.target=Xr)))}function ar(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var Qr={animationend:ar("Animation","AnimationEnd"),animationiteration:ar("Animation","AnimationIteration"),animationstart:ar("Animation","AnimationStart"),transitionrun:ar("Transition","TransitionRun"),transitionstart:ar("Transition","TransitionStart"),transitioncancel:ar("Transition","TransitionCancel"),transitionend:ar("Transition","TransitionEnd")},Eu={},Sp={};Hs&&(Sp=document.createElement("div").style,"AnimationEvent"in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),"TransitionEvent"in window||delete Qr.transitionend.transition);function lr(i){if(Eu[i])return Eu[i];if(!Qr[i])return i;var s=Qr[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in Sp)return Eu[i]=s[a];return i}var xp=lr("animationend"),wp=lr("animationiteration"),bp=lr("animationstart"),h4=lr("transitionrun"),u4=lr("transitionstart"),d4=lr("transitioncancel"),Cp=lr("transitionend"),kp=new Map,Mu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Mu.push("scrollEnd");function os(i,s){kp.set(i,s),rr(s,[i])}var f4=0;function Is(i,s){if(i.name!=null&&i.name!=="auto")return i.name;if(s.autoName!==null)return s.autoName;i=ds.identifierPrefix;var a=f4++;return i="_"+i+"t_"+a.toString(32)+"_",s.autoName=i}function Ep(i){if(i==null||typeof i=="string")return i;var s=null,a=_a;if(a!==null)for(var o=0;o<a.length;o++){var u=i[a[o]];if(u!=null){if(u==="none")return"none";s=s==null?u:s+(" "+u)}}return s??i.default}function Us(i,s){return i=Ep(i),s=Ep(s),s==null?i==="auto"?null:i:s==="auto"?null:s}var Ko=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},qi=[],Jr=0,ju=0;function Yo(){for(var i=Jr,s=ju=Jr=0;s<i;){var a=qi[s];qi[s++]=null;var o=qi[s];qi[s++]=null;var u=qi[s];qi[s++]=null;var f=qi[s];if(qi[s++]=null,o!==null&&u!==null){var y=o.pending;y===null?u.next=u:(u.next=y.next,y.next=u),o.pending=u}f!==0&&Mp(a,u,f)}}function Go(i,s,a,o){qi[Jr++]=i,qi[Jr++]=s,qi[Jr++]=a,qi[Jr++]=o,ju|=o,i.lanes|=o,i=i.alternate,i!==null&&(i.lanes|=o)}function Tu(i,s,a,o){return Go(i,s,a,o),Zo(i)}function or(i,s){return Go(i,null,null,s),Zo(i)}function Mp(i,s,a){i.lanes|=a;var o=i.alternate;o!==null&&(o.lanes|=a);for(var u=!1,f=i.return;f!==null;)f.childLanes|=a,o=f.alternate,o!==null&&(o.childLanes|=a),f.tag===22&&(i=f.stateNode,i===null||i._visibility&1||(u=!0)),i=f,f=f.return;return i.tag===3?(f=i.stateNode,u&&s!==null&&(u=31-ji(a),i=f.hiddenUpdates,o=i[u],o===null?i[u]=[s]:o.push(s),s.lane=a|536870912),f):null}function Zo(i){if(50<Ll)throw Ll=0,Ic=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var ea={};function p4(i,s,a,o){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vi(i,s,a,o){return new p4(i,s,a,o)}function Du(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ps(i,s){var a=i.alternate;return a===null?(a=vi(i.tag,s,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=s,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&1206910976,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,s=i.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function jp(i,s){i.flags&=1206910978;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,s=a.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Xo(i,s,a,o,u,f){var y=0;if(o=i,typeof o=="function")Du(o)&&(y=1);else if(typeof o=="string")y=q5(i,a,gi.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(o){case de:return i=vi(31,a,s,u),i.elementType=de,i.lanes=f,i;case $:return cr(a.children,u,f,s);case M:y=8,u|=24;break;case N:return i=vi(12,a,s,u|2),i.elementType=N,i.lanes=f,i;case te:return i=vi(13,a,s,u),i.elementType=te,i.lanes=f,i;case Q:return i=vi(19,a,s,u),i.elementType=Q,i.lanes=f,i;case Ce:case D:return i=u|32,i=vi(30,a,s,i),i.elementType=D,i.lanes=f,i.stateNode={autoName:null,paired:null,clones:null,ref:null},i;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case O:y=10;break e;case L:y=9;break e;case P:y=11;break e;case ce:y=14;break e;case re:y=16,o=null;break e}y=29,a=Error(r(130,i===null?"null":typeof i,"")),o=null}return s=vi(y,a,s,u),s.elementType=i,s.type=o,s.lanes=f,s}function cr(i,s,a,o){return i=vi(7,i,o,s),i.lanes=a,i}function Ru(i,s,a){return i=vi(6,i,null,s),i.lanes=a,i}function Tp(i){var s=vi(18,null,null,0);return s.stateNode=i,s}function Au(i,s,a){return s=vi(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Dp=new WeakMap;function Vi(i,s){if(typeof i=="object"&&i!==null){var a=Dp.get(i);return a!==void 0?a:(s={value:i,source:s,stack:ls(s)},Dp.set(i,s),s)}return{value:i,source:s,stack:ls(s)}}var ta=[],ia=0,Qo=null,fl=0,$i=[],Wi=0,mn=null,ms=1,vs="";function qs(i,s){ta[ia++]=fl,ta[ia++]=Qo,Qo=i,fl=s}function Rp(i,s,a){$i[Wi++]=ms,$i[Wi++]=vs,$i[Wi++]=mn,mn=i;var o=ms;i=vs;var u=32-ji(o)-1;o&=~(1<<u),a+=1;var f=32-ji(s)+u;if(30<f){var y=u-u%5;f=(o&(1<<y)-1).toString(32),o>>=y,u-=y,ms=1<<32-ji(s)+u|a<<u|o,vs=f+i}else ms=1<<f|a<<u|o,vs=i}function Jo(i){i.return!==null&&(qs(i,1),Rp(i,1,0))}function Nu(i){for(;i===Qo;)Qo=ta[--ia],ta[ia]=null,fl=ta[--ia],ta[ia]=null;for(;i===mn;)mn=$i[--Wi],$i[Wi]=null,vs=$i[--Wi],$i[Wi]=null,ms=$i[--Wi],$i[Wi]=null}function Ap(i,s){$i[Wi++]=ms,$i[Wi++]=vs,$i[Wi++]=mn,ms=s.id,vs=s.overflow,mn=i}var zt=null,nt=null,Oe=!1,vn=null,Fi=!1,Lu=Error(r(519));function _n(i){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pl(Vi(s,i)),Lu}function Np(i){var s=i.stateNode,a=i.type,o=i.memoizedProps;switch(s[Ft]=i,s[mi]=o,a){case"dialog":Ue("cancel",s),Ue("close",s);break;case"iframe":case"object":case"embed":Ue("load",s);break;case"video":case"audio":for(a=0;a<Ol.length;a++)Ue(Ol[a],s);break;case"source":Ue("error",s);break;case"img":case"image":case"link":Ue("error",s),Ue("load",s);break;case"details":Ue("toggle",s);break;case"input":Ue("invalid",s),W1(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Ue("invalid",s);break;case"textarea":Ue("invalid",s),K1(s,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||o.suppressHydrationWarning===!0||ev(s.textContent,a)?(o.popover!=null&&(Ue("beforetoggle",s),Ue("toggle",s)),o.onScroll!=null&&Ue("scroll",s),o.onScrollEnd!=null&&Ue("scrollend",s),o.onClick!=null&&(s.onclick=gs),s=!0):s=!1,s||_n(i,!0)}function ec(i){for(zt=i.return;zt;)switch(zt.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:zt=zt.return}}function sa(i){if(i!==zt)return!1;if(!Oe)return ec(i),Oe=!0,!1;var s=i.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||h0(i.type,i.memoizedProps)),a=!a),a&&nt&&_n(i),ec(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));nt=yv(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));nt=yv(i)}else s===27?(s=nt,Ln(i.type)?(i=y0,y0=null,nt=i):nt=s):nt=zt?Yi(i.stateNode.nextSibling):null;return!0}function hr(){nt=zt=null,Oe=!1}function Bu(){var i=vn;return i!==null&&(Si===null?Si=i:Si.push.apply(Si,i),vn=null),i}function pl(i){vn===null?vn=[i]:vn.push(i)}var Ou=Bt(null),ur=null,Vs=null;function yn(i,s,a){$e(Ou,s._currentValue),s._currentValue=a}function $s(i){i._currentValue=Ou.current,pt(Ou)}function tc(i,s,a){for(;i!==null;){var o=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),i===a)break;i=i.return}}function zu(i,s,a,o){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var C=f;f=u;for(var T=0;T<s.length;T++)if(C.context===s[T]){f.lanes|=a,C=f.alternate,C!==null&&(C.lanes|=a),tc(f.return,a,i),o||(y=null);break e}f=C.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(r(341));y.lanes|=a,f=y.alternate,f!==null&&(f.lanes|=a),tc(y,a,i),y=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=a,y=u.alternate,y!==null&&(y.lanes|=a),tc(u.return,a,i),y=u.child,y=y!==null?y.sibling:null):y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===i){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function dr(i,s,a,o){i=null;for(var u=s,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(r(387));if(y=y.memoizedProps,y!==null){var C=u.type;Di(u.pendingProps.value,y.value)||(i!==null?i.push(C):i=[C])}}else if(u===ki.current){if(y=u.alternate,y===null)throw Error(r(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(ja):i=[ja])}u=u.return}return i!==null&&zu(s,i,a,o),s.flags|=262144,i!==null}function ic(i){for(i=i.firstContext;i!==null;){if(!Di(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function fr(i){ur=i,Vs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Kt(i){return Lp(ur,i)}function sc(i,s){return ur===null&&fr(i),Lp(i,s)}function Lp(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},Vs===null){if(i===null)throw Error(r(308));Vs=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Vs=Vs.next=s;return a}var g4=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,o){i.push(o)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},m4=e.unstable_scheduleCallback,v4=e.unstable_NormalPriority,xt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hu(){return{controller:new g4,data:new Map,refCount:0}}function gl(i){i.refCount--,i.refCount===0&&m4(v4,function(){i.controller.abort()})}function Bp(i,s){if((i.pendingLanes&4194048)!==0){var a=i.transitionTypes;for(a===null&&(a=i.transitionTypes=[]),i=0;i<s.length;i++){var o=s[i];a.indexOf(o)===-1&&a.push(o)}}}var ml=null;function _4(i){var s=i.transitionTypes;return i.transitionTypes=null,s}var vl=null,Iu=0,pr=0,na=null;function y4(i,s){if(vl===null){var a=vl=[];Iu=0,pr=t0(),na={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Iu++,s.then(Op,Op),s}function Op(){if(--Iu===0&&(ml=null,vl!==null)){na!==null&&(na.status="fulfilled");var i=vl;vl=null,pr=0,na=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function S4(i,s){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return i.then(function(){o.status="fulfilled",o.value=s;for(var u=0;u<a.length;u++)(0,a[u])(s)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var zp=pe.S;pe.S=function(i,s){if(Tm=Ei(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&y4(i,s),ml!==null)for(var a=wa;a!==null;)Bp(a,ml),a=a.next;if(a=i.types,a!==null){for(var o=wa;o!==null;)Bp(o,a),o=o.next;if(pr!==0){o=ml,o===null&&(o=ml=[]);for(var u=0;u<a.length;u++){var f=a[u];o.indexOf(f)===-1&&o.push(f)}}}zp!==null&&zp(i,s)};var gr=Bt(null);function Uu(){var i=gr.current;return i!==null?i:st.pooledCache}function nc(i,s){s===null?$e(gr,gr.current):$e(gr,s.pool)}function Hp(){var i=Uu();return i===null?null:{parent:xt._currentValue,pool:i}}var ra=Error(r(460)),Pu=Error(r(474)),rc=Error(r(542)),ac={then:function(){}};function Ip(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Up(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(gs,gs),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,qp(i),i===void 0&&!("reason"in s)?Error(r(600)):i;default:if(typeof s.status=="string")s.then(gs,gs);else{if(i=st,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(o){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=o}},function(o){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,qp(i),i}throw vr=s,ra}}function mr(i){try{var s=i._init;return s(i._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(vr=a,ra):a}}var vr=null;function Pp(){if(vr===null)throw Error(r(459));var i=vr;return vr=null,i}function qp(i){if(i===ra||i===rc)throw Error(r(483))}var aa=null,_l=0;function lc(i){var s=_l;return _l+=1,aa===null&&(aa=[]),Up(aa,i,s)}function Sn(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function oc(i,s){throw s.$$typeof===q?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Vp(i){function s(K,H){if(i){var Z=K.deletions;Z===null?(K.deletions=[H],K.flags|=16):Z.push(H)}}function a(K,H){if(!i)return null;for(;H!==null;)s(K,H),H=H.sibling;return null}function o(K){for(var H=new Map;K!==null;)K.key===null?H.set(K.index,K):H.set(K.key,K),K=K.sibling;return H}function u(K,H){return K=Ps(K,H),K.index=0,K.sibling=null,K}function f(K,H,Z){return K.index=Z,i?(Z=K.alternate,Z!==null?(Z=Z.index,Z<H?(K.flags|=2,H):Z):(K.flags|=134217730,H)):(K.flags|=1048576,H)}function y(K){return i&&K.alternate===null&&(K.flags|=134217730),K}function C(K,H,Z,ie){return H===null||H.tag!==6?(H=Ru(Z,K.mode,ie),H.return=K,H):(H=u(H,Z),H.return=K,H)}function T(K,H,Z,ie){var ve=Z.type;return ve===$?(K=ee(K,H,Z.props.children,ie,Z.key),Sn(K,Z),K):H!==null&&(H.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===re&&mr(ve)===H.type)?(H=u(H,Z.props),Sn(H,Z),H.return=K,H):(H=Xo(Z.type,Z.key,Z.props,null,K.mode,ie),Sn(H,Z),H.return=K,H)}function G(K,H,Z,ie){return H===null||H.tag!==4||H.stateNode.containerInfo!==Z.containerInfo||H.stateNode.implementation!==Z.implementation?(H=Au(Z,K.mode,ie),H.return=K,H):(H=u(H,Z.children||[]),H.return=K,H)}function ee(K,H,Z,ie,ve){return H===null||H.tag!==7?(H=cr(Z,K.mode,ie,ve),H.return=K,H):(H=u(H,Z),H.return=K,H)}function se(K,H,Z){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Ru(""+H,K.mode,Z),H.return=K,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case U:return Z=Xo(H.type,H.key,H.props,null,K.mode,Z),Sn(Z,H),Z.return=K,Z;case Y:return H=Au(H,K.mode,Z),H.return=K,H;case re:return H=mr(H),se(K,H,Z)}if(be(H)||he(H))return H=cr(H,K.mode,Z,null),H.return=K,H;if(typeof H.then=="function")return se(K,lc(H),Z);if(H.$$typeof===O)return se(K,sc(K,H),Z);oc(K,H)}return null}function W(K,H,Z,ie){var ve=H!==null?H.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return ve!==null?null:C(K,H,""+Z,ie);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case U:return Z.key===ve?T(K,H,Z,ie):null;case Y:return Z.key===ve?G(K,H,Z,ie):null;case re:return Z=mr(Z),W(K,H,Z,ie)}if(be(Z)||he(Z))return ve!==null?null:ee(K,H,Z,ie,null);if(typeof Z.then=="function")return W(K,H,lc(Z),ie);if(Z.$$typeof===O)return W(K,H,sc(K,Z),ie);oc(K,Z)}return null}function X(K,H,Z,ie,ve){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return K=K.get(Z)||null,C(H,K,""+ie,ve);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case U:return K=K.get(ie.key===null?Z:ie.key)||null,T(H,K,ie,ve);case Y:return K=K.get(ie.key===null?Z:ie.key)||null,G(H,K,ie,ve);case re:return ie=mr(ie),X(K,H,Z,ie,ve)}if(be(ie)||he(ie))return K=K.get(Z)||null,ee(H,K,ie,ve,null);if(typeof ie.then=="function")return X(K,H,Z,lc(ie),ve);if(ie.$$typeof===O)return X(K,H,Z,sc(H,ie),ve);oc(H,ie)}return null}function fe(K,H,Z,ie){for(var ve=null,qe=null,Se=H,Me=H=0,Ct=null;Se!==null&&Me<Z.length;Me++){Se.index>Me?(Ct=Se,Se=null):Ct=Se.sibling;var Ve=W(K,Se,Z[Me],ie);if(Ve===null){Se===null&&(Se=Ct);break}i&&Se&&Ve.alternate===null&&s(K,Se),H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve,Se=Ct}if(Me===Z.length)return a(K,Se),Oe&&qs(K,Me),ve;if(Se===null){for(;Me<Z.length;Me++)Se=se(K,Z[Me],ie),Se!==null&&(H=f(Se,H,Me),qe===null?ve=Se:qe.sibling=Se,qe=Se);return Oe&&qs(K,Me),ve}for(Se=o(Se);Me<Z.length;Me++)Ct=X(Se,K,Me,Z[Me],ie),Ct!==null&&(i&&(Ve=Ct.alternate,Ve!==null&&Se.delete(Ve.key===null?Me:Ve.key)),H=f(Ct,H,Me),qe===null?ve=Ct:qe.sibling=Ct,qe=Ct);return i&&Se.forEach(function(In){return s(K,In)}),Oe&&qs(K,Me),ve}function ye(K,H,Z,ie){if(Z==null)throw Error(r(151));for(var ve=null,qe=null,Se=H,Me=H=0,Ct=null,Ve=Z.next();Se!==null&&!Ve.done;Me++,Ve=Z.next()){Se.index>Me?(Ct=Se,Se=null):Ct=Se.sibling;var In=W(K,Se,Ve.value,ie);if(In===null){Se===null&&(Se=Ct);break}i&&Se&&In.alternate===null&&s(K,Se),H=f(In,H,Me),qe===null?ve=In:qe.sibling=In,qe=In,Se=Ct}if(Ve.done)return a(K,Se),Oe&&qs(K,Me),ve;if(Se===null){for(;!Ve.done;Me++,Ve=Z.next())Ve=se(K,Ve.value,ie),Ve!==null&&(H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve);return Oe&&qs(K,Me),ve}for(Se=o(Se);!Ve.done;Me++,Ve=Z.next())Ve=X(Se,K,Me,Ve.value,ie),Ve!==null&&(i&&(Ct=Ve.alternate,Ct!==null&&Se.delete(Ct.key===null?Me:Ct.key)),H=f(Ve,H,Me),qe===null?ve=Ve:qe.sibling=Ve,qe=Ve);return i&&Se.forEach(function(eb){return s(K,eb)}),Oe&&qs(K,Me),ve}function Be(K,H,Z,ie){if(typeof Z=="object"&&Z!==null&&Z.type===$&&Z.key===null&&Z.props.ref===void 0&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case U:e:{for(var ve=Z.key;H!==null;){if(H.key===ve){if(ve=Z.type,ve===$){if(H.tag===7){a(K,H.sibling),ie=u(H,Z.props.children),Sn(ie,Z),ie.return=K,K=ie;break e}}else if(H.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===re&&mr(ve)===H.type){a(K,H.sibling),ie=u(H,Z.props),Sn(ie,Z),ie.return=K,K=ie;break e}a(K,H);break}else s(K,H);H=H.sibling}Z.type===$?(ie=cr(Z.props.children,K.mode,ie,Z.key),Sn(ie,Z),ie.return=K,K=ie):(ie=Xo(Z.type,Z.key,Z.props,null,K.mode,ie),Sn(ie,Z),ie.return=K,K=ie)}return y(K);case Y:e:{for(ve=Z.key;H!==null;){if(H.key===ve)if(H.tag===4&&H.stateNode.containerInfo===Z.containerInfo&&H.stateNode.implementation===Z.implementation){a(K,H.sibling),ie=u(H,Z.children||[]),ie.return=K,K=ie;break e}else{a(K,H);break}else s(K,H);H=H.sibling}ie=Au(Z,K.mode,ie),ie.return=K,K=ie}return y(K);case re:return Z=mr(Z),Be(K,H,Z,ie)}if(be(Z))return fe(K,H,Z,ie);if(he(Z)){if(ve=he(Z),typeof ve!="function")throw Error(r(150));return Z=ve.call(Z),ye(K,H,Z,ie)}if(typeof Z.then=="function")return Be(K,H,lc(Z),ie);if(Z.$$typeof===O)return Be(K,H,sc(K,Z),ie);oc(K,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,H!==null&&H.tag===6?(a(K,H.sibling),ie=u(H,Z),ie.return=K,K=ie):(a(K,H),ie=Ru(Z,K.mode,ie),ie.return=K,K=ie),y(K)):a(K,H)}return function(K,H,Z,ie){try{_l=0;var ve=Be(K,H,Z,ie);return aa=null,ve}catch(Se){if(Se===ra||Se===rc)throw Se;var qe=vi(29,Se,null,K.mode);return qe.lanes=ie,qe.return=K,qe}}}var _r=Vp(!0),$p=Vp(!1),xn=!1;function qu(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vu(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function wn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function bn(i,s,a){var o=i.updateQueue;if(o===null)return null;if(o=o.shared,(Ye&2)!==0){var u=o.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),o.pending=s,s=Zo(i),Mp(i,null,a),s}return Go(i,o,s,a),Zo(i)}function yl(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var o=s.lanes;o&=i.pendingLanes,a|=o,s.lanes=a,R1(i,a)}}function $u(i,s){var a=i.updateQueue,o=i.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,a=a.next}while(a!==null);f===null?u=f=s:f=f.next=s}else u=f=s;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var Wu=!1;function Sl(){if(Wu){var i=na;if(i!==null)throw i}}function xl(i,s,a,o){Wu=!1;var u=i.updateQueue;xn=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var T=C,G=T.next;T.next=null,y===null?f=G:y.next=G,y=T;var ee=i.alternate;ee!==null&&(ee=ee.updateQueue,C=ee.lastBaseUpdate,C!==y&&(C===null?ee.firstBaseUpdate=G:C.next=G,ee.lastBaseUpdate=T))}if(f!==null){var se=u.baseState;y=0,ee=G=T=null,C=f;do{var W=C.lane&-536870913,X=W!==C.lane;if(X?(Pe&W)===W:(o&W)===W){W!==0&&W===pr&&(Wu=!0),ee!==null&&(ee=ee.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var fe=i,ye=C;W=s;var Be=a;switch(ye.tag){case 1:if(fe=ye.payload,typeof fe=="function"){se=fe.call(Be,se,W);break e}se=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ye.payload,W=typeof fe=="function"?fe.call(Be,se,W):fe,W==null)break e;se=I({},se,W);break e;case 2:xn=!0}}W=C.callback,W!==null&&(i.flags|=64,X&&(i.flags|=8192),X=u.callbacks,X===null?u.callbacks=[W]:X.push(W))}else X={lane:W,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ee===null?(G=ee=X,T=se):ee=ee.next=X,y|=W;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;X=C,C=X.next,X.next=null,u.lastBaseUpdate=X,u.shared.pending=null}}while(!0);ee===null&&(T=se),u.baseState=T,u.firstBaseUpdate=G,u.lastBaseUpdate=ee,f===null&&(u.shared.lanes=0),Dn|=y,i.lanes=y,i.memoizedState=se}}function Wp(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Fp(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)Wp(a[i],s)}var Cn=Bt(null),cc=Bt(0);function Kp(i,s){i=Gs,$e(cc,i),$e(Cn,s),Gs=i|s.baseLanes}function Fu(){$e(cc,Gs),$e(Cn,Cn.current)}function Ku(){Gs=cc.current,pt(Cn),pt(cc)}var Yt=Bt(null),ii=null;function kn(i){var s=i.alternate;$e(Gt,Gt.current&1),$e(Yt,i),ii===null&&(s===null||Cn.current!==null||s.memoizedState!==null)&&(ii=i)}function Yu(i){$e(Gt,Gt.current),$e(Yt,i),ii===null&&(ii=i)}function Yp(i){i.tag===22?($e(Gt,Gt.current),$e(Yt,i),ii===null&&(ii=i)):En()}function En(){$e(Gt,Gt.current),$e(Yt,Yt.current)}function Ri(i){pt(Yt),ii===i&&(ii=null),pt(Gt)}var Gt=Bt(0);function wl(i,s){$e(Yt,Yt.current),$e(Gt,s)}function Gu(i){pt(Gt),pt(Yt),ii===i&&(ii=null)}function hc(i){for(var s=i;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||v0(a)||_0(a)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!=="independent"){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ws=0,Le=null,tt=null,wt=null,uc=!1,la=!1,yr=!1,dc=0,bl=0,oa=null,x4=0;function gt(){throw Error(r(321))}function Zu(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!Di(i[a],s[a]))return!1;return!0}function Xu(i,s,a,o,u,f){return Ws=f,Le=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,pe.H=i===null||i.memoizedState===null?Rg:Ag,yr=!1,f=a(o,u),yr=!1,la&&(f=Zp(s,a,o,u)),Gp(i),f}function Gp(i){pe.H=yc;var s=tt!==null&&tt.next!==null;if(Ws=0,wt=tt=Le=null,uc=!1,bl=0,oa=null,s)throw Error(r(300));i===null||bt||(i=i.dependencies,i!==null&&ic(i)&&(bt=!0))}function Zp(i,s,a,o){Le=i;var u=0;do{if(la&&(oa=null),bl=0,la=!1,25<=u)throw Error(r(301));if(u+=1,wt=tt=null,i.updateQueue!=null){var f=i.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}pe.H=T4,f=s(a,o)}while(la);return f}function w4(){var i=pe.H,s=i.useState()[0];return s=typeof s.then=="function"?Cl(s):s,i=i.useState()[0],(tt!==null?tt.memoizedState:null)!==i&&(Le.flags|=1024),s}function Qu(){var i=dc!==0;return dc=0,i}function Ju(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function ed(i){if(uc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}uc=!1}Ws=0,wt=tt=Le=null,la=!1,bl=dc=0,oa=null}function ai(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?Le.memoizedState=wt=i:wt=wt.next=i,wt}function yt(){if(tt===null){var i=Le.alternate;i=i!==null?i.memoizedState:null}else i=tt.next;var s=wt===null?Le.memoizedState:wt.next;if(s!==null)wt=s,tt=i;else{if(i===null)throw Le.alternate===null?Error(r(467)):Error(r(310));tt=i,i={memoizedState:tt.memoizedState,baseState:tt.baseState,baseQueue:tt.baseQueue,queue:tt.queue,next:null},wt===null?Le.memoizedState=wt=i:wt=wt.next=i}return wt}function fc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Cl(i){var s=bl;return bl+=1,oa===null&&(oa=[]),i=Up(oa,i,s),s=Le,(wt===null?s.memoizedState:wt.next)===null&&(s=s.alternate,pe.H=s===null||s.memoizedState===null?Rg:Ag),i}function pc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Cl(i);if(i.$$typeof===J)return;if(i.$$typeof===O)return Kt(i)}throw Error(r(438,String(i)))}function td(i){var s=null,a=Le.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var o=Le.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=fc(),Le.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),o=0;o<i;o++)a[o]=je;return s.index++,a}function Fs(i,s){return typeof s=="function"?s(i):s}function gc(i){var s=yt();return id(s,tt,i)}function id(i,s,a){var o=i.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=a;var u=i.baseQueue,f=o.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}s.baseQueue=u=f,o.pending=null}if(f=i.baseState,u===null)i.memoizedState=f;else{s=u.next;var C=y=null,T=null,G=s,ee=!1;do{var se=G.lane&-536870913;if(se!==G.lane?(Pe&se)===se:(Ws&se)===se){var W=G.revertLane;if(W===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),se===pr&&(ee=!0);else if((Ws&W)===W){G=G.next,W===pr&&(ee=!0);continue}else se={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(C=T=se,y=f):T=T.next=se,Le.lanes|=W,Dn|=W;se=G.action,yr&&a(f,se),f=G.hasEagerState?G.eagerState:a(f,se)}else W={lane:se,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},T===null?(C=T=W,y=f):T=T.next=W,Le.lanes|=se,Dn|=se;G=G.next}while(G!==null&&G!==s);if(T===null?y=f:T.next=C,!Di(f,i.memoizedState)&&(bt=!0,ee&&(a=na,a!==null)))throw a;i.memoizedState=f,i.baseState=y,i.baseQueue=T,o.lastRenderedState=f}return u===null&&(o.lanes=0),[i.memoizedState,o.dispatch]}function sd(i){var s=yt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var o=a.dispatch,u=a.pending,f=s.memoizedState;if(u!==null){a.pending=null;var y=u=u.next;do f=i(f,y.action),y=y.next;while(y!==u);Di(f,s.memoizedState)||(bt=!0),s.memoizedState=f,s.baseQueue===null&&(s.baseState=f),a.lastRenderedState=f}return[f,o]}function Xp(i,s,a){var o=Le,u=yt(),f=Oe;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=s();var y=!Di((tt||u).memoizedState,a);if(y&&(u.memoizedState=a,bt=!0),u=u.queue,ad(eg.bind(null,o,u,i),[i]),i=u.getSnapshot!==s||y||wt!==null&&(wt.memoizedState.tag&1)!==0,ca(i?9:8,{destroy:void 0},Jp.bind(null,o,u,a,s),null),i){if(o.flags|=2048,st===null)throw Error(r(349));f||(Ws&127)!==0||Qp(o,s,a)}return a}function Qp(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=Le.updateQueue,s===null?(s=fc(),Le.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function Jp(i,s,a,o){s.value=a,s.getSnapshot=o,tg(s)&&ig(i)}function eg(i,s,a){return a(function(){tg(s)&&ig(i)})}function tg(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!Di(i,a)}catch{return!0}}function ig(i){var s=or(i,2);s!==null&&xi(s,i,2)}function nd(i){var s=ai();if(typeof i=="function"){var a=i;if(i=a(),yr){fn(!0);try{a()}finally{fn(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:i},s}function sg(i,s,a,o){return i.baseState=a,id(i,tt,typeof o=="function"?o:Fs)}function b4(i,s,a,o,u){if(_c(i))throw Error(r(485));if(i=s.action,i!==null){var f={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};pe.T!==null?a(!0):f.isTransition=!1,o(f),a=s.pending,a===null?(f.next=s.pending=f,ng(s,f)):(f.next=a.next,s.pending=a.next=f)}}function ng(i,s){var a=s.action,o=s.payload,u=i.state;if(s.isTransition){var f=pe.T,y={};y.types=f!==null?f.types:null,pe.T=y;try{var C=a(u,o),T=pe.S;T!==null&&T(y,C),rg(i,s,C)}catch(G){rd(i,s,G)}finally{f!==null&&y.types!==null&&(f.types=y.types),pe.T=f}}else try{f=a(u,o),rg(i,s,f)}catch(G){rd(i,s,G)}}function rg(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){ag(i,s,o)},function(o){return rd(i,s,o)}):ag(i,s,a)}function ag(i,s,a){s.status="fulfilled",s.value=a,lg(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,ng(i,a)))}function rd(i,s,a){var o=i.pending;if(i.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=a,lg(s),s=s.next;while(s!==o)}i.action=null}function lg(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function og(i,s){return s}function cg(i,s){if(Oe){var a=st.formState;if(a!==null){e:{var o=Le;if(Oe){if(nt){t:{for(var u=nt,f=Fi;u.nodeType!==8;){if(!f){u=null;break t}if(u=Yi(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){nt=Yi(u.nextSibling),o=u.data==="F!";break e}}_n(o)}o=!1}o&&(s=a[0])}}return a=ai(),a.memoizedState=a.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:og,lastRenderedState:s},a.queue=o,a=jg.bind(null,Le,o),o.dispatch=a,o=nd(!1),f=ud.bind(null,Le,!1,o.queue),o=ai(),u={state:s,dispatch:null,action:i,pending:null},o.queue=u,a=b4.bind(null,Le,u,f,a),u.dispatch=a,o.memoizedState=i,[s,a,!1]}function hg(i){var s=yt();return ug(s,tt,i)}function ug(i,s,a){if(s=id(i,s,og)[0],i=gc(Fs)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=Cl(s)}catch(y){throw y===ra?rc:y}else o=s;s=yt();var u=s.queue,f=u.dispatch;return a!==s.memoizedState&&(Le.flags|=2048,ca(9,{destroy:void 0},C4.bind(null,u,a),null)),[o,f,i]}function C4(i,s){i.action=s}function dg(i){var s=yt(),a=tt;if(a!==null)return ug(s,a,i);yt(),s=s.memoizedState,a=yt();var o=a.queue.dispatch;return a.memoizedState=i,[s,o,!1]}function ca(i,s,a,o){return i={tag:i,create:a,deps:o,inst:s,next:null},s=Le.updateQueue,s===null&&(s=fc(),Le.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(o=a.next,a.next=i,i.next=o,s.lastEffect=i),i}function fg(){return yt().memoizedState}function mc(i,s,a,o){var u=ai();Le.flags|=i,u.memoizedState=ca(1|s,{destroy:void 0},a,o===void 0?null:o)}function vc(i,s,a,o){var u=yt();o=o===void 0?null:o;var f=u.memoizedState.inst;tt!==null&&o!==null&&Zu(o,tt.memoizedState.deps)?u.memoizedState=ca(s,f,a,o):(Le.flags|=i,u.memoizedState=ca(1|s,f,a,o))}function pg(i,s){mc(8390656,8,i,s)}function ad(i,s){vc(2048,8,i,s)}function k4(i){Le.flags|=4;var s=Le.updateQueue;if(s===null)s=fc(),Le.updateQueue=s,s.events=[i];else{var a=s.events;a===null?s.events=[i]:a.push(i)}}function gg(i){var s=yt().memoizedState;return k4({ref:s,nextImpl:i}),function(){if((Ye&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function mg(i,s){return vc(4,2,i,s)}function vg(i,s){return vc(4,4,i,s)}function _g(i,s){if(typeof s=="function"){i=i();var a=s(i);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function yg(i,s,a){a=a!=null?a.concat([i]):null,vc(4,4,_g.bind(null,s,i),a)}function ld(){}function Sg(i,s){var a=yt();s=s===void 0?null:s;var o=a.memoizedState;return s!==null&&Zu(s,o[1])?o[0]:(a.memoizedState=[i,s],i)}function xg(i,s){var a=yt();s=s===void 0?null:s;var o=a.memoizedState;if(s!==null&&Zu(s,o[1]))return o[0];if(o=i(),yr){fn(!0);try{i()}finally{fn(!1)}}return a.memoizedState=[o,s],o}function od(i,s,a){return a===void 0||(Ws&1073741824)!==0&&(Pe&261930)===0?i.memoizedState=s:(i.memoizedState=a,i=Rm(),Le.lanes|=i,Dn|=i,a)}function wg(i,s,a,o){return Di(a,s)?a:Cn.current!==null?(i=od(i,a,o),Di(i,s)||(bt=!0),i):(Ws&106)===0||(Ws&1073741824)!==0&&(Pe&261930)===0?(bt=!0,i.memoizedState=a):(i=Rm(),Le.lanes|=i,Dn|=i,s)}function bg(i,s,a,o,u){var f=_e.p;_e.p=f!==0&&8>f?f:8;var y=pe.T,C={};C.types=y!==null?y.types:null,pe.T=C,ud(i,!1,s,a);try{var T=u(),G=pe.S;if(G!==null&&G(C,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var ee=S4(T,o);kl(i,s,ee,Bi(i))}else kl(i,s,o,Bi(i))}catch(se){kl(i,s,{then:function(){},status:"rejected",reason:se},Bi())}finally{_e.p=f,y!==null&&C.types!==null&&(y.types=C.types),pe.T=y}}function E4(){}function cd(i,s,a,o){if(i.tag!==5)throw Error(r(476));var u=Cg(i).queue;bg(i,u,s,Re,a===null?E4:function(){return kg(i),a(o)})}function Cg(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:Re,baseState:Re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:Re},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function kg(i){var s=Cg(i);s.next===null&&(s=i.alternate.memoizedState),kl(i,s.next.queue,{},Bi())}function hd(){return Kt(ja)}function Eg(){return yt().memoizedState}function Mg(){return yt().memoizedState}function M4(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=Bi();i=wn(a);var o=bn(s,i,a);o!==null&&(xi(o,s,a),yl(o,s,a)),s={cache:Hu()},i.payload=s;return}s=s.return}}function j4(i,s,a){var o=Bi();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},_c(i)?Tg(s,a):(a=Tu(i,s,a,o),a!==null&&(xi(a,i,o),Dg(a,s,o)))}function jg(i,s,a){var o=Bi();kl(i,s,a,o)}function kl(i,s,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(_c(i))Tg(s,u);else{var f=i.alternate;if(i.lanes===0&&(f===null||f.lanes===0)&&(f=s.lastRenderedReducer,f!==null))try{var y=s.lastRenderedState,C=f(y,a);if(u.hasEagerState=!0,u.eagerState=C,Di(C,y))return Go(i,s,u,0),st===null&&Yo(),!1}catch{}if(a=Tu(i,s,u,o),a!==null)return xi(a,i,o),Dg(a,s,o),!0}return!1}function ud(i,s,a,o){if(o={lane:2,revertLane:t0(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},_c(i)){if(s)throw Error(r(479))}else s=Tu(i,a,o,2),s!==null&&xi(s,i,2)}function _c(i){var s=i.alternate;return i===Le||s!==null&&s===Le}function Tg(i,s){la=uc=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function Dg(i,s,a){if((a&4194048)!==0){var o=s.lanes;o&=i.pendingLanes,a|=o,s.lanes=a,R1(i,a)}}var yc={readContext:Kt,use:pc,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt,useEffectEvent:gt},Rg={readContext:Kt,use:pc,useCallback:function(i,s){return ai().memoizedState=[i,s===void 0?null:s],i},useContext:Kt,useEffect:pg,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,mc(4194308,4,_g.bind(null,s,i),a)},useLayoutEffect:function(i,s){return mc(4194308,4,i,s)},useInsertionEffect:function(i,s){mc(4,2,i,s)},useMemo:function(i,s){var a=ai();s=s===void 0?null:s;var o=i();if(yr){fn(!0);try{i()}finally{fn(!1)}}return a.memoizedState=[o,s],o},useReducer:function(i,s,a){var o=ai();if(a!==void 0){var u=a(s);if(yr){fn(!0);try{a(s)}finally{fn(!1)}}}else u=s;return o.memoizedState=o.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},o.queue=i,i=i.dispatch=j4.bind(null,Le,i),[o.memoizedState,i]},useRef:function(i){var s=ai();return i={current:i},s.memoizedState=i},useState:function(i){i=nd(i);var s=i.queue,a=jg.bind(null,Le,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:ld,useDeferredValue:function(i,s){var a=ai();return od(a,i,s)},useTransition:function(){var i=nd(!1);return i=bg.bind(null,Le,i.queue,!0,!1),ai().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var o=Le,u=ai();if(Oe){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),st===null)throw Error(r(349));(Pe&127)!==0||Qp(o,s,a)}u.memoizedState=a;var f={value:a,getSnapshot:s};return u.queue=f,pg(eg.bind(null,o,f,i),[i]),o.flags|=2048,ca(9,{destroy:void 0},Jp.bind(null,o,f,a,s),null),a},useId:function(){var i=ai(),s=st.identifierPrefix;if(Oe){var a=vs,o=ms;a=(o&~(1<<32-ji(o)-1)).toString(32)+a,s="_"+s+"R_"+a,a=dc++,0<a&&(s+="H"+a.toString(32)),s+="_"}else a=x4++,s="_"+s+"r_"+a.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:hd,useFormState:cg,useActionState:cg,useOptimistic:function(i){var s=ai();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=ud.bind(null,Le,!0,a),a.dispatch=s,[i,s]},useMemoCache:td,useCacheRefresh:function(){return ai().memoizedState=M4.bind(null,Le)},useEffectEvent:function(i){var s=ai(),a={impl:i};return s.memoizedState=a,function(){if((Ye&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Ag={readContext:Kt,use:pc,useCallback:Sg,useContext:Kt,useEffect:ad,useImperativeHandle:yg,useInsertionEffect:mg,useLayoutEffect:vg,useMemo:xg,useReducer:gc,useRef:fg,useState:function(){return gc(Fs)},useDebugValue:ld,useDeferredValue:function(i,s){var a=yt();return wg(a,tt.memoizedState,i,s)},useTransition:function(){var i=gc(Fs)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:hd,useFormState:hg,useActionState:hg,useOptimistic:function(i,s){var a=yt();return sg(a,tt,i,s)},useMemoCache:td,useCacheRefresh:Mg,useEffectEvent:gg},T4={readContext:Kt,use:pc,useCallback:Sg,useContext:Kt,useEffect:ad,useImperativeHandle:yg,useInsertionEffect:mg,useLayoutEffect:vg,useMemo:xg,useReducer:sd,useRef:fg,useState:function(){return sd(Fs)},useDebugValue:ld,useDeferredValue:function(i,s){var a=yt();return tt===null?od(a,i,s):wg(a,tt.memoizedState,i,s)},useTransition:function(){var i=sd(Fs)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:hd,useFormState:dg,useActionState:dg,useOptimistic:function(i,s){var a=yt();return tt!==null?sg(a,tt,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:td,useCacheRefresh:Mg,useEffectEvent:gg};function dd(i,s,a,o){s=i.memoizedState,a=a(o,s),a=a==null?s:I({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var fd={enqueueSetState:function(i,s,a){i=i._reactInternals;var o=Bi(),u=wn(o);u.payload=s,a!=null&&(u.callback=a),s=bn(i,u,o),s!==null&&(xi(s,i,o),yl(s,i,o))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var o=Bi(),u=wn(o);u.tag=1,u.payload=s,a!=null&&(u.callback=a),s=bn(i,u,o),s!==null&&(xi(s,i,o),yl(s,i,o))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=Bi(),o=wn(a);o.tag=2,s!=null&&(o.callback=s),s=bn(i,o,a),s!==null&&(xi(s,i,a),yl(s,i,a))}};function Ng(i,s,a,o,u,f,y){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(o,f,y):s.prototype&&s.prototype.isPureReactComponent?!ul(a,o)||!ul(u,f):!0}function Lg(i,s,a,o){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,o),s.state!==i&&fd.enqueueReplaceState(s,s.state,null)}function Sr(i,s){var a=s;if("ref"in s){a={};for(var o in s)o!=="ref"&&(a[o]=s[o])}if(i=i.defaultProps){a===s&&(a=I({},a));for(var u in i)a[u]===void 0&&(a[u]=i[u])}return a}function Bg(i){Ko(i)}function Og(i){console.error(i)}function zg(i){Ko(i)}function Sc(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function Hg(i,s,a){try{var o=i.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function pd(i,s,a){return a=wn(a),a.tag=3,a.payload={element:null},a.callback=function(){Sc(i,s)},a}function Ig(i){return i=wn(i),i.tag=3,i}function Ug(i,s,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var f=o.value;i.payload=function(){return u(f)},i.callback=function(){Hg(s,a,o)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(i.callback=function(){Hg(s,a,o),typeof u!="function"&&(Rn===null?Rn=new Set([this]):Rn.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})})}function D4(i,s,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=a.alternate,s!==null&&dr(s,a,u,!0),a=Yt.current,a!==null){switch(a.tag){case 31:case 13:case 19:return ii===null?Pc():a.alternate===null&&mt===0&&(mt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===ac?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([o]):s.add(o),Qd(i,o,u)),!1;case 22:return a.flags|=65536,o===ac?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([o]):a.add(o)),Qd(i,o,u)),!1}throw Error(r(435,a.tag))}return Qd(i,o,u),Pc(),!1}if(Oe)return s=Yt.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,o!==Lu&&(i=Error(r(422),{cause:o}),pl(Vi(i,a)))):(o!==Lu&&(s=Error(r(423),{cause:o}),pl(Vi(s,a))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,o=Vi(o,a),u=pd(i.stateNode,o,u),$u(i,u),mt!==4&&(mt=2)),!1;var f=Error(r(520),{cause:o});if(f=Vi(f,a),Nl===null?Nl=[f]:Nl.push(f),mt!==4&&(mt=2),s===null)return!0;o=Vi(o,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=u&-u,a.lanes|=i,i=pd(a.stateNode,o,i),$u(a,i),!1;case 1:if(s=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Rn===null||!Rn.has(f))))return a.flags|=65536,u&=-u,a.lanes|=u,u=Ig(u),Ug(u,i,a,o),$u(a,u),!1;break;case 22:if(a.memoizedState!==null)return a.flags|=65536,!1}a=a.return}while(a!==null);return!1}var gd=Error(r(461)),bt=!1;function jt(i,s,a,o){s.child=i===null?$p(s,null,a,o):_r(s,i.child,a,o)}function Pg(i,s,a,o,u){a=a.render;var f=s.ref;if("ref"in o){var y={};for(var C in o)C!=="ref"&&(y[C]=o[C])}else y=o;return fr(s),o=Xu(i,s,a,y,f,u),C=Qu(),i!==null&&!bt?(Ju(i,s,u),Ks(i,s,u)):(Oe&&C&&Jo(s),s.flags|=1,jt(i,s,o,u),s.child)}function qg(i,s,a,o,u){if(i===null){var f=a.type;return typeof f=="function"&&!Du(f)&&f.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=f,Vg(i,s,f,o,u)):(i=Xo(a.type,null,o,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(f=i.child,!bd(i,u)){var y=f.memoizedProps;if(a=a.compare,a=a!==null?a:ul,a(y,o)&&i.ref===s.ref)return Ks(i,s,u)}return s.flags|=1,i=Ps(f,o),i.ref=s.ref,i.return=s,s.child=i}function Vg(i,s,a,o,u){if(i!==null){var f=i.memoizedProps;if(ul(f,o)&&i.ref===s.ref)if(bt=!1,s.pendingProps=o=f,bd(i,u))(i.flags&131072)!==0&&(bt=!0);else return s.lanes=i.lanes,Ks(i,s,u)}return md(i,s,a,o,u)}function $g(i,s,a,o){var u=o.children,f=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,i!==null){for(o=s.child=i.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~f}else o=0,s.child=null;return Wg(i,s,f,a,o)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&nc(s,f!==null?f.cachePool:null),f!==null?Kp(s,f):Fu(),Yp(s);else return o=s.lanes=536870912,Wg(i,s,f!==null?f.baseLanes|a:a,a,o)}else f!==null?(nc(s,f.cachePool),Kp(s,f),En(),s.memoizedState=null):(i!==null&&nc(s,null),Fu(),En());return jt(i,s,u,a),s.child}function El(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Wg(i,s,a,o,u){var f=Uu();return f=f===null?null:{parent:xt._currentValue,pool:f},s.memoizedState={baseLanes:a,cachePool:f},i!==null&&nc(s,null),Fu(),Yp(s),i!==null&&dr(i,s,o,!0),s.childLanes=u,null}function xc(i,s){return s=wc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Fg(i,s,a){return _r(s,i.child,null,a),i=xc(s,s.pendingProps),i.flags|=2,Ri(s),s.memoizedState=null,i}function R4(i,s,a){var o=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Oe){if(o.mode==="hidden")return i=xc(s,o),s.lanes=536870912,i.memoizedState={baseLanes:0,cachePool:null},El(null,i);if(Yu(s),(i=nt)?(i=_v(i,Fi),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:mn!==null?{id:ms,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Tp(i),a.return=s,s.child=a,zt=s,nt=null)):i=null,i===null)throw _n(s);return s.lanes=536870912,null}return xc(s,o)}var f=i.memoizedState;if(f!==null){var y=f.dehydrated;if(Yu(s),u)if(s.flags&256)s.flags&=-257,s=Fg(i,s,a);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(r(558));else if(bt||dr(i,s,a,!1),u=(a&i.childLanes)!==0,bt||u){if(Cn.current===null){if(o=st,o!==null&&(y=A1(o,a),y!==0&&y!==f.retryLane))throw f.retryLane=y,or(i,y),xi(o,i,y),gd;Pc()}s=Fg(i,s,a)}else i=f.treeContext,nt=Yi(y.nextSibling),zt=s,Oe=!0,vn=null,Fi=!1,i!==null&&Ap(s,i),s=xc(s,o),s.flags|=134221824;return s}return i=Ps(i.child,{mode:o.mode,children:o.children}),i.ref=s.ref,s.child=i,i.return=s,i}function ha(i,s){var a=s.ref;if(a===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(s.flags|=4194816)}}function md(i,s,a,o,u){return fr(s),a=Xu(i,s,a,o,void 0,u),o=Qu(),i!==null&&!bt?(Ju(i,s,u),Ks(i,s,u)):(Oe&&o&&Jo(s),s.flags|=1,jt(i,s,a,u),s.child)}function Kg(i,s,a,o,u,f){return fr(s),s.updateQueue=null,a=Zp(s,o,a,u),Gp(i),o=Qu(),i!==null&&!bt?(Ju(i,s,f),Ks(i,s,f)):(Oe&&o&&Jo(s),s.flags|=1,jt(i,s,a,f),s.child)}function Yg(i,s,a,o,u){if(fr(s),s.stateNode===null){var f=ea,y=a.contextType;typeof y=="object"&&y!==null&&(f=Kt(y)),f=new a(o,f),s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=fd,s.stateNode=f,f._reactInternals=s,f=s.stateNode,f.props=o,f.state=s.memoizedState,f.refs={},qu(s),y=a.contextType,f.context=typeof y=="object"&&y!==null?Kt(y):ea,f.state=s.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(dd(s,a,y,o),f.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&fd.enqueueReplaceState(f,f.state,null),xl(s,o,f,u),Sl(),f.state=s.memoizedState),typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(i===null){f=s.stateNode;var C=s.memoizedProps,T=Sr(a,C);f.props=T;var G=f.context,ee=a.contextType;y=ea,typeof ee=="object"&&ee!==null&&(y=Kt(ee));var se=a.getDerivedStateFromProps;ee=typeof se=="function"||typeof f.getSnapshotBeforeUpdate=="function",C=s.pendingProps!==C,ee||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(C||G!==y)&&Lg(s,f,o,y),xn=!1;var W=s.memoizedState;f.state=W,xl(s,o,f,u),Sl(),G=s.memoizedState,C||W!==G||xn?(typeof se=="function"&&(dd(s,a,se,o),G=s.memoizedState),(T=xn||Ng(s,a,T,o,W,G,y))?(ee||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(s.flags|=4194308)):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=G),f.props=o,f.state=G,f.context=y,o=T):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{f=s.stateNode,Vu(i,s),y=s.memoizedProps,ee=Sr(a,y),f.props=ee,se=s.pendingProps,W=f.context,G=a.contextType,T=ea,typeof G=="object"&&G!==null&&(T=Kt(G)),C=a.getDerivedStateFromProps,(G=typeof C=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==se||W!==T)&&Lg(s,f,o,T),xn=!1,W=s.memoizedState,f.state=W,xl(s,o,f,u),Sl();var X=s.memoizedState;y!==se||W!==X||xn||i!==null&&i.dependencies!==null&&ic(i.dependencies)?(typeof C=="function"&&(dd(s,a,C,o),X=s.memoizedState),(ee=xn||Ng(s,a,ee,o,W,X,T)||i!==null&&i.dependencies!==null&&ic(i.dependencies))?(G||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,X,T),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,X,T)),typeof f.componentDidUpdate=="function"&&(s.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=X),f.props=o,f.state=X,f.context=T,o=ee):(typeof f.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(s.flags|=1024),o=!1)}return f=o,ha(i,s),o=(s.flags&128)!==0,f||o?(f=s.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:f.render(),s.flags|=1,i!==null&&o?(s.child=_r(s,i.child,null,u),s.child=_r(s,null,a,u)):jt(i,s,a,u),s.memoizedState=f.state,i=s.child):i=Ks(i,s,u),i}function Gg(i,s,a,o){return hr(),s.flags|=256,jt(i,s,a,o),s.child}var vd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _d(i){return{baseLanes:i,cachePool:Hp()}}function yd(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=Li),i}function Zg(i,s,a){var o=s.pendingProps,u=!1,f=(s.flags&128)!==0,y;if((y=f)||(y=i!==null&&i.memoizedState===null?!1:(Gt.current&2)!==0),y&&(u=!0,s.flags&=-129),y=(s.flags&32)!==0,s.flags&=-33,i===null){if(Oe){if(u?kn(s):En(),(i=nt)?(i=_v(i,Fi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:mn!==null?{id:ms,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Tp(i),a.return=s,s.child=a,zt=s,nt=null)):i=null,i===null)throw _n(s);return _0(i)?s.lanes=32:s.lanes=536870912,null}return f=o.children,o=o.fallback,u?(En(),u=s.mode,f=wc({mode:"hidden",children:f},u),o=cr(o,u,a,null),f.return=s,o.return=s,f.sibling=o,s.child=f,o=s.child,o.memoizedState=_d(a),o.childLanes=yd(i,y,a),s.memoizedState=vd,El(null,o)):(kn(s),Sd(s,f))}var C=i.memoizedState;if(C!==null){var T=C.dehydrated;if(T!==null)return A4(i,s,f,y,o,T,C,a)}return u?(En(),u=o.fallback,f=s.mode,C=i.child,T=C.sibling,o=Ps(C,{mode:"hidden",children:o.children}),o.subtreeFlags=C.subtreeFlags&1206910976,T!==null?u=Ps(T,u):(u=cr(u,f,a,null),u.flags|=2),u.return=s,o.return=s,o.sibling=u,s.child=o,El(null,o),o=s.child,u=i.child.memoizedState,u===null?u=_d(a):(f=u.cachePool,f!==null?(C=xt._currentValue,f=f.parent!==C?{parent:C,pool:C}:f):f=Hp(),u={baseLanes:u.baseLanes|a,cachePool:f}),o.memoizedState=u,o.childLanes=yd(i,y,a),s.memoizedState=vd,El(i.child,o)):(kn(s),a=i.child,i=a.sibling,a=Ps(a,{mode:"visible",children:o.children}),a.return=s,a.sibling=null,i!==null&&(y=s.deletions,y===null?(s.deletions=[i],s.flags|=16):y.push(i)),s.child=a,s.memoizedState=null,a)}function Sd(i,s){return s=wc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function wc(i,s){return i=vi(22,i,null,s),i.lanes=0,i}function bc(i,s,a){return _r(s,i.child,null,a),i=Sd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function A4(i,s,a,o,u,f,y,C){if(a)return s.flags&256?(kn(s),s.flags&=-257,bc(i,s,C)):s.memoizedState!==null?(En(),s.child=i.child,s.flags|=128,null):(En(),f=u.fallback,y=s.mode,u=wc({mode:"visible",children:u.children},y),f=cr(f,y,C,null),f.flags|=2,u.return=s,f.return=s,u.sibling=f,s.child=u,_r(s,i.child,null,C),u=s.child,u.memoizedState=_d(C),u.childLanes=yd(i,o,C),s.memoizedState=vd,El(null,u));if(kn(s),_0(f)){if(o=f.nextSibling&&f.nextSibling.dataset,o)var T=o.dgst;return o=T,o!==""&&(u=Error(r(419)),u.stack="",u.digest=o,pl({value:u,source:null,stack:null})),bc(i,s,C)}if(bt||dr(i,s,C,!1),o=(C&i.childLanes)!==0,bt||o){if(Cn.current!==null)return bc(i,s,C);if(o=st,o!==null&&(u=A1(o,C),u!==0&&u!==y.retryLane))throw y.retryLane=u,or(i,u),xi(o,i,u),gd;return v0(f)||Pc(),bc(i,s,C)}return v0(f)?(s.flags|=192,s.child=i.child,null):(i=y.treeContext,nt=Yi(f.nextSibling),zt=s,Oe=!0,vn=null,Fi=!1,i!==null&&Ap(s,i),s=Sd(s,u.children),s.flags|=134221824,s)}function Xg(i,s,a){i.lanes|=s;var o=i.alternate;o!==null&&(o.lanes|=s),tc(i.return,s,a)}function Qg(i){for(var s=null;i!==null;){var a=i.alternate;a!==null&&hc(a)===null&&(s=i),i=i.sibling}return s}function Cc(i,s,a,o,u,f){var y=i.memoizedState;y===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:f}:(y.isBackwards=s,y.rendering=null,y.renderingStartTime=0,y.last=o,y.tail=a,y.tailMode=u,y.treeForkCount=f)}function xd(i){var s=i.child;for(i.child=null;s!==null;){var a=s.sibling;s.sibling=i.child,i.child=s,s=a}}function wd(i,s,a){var o=s.pendingProps,u=o.revealOrder,f=o.tail;o=o.children;var y=Gt.current;if(s.flags&128)return wl(s,y),null;var C=(y&2)!==0;if(C?(y=y&1|2,s.flags|=128):y&=1,wl(s,y),u==="backwards"&&i!==null?(xd(i),jt(i,s,o,a),xd(i)):jt(i,s,o,a),o=Oe?fl:0,!C&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Xg(i,a,s);else if(i.tag===19)Xg(i,a,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"backwards":a=Qg(s.child),a===null?(u=s.child,s.child=null):(u=a.sibling,a.sibling=null,xd(s)),Cc(s,!0,u,null,f,o);break;case"unstable_legacy-backwards":for(a=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&hc(i)===null){s.child=u;break}i=u.sibling,u.sibling=a,a=u,u=i}Cc(s,!0,a,null,f,o);break;case"together":Cc(s,!1,null,null,void 0,o);break;case"independent":s.memoizedState=null;break;default:a=Qg(s.child),a===null?(u=s.child,s.child=null):(u=a.sibling,a.sibling=null),Cc(s,!1,u,a,f,o)}return s.child}function Jg(i,s,a){var o=s.pendingProps;return yn(s,s.type,o.value),jt(i,s,o.children,a),s.child}function Ks(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),Dn|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(dr(i,s,a,!1),(a&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,a=Ps(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=Ps(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function bd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&ic(i)))}function N4(i,s,a){switch(s.tag){case 3:Ur(s,s.stateNode.containerInfo),yn(s,xt,i.memoizedState.cache),hr();break;case 27:case 5:Pr(s);break;case 4:Ur(s,s.stateNode.containerInfo);break;case 10:yn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Yu(s),null;break;case 13:var o=s.memoizedState;if(o!==null){if(o.dehydrated!==null)return kn(s),s.flags|=128,null;o=dr(i,s,a,!1);var u=s.child.childLanes;return o||(a&u)!==0?Zg(i,s,a):(kn(s),i=Ks(i,s,a),i!==null?i.sibling:null)}kn(s);break;case 19:if(s.flags&128)return wd(i,s,a);if(u=(i.flags&128)!==0,o=(a&s.childLanes)!==0,o||(dr(i,s,a,!1),o=(a&s.childLanes)!==0),u){if(o)return wd(i,s,a);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),wl(s,Gt.current),o)break;return null;case 22:return s.lanes=0,$g(i,s,a,s.pendingProps);case 24:yn(s,xt,i.memoizedState.cache)}return Ks(i,s,a)}function em(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)bt=!0;else{if(!bd(i,a)&&(s.flags&128)===0)return bt=!1,N4(i,s,a);bt=(i.flags&131072)!==0}else bt=!1,Oe&&(s.flags&1048576)!==0&&Rp(s,fl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(i=mr(s.elementType),s.type=i,typeof i=="function")Du(i)?(o=Sr(i,o),s.tag=1,s=Yg(null,s,i,o,a)):(s.tag=0,s=md(null,s,i,o,a));else{if(i!=null){var u=i.$$typeof;if(u===P){s.tag=11,s=Pg(null,s,i,o,a);break e}else if(u===ce){s.tag=14,s=qg(null,s,i,o,a);break e}else if(u===O){s.tag=10,s.type=i,s=Jg(null,s,a);break e}}throw s=xe(i)||i,Error(r(306,s,""))}}return s;case 0:return md(i,s,s.type,s.pendingProps,a);case 1:return o=s.type,u=Sr(o,s.pendingProps),Yg(i,s,o,u,a);case 3:e:{if(Ur(s,s.stateNode.containerInfo),i===null)throw Error(r(387));o=s.pendingProps;var f=s.memoizedState;u=f.element,Vu(i,s),xl(s,o,null,a);var y=s.memoizedState;if(o=y.cache,yn(s,xt,o),o!==f.cache&&zu(s,[xt],a,!0),Sl(),o=y.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:y.cache},s.updateQueue.baseState=f,s.memoizedState=f,s.flags&256){s=Gg(i,s,o,a);break e}else if(o!==u){u=Vi(Error(r(424)),s),pl(u),s=Gg(i,s,o,a);break e}else for(i=s.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,nt=Yi(i.firstChild),zt=s,Oe=!0,vn=null,Fi=!0,a=$p(s,null,o,a),s.child=a;a;)a.flags=a.flags&-3|134221824,a=a.sibling;else{if(hr(),o===u){s=Ks(i,s,a);break e}jt(i,s,o,a)}s=s.child}return s;case 26:return ha(i,s),i===null?(a=kv(s.type,null,s.pendingProps,null))?s.memoizedState=a:Oe||(s.stateNode=nv(s.type,s.pendingProps,Ke.current,s)):s.memoizedState=kv(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Pr(s),i===null&&Oe&&(o=s.stateNode=xv(s.type,s.pendingProps,Ke.current),zt=s,Fi=!0,u=nt,Ln(s.type)?(y0=u,nt=Yi(o.firstChild)):nt=u),jt(i,s,s.pendingProps.children,a),ha(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Oe&&((u=o=nt)&&(o=M5(o,s.type,s.pendingProps,Fi),o!==null?(s.stateNode=o,zt=s,nt=Yi(o.firstChild),Fi=!1,u=!0):u=!1),u||_n(s)),Pr(s),u=s.type,f=s.pendingProps,y=i!==null?i.memoizedProps:null,o=f.children,h0(u,f)?o=null:y!==null&&h0(u,y)&&(s.flags|=32),s.memoizedState!==null&&(u=Xu(i,s,w4,null,null,a),ja._currentValue=u),ha(i,s),jt(i,s,o,a),s.child;case 6:return i===null&&Oe&&((i=a=nt)&&(a=j5(a,s.pendingProps,Fi),a!==null?(s.stateNode=a,zt=s,nt=null,i=!0):i=!1),i||_n(s)),null;case 13:return Zg(i,s,a);case 4:return Ur(s,s.stateNode.containerInfo),o=s.pendingProps,i===null?s.child=_r(s,null,o,a):jt(i,s,o,a),s.child;case 11:return Pg(i,s,s.type,s.pendingProps,a);case 7:return o=s.pendingProps,ha(i,s),jt(i,s,o,a),s.child;case 8:return jt(i,s,s.pendingProps.children,a),s.child;case 12:return jt(i,s,s.pendingProps.children,a),s.child;case 10:return Jg(i,s,a);case 9:return u=s.type._context,o=s.pendingProps.children,fr(s),u=Kt(u),o=o(u),s.flags|=1,jt(i,s,o,a),s.child;case 14:return qg(i,s,s.type,s.pendingProps,a);case 15:return Vg(i,s,s.type,s.pendingProps,a);case 19:return wd(i,s,a);case 31:return R4(i,s,a);case 22:return $g(i,s,a,s.pendingProps);case 24:return fr(s),o=Kt(xt),i===null?(u=Uu(),u===null&&(u=st,f=Hu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),s.memoizedState={parent:o,cache:u},qu(s),yn(s,xt,u)):((i.lanes&a)!==0&&(Vu(i,s),xl(s,null,null,a),Sl()),u=i.memoizedState,f=s.memoizedState,u.parent!==o?(u={parent:o,cache:o},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),yn(s,xt,o)):(o=f.cache,yn(s,xt,o),o!==u.cache&&zu(s,[xt],a,!0))),jt(i,s,s.pendingProps.children,a),s.child;case 30:return s.stateNode===null&&(s.stateNode={autoName:null,paired:null,clones:null,ref:null}),o=s.pendingProps,o.name!=null&&o.name!=="auto"?s.flags|=i===null?18882560:18874368:Oe&&Jo(s),i!==null&&i.memoizedProps.name!==o.name?s.flags|=4194816:ha(i,s),jt(i,s,o.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Ys(i){i.flags|=4}function Cd(i,s,a,o,u){var f;if((f=(i.mode&32)!==0)&&(f=a===null?Tv(s,o):Tv(s,o)&&(o.src!==a.src||o.srcSet!==a.srcSet)),f){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(Bm())i.flags|=8192;else throw vr=ac,Pu}else i.flags&=-16777217}function tm(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Dv(s))if(Bm())i.flags|=8192;else throw vr=ac,Pu}function kc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?T1():536870912,i.lanes|=s,ga|=s)}function Ml(i,s){if(!Oe)switch(i.tailMode){case"visible":break;case"collapsed":for(var a=i.tail,o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:o.sibling=null;break;default:for(s=i.tail,a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?i.tail=null:a.sibling=null}}function rt(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,o=0;if(s)for(var u=i.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&1206910976,o|=u.flags&1206910976,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=o,i.childLanes=a,s}function L4(i,s,a){var o=s.pendingProps;switch(Nu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rt(s),null;case 1:return rt(s),null;case 3:return a=s.stateNode,o=null,i!==null&&(o=i.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),$s(xt),Bs(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(sa(s)?Ys(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Bu())),rt(s),null;case 26:var u=s.type,f=s.memoizedState;return i===null?(Ys(s),f!==null?(rt(s),tm(s,f)):(rt(s),Cd(s,u,null,o,a))):f?f!==i.memoizedState?(Ys(s),rt(s),tm(s,f)):(rt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==o&&Ys(s),rt(s),Cd(s,u,i,o,a)),null;case 27:if(rs(s),a=Ke.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return rt(s),s.subtreeFlags&=-33554433,null}i=gi.current,sa(s)?Np(s):(i=xv(u,o,a),s.stateNode=i,Ys(s))}return rt(s),s.subtreeFlags&=-33554433,null;case 5:if(rs(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return rt(s),s.subtreeFlags&=-33554433,null}if(f=gi.current,sa(s))Np(s);else{var y=Hl(Ke.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?y.createElement("select",{is:o.is}):y.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?y.createElement(u,{is:o.is}):y.createElement(u)}}f[Ft]=s,f[mi]=o;e:for(y=s.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===s)break e;for(;y.sibling===null;){if(y.return===null||y.return===s)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}s.stateNode=f;e:switch(Xt(f,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Ys(s)}}return rt(s),s.subtreeFlags&=-33554433,Cd(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,a),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==o&&Ys(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(r(166));if(i=Ke.current,sa(s)){if(i=s.stateNode,a=s.memoizedProps,o=null,u=zt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}i[Ft]=s,i=!!(i.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||ev(i.nodeValue,a)),i||_n(s,!0)}else i=Hl(i).createTextNode(o),i[Ft]=s,s.stateNode=i}return rt(s),null;case 31:if(a=s.memoizedState,i===null||i.memoizedState!==null){if(o=sa(s),a!==null){if(i===null){if(!o)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Ft]=s}else hr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;rt(s),i=!1}else a=Bu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=a),i=!0;if(!i)return s.flags&256?(Ri(s),s):(Ri(s),null);if((s.flags&128)!==0)throw Error(r(558))}return rt(s),null;case 13:if(o=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=sa(s),o!==null&&o.dehydrated!==null){if(i===null){if(!u)throw Error(r(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[Ft]=s}else hr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;rt(s),u=!1}else u=Bu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(Ri(s),s):(Ri(s),null)}return Ri(s),(s.flags&128)!==0?(s.lanes=a,s):(a=o!==null,i=i!==null&&i.memoizedState!==null,a&&(o=s.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==u&&(o.flags|=2048)),a!==i&&a&&(s.child.flags|=8192),kc(s,s.updateQueue),rt(s),null);case 4:return Bs(),i===null&&r0(s.stateNode.containerInfo),s.flags|=67108864,rt(s),null;case 10:return $s(s.type),rt(s),null;case 19:if(Gu(s),o=s.memoizedState,o===null)return rt(s),null;if(u=(s.flags&128)!==0,f=o.rendering,f===null)if(u)Ml(o,!1);else{if(mt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(f=hc(i),f!==null){for(s.flags|=128,Ml(o,!1),i=f.updateQueue,s.updateQueue=i,kc(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)jp(a,i),a=a.sibling;return wl(s,Gt.current&1|2),Oe&&qs(s,o.treeForkCount),s.child}i=i.sibling}o.tail!==null&&Ei()>zc&&(s.flags|=128,u=!0,Ml(o,!1),s.lanes=4194304)}else{if(!u)if(i=hc(f),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,kc(s,i),Ml(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!f.alternate&&!Oe)return rt(s),null}else 2*Ei()-o.renderingStartTime>zc&&a!==536870912&&(s.flags|=128,u=!0,Ml(o,!1),s.lanes=4194304);o.isBackwards?(f.sibling=s.child,s.child=f):(i=o.last,i!==null?i.sibling=f:s.child=f,o.last=f)}if(o.tail!==null){i=o.tail;e:{for(a=i;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return o.rendering=i,o.tail=i.sibling,o.renderingStartTime=Ei(),i.sibling=null,f=Gt.current,f=u?f&1|2:f&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!a||Oe?wl(s,f):(a=f,$e(Yt,s),$e(Gt,a),ii===null&&(ii=s)),Oe&&qs(s,o.treeForkCount),i}return rt(s),null;case 22:case 23:return Ri(s),Ku(),o=s.memoizedState!==null,i!==null?i.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(a&536870912)!==0&&(s.flags&128)===0&&(rt(s),s.subtreeFlags&6&&(s.flags|=8192)):rt(s),a=s.updateQueue,a!==null&&kc(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==a&&(s.flags|=2048),i!==null&&pt(gr),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),$s(xt),rt(s),null;case 25:return null;case 30:return s.flags|=33554432,rt(s),null}throw Error(r(156,s.tag))}function B4(i,s){switch(Nu(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return $s(xt),Bs(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return rs(s),null;case 31:if(s.memoizedState!==null){if(Ri(s),s.alternate===null)throw Error(r(340));hr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(Ri(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));hr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return Gu(s),i=s.flags,i&65536?(s.flags=i&-65537|128,i=s.memoizedState,i!==null&&(i.rendering=null,i.tail=null),s.flags|=4,s):null;case 4:return Bs(),null;case 10:return $s(s.type),null;case 22:case 23:return Ri(s),Ku(),i!==null&&pt(gr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return $s(xt),null;case 25:return null;default:return null}}function im(i,s){switch(Nu(s),s.tag){case 3:$s(xt),Bs();break;case 26:case 27:case 5:rs(s);break;case 4:Bs();break;case 31:s.memoizedState!==null&&Ri(s);break;case 13:Ri(s);break;case 19:Gu(s);break;case 10:$s(s.type);break;case 22:case 23:Ri(s),Ku(),i!==null&&pt(gr);break;case 24:$s(xt)}}function jl(i,s){try{var a=s.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&i)===i){o=void 0;var f=a.create,y=a.inst;o=f(),y.destroy=o}a=a.next}while(a!==u)}}catch(C){Qe(s,s.return,C)}}function Mn(i,s,a){try{var o=s.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var f=u.next;o=f;do{if((o.tag&i)===i){var y=o.inst,C=y.destroy;if(C!==void 0){y.destroy=void 0,u=s;var T=a,G=C;try{G()}catch(ee){Qe(u,T,ee)}}}o=o.next}while(o!==f)}}catch(ee){Qe(s,s.return,ee)}}function sm(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{Fp(s,a)}catch(o){Qe(i,i.return,o)}}}function nm(i,s,a){a.props=Sr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(o){Qe(i,s,o)}}function _s(i,s){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var o=i.stateNode;break;case 30:var u=i.stateNode,f=Is(i.memoizedProps,u);(u.ref===null||u.ref.name!==f)&&(u.ref=uv(f)),o=u.ref;break;case 7:if(i.stateNode===null){var y=new Oi(i);_(i.child,!1,k5,y,void 0,void 0),i.stateNode=y}o=i.stateNode;break;default:o=i.stateNode}typeof a=="function"?i.refCleanup=a(o):a.current=o}}catch(C){Qe(i,s,C)}}function Zt(i,s){var a=i.ref,o=i.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Qe(i,s,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Qe(i,s,u)}else a.current=null}function Ec(i,s){if((i.tag===5||i.tag===27||i.tag===6)&&i.alternate===null&&s!==null)for(var a=0;a<s.length;a++)vv(i.stateNode,s[a])}function rm(i){for(var s=i.return;s!==null&&(Ed(s)&&vv(i.stateNode,s.stateNode),!kd(s));)s=s.return}function Tl(i){for(var s=i.return;s!==null&&(Ed(s)&&E5(i.stateNode,s.stateNode),!kd(s));)s=s.return}function kd(i){return i.tag===5||i.tag===3||i.tag===27}function Ed(i){return i&&i.tag===7&&i.stateNode!==null}function Md(i){var s=i.type,a=i.memoizedProps,o=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Qe(i,i.return,u)}}function jd(i,s,a){try{var o=i.stateNode;l5(o,i.type,a,s),o[mi]=s}catch(u){Qe(i,i.return,u)}}function am(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Ln(i.type)||i.tag===4}function Td(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||am(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Ln(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Dd(i,s,a,o){var u=i.tag;if(u===5||u===6)u=i.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(u,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(u),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=gs)),Ec(i,o),We=!0;else if(u!==4&&(u===27&&(Ec(i,o),o=null,Ln(i.type)&&(a=i.stateNode,s=null)),i=i.child,i!==null))for(Dd(i,s,a,o),i=i.sibling;i!==null;)Dd(i,s,a,o),i=i.sibling}function Mc(i,s,a,o){var u=i.tag;if(u===5||u===6)u=i.stateNode,s?a.insertBefore(u,s):a.appendChild(u),Ec(i,o),We=!0;else if(u!==4&&(u===27&&(Ec(i,o),o=null,Ln(i.type)&&(a=i.stateNode)),i=i.child,i!==null))for(Mc(i,s,a,o),i=i.sibling;i!==null;)Mc(i,s,a,o),i=i.sibling}function lm(i){var s=i.stateNode,a=i.memoizedProps;try{for(var o=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Xt(s,o,a),s[Ft]=i,s[mi]=a}catch(f){Qe(i,i.return,f)}}var jc=!1,Ai=null;function om(i){(i.tag===30||(i.subtreeFlags&33554432)!==0)&&(jc=!0)}var ys=null;function cm(){var i=ys;return ys=null,i}var _i=0;function ua(i,s,a,o,u){return _i=0,hm(i.child,s,a,o,u)}function hm(i,s,a,o,u){for(var f=!1;i!==null;){if(i.tag===5){var y=i.stateNode;if(o!==null){var C=f0(y);o.push(C),C.view&&(f=!0)}else f||f0(y).view&&(f=!0);jc=!0,cv(y,_i===0?s:s+"_"+_i,a),_i++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&u||hm(i.child,s,a,o,u)&&(f=!0));i=i.sibling}return f}function Ss(i,s){for(;i!==null;)i.tag===5?hv(i.stateNode,i.memoizedProps):(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&s||Ss(i.child,s)),i=i.sibling}function Tc(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if((i.tag!==22||i.memoizedState===null)&&(Tc(i),i.tag===30&&(i.flags&18874368)!==0&&i.stateNode.paired)){var s=i.memoizedProps;if(s.name==null||s.name==="auto")throw Error(r(544));var a=s.name;s=Us(s.default,s.share),s!=="none"&&(ua(i,a,s,null,!1)||Ss(i.child,!1))}i=i.sibling}}function Rd(i,s){if(i.tag===30){var a=i.stateNode,o=i.memoizedProps,u=Is(o,a),f=Us(o.default,a.paired?o.share:o.enter);f!=="none"?ua(i,u,f,null,!1)?(Tc(i),a.paired||s||ya(i,o.onEnter)):Ss(i.child,!1):Tc(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Rd(i,s),i=i.sibling;else Tc(i)}function Ad(i){if(Ai!==null&&Ai.size!==0){var s=Ai;if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var a=i.memoizedProps,o=a.name;if(o!=null&&o!=="auto"){var u=s.get(o);if(u!==void 0){var f=Us(a.default,a.share);if(f!=="none"&&(ua(i,o,f,null,!1)?(f=i.stateNode,u.paired=f,f.paired=u,ya(i,a.onShare)):Ss(i.child,!1)),s.delete(o),s.size===0)break}}}Ad(i)}i=i.sibling}}}function Nd(i){if(i.tag===30){var s=i.memoizedProps,a=Is(s,i.stateNode),o=Ai!==null?Ai.get(a):void 0,u=Us(s.default,o!==void 0?s.share:s.exit);u!=="none"&&(ua(i,a,u,null,!1)?o!==void 0?(u=i.stateNode,o.paired=u,u.paired=o,Ai.delete(a),ya(i,s.onShare)):ya(i,s.onExit):Ss(i.child,!1)),Ai!==null&&Ad(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Nd(i),i=i.sibling;else Ai!==null&&Ad(i)}function um(i){for(i=i.child;i!==null;){if(i.tag===30){var s=i.memoizedProps,a=Is(s,i.stateNode);s=Us(s.default,s.update),i.flags&=-5,s!=="none"&&ua(i,a,s,i.memoizedState=[],!1)}else(i.subtreeFlags&33554432)!==0&&um(i);i=i.sibling}}function Ld(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var s=i.stateNode;s.paired!==null&&(s.paired=null,Ss(i.child,!1))}Ld(i)}i=i.sibling}}function Dc(i){if(i.tag===30)i.stateNode.paired=null,Ss(i.child,!1),Ld(i);else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Dc(i),i=i.sibling;else Ld(i)}function dm(i){for(i=i.child;i!==null;)i.tag===30?Ss(i.child,!1):(i.subtreeFlags&33554432)!==0&&dm(i),i=i.sibling}function Bd(i,s,a,o,u,f,y){for(var C=!1;s!==null;){if(s.tag===5){var T=s.stateNode;if(f!==null&&_i<f.length){var G=f[_i],ee=f0(T);(G.view||ee.view)&&(C=!0);var se;if(se=(i.flags&4)===0)if(ee.clip)se=!0;else{se=G.rect;var W=ee.rect;se=se.y!==W.y||se.x!==W.x||se.height!==W.height||se.width!==W.width}se&&(i.flags|=4),ee.abs?ee=!G.abs:(G=G.rect,ee=ee.rect,ee=G.height!==ee.height||G.width!==ee.width),ee&&(i.flags|=32)}else i.flags|=32;(i.flags&4)!==0&&cv(T,_i===0?a:a+"_"+_i,u),C&&(i.flags&4)!==0||(ys===null&&(ys=[]),ys.push(T,_i===0?o:o+"_"+_i,s.memoizedProps)),_i++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&y?i.flags|=s.flags&32:Bd(i,s.child,a,o,u,f,y)&&(C=!0));s=s.sibling}return C}function fm(i,s){for(i=i.child;i!==null;){if(i.tag===30){var a=i.memoizedProps,o=i.stateNode,u=Is(a,o),f=Us(a.default,a.update),y;y=i.memoizedState,i.memoizedState=null,o=i;var C=i.child;_i=0,u=Bd(o,C,u,u,f,y,!1),(i.flags&4)!==0&&u&&ya(i,a.onUpdate)}else(i.subtreeFlags&33554432)!==0&&fm(i);i=i.sibling}}var Ht=!1,Ge=!1,xs=!1,Od=!1,pm=typeof WeakSet=="function"?WeakSet:Set,It=null,ws=!1,Dl=!1,Rc=!1,zd=!1;function O4(i,s,a){if(i=i.containerInfo,o0=Ta,i=_p(i),bu(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var C=0,T=-1,G=-1,ee=0,se=0,W=i,X=null;t:for(;;){for(var fe;W!==o||f!==0&&W.nodeType!==3||(T=C+f),W!==y||u!==0&&W.nodeType!==3||(G=C+u),W.nodeType===3&&(C+=W.nodeValue.length),(fe=W.firstChild)!==null;)X=W,W=fe;for(;;){if(W===i)break t;if(X===o&&++ee===f&&(T=C),X===y&&++se===u&&(G=C),(fe=W.nextSibling)!==null)break;W=X,X=W.parentNode}W=fe}o=T===-1||G===-1?null:{start:T,end:G}}else o=null}o=o||{start:0,end:0}}else o=null;for(c0={focusedElem:i,selectionRange:o},Ta=!1,a=(a&335544064)===a,It=s,s=a?9270:1024;It!==null;){if(i=It,a&&(o=i.deletions,o!==null))for(f=0;f<o.length;f++)a&&Nd(o[f]);if(i.alternate===null&&(i.flags&2)!==0)a&&om(i),Ac(a);else{if(i.tag===22){if(o=i.alternate,i.memoizedState!==null){o!==null&&o.memoizedState===null&&a&&Nd(o),Ac(a);continue}else if(o!==null&&o.memoizedState!==null){a&&om(i),Ac(a);continue}}o=i.child,(i.subtreeFlags&s)!==0&&o!==null?(o.return=i,It=o):(a&&um(i),Ac(a))}}Ai=null}function Ac(i){for(;It!==null;){var s=It,a=i,o=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&o!==null){a=void 0,u=o.memoizedProps,o=o.memoizedState;var f=s.stateNode;try{var y=Sr(s.type,u);a=f.getSnapshotBeforeUpdate(y,o),f.__reactInternalSnapshotBeforeUpdate=a}catch(C){Qe(s,s.return,C)}}break;case 3:if((u&1024)!==0){if(o=s.stateNode.containerInfo,a=o.nodeType,a===9)m0(o);else if(a===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":m0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:a&&o!==null&&(a=Is(o.memoizedProps,o.stateNode),u=s.memoizedProps,u=Us(u.default,u.update),u!=="none"&&ua(o,a,u,o.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(r(163))}if(o=s.sibling,o!==null){o.return=s.return,It=o;break}It=s.return}}function gm(i,s,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:bs(i,a),o&4&&jl(5,a);break;case 1:if(bs(i,a),o&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(y){Qe(a,a.return,y)}else{var u=Sr(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(y){Qe(a,a.return,y)}}o&64&&sm(a),o&512&&_s(a,a.return);break;case 3:if(bs(i,a),o&64&&(i=a.updateQueue,i!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{Fp(i,s)}catch(y){Qe(a,a.return,y)}}break;case 27:s===null&&o&4&&lm(a);case 26:case 5:bs(i,a),s===null&&o&4&&Md(a),o&512&&_s(a,a.return);break;case 12:bs(i,a);break;case 31:bs(i,a),o&4&&ym(i,a);break;case 13:bs(i,a),o&4&&Sm(i,a),o&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=Y4.bind(null,a),T5(i,a))));break;case 22:if(o=a.memoizedState!==null||Ht,!o){var f=s!==null&&s.memoizedState!==null||Ge;s=Ht,u=Ge,Ht=o,(Ge=f)&&!u?(o=2,(a.subtreeFlags&8772)!==0&&(o|=1),us(i,a,o)):bs(i,a),Ht=s,Ge=u}break;case 30:bs(i,a),o&512&&_s(a,a.return);break;case 7:o&512&&_s(a,a.return);default:bs(i,a)}}function Hd(i,s){for(i=i.child;i!==null;)mm(i,s),i=i.sibling}function mm(i,s){switch(i.tag){case 5:case 26:try{var a=i.stateNode;if(s){var o=a.style;typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"}else{var u=i.stateNode,f=i.memoizedProps.style,y=f!=null&&f.hasOwnProperty("display")?f.display:null;u.style.display=y==null||typeof y=="boolean"?"":(""+y).trim()}}catch(T){Qe(i,i.return,T)}Id(i,s);break;case 6:try{i.stateNode.nodeValue=s?"":i.memoizedProps,We=!0}catch(T){Qe(i,i.return,T)}break;case 18:try{var C=i.stateNode;s?ov(C,!0):ov(i.stateNode,!1)}catch(T){Qe(i,i.return,T)}break;case 22:case 23:i.memoizedState===null&&Hd(i,s);break;default:Hd(i,s)}}function Id(i,s){if(i.subtreeFlags&67108864)for(i=i.child;i!==null;){e:{var a=i,o=s;switch(a.tag){case 4:mm(a,o);break e;case 22:a.memoizedState===null&&Id(a,o);break e;default:Id(a,o)}}i=i.sibling}}function vm(i){var s=i.alternate;s!==null&&(i.alternate=null,vm(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&zo(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var ct=null,yi=!1;function cs(i,s,a){for(a=a.child;a!==null;)_m(i,s,a),a=a.sibling}function _m(i,s,a){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(Ja,a)}catch{}switch(a.tag){case 26:Ge||Zt(a,s),cs(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&!Ge&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ge||Zt(a,s),Tl(a);var o=ct,u=yi;Ln(a.type)&&(ct=a.stateNode,yi=!1),cs(i,s,a),wv(a.stateNode,a.type,a.memoizedProps),ct=o,yi=u;break;case 5:Ge||Zt(a,s),Tl(a);case 6:if(a.tag===6&&Tl(a),o=ct,u=yi,ct=null,cs(i,s,a),ct=o,yi=u,ct!==null)if(yi)try{(ct.nodeType===9?ct.body:ct.nodeName==="HTML"?ct.ownerDocument.body:ct).removeChild(a.stateNode),We=!0}catch(f){Qe(a,s,f)}else try{ct.removeChild(a.stateNode),We=!0}catch(f){Qe(a,s,f)}break;case 18:ct!==null&&(yi?(i=ct,lv(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Da(i)):lv(ct,a.stateNode));break;case 4:o=ct,u=yi,ct=a.stateNode.containerInfo,yi=!0,cs(i,s,a),ct=o,yi=u;break;case 0:case 11:case 14:case 15:Mn(2,a,s),Ge||Mn(4,a,s),cs(i,s,a);break;case 1:Ge||(Zt(a,s),o=a.stateNode,typeof o.componentWillUnmount=="function"&&nm(a,s,o)),cs(i,s,a);break;case 21:cs(i,s,a);break;case 22:Ge=(o=Ge)||a.memoizedState!==null,cs(i,s,a),Ge=o;break;case 30:Zt(a,s),cs(i,s,a);break;case 7:Ge||Zt(a,s),cs(i,s,a);break;default:cs(i,s,a)}}function ym(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Da(i)}catch(a){Qe(s,s.return,a)}}}function Sm(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Da(i)}catch(a){Qe(s,s.return,a)}}function z4(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new pm),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new pm),s;default:throw Error(r(435,i.tag))}}function Nc(i,s){var a=z4(i);s.forEach(function(o){if(!a.has(o)){a.add(o);var u=G4.bind(null,i,o);o.then(u,u)}})}function li(i,s,a){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var f=o[u],y=i,C=s,T=C;e:for(;T!==null;){switch(T.tag){case 27:if(Ln(T.type)){ct=T.stateNode,yi=!1;break e}break;case 5:ct=T.stateNode,yi=!1;break e;case 3:case 4:ct=T.stateNode.containerInfo,yi=!0;break e}T=T.return}if(ct===null)throw Error(r(160));_m(y,C,f),ct=null,yi=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)xm(s,i,a),s=s.sibling}var hs=null;function xm(i,s,a){var o=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(u&4&&(o=i.updateQueue,o=o!==null?o.events:null,o!==null))for(var f=0;f<o.length;f++){var y=o[f];y.ref.impl=y.nextImpl}li(s,i,a),oi(i),u&4&&(Mn(3,i,i.return),jl(3,i),Mn(5,i,i.return));break;case 1:li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),u&64&&Ht&&(i=i.updateQueue,i!==null&&(s=i.callbacks,s!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:if(f=hs,li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),u&4)if(u=o!==null?o.memoizedState:null,a=i.memoizedState,o===null)if(a===null)if(i.stateNode===null)if(Ht)i.stateNode=nv(i.type,i.memoizedProps,s.containerInfo,i);else{e:{s=i.type,a=i.memoizedProps,u=f.ownerDocument||f;t:switch(s){case"title":o=u.getElementsByTagName("title")[0],(!o||o[il]||o[Ft]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=u.createElement(s),u.head.insertBefore(o,u.querySelector("head > title"))),Xt(o,s,a),o[Ft]=i,Ot(o),s=o;break e;case"link":if(f=jv("link","href",u).get(s+(a.href||""))){for(y=0;y<f.length;y++)if(o=f[y],o.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&o.getAttribute("rel")===(a.rel==null?null:a.rel)&&o.getAttribute("title")===(a.title==null?null:a.title)&&o.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(y,1);break t}}o=u.createElement(s),Xt(o,s,a),u.head.appendChild(o);break;case"meta":if(f=jv("meta","content",u).get(s+(a.content||""))){for(y=0;y<f.length;y++)if(o=f[y],o.getAttribute("content")===(a.content==null?null:""+a.content)&&o.getAttribute("name")===(a.name==null?null:a.name)&&o.getAttribute("property")===(a.property==null?null:a.property)&&o.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&o.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(y,1);break t}}o=u.createElement(s),Xt(o,s,a),u.head.appendChild(o);break;default:throw Error(r(468,s))}o[Ft]=i,Ot(o),s=o}i.stateNode=s}else Ht||b0(f,i.type,i.stateNode);else i.stateNode=Mv(f,a,i.memoizedProps);else u!==a?(u===null?(s=o.stateNode,s===null||Ge||s.parentNode.removeChild(s)):u.count--,a===null?Ht||b0(f,i.type,i.stateNode):Mv(f,a,i.memoizedProps)):a===null&&i.stateNode!==null&&jd(i,i.memoizedProps,o.memoizedProps);break;case 27:li(s,i,a),oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),o!==null&&u&4&&jd(i,i.memoizedProps,o.memoizedProps);break;case 5:if(f=xs,xs=!1,li(s,i,a),xs=f,oi(i),u&512&&(Ge||o===null||Zt(o,o.return)),i.flags&32){s=i.stateNode;try{Kr(s,""),We=!0}catch(ee){Qe(i,i.return,ee)}}u&4&&i.stateNode!=null&&(s=i.memoizedProps,jd(i,s,o!==null?o.memoizedProps:s)),u&1024&&(Od=!0);break;case 6:if(li(s,i,a),oi(i),u&4){if(i.stateNode===null)throw Error(r(162));s=i.memoizedProps,a=i.stateNode;try{a.nodeValue=s,We=!0}catch(ee){Qe(i,i.return,ee)}}break;case 3:if(We=!1,Yc=null,f=hs,hs=Il(s.containerInfo),li(s,i,a),hs=f,oi(i),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Da(s.containerInfo)}catch(ee){Qe(i,i.return,ee)}Od&&(Od=!1,wm(i)),We=!1;break;case 4:u=xs,xs=Ht,o=q1(),f=hs,hs=Il(i.stateNode.containerInfo),li(s,i,a),oi(i),hs=f,We&&Dl&&(Rc=!0),We=o,xs=u;break;case 12:li(s,i,a),oi(i);break;case 31:li(s,i,a),oi(i),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 13:li(s,i,a),oi(i),i.child.flags&8192&&i.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Oc=Ei()),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 22:f=i.memoizedState!==null,y=o!==null&&o.memoizedState!==null;var C=Ht,T=Ge,G=xs;Ht=C||f,xs=G||f,Ge=T||y,li(s,i,a),Ge=T,xs=G,Ht=C,oi(i),u&8192&&(s=i.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,!f||o===null||y||Ht||Ge||(s=y||Ge,a=Ht,o=Ge,Ht=f||Ht,Ge=s,jn(i,2),Ht=a,Ge=o),!f&&xs||Hd(i,f)),u&4&&(s=i.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Nc(i,a))));break;case 19:li(s,i,a),oi(i),u&4&&(s=i.updateQueue,s!==null&&(i.updateQueue=null,Nc(i,s)));break;case 30:u&512&&(Ge||o===null||Zt(o,o.return)),u=q1(),f=Dl,y=(a&335544064)===a,C=i.memoizedProps,Dl=y&&Us(C.default,C.update)!=="none",li(s,i,a),oi(i),y&&o!==null&&We&&(i.flags|=4),Dl=f,We=u;break;case 21:break;case 7:u&512&&(Ge||o===null||Zt(o,o.return)),o&&o.stateNode!==null&&(o.stateNode._fragmentFiber=i);default:li(s,i,a),oi(i)}}function oi(i){var s=i.flags;if(s&2){try{for(var a,o=i.return;o!==null;){if(am(o)){a=o;break}o=o.return}o=null;for(var u=i.return;u!==null;){if(Ed(u)){var f=u.stateNode;o===null?o=[f]:o.push(f)}if(kd(u))break;u=u.return}var y=o;if(a==null)throw Error(r(160));switch(a.tag){case 27:var C=a.stateNode,T=Td(i);Mc(i,T,C,y);break;case 5:var G=a.stateNode;a.flags&32&&(Kr(G,""),a.flags&=-33);var ee=Td(i);Mc(i,ee,G,y);break;case 3:case 4:var se=a.stateNode.containerInfo,W=Td(i);Dd(i,W,se,y);break;default:throw Error(r(161))}}catch(X){Qe(i,i.return,X)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function wm(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;wm(s),s.tag===5&&s.flags&1024&&(s=s.stateNode,Ta=!0,s.reset(),Ta=!1),i=i.sibling}}function da(i,s){if(s.subtreeFlags&9270)for(s=s.child;s!==null;)bm(s,i),s=s.sibling;else fm(s)}function bm(i,s){var a=i.alternate;if(a===null)Rd(i,!1);else switch(i.tag){case 3:if(zd=ws=!1,cm(),da(s,i),!ws&&!Rc){if(i=ys,i!==null)for(var o=0;o<i.length;o+=3){a=i[o];var u=i[o+1];hv(a,i[o+2]),a=a.ownerDocument.documentElement,a!==null&&a.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+u+")"})}i=s.containerInfo,i=i.nodeType===9?i.documentElement:i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName===""&&(i.style.viewTransitionName="none",i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),i.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),zd=!0}ys=null;break;case 5:da(s,i);break;case 4:o=ws,ws=!1,da(s,i),ws&&(Rc=!0),ws=o;break;case 22:i.memoizedState===null&&(a.memoizedState!==null?Rd(i,!1):da(s,i));break;case 30:o=ws,u=cm(),ws=!1,da(s,i),ws&&(i.flags|=4);var f=i.memoizedProps,y=i.stateNode;s=Is(f,y),y=Is(a.memoizedProps,y);var C=Us(f.default,f.update);C==="none"?s=!1:(f=a.memoizedState,a.memoizedState=null,a=i.child,_i=0,s=Bd(i,a,s,y,C,f,!0),_i!==(f===null?0:f.length)&&(i.flags|=32)),(i.flags&4)!==0&&s?(ya(i,i.memoizedProps.onUpdate),ys=u):u!==null&&(u.push.apply(u,ys),ys=u),ws=(i.flags&32)!==0?!0:o;break;default:da(s,i)}}function bs(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)gm(i,s.alternate,s),s=s.sibling}function jn(i,s){for(i=i.child;i!==null;){var a=i,o=s;switch(a.tag){case 0:case 11:case 14:case 15:Mn(4,a,a.return),jn(a,o);break;case 1:Zt(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&nm(a,a.return,u),jn(a,o);break;case 27:(o&2)!==0&&wv(a.stateNode,a.type,a.memoizedProps);case 5:Zt(a,a.return),a.tag!==5&&a.tag!==27||Tl(a),jn(a,o);break;case 6:Tl(a);break;case 26:Zt(a,a.return),u=a.stateNode,a.memoizedState!==null||u===null||Ge||u.parentNode.removeChild(u),jn(a,o);break;case 22:a.memoizedState===null&&jn(a,o);break;case 30:Zt(a,a.return),jn(a,o);break;case 7:Zt(a,a.return);default:jn(a,o)}i=i.sibling}}function us(i,s,a){for(a=(s.subtreeFlags&8772)!==0?a:a&-2,s=s.child;s!==null;){var o=s.alternate,u=i,f=s,y=f.flags,C=(a&1)!==0;switch(f.tag){case 0:case 11:case 15:us(u,f,a),jl(4,f);break;case 1:if(us(u,f,a),o=f,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(ee){Qe(o,o.return,ee)}if(o=f,u=o.updateQueue,u!==null){var T=o.stateNode;try{var G=u.shared.hiddenCallbacks;if(G!==null)for(u.shared.hiddenCallbacks=null,u=0;u<G.length;u++)Wp(G[u],T)}catch(ee){Qe(o,o.return,ee)}}C&&y&64&&sm(f),_s(f,f.return);break;case 27:(a&2)!==0&&lm(f);case 5:f.tag!==5&&f.tag!==27||rm(f),us(u,f,a),C&&o===null&&y&4&&Md(f),_s(f,f.return);break;case 6:rm(f);break;case 26:T=f.stateNode,f.memoizedState!==null||T===null||Ht||b0(Il(T.ownerDocument),f.type,T),us(u,f,a),C&&o===null&&y&4&&Md(f),_s(f,f.return);break;case 12:us(u,f,a);break;case 31:us(u,f,a),C&&y&4&&ym(u,f);break;case 13:us(u,f,a),C&&y&4&&Sm(u,f);break;case 22:f.memoizedState===null&&us(u,f,a),_s(f,f.return);break;case 30:us(u,f,a),_s(f,f.return);break;case 7:_s(f,f.return);default:us(u,f,a)}s=s.sibling}}function Ud(i,s){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&gl(a))}function Pd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&gl(i))}function Ki(i,s,a,o){var u=(a&335544064)===a;if(s.subtreeFlags&(u?10262:10256))for(s=s.child;s!==null;)Cm(i,s,a,o),s=s.sibling;else u&&dm(s)}function Cm(i,s,a,o){var u=(a&335544064)===a;u&&s.alternate===null&&s.return!==null&&s.return.alternate!==null&&Dc(s);var f=s.flags;switch(s.tag){case 0:case 11:case 15:Ki(i,s,a,o),f&2048&&jl(9,s);break;case 1:Ki(i,s,a,o);break;case 3:Ki(i,s,a,o),u&&zd&&(i=i.containerInfo,i=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,i.style.viewTransitionName==="root"&&(i.style.viewTransitionName=""),i=i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName==="none"&&(i.style.viewTransitionName="")),f&2048&&(f=null,s.alternate!==null&&(f=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==f&&(s.refCount++,f!=null&&gl(f)));break;case 12:if(f&2048){Ki(i,s,a,o),f=s.stateNode;try{var y=s.memoizedProps,C=y.id,T=y.onPostCommit;typeof T=="function"&&T(C,s.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(G){Qe(s,s.return,G)}}else Ki(i,s,a,o);break;case 31:Ki(i,s,a,o);break;case 13:Ki(i,s,a,o);break;case 23:break;case 22:y=s.stateNode,C=s.alternate,s.memoizedState!==null?(u&&C!==null&&C.memoizedState===null&&Dc(C),y._visibility&2?Ki(i,s,a,o):Rl(i,s)):(u&&C!==null&&C.memoizedState!==null&&Dc(s),y._visibility&2?Ki(i,s,a,o):(y._visibility|=2,fa(i,s,a,o,(s.subtreeFlags&10256)!==0||!1))),f&2048&&Ud(C,s);break;case 24:Ki(i,s,a,o),f&2048&&Pd(s.alternate,s);break;case 30:u&&(f=s.alternate,f!==null&&(Ss(f.child,!0),Ss(s.child,!0))),Ki(i,s,a,o);break;default:Ki(i,s,a,o)}}function fa(i,s,a,o,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var f=i,y=s,C=a,T=o,G=y.flags;switch(y.tag){case 0:case 11:case 15:fa(f,y,C,T,u),jl(8,y);break;case 23:break;case 22:var ee=y.stateNode;y.memoizedState!==null?ee._visibility&2?fa(f,y,C,T,u):Rl(f,y):(ee._visibility|=2,fa(f,y,C,T,u)),u&&G&2048&&Ud(y.alternate,y);break;case 24:fa(f,y,C,T,u),u&&G&2048&&Pd(y.alternate,y);break;default:fa(f,y,C,T,u)}s=s.sibling}}function Rl(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,o=s,u=o.flags;switch(o.tag){case 22:Rl(a,o),u&2048&&Ud(o.alternate,o);break;case 24:Rl(a,o),u&2048&&Pd(o.alternate,o);break;default:Rl(a,o)}s=s.sibling}}var xr=8192;function wr(i,s,a){if(i.subtreeFlags&xr)for(i=i.child;i!==null;)km(i,s,a),i=i.sibling}function km(i,s,a){switch(i.tag){case 26:wr(i,s,a),i.flags&xr&&(i.memoizedState!==null?V5(a,hs,i.memoizedState,i.memoizedProps):(i=i.stateNode,(s&335544128)===s&&Av(a,i)));break;case 5:wr(i,s,a),i.flags&xr&&(i=i.stateNode,(s&335544128)===s&&Av(a,i));break;case 3:case 4:var o=hs;hs=Il(i.stateNode.containerInfo),wr(i,s,a),hs=o;break;case 22:i.memoizedState===null&&(o=i.alternate,o!==null&&o.memoizedState!==null?(o=xr,xr=16777216,wr(i,s,a),xr=o):wr(i,s,a));break;case 30:if((i.flags&xr)!==0&&(o=i.memoizedProps.name,o!=null&&o!=="auto")){var u=i.stateNode;u.paired=null,Ai===null&&(Ai=new Map),Ai.set(o,u)}wr(i,s,a);break;default:wr(i,s,a)}}function Em(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Al(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var o=s[a];It=o,jm(o,i)}Em(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Mm(i),i=i.sibling}function Mm(i){switch(i.tag){case 0:case 11:case 15:Al(i),i.flags&2048&&Mn(9,i,i.return);break;case 3:Al(i);break;case 12:Al(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Lc(i)):Al(i);break;default:Al(i)}}function Lc(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var o=s[a];It=o,jm(o,i)}Em(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:Mn(8,s,s.return),Lc(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,Lc(s));break;default:Lc(s)}i=i.sibling}}function jm(i,s){for(;It!==null;){var a=It;switch(a.tag){case 0:case 11:case 15:Mn(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:gl(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,It=o;else e:for(a=i;It!==null;){o=It;var u=o.sibling,f=o.return;if(vm(o),o===a){It=null;break e}if(u!==null){u.return=f,It=u;break e}It=f}}}var H4={getCacheForType:function(i){var s=Kt(xt),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a},cacheSignal:function(){return Kt(xt).controller.signal}},I4=typeof WeakMap=="function"?WeakMap:Map,Ye=0,st=null,Ie=null,Pe=0,Xe=0,Ni=null,Tn=!1,pa=!1,qd=!1,Gs=0,mt=0,Dn=0,br=0,Bc=0,Li=0,ga=0,Nl=null,Si=null,Vd=!1,Oc=0,Tm=0,zc=1/0,Hc=null,Rn=null,ut=0,ds=null,Cr=null,Cs=0,$d=0,Wd=null,Dm=null,ma=null,va=null,_a=null,Ll=0,Ic=null;function Bi(){return(Ye&2)!==0&&Pe!==0?Pe&-Pe:pe.T!==null?t0():N1()}function Rm(){if(Li===0)if((Pe&536870912)===0||Oe){var i=No;No<<=1,(No&3932160)===0&&(No=262144),Li=i}else Li=536870912;return i=Yt.current,i!==null&&(i.flags|=32),Li}function ya(i,s){if(s!=null){var a=i.stateNode,o=a.ref;o===null&&(o=a.ref=uv(Is(i.memoizedProps,a))),va===null&&(va=[]),va.push(s.bind(null,o))}}function xi(i,s,a){(i===st&&(Xe===2||Xe===9)||i.cancelPendingCommit!==null)&&(Sa(i,0),An(i,Pe,Li,!1)),tl(i,a),((Ye&2)===0||i!==st)&&(i===st&&((Ye&2)===0&&(br|=a),mt===4&&An(i,Pe,Li,!1)),ks(i))}function Am(i,s,a){if((Ye&6)!==0)throw Error(r(327));var o=!a&&(s&127)===0&&(s&i.expiredLanes)===0||el(i,s),u=o?q4(i,s):Kd(i,s,!0),f=o;do{if(u===0){pa&&!o&&An(i,s,0,!1);break}else{if(a=i.current.alternate,f&&!U4(a)){u=Kd(i,s,!1),f=!1;continue}if(u===2){if(f=s,i.errorRecoveryDisabledLanes&f)var y=0;else y=i.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){s=y;e:{var C=i;u=Nl;var T=C.current.memoizedState.isDehydrated;if(T&&(Sa(C,y).flags|=256),y=Kd(C,y,!1),y!==2&&y!==6){if(qd&&!T){C.errorRecoveryDisabledLanes|=f,br|=f,u=4;break e}f=Si,Si=u,f!==null&&(Si===null?Si=f:Si.push.apply(Si,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){Sa(i,0),An(i,s,0,!0);break}e:{switch(o=i,f=u,f){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s&&(s&62914560)!==s)break;case 6:An(o,s,Li,!Tn);break e;case 2:Si=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(u=Oc+300-Ei(),10<u)){if(An(o,s,Li,!Tn),Bo(o,0,!0)!==0)break e;Cs=s,o.timeoutHandle=d0(Nm.bind(null,o,a,Si,Hc,Vd,s,Li,br,ga,Tn,f,"Throttled",-0,0),u);break e}Nm(o,a,Si,Hc,Vd,s,Li,br,ga,Tn,f,null,-0,0)}}break}while(!0);ks(i)}function Nm(i,s,a,o,u,f,y,C,T,G,ee,se,W,X){i.timeoutHandle=-1;var fe=s.subtreeFlags,ye=(f&335544064)===f;if(se=null,(ye||fe&8192||(fe&16785408)===16785408)&&(se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gs},Ai=null,km(s,f,se),ye&&(fe=se,ye=i.containerInfo,ye=(ye.nodeType===9?ye:ye.ownerDocument).__reactViewTransition,ye!=null&&(fe.count++,fe.waitingForViewTransition=!0,fe=ql.bind(fe),ye.finished.then(fe,fe))),fe=(f&62914560)===f?Oc-Ei():(f&4194048)===f?Tm-Ei():0,fe=$5(se,fe),fe!==null)){Cs=f,i.cancelPendingCommit=fe(Pm.bind(null,i,s,f,a,o,u,y,C,T,G,ee,se,null,W,X)),An(i,f,y,!G);return}Pm(i,s,f,a,o,u,y,C,T,G,ee,se)}function U4(i){for(var s=i;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],f=u.getSnapshot;u=u.value;try{if(!Di(f(),u))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function An(i,s,a,o){s=j1(i,s),s&=~Bc,s&=~br,i.suspendedLanes|=s,i.pingedLanes&=~s,o&&(i.warmLanes|=s),o=i.expirationTimes;for(var u=s;0<u;){var f=31-ji(u),y=1<<f;o[f]=-1,u&=~y}a!==0&&D1(i,a,s)}function Uc(){return(Ye&6)===0?(Bl(0),!1):!0}function Fd(){if(Ie!==null){if(Xe===0)var i=Ie.return;else i=Ie,Vs=ur=null,ed(i),aa=null,_l=0,i=Ie;for(;i!==null;)im(i.alternate,i),i=i.return;Ie=null}}function Sa(i,s){var a=i.timeoutHandle;return a!==-1&&(i.timeoutHandle=-1,h5(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),Cs=0,Fd(),st=i,Ie=a=Ps(i.current,null),Pe=s,Xe=0,Ni=null,Tn=!1,pa=el(i,s),qd=!1,ga=Li=Bc=br=Dn=mt=0,Si=Nl=null,Vd=!1,Gs=j1(i,s),Yo(),a}function Lm(i,s){Le=null,pe.H=yc,s===ra||s===rc?(s=Pp(),Xe=3):s===Pu?(s=Pp(),Xe=4):Xe=s===gd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Ni=s,Ie===null&&(mt=1,Sc(i,Vi(s,i.current)))}function Bm(){var i=Yt.current;return i===null?!0:(Pe&4194048)===Pe?ii===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?i===ii:!1}function Om(){var i=pe.H;return pe.H=yc,i===null?yc:i}function zm(){var i=pe.A;return pe.A=H4,i}function Pc(){mt=4,Tn||(Pe&4194048)!==Pe&&Yt.current!==null||(pa=!0),(Dn&134217727)===0&&(br&134217727)===0||st===null||An(st,Pe,Li,!1)}function Kd(i,s,a){var o=Ye;Ye|=2;var u=Om(),f=zm();(st!==i||Pe!==s)&&(Hc=null,Sa(i,s)),s=!1;var y=mt;e:do try{if(Xe!==0&&Ie!==null){var C=Ie,T=Ni;switch(Xe){case 8:Fd(),y=6;break e;case 3:case 2:case 9:case 6:Yt.current===null&&(s=!0);var G=Xe;if(Xe=0,Ni=null,xa(i,C,T,G),a&&pa){y=0;break e}break;default:G=Xe,Xe=0,Ni=null,xa(i,C,T,G)}}P4(),y=mt;break}catch(ee){Lm(i,ee)}while(!0);return s&&i.shellSuspendCounter++,Vs=ur=null,Ye=o,pe.H=u,pe.A=f,Ie===null&&(st=null,Pe=0,Yo()),y}function P4(){for(;Ie!==null;)Hm(Ie)}function q4(i,s){var a=Ye;Ye|=2;var o=Om(),u=zm();st!==i||Pe!==s?(Hc=null,zc=Ei()+500,Sa(i,s)):pa=el(i,s);e:do try{if(Xe!==0&&Ie!==null){s=Ie;var f=Ni;t:switch(Xe){case 1:Xe=0,Ni=null,xa(i,s,f,1);break;case 2:case 9:if(Ip(f)){Xe=0,Ni=null,Im(s);break}s=function(){Xe!==2&&Xe!==9||st!==i||(Xe=7),ks(i)},f.then(s,s);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:Ip(f)?(Xe=0,Ni=null,Im(s)):(Xe=0,Ni=null,xa(i,s,f,7));break;case 5:var y=null;switch(Ie.tag){case 26:y=Ie.memoizedState;case 5:case 27:var C=Ie;if(y?Dv(y):C.stateNode.complete){Xe=0,Ni=null;var T=C.sibling;if(T!==null)Ie=T;else{var G=C.return;G!==null?(Ie=G,qc(G)):Ie=null}break t}}Xe=0,Ni=null,xa(i,s,f,5);break;case 6:Xe=0,Ni=null,xa(i,s,f,6);break;case 8:Fd(),mt=6;break e;default:throw Error(r(462))}}V4();break}catch(ee){Lm(i,ee)}while(!0);return Vs=ur=null,pe.H=o,pe.A=u,Ye=a,Ie!==null?0:(st=null,Pe=0,Yo(),mt)}function V4(){for(;Ie!==null&&!aw();)Hm(Ie)}function Hm(i){var s=em(i.alternate,i,Gs);i.memoizedProps=i.pendingProps,s===null?qc(i):Ie=s}function Im(i){var s=i,a=s.alternate;switch(s.tag){case 15:case 0:s=Kg(a,s,s.pendingProps,s.type,void 0,Pe);break;case 11:s=Kg(a,s,s.pendingProps,s.type.render,s.ref,Pe);break;case 5:ed(s);var o=s;o===zt&&(Oe?(ec(o),o.tag===5&&o.stateNode!=null&&(nt=o.stateNode)):(ec(o),Oe=!0));default:im(a,s),s=Ie=jp(s,Gs),s=em(a,s,Gs)}i.memoizedProps=i.pendingProps,s===null?qc(i):Ie=s}function xa(i,s,a,o){Vs=ur=null,ed(s),aa=null,_l=0;var u=s.return;try{if(D4(i,u,s,a,Pe)){mt=1,Sc(i,Vi(a,i.current)),Ie=null;return}}catch(f){if(u!==null)throw Ie=u,f;mt=1,Sc(i,Vi(a,i.current)),Ie=null;return}s.flags&32768?(Oe||o===1?i=!0:pa||(Pe&536870912)!==0?i=!1:(Tn=i=!0,(o===2||o===9||o===3||o===6)&&(o=Yt.current,o!==null&&o.tag===13&&(o.flags|=16384))),Um(s,i)):qc(s)}function qc(i){var s=i;do{if((s.flags&32768)!==0){Um(s,Tn);return}i=s.return;var a=L4(s.alternate,s,Gs);if(a!==null){Ie=a;return}if(s=s.sibling,s!==null){Ie=s;return}Ie=s=i}while(s!==null);mt===0&&(mt=5)}function Um(i,s){do{var a=B4(i.alternate,i);if(a!==null){a.flags&=32767,Ie=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Ie=i;return}Ie=i=a}while(i!==null);mt=6,Ie=null}function Pm(i,s,a,o,u,f,y,C,T,G,ee,se){i.cancelPendingCommit=null;do Vc();while(ut!==0);if((Ye&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));i===st&&(Ie=st=null,Pe=0),Cr=s,ds=i,Cs=a,Wd=u,Dm=o,$4(i,s,a,y,C,T,se)}}function $4(i,s,a,o,u,f,y){var C=s.lanes|s.childLanes;if($d=C,C|=ju,mw(i,a,C,o,u,f),va=null,(a&335544064)===a?(_a=_4(i),o=10262):(_a=null,o=10256),(s.subtreeFlags&o)!==0||(s.flags&o)!==0?(i.callbackNode=null,i.callbackPriority=0,Z4(Ro,function(){return Xd(),null})):(i.callbackNode=null,i.callbackPriority=0),jc=!1,o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=pe.T,pe.T=null,u=_e.p,_e.p=2,f=Ye,Ye|=4;try{O4(i,s,a)}finally{Ye=f,_e.p=u,pe.T=o}}ut=1,jc?ma=m5(y,i.containerInfo,_a,Yd,Gd,F4,Zd,Xd,W4):(Yd(),Gd(),Zd())}function W4(i){if(ut!==0){var s=ds.onRecoverableError;s(i,{componentStack:null})}}function F4(){ut===3&&(ut=0,bm(Cr,ds),ut=4)}function Yd(){if(ut===1){ut=0;var i=ds,s=Cr,a=Cs,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=pe.T,pe.T=null;var u=_e.p;_e.p=2;var f=Ye;Ye|=4;try{Dl=Rc=!1,xm(s,i,a),a=c0;var y=_p(i.containerInfo),C=a.focusedElem,T=a.selectionRange;if(y!==C&&C&&C.ownerDocument&&vp(C.ownerDocument.documentElement,C)){if(T!==null&&bu(C)){var G=T.start,ee=T.end;if(ee===void 0&&(ee=G),"selectionStart"in C)C.selectionStart=G,C.selectionEnd=Math.min(ee,C.value.length);else{var se=C.ownerDocument||document,W=se&&se.defaultView||window;if(W.getSelection){var X=W.getSelection(),fe=C.textContent.length,ye=Math.min(T.start,fe),Be=T.end===void 0?ye:Math.min(T.end,fe);!X.extend&&ye>Be&&(y=Be,Be=ye,ye=y);var K=mp(C,ye),H=mp(C,Be);if(K&&H&&(X.rangeCount!==1||X.anchorNode!==K.node||X.anchorOffset!==K.offset||X.focusNode!==H.node||X.focusOffset!==H.offset)){var Z=se.createRange();Z.setStart(K.node,K.offset),X.removeAllRanges(),ye>Be?(X.addRange(Z),X.extend(H.node,H.offset)):(Z.setEnd(H.node,H.offset),X.addRange(Z))}}}}for(se=[],X=C;X=X.parentNode;)X.nodeType===1&&se.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<se.length;C++){var ie=se[C];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Ta=!!o0,c0=o0=null}finally{Ye=f,_e.p=u,pe.T=o}}i.current=s,ut=2}}function Gd(){if(ut===2){ut=0;var i=ds,s=Cr,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=pe.T,pe.T=null;var o=_e.p;_e.p=2;var u=Ye;Ye|=4;try{gm(i,s.alternate,s)}finally{Ye=u,_e.p=o,pe.T=a}}ut=3}}function Zd(){if(ut===4||ut===3){ut=0;var i=ma;ma=null,lw();var s=ds,a=Cr,o=Cs,u=Dm,f=(o&335544064)===o?10262:10256;if((a.subtreeFlags&f)!==0||(a.flags&f)!==0?ut=5:(ut=0,Cr=ds=null,qm(s,s.pendingLanes)),f=s.pendingLanes,f===0&&(Rn=null),ru(o),a=a.stateNode,Mi&&typeof Mi.onCommitFiberRoot=="function")try{Mi.onCommitFiberRoot(Ja,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=pe.T,f=_e.p,_e.p=2,pe.T=null;try{for(var y=s.onRecoverableError,C=0;C<u.length;C++){var T=u[C];y(T.value,{componentStack:T.stack})}}finally{pe.T=a,_e.p=f}}if(u=va,y=_a,_a=null,u!==null&&(va=null,y===null&&(y=[]),i!==null))for(T=0;T<u.length;T++)a=(0,u[T])(y),a!==void 0&&i.finished.finally(a);(Cs&3)!==0&&Vc(),ks(s),f=s.pendingLanes,(o&261930)!==0&&(f&42)!==0?s===Ic?Ll++:(Ll=0,Ic=s):(Ll=0,Ic=null),Bl(0)}}function qm(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,gl(s)))}function Vc(){return ma!==null&&(ma.skipTransition(),ma=null),Yd(),Gd(),Zd(),Xd()}function Xd(){if(ut!==5)return!1;var i=ds,s=$d;$d=0;var a=ru(Cs),o=pe.T,u=_e.p;try{_e.p=32>a?32:a,pe.T=null,a=Wd,Wd=null;var f=ds,y=Cs;if(ut=0,Cr=ds=null,Cs=0,(Ye&6)!==0)throw Error(r(331));var C=Ye;if(Ye|=4,Mm(f.current),Cm(f,f.current,y,a),Ye=C,Bl(0,!1),Mi&&typeof Mi.onPostCommitFiberRoot=="function")try{Mi.onPostCommitFiberRoot(Ja,f)}catch{}return!0}finally{_e.p=u,pe.T=o,qm(i,s)}}function Vm(i,s,a){s=Vi(a,s),s=pd(i.stateNode,s,2),i=bn(i,s,2),i!==null&&(tl(i,2),ks(i))}function Qe(i,s,a){if(i.tag===3)Vm(i,i,a);else for(;s!==null;){if(s.tag===3){Vm(s,i,a);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Rn===null||!Rn.has(o))){i=Vi(a,i),a=Ig(2),o=bn(s,a,2),o!==null&&(Ug(a,o,s,i),tl(o,2),ks(o));break}}s=s.return}}function Qd(i,s,a){var o=i.pingCache;if(o===null){o=i.pingCache=new I4;var u=new Set;o.set(s,u)}else u=o.get(s),u===void 0&&(u=new Set,o.set(s,u));u.has(a)||(qd=!0,u.add(a),i=K4.bind(null,i,s,a),s.then(i,i))}function K4(i,s,a){var o=i.pingCache;o!==null&&o.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,st===i&&(Pe&a)===a&&((mt===4||mt===3&&(Pe&62914560)===Pe&&300>Ei()-Oc)&&(Ye&2)===0?Sa(i,0):Bc|=a,ga===Pe&&(ga=0)),ks(i)}function $m(i,s){s===0&&(s=T1()),i=or(i,s),i!==null&&(tl(i,s),ks(i))}function Y4(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),$m(i,a)}function G4(i,s){var a=0;switch(i.tag){case 31:case 13:var o=i.stateNode,u=i.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=i.stateNode;break;case 22:o=i.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(s),$m(i,a)}function Z4(i,s){return tu(i,s)}var wa=null,ba=null,Jd=!1,$c=!1,e0=!1,Nn=0;function ks(i){i!==ba&&i.next===null&&(ba===null?wa=ba=i:ba=ba.next=i),$c=!0,Jd||(Jd=!0,Q4())}function Bl(i,s){if(!e0&&$c){e0=!0;do for(var a=!1,o=wa;o!==null;){if(i!==0){var u=o.pendingLanes;if(u===0)var f=0;else{var y=o.suspendedLanes,C=o.pingedLanes;f=(1<<31-ji(42|i)+1)-1,f&=u&~(y&~C),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Ym(o,f))}else f=Pe,f=Bo(o,o===st?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||el(o,f)||(a=!0,Ym(o,f));o=o.next}while(a);e0=!1}}function X4(){Wm()}function Wm(){$c=Jd=!1;var i=0;Nn!==0&&c5()&&(i=Nn);for(var s=Ei(),a=null,o=wa;o!==null;){var u=o.next,f=Fm(o,s);f===0?(o.next=null,a===null?wa=u:a.next=u,u===null&&(ba=a)):(a=o,(i!==0||(f&3)!==0)&&($c=!0)),o=u}ut!==0&&ut!==5||Bl(i),Nn!==0&&(Nn=0)}function Fm(i,s){for(var a=i.suspendedLanes,o=i.pingedLanes,u=i.expirationTimes,f=i.pendingLanes&-62914561;0<f;){var y=31-ji(f),C=1<<y,T=u[y];T===-1?((C&a)===0||(C&o)!==0)&&(u[y]=gw(C,s)):T<=s&&(i.expiredLanes|=C),f&=~C}if(s=st,a=Pe,a=Bo(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),o=i.callbackNode,a===0||i===s&&(Xe===2||Xe===9)||i.cancelPendingCommit!==null)return o!==null&&o!==null&&iu(o),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||el(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(o!==null&&iu(o),ru(a)){case 2:case 8:a=E1;break;case 32:a=Ro;break;case 268435456:a=M1;break;default:a=Ro}return o=Km.bind(null,i),a=tu(a,o),i.callbackPriority=s,i.callbackNode=a,s}return o!==null&&o!==null&&iu(o),i.callbackPriority=2,i.callbackNode=null,2}function Km(i,s){if(ut!==0&&ut!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Vc()&&i.callbackNode!==a)return null;var o=Pe;return o=Bo(i,i===st?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),o===0?null:(Am(i,o,s),Fm(i,Ei()),i.callbackNode!=null&&i.callbackNode===a?Km.bind(null,i):null)}function Ym(i,s){if(Vc())return null;Am(i,s,!0)}function Q4(){u5(function(){(Ye&6)!==0?tu(k1,X4):Wm()})}function t0(){if(Nn===0){var i=pr;i===0&&(i=Ao,Ao<<=1,(Ao&261888)===0&&(Ao=256)),Nn=i}return Nn}function Gm(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Uo(i)}function J4(i,s,a,o,u){if(s==="submit"&&a&&a.stateNode===u){var f=Gm((u[mi]||null).action),y=o.submitter;y&&(s=(s=y[mi]||null)?Gm(s.formAction):y.getAttribute("formAction"),s!==null&&(f=s,y=null));var C=new $o("action","action",null,o,u);i.push({event:C,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Nn!==0){var T=new FormData(u,y);cd(a,{pending:!0,data:T,method:u.method,action:f},null,T)}}else typeof f=="function"&&(C.preventDefault(),T=new FormData(u,y),cd(a,{pending:!0,data:T,method:u.method,action:f},f,T))},currentTarget:u}]})}}for(var i0=0;i0<Mu.length;i0++){var s0=Mu[i0],e5=s0.toLowerCase(),t5=s0[0].toUpperCase()+s0.slice(1);os(e5,"on"+t5)}os(xp,"onAnimationEnd"),os(wp,"onAnimationIteration"),os(bp,"onAnimationStart"),os("dblclick","onDoubleClick"),os("focusin","onFocus"),os("focusout","onBlur"),os(h4,"onTransitionRun"),os(u4,"onTransitionStart"),os(d4,"onTransitionCancel"),os(Cp,"onTransitionEnd"),Wr("onMouseEnter",["mouseout","mouseover"]),Wr("onMouseLeave",["mouseout","mouseover"]),Wr("onPointerEnter",["pointerout","pointerover"]),Wr("onPointerLeave",["pointerout","pointerover"]),rr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rr("onBeforeInput",["compositionend","keypress","textInput","paste"]),rr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ol="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),i5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ol));function Zm(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var o=i[a],u=o.event;o=o.listeners;e:{var f=void 0;if(s)for(var y=o.length-1;0<=y;y--){var C=o[y],T=C.instance,G=C.currentTarget;if(C=C.listener,T!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=G;try{f(u)}catch(ee){Ko(ee)}u.currentTarget=null,f=T}else for(y=0;y<o.length;y++){if(C=o[y],T=C.instance,G=C.currentTarget,C=C.listener,T!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=G;try{f(u)}catch(ee){Ko(ee)}u.currentTarget=null,f=T}}}}function Ue(i,s){var a=s[B1];a===void 0&&(a=s[B1]=new Set);var o=i+"__bubble";a.has(o)||(Xm(s,i,2,!1),a.add(o))}function n0(i,s,a){var o=0;s&&(o|=4),Xm(a,i,o,s)}var Wc="_reactListening"+Math.random().toString(36).slice(2);function r0(i){if(!i[Wc]){i[Wc]=!0,H1.forEach(function(a){a!=="selectionchange"&&(i5.has(a)||n0(a,!1,i),n0(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Wc]||(s[Wc]=!0,n0("selectionchange",!1,s))}}function Xm(i,s,a,o){switch(Uv(s)){case 2:var u=Y5;break;case 8:u=G5;break;default:u=k0}a=u.bind(null,s,a,i),u=void 0,!fu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),o?u!==void 0?i.addEventListener(s,a,{capture:!0,passive:u}):i.addEventListener(s,a,!0):u!==void 0?i.addEventListener(s,a,{passive:u}):i.addEventListener(s,a,!1)}function a0(i,s,a,o,u){var f=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var y=o.tag;if(y===3||y===4){var C=o.stateNode.containerInfo;if(C===u)break;if(y===4)for(y=o.return;y!==null;){var T=y.tag;if((T===3||T===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;C!==null;){if(y=nr(C),y===null)return;if(T=y.tag,T===5||T===6||T===26||T===27){o=f=y;continue e}C=C.parentNode}}o=o.return}X1(function(){var G=f,ee=uu(a),se=[];e:{var W=kp.get(i);if(W!==void 0){var X=$o,fe=i;switch(i){case"keypress":if(qo(a)===0)break e;case"keydown":case"keyup":X=Uw;break;case"focusin":fe="focus",X=vu;break;case"focusout":fe="blur",X=vu;break;case"beforeblur":case"afterblur":X=vu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=ep;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=jw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=Ww;break;case xp:case wp:case bp:X=Rw;break;case Cp:X=Kw;break;case"scroll":case"scrollend":X=Ew;break;case"wheel":X=Gw;break;case"copy":case"cut":case"paste":X=Nw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=ip;break;case"submit":X=Vw;break;case"toggle":case"beforetoggle":X=Xw}var ye=(s&4)!==0,Be=!ye&&(i==="scroll"||i==="scrollend"),K=ye?W!==null?W+"Capture":null:W;ye=[];for(var H=G,Z;H!==null;){var ie=H;if(Z=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||Z===null||K===null||(ie=nl(H,K),ie!=null&&ye.push(zl(H,ie,Z))),Be)break;H=H.return}0<ye.length&&(W=new X(W,fe,null,a,ee),se.push({event:W,listeners:ye}))}}if((s&7)===0){e:{if(X=i==="mouseover"||i==="pointerover",W=i==="mouseout"||i==="pointerout",X&&a!==hu&&(fe=a.relatedTarget||a.fromElement)&&(nr(fe)||fe[qr]))break e;(W||X)&&(fe=ee.window===ee?ee:(X=ee.ownerDocument)?X.defaultView||X.parentWindow:window,W?(X=a.relatedTarget||a.toElement,W=G,X=X?nr(X):null,X!==null&&(Be=h(X),ye=X.tag,X!==Be||ye!==5&&ye!==27&&ye!==6)&&(X=null)):(W=null,X=G),W!==X&&(ye=ep,ie="onMouseLeave",K="onMouseEnter",H="mouse",(i==="pointerout"||i==="pointerover")&&(ye=ip,ie="onPointerLeave",K="onPointerEnter",H="pointer"),Be=W==null?fe:sl(W),Z=X==null?fe:sl(X),fe=new ye(ie,H+"leave",W,a,ee),fe.target=Be,fe.relatedTarget=Z,ie=null,nr(ee)===G&&(ye=new ye(K,H+"enter",X,a,ee),ye.target=Z,ye.relatedTarget=Be,ie=ye),Be=ie,ye=W&&X?R(W,X,s5):null,W!==null&&Qm(se,fe,W,ye,!1),X!==null&&Be!==null&&Qm(se,Be,X,ye,!0)))}e:{if(W=G?sl(G):window,X=W.nodeName&&W.nodeName.toLowerCase(),X==="select"||X==="input"&&W.type==="file")var ve=hp;else if(op(W))if(up)ve=l4;else{ve=r4;var qe=n4}else X=W.nodeName,!X||X.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?G&&cu(G.elementType)&&(ve=hp):ve=a4;if(ve&&(ve=ve(i,G))){cp(se,ve,a,ee);break e}qe&&qe(i,W,G)}switch(qe=G?sl(G):window,i){case"focusin":(op(qe)||qe.contentEditable==="true")&&(Xr=qe,Cu=G,dl=null);break;case"focusout":dl=Cu=Xr=null;break;case"mousedown":ku=!0;break;case"contextmenu":case"mouseup":case"dragend":ku=!1,yp(se,a,ee);break;case"selectionchange":if(c4)break;case"keydown":case"keyup":yp(se,a,ee)}var Se;if(yu)e:{switch(i){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Zr?ap(i,a)&&(Me="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(Me="onCompositionStart");Me&&(sp&&a.locale!=="ko"&&(Zr||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Zr&&(Se=Q1()):(pn=ee,pu="value"in pn?pn.value:pn.textContent,Zr=!0)),qe=Fc(G,Me),0<qe.length&&(Me=new tp(Me,i,null,a,ee),se.push({event:Me,listeners:qe}),Se?Me.data=Se:(Se=lp(a),Se!==null&&(Me.data=Se)))),(Se=Jw?e4(i,a):t4(i,a))&&(Me=Fc(G,"onBeforeInput"),0<Me.length&&(qe=new tp("onBeforeInput","beforeinput",null,a,ee),se.push({event:qe,listeners:Me}),qe.data=Se)),J4(se,i,G,a,ee)}Zm(se,s)})}function zl(i,s,a){return{instance:i,listener:s,currentTarget:a}}function Fc(i,s){for(var a=s+"Capture",o=[];i!==null;){var u=i,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=nl(i,a),u!=null&&o.unshift(zl(i,u,f)),u=nl(i,s),u!=null&&o.push(zl(i,u,f))),i.tag===3)return o;i=i.return}return[]}function s5(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Qm(i,s,a,o,u){for(var f=s._reactName,y=[];a!==null&&a!==o;){var C=a,T=C.alternate,G=C.stateNode;if(C=C.tag,T!==null&&T===o)break;C!==5&&C!==26&&C!==27||G===null||(T=G,u?(G=nl(a,f),G!=null&&y.unshift(zl(a,G,T))):u||(G=nl(a,f),G!=null&&y.push(zl(a,G,T)))),a=a.return}y.length!==0&&i.push({event:s,listeners:y})}var n5=/\r\n?/g,r5=/\u0000|\uFFFD/g;function Jm(i){return(typeof i=="string"?i:""+i).replace(n5,`
-`).replace(r5,"")}function ev(i,s){return s=Jm(s),Jm(i)===s}function Je(i,s,a,o,u,f){switch(a){case"children":if(typeof o=="string")s==="body"||s==="textarea"&&o===""||Kr(i,o);else if(typeof o=="number"||typeof o=="bigint")s!=="body"&&Kr(i,""+o);else return;break;case"className":Io(i,"class",o);break;case"tabIndex":Io(i,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Io(i,a,o);break;case"style":G1(i,o,f);return;case"data":if(s!=="object"){Io(i,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){i.removeAttribute(a);break}o=Uo(o),i.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){i.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(a==="formAction"?(s!=="input"&&Je(i,s,"name",u.name,u,null),Je(i,s,"formEncType",u.formEncType,u,null),Je(i,s,"formMethod",u.formMethod,u,null),Je(i,s,"formTarget",u.formTarget,u,null)):(Je(i,s,"encType",u.encType,u,null),Je(i,s,"method",u.method,u,null),Je(i,s,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){i.removeAttribute(a);break}o=Uo(o),i.setAttribute(a,o);break;case"onClick":o!=null&&(i.onclick=gs);return;case"onScroll":o!=null&&Ue("scroll",i);return;case"onScrollEnd":o!=null&&Ue("scrollend",i);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"multiple":i.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":i.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){i.removeAttribute("xlink:href");break}a=Uo(o),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,o):i.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":o===!0?i.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?i.setAttribute(a,o):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?i.setAttribute(a,o):i.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?i.removeAttribute(a):i.setAttribute(a,o);break;case"popover":Ue("beforetoggle",i),Ue("toggle",i),Ho(i,"popover",o);break;case"xlinkActuate":zs(i,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":zs(i,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":zs(i,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":zs(i,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":zs(i,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":zs(i,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":zs(i,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":zs(i,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":zs(i,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Ho(i,"is",o);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=Cw.get(a)||a,Ho(i,a,o);else return}We=!0}function l0(i,s,a,o,u,f){switch(a){case"style":G1(i,o,f);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(r(60));f?.__html!==a&&(i.innerHTML=a)}}break;case"children":if(typeof o=="string")Kr(i,o);else if(typeof o=="number"||typeof o=="bigint")Kr(i,""+o);else return;break;case"onScroll":o!=null&&Ue("scroll",i);return;case"onScrollEnd":o!=null&&Ue("scrollend",i);return;case"onClick":o!=null&&(i.onclick=gs);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!I1.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),f=a.slice(2,u?a.length-7:void 0),s=i[mi]||null,s=s!=null?s[a]:null,typeof s=="function"&&i.removeEventListener(f,s,u),typeof o=="function")){typeof s!="function"&&s!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(f,o,u);break e}We=!0,a in i?i[a]=o:o===!0?i.setAttribute(a,""):Ho(i,a,o)}return}We=!0}function Xt(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",i),Ue("load",i);var o=!1,u=!1,f;for(f in a)if(a.hasOwnProperty(f)){var y=a[f];if(y!=null)switch(f){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Je(i,s,f,y,a,null)}}u&&Je(i,s,"srcSet",a.srcSet,a,null),o&&Je(i,s,"src",a.src,a,null);return;case"input":Ue("invalid",i);var C=f=y=u=null,T=null,G=null;for(o in a)if(a.hasOwnProperty(o)){var ee=a[o];if(ee!=null)switch(o){case"name":u=ee;break;case"type":y=ee;break;case"checked":T=ee;break;case"defaultChecked":G=ee;break;case"value":f=ee;break;case"defaultValue":C=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,s));break;default:Je(i,s,o,ee,a,null)}}W1(i,f,C,T,G,y,u,!1);return;case"select":Ue("invalid",i),o=y=f=null;for(u in a)if(a.hasOwnProperty(u)&&(C=a[u],C!=null))switch(u){case"value":f=C;break;case"defaultValue":y=C;break;case"multiple":o=C;default:Je(i,s,u,C,a,null)}s=f,a=y,i.multiple=!!o,s!=null?Fr(i,!!o,s,!1):a!=null&&Fr(i,!!o,a,!0);return;case"textarea":Ue("invalid",i),f=u=o=null;for(y in a)if(a.hasOwnProperty(y)&&(C=a[y],C!=null))switch(y){case"value":o=C;break;case"defaultValue":u=C;break;case"children":f=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(r(91));break;default:Je(i,s,y,C,a,null)}K1(i,o,u,f);return;case"option":for(T in a)a.hasOwnProperty(T)&&(o=a[T],o!=null)&&(T==="selected"?i.selected=o&&typeof o!="function"&&typeof o!="symbol":Je(i,s,T,o,a,null));return;case"dialog":Ue("beforetoggle",i),Ue("toggle",i),Ue("cancel",i),Ue("close",i);break;case"iframe":case"object":Ue("load",i);break;case"video":case"audio":for(o=0;o<Ol.length;o++)Ue(Ol[o],i);break;case"image":Ue("error",i),Ue("load",i);break;case"details":Ue("toggle",i);break;case"embed":case"source":case"link":Ue("error",i),Ue("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(o=a[G],o!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Je(i,s,G,o,a,null)}return;default:if(cu(s)){for(ee in a)a.hasOwnProperty(ee)&&(o=a[ee],o!==void 0&&l0(i,s,ee,o,a,void 0));return}}for(C in a)a.hasOwnProperty(C)&&(o=a[C],o!=null&&Je(i,s,C,o,a,null))}var a5={};function l5(i,s,a,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,C=null,T=null,G=null,ee=null;for(X in a){var se=a[X];if(a.hasOwnProperty(X)&&se!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":T=se;default:o.hasOwnProperty(X)||Je(i,s,X,null,o,se)}}for(var W in o){var X=o[W];if(se=a[W],o.hasOwnProperty(W)&&(X!=null||se!=null))switch(W){case"type":X!==se&&(We=!0),f=X;break;case"name":X!==se&&(We=!0),u=X;break;case"checked":X!==se&&(We=!0),G=X;break;case"defaultChecked":X!==se&&(We=!0),ee=X;break;case"value":X!==se&&(We=!0),y=X;break;case"defaultValue":X!==se&&(We=!0),C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,s));break;default:X!==se&&Je(i,s,W,X,o,se)}}lu(i,y,C,T,G,ee,f,u);return;case"select":X=y=C=W=null;for(f in a)if(T=a[f],a.hasOwnProperty(f)&&T!=null)switch(f){case"value":break;case"multiple":X=T;default:o.hasOwnProperty(f)||Je(i,s,f,null,o,T)}for(u in o)if(f=o[u],T=a[u],o.hasOwnProperty(u)&&(f!=null||T!=null))switch(u){case"value":f!==T&&(We=!0),W=f;break;case"defaultValue":f!==T&&(We=!0),C=f;break;case"multiple":f!==T&&(We=!0),y=f;default:f!==T&&Je(i,s,u,f,o,T)}s=C,a=y,o=X,W!=null?Fr(i,!!a,W,!1):!!o!=!!a&&(s!=null?Fr(i,!!a,s,!0):Fr(i,!!a,a?[]:"",!1));return;case"textarea":X=W=null;for(C in a)if(u=a[C],a.hasOwnProperty(C)&&u!=null&&!o.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Je(i,s,C,null,o,u)}for(y in o)if(u=o[y],f=a[y],o.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":u!==f&&(We=!0),W=u;break;case"defaultValue":u!==f&&(We=!0),X=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&Je(i,s,y,u,o,f)}F1(i,W,X);return;case"option":for(var fe in a)W=a[fe],a.hasOwnProperty(fe)&&W!=null&&!o.hasOwnProperty(fe)&&(fe==="selected"?i.selected=!1:Je(i,s,fe,null,o,W));for(T in o)W=o[T],X=a[T],o.hasOwnProperty(T)&&W!==X&&(W!=null||X!=null)&&(T==="selected"?(W!==X&&(We=!0),i.selected=W&&typeof W!="function"&&typeof W!="symbol"):Je(i,s,T,W,o,X));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in a)W=a[ye],a.hasOwnProperty(ye)&&W!=null&&!o.hasOwnProperty(ye)&&Je(i,s,ye,null,o,W);for(G in o)if(W=o[G],X=a[G],o.hasOwnProperty(G)&&W!==X&&(W!=null||X!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,s));break;default:Je(i,s,G,W,o,X)}return;default:if(cu(s)){for(var Be in a)W=a[Be],a.hasOwnProperty(Be)&&W!==void 0&&!o.hasOwnProperty(Be)&&l0(i,s,Be,void 0,o,W);for(ee in o)W=o[ee],X=a[ee],!o.hasOwnProperty(ee)||W===X||W===void 0&&X===void 0||l0(i,s,ee,W,o,X);return}}for(var K in a)W=a[K],a.hasOwnProperty(K)&&W!=null&&!o.hasOwnProperty(K)&&Je(i,s,K,null,o,W);for(se in o)W=o[se],X=a[se],!o.hasOwnProperty(se)||W===X||W==null&&X==null||Je(i,s,se,W,o,X)}function tv(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o5(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],f=u.transferSize,y=u.initiatorType,C=u.duration;if(f&&C&&tv(y)){for(y=0,C=u.responseEnd,o+=1;o<a.length;o++){var T=a[o],G=T.startTime;if(G>C)break;var ee=T.transferSize,se=T.initiatorType;ee&&tv(se)&&(T=T.responseEnd,y+=ee*(T<C?1:(C-G)/(T-G)))}if(--o,s+=8*(f+y)/(u.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var o0=null,c0=null;function Hl(i){return i.nodeType===9?i:i.ownerDocument}function iv(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sv(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function nv(i,s,a,o){return a=Hl(a).createElement(i),a[Ft]=o,a[mi]=s,Xt(a,i,s),Ot(a),a}function h0(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var u0=null;function c5(){var i=window.event;return i&&i.type==="popstate"?i===u0?!1:(u0=i,!0):(u0=null,!1)}var d0=typeof setTimeout=="function"?setTimeout:void 0,h5=typeof clearTimeout=="function"?clearTimeout:void 0,rv=typeof Promise=="function"?Promise:void 0,av=typeof requestAnimationFrame=="function"?requestAnimationFrame:d0,u5=typeof queueMicrotask=="function"?queueMicrotask:typeof rv<"u"?function(i){return rv.resolve(null).then(i).catch(d5)}:d0;function d5(i){setTimeout(function(){throw i})}function Ln(i){return i==="head"}function lv(i,s){var a=s,o=0;do{var u=a.nextSibling;if(i.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){i.removeChild(u),Da(s);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")S0(i.ownerDocument.documentElement);else if(a==="head"){a=i.ownerDocument.head,S0(a);for(var f=a.firstChild;f;){var y=f.nextSibling,C=f.nodeName;f[il]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=y}}else a==="body"&&S0(i.ownerDocument.body);a=u}while(a);Da(s)}function ov(i,s){var a=i;i=0;do{var o=a.nextSibling;if(a.nodeType===1?s?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(s?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(i===0)break;i--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||i++;a=o}while(a)}function cv(i,s,a){if(s=CSS.escape(s)!==s?"r-"+btoa(s).replace(/=/g,""):s,i.style.viewTransitionName=s,a!=null&&(i.style.viewTransitionClass=a),a=getComputedStyle(i),a.display==="inline"){if(s=i.getClientRects(),s.length===1)var o=1;else for(var u=o=0;u<s.length;u++){var f=s[u];0<f.width&&0<f.height&&o++}o===1&&(i=i.style,i.display=s.length===1?"inline-block":"block",i.marginTop="-"+a.paddingTop,i.marginBottom="-"+a.paddingBottom)}}function hv(i,s){i=i.style,s=s.style;var a=s!=null?s.hasOwnProperty("viewTransitionName")?s.viewTransitionName:s.hasOwnProperty("view-transition-name")?s["view-transition-name"]:null:null;i.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=s!=null?s.hasOwnProperty("viewTransitionClass")?s.viewTransitionClass:s.hasOwnProperty("view-transition-class")?s["view-transition-class"]:null:null,i.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),i.display==="inline-block"&&(s==null?i.display=i.margin="":(a=s.display,i.display=a==null||typeof a=="boolean"?"":a,a=s.margin,a!=null?i.margin=a:(a=s.hasOwnProperty("marginTop")?s.marginTop:s["margin-top"],i.marginTop=a==null||typeof a=="boolean"?"":a,s=s.hasOwnProperty("marginBottom")?s.marginBottom:s["margin-bottom"],i.marginBottom=s==null||typeof s=="boolean"?"":s)))}function f5(i,s,a){return a=a.ownerDocument.defaultView,{rect:i,abs:s.position==="absolute"||s.position==="fixed",clip:s.clipPath!=="none"||s.overflow!=="visible"||s.filter!=="none"||s.mask!=="none"||s.mask!=="none"||s.borderRadius!=="0px",view:0<=i.bottom&&0<=i.right&&i.top<=a.innerHeight&&i.left<=a.innerWidth}}function f0(i){var s=i.getBoundingClientRect(),a=getComputedStyle(i);return f5(s,a,i)}function p5(i){return i.documentElement.clientHeight}function g5(i){this.addEventListener("load",i),this.addEventListener("error",i)}function m5(i,s,a,o,u,f,y,C,T){var G=s.nodeType===9?s:s.ownerDocument;try{var ee=G.startViewTransition({update:function(){var W=G.defaultView,X=W.navigation&&W.navigation.transition,fe=G.fonts.status;o();var ye=[];if(fe==="loaded"&&(p5(G),G.fonts.status==="loading"&&ye.push(G.fonts.ready)),fe=ye.length,i!==null)for(var Be=i.suspenseyImages,K=0,H=0;H<Be.length;H++){var Z=Be[H];if(!Z.complete){var ie=Z.getBoundingClientRect();if(0<ie.bottom&&0<ie.right&&ie.top<W.innerHeight&&ie.left<W.innerWidth){if(K+=Rv(Z),K>Gc){ye.length=fe;break}Z=new Promise(g5.bind(Z)),ye.push(Z)}}}if(0<ye.length)return W=Promise.race([Promise.all(ye),new Promise(function(ve){return setTimeout(ve,500)})]).then(u,u),(X?Promise.allSettled([X.finished,W]):W).then(f,f);if(u(),X)return X.finished.then(f,f);f()},types:a});G.__reactViewTransition=ee;var se=[];return ee.ready.then(function(){for(var W=G.documentElement.getAnimations({subtree:!0}),X=0;X<W.length;X++){var fe=W[X],ye=fe.effect,Be=ye.pseudoElement;if(Be!=null&&Be.startsWith("::view-transition")){se.push(fe),fe=ye.getKeyframes();for(var K=Be=void 0,H=!0,Z=0;Z<fe.length;Z++){var ie=fe[Z],ve=ie.width;if(Be===void 0)Be=ve;else if(Be!==ve){H=!1;break}if(ve=ie.height,K===void 0)K=ve;else if(K!==ve){H=!1;break}delete ie.width,delete ie.height,ie.transform==="none"&&delete ie.transform}H&&Be!==void 0&&K!==void 0&&(ye.setKeyframes(fe),H=getComputedStyle(ye.target,ye.pseudoElement),H.width!==Be||H.height!==K)&&(H=fe[0],H.width=Be,H.height=K,H=fe[fe.length-1],H.width=Be,H.height=K,ye.setKeyframes(fe))}}y()},function(W){G.__reactViewTransition===ee&&(G.__reactViewTransition=null);try{typeof W=="object"&&W!==null&&W.name==="InvalidStateError"&&(W.message==="View transition was skipped because document visibility state is hidden."||W.message==="Skipping view transition because document visibility state has become hidden."||W.message==="Skipping view transition because viewport size changed."||W.message==="Transition was aborted because of invalid state")&&(W=null),W!==null&&T(W)}finally{o(),u(),y()}}),ee.finished.finally(function(){for(var W=0;W<se.length;W++)se[W].cancel();G.__reactViewTransition===ee&&(G.__reactViewTransition=null),C()}),ee}catch{return o(),u(),y(),null}}function kr(i,s){this._scope=document.documentElement,this._selector="::view-transition-"+i+"("+s+")"}kr.prototype.animate=function(i,s){return s=typeof s=="number"?{duration:s}:I({},s),s.pseudoElement=this._selector,this._scope.animate(i,s)},kr.prototype.getAnimations=function(){for(var i=this._scope,s=this._selector,a=i.getAnimations({subtree:!0}),o=[],u=0;u<a.length;u++){var f=a[u].effect;f!==null&&f.target===i&&f.pseudoElement===s&&o.push(a[u])}return o},kr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function uv(i){return{name:i,group:new kr("group",i),imagePair:new kr("image-pair",i),old:new kr("old",i),new:new kr("new",i)}}function Oi(i){this._fragmentFiber=i,this._observers=this._eventListeners=null}Oi.prototype.addEventListener=function(i,s,a){var o=null,u=null;if(!(a!=null&&typeof a!="boolean"&&(o=a.signal||null,o!==null&&o.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(fv(f,i,s,a)===-1){var y=this,C=s;a!=null&&typeof a!="boolean"&&a.once===!0&&(C=function(T){y.removeEventListener(i,s,a),typeof s=="function"?s.call(this,T):s.handleEvent(T)}),o!==null&&(u=y.removeEventListener.bind(y,i,s,a),o.addEventListener("abort",u,{once:!0}),u=o.removeEventListener.bind(o,"abort",u)),o=Ca(a),f.push({type:i,listener:s,optionsOrUseCapture:a,attachedListener:C,cleanup:u}),_(this._fragmentFiber.child,!1,v5,i,C,o)}this._eventListeners=f}};function v5(i,s,a,o){return E(i).addEventListener(s,a,o),!1}Oi.prototype.removeEventListener=function(i,s,a){var o=this._eventListeners;if(o!==null&&(s=fv(o,i,s,a),s!==-1)){var u=o[s];a=u.attachedListener;var f=u.cleanup;u=Ca(u.optionsOrUseCapture),_(this._fragmentFiber.child,!1,_5,i,a,u),o.splice(s,1),f!==null&&f()}};function _5(i,s,a,o){return E(i).removeEventListener(s,a,o),!1}function Ca(i){return i!=null&&typeof i!="boolean"&&(i.once===!0||i.signal instanceof AbortSignal)?{capture:i.capture,passive:i.passive}:i}function dv(i){return i==null?"c=0":typeof i=="boolean"?"c="+(i?"1":"0"):"c="+(i.capture?"1":"0")}function fv(i,s,a,o){if(i.length===0)return-1;o=dv(o);for(var u=0;u<i.length;u++){var f=i[u];if(f.type===s&&f.listener===a&&dv(f.optionsOrUseCapture)===o)return u}return-1}Oi.prototype.dispatchEvent=function(i){var s=S(this._fragmentFiber);if(s===null)return!0;s=E(s);var a=this._eventListeners;if(a!==null&&0<a.length||!i.bubbles){var o=s.nodeType===9?s.createComment(""):document.createTextNode("");if(a)for(var u=0;u<a.length;u++){var f=a[u];o.addEventListener(f.type,f.attachedListener,Ca(f.optionsOrUseCapture))}if(s.appendChild(o),i=o.dispatchEvent(i),a)for(u=0;u<a.length;u++)f=a[u],o.removeEventListener(f.type,f.attachedListener,Ca(f.optionsOrUseCapture));return s.removeChild(o),i}return s.dispatchEvent(i)},Oi.prototype.focus=function(i){_(this._fragmentFiber.child,!0,pv,i,void 0,void 0)};function pv(i,s){return i.tag===6?!1:(i=E(i),D5(i,s))}Oi.prototype.focusLast=function(i){var s=[];_(this._fragmentFiber.child,!0,p0,s,void 0,void 0);for(var a=s.length-1;0<=a&&!pv(s[a],i);a--);};function p0(i,s){return s.push(i),!1}Oi.prototype.blur=function(){var i=S(this._fragmentFiber);i!==null&&(i=E(i),i=Hl(i).activeElement,i!==null&&_(this._fragmentFiber.child,!1,y5,i,void 0,void 0))};function y5(i,s){return i.tag===6?!1:(i=E(i),i===s||i.contains(s)?(s.blur(),!0):!1)}Oi.prototype.observeUsing=function(i){this._observers===null&&(this._observers=new Set),this._observers.add(i),_(this._fragmentFiber.child,!1,S5,i,void 0,void 0)};function S5(i,s){return i.tag===6||(i=E(i),s.observe(i)),!1}Oi.prototype.unobserveUsing=function(i){var s=this._observers;if(s!==null&&s.has(i)){s.delete(i),_(this._fragmentFiber.child,!1,x5,i,void 0,void 0);for(var a=s=0;a<fs.length;a++){var o=fs[a];o.fragmentInstance===this&&o.observer===i?i.unobserve(o.instance):fs[s++]=o}fs.length=s}};function x5(i,s){return i.tag===6||(i=E(i),s.unobserve(i)),!1}var fs=[],g0=!1;function w5(i,s,a){fs.push({fragmentInstance:i,observer:s,instance:a}),g0||(g0=!0,R5(function(){g0=!1;var o=fs;fs=[];for(var u=0;u<o.length;u++){var f=o[u];f.observer.unobserve(f.instance)}}))}Oi.prototype.getClientRects=function(){var i=[];return _(this._fragmentFiber.child,!1,b5,i,void 0,void 0),i};function b5(i,s){if(i.tag===6){i=i.stateNode;var a=i.ownerDocument.createRange();a.selectNodeContents(i),s.push.apply(s,a.getClientRects())}else i=E(i),s.push.apply(s,i.getClientRects());return!1}Oi.prototype.getRootNode=function(i){var s=S(this._fragmentFiber);return s===null?this:E(s).getRootNode(i)},Oi.prototype.compareDocumentPosition=function(i){var s=S(this._fragmentFiber);if(s===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];_(this._fragmentFiber.child,!1,p0,a,void 0,void 0);var o=E(s);if(a.length===0){if(a=o,w(this._fragmentFiber)){e:{for(s=this._fragmentFiber.return;s!==null;){if(s.tag===4){s=s.stateNode.containerInfo;break e}if(s.tag===3||s.tag===5||s.tag===27)break;s=s.return}s=null}s!=null&&(a=s)}s=this._fragmentFiber;var u=o=a.compareDocumentPosition(i);return a===i?u=Node.DOCUMENT_POSITION_CONTAINS:o&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=b(s)[1],a===null?u=Node.DOCUMENT_POSITION_PRECEDING:(i=E(a).compareDocumentPosition(i),u=i===0||i&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),u|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}s=E(a[0]),u=E(a[a.length-1]);var f=w(this._fragmentFiber)?s.parentElement:o;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;o=f.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var y=s.compareDocumentPosition(i),C=u.compareDocumentPosition(i),T=y&Node.DOCUMENT_POSITION_CONTAINED_BY||C&Node.DOCUMENT_POSITION_CONTAINED_BY;return C=o&&f&&y&Node.DOCUMENT_POSITION_FOLLOWING&&C&Node.DOCUMENT_POSITION_PRECEDING,s=o&&s===i||f&&u===i||T||C?Node.DOCUMENT_POSITION_CONTAINED_BY:!o&&s===i||!f&&u===i?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:y,s&Node.DOCUMENT_POSITION_DISCONNECTED||s&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||C5(s,this._fragmentFiber,a[0],a[a.length-1],i)?s:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function C5(i,s,a,o,u){var f=nr(u);if(i&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!f)e:{for(;f!==null;){if(f.tag===7&&(f===s||f.alternate===s)){a=!0;break e}f=f.return}a=!1}return a}if(i&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=u.ownerDocument,u===f||u===f.documentElement||u===f.body;e:{for(f=s,s=S(s);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==s&&f.alternate!==s)){f=!0;break e}f=f.return}f=!1}return f}return i&Node.DOCUMENT_POSITION_PRECEDING?((s=!!f)&&!(s=f===a)&&(s=R(a,f,F),s===null?s=!1:(_(s,!0,A,f,a),f=j,j=null,s=f!==null)),s):i&Node.DOCUMENT_POSITION_FOLLOWING?((s=!!f)&&!(s=f===o)&&(s=R(o,f,F),s===null?s=!1:(_(s,!0,z,f,o),f=j,V=j=null,s=f!==null)),s):!1}function gv(i,s){var a=i.ownerDocument.createRange();a.selectNodeContents(i),i=a.getBoundingClientRect(),window.scrollTo(window.scrollX+i.left,s?window.scrollY+i.top:window.scrollY+i.bottom-window.innerHeight)}Oi.prototype.scrollIntoView=function(i){if(typeof i=="object")throw Error(r(566));var s=[];_(this._fragmentFiber.child,!1,p0,s,void 0,void 0);var a=i!==!1;if(s.length===0){var o=b(this._fragmentFiber);if(o=a?o[1]||o[0]||S(this._fragmentFiber):o[0]||o[1],o===null)return;if(o.tag===6){i=E(o),gv(i,a);return}if(o=E(o),o.nodeType!==9){if(o.nodeType===11){a="host"in o?o.host:null,a!==null&&a.scrollIntoView(i);return}o.scrollIntoView(i)}}for(o=a?s.length-1:0;o!==(a?-1:s.length);){var u=s[o];u.tag===6?(u=E(u),gv(u,a)):E(u).scrollIntoView(i),o+=a?-1:1}};function k5(i,s){return i=E(i),mv(i,s),!1}function mv(i,s){i.reactFragments==null&&(i.reactFragments=new Set),i.reactFragments.add(s)}function vv(i,s){var a=s._eventListeners;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];i.addEventListener(u.type,u.attachedListener,Ca(u.optionsOrUseCapture))}i.nodeType!==3&&(a=s._observers,a!==null&&a.forEach(function(f){for(var y=0,C=0;C<fs.length;C++){var T=fs[C];(T.fragmentInstance!==s||T.observer!==f||T.instance!==i)&&(fs[y++]=T)}fs.length=y,f.observe(i)}),mv(i,s))}function E5(i,s){var a=s._eventListeners;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];i.removeEventListener(u.type,u.attachedListener,Ca(u.optionsOrUseCapture))}i.nodeType!==3&&(a=s._observers,a!==null&&a.forEach(function(f){typeof f.rootMargin=="string"?w5(s,f,i):f.unobserve(i)}),i.reactFragments!=null&&i.reactFragments.delete(s))}function m0(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":m0(a),zo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function M5(i,s,a,o){for(;i.nodeType===1;){var u=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(o){if(!i[il])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(f=i.getAttribute("rel"),f==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(f!==u.rel||i.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||i.getAttribute("title")!==(u.title==null?null:u.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(f=i.getAttribute("src"),(f!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===f)return i}else return i;if(i=Yi(i.nextSibling),i===null)break}return null}function j5(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Yi(i.nextSibling),i===null))return null;return i}function _v(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=Yi(i.nextSibling),i===null))return null;return i}function v0(i){return i.data==="$?"||i.data==="$~"}function _0(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function T5(i,s){var a=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||a.readyState!=="loading")s();else{var o=function(){s(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),i._reactRetry=o}}function Yi(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var y0=null;function yv(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"||a==="/&"){if(s===0)return Yi(i.nextSibling);s--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||s++}i=i.nextSibling}return null}function Sv(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(s===0)return i;s--}else a!=="/$"&&a!=="/&"||s++}i=i.previousSibling}return null}function D5(i,s){function a(){o=!0}if(i.ownerDocument.activeElement===i)return!0;var o=!1;try{i.ownerDocument.addEventListener("focus",a,!0),(i.focus||HTMLElement.prototype.focus).call(i,s)}finally{i.ownerDocument.removeEventListener("focus",a,!0)}return o}function R5(i){av(function(){av(function(s){return i(s)})})}function xv(i,s,a){switch(s=Hl(a),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function wv(i,s,a){for(var o in a){var u=a[o];a.hasOwnProperty(o)&&u!=null&&Je(i,s,o,null,a5,u)}a.dangerouslySetInnerHTML!=null&&(i.textContent=""),i.onclick===gs&&(i.onclick=null),zo(i)}function S0(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);zo(i)}var Gi=new Map,bv=new Set;function Il(i){if(typeof i.getRootNode=="function"){var s=i.getRootNode();if(s.nodeType===9||s.nodeType===11)return s}return i.nodeType===9?i:i.ownerDocument}var Zs=_e.d;_e.d={f:A5,r:N5,D:L5,C:B5,L:O5,m:z5,X:I5,S:H5,M:U5};function A5(){var i=Zs.f(),s=Uc();return i||s}function N5(i){var s=Vr(i);s!==null&&s.tag===5&&s.type==="form"?kg(s):Zs.r(i)}var ka=typeof document>"u"?null:document;function Cv(i,s,a){var o=ka;if(o&&typeof s=="string"&&s){var u=Pi(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),bv.has(u)||(bv.add(u),i={rel:i,crossOrigin:a,href:s},o.querySelector(u)===null&&(s=o.createElement("link"),Xt(s,"link",i),Ot(s),o.head.appendChild(s)))}}function L5(i){Zs.D(i),Cv("dns-prefetch",i,null)}function B5(i,s){Zs.C(i,s),Cv("preconnect",i,s)}function O5(i,s,a){Zs.L(i,s,a);var o=ka;if(o&&i&&s){var u='link[rel="preload"][as="'+Pi(s)+'"]';s==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Pi(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Pi(a.imageSizes)+'"]')):u+='[href="'+Pi(i)+'"]';var f=u;switch(s){case"style":f=Ea(i);break;case"script":f=Ma(i)}if(!(Gi.has(f)||(i=I({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),Gi.set(f,i),o.querySelector(u)!==null||s==="style"&&o.querySelector(Ul(f))||s==="script"&&o.querySelector(Pl(f))))){var y=o.createElement("link");Xt(y,"link",i),s==="style"&&(y[Oo]=!0,y.onload=y.onerror=function(){z1(y)}),Ot(y),o.head.appendChild(y)}}}function z5(i,s){Zs.m(i,s);var a=ka;if(a&&i){var o=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Pi(o)+'"][href="'+Pi(i)+'"]',f=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ma(i)}if(!Gi.has(f)&&(i=I({rel:"modulepreload",href:i},s),Gi.set(f,i),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Pl(f)))return}o=a.createElement("link"),Xt(o,"link",i),Ot(o),a.head.appendChild(o)}}}function H5(i,s,a){Zs.S(i,s,a);var o=ka;if(o&&i){var u=$r(o).hoistableStyles,f=Ea(i);s=s||"default";var y=u.get(f);if(!y){var C={loading:0,preload:null};if(y=o.querySelector(Ul(f)))C.loading=5;else{i=I({rel:"stylesheet",href:i,"data-precedence":s},a),(a=Gi.get(f))&&x0(i,a);var T=y=o.createElement("link");Ot(T),Xt(T,"link",i),T._p=new Promise(function(G,ee){T.onload=G,T.onerror=ee}),T.addEventListener("load",function(){C.loading|=1}),T.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Kc(y,s,o)}y={type:"stylesheet",instance:y,count:1,state:C},u.set(f,y)}}}function I5(i,s){Zs.X(i,s);var a=ka;if(a&&i){var o=$r(a).hoistableScripts,u=Ma(i),f=o.get(u);f||(f=a.querySelector(Pl(u)),f||(i=I({src:i,async:!0},s),(s=Gi.get(u))&&w0(i,s),f=a.createElement("script"),Ot(f),Xt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function U5(i,s){Zs.M(i,s);var a=ka;if(a&&i){var o=$r(a).hoistableScripts,u=Ma(i),f=o.get(u);f||(f=a.querySelector(Pl(u)),f||(i=I({src:i,async:!0,type:"module"},s),(s=Gi.get(u))&&w0(i,s),f=a.createElement("script"),Ot(f),Xt(f,"link",i),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function kv(i,s,a,o){var u=(u=Ke.current)?Il(u):null;if(!u)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Ea(a.href),s=$r(u).hoistableStyles,o=s.get(a),o||(o={type:"style",instance:null,count:0,state:null},s.set(a,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=Ea(a.href);var f=$r(u).hoistableStyles,y=f.get(i);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(i,y),(f=u.querySelector(Ul(i)))?f._p||(y.instance=f,y.state.loading=5):(f=Gi.get(i),f||(f={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Gi.set(i,f)),P5(u,i,f,y.state))),s&&o===null)throw Error(r(528,""));return y}if(s&&o!==null)throw Error(r(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(a=Ma(a),s=$r(u).hoistableScripts,o=s.get(a),o||(o={type:"script",instance:null,count:0,state:null},s.set(a,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ea(i){return'href="'+Pi(i)+'"'}function Ul(i){return'link[rel="stylesheet"]['+i+"]"}function Ev(i){return I({},i,{"data-precedence":i.precedence,precedence:null})}function P5(i,s,a,o){if(s=i.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[Oo]!==!0){o.loading=1;return}}else s=i.createElement("link"),s[Oo]=!0,s.onload=s.onerror=z1.bind(null,s),Xt(s,"link",a),Ot(s),i.head.appendChild(s);o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2})}function Ma(i){return'[src="'+Pi(i)+'"]'}function Pl(i){return"script[async]"+i}function Mv(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var o=i.querySelector('style[data-href~="'+Pi(a.href)+'"]');if(o)return s.instance=o,Ot(o),o;var u=I({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(i.ownerDocument||i).createElement("style"),Ot(o),Xt(o,"style",u),Kc(o,a.precedence,i),s.instance=o;case"stylesheet":u=Ea(a.href);var f=i.querySelector(Ul(u));if(f)return s.state.loading|=4,s.instance=f,Ot(f),f;o=Ev(a),(u=Gi.get(u))&&x0(o,u),f=(i.ownerDocument||i).createElement("link"),Ot(f);var y=f;return y._p=new Promise(function(C,T){y.onload=C,y.onerror=T}),Xt(f,"link",o),s.state.loading|=4,Kc(f,a.precedence,i),s.instance=f;case"script":return f=Ma(a.src),(u=i.querySelector(Pl(f)))?(s.instance=u,Ot(u),u):(o=a,(u=Gi.get(f))&&(o=I({},a),w0(o,u)),i=i.ownerDocument||i,u=i.createElement("script"),Ot(u),Xt(u,"link",o),i.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Kc(o,a.precedence,i));return s.instance}function Kc(i,s,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,f=u,y=0;y<o.length;y++){var C=o[y];if(C.dataset.precedence===s)f=C;else if(f!==u)break}f?f.parentNode.insertBefore(i,f.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function x0(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function w0(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Yc=null;function jv(i,s,a){if(Yc===null){var o=new Map,u=Yc=new Map;u.set(a,o)}else u=Yc,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(i))return o;for(o.set(i,null),a=a.getElementsByTagName(i),u=0;u<a.length;u++){var f=a[u];if(!(f[il]||f[Ft]||i==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(s)||"";y=i+y;var C=o.get(y);C?C.push(f):o.set(y,[f])}}return o}function b0(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function q5(i,s,a){if(a===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Tv(i,s){return i==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function Dv(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Rv(i){return(i.width||100)*(i.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Av(i,s){typeof s.decode=="function"&&(i.imgCount++,s.complete||(i.imgBytes+=Rv(s),i.suspenseyImages.push(s)),i=W5.bind(i),s.decode().then(i,i))}function V5(i,s,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Ea(o.href),f=s.querySelector(Ul(u));if(f){s=f._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=ql.bind(i),s.then(i,i)),a.state.loading|=4,a.instance=f,Ot(f);return}f=s.ownerDocument||s,o=Ev(o),(u=Gi.get(u))&&x0(o,u),f=f.createElement("link"),Ot(f);var y=f;y._p=new Promise(function(C,T){y.onload=C,y.onerror=T}),Xt(f,"link",o),a.instance=f}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(a,s),(s=a.state.preload)&&(a.state.loading&3)===0&&(i.count++,a=ql.bind(i),s.addEventListener("load",a),s.addEventListener("error",a))}}var Gc=0;function $5(i,s){return i.stylesheets&&i.count===0&&Xc(i,i.stylesheets),0<i.count||0<i.imgCount?function(a){var o=setTimeout(function(){if(i.stylesheets&&Xc(i,i.stylesheets),i.unsuspend){var f=i.unsuspend;i.unsuspend=null,f()}},6e4+s);0<i.imgBytes&&Gc===0&&(Gc=62500*o5());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Xc(i,i.stylesheets),i.unsuspend)){var f=i.unsuspend;i.unsuspend=null,f()}},(i.imgBytes>Gc?50:800)+s);return i.unsuspend=a,function(){i.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Nv(i){if(i.count===0&&(i.imgCount===0||!i.waitingForImages)){if(i.stylesheets)Xc(i,i.stylesheets);else if(i.unsuspend){var s=i.unsuspend;i.unsuspend=null,s()}}}function ql(){this.count--,Nv(this)}function W5(){this.imgCount--,Nv(this)}var Zc=null;function Xc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Zc=new Map,s.forEach(F5,i),Zc=null,ql.call(i))}function F5(i,s){if(!(s.state.loading&4)){var a=Zc.get(i);if(a)var o=a.get(null);else{a=new Map,Zc.set(i,a);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),o=y)}o&&a.set(null,o)}u=s.instance,y=u.getAttribute("data-precedence"),f=a.get(y)||o,f===o&&a.set(null,u),a.set(y,u),this.count++,o=ql.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),f?f.parentNode.insertBefore(u,f.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var ja={$$typeof:O,Provider:null,Consumer:null,_currentValue:Re,_currentValue2:Re,_threadCount:0};function K5(i,s,a,o,u,f,y,C,T){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=su(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=su(0),this.hiddenUpdates=su(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.transitionTypes=null,this.incompleteTransitions=new Map}function Lv(i,s,a,o,u,f,y,C,T,G,ee,se){return i=new K5(i,s,a,y,T,G,ee,se,C),s=1,f===!0&&(s|=24),f=vi(3,null,null,s),i.current=f,f.stateNode=i,s=Hu(),s.refCount++,i.pooledCache=s,s.refCount++,f.memoizedState={element:o,isDehydrated:a,cache:s},qu(f),i}function Bv(i){return i?(i=ea,i):ea}function Ov(i,s,a,o,u,f){u=Bv(u),o.context===null?o.context=u:o.pendingContext=u,o=wn(s),o.payload={element:a},f=f===void 0?null:f,f!==null&&(o.callback=f),a=bn(i,o,s),a!==null&&(xi(a,i,s),yl(a,i,s))}function zv(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function C0(i,s){zv(i,s),(i=i.alternate)&&zv(i,s)}function Hv(i){if(i.tag===13||i.tag===31){var s=or(i,67108864);s!==null&&xi(s,i,67108864),C0(i,67108864)}}function Iv(i){if(i.tag===13||i.tag===31){var s=Bi();s=nu(s);var a=or(i,s);a!==null&&xi(a,i,s),C0(i,s)}}var Ta=!0;function Y5(i,s,a,o){var u=pe.T;pe.T=null;var f=_e.p;try{_e.p=2,k0(i,s,a,o)}finally{_e.p=f,pe.T=u}}function G5(i,s,a,o){var u=pe.T;pe.T=null;var f=_e.p;try{_e.p=8,k0(i,s,a,o)}finally{_e.p=f,pe.T=u}}function k0(i,s,a,o){if(Ta){var u=E0(o);if(u===null)a0(i,s,o,Qc,a),Pv(i,o);else if(X5(u,i,s,a,o))o.stopPropagation();else if(Pv(i,o),s&4&&-1<Z5.indexOf(i)){for(;u!==null;){var f=Vr(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=sr(f.pendingLanes);if(y!==0){var C=f;for(C.pendingLanes|=2,C.entangledLanes|=2;y;){var T=1<<31-ji(y);C.entanglements[1]|=T,y&=~T}ks(f),(Ye&6)===0&&(zc=Ei()+500,Bl(0))}}break;case 31:case 13:C=or(f,2),C!==null&&xi(C,f,2),Uc(),C0(f,2)}if(f=E0(o),f===null&&a0(i,s,o,Qc,a),f===u)break;u=f}u!==null&&o.stopPropagation()}else a0(i,s,o,null,a)}}function E0(i){return i=uu(i),M0(i)}var Qc=null;function M0(i){if(Qc=null,i=nr(i),i!==null){var s=h(i);if(s===null)i=null;else{var a=s.tag;if(a===13){if(i=d(s),i!==null)return i;i=null}else if(a===31){if(i=p(s),i!==null)return i;i=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Qc=i,null}function Uv(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ow()){case k1:return 2;case E1:return 8;case Ro:case cw:return 32;case M1:return 268435456;default:return 32}default:return 32}}var j0=!1,Bn=null,On=null,zn=null,Vl=new Map,$l=new Map,Hn=[],Z5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Pv(i,s){switch(i){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":On=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":Vl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":$l.delete(s.pointerId)}}function Wl(i,s,a,o,u,f){return i===null||i.nativeEvent!==f?(i={blockedOn:s,domEventName:a,eventSystemFlags:o,nativeEvent:f,targetContainers:[u]},s!==null&&(s=Vr(s),s!==null&&Hv(s)),i):(i.eventSystemFlags|=o,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function X5(i,s,a,o,u){switch(s){case"focusin":return Bn=Wl(Bn,i,s,a,o,u),!0;case"dragenter":return On=Wl(On,i,s,a,o,u),!0;case"mouseover":return zn=Wl(zn,i,s,a,o,u),!0;case"pointerover":var f=u.pointerId;return Vl.set(f,Wl(Vl.get(f)||null,i,s,a,o,u)),!0;case"gotpointercapture":return f=u.pointerId,$l.set(f,Wl($l.get(f)||null,i,s,a,o,u)),!0}return!1}function qv(i){var s=nr(i.target);if(s!==null){var a=h(s);if(a!==null){if(s=a.tag,s===13){if(s=d(a),s!==null){i.blockedOn=s,L1(i.priority,function(){Iv(a)});return}}else if(s===31){if(s=p(a),s!==null){i.blockedOn=s,L1(i.priority,function(){Iv(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Jc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=E0(i.nativeEvent);if(a===null){a=i.nativeEvent;var o=new a.constructor(a.type,a);hu=o,a.target.dispatchEvent(o),hu=null}else return s=Vr(a),s!==null&&Hv(s),i.blockedOn=a,!1;s.shift()}return!0}function Vv(i,s,a){Jc(i)&&a.delete(s)}function Q5(){j0=!1,Bn!==null&&Jc(Bn)&&(Bn=null),On!==null&&Jc(On)&&(On=null),zn!==null&&Jc(zn)&&(zn=null),Vl.forEach(Vv),$l.forEach(Vv)}function eh(i,s){i.blockedOn===s&&(i.blockedOn=null,j0||(j0=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Q5)))}var th=null;function $v(i){th!==i&&(th=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){th===i&&(th=null);for(var s=0;s<i.length;s+=3){var a=i[s],o=i[s+1],u=i[s+2];if(typeof o!="function"){if(M0(o||a)===null)continue;break}var f=Vr(a);f!==null&&(i.splice(s,3),s-=3,cd(f,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Da(i){function s(T){return eh(T,i)}Bn!==null&&eh(Bn,i),On!==null&&eh(On,i),zn!==null&&eh(zn,i),Vl.forEach(s),$l.forEach(s);for(var a=0;a<Hn.length;a++){var o=Hn[a];o.blockedOn===i&&(o.blockedOn=null)}for(;0<Hn.length&&(a=Hn[0],a.blockedOn===null);)qv(a),a.blockedOn===null&&Hn.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],f=a[o+1],y=u[mi]||null;if(typeof f=="function")y||$v(a);else if(y){var C=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[mi]||null)C=y.formAction;else if(M0(u)!==null)continue}else C=y.action;typeof C=="function"?a[o+1]=C:(a.splice(o,3),o-=3),$v(a)}}}function Wv(){function i(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function T0(i){this._internalRoot=i}ih.prototype.render=T0.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,o=Bi();Ov(a,o,i,s,null,null)},ih.prototype.unmount=T0.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Ov(i.current,2,null,i,null,null),Uc(),s[qr]=null}};function ih(i){this._internalRoot=i}ih.prototype.unstable_scheduleHydration=function(i){if(i){var s=N1();i={blockedOn:null,target:i,priority:s};for(var a=0;a<Hn.length&&s!==0&&s<Hn[a].priority;a++);Hn.splice(a,0,i),a===0&&qv(i)}};var Fv=t.version;if(Fv!=="19.3.0")throw Error(r(527,Fv,"19.3.0"));_e.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=m(s),i=i!==null?v(i):null,i=i===null?null:i.stateNode,i};var J5={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:pe,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sh.isDisabled&&sh.supportsFiber)try{Ja=sh.inject(J5),Mi=sh}catch{}}return Kl.createRoot=function(i,s){if(!l(i))throw Error(r(299));var a=!1,o="",u=Bg,f=Og,y=zg;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(f=s.onCaughtError),s.onRecoverableError!==void 0&&(y=s.onRecoverableError)),s=Lv(i,1,!1,null,null,a,o,null,u,f,y,Wv),i[qr]=s.current,r0(i),new T0(s)},Kl.hydrateRoot=function(i,s,a){if(!l(i))throw Error(r(299));var o=!1,u="",f=Bg,y=Og,C=zg,T=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError),a.formState!==void 0&&(T=a.formState)),s=Lv(i,1,!0,s,a??null,o,u,T,f,y,C,Wv),s.context=Bv(null),a=s.current,o=Bi(),o=nu(o),u=wn(o),u.callback=null,bn(a,u,o),a=o,s.current.lanes=a,tl(s,a),ks(s),i[qr]=s.current,r0(i),new ih(s)},Kl.version="19.3.0",Kl}var l_;function bb(){if(l_)return N0.exports;l_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),N0.exports=wb(),N0.exports}var Cb=bb(),x=W2();const Hf=window.matchMedia("(prefers-color-scheme: dark)"),If=window.matchMedia("(prefers-reduced-motion: reduce)"),P3=e=>t=>(e.addEventListener("change",t),()=>e.removeEventListener("change",t));function F2(){return x.useSyncExternalStore(P3(Hf),()=>Hf.matches)}function Ka(){return x.useSyncExternalStore(P3(If),()=>If.matches)}const Co=()=>Hf.matches,o_=()=>If.matches,kb=e=>({text:e?[242,242,242]:[20,20,20],secondary:e?"#9a9a9a":"#6b6b6b",background:e?"#0a0a0a":"#ffffff"}),Ah=[{id:"black",label:"Black",hex:"#2B2B2B"},{id:"brown",label:"Brown",hex:"#936439"},{id:"red",label:"Red",hex:"#FF263C"},{id:"orange",label:"Orange",hex:"#FF6700"},{id:"yellow",label:"Yellow",hex:"#FF9800"},{id:"green",label:"Green",hex:"#00C972"},{id:"cyan",label:"Cyan",hex:"#00BCA6"},{id:"blue",label:"Blue",hex:"#1084FE"},{id:"violet",label:"Violet",hex:"#9159FE"},{id:"magenta",label:"Magenta",hex:"#FF309B"},{id:"gray",label:"Gray",hex:"#777777"}],q3=["blob","pebble","squircle","tablet","wedge","hex","cloud","teardrop"];function ko(e){return(Ah.find(t=>t.id===e)??Ah[7]).hex}function Eb(e,t){const n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}const Mb=[["path",{d:"M12 6.528V3a1 1 0 0 1 1-1h0"}],["path",{d:"M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21"}]];const jb=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];const Tb=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];const Db=[["path",{d:"M17 12H3"}],["path",{d:"m11 18 6-6-6-6"}],["path",{d:"M21 5v14"}]];const Rb=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];const Ab=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];const Nb=[["path",{d:"M2 10v3"}],["path",{d:"M6 6v11"}],["path",{d:"M10 3v18"}],["path",{d:"M14 8v7"}],["path",{d:"M18 5v13"}],["path",{d:"M22 10v3"}]];const Lb=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const Bb=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M11.68 2.009A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673c-.824-.85-1.678-1.731-2.21-3.348"}],["circle",{cx:"18",cy:"5",r:"3"}]];const Ob=[["path",{d:"M12 5v16"}],["path",{d:"M16 13h2"}],["path",{d:"M16 9h2"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z"}],["path",{d:"M6 13h2"}],["path",{d:"M6 9h2"}]];const zb=[["path",{d:"M12 5v16"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z"}]];const Hb=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"}]];const Ib=[["path",{d:"M8 2v3"}],["path",{d:"M16 2v3"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}],["path",{d:"M3 9h18"}]];const Ub=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]];const Pb=[["path",{d:"M20 6 9 17l-5-5"}]];const qb=[["path",{d:"m6 9 6 6 6-6"}]];const Vb=[["path",{d:"m15 18-6-6 6-6"}]];const $b=[["path",{d:"m18 15-6-6-6 6"}]];const Wb=[["path",{d:"m9 18 6-6-6-6"}]];const Fb=[["path",{d:"m11 17-5-5 5-5"}],["path",{d:"m18 17-5-5 5-5"}]];const Kb=[["path",{d:"m6 17 5-5-5-5"}],["path",{d:"m13 17 5-5-5-5"}]];const Yb=[["path",{d:"m7 15 5 5 5-5"}],["path",{d:"m7 9 5-5 5 5"}]];const c_=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]];const Gb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 8v8"}],["path",{d:"m8 12 4 4 4-4"}]];const h_=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16 9-5.5 5.5L8 12"}]];const Zb=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"}]];const Xb=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"12",cy:"12",r:"10"}]];const Qb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M17 12h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M7 12h.01"}]];const Jb=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}]];const e6=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z"}],["circle",{cx:"12",cy:"12",r:"10"}]];const t6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 12h8"}],["path",{d:"M12 8v8"}]];const i6=[["circle",{cx:"12",cy:"12",r:"10"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1"}]];const s6=[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"10",r:"3"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"}]];const u_=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];const V3=[["circle",{cx:"12",cy:"12",r:"10"}]];const n6=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];const r6=[["path",{d:"M11 14h10"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344"}],["path",{d:"m17 18 4-4-4-4"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}]];const d_=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];const a6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];const l6=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"}]];const o6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z"}]];const f_=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];const c6=[["path",{d:"M12 20v2"}],["path",{d:"M12 2v2"}],["path",{d:"M17 20v2"}],["path",{d:"M17 2v2"}],["path",{d:"M2 12h2"}],["path",{d:"M2 17h2"}],["path",{d:"M2 7h2"}],["path",{d:"M20 12h2"}],["path",{d:"M20 17h2"}],["path",{d:"M20 7h2"}],["path",{d:"M7 20v2"}],["path",{d:"M7 2v2"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1"}]];const h6=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];const u6=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];const d6=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];const f6=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 12v-1"}],["path",{d:"M8 18v-2"}],["path",{d:"M8 7V6"}],["circle",{cx:"8",cy:"20",r:"2"}]];const p6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M9 15h6"}],["path",{d:"M12 18v-6"}]];const H0=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];const g6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];const m6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M7 3v18"}],["path",{d:"M3 7.5h4"}],["path",{d:"M3 12h18"}],["path",{d:"M3 16.5h4"}],["path",{d:"M17 3v18"}],["path",{d:"M17 7.5h4"}],["path",{d:"M17 16.5h4"}]];const v6=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];const _6=[["path",{d:"m12 14 4-4"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}]];const y6=[["path",{d:"M15 6a9 9 0 0 0-9 9V3"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}]];const S6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]];const x6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];const w6=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9"}],["path",{d:"m18 15 4-4"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5"}]];const b6=[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5"}]];const C6=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const k6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];const E6=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2"}]];const M6=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];const j6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];const T6=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor"}]];const D6=[["path",{d:"m2 21 9.6-9.6"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5"}]];const R6=[["path",{d:"M10 8h.01"}],["path",{d:"M12 12h.01"}],["path",{d:"M14 8h.01"}],["path",{d:"M16 12h.01"}],["path",{d:"M18 8h.01"}],["path",{d:"M6 8h.01"}],["path",{d:"M7 16h10"}],["path",{d:"M8 12h.01"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}]];const A6=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z"}],["path",{d:"M20.054 15.987H3.946"}]];const N6=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}]];const L6=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];const B6=[["path",{d:"M13 5h8"}],["path",{d:"M13 12h8"}],["path",{d:"M13 19h8"}],["path",{d:"m3 17 2 2 4-4"}],["path",{d:"m3 7 2 2 4-4"}]];const O6=[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]];const z6=[["path",{d:"m16 17 5-5-5-5"}],["path",{d:"M21 12H9"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}]];const H6=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"}],["path",{d:"M7 11h10"}],["path",{d:"M7 15h6"}],["path",{d:"M7 7h8"}]];const I6=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"}]];const U6=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1"}]];const p_=[["path",{d:"M12 19v3"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}]];const g_=[["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]];const P6=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const q6=[["path",{d:"M12 17v4"}],["path",{d:"M22 12.307V15a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8.693"}],["path",{d:"M8 21h8"}],["circle",{cx:"19",cy:"6",r:"3"}]];const V6=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"}],["path",{d:"M10 19v-3.96 3.15"}],["path",{d:"M7 19h5"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2"}]];const m_=[["path",{d:"m14.5 12.5-5-5"}],["path",{d:"m9.5 12.5 5-5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["path",{d:"M12 17v4"}],["path",{d:"M8 21h8"}]];const v_=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];const $6=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"}]];const W6=[["path",{d:"M14 4.1 12 6"}],["path",{d:"m5.1 8-2.9-.8"}],["path",{d:"m6 12-1.9 2"}],["path",{d:"M7.2 2.2 8 5.1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"}]];const F6=[["path",{d:"M9 18V5l12-2v13"}],["circle",{cx:"6",cy:"18",r:"3"}],["circle",{cx:"18",cy:"16",r:"3"}]];const K6=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]];const Y6=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"}],["path",{d:"M12 22V12"}],["polyline",{points:"3.29 7 12 12 20.71 7"}],["path",{d:"m7.5 4.27 9 5.15"}]];const G6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M9 3v18"}]];const Z6=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];const X6=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272"}],["path",{d:"M22 2 2 22"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473"}]];const Q6=[["path",{d:"M12 17v5"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"}],["path",{d:"m2 2 20 20"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"}]];const __=[["path",{d:"M12 17v5"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"}]];const J6=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];const eC=[["path",{d:"M22 14a8 8 0 0 1-8 8"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"}]];const tC=[["path",{d:"M12 2v10"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04"}]];const iC=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3"}],["path",{d:"M21 21v.01"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7"}],["path",{d:"M3 12h.01"}],["path",{d:"M12 3h.01"}],["path",{d:"M12 16v.01"}],["path",{d:"M16 12h1"}],["path",{d:"M21 12v.01"}],["path",{d:"M12 21v-1"}]];const sC=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];const nC=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}],["path",{d:"m9 17-5-5 5-5"}]];const rC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}],["path",{d:"M12 7v5l4 2"}]];const aC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const y_=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];const lC=[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"}]];const oC=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];const ah=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18"}]];const cC=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];const hC=[["path",{d:"M12 2v13"}],["path",{d:"m16 6-4-4-4 4"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}]];const uC=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m9 12 2 2 4-4"}]];const dC=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const fC=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]];const pC=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}],["path",{d:"M20 2v4"}],["path",{d:"M22 4h-4"}],["circle",{cx:"4",cy:"20",r:"2"}]];const gC=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}],["path",{d:"m21 3-9 9"}],["path",{d:"M15 3h6v6"}]];const mC=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"}]];const vC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];const _C=[["path",{d:"M12 19h8"}],["path",{d:"m4 17 6-6-6-6"}]];const yC=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];const I0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];const SC=[["path",{d:"m16 11 2 2 4-4"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}]];const xC=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["circle",{cx:"9",cy:"7",r:"4"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11"}]];const S_=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]];const wC=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}],["circle",{cx:"9",cy:"7",r:"4"}]];const x_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]];const bC=[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z"}],["path",{d:"m16.5 14.5 5-5"}],["path",{d:"m16.5 9.5 5 5"}]];const CC=[["path",{d:"m10.586 5.414-5.172 5.172"}],["path",{d:"m18.586 13.414-5.172 5.172"}],["path",{d:"M6 12h12"}],["circle",{cx:"12",cy:"20",r:"2"}],["circle",{cx:"12",cy:"4",r:"2"}],["circle",{cx:"20",cy:"12",r:"2"}],["circle",{cx:"4",cy:"12",r:"2"}]];const kC=[["path",{d:"M12 20h.01"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764"}],["path",{d:"m2 2 20 20"}]];const EC=[["path",{d:"M12 20h.01"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0"}]];const MC=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"}]];const jC=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const TC=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"}]],DC={"arrow.clockwise":y_,"arrow.counterclockwise":aC,"arrow.down":jb,"arrow.down.circle":Gb,"arrow.down.right.and.arrow.up.left":P6,"arrow.left":Tb,"arrow.right":Rb,"arrow.right.doc.on.clipboard":n6,"arrow.up.doc.on.clipboard":r6,"arrow.right.to.line":Db,"arrow.triangle.2.circlepath":sC,"arrow.triangle.branch":y6,"arrow.up":Ab,"arrow.up.right.square":gC,"arrowshape.turn.up.left":nC,"apple.logo":Mb,"bell.badge":Bb,bolt:TC,book:zb,"book.closed":Hb,"book.pages":Ob,"bubble.left":I6,"bubble.left.and.bubble.right":U6,calendar:Ib,"chart.bar":Ub,checklist:B6,checkmark:Pb,"checkmark.circle":h_,"checkmark.circle.fill":h_,"checkmark.seal":Lb,"chevron.down":qb,"chevron.left":Vb,"chevron.left.2":Fb,"chevron.right":Wb,"chevron.right.2":Kb,"chevron.up":$b,"chevron.up.chevron.down":Yb,circle:V3,"circle.dotted":Zb,clock:a6,"clock.arrow.circlepath":rC,cloud:l6,cpu:c6,"cursorarrow.motionlines":W6,desktopcomputer:v_,"desktopcomputer.trianglebadge.exclamationmark":m_,display:v_,"display.2":V6,"display.trianglebadge.exclamationmark":m_,doc:g6,"doc.badge.plus":p6,"doc.on.clipboard":d_,"doc.on.clipboard.fill":d_,"doc.on.doc":f_,"doc.plaintext":H0,"doc.richtext":H0,"doc.text":H0,"doc.zipper":f6,ellipsis:h6,"ellipsis.circle":Qb,exclamationmark:I0,"exclamationmark.circle":c_,"exclamationmark.circle.fill":c_,"exclamationmark.triangle":I0,"exclamationmark.triangle.fill":I0,eye:d6,"eye.slash":u6,film:m6,folder:v6,"gauge.with.dots.needle.33percent":_6,gearshape:cC,globe:S6,hammer:w6,"hand.point.up.left":eC,"hand.raised":C6,"hand.raised.slash":b6,"info.circle":j6,iphone:fC,key:D6,"key.fill":T6,"keyboard.chevron.compact.down":R6,laptopcomputer:A6,link:L6,"list.bullet":O6,"list.bullet.rectangle":lC,"lock.display":q6,"lock.shield":uC,macmini:ah,"macpro.gen3":ah,macstudio:ah,magnifyingglass:oC,mic:g_,"mic.fill":g_,"mic.slash":p_,"mic.slash.fill":p_,"minus.circle":Jb,"music.note":F6,network:K6,pencil:Z6,person:S_,"person.2":wC,"person.crop.circle":s6,"person.crop.circle.badge.checkmark":SC,"person.crop.circle.badge.plus":xC,"person.fill":S_,"phone.down.fill":X6,photo:k6,"photo.on.rectangle":E6,pin:__,"pin.fill":__,"pin.slash":Q6,"play.circle":e6,plus:J6,"plus.circle":t6,"point.3.connected.trianglepath.dotted":CC,power:tC,qrcode:iC,"record.circle":Xb,"rectangle.and.hand.point.up.left":$6,"rectangle.portrait.and.arrow.right":z6,"rotate.right":y_,safari:o6,"server.rack":ah,shippingbox:Y6,"sidebar.left":G6,"slider.horizontal.3":dC,sparkles:pC,"speaker.slash.fill":bC,"speaker.wave.2":x_,"speaker.wave.2.fill":x_,"square.and.arrow.up":hC,"square.and.pencil":mC,"square.grid.2x2":N6,"square.grid.3x3":x6,"square.on.square":f_,"stop.circle":i6,"stop.fill":vC,terminal:_C,"text.bubble":H6,tray:M6,trash:yC,waveform:Nb,wifi:EC,"wifi.slash":kC,"wrench.and.screwdriver":MC,xmark:jC,"xmark.circle":u_,"xmark.circle.fill":u_},w_=new Map;function RC(e){const t=w_.get(e);if(t!==void 0)return t;const r=(DC[e]??V3).map(([l,h])=>`<${l} ${Object.entries(h).filter(([,d])=>d!==void 0).map(([d,p])=>`${d}="${p}"`).join(" ")}/>`).join("");return w_.set(e,r),r}let xh=null;const Nh=new Set;window.codync?.platform==="darwin"?fetch("/demo/desktop/symbols/manifest.json").then(e=>e.ok?e.json():{}).then(e=>{xh=e;for(const t of Nh)t()}).catch(()=>{xh={};for(const e of Nh)e()}):xh={};function AC(){return x.useSyncExternalStore(e=>(Nh.add(e),()=>{Nh.delete(e)}),()=>xh)}function ae({name:e,size:t,weight:n="regular",color:r,style:l,className:h,scaled:d=!0,title:p}){const m=AC()?.[e],v=d?`${t}px * var(--scale)`:`${t}px`;if(m){const S=`url("/demo/desktop/symbols/${e}.${n}.png")`;return c.jsx("span",{className:h,title:p,"aria-hidden":p?void 0:!0,style:{display:"inline-block",flex:"none",width:`calc(${m.w} * ${v})`,height:`calc(${m.h} * ${v})`,backgroundColor:r??"currentColor",WebkitMaskImage:S,maskImage:S,WebkitMaskSize:"100% 100%",maskSize:"100% 100%",WebkitMaskRepeat:"no-repeat",...l}})}const _={light:1.5,regular:1.75,medium:2,semibold:2.25,bold:2.5,black:2.75}[n];return c.jsx("svg",{className:h,"aria-hidden":p?void 0:!0,viewBox:"0 0 24 24",fill:"none",stroke:r??"currentColor",strokeWidth:_,strokeLinecap:"round",strokeLinejoin:"round",style:{width:`calc(1.2 * ${v})`,height:`calc(1.2 * ${v})`,flex:"none",...l},dangerouslySetInnerHTML:{__html:(p?`<title>${p}</title>`:"")+RC(e)}})}function NC(e,t,n){const r=new Path2D;let l=0;switch(e){case"pebble":r.ellipse(t/2,n/2,t/2,n*.4,0,0,Math.PI*2);break;case"squircle":r.roundRect(t*.04,n*.04,t*.92,n*.92,t*.3);break;case"tablet":r.roundRect(t*.14,0,t*.72,n,t*.22);break;case"wedge":r.moveTo(t*.5,n*.04),r.quadraticCurveTo(t*.9,n*.4,t*.98,n*.86),r.quadraticCurveTo(t*.5,n*1.04,t*.02,n*.86),r.quadraticCurveTo(t*.1,n*.4,t*.5,n*.04);break;case"hex":for(let h=0;h<6;h++){const d=h*Math.PI/3-Math.PI/2,p=t/2+Math.cos(d)*t*.49,g=n/2+Math.sin(d)*n*.49;h===0?r.moveTo(p,g):r.lineTo(p,g)}r.closePath(),l=t*.08;break;case"cloud":r.ellipse(t*.275,n*.575,t*.275,n*.275,0,0,Math.PI*2),r.moveTo(t,n*.575),r.ellipse(t*.725,n*.575,t*.275,n*.275,0,0,Math.PI*2),r.moveTo(t*.82,n*.4),r.ellipse(t*.5,n*.4,t*.32,n*.32,0,0,Math.PI*2),r.roundRect(t*.1,n*.5,t*.8,n*.35,t*.15);break;case"teardrop":r.moveTo(t*.5,0),r.bezierCurveTo(t*.62,n*.2,t*.94,n*.38,t*.94,n*.62),r.arc(t*.5,n*.62,t*.44,0,Math.PI,!1),r.bezierCurveTo(t*.06,n*.38,t*.38,n*.2,t*.5,0);break;default:{for(let d=0;d<=64;d++){const p=d/64*2*Math.PI,g=.46+.035*Math.sin(p*3+.6),m=t/2+Math.cos(p)*t*g,v=n/2+Math.sin(p)*n*g;d===0?r.moveTo(m,v):r.lineTo(m,v)}r.closePath()}}return{path:r,stroke:l}}const lh=document.createElement("canvas").getContext("2d"),b_=new Map;function LC(e,t,n){const r=`${e}|${t}|${n}`,l=b_.get(r);if(l)return l;const{path:h,stroke:d}=NC(e,t,t),p=t/n,g=[];lh.lineWidth=d,lh.lineJoin="round";for(let m=0;m<n;m++)for(let v=0;v<n;v++){const _=(v+.5)*p,S=(m+.5)*p;(lh.isPointInPath(h,_,S,"nonzero")||d>0&&lh.isPointInStroke(h,_,S))&&g.push({row:m,col:v,x:_,y:S})}return b_.set(r,g),g}const nn=x.memo(function({shape:t,color:n,tint:r,size:l=40,mood:h="idle",style:d}){const p=x.useRef(null),g=F2(),m=Ka(),v=r??ko(n);return x.useEffect(()=>{const _=p.current;if(!_)return;const S=window.devicePixelRatio||1;_.width=Math.round(l*S),_.height=Math.round(l*S);const w=_.getContext("2d"),b=h==="idle"||m;let k=0;const E=j=>{w.setTransform(S,0,0,S,0,0),w.clearRect(0,0,l,l),K2(w,{shape:t,fill:v,size:l,mood:h,dark:g,t:b?0:j/1e3%3600,still:b}),b||(k=requestAnimationFrame(E))};return E(performance.now()),()=>cancelAnimationFrame(k)},[t,v,l,h,g,m]),c.jsx("canvas",{ref:p,"aria-hidden":!0,style:{width:l,height:l,display:"block",flex:"none",...d}})});function K2(e,{shape:t,fill:n,size:r,mood:l,dark:h,t:d,still:p}){const g=r<18?7:r<28?9:13,m=g===7?[2,4]:g===9?[3,6]:[4,8],v=g===13?[4,5,6]:g===9?[3,4]:[2,3],_=r/g,S=LC(t,r,g),[w,b,k]=kb(h).text,E=parseInt(n.slice(1),16),[j,V,A]=[E>>16&255,E>>8&255,E&255],z=l==="working"?Math.round(Math.sin(d*2*Math.PI/3.2)*1.4):0,R=!p&&d/4.7%1<.035?v.slice(-1):v,I=m.map(L=>L+z),q=r/2,U=l==="working"?d*1.4:-.7,Y=Math.sin(U)*.8,$=.55,M=Math.cos(U)*.5+.6,N=Math.hypot(Y,$,M);for(const L of S){if(I.includes(L.col)&&R.includes(L.row))continue;const O=(L.x-q)/q,P=(q-L.y)/q,te=Math.sqrt(Math.max(.2,1-O*O-P*P)),Q=Math.hypot(O,P,te);let ce=.3+.7*Math.max(0,(O*Y+P*$+te*M)/(Q*N));if(l==="needsInput"){const Ce=.5+.5*Math.sin(Math.hypot(O,P)*9-d*5);ce*=.6+.4*Ce}const re=_*.42*(.55+.45*ce),de=g<13?.4+.4*ce:.2+.4*Math.min(1,ce/.7);e.beginPath(),e.arc(L.x,L.y,re,0,Math.PI*2),e.fillStyle=`rgba(${w},${b},${k},${de})`,e.fill(),ce>.6&&(e.fillStyle=`rgba(${j},${V},${A},${(ce-.6)/.4})`,e.fill())}}function $3(e,t=!0){return t?ln(e)?"needsInput":Jn(e)?"working":"idle":"idle"}function Ui({bot:e,size:t=40,animated:n=!0}){return c.jsx(nn,{shape:e.avatarShape,color:e.avatarColor,size:t,mood:$3(e,n)})}function Eo({members:e,size:t=40,animated:n=!0}){const r=(h,d,p)=>c.jsx("div",{style:{position:"absolute",...p},children:c.jsx(Ui,{bot:h,size:d,animated:n})},h.id);let l;switch(e.length){case 0:l=c.jsx("div",{style:{display:"grid",placeItems:"center",width:"100%",height:"100%",color:"var(--secondary)"},children:c.jsx(ae,{name:"person.2",size:t*.4})});break;case 1:l=c.jsx(Ui,{bot:e[0],size:t,animated:n});break;case 2:l=[r(e[1],t*.66,{top:0,right:0}),r(e[0],t*.66,{bottom:0,left:0})];break;case 3:l=[r(e[0],t*.55,{top:0,left:(t-t*.55)/2}),r(e[1],t*.55,{bottom:0,left:0}),r(e[2],t*.55,{bottom:0,right:0})];break;default:l=[r(e[0],t*.5,{top:0,left:0}),r(e[1],t*.5,{top:0,right:0}),r(e[2],t*.5,{bottom:0,left:0}),e.length===4?r(e[3],t*.5,{bottom:0,right:0}):c.jsxs("div",{style:{position:"absolute",right:0,bottom:0,width:t*.5,height:t*.5,display:"grid",placeItems:"center",fontSize:t*.24,fontWeight:700,color:"var(--secondary)",fontFamily:"ui-rounded, var(--font)"},children:["+",e.length-3]},"more")]}return c.jsx("div",{"aria-hidden":!0,style:{position:"relative",width:t,height:t,flex:"none"},children:l})}function BC({bot:e,members:t=[],size:n=44}){return c.jsxs("div",{style:{position:"relative",width:n,height:n,flex:"none"},children:[At(e)?c.jsx(Eo,{members:t,size:n}):c.jsx(Ui,{bot:e,size:n}),ln(e)?c.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:n*.36,height:n*.36,borderRadius:"50%",background:"var(--warning)",boxShadow:"0 0 0 2px var(--background)",display:"grid",placeItems:"center",color:"#fff"},children:c.jsx(ae,{name:"exclamationmark",size:n*.2,weight:"black",scaled:!1})}):e.unread>0?c.jsx("div",{style:{position:"absolute",right:0,bottom:0,width:n*.28,height:n*.28,borderRadius:"50%",background:"var(--accent-fill)",boxShadow:"0 0 0 2px var(--background)"}}):null]})}const OC={largeTitle:26,title:22,title2:17,title3:15,headline:13,body:13,callout:12,subheadline:11,footnote:10,caption:10,caption2:10,compactBody:12,compactSecondary:11},Fh=e=>`calc(${e}px * var(--scale))`,zC={light:300,regular:400,medium:500,semibold:600,bold:700,black:900};function B(e,t,n){const r=typeof e=="number"?e:OC[e],l=t??(e==="headline"?"bold":"regular");return{fontSize:Fh(r),fontWeight:zC[l],...n==="monospaced"?{fontFamily:"var(--mono)"}:n==="rounded"?{fontFamily:"ui-rounded, var(--font)"}:{}}}var Kh=U3();function er(e,t=300,n=!0){const[r,l]=x.useState(e),[h,d]=x.useState(e&&!n);return x.useLayoutEffect(()=>{if(o_()){l(e),d(e);return}if(e){l(!0);let g=0;const m=requestAnimationFrame(()=>{g=requestAnimationFrame(()=>d(!0))});return()=>{cancelAnimationFrame(m),cancelAnimationFrame(g)}}d(!1);const p=setTimeout(()=>l(!1),o_()?0:t);return()=>clearTimeout(p)},[e,t]),{mounted:r,shown:h}}const W3=x.createContext(()=>{}),ss=()=>x.useContext(W3),Yl=[];let HC=0;function Y2(e,t){const n=x.useRef(t);n.current=t,x.useEffect(()=>{if(!e)return;const r=++HC;Yl.push(r);const l=h=>{h.key==="Escape"&&Yl[Yl.length-1]===r&&(h.preventDefault(),h.stopPropagation(),n.current())};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0),Yl.splice(Yl.indexOf(r),1)}},[e])}function $t({open:e,onClose:t,width:n,height:r,children:l}){const{mounted:h,shown:d}=er(e),p=x.useRef(l);return e&&(p.current=l),Y2(e,t),h?Kh.createPortal(c.jsx(W3.Provider,{value:t,children:c.jsxs("div",{className:`modal-card ${d?"shown":""}`,role:"dialog","aria-modal":!0,children:[c.jsx("div",{className:"modal-dim"}),c.jsx("div",{className:"modal-content",style:{width:n,height:r,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 48px)"},children:e?l:p.current})]})}),document.body):null}function ts({open:e,title:t,message:n,actions:r,cancel:l="Cancel",onClose:h}){const{mounted:d,shown:p}=er(e,120),g=x.useRef({title:t,message:n,actions:r});if(e&&(g.current={title:t,message:n,actions:r}),Y2(e&&l!==null,h),!d)return null;const m=g.current;return Kh.createPortal(c.jsxs("div",{className:`dialog ${p?"shown":""}`,role:"alertdialog","aria-modal":!0,children:[c.jsx("div",{className:"dialog-dim",onClick:()=>l!==null&&h()}),c.jsxs("div",{className:"dialog-card",children:[c.jsxs("div",{className:"dialog-text",children:[c.jsx("div",{style:B("headline"),children:m.title}),m.message?c.jsx("div",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:m.message}):null]}),c.jsxs("div",{className:"dialog-buttons",children:[m.actions.map(v=>c.jsx("button",{className:`dialog-button ${v.destructive?"destructive":"prominent"}`,onClick:()=>{h(),v.action()},children:v.title},v.title)),l!==null?c.jsx("button",{className:"dialog-button",onClick:h,children:l}):null]})]})]}),document.body)}function IC({pick:e,dismiss:t,size:n=26}){return c.jsx("div",{style:{display:"flex"},children:e.emoji.map(r=>{const l=e.chosen.includes(r);return c.jsx("button",{className:`reaction-button ${l?"chosen":""}`,style:{width:n,height:n,borderRadius:n*.28},title:l?`Remove ${r}`:`React ${r}`,"aria-label":l?`Remove reaction ${r}`:`React ${r}`,onClick:()=>{t?.(),e.toggle(r)},children:c.jsx("span",{style:B(14),children:r})},r)})})}function UC({items:e,reactions:t,dismiss:n,maxHeight:r}){const[l,h]=x.useState(-1);return x.useEffect(()=>{const d=p=>{p.key==="ArrowDown"||p.key==="ArrowUp"?(p.preventDefault(),h(g=>(g+(p.key==="ArrowDown"?1:-1)+e.length)%e.length)):p.key==="Enter"&&l>=0&&(p.preventDefault(),n(),e[l]?.action())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l,n]),c.jsxs("div",{className:"menu-panel",style:{maxHeight:r},children:[t?c.jsx("div",{style:{paddingBottom:e.length?4:0},children:c.jsx(IC,{pick:t,dismiss:n})}):null,e.map((d,p)=>c.jsxs("div",{children:[d.divider?c.jsx("div",{className:"menu-divider"}):null,c.jsxs("button",{className:`menu-row ${d.destructive?"destructive":""} ${l===p?"highlight":""}`,title:d.title,onMouseEnter:()=>h(p),onClick:()=>{n(),d.action()},children:[d.icon?c.jsx("span",{className:"menu-icon",children:c.jsx(ae,{name:d.icon,size:12})}):null,c.jsx("span",{className:"menu-title",children:d.title}),d.selected!==void 0?c.jsx("span",{style:{opacity:d.selected?1:0,display:"flex"},children:c.jsx(ae,{name:"checkmark",size:10,weight:"semibold"})}):null]})]},`${d.title}-${p}`))]})}function Pa({open:e,onClose:t,anchor:n,point:r,items:l,reactions:h}){const{mounted:d,shown:p}=er(e,120),[g,m]=x.useState(null),v=x.useRef([]);if(e&&(v.current=l()),x.useLayoutEffect(()=>{e&&(r?m(new DOMRect(r.x,r.y,0,0)):n?.current&&m(n.current.getBoundingClientRect()))},[e,r,n]),Y2(e,t),!d||!g)return null;const _=window.innerWidth,S=window.innerHeight,w=Math.max(0,S-g.bottom-14),b=Math.max(0,g.top-14),k=w>=b,E=g.left+g.width/2<_*.6,j=Math.min(320,_-16),V=Math.max(8,_-j-8),A={position:"absolute",[k?"top":"bottom"]:k?g.bottom+6:S-g.top+6,...E?{left:Math.min(Math.max(8,g.left),V)}:{right:Math.min(Math.max(8,_-g.right),V)},maxWidth:j,transformOrigin:`${k?"top":"bottom"} ${E?"left":"right"}`};return Kh.createPortal(c.jsx("div",{className:`anchored ${p?"shown":""}`,onMouseDown:z=>z.target===z.currentTarget&&t(),onContextMenu:z=>{z.preventDefault(),t()},children:c.jsx("div",{className:"anchored-panel",style:A,children:c.jsx(UC,{items:v.current,reactions:h,dismiss:t,maxHeight:Math.min(420,k?w:b)})})}),document.body)}function PC(){const[e,t]=x.useState(null);return{point:e,open:e!==null,onContextMenu:n=>{n.preventDefault(),n.stopPropagation(),t({x:n.clientX,y:n.clientY})},close:()=>t(null)}}function Lt({title:e,trailing:t}){const n=ss();return c.jsxs("div",{className:"modal-header",children:[c.jsx("div",{style:{...B("compactBody","semibold"),flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t,c.jsx(F3,{title:"Close",icon:"xmark",onClick:n})]})}function F3({title:e,icon:t,onClick:n,selected:r=!1,size:l=28,disabled:h,className:d,buttonRef:p}){return c.jsx("button",{ref:p,className:`icon-button ${r?"selected":""} ${d??""}`,style:{width:l,height:l,borderRadius:l*.28},title:e,"aria-label":e,disabled:h,onClick:n,children:c.jsx(ae,{name:t,size:l/2,weight:"medium"})})}const ke=F3;function Fe({kind:e="primary",children:t,onClick:n,disabled:r,style:l,className:h,title:d}){return c.jsx("button",{className:`styled-button ${e} ${h??""}`,onClick:n,disabled:r,style:l,title:d,children:t})}function et({size:e=14}){const t=Math.max(1.5,e/9),n=(e-t)/2,r=2*Math.PI*n;return c.jsx("svg",{className:"spinner",width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-label":"Loading",role:"img",children:c.jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:"var(--secondary)",strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.7} ${r}`})})}function rn({on:e,onChange:t,children:n,disabled:r,style:l}){return c.jsxs("button",{className:"switch",role:"switch","aria-checked":e,disabled:r,onClick:()=>t(!e),style:l,children:[n!==void 0?c.jsx("span",{className:"switch-label",children:n}):null,c.jsx("span",{className:`switch-track ${e?"on":""}`,children:c.jsx("span",{className:"switch-knob"})})]})}function Yh({items:e,children:t,className:n,style:r,title:l}){const[h,d]=x.useState(!1),p=x.useRef(null);return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:p,className:n,style:r,title:l,onClick:()=>d(g=>!g),children:t}),c.jsx(Pa,{open:h,onClose:()=>d(!1),anchor:p,items:e})]})}function Ci({selection:e,options:t,onChange:n,fill:r,fits:l=!1}){const h=t.find(d=>d.id===e)?.label??"Choose";return c.jsxs(Yh,{title:h,className:`choice-picker ${r?"":"outlined"}`,style:{background:r,width:l?"100%":void 0},items:()=>t.map(d=>({title:d.label,selected:d.id===e,action:()=>n(d.id)})),children:[c.jsx("span",{className:"choice-label",children:h}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})}function qC({selection:e,options:t,onChange:n}){const r=Math.max(0,t.findIndex(l=>l.id===e));return c.jsxs("div",{className:"segmented",children:[c.jsx("div",{className:"segmented-thumb",style:{width:`calc((100% - 6px - ${(t.length-1)*2}px) / ${t.length})`,transform:`translateX(calc(${r} * (100% + 2px)))`}}),t.map(l=>c.jsx("button",{className:`segmented-option ${l.id===e?"on":""}`,onClick:()=>n(l.id),"aria-pressed":l.id===e,children:l.label},l.id))]})}function VC({selection:e,options:t,onChange:n}){return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.map(r=>c.jsxs("button",{className:"choice-row",onClick:()=>n(r.id),children:[c.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[c.jsx("span",{style:{color:"var(--text)"},children:r.label}),r.detail?c.jsx("span",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:r.detail}):null]}),c.jsx("span",{style:{opacity:r.id===e?1:0,display:"flex"},children:c.jsx(ae,{name:"checkmark",size:10,weight:"semibold"})})]},r.id))})}function hi({children:e,style:t}){return c.jsx("div",{className:"card-form",style:t,children:c.jsx("div",{className:"card-form-content",children:e})})}function Ee({title:e,footer:t,accessory:n,children:r}){const l=x.Children.toArray(r);return c.jsxs("section",{className:"card-section",children:[e?c.jsxs("div",{className:"card-section-title",children:[c.jsx("span",{style:{...B(13,"semibold"),color:"var(--text)"},children:e}),c.jsx("span",{style:{flex:1}}),n]}):null,c.jsx("div",{className:"card-section-rows",children:l.map((h,d)=>c.jsxs(x.Fragment,{children:[c.jsx("div",{className:"card-row",children:h}),d<l.length-1?c.jsx("div",{className:"hairline inset"}):null]},d))}),t?c.jsx("div",{className:"card-section-footer",children:t}):null]})}function $C({style:e}){return c.jsx("div",{className:"hairline",style:e})}function Jt({label:e,detail:t,children:n}){return c.jsxs("div",{className:"value-row",children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,minWidth:0},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),c.jsx("span",{style:{flex:1,minWidth:12}}),c.jsx("span",{style:{color:"var(--secondary)",display:"flex",alignItems:"center"},children:n})]})}function WC({value:e,onChange:t,prompt:n="Search",inputRef:r}){return c.jsxs("div",{className:"search-field",children:[c.jsx(ae,{name:"magnifyingglass",size:12,color:"var(--secondary)"}),c.jsx("input",{ref:r,value:e,placeholder:n,spellCheck:!1,onChange:l=>t(l.target.value)}),e?c.jsx("button",{"aria-label":"Clear search",onClick:()=>t(""),style:{display:"flex",color:"var(--tertiary)"},children:c.jsx(ae,{name:"xmark.circle.fill",size:12})}):null]})}function G2({expanded:e,onToggle:t,label:n,children:r}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("button",{className:"disclosure-label",onClick:t,"aria-expanded":e,children:[n,c.jsx("span",{style:{flex:1,minWidth:8}}),c.jsx("span",{style:{display:"flex",transform:`rotate(${e?90:0}deg)`,transition:"transform var(--layout)",color:"var(--secondary)"},children:c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold"})})]}),e?r:null]})}function K3({children:e,fill:t="var(--background)",outlined:n=!1,style:r}){return c.jsx("span",{className:"pill",style:{background:n?"transparent":t,boxShadow:n?"inset 0 0 0 1px var(--border)":void 0,...r},children:e})}class Br{#e=new Set;#i=0;#t=!1;changed(){this.#t||(this.#t=!0,queueMicrotask(()=>{this.#t=!1,this.#i++;for(const t of[...this.#e])t()}))}subscribe=t=>(this.#e.add(t),()=>{this.#e.delete(t)});getVersion=()=>this.#i}function cn(e){return x.useSyncExternalStore(e?e.subscribe:FC,e?e.getVersion:KC),e}const FC=()=>()=>{},KC=()=>0;function Y3(e){const t=x.useRef({models:e,version:0});t.current.models=e,x.useSyncExternalStore(x.useCallback(n=>{const r=t.current.models.map(l=>l.subscribe(()=>{t.current.version++,n()}));return()=>r.forEach(l=>l())},[e.length,...e]),()=>t.current.version)}function bi(e,t){const n=new Set;let r=(()=>{try{const l=localStorage.getItem(e);return l===null?t:JSON.parse(l)}catch{return t}})();return window.addEventListener("storage",l=>{if(l.key===e){try{r=l.newValue===null?t:JSON.parse(l.newValue)}catch{r=t}for(const h of n)h()}}),{get:()=>r,set(l){r=l;try{localStorage.setItem(e,JSON.stringify(l))}catch{}for(const h of n)h()},subscribe(l){return n.add(l),()=>{n.delete(l)}}}}function ni(e){return[x.useSyncExternalStore(e.subscribe,e.get),e.set]}const Uf=[11,12,13,14,15,16,18],Ua=12;function YC(e,t){return(t?Uf.find(n=>n>e):[...Uf].reverse().find(n=>n<e))??e}const Rt={textSize:bi("conversationFontSize",Ua),sidebarCompact:bi("sidebarCompact",!1),sidebarWidth:bi("desktopSidebarWidth",296),hiddenComputers:bi("hiddenComputers",""),usageIconStyle:bi("usageIconStyle","character"),onboardingDone:bi("macAccountOnboardingCompleted",!1)};function G3(e){const t=Number.isFinite(e)?Math.min(Math.max(e,11),18):Ua;document.documentElement.style.setProperty("--scale",String(t/Ua)),document.documentElement.style.setProperty("--conversation",`${t}px`),document.documentElement.style.setProperty("--chat",`${t+2}px`),document.documentElement.style.setProperty("--chat-scale",String((t+2)/Ua))}Rt.textSize.subscribe(()=>G3(Rt.textSize.get()));const Z3=x.createContext(null);function ns(){const e=x.useContext(Z3);if(!e)throw new Error("AppContext missing");return cn(e)}const en=x.createContext(null);function Ne(){const e=x.useContext(en);if(!e)throw new Error("StoreContext missing");return cn(e)}function Or(){const e=x.useContext(en);if(!e)throw new Error("StoreContext missing");return e}class Ji extends Error{constructor(t,n){super(n),this.status=t}status;static unreachable(){return new Ji(0,"Can't reach your computer. Is it on and connected to the internet?")}get isTransient(){return this.status===0}}class Z2{constructor(t,n){this.baseURL=t,this.token=n}baseURL;token;async call(t,n,r){try{return await window.codync.host.call(this.baseURL,this.token,t,n,r)}catch(l){const h=l;throw new Ji(h.status??0,h.status===401?"This device isn't allowed on that computer anymore.":h.message)}}stream(t,n,r){return window.codync.host.stream(`${this.baseURL}${t}`,this.token,n,l=>r(l?new Ji(l.status,l.message):null))}}function GC(e){let t;try{t=JSON.parse(e)}catch{return null}const n=t.type;switch(n){case"hello":return{type:n,hostId:t.hostId??"",rev:t.rev??0,usage:t.usage??{providers:[]},screen:zf(t.screen)};case"bot":{const r=t.bot;return!r||typeof r.id!="string"?{type:"undecodable",kind:"bot"}:r.deleted?{type:"botDeleted",id:r.id,rev:r.rev??0}:{type:n,bot:Of(r)}}case"entry":{const r=t.entry;return!r||typeof r.id!="string"||typeof r.botId!="string"?{type:"undecodable",kind:"entry"}:{type:n,entry:{...r,data:r.data??{}}}}case"usage":return t.usage?{type:n,usage:t.usage}:null;case"screen":{const r=zf(t.screen);return r?{type:n,screen:r}:null}case"accessRequests":return{type:n,requests:t.requests??[]};case"cloud":return t.cloud?{type:n,cloud:t.cloud}:null;case"resync":return{type:n};default:return null}}class X2{constructor(t){this.transport=t}transport;call(t,n={},r=2e4){return this.transport.call(t,n,r)}events(t,n,r,l){const h=new URLSearchParams({since:String(t),client:n});return this.transport.stream(`/events?${h}`,d=>{const p=GC(d);p&&r(p)},l)}hello(){return this.call("hello").then(t=>({...t,backends:t.backends??[],screen:zf(t.screen)??void 0}))}async history(t,n,r=100){return(await this.call("history",{botId:t,beforeSeq:n,limit:r})).entries}async thread(t,n){return(await this.call("thread",{botId:t,rootId:n})).entries}async send(t,n,r,l,h){return(await this.call("send",{botId:t,text:n,clientNonce:r,threadId:l,attachments:h})).entry}static uploadChunk=384*1024;async upload(t,n,r,l){let h=0;do{const d=Math.min(h+X2.uploadChunk,l.length);await this.call("upload",{botId:t,uploadId:n,name:r,data:X3(l.subarray(h,d)),offset:h,done:d===l.length},6e4),h=d}while(h<l.length)}async readUpload(t,n){const r=[];let l=0;for(;;){const p=await this.call("readUpload",{botId:t,uploadId:n,offset:l},6e4),g=Q3(p.data);if(!g.length||(r.push(g),l+=g.length,l>=p.size))break}const h=new Uint8Array(l);let d=0;for(const p of r)h.set(p,d),d+=p.length;return h}}function X3(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function Q3(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const C_="2.3.0";function k_(e){let t=e.trim();t.startsWith("v")&&(t=t.slice(1)),t=t.split("-")[0].split("+")[0];const n=t.split(".");if(n.length<1||n.length>3)return null;const r=[];for(const l of n){if(!/^[0-9]+$/.test(l))return null;r.push(Number(l))}for(;r.length<3;)r.push(0);return r}function Pf(e,t){const n=k_(e),r=k_(t);if(!n||!r)return!1;for(let l=0;l<3;l++)if(n[l]!==r[l])return n[l]<r[l];return!1}function ZC(e,t,n){return n&&Pf(e,n)?{kind:"updateApp",minimum:n}:Pf(t,C_)?{kind:"updateHost",version:t,minimum:C_}:null}class XC{values=new Map;listeners=new Set;retired=!1;storage;key;onSaveError;constructor(t,n,r){this.storage=t,this.key=n,this.onSaveError=r;try{const l=JSON.parse(t.getItem(n)??"null");if(Array.isArray(l))for(const h of l)Array.isArray(h)&&h.length===2&&typeof h[0]=="string"&&typeof h[1]=="string"&&this.values.set(h[0],h[1])}catch{}}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});get(t,n=null){return this.values.get(JSON.stringify([t,n]))??""}set(t,n,r){if(this.retired)return;const l=JSON.stringify([t,n]);r?this.values.set(l,r):this.values.delete(l),this.save()}removeBot(t){if(!this.retired){for(const n of this.values.keys())try{JSON.parse(n)[0]===t&&this.values.delete(n)}catch{this.values.delete(n)}this.save()}}clear(){this.retired||(this.values.clear(),this.save())}retire(){this.retired=!0}save(){try{this.storage.setItem(this.key,JSON.stringify([...this.values]))}catch{this.onSaveError?.()}for(const t of this.listeners)t()}}class QC extends Br{constructor(t,n,r,l="mac",h=window.codync.appVersion,d="local"){super(),this.isLoopback=n,this.makeTransport=r,this.clientKind=l,this.appVersion=h,this.contextId=d,this.computer=t,this.composerDrafts=new XC(localStorage,`codync-drafts-v1-${JSON.stringify([d,t.id])}`,()=>this.setError("Couldn't save the draft on this device. Your text is still here; keep this window open until you send or copy it.")),this.loadCache()}isLoopback;makeTransport;clientKind;appVersion;contextId;computer;connection={kind:"connecting"};hostRoute=null;client=null;hello=null;hostVersion=null;bots=new Map;entries=new Map;usage={providers:[]};screen=null;accessRequests=[];cloud=null;historyComplete=new Set;routineDrafts=new Map;composerDrafts;lastError=null;selection=null;answering=new Map;onRosterChanged=null;onComputerChanged=null;waiting=0;rev=0;hostId=null;retired=!1;unreadable=!1;saveTimer=null;cacheStamp=null;get isOffline(){const t=this.connection.kind;return t==="computerOffline"||t==="offline"||t==="unauthorized"}get canQueue(){return!1}get shownConnection(){return this.waiting>0&&this.connection.kind==="online"?{kind:"connecting"}:this.connection}get hostName(){return this.hello?.name??this.computer.name}get mismatch(){if(!this.hostVersion)return null;const t=ZC(this.appVersion,this.hostVersion.version,this.hostVersion.minApp);return t||(this.unreadable&&Pf(this.appVersion,this.hostVersion.version)?{kind:"updateApp",minimum:this.hostVersion.version}:null)}get roster(){return[...this.bots.values()].filter(t=>!t.hidden).sort((t,n)=>t.pinned!==n.pinned?t.pinned?-1:1:n.lastAt-t.lastAt)}get hiddenBots(){return[...this.bots.values()].filter(t=>t.hidden).sort((t,n)=>t.name.localeCompare(n.name))}backendName(t){return this.hello?.backends.find(n=>n.id===t)?.name??JC(t)}chat(t){return(this.entries.get(t)??[]).filter(n=>!n.threadId)}allEntries(t){return this.entries.get(t)??[]}replies(t,n){return(this.entries.get(t)??[]).filter(r=>r.threadId===n)}members(t){return t.members.map(n=>this.bots.get(n)).filter(n=>!!n)}authorName(t){return t&&this.bots.get(t)?.name||"A deleted bot"}currentThinking(t,n){const r=this.allEntries(t);for(let l=r.length-1;l>=0;l--){const h=r[l];if((h.threadId??null)===n){if(h.kind==="user"||h.kind==="agent"&&h.data.final===!0)return null;if(h.kind==="thought"&&h.data.text)return h.data.text}}return null}get connectionLabel(){switch(this.shownConnection.kind){case"online":return this.mismatch?"Needs update":"Connected";case"connecting":return"Connecting…";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}}updateComputer(t){const n=t({...this.computer});JSON.stringify(n)!==JSON.stringify(this.computer)&&(this.computer=n,this.onComputerChanged?.(n),this.changed())}upsert(t){const n=[...this.entries.get(t.botId)??[]],r=n.findIndex(l=>l.id===t.id);if(r>=0){if(t.rev<n[r].rev)return;n[r]=t}else{const l=t.kind==="user"?t.data.clientNonce:void 0,h=l?n.filter(p=>p.id!==`local-${l}`):n,d=h[h.length-1];if(d&&d.seq>t.seq&&t.seq>0){const p=h.findIndex(g=>g.seq>t.seq);h.splice(p<0?h.length:p,0,t)}else h.push(t);this.entries.set(t.botId,h);return}this.entries.set(t.botId,n)}setError(t){this.lastError=t,this.changed()}get cacheKey(){return`codync-mirror-${this.contextId}-${this.computer.id}`}loadCache(){try{const t=localStorage.getItem(this.cacheKey);if(!t)return;const n=JSON.parse(t);this.cacheStamp=n.stamp??"",this.hostId=n.hostId??null,this.rev=n.rev,this.bots=new Map(n.bots.map(l=>[l.id,l]));const r=new Map;for(const l of n.entries)r.set(l.botId,[...r.get(l.botId)??[],l]);this.entries=r}catch{}}scheduleSave(){this.retired||(this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>this.saveCache(),2e3))}saveCache(){if(this.retired)return;const t=[];for(const r of this.entries.values())t.push(...r.filter(l=>!l.id.startsWith("local-")).slice(-200)),t.push(...r.filter(l=>l.id.startsWith("local-")&&l.data.status==="failed"));const n={stamp:`${this.appVersion}/${this.hello?.version??""}`,hostId:this.hostId,rev:this.rev,bots:[...this.bots.values()],entries:t};try{localStorage.setItem(this.cacheKey,JSON.stringify(n))}catch{}}}function JC(e){switch(e){case"claude":return"Claude Code";case"codex":return"Codex";case"opencode":return"OpenCode";case"grok":return"Grok Build";case"gemini":return"Gemini CLI";default:return"Custom agent"}}const e8=5e3,E_=1e3,M_=2e4,t8=3e4,za=e=>new Promise(t=>setTimeout(t,e)),i8=(e,t)=>e.kind===t.kind&&JSON.stringify(e)===JSON.stringify(t);class s8 extends QC{heldDrop=null;dropTimer=null;closeEvents=null;eventsLoop=0;rewound=!1;readingViews=new Map;retire(){this.retired=!0,this.composerDrafts.retire(),this.stopTransport(),this.saveTimer&&clearTimeout(this.saveTimer),this.onRosterChanged=null,this.onComputerChanged=null,this.client=null,this.selection=null}start(){this.restartStream()}restartStream(){if(this.retired)return;this.stopTransport(),this.connection.kind!=="online"&&this.setConnection({kind:"connecting"});const t=this.makeTransport();this.client=new X2(t),this.hostRoute=this.isLoopback?"loopback":null,this.runEvents(this.client)}stopTransport(){this.eventsLoop++,this.closeEvents?.(),this.closeEvents=null,this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null}setConnection(t){const n=t.kind==="connecting"||t.kind==="offline"||t.kind==="computerOffline",r=t.kind==="online"&&(this.connection.kind!=="online"||this.heldDrop!==null),l=this.connection.kind==="connecting"&&n&&t.kind!=="connecting";if(n&&(this.connection.kind==="online"||l)){const h=this.connection.kind==="online"?e8:E_;this.heldDrop=t,this.dropTimer||(this.dropTimer=setTimeout(()=>{this.dropTimer=null;const d=this.heldDrop;this.heldDrop=null,d&&!this.retired&&(this.connection=d,this.changed())},h));return}if(this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=null,this.heldDrop=null,i8(t,this.connection)||(this.connection=t,this.changed()),r)for(const h of this.readingViews.values())this.markRead(h.botId,h.thread)}runEvents(t){const n=++this.eventsLoop;let r=1e3;const l=()=>n===this.eventsLoop&&!this.retired,h=async()=>{if(l()){try{if(await this.refreshHello(t),!l())return;if(this.mismatch)return this.setConnection({kind:"online"}),await za(t8),void h();if(this.isLoopback){try{this.accessRequests=(await t.call("accessRequests")).requests}catch{}try{this.cloud=await t.call("cloudStatus")}catch{}this.changed()}if(!l())return;await new Promise((d,p)=>{this.closeEvents=t.events(this.rev,this.clientKind,g=>{l()&&(this.setConnection({kind:"online"}),r=1e3,this.apply(g))},g=>g?p(g):d())})}catch(d){if(!l())return;const p=d instanceof Error?d.message:String(d);if(this.setConnection({kind:"offline",message:p}),d instanceof Ji&&d.status===401)return}l()&&(await za(r),r=Math.min(r*2,2e4),h())}};h()}restartEvents(){this.client&&(this.closeEvents?.(),this.runEvents(this.client))}async refreshHello(t){const n=await t.hello();this.retired||(this.hello=n,this.noteHostVersion({version:n.version,minApp:n.minApp}),this.isLoopback&&this.updateComputer(r=>({...r,name:n.name,device:n.device??r.device})),this.changed())}noteHostVersion(t){(this.cacheStamp!==null&&this.cacheStamp!==`${this.appVersion}/${t.version}`||this.hostVersion&&this.hostVersion.version!==t.version)&&(this.rev=0,this.rewound=!1,this.unreadable=!1),this.cacheStamp=null,this.hostVersion=t}apply(t){switch(t.type){case"hello":this.hostId&&this.hostId!==t.hostId&&this.resetMirror(),this.hostId=t.hostId,this.usage=t.usage,this.screen=t.screen,t.rev<this.rev&&(this.rev=0);break;case"bot":this.bots.set(t.bot.id,t.bot),this.bump(t.bot.rev),this.onRosterChanged?.(),t.bot.unread>0&&this.acknowledgeVisible(t.bot.id);break;case"botDeleted":this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.bump(t.rev),this.selection===t.id&&(this.selection=null),this.onRosterChanged?.();break;case"entry":this.upsert(t.entry),this.bump(t.entry.rev),this.acknowledgeVisible(t.entry.botId,t.entry);break;case"usage":this.usage=t.usage;break;case"screen":this.screen=t.screen;break;case"accessRequests":this.accessRequests=t.requests;break;case"cloud":this.cloud=t.cloud;break;case"resync":this.restartEvents();break;case"undecodable":this.rewound?this.unreadable||(this.unreadable=!0,this.mismatch&&this.restartEvents()):(this.rewound=!0,this.rev=0,this.restartEvents());break}this.changed(),this.scheduleSave()}resetMirror(){this.composerDrafts.clear(),this.bots=new Map;const t=new Map;for(const[n,r]of this.entries){const l=r.filter(h=>h.id.startsWith("local-"));l.length&&t.set(n,l)}this.entries=t,this.selection=null,this.onRosterChanged?.(),this.rev=0,this.hostId=null,this.historyComplete=new Set,this.screen=null,this.saveCache()}bump(t){this.rev=Math.max(this.rev,t)}get live(){return this.connection.kind==="online"&&!this.heldDrop&&!this.retired?this.client:null}async ready(t=Date.now()+M_){let n=!1,r=!1;try{for(;!this.retired;){if(this.live)return this.live;switch(this.connection.kind){case"online":case"connecting":break;case"offline":if(!r){r=!0,this.restartStream();break}throw Ji.unreachable();case"unpaired":throw Ji.unreachable();case"computerOffline":throw new Ji(0,"Your computer is offline.");case"unauthorized":throw new Ji(401,this.connection.message)}if(Date.now()>=t)break;n||(n=!0,this.waiting++,this.changed()),await za(100)}throw Ji.unreachable()}finally{n&&(this.waiting--,this.changed())}}async withLink(t,n=!1){const r=Date.now()+M_;for(;;){const l=await this.ready(r);try{return await t(l)}catch(h){if(n&&h instanceof Ji&&h.isTransient&&Date.now()<r){await za(500);continue}throw h}}}perform(t,n=!1){this.withLink(t,n).catch(r=>{this.lastError=r instanceof Error?r.message:String(r),this.changed()})}setReading(t,n,r,l){l?(this.readingViews.set(t,{botId:n,thread:r}),this.connection.kind==="online"&&this.markRead(n,r)):this.readingViews.delete(t)}acknowledgeVisible(t,n){if(this.connection.kind!=="online")return;const r=new Set;for(const l of this.readingViews.values()){if(l.botId!==t||n&&(!_o(n)||(n.threadId??null)!==l.thread))continue;const h=`${l.botId}/${l.thread}`;r.has(h)||(r.add(h),this.markRead(t,l.thread))}}markRead(t,n=null){(async()=>{this.live||await za(E_);const r=this.live;if(r)try{await r.call("markRead",{botId:t,threadId:n,all:!1})}catch{}})()}}const n8=100*1024*1024,r8=["👍","❤️","😂","🎉","👀","✅"];class J3 extends s8{outgoingFiles=new Map;send(t,n,r=null,l=[],h=crypto.randomUUID()){const d=t.trim();if(!d&&!l.length||this.retired)return;const p={text:d,status:"sending",clientNonce:h};l.length&&(p.attachments=l.map(g=>({id:g.id,name:g.name,size:g.data.length})),this.outgoingFiles.set(h,l)),this.upsert({id:`local-${h}`,seq:Number.MAX_SAFE_INTEGER,botId:n,threadId:r,rev:0,kind:"user",turn:0,data:p,createdAt:Date.now(),updatedAt:0}),this.changed(),(async()=>{try{const g=await this.withLink(async m=>{let v=null;const _=this.outgoingFiles.get(h);if(_){v=[];for(const S of _){const w=crypto.randomUUID();await m.upload(n,w,S.name,S.data),j_(w,S.data),v.push(w)}}return m.send(n,d,h,r,v)},!0);this.outgoingFiles.delete(h),this.upsert(g),this.changed()}catch(g){this.outgoingFiles.has(h)&&(this.lastError=`Couldn't send the files: ${g instanceof Error?g.message:g}`),this.markLocal(h,n,"failed")}})()}retry(t){const n=t.data.clientNonce&&this.outgoingFiles.get(t.data.clientNonce)||[],r=t.data.text??"";!r&&!n.length||(this.entries.set(t.botId,this.allEntries(t.botId).filter(l=>l.id!==t.id)),this.send(r,t.botId,t.threadId??null,n,t.data.clientNonce??crypto.randomUUID()))}discard(t){t.data.clientNonce&&this.outgoingFiles.delete(t.data.clientNonce),this.entries.set(t.botId,this.allEntries(t.botId).filter(n=>n.id!==t.id)),this.changed(),this.scheduleSave()}cancelQueued(t){}markLocal(t,n,r){const l=this.entries.get(n),h=l?.findIndex(p=>p.id===`local-${t}`)??-1;if(!l||h<0)return;const d=[...l];d[h]={...d[h],data:{...d[h].data,status:r}},this.entries.set(n,d),this.changed(),this.scheduleSave()}async attachmentData(t,n){const r=eS.get(t);if(r)return r;const l=this.live;if(!l)return null;try{const h=await l.readUpload(n,t);return j_(t,h),h}catch{return null}}stop(t){this.perform(n=>n.call("stop",{botId:t}),!0)}newSession(t){this.perform(n=>n.call("newSession",{botId:t}))}logCall(t,n){this.perform(r=>r.call("logCall",{botId:t,seconds:n}))}screenTakeover(t){this.perform(async n=>{this.screen=await n.call("screenTakeover",{on:t}),this.changed()},!0)}async setScreenEnabled(t){this.screen=await(await this.ready()).call("setScreenEnabled",{enabled:t}),this.changed()}react(t,n){const r=this.entries.get(t.botId),l=r?.findIndex(g=>g.id===t.id)??-1;if(!r||l<0)return;const h=[...r[l].data.reactions??[]],d=h.indexOf(n);d>=0?h.splice(d,1):h.push(n);const p=[...r];p[l]={...p[l],data:{...p[l].data,reactions:h}},this.entries.set(t.botId,p),this.changed(),this.perform(async g=>{const m=await g.call("react",{entryId:t.id,emoji:n});this.upsert(m.entry),this.changed()})}respond(t,n){this.answering.has(t.id)||(this.answering.set(t.id,n??""),this.changed(),(async()=>{try{await this.withLink(r=>r.call("respondPermission",{entryId:t.id,optionId:n}),!0),await za(2e3)}catch(r){this.lastError=r instanceof Error?r.message:String(r)}this.answering.delete(t.id),this.changed()})())}markAllRead(t){const n=this.bots.get(t);!n||n.unread<=0||(this.bots.set(t,{...n,unread:0}),this.changed(),this.perform(r=>r.call("markRead",{botId:t,threadId:null,all:!0}),!0))}patchBot(t,n){const r=this.bots.get(t.id);r&&this.bots.set(t.id,{...r,...n}),this.changed(),this.perform(l=>l.call("updateBot",{...a8(t),...n}),!0)}setPinned(t,n){this.patchBot(t,{pinned:n})}setHidden(t,n){this.patchBot(t,{hidden:n})}delete(t){this.composerDrafts.removeBot(t.id),this.bots.delete(t.id),this.entries.delete(t.id),this.onRosterChanged?.(),this.changed(),this.perform(n=>n.call("deleteBot",{botId:t.id}),!0)}async createGroup(t,n,r){const l={kind:"group",name:t,description:n,members:r},h=await(await this.ready()).call("createBot",l);return this.bots.set(h.bot.id,h.bot),this.selection=h.bot.id,this.onRosterChanged?.(),this.changed(),h.bot}async updateGroup(t){const n=await(await this.ready()).call("updateBot",t);this.bots.set(n.bot.id,n.bot),this.changed()}async loadThread(t,n){if(this.client)try{for(const r of await this.client.thread(t,n))this.upsert(r);this.changed()}catch{}}async save(t){const n=await this.ready(),r=t.id?await n.call("updateBot",{...t,model:t.model??null}):await n.call("createBot",t);return this.bots.set(r.bot.id,r.bot),this.onRosterChanged?.(),this.changed(),r.bot}async refreshBackends(){if(!(!this.client||!this.hello))try{const t=await this.client.call("refreshBackends",{},6e4);this.hello={...this.hello,backends:t.backends},this.changed()}catch{}}async listDirs(t){return(await this.ready()).call("listDirs",{path:t})}async refreshUsage(){if(!(this.retired||!this.client))try{this.usage=await this.client.call("usage",{refresh:!0}),this.changed()}catch{}}async loadOlder(t){if(!this.client||this.historyComplete.has(t))return;const n=this.chat(t).find(r=>r.seq>0&&r.seq!==Number.MAX_SAFE_INTEGER)?.seq??Number.MAX_SAFE_INTEGER;try{const r=await this.client.history(t,n,100);r.length<100&&this.historyComplete.add(t);for(const l of r)this.upsert(l);this.changed()}catch{}}setSelection(t){this.selection=t,this.changed()}consumeRoutineDraft(t){const n=this.routineDrafts.get(t);return n!==void 0&&(this.routineDrafts.delete(t),this.changed()),n}setRoutineDraft(t,n){this.routineDrafts.set(t,n),this.changed()}}function a8(e){return{id:e.id,name:e.name,description:e.description,avatarColor:e.avatarColor,avatarShape:e.avatarShape,backend:e.backend,command:e.command??null,cwd:e.managedWorkspace?"":e.cwd,permission:e.permission,model:e.model??null,pinned:e.pinned,hidden:e.hidden,notify:e.notify??null,connectors:e.connectors,skills:e.skills,computer:e.computer}}const eS=new Map;function j_(e,t){eS.set(e,t)}class l8 extends Br{isBusy=!1;isReady=!0;isConfigured=!1;errorMessage=null;user=null;cloudURL=null;get isSignedIn(){return this.user!==null}async start(){const t=await window.codync.account.state();this.apply(t),window.codync.account.onChange(n=>this.apply(n))}apply(t){this.isReady=t.ready,this.isConfigured=t.configured,this.isBusy=t.busy,this.errorMessage=t.error,this.user=t.user,this.cloudURL=t.cloudURL,this.changed()}async signIn(t){await window.codync.account.signIn(t)}async signOut(){await window.codync.account.signOut()}sessionToken(){return window.codync.account.token()}}const Zn=new l8;function Ya(){return cn(Zn)}class tS extends Error{constructor(t,n,r){super(n==="requestExpired"?"The request expired. Ask again.":n==="accountDeleted"?"This account was deleted.":n==="rateLimited"?"Too many requests. Try again in a little while.":r??`Codync cloud error (${n})`),this.status=t,this.code=n}status;code;get isTransient(){return this.status===0||this.status>=500||this.status===429||this.status===401}}async function Es(e,t,n,r=!1){const l=await window.codync.cloud.request(e,t,n,r);if(!l.ok)throw new tS(l.error.status,l.error.code,l.error.message);return l.value}const Aa=bi("cloudDefaultApplied",[]),U0=bi("claimedComputerIds",[]),P0=e=>bi(`keptOutOfAccount.${e}`,[]);class o8 extends Br{constructor(t){super(),this.app=t,Zn.subscribe(()=>this.tick()),t.subscribe(()=>this.tick())}app;computers=[];registeredFor=null;enablingCloud=!1;autoClaiming=!1;fail(t,n=!1){n||t instanceof tS&&t.isTransient||this.app.setError(t instanceof Error?t.message:String(t))}get userId(){return Zn.user?.userId??null}tick(){const t=this.userId;if(!t){this.computers.length&&(this.computers=[],this.changed()),this.registeredFor=null;return}this.registeredFor!==t&&(this.registeredFor=t,(async()=>{try{await Es("POST","v1/devices",{name:await c8(),platform:window.codync.platform==="darwin"?"macos":"linux"},!0)}catch(n){this.fail(n)}await this.refresh()})()),this.applyCloudDefault(),this.autoClaim()}async refresh(){if(this.userId)try{const t=await Es("GET","v1/computers",void 0,!0);this.computers=t.computers,this.changed()}catch(t){this.fail(t)}}applyCloudDefault(){const t=this.app.local;if(!Zn.cloudURL||!t||t.connection.kind!=="online"||!t.cloud)return;const n=t.computer.id;Aa.get().includes(n)||(Aa.set([...Aa.get(),n]),!(t.cloud.enabled||this.enablingCloud)&&(this.enablingCloud=!0,this.enableCloud(t).catch(()=>{}).finally(()=>this.enablingCloud=!1)))}autoClaim(){const t=this.userId,n=this.app.local;t&&n&&n.cloud?.owner?.userId===t&&U0.set([n.computer.id]);const r=this.autoClaimTarget;!r||this.autoClaiming||(this.autoClaiming=!0,(async()=>{let l=3e4;for(;!await this.claim(r,!0)&&(await new Promise(h=>setTimeout(h,l)),l=Math.min(l*2,6e5),this.autoClaimTarget?.computer.id===r.computer.id););this.autoClaiming=!1})())}get autoClaimTarget(){const t=this.userId,n=this.app.local;if(!t||!n||n.connection.kind!=="online")return null;const r=n.cloud;return!r?.enabled||r.owner||P0(t).get().includes(n.computer.id)?null:n}async claim(t,n=!1){const r=this.userId;if(!r||!t.client)return n||this.app.setError("Sign in first."),!1;const l=P0(r);l.set(l.get().filter(h=>h!==t.computer.id));try{const h=await t.ready();t.cloud?.enabled||await this.enableCloud(t);const d=await Es("POST","v1/claims",{}),p=await h.call("claimSign",{claimId:d.claimId,nonce:d.nonce,userId:r});return await Es("POST",`v1/claims/${d.claimId}/complete`,p),await this.refresh(),t===this.app.local&&await this.forgetEarlierIdentities(t.computer.id),!0}catch(h){return this.fail(h,n),!1}}async forgetEarlierIdentities(t){const n=new Set(U0.get().filter(r=>r!==t));for(const r of this.computers)n.has(r.computerId)&&!r.online&&await this.removeFromAccount(r.computerId);U0.set([t])}async unclaim(t){const n=this.userId;if(n){const r=P0(n);r.get().includes(t.computer.id)||r.set([...r.get(),t.computer.id])}try{await(await t.ready()).call("unclaim",{},3e4),await this.refresh()}catch(r){this.fail(r)}}async setCloud(t,n){Aa.get().includes(t.computer.id)||Aa.set([...Aa.get(),t.computer.id]);try{n?await this.enableCloud(t):await(await t.ready()).call("setCloud",{enabled:!1},3e4)}catch(r){this.fail(r)}}async enableCloud(t){return(await t.ready()).call("setCloud",{enabled:!0},3e4)}async removeFromAccount(t){try{await Es("DELETE",`v1/computers/${t}`),await this.refresh()}catch(n){this.fail(n)}}isOlderCopy(t){return t.online?!1:this.app.computers.some(n=>n.id!==t.computerId&&n.name===t.name)||this.computers.some(n=>n.computerId!==t.computerId&&n.name===t.name&&(this.app.store(n.computerId)!==null||!!n.online))}devices(){return Es("GET","v1/devices").then(t=>t.devices)}revokeDevice(t){return Es("DELETE",`v1/devices/${t}`)}grants(t){return Es("GET",`v1/computers/${t}/grants`).then(n=>n.grants)}revokeGrant(t,n){return Es("DELETE",`v1/computers/${t}/grants/${n}`)}async renameComputer(t,n){await Es("PATCH",`v1/computers/${t}`,{name:n}),await this.refresh()}}async function c8(){return window.codync.computerName||(window.codync.platform==="darwin"?"Mac":"Linux")}const T_=e=>`${e.computerId}/${e.botId}`,D_=e=>{const t=e.indexOf("/");return t<0?null:{computerId:e.slice(0,t),botId:e.slice(t+1)}},R_=(e,t)=>!!e&&!!t&&e.computerId===t.computerId&&e.botId===t.botId;class h8 extends Br{constructor(t=!0){super(),this.mirrors=t,this.cloud=new o8(this)}mirrors;host={state:{kind:"starting"},local:null,dev:!1,logPath:""};computers=[];stores=new Map;selection=null;lastError=null;screenNeedsApproval=!1;screenError=null;screenSynced=!1;deferred=new Set;storeSubscriptions=new Map;cloud;setError(t){this.lastError=t,this.changed()}async start(){window.codync.host.onChange(t=>this.setHost(t)),this.setHost(await window.codync.host.snapshot())}setHost(t){const n=this.host.local;this.host=t;const r=t.local;if(!this.mirrors)return this.changed();if(r&&(n?.computerId!==r.computerId||n.token!==r.token||!this.stores.has(r.computerId))){n&&n.computerId!==r.computerId&&this.detach(n.computerId);const h=this.computers.find(p=>p.id===r.computerId)??{id:r.computerId,name:"This computer",signKey:"",urls:[]},d=new J3(h,!0,()=>new Z2(r.baseURL,r.token));this.attach(h,d),d.subscribe(()=>this.syncScreen(d))}else!r&&n&&this.detach(n.computerId);this.changed()}get local(){return this.host.local?this.stores.get(this.host.local.computerId)??null:null}attach(t,n){this.detach(t.id),this.computers=[...this.computers.filter(r=>r.id!==t.id),t],this.stores.set(t.id,n),n.onComputerChanged=r=>{this.computers=this.computers.map(l=>l.id===r.id?r:l),this.changed()},n.onRosterChanged=()=>this.changed(),this.storeSubscriptions.set(t.id,n.subscribe(()=>{if(n.selection){const r=n.selection;n.selection=null,this.select({computerId:t.id,botId:r})}})),n.start(),this.changed()}detach(t){this.storeSubscriptions.get(t)?.(),this.storeSubscriptions.delete(t),this.stores.get(t)?.retire(),this.stores.delete(t),this.computers=this.computers.filter(n=>n.id!==t),this.selection?.computerId===t&&(this.selection=null),this.changed()}store(t){return this.stores.get(t)??null}get roster(){const t=[];for(const n of this.computers){const r=this.stores.get(n.id);if(r)for(const l of r.roster)t.push({ref:{computerId:n.id,botId:l.id},bot:l,computer:r.computer,store:r})}return t.sort((n,r)=>n.bot.pinned!==r.bot.pinned?n.bot.pinned?-1:1:r.bot.lastAt-n.bot.lastAt)}select(t){this.selection=t,this.changed()}get selectedStore(){return this.selection?this.store(this.selection.computerId):null}get managedStores(){return[...this.stores.values()].filter(t=>t.isLoopback)}get approvals(){return this.managedStores.flatMap(t=>t.accessRequests.map(n=>({id:`${t.computer.id}/${n.requestId}`,store:t,request:n})))}get currentApproval(){return this.approvals.find(t=>!this.deferred.has(A_(t)))??null}deferApproval(t){this.deferred.add(A_(t)),this.changed()}reviewApprovals(){this.deferred.clear(),this.changed()}async decide(t,n){await(await t.store.ready()).call("decideAccessRequest",{requestId:t.request.requestId,approve:n},3e4)}get needsAttention(){return this.roster.some(t=>t.bot.status==="needsInput")||this.approvals.length>0}get working(){return this.roster.filter(t=>t.bot.status==="working"||t.bot.status==="needsInput").length}get errorMessage(){if(this.lastError)return this.lastError;for(const t of this.stores.values())if(t.lastError)return t.lastError;return null}async setRemoteScreen(t){const n=this.local;if(n){try{this.screenNeedsApproval=(await window.codync.app.setScreenAgent(t)).needsApproval,await n.setScreenEnabled(t),this.screenError=null}catch(r){this.screenError=r instanceof Error?r.message:String(r)}this.changed()}}syncScreen(t){this.screenSynced||!t.screen||(this.screenSynced=!0,window.codync.app.syncScreenAgent(t.screen.enabled).then(n=>{this.screenNeedsApproval=n.needsApproval,this.changed()}))}clearErrors(){this.lastError=null;for(const t of this.stores.values())t.lastError=null;this.changed()}}const A_=e=>`${e.id}/${e.request.code??""}`;function u8(e,t){const n=t<40;switch(e){case"working":return n?3.9:1.885;case"searching":return n?2.665:2.015;case"listening":return n?3.998:4.388;case"connecting":return n?6.63:3.315}}function Q2(e,t,n,r){const l=Math.sin(e),h=Math.cos(e),d=Math.sin(t),p=Math.cos(t);return g=>{const m=g[0]*h+g[2]*l,v=-g[0]*l+g[2]*h;return[n/2+m*r,n/2-(g[1]*p-v*d)*r,g[1]*d+v*p]}}const tn=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)};function q0(e,t){const n=Math.floor(e),r=Math.floor(t),l=e-n,h=t-r,d=l*l*(3-2*l),p=h*h*(3-2*h),g=tn(n,r),m=tn(n+1,r),v=tn(n,r+1),_=tn(n+1,r+1);return g+(m-g)*d+(v-g)*p+(g-m-v+_)*d*p}const wh=e=>Math.hypot(e[0],e[1],e[2]),ps=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],qf=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],N_=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]];function d8(e,t){const n=e<40,r=e/2*.82,l=Q2(t*.12,.3,e,1),h=Math.pow(e/300,.6),d=n?2.4:1,p=n?3:12,g=n?10:40,m=[];for(let v=0;v<p;v++){const _=tn(v,1.7),S=tn(v,5.2),w=tn(v,8.9),b=r*(.45+.52*_),k=_*2*Math.PI,E=Math.acos(2*S-1),j=[Math.sin(E)*Math.cos(k),Math.cos(E),Math.sin(E)*Math.sin(k)];let V=[-j[1],j[0],0];V=ps(V,1/Math.max(1e-6,wh(V)));const A=[-j[2]*V[1],j[2]*V[0],j[0]*V[1]-j[1]*V[0]],z=(.25+.55*w)*(w>.5?1:-1);for(let F=0;F<g;F++){const R=F/g*2*Math.PI,I=l(ps(qf(ps(V,Math.cos(R)),ps(A,Math.sin(R))),b)),q=(I[2]/b+1)/2;m.push({x:I[0],y:I[1],z:I[2],radius:.9*d*h,white:.72,alpha:.5*(.4+.6*q)})}for(let F=0;F<3;F++){const R=t*z+F/3*2*Math.PI+S*6,I=l(ps(qf(ps(V,Math.cos(R)),ps(A,Math.sin(R))),b)),q=(I[2]/b+1)/2;m.push({x:I[0],y:I[1],z:I[2],radius:(1.2+1.6*q)*d*h,white:.3-.22*q,alpha:1})}}return{dots:m,lines:[]}}function f8(e,t,n){const r=e<40,l=Math.pow(e/300,.6),h=n?r?5:9:r?6:11,d=n?r?13:23:r?14:29,p=n?r?1.6:1:r?1.75:1.15,g=e/2*(n?.874:.82),m=n?.38:.4+.06*Math.sin(t*.35),v=Q2(t*(n?.18:.5),m,e,n?1:g),_=t*(.5+1.2*(r?4.335:4.08)),S=[];for(let w=0;w<=h;w++){const b=-Math.PI/2+w/h*Math.PI,k=Math.cos(b),E=Math.sin(b),j=.62*Math.sin(t*2.1-w*.52)+.38*Math.sin(t*1.27+w*.83),V=n?g*(.88+.105*j):1,A=Math.max(1,Math.round(Math.abs(k)*d));for(let z=0;z<A;z++){const F=z/A*2*Math.PI,R=v(ps([k*Math.cos(F),E,k*Math.sin(F)],V)),I=(R[2]/(n?g:1)+1)/2;if(n){const q=Math.max(0,j);S.push({x:R[0],y:R[1],z:R[2],radius:(.6+1.7*I)*p*(1+.4*q)*l,white:.66-.56*I-.1*q,alpha:1})}else{const q=F+t*.5-_,U=Math.atan2(Math.sin(q),Math.cos(q)),Y=Math.exp(-(U*U)/.18)*Math.max(0,R[2]);S.push({x:R[0],y:R[1],z:R[2],radius:((.6+1.7*I)*p+Y)*l,white:.62-.54*I,alpha:.45+.55*Math.min(1,Y)})}}}return{dots:S,lines:[]}}function p8(e,t){const n=e<40,r=Math.pow(e/300,.6),l=n?8:41,h=n?1:7,d=n?1.52:.95,p=.72,g=Q2(t*.12,.32,e,e/2*.8),m=Math.PI*(3-Math.sqrt(5)),v=[];for(let w=0;w<l;w++){const b=1-2*(w+.5)/l,k=Math.sqrt(1-b*b),E=w*m,j=[k*Math.cos(E),b,k*Math.sin(E)];j[0]+=.3*(q0(w*.31+9,t*.24)-.5)*2,j[1]+=.3*(q0(w*.53+27,t*.21)-.5)*2,j[2]+=.3*(q0(w*.77+55,t*.27)-.5)*2,v.push(ps(j,1/wh(j)))}const _=[],S=[];for(let w=0;w<l;w++){for(let j=w+1;j<l;j++){const V=wh(N_(v[w],v[j]));if(V>=p)continue;const A=g(v[w]),z=g(v[j]),F=((A[2]+z[2])/2+1)/2;S.push({x1:A[0],y1:A[1],x2:z[0],y2:z[1],white:.42,alpha:(1-V/p)*(.3+.55*F),width:Math.max(.6,.8*r)})}const b=g(v[w]),k=(b[2]+1)/2,E=1+.25*Math.sin(t*1.4+w*2.7);_.push({x:b[0],y:b[1],z:b[2],radius:(1.4+1.8*k)*d*E*r,white:.55-.45*k,alpha:1})}for(let w=0;w<h;w++){const b=Math.floor(t*.55+w*7.31),k=Math.floor(tn(b,w*3.1+1.7)*l),E=Math.floor(tn(b,w*5.7+4.2)*l);if(k===E)continue;const j=t*.55+w*7.31,V=j-Math.floor(j),A=qf(v[k],ps(N_(v[E],v[k]),V)),z=g(ps(A,1/Math.max(1e-6,wh(A)))),F=(z[2]+1)/2;_.push({x:z[0],y:z[1],z:z[2],radius:(1.4*1.5+1.8*F)*d*r,white:.05,alpha:.5+.5*F})}return{dots:_,lines:S}}function g8(e,t,n){const r=e==="working"?d8(t,n):e==="connecting"?p8(t,n):f8(t,n,e==="listening");return{dots:r.dots.filter(l=>l.alpha>=.02).map(l=>({...l,radius:Math.max(.3,l.radius)})).sort((l,h)=>l.z-h.z),lines:r.lines.filter(l=>l.alpha>=.02)}}const L_=(e,t)=>(1-Math.min(1,Math.max(0,e)))*t;function on({state:e="working",size:t=16,color:n="var(--text)",animated:r=!0}){const l=x.useRef(null),h=Ka(),d=F2();return x.useEffect(()=>{const p=l.current;if(!p)return;const g=window.devicePixelRatio||1;p.width=Math.round(t*g),p.height=Math.round(t*g);const m=p.getContext("2d"),v=getComputedStyle(p).color,_=r&&!h,S=performance.now();let w=0,b=0;const k=E=>{if(_&&E-b<1e3/30){w=requestAnimationFrame(k);return}b=E;const j=.6+(_?(E-S)/1e3*u8(e,t):0),V=g8(e,t,j);m.setTransform(g,0,0,g,0,0),m.clearRect(0,0,t,t),m.strokeStyle=v,m.fillStyle=v;for(const A of V.lines)m.globalAlpha=L_(A.white,A.alpha),m.lineWidth=A.width,m.beginPath(),m.moveTo(A.x1,A.y1),m.lineTo(A.x2,A.y2),m.stroke();for(const A of V.dots)m.globalAlpha=L_(A.white,A.alpha),m.beginPath(),m.arc(A.x,A.y,A.radius,0,Math.PI*2),m.fill();m.globalAlpha=1,_&&(w=requestAnimationFrame(k))};return w=requestAnimationFrame(k),()=>cancelAnimationFrame(w)},[e,t,r,h,n,d]),c.jsx("canvas",{ref:l,"aria-hidden":!0,style:{width:t,height:t,color:n,display:"block",flex:"none"}})}const m8=x.memo(function({bot:t,store:n,compact:r,usingComputer:l,members:h}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r?0:8,padding:"6px 0",width:"100%",justifyContent:r?"center":"flex-start"},children:[c.jsx(BC,{bot:t,members:h,size:30}),c.jsxs("div",{"aria-hidden":r,style:{display:"flex",flexDirection:"column",gap:1,minWidth:0,overflow:"hidden",width:r?0:void 0,flex:r?"none":1,opacity:r?0:1,transition:"opacity var(--layout)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:4,minWidth:0},children:[t.pinned?c.jsx(ae,{name:"pin.fill",size:10,color:"var(--tertiary)"}):null,c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}),l?c.jsx(ae,{name:"cursorarrow.motionlines",size:10,color:"var(--accent)",title:"Using the computer"}):null]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[c.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:c.jsx(v8,{bot:t,store:n})}),t.unread>0?c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:999,padding:"0 6px",minWidth:18,height:18,display:"grid",placeItems:"center",flex:"none"},children:t.unread}):null]})]})]})}),B_=e=>{const t=e.indexOf(`
-`);return t<0?e:`${e.slice(0,t)}…`},oh={...B("compactSecondary"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0};function v8({bot:e,store:t}){return ln(e)?c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--warning)",minWidth:0},children:[c.jsx(on,{state:"listening",size:16,color:"var(--warning)"}),c.jsx("span",{style:oh,children:e.activity||"Needs your approval"})]}):Jn(e)?c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--secondary)",minWidth:0},children:[c.jsx(on,{size:13,color:"var(--secondary)"}),c.jsx("span",{style:oh,children:e.activity||"Working…"})]}):e.status==="error"?c.jsx("span",{style:{...oh,color:"var(--danger)"},children:B_(e.lastMessage??"Something went wrong")}):c.jsx("span",{style:{...oh,color:"var(--secondary)"},children:B_(e.lastMessage??`${t.backendName(e.backend)} · ${bo(e)}`)})}function iS(e,t){const n=new Set(t.split(",").filter(Boolean)),r=e.filter(d=>!n.has(d)),l=r.length?r:e,h=d=>[...d].sort().join(",");return{shown:l,toggling(d){if(!e.includes(d))return h(new Set(e.filter(g=>!l.includes(g))));const p=new Set(l);return p.has(d)?p.size>1&&p.delete(d):p.add(d),h(new Set(e.filter(g=>!p.has(g))))},only(d){return e.includes(d)?h(new Set(e.filter(p=>p!==d))):""}}}function _8(e){if(!e.length)return"Computers";const t=e.filter(n=>n.kind==="online").length;return t===e.length?`${t} connected`:t>0?`${t}/${e.length} connected`:e.some(n=>n.kind==="connecting")?"Connecting…":e.every(n=>n.kind==="unauthorized")?"No access":e.every(n=>n.kind==="unpaired")?"Not paired":`${e.length} offline`}function O_({hidden:e,setHidden:t,manage:n,compact:r=!1}){const l=ns(),h=iS(l.computers.map(v=>v.id),e),d=h.shown.map(v=>l.store(v)).filter(v=>!!v),p=_8(d.map(v=>v.shownConnection)),g=v=>{const _=l.store(v.id);return _?`${_.hostName} · ${_.connectionLabel}`:v.name},m=()=>{const v=[{title:"All computers",selected:h.shown.length===l.computers.length,action:()=>t("")}];for(const _ of l.computers)v.push({title:g(_),selected:h.shown.includes(_.id),action:()=>t(h.toggling(_.id))});return l.computers.length>1&&l.computers.forEach((_,S)=>v.push({title:`Only ${_.name}`,divider:S===0,action:()=>t(h.only(_.id))})),d.length&&v.push({title:"Reconnect",icon:"arrow.clockwise",divider:!0,action:()=>d.forEach(_=>_.restartStream())}),v.push({title:"Manage computers",icon:"desktopcomputer",action:n}),v};return c.jsxs(Yh,{items:m,title:p,style:{display:"flex",alignItems:"center",gap:4,padding:"6px 0",...B(12,"medium"),color:"var(--secondary)"},children:[r?c.jsx(ae,{name:"desktopcomputer",size:12,weight:"medium"}):c.jsx("span",{style:{whiteSpace:"nowrap"},"aria-label":`Computers, ${p}. Filter conversations`,children:p}),c.jsx(ae,{name:"chevron.down",size:8,weight:"semibold"})]})}const z_={title(e,t){return e.kind==="updateApp"?"Update this app":`Update Codync on ${t}`},detail(e,t,n,r,l=!0){if(e.kind==="updateApp")return`${n?`${t} runs Codync ${n} and`:t} needs this app to be ${e.minimum} or newer. Your chats are safe on the computer.`;const h=r==="macos"?"Open Codync on that Mac and choose Check for Updates.":r==="linux"?"Run codync-host update there.":"Update Codync on that computer.",d=`${t} runs Codync ${e.version}; this app needs ${e.minimum} or newer.`;return l?`${d} ${h}`:d}};function J2(){const e=ns(),t=Ne(),n=t.mismatch;if(!n)return null;const r=n.kind==="updateApp"?["Update Codync",()=>window.codync.updates.check()]:t===e.local&&!e.host.dev&&window.codync.platform==="darwin"?[`Update ${t.hostName}`,()=>window.codync.host.restart()]:null;return c.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12,padding:14,background:"var(--surface)",borderRadius:16},children:[c.jsx(ae,{name:"arrow.down.circle",size:15,color:"var(--warning)"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[c.jsx("div",{style:{...B("subheadline","semibold"),color:"var(--text)"},children:z_.title(n,t.hostName)}),c.jsx("div",{style:{...B("footnote"),color:"var(--secondary)"},children:z_.detail(n,t.hostName,t.hostVersion?.version,t.hello?.os,r===null)}),r?c.jsx(Fe,{onClick:r[1],style:{marginTop:4,alignSelf:"flex-start"},children:r[0]}):null]})]})}function Vf(e){const t=[];let n=null,r=null;for(const l of e){if(!_o(l))continue;const h=l.kind==="user"&&l.data.clientNonce?`user-${l.data.clientNonce}`:l.id;(n===null||l.createdAt-n>36e5)&&(t.push({id:`sep-${h}`,kind:"separator",date:l.createdAt}),r=null);const d=l.kind==="user"?"user":l.kind==="agent"?`agent:${l.data.author??""}`:l.kind;t.push({id:h,kind:"entry",entry:l,groupStart:d!==r}),r=d==="user"||l.kind==="agent"?d:null,n=l.createdAt}return t}function sS(e,t){const n=x.useRef(null),r=x.useRef(new Set);n.current===null&&(n.current=new Set(e));for(const l of e)n.current.has(l)||(n.current.add(l),t&&r.current.add(l));return r.current}function nS(e){return e.kind==="entry"&&e.entry.kind==="user"?"row-in mine":"row-in"}const V0=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}),$0=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),y8=new Intl.DateTimeFormat(void 0,{weekday:"long"}),ch=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),e1={time:e=>V0.format(new Date(e)),separator(e){const t=new Date(e),n=new Date,r=new Date(n.getTime()-864e5);return`${ch(t,n)?"Today":ch(t,r)?"Yesterday":$0.format(t)} ${V0.format(t)}`},day(e){const t=new Date(e),n=new Date;return ch(t,n)?V0.format(t):ch(t,new Date(n.getTime()-864e5))?"Yesterday":n.getTime()-e<6*864e5?y8.format(t):$0.format(t)},short(e){const t=Math.max(0,(Date.now()-e)/1e3);return t<60?"now":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:t<86400*7?`${Math.floor(t/86400)}d`:$0.format(new Date(e))}};function rS(e){const t=e.split(".").pop()?.toLowerCase()??"";return["png","jpg","jpeg","heic","gif","webp","tiff","bmp"].includes(t)?"photo":t==="pdf"?"doc.richtext":["zip","gz","tar","7z"].includes(t)?"doc.zipper":["mov","mp4","m4v"].includes(t)?"film":["mp3","m4a","wav","aac"].includes(t)?"waveform":"doc"}function S8(e){if(e<1e3)return`${e} bytes`;const t=["KB","MB","GB"];let n=e/1e3,r=0;for(;n>=1e3&&r<t.length-1;)n/=1e3,r++;return`${n<10?n.toFixed(1):Math.round(n)} ${t[r]}`}function x8({attachments:e,botId:t}){const[n,r]=x.useState(null);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},children:[e.map(l=>O3(l.name)?c.jsx("button",{"aria-label":l.name,onClick:()=>r(l),style:{borderRadius:16,overflow:"hidden",maxWidth:220,maxHeight:280,display:"flex"},children:c.jsx(H_,{file:l,botId:t,style:{maxWidth:220,maxHeight:280}})},l.id):c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:"var(--bubble-user)",borderRadius:16},children:[c.jsx(ae,{name:rS(l.name),size:16,color:"var(--secondary)"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:l.name}),c.jsx("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:S8(l.size)})]})]},l.id)),c.jsx($t,{open:n!==null,onClose:()=>r(null),width:720,height:560,children:n?c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:n.name}),c.jsx("div",{style:{flex:1,minHeight:0,padding:12,display:"grid",placeItems:"center"},children:c.jsx(H_,{file:n,botId:t,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})]}):null})]})}function H_({file:e,botId:t,style:n}){const r=Or(),[l,h]=x.useState(null);return x.useEffect(()=>{let d=!1,p=null;return r.attachmentData(e.id,t).then(g=>{!g||d||(p=URL.createObjectURL(new Blob([g])),h(p))}),()=>{d=!0,p&&URL.revokeObjectURL(p)}},[r,e.id,t]),l?c.jsx("img",{src:l,alt:"",style:{display:"block",...n}}):c.jsx("div",{style:{width:160,height:120,borderRadius:16,background:"var(--bubble-user)",display:"grid",placeItems:"center"},children:c.jsx(ae,{name:"photo",size:13,color:"var(--tertiary)"})})}const w8=e=>e.includes("-")&&[...e].every(t=>"|-: ".includes(t)),I_=e=>{let t=e;return t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(n=>n.trim())};function b8(e){const t=[];let n=[],r=[],l=null,h="";const d=()=>{n.length&&(t.push({kind:"paragraph",text:n.join(`
-`)}),n=[]),r.length&&(r.length>=2&&w8(r[1])?t.push({kind:"table",header:I_(r[0]),rows:r.slice(2).map(I_)}):t.push({kind:"paragraph",text:r.join(`
-`)}),r=[])};for(const p of e.split(`
-`)){const g=p.trim();if(g.startsWith("```")){l?(t.push({kind:"code",text:l.join(`
-`),language:h}),l=null):(d(),l=[],h=g.slice(3));continue}if(l){l.push(p);continue}if(g.startsWith("|")){n.length&&d(),r.push(g);continue}r.length&&d();const m=Math.min(Math.floor((/^[ \t]*/.exec(p)?.[0].length??0)/2),3),v=/^(#+) (.*)$/.exec(g),_=/^(\d+\.) (.*)$/.exec(g);g?g==="---"||g==="***"||g==="___"?(d(),t.push({kind:"rule"})):v?(d(),t.push({kind:"heading",text:v[2].trim(),level:v[1].length})):/^[-*+•] /.test(g)?(d(),t.push({kind:"bullet",text:g.slice(2),marker:m>0?"◦":"•",depth:m})):_?(d(),t.push({kind:"bullet",text:_[2],marker:_[1],depth:m})):g.startsWith(">")?(d(),t.push({kind:"quote",text:g.slice(1).trim()})):n.push(p):d()}return l&&t.push({kind:"code",text:l.join(`
-`),language:h}),d(),t}function Na(e,t="i"){const n=[];return e.split(/(`[^`\n]+`)/).forEach((r,l)=>{r.length>2&&r.startsWith("`")&&r.endsWith("`")?n.push(c.jsx("code",{style:{fontFamily:"var(--mono)",background:"rgba(var(--text-rgb), 0.08)"},children:r.slice(1,-1)},`${t}${l}`)):r&&n.push(...no(r,`${t}${l}-`))}),n}const C8=new RegExp("\\[([^\\]]+)\\]\\(([^)\\s]+)\\)|\\*\\*([^*]+)\\*\\*|__([^_]+)__|~~([^~]+)~~|\\*([^*\\n]+)\\*|(?<![\\w])_([^_\\n]+)_(?![\\w])");function no(e,t){const n=[];let r=e,l=0;for(;r;){const h=C8.exec(r);if(!h){n.push(r);break}h.index>0&&n.push(r.slice(0,h.index));const d=`${t}${l++}`;if(h[1]!==void 0){const p=h[2];n.push(c.jsx("a",{href:p,onClick:g=>{g.preventDefault(),window.codync.app.openExternal(p)},style:{color:"var(--accent)",textDecoration:"none",cursor:"pointer"},children:no(h[1],`${d}-`)},d))}else h[3]!==void 0||h[4]!==void 0?n.push(c.jsx("strong",{style:{fontWeight:600},children:no(h[3]??h[4],`${d}-`)},d)):h[5]!==void 0?n.push(c.jsx("s",{children:no(h[5],`${d}-`)},d)):n.push(c.jsx("em",{children:no(h[6]??h[7],`${d}-`)},d));r=r.slice(h.index+h[0].length)}return n}const k8=e=>e===1?15:e===2?13:11,$f="calc(1.2em + 4px * var(--md-scale))",aS={lineHeight:$f,margin:"calc(-2px * var(--md-scale)) 0"},W0={color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",...aS},E8=x.memo(function({block:t}){switch(t.kind){case"paragraph":return c.jsx("div",{style:{...W0,fontSize:"var(--conversation)"},children:Na(t.text)});case"heading":return c.jsx("div",{style:{...W0,fontSize:`calc(${k8(t.level)}px * var(--md-scale))`,fontWeight:t.level===2?600:700},children:Na(t.text)});case"bullet":return c.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,fontSize:"var(--conversation)",paddingLeft:t.depth*16,...aS},children:[c.jsx("span",{style:{color:"var(--secondary)",fontVariantNumeric:"tabular-nums",flex:"none"},children:t.marker}),c.jsx("span",{style:{color:"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",minWidth:0},children:Na(t.text)})]});case"rule":return c.jsx("div",{style:{height:1,background:"var(--border)",margin:"4px 0"}});case"table":{const n=Math.max(t.header.length,...t.rows.map(l=>l.length)),r=Array.from({length:n},(l,h)=>h);return c.jsx("div",{style:{overflowX:"auto"},children:c.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${n}, max-content)`,columnGap:16,rowGap:7,fontSize:"var(--conversation)",color:"var(--text)",padding:"2px 0",width:"max-content",lineHeight:$f},children:[r.map(l=>c.jsx("span",{style:{fontWeight:600},children:Na(t.header[l]??"",`h${l}`)},`h${l}`)),t.rows.map((l,h)=>[c.jsx("div",{style:{gridColumn:`1 / span ${n}`,height:1,background:"var(--border)"}},`l${h}`),...r.map(d=>c.jsx("span",{children:Na(l[d]??"",`${h}-${d}`)},`${h}-${d}`))])]})})}case"quote":return c.jsx("div",{style:{...W0,fontSize:"var(--conversation)",color:"var(--secondary)",paddingLeft:10,boxShadow:"inset 3px 0 0 var(--border)"},children:Na(t.text)});case"code":return c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflowX:"auto"},children:c.jsx("pre",{style:{margin:0,padding:10,fontFamily:"var(--mono)",fontSize:"calc(10px * var(--md-scale))",color:"var(--text)",width:"max-content",lineHeight:$f},children:t.text})})}},(e,t)=>JSON.stringify(e.block)===JSON.stringify(t.block)),lS=x.memo(function({text:t}){const n=b8(t);return c.jsx("div",{className:"markdown selectable",style:{display:"flex",flexDirection:"column",gap:10,minWidth:0},children:n.map((r,l)=>c.jsx(E8,{block:r},l))})}),M8=e=>{switch(e){case"execute":return"Wants to run a command";case"edit":case"delete":case"move":return"Wants to change files";case"fetch":return"Wants to access the web";case"read":case"search":return"Wants to read files";default:return"Wants to use a tool"}},U_={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function j8(e){switch(e.kind){case"allow_once":return"Allow once";case"allow_always":return"Always allow";case"reject_once":return"Deny";case"reject_always":return"Never";default:return e.name}}function T8({entry:e,hostName:t,answering:n,respond:r}){const[l,h]=x.useState(!1),d=e.data,p=d.status==="pending",g=!!d.command||!!d.detail||!!d.diffs?.length,m=[...d.options??[]].sort((_,S)=>(U_[_.kind]??9)-(U_[S.kind]??9)),v=d.cwd?` · ${d.cwd.split("/").filter(Boolean).pop()??d.cwd}`:"";return c.jsx("div",{style:{paddingRight:40},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:16,background:"var(--bubble-agent)",borderRadius:22},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{...B("headline"),color:"var(--text)"},children:M8(d.toolKind)}),p?c.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--warning)"}}):null]}),c.jsx("div",{className:"selectable",style:{...B("subheadline",void 0,"monospaced"),color:"var(--secondary)",overflowWrap:"anywhere",...l?{}:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"}},children:d.title??""}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...B("caption"),color:"var(--tertiary)"},children:[c.jsx(ae,{name:"desktopcomputer",size:10}),`Runs on ${t}${v}`]}),g?c.jsx(G2,{expanded:l,onToggle:()=>h(_=>!_),label:c.jsx("span",{style:{...B("caption","medium"),color:"var(--secondary)"},children:"Details"}),children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,paddingTop:6},children:[d.command?c.jsx(Wf,{text:d.command}):null,d.detail?c.jsx(Wf,{text:d.detail.slice(0,2e3)}):null,(d.diffs??[]).map((_,S)=>c.jsx(oS,{diff:_},S))]})}):null,p?c.jsx("div",{style:{background:"var(--background)",borderRadius:14,marginTop:4},children:m.map((_,S)=>c.jsxs("div",{children:[S>0?c.jsx("div",{style:{height:.5,background:"var(--border)"}}):null,c.jsxs("button",{disabled:n!==null,onClick:()=>r(_.optionId),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:46,padding:"0 14px",opacity:n===null||n===_.optionId?1:.4},children:[c.jsx("span",{style:{...B("body",_.kind==="allow_once"?"semibold":"regular"),color:_.kind.startsWith("allow")?"var(--text)":"var(--danger)",flex:1},children:j8(_)}),n===_.optionId?c.jsx(et,{size:14}):null]})]},_.optionId))}):c.jsx("div",{style:{...B("caption","medium"),color:"var(--secondary)"},children:D8(e)})]})})}function D8(e){const t=e.data;switch(t.status){case"answered":{const n=t.options?.find(r=>r.optionId===t.selected);switch(n?.kind){case"allow_once":return"Allowed once";case"allow_always":return"Always allowed";case"reject_once":return"Denied";case"reject_always":return"Never allowed";default:return n?.name??"Answered"}}case"cancelled":return"Cancelled";default:return"Expired — the agent moved on"}}function Wf({text:e}){return c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:240},children:c.jsx("pre",{className:"selectable",style:{margin:0,padding:8,fontFamily:"var(--mono)",fontSize:Fh(10),color:"var(--text)",width:"max-content"},children:e})})}function oS({diff:e}){const t=e.patch.split(`
-`).slice(0,80);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,...B("caption",void 0,"monospaced"),color:"var(--secondary)"},children:[c.jsx(ae,{name:e.isNew?"doc.badge.plus":"doc.text",size:10}),c.jsx("span",{style:{flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.path.split("/").pop()}),c.jsxs("span",{style:{color:"var(--added)"},children:["+",e.added]}),c.jsxs("span",{style:{color:"var(--removed)"},children:["−",e.removed]})]}),c.jsx("div",{style:{background:"var(--code-background)",borderRadius:8,overflow:"auto",maxHeight:260},children:c.jsx("div",{style:{padding:8,fontFamily:"var(--mono)",fontSize:Fh(10),width:"max-content"},children:t.map((n,r)=>c.jsx("div",{style:{whiteSpace:"pre",color:n.startsWith("+")?"var(--added)":n.startsWith("-")?"var(--removed)":"var(--secondary)"},children:n||" "},r))})})]})}const qa=e=>e.auth==="signedOut",R8=e=>e.connection?.status==="active",at=e=>e*1e3,Ae={connectors:async e=>(await e.call("connectors")).items,marketConnectors:async(e,t,n=null)=>{const r=await e.call("marketConnectors",{search:t,cursor:n??""},at(60));return{items:r.items,next:r.nextCursor||null}},installConnector:async(e,t,n,r)=>(await e.call("installConnector",{registryName:t,option:n,inputs:r},at(45))).connector,addConnector:async(e,t)=>(await e.call("installConnector",t,at(45))).connector,importConnectors:async(e,t)=>(await e.call("importConnectors",{config:t},at(60))).items,connectorSignIn:(e,t)=>e.call("connectorSignIn",{id:t},at(60)),finishConnectorSignIn:async(e,t,n,r)=>(await e.call("connectorSignInFinish",{state:t,code:n,error:r},at(60))).connector,removeConnector:(e,t)=>e.call("removeConnector",{id:t}),composioStatus:e=>e.call("composioStatus"),setComposioKey:(e,t)=>e.call("setComposioKey",{key:t},at(60)),composioApps:async(e,t)=>(await e.call("composioToolkits",{search:t},at(60))).items,composioConnect:(e,t)=>e.call("composioConnect",{toolkit:t},at(60)),composioConnectFields:(e,t,n,r)=>e.call("composioConnectFields",{toolkit:t,mode:n,fields:r},at(60)),composioConnection:(e,t)=>e.call("composioConnection",{id:t},at(30)),skills:async e=>(await e.call("skills")).items,marketSkills:async e=>(await e.call("marketSkills",{},at(60))).items,installSkill:(e,t)=>e.call("installSkill",{source:t},at(60)),addSkill:(e,t,n,r)=>e.call("installSkill",{name:t,description:n,instructions:r}),removeSkill:(e,t)=>e.call("removeSkill",{id:t}),connectorInfo:(e,t)=>e.call("connectorInfo",{registryName:t},at(60)),verifyConnector:(e,t)=>e.call("connectorVerify",{id:t},at(120)),finishConnectionRequest:(e,t,n={})=>e.call("connectorRequestFinish",{entryId:t,connectorId:n.connectorId??null,value:n.value??null,username:n.username??null,cancel:n.cancel??!1},at(120)),logins:async e=>(await e.call("credentialLogins",{},at(60))).items,saveLogin:(e,t,n,r)=>e.call("credentialSaveLogin",{site:t,username:n,password:r},at(60)),removeLogin:(e,t)=>e.call("credentialRemoveLogin",{id:t},at(60)),credentialStatus:e=>e.call("credentialStatus",{},at(60)),setOnePasswordToken:(e,t)=>e.call("credentialSetOnePassword",{token:t},at(60)),updateConnectorCredentials:(e,t,n)=>e.call("credentialUpdateConnector",{id:t,fields:n},at(120)),agentSetup:async(e,t,n,r,l,h)=>(await e.call("agentSetup",{backend:t,step:n,method:r,cols:l,rows:h},at(300))).term,agentAuth:(e,t)=>e.call("agentAuth",{backend:t},at(300)),agentAuthenticate:(e,t,n)=>e.call("agentAuthenticate",{backend:t,method:n},at(660)),setAgentEnv:(e,t,n)=>e.call("setAgentEnv",{backend:t,vars:n},at(300)),termInput:(e,t,n)=>e.call("termInput",{term:t,data:n}),termResize:(e,t,n,r)=>e.call("termResize",{term:t,cols:n,rows:r}),termClose:(e,t)=>e.call("termClose",{term:t})},Lh=()=>({items:[],visibleCount:12});function cS(e,t,n){const r=new Set(e.items.map(n));return{...e,items:[...e.items,...t.filter(l=>!r.has(n(l))&&(r.add(n(l)),!0))]}}const hS=(e,t)=>cS(Lh(),e,t),Ff=e=>({...e,visibleCount:Math.min(e.items.length,e.visibleCount+12)}),uS=e=>e.items.slice(0,e.visibleCount),Kf=e=>e.items.length>e.visibleCount,lt=e=>e instanceof Error?e.message:String(e),dS=e=>new Promise(t=>setTimeout(t,e));function ro({title:e,children:t}){return c.jsxs("section",{className:"market-section",children:[c.jsx("div",{style:{...B("headline"),color:"var(--text)",paddingLeft:4},children:e}),t]})}function uo({children:e}){return c.jsx("div",{className:"item-grid",children:e})}const Yf={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Gf=e=>({display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical",overflow:"hidden"});function Ha({title:e,subtitle:t,added:n,busy:r=!1,addLabel:l="Add",icon:h,onAdd:d}){return c.jsxs("div",{className:"market-row",children:[c.jsx("div",{style:{width:46,height:46,flex:"none",display:"grid"},children:h}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)",...Yf},title:e,children:e}),c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Yf},title:t,children:t})]}),r?c.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none"},children:c.jsx(on,{size:18,color:"var(--secondary)"})}):n?c.jsx("span",{style:{width:60,display:"flex",justifyContent:"center",flex:"none",color:"var(--secondary)"},"aria-label":"Added",title:"Added",children:c.jsx(ae,{name:"checkmark",size:11,weight:"semibold"})}):c.jsx("button",{className:"capsule-action",style:B("subheadline","semibold"),onClick:d,children:l})]})}function Zf(){return c.jsx("div",{className:"item-grid skeleton",children:[0,1,2,3].map(e=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"10px 12px"},children:[c.jsx("div",{style:{width:46,height:46,borderRadius:12,background:"var(--bubble-agent)",flex:"none"}}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx("div",{style:{width:120,height:12,borderRadius:6,background:"var(--bubble-agent)"}}),c.jsx("div",{style:{width:190,height:10,borderRadius:5,background:"var(--bubble-agent)"}})]})]},e))})}function A8({src:e,style:t}){const[n,r]=x.useState(!1);return c.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>r(!0),style:{...t,display:n?"block":"none"}})}function N8(e,t,n){if(e&&URL.canParse(e)){const h=new URL(e).hostname;if(h&&h!=="github.com")return h}const r=n?.split("/")[0];if(!r)return null;const l=r.split(".").filter(Boolean);return l.length<2||l[0]==="io"&&l[1]==="github"?t.toLowerCase().includes("github")?"github.com":null:`${l[1]}.${l[0]}`}function Xf({website:e,name:t,registryName:n,size:r=46}){const l=N8(e,t,n),h=r*.26;return c.jsxs("div",{style:{position:"relative",width:r,height:r,borderRadius:h,overflow:"hidden",background:"var(--bubble-agent)",display:"grid",placeItems:"center",flex:"none"},children:[c.jsx("span",{style:{...B(r*.4,"semibold","rounded"),color:"var(--text)"},children:t.slice(0,1).toUpperCase()||"?"}),l?c.jsx(A8,{src:`https://www.google.com/s2/favicons?domain=${encodeURIComponent(l)}&sz=128`,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:r*.2,boxSizing:"border-box",background:"#fff"}}):null]})}function t1({url:e,name:t,size:n=46}){const[r,l]=x.useState(!1);return c.jsxs("div",{"aria-hidden":!0,style:{position:"relative",width:n,height:n,flex:"none",borderRadius:n*.28,background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:[r?null:c.jsx("span",{style:{...B(n*.4,"semibold"),color:"var(--secondary)"},children:t.slice(0,1).toUpperCase()}),e?c.jsx("img",{src:e,alt:"",draggable:!1,onLoad:()=>l(!0),style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",padding:n*.18,boxSizing:"border-box",display:r?"block":"none"}}):null]})}function Qf({name:e}){return c.jsx("div",{style:{width:"100%",height:"100%",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(ae,{name:e,size:18,weight:"medium"})})}function fS({size:e}){return c.jsx("div",{style:{width:e??"100%",height:e??"100%",flex:"none",borderRadius:12,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(ae,{name:"book.pages",size:13})})}function i1({title:e,url:t,style:n}){return c.jsx("button",{className:"plain-link",style:n,title:t,onClick:()=>window.codync.app.openExternal(t),children:e})}function s1({title:e,onBack:t,trailing:n}){return c.jsxs("div",{style:{position:"relative",height:44,padding:"0 12px",display:"flex",alignItems:"center",gap:6,flex:"none",background:"var(--background)"},children:[c.jsx("div",{style:{position:"absolute",left:60,right:60,textAlign:"center",...B("compactBody","semibold"),color:"var(--text)",...Yf},children:e}),c.jsx(ke,{title:"Back",icon:"chevron.left",onClick:t}),c.jsx("span",{style:{flex:1,minWidth:8}}),n]})}function pS({base:e,top:t}){const{mounted:n,shown:r}=er(t!==null),l=x.useRef(t);return t!==null&&(l.current=t),c.jsxs("div",{className:"market-stack",children:[c.jsx("div",{className:`market-layer ${r?"off-leading":""}`,inert:r,children:e}),n?c.jsx("div",{className:`market-layer ${r?"":"off-trailing"}`,children:t??l.current}):null]})}function Mt({value:e,onChange:t,placeholder:n,secret:r=!1,lines:l,mono:h=!1,label:d}){const p=h?B("callout","regular","monospaced"):{};return l?c.jsx("textarea",{className:"market-field","aria-label":d??n,value:e,placeholder:n,spellCheck:!1,onChange:g=>t(g.target.value),style:{...p,lineHeight:1.3,minHeight:`${l[0]*1.3}em`,maxHeight:`${l[1]*1.3}em`}}):c.jsx("input",{className:"market-field","aria-label":d??n,type:r?"password":"text",value:e,placeholder:n,spellCheck:!1,autoComplete:"off",onChange:g=>t(g.target.value),style:p})}function hn({text:e}){return c.jsx("span",{className:"selectable",style:{color:"var(--danger)"},children:e})}const n1=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""));function L8(){const[e,t]=x.useState(window.innerHeight);return x.useEffect(()=>{const n=()=>t(window.innerHeight);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Rs({open:e,onClose:t,width:n=520,height:r=600,children:l}){const h=L8();return c.jsx($t,{open:e,onClose:t,width:n,height:Math.min(r,h-76),children:l})}class B8 extends Br{constructor(t){super(),this.store=t}store;installedConnectors=[];installedSkills=[];async refresh(){const t=this.store.client;if(!t)return;const[n,r]=await Promise.allSettled([Ae.connectors(t),Ae.skills(t)]);n.status==="fulfilled"&&(this.installedConnectors=n.value),r.status==="fulfilled"&&(this.installedSkills=r.value),this.changed()}async after(t){const n=await t;return await this.refresh(),n}async installConnector(t,n,r){return this.after(Ae.installConnector(await this.store.ready(),t.name,n,r))}async addConnector(t){return this.after(Ae.addConnector(await this.store.ready(),t))}async importConnectors(t){return this.after(Ae.importConnectors(await this.store.ready(),t))}async finishConnectorSignIn(t,n,r){return this.after(Ae.finishConnectorSignIn(await this.store.ready(),t,n,r))}async waitForSignIn(t){for(let n=0;n<150;n++){await dS(2e3),await this.refresh();const r=this.installedConnectors.find(l=>l.id===t);if(r&&!qa(r))return}}async removeConnector(t){await this.after(Ae.removeConnector(await this.store.ready(),t))}async installSkill(t){await this.after(Ae.installSkill(await this.store.ready(),t))}async addSkill(t,n,r){await this.after(Ae.addSkill(await this.store.ready(),t,n,r))}async removeSkill(t){await this.after(Ae.removeSkill(await this.store.ready(),t))}async signIn(t){const n=await Ae.connectorSignIn(await this.store.ready(),t);if(!URL.canParse(n.url))return;if(n.callback!=="app"){window.codync.app.openExternal(n.url),await this.waitForSignIn(t);return}let r;try{r=await window.codync.app.authenticate(n.url,"codync")}catch{return}const l=new URL(r).searchParams;await this.finishConnectorSignIn(l.get("state")??"",l.get("code"),l.get("error_description")??l.get("error"))}}const P_=new WeakMap;function r1(e){let t=P_.get(e);return t||P_.set(e,t=new B8(e)),t}const Ga=e=>cn(r1(e));function O8({query:e,searchToken:t}){const n=Ne(),[r,l]=x.useState(null),[h,d]=x.useState(Lh),[p,g]=x.useState(!0),[m,v]=x.useState(null),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(0),E=x.useRef(e);E.current=e;const j=async()=>{const A=n.client;if(!A)return;const z=++k.current,F=E.current;g(!0);try{const R=await Ae.composioStatus(A),I=R.configured?await Ae.composioApps(A,F):[];if(k.current!==z)return;l(R),d(hS(I,q=>q.slug)),v(null)}catch(R){k.current===z&&v(lt(R))}finally{k.current===z&&g(!1)}};x.useEffect(()=>(j(),()=>{k.current++}),[t]);const V=r?.configured===!0;return c.jsxs(ro,{title:"Apps",children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[V?p?c.jsx(Zf,{}):h.items.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:e?`No apps match “${e}”.`:"Couldn't load apps."}):c.jsx(uo,{children:uS(h).map(A=>c.jsx(Ha,{title:A.name,subtitle:A.description??A.slug,added:R8(A),addLabel:"Connect",icon:c.jsx(t1,{url:A.logo,name:A.name}),onAdd:()=>b(A)},A.slug))}):c.jsx(uo,{children:c.jsx(Ha,{title:"Composio",subtitle:"Gmail, Slack, GitHub, Notion and 1,000 more apps",added:!1,busy:r===null&&p,addLabel:"Set up",icon:c.jsx(Qf,{name:"square.grid.3x3"}),onAdd:()=>S(!0)})}),!p&&Kf(h)&&V?c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Fe,{kind:"secondary",onClick:()=>d(Ff),children:"Load more apps"})}):null,m?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:m}):null,V?c.jsxs("button",{style:{display:"flex",alignItems:"center",gap:4,alignSelf:"flex-start",...B("footnote"),color:"var(--tertiary)"},onClick:()=>S(!0),children:[c.jsx(ae,{name:"key",size:10}),"Composio settings"]}):null]}),c.jsx(Rs,{open:_,onClose:()=>S(!1),children:c.jsx(z8,{status:r,done:A=>{l(A),j()}})}),c.jsx(Rs,{open:w!==null,onClose:()=>b(null),children:w?c.jsx(gS,{app:w,done:()=>{j(),r1(n).refresh()}},w.slug):null})]})}function z8({status:e,done:t}){const n=Ne(),r=ss(),[l,h]=x.useState(""),[d,p]=x.useState(!1),[g,m]=x.useState(null),v=async S=>{const w=n.client;if(w){p(!0);try{t(await Ae.setComposioKey(w,S)),r()}catch(b){m(lt(b))}p(!1)}},_=e?.keyUrl??"https://platform.composio.dev";return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Composio",trailing:d?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:!l.trim(),onClick:()=>{v(l)}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{title:"Composio API key",footer:`Composio signs you in to apps like Gmail and Slack and runs their tools for your bots. The key stays on ${n.hostName}.`,children:[c.jsx(Mt,{label:"API key",value:l,onChange:h,secret:!0,placeholder:e?.configured?"Saved (paste to replace)":"ak_…"}),URL.canParse(_)?c.jsx(i1,{title:"Get a key from Composio",url:_,style:B("footnote")}):null]}),e?.configured?c.jsx(Ee,{footer:"Bots lose the apps you connected until you add a key again.",children:c.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{v("")},children:"Remove key"})}):null,g?c.jsx(Ee,{children:c.jsx(hn,{text:g})}):null]})]})}function gS({app:e,requestId:t,done:n}){const r=Ne(),l=ss(),[h,d]=x.useState(null),[p,g]=x.useState({}),[m,v]=x.useState(!1),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(!1),E=x.useRef(n);E.current=n;const j=()=>{g({}),k.current=!0,v(!0)};x.useEffect(()=>{let R=!1;return(async()=>{const I=r.client;if(I)try{const q=await Ae.composioConnect(I,e.slug);if(R||(d(q),q.status!=="redirect"||!q.connection))return;q.url&&URL.canParse(q.url)&&window.codync.app.openExternal(q.url);for(let U=0;U<300;U++){if(await dS(2e3),R)return;const Y=await Ae.composioConnection(I,q.connection).catch(()=>null);if(R)return;if(Y){if(Y.status==="active"){if(t)try{await Ae.finishConnectionRequest(I,t,{connectorId:`composio-${e.slug}`})}catch($){R||b(lt($));return}R||j();return}if(Y.status==="failed"||Y.status==="expired"){b(`Signing in to ${e.name} didn't work (${Y.status}). Close and try again.`);return}}}b("Timed out waiting for the sign-in.")}catch(q){R||b(lt(q))}})(),()=>{R=!0,k.current&&E.current()}},[r,e.slug,e.name,t]);const V=async()=>{const R=r.client,I=h?.mode;if(!(!R||!I)){S(!0);try{const q=await Ae.composioConnectFields(R,e.slug,I,n1(p));q.status==="active"?(t&&await Ae.finishConnectionRequest(R,t,{connectorId:`composio-${e.slug}`}),j()):b(`${e.name} says the connection is ${q.status}.`)}catch(q){b(lt(q))}S(!1)}},A=h?.status==="needsFields",z=m?c.jsx(ke,{title:"Done",icon:"checkmark",onClick:l}):A?_?c.jsx(et,{}):c.jsx(ke,{title:"Connect",icon:"checkmark",disabled:h?.fields?.some(R=>R.required&&!p[R.name])??!0,onClick:()=>{V()}}):null,F=R=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(et,{}),c.jsx("span",{style:{color:"var(--secondary)"},children:R})]});return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:`Connect ${e.name}`,trailing:z}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[c.jsx(t1,{url:e.logo,name:e.name,size:52}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[c.jsx("span",{style:B("title3","semibold"),children:e.name}),e.description?c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:e.description}):null]})]})}),m?c.jsx(Ee,{footer:`Turn ${e.name} on for a bot in the bot's settings, under Connectors.`,children:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--added)"},children:[c.jsx(ae,{name:"checkmark.circle.fill",size:12}),"Connected"]})}):A?c.jsx(Ee,{footer:`Sent to Composio, which keeps it for ${e.name}.`,children:(h?.fields??[]).map(R=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:R.label,value:p[R.name]??"",secret:R.secret,placeholder:R.label,onChange:I=>g(q=>({...q,[R.name]:I}))}),R.description?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:R.description+(R.required?"":" (optional)")}):null]},R.name))}):h?.status==="redirect"?c.jsxs(Ee,{footer:"Sign in on the page that opened. This updates by itself when you're done.",children:[h.url&&URL.canParse(h.url)?c.jsx("div",{children:c.jsxs(Fe,{kind:"secondary",onClick:()=>window.codync.app.openExternal(h.url),children:[c.jsx(ae,{name:"safari",size:11}),"Open the sign-in page"]})}):null,F("Waiting for you to finish signing in…")]}):w===null?c.jsx(Ee,{children:F("Asking Composio…")}):null,w?c.jsx(Ee,{children:c.jsx(hn,{text:w})}):null]})]})}const a1={display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"};function mS({item:e,requestId:t,done:n}){const r=Ne(),l=Ga(r),h=ss(),[d,p]=x.useState(e.options[0]?.id??""),[g,m]=x.useState({}),[v,_]=x.useState(null),[S,w]=x.useState(!1),[b,k]=x.useState(null),E=x.useRef(!1),j=e.options.find(F=>F.id===d)??e.options[0],V=F=>g[F.name]??"",A=async()=>{if(j){w(!0),k(null);try{const F=await r.ready();let R;v?R=(await Ae.connectors(F)).find(I=>I.id===v.id)??v:(R=await l.installConnector(e,j.id,g),_(R),m({})),qa(R)&&await l.signIn(R.id),t?await Ae.finishConnectionRequest(F,t,{connectorId:R.id}):await Ae.verifyConnector(F,R.id),await l.refresh(),n(),h()}catch(F){k(lt(F))}w(!1)}};x.useEffect(()=>{E.current||(E.current=!0,e.options.length===1&&e.options[0].inputs.length===0&&A())},[]);const z=!j||j.inputs.some(F=>F.required&&!(g[F.name]??F.default??""));return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"Add connector",trailing:S?c.jsx(et,{}):c.jsx(ke,{title:"Add",icon:"plus",disabled:v===null&&z,onClick:()=>{A()}})}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 0"},children:[c.jsx("span",{style:B("title3","semibold"),children:e.title}),e.description?c.jsx("span",{style:{color:"var(--secondary)"},children:e.description}):null,e.website&&URL.canParse(e.website)?c.jsx(i1,{title:e.website,url:e.website,style:{...B("footnote"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}):null]})}),e.options.length>1?c.jsx(Ee,{title:"Runs",children:c.jsx(VC,{selection:d,onChange:p,options:e.options.map(F=>({id:F.id,label:F.kind==="remote"?`Hosted by ${e.title}`:`On ${r.hostName} (${F.kind})`}))})}):null,j?c.jsxs(Ee,{title:"Setup",footer:`Keys are saved on ${r.hostName} only.`,children:[j.inputs.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:j.kind==="remote"?`No keys needed here. If ${e.title} wants you to sign in, its sign-in page opens next.`:"No setup needed."}):null,j.inputs.map(F=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:F.name,value:V(F),secret:F.secret,placeholder:F.secret?F.name:F.default??F.placeholder??F.name,onChange:R=>m(I=>({...I,[F.name]:R}))}),F.description?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:F.description+(F.required?"":" (optional)")}):null]},F.name))]}):null,b?c.jsx(Ee,{children:c.jsx(hn,{text:b})}):null]})]})}function H8(){const e=Ne(),t=Ga(e),n=ss(),[r,l]=x.useState(""),[h,d]=x.useState("command"),[p,g]=x.useState(""),[m,v]=x.useState(""),[_,S]=x.useState(""),[w,b]=x.useState(!1),[k,E]=x.useState(null),j=h==="config"?_.trim()!=="":r.trim()!==""&&p.trim()!=="",V={command:`Runs on ${e.hostName} in the bot's project folder. Quotes work like in a shell.`,url:"A remote MCP server, streamable HTTP or SSE.",config:`Paste the MCP config from a README or another app (Claude, Cursor, VS Code). Every server in it is added. Saved on ${e.hostName} only.`}[h],A=async()=>{b(!0),E(null);const z=h==="url",F={};for(const R of m.split(`
-`)){const I=R.indexOf(z?":":"=");if(I<0)continue;const q=R.slice(0,I).trim();q&&(F[q]=R.slice(I+1).trim())}try{const R=h==="config"?await t.importConnectors(_):[await t.addConnector({name:r,command:z?null:p,url:z?p:null,env:z?{}:F,headers:z?F:{}})];for(const I of R)qa(I)&&await t.signIn(I.id);n()}catch(R){E(lt(R))}b(!1)};return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"Custom connector",trailing:w?c.jsx(et,{}):c.jsx(ke,{title:"Add",icon:"plus",disabled:!j,onClick:()=>{A()}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{footer:V,children:[c.jsx(qC,{selection:h,onChange:d,options:[{id:"command",label:"Command"},{id:"url",label:"URL"},{id:"config",label:"Config"}]}),h==="config"?c.jsx(Mt,{value:_,onChange:S,placeholder:'{ "mcpServers": { … } }',lines:[6,16],mono:!0}):null,h!=="config"?c.jsx(Mt,{value:r,onChange:l,placeholder:"Name"}):null,h!=="config"?c.jsx(Mt,{value:p,onChange:g,placeholder:h==="url"?"https://example.com/mcp":"npx -y @scope/server",mono:!0}):null]}),h==="url"?c.jsx(Ee,{title:"Headers",footer:`Optional, one Name: value per line. Leave empty if the service has you sign in. Saved on ${e.hostName} only.`,children:c.jsx(Mt,{value:m,onChange:v,placeholder:"Authorization: Bearer …",lines:[2,6],mono:!0})}):h==="command"?c.jsx(Ee,{title:"Environment",footer:`One KEY=value per line. Saved on ${e.hostName} only.`,children:c.jsx(Mt,{value:m,onChange:v,placeholder:"API_KEY=…",lines:[2,6],mono:!0})}):null,k?c.jsx(Ee,{children:c.jsx(hn,{text:k})}):null]})]})}function I8(){const e=Ne(),t=Ga(e),n=ss(),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(null),w=async()=>{v(!0);try{await t.addSkill(r,h,p),n()}catch(b){S(lt(b))}v(!1)};return c.jsxs("div",{style:a1,children:[c.jsx(Lt,{title:"New skill",trailing:m?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:!r.trim()||!p.trim(),onClick:()=>{w()}})}),c.jsxs(hi,{children:[c.jsxs(Ee,{footer:"The bot sees the name and when to use it, and reads the instructions only when a task fits.",children:[c.jsx(Mt,{value:r,onChange:l,placeholder:"Name"}),c.jsx(Mt,{value:h,onChange:d,placeholder:"When to use it",lines:[2,4]})]}),c.jsx(Ee,{title:"Instructions",children:c.jsx(Mt,{value:p,onChange:g,placeholder:"Step by step, in plain words…",lines:[6,20]})}),_?c.jsx(Ee,{children:c.jsx(hn,{text:_})}):null]})]})}const fo={...B("caption"),color:"var(--secondary)"};function U8({entry:e}){const t=Ne(),n=e.data.connectionRequest,[r,l]=x.useState(null),[h,d]=x.useState(null),[p,g]=x.useState(""),[m,v]=x.useState(""),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=n.kind==="login",E=n.kind==="secret",j=async()=>{const A=t.client;if(A){S(!0),b(null);try{if(n.kind==="app"&&n.toolkit)l({slug:n.toolkit,name:n.title});else if(k)await Ae.finishConnectionRequest(A,e.id,{value:p,username:m}),g("");else if(E)await Ae.finishConnectionRequest(A,e.id,{value:p}),g("");else if(n.connectorId){const z=n.connectorId,F=(await Ae.connectors(A)).find(R=>R.id===z);F&&qa(F)&&await r1(t).signIn(z),await Ae.finishConnectionRequest(A,e.id,{connectorId:z})}else n.registryName&&d(await Ae.connectorInfo(A,n.registryName))}catch(z){b(lt(z))}S(!1)}},V=async()=>{const A=t.client;if(A){S(!0);try{await Ae.finishConnectionRequest(A,e.id,{cancel:!0}),g("")}catch(z){b(lt(z))}S(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16,background:"var(--surface)",borderRadius:18},children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B("headline")},children:[c.jsx(ae,{name:"lock.shield",size:13}),n.title]}),e.data.text?c.jsx("span",{style:{color:"var(--secondary)"},children:e.data.text}):null,n.status==="pending"?c.jsxs(c.Fragment,{children:[k?c.jsxs(c.Fragment,{children:[c.jsx(Mt,{value:m,onChange:v,placeholder:"Username or email"}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Password or op:// reference",secret:!0}),c.jsx("span",{style:fo,children:"Saved securely on this computer. The bot types it into the sign-in page but never sees it."})]}):E?c.jsxs(c.Fragment,{children:[c.jsx("span",{style:fo,children:`${n.field??"Credential"} · ${n.location??""}`}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Credential or op:// reference",secret:!0}),c.jsx("span",{style:fo,children:"Saved securely on this computer. Never added to the conversation."})]}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(Fe,{disabled:_||(E||k)&&!p,onClick:()=>{j()},children:k?"Save login":E?"Save and connect":"Connect"}),c.jsx(Fe,{kind:"secondary",disabled:_,onClick:()=>{V()},children:"Cancel"}),_?c.jsx(et,{}):null]})]}):c.jsx("span",{style:{color:"var(--secondary)"},children:n.status==="ready"?k?"Saved":"Connected":"Cancelled"}),w?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:w}):null,c.jsx(Rs,{open:h!==null,onClose:()=>d(null),children:h?c.jsx(mS,{item:h,requestId:e.id,done:()=>d(null)}):null}),c.jsx(Rs,{open:r!==null,onClose:()=>l(null),children:r?c.jsx(gS,{app:r,requestId:e.id,done:()=>l(null)}):null})]})}function P8(){const e=Ne(),t=Ga(e),[n,r]=x.useState(null),[l,h]=x.useState(""),[d,p]=x.useState(null),[g,m]=x.useState(!1),[v,_]=x.useState(null);x.useEffect(()=>{(async()=>{await t.refresh();const w=e.client;if(w)try{p(await Ae.credentialStatus(w))}catch(b){_(lt(b))}})()},[t,e]);const S=async w=>{const b=e.client;if(b){m(!0),_(null);try{p(await Ae.setOnePasswordToken(b,w)),h("")}catch(k){_(lt(k))}m(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Credentials"}),c.jsxs(hi,{children:[c.jsxs(Ee,{title:"Storage",children:[c.jsx("span",{children:d?.provider??"System credential store"}),c.jsx("span",{style:{color:"var(--secondary)"},children:"Credentials are encrypted on the connected computer. Linux uses Secret Service; macOS uses Keychain."})]}),c.jsxs(Ee,{title:"Saved connections",children:[t.installedConnectors.filter(w=>w.keys.length>0).map(w=>c.jsxs("button",{className:"plain-row-button",onClick:()=>r(w),children:[c.jsx("span",{style:{flex:1},children:w.name}),c.jsx(ae,{name:"chevron.right",size:10})]},w.id)),c.jsx("span",{style:fo,children:"Values stay hidden. Select a connection to replace its credentials."})]}),c.jsx(q8,{}),c.jsxs(Ee,{title:"1Password",footer:"Use a service account with read access only to a dedicated shared vault. The 1Password CLI must be installed on the computer.",children:[c.jsx("span",{children:d?.onePasswordConnected?"Connected":"Connect a shared vault"}),c.jsx(Mt,{value:l,onChange:h,placeholder:"Service account token",secret:!0}),c.jsx("div",{children:c.jsx(Fe,{disabled:g||!l,onClick:()=>{S(l)},children:"Connect"})}),d?.onePasswordConnected?c.jsx("div",{children:c.jsx(Fe,{kind:"secondary",disabled:g,onClick:()=>{S("")},children:"Disconnect"})}):null,c.jsx("span",{style:{...B("footnote"),color:"var(--secondary)"},children:"Use op://vault/item/field in a connector's credential field. Codync retrieves the value when the connector runs."})]}),g?c.jsx(et,{}):null,v?c.jsx(hn,{text:v}):null]}),c.jsx(Rs,{open:n!==null,onClose:()=>r(null),children:n?c.jsx(V8,{connector:n},n.id):null})]})}function q8(){const e=Ne(),[t,n]=x.useState([]),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(null),w=async()=>{const E=e.client;try{n(E?await Ae.logins(E):[])}catch(j){S(lt(j))}};x.useEffect(()=>{w()},[]);const b=async()=>{const E=e.client;if(E){v(!0),S(null);try{await Ae.saveLogin(E,r,h,p),l(""),d(""),g(""),await w()}catch(j){S(lt(j))}v(!1)}},k=async E=>{const j=e.client;if(j)try{await Ae.removeLogin(j,E.id),n(V=>V.filter(A=>A.id!==E.id))}catch(V){S(lt(V))}};return c.jsxs(Ee,{title:"Sign-ins",footer:"Bots type these into the matching website or app and never see the password. You can use an op:// reference.",children:[t.map(E=>c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{children:E.site}),E.username?c.jsx("span",{style:fo,children:E.username}):null]}),c.jsx(ke,{title:"Remove",icon:"trash",onClick:()=>{k(E)}})]},E.id)),c.jsx(Mt,{value:r,onChange:l,placeholder:"Website or app, e.g. github.com"}),c.jsx(Mt,{value:h,onChange:d,placeholder:"Username or email"}),c.jsx(Mt,{value:p,onChange:g,placeholder:"Password or op:// reference",secret:!0}),c.jsx("div",{children:c.jsx(Fe,{disabled:m||!r||!p,onClick:()=>{b()},children:"Save sign-in"})}),_?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:_}):null]})}function V8({connector:e}){const t=Ne(),n=ss(),[r,l]=x.useState({}),[h,d]=x.useState(!1),[p,g]=x.useState(null),m=async()=>{const v=t.client;if(v){d(!0),g(null);try{await Ae.updateConnectorCredentials(v,e.id,n1(r)),l({}),n()}catch(_){g(lt(_))}d(!1)}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:e.name,trailing:h?c.jsx(et,{}):c.jsx(ke,{title:"Save credentials",icon:"checkmark",disabled:Object.values(r).every(v=>!v),onClick:()=>{m()}})}),c.jsxs(hi,{children:[c.jsx(Ee,{footer:"Enter only the values you want to replace. You can use an op:// reference.",children:e.keys.map(v=>c.jsx(Mt,{label:v,value:r[v]??"",placeholder:v,secret:!0,onChange:_=>l(S=>({...S,[v]:_}))},v))}),p?c.jsx(hn,{text:p}):null]})]})}function Bh(e,t){return{emoji:r8,chosen:t.data.reactions??[],toggle:n=>e.react(t,n)}}const Jf=x.memo(function({entry:t,groupStart:n,chat:r,openTrace:l,openThread:h}){const d=h?()=>h(t):void 0,p=t.data.thread&&t.data.thread.count>0&&h?c.jsx(W8,{summary:t.data.thread,open:()=>h(t)}):null;switch(t.kind){case"user":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,paddingTop:n?12:4},children:[c.jsx(F8,{entry:t,botWorking:!!r&&Jn(r),reply:d}),c.jsx(V_,{entry:t}),p]});case"agent":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,paddingTop:n?12:4},children:[r&&At(r)&&n?c.jsx(q_,{botId:t.data.author}):null,c.jsx(Y8,{entry:t,openTrace:l,reply:d}),c.jsxs("div",{style:{paddingLeft:r&&At(r)?34:0,display:"flex",flexDirection:"column",gap:4},children:[c.jsx(V_,{entry:t}),p]})]});case"permission":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingTop:12},children:[r&&At(r)?c.jsx(q_,{botId:t.data.author}):null,c.jsx($8,{entry:t})]});default:return t.data.connectionRequest?c.jsx("div",{style:{paddingTop:12},children:c.jsx(U8,{entry:t})}):c.jsx("div",{style:{paddingTop:10},children:c.jsx(G8,{entry:t})})}});function $8({entry:e}){const t=Ne();return c.jsx(T8,{entry:e,hostName:t.hostName,answering:t.answering.get(e.id)??null,respond:n=>t.respond(e,n)})}function q_({botId:e}){const t=Or(),n=e?t.bots.get(e):void 0;return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n?c.jsx(Ui,{bot:n,size:26,animated:!1}):null,c.jsx("span",{style:{...B("subheadline","medium"),color:n?ko(n.avatarColor):"var(--secondary)"},children:t.authorName(e)})]})}function W8({summary:e,open:t}){const n=Or(),r=e.authors.map(h=>n.bots.get(h)).filter(h=>!!h).slice(0,3),l=e.unread??0;return c.jsxs("button",{className:"press thread-chip",onClick:t,title:"View thread","aria-label":`View thread, ${e.count} ${e.count===1?"reply":"replies"}${l>0?`, ${l} new`:""}`,children:[r.length?c.jsx("span",{style:{display:"flex"},children:r.map((h,d)=>c.jsx("span",{style:{marginLeft:d?-6:0},children:c.jsx(Ui,{bot:h,size:18,animated:!1})},h.id))}):null,c.jsx("span",{style:{...B("footnote","semibold"),color:"var(--accent)"},children:e.count===1?"1 reply":`${e.count} replies`}),l>0?c.jsxs("span",{style:{...B("footnote","semibold"),color:"var(--text)"},children:[l," new"]}):c.jsx("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:e1.day(e.lastAt)}),c.jsx(ae,{name:"chevron.right",size:10,color:"var(--tertiary)"})]})}function vS({className:e,items:t,reactions:n,children:r}){const l=PC();return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:e,onContextMenu:l.onContextMenu,children:r}),c.jsx(Pa,{open:l.open,onClose:l.close,point:l.point,items:t,reactions:n})]})}const _S=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function F8({entry:e,botWorking:t,reply:n}){const r=Or(),[l,h]=x.useState(!1),d=e.data.status,p=()=>e.data.text&&window.codync.app.copy(e.data.text);return c.jsx("div",{className:"message user",title:_S.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:c.jsxs("div",{className:"message-body",children:[e.data.attachments?.length?c.jsx(x8,{attachments:e.data.attachments,botId:e.botId}):null,e.data.text?c.jsx(vS,{className:"bubble user selectable",reactions:Bh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:p},...n?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:n}]:[]],children:e.data.text}):null,d&&d!=="sent"?c.jsx(K8,{entry:e,botWorking:t,hovering:l}):null,c.jsx(SS,{className:"leading",visible:l,reactions:Bh(r,e),reply:n,copy:p})]})})}function K8({entry:e,botWorking:t,hovering:n}){const r=Or(),l={...B("caption2"),color:"var(--tertiary)"};switch(e.data.status){case"sending":return c.jsx("span",{style:l,children:"Sending…"});case"queued":return c.jsx("span",{style:l,children:t?"Queued until this response finishes":"Queued"});case"failed":return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10,...B("caption2","semibold")},children:[c.jsx("span",{style:{color:"var(--danger)"},children:"Failed to send"}),c.jsx("button",{title:"Resend","aria-label":"Resend",style:{display:"flex"},onClick:()=>r.retry(e),children:c.jsx(ae,{name:"arrow.clockwise",size:10,weight:"semibold"})}),c.jsx("button",{title:"Delete","aria-label":"Delete",style:{display:"flex"},onClick:()=>r.discard(e),children:c.jsx(ae,{name:"trash",size:10,weight:"semibold"})})]});case"cancelled":return c.jsx("span",{style:l,children:"Not sent — stopped"});case"waiting":return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10,...B("caption2")},children:[c.jsx("span",{style:{color:"var(--tertiary)"},children:"Waiting for the computer to come online"}),c.jsx("button",{title:"Don't send","aria-label":"Don't send",style:{display:"flex"},onClick:()=>r.cancelQueued(e),children:c.jsx(ae,{name:"xmark.circle",size:10})})]});case"delivering":return c.jsx("span",{style:l,children:"Delivered to the computer"});default:return c.jsx("span",{style:{...B(10),color:"var(--tertiary)",opacity:n?1:0,transition:"opacity var(--hover)"},children:e1.time(e.createdAt)})}}function Y8({entry:e,openTrace:t,reply:n}){const r=Or(),[l,h]=x.useState(!1),d=()=>e.data.text&&window.codync.app.copy(e.data.text);return c.jsx("div",{className:"message agent",title:_S.format(e.createdAt),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:c.jsxs("div",{className:"message-body",children:[c.jsx(vS,{className:"bubble agent",reactions:Bh(r,e),items:()=>[{title:"Copy",icon:"square.on.square",action:d},...n?[{title:"Reply in thread",icon:"arrowshape.turn.up.left",action:n}]:[],{title:"Show what it did",icon:"list.bullet",action:t}],children:c.jsx(lS,{text:e.data.text??""})}),c.jsx(SS,{className:"trailing",visible:l,reactions:Bh(r,e),reply:n,trace:t,copy:d})]})})}function G8({entry:e}){const t=e.data.text??"";if(e.data.callSeconds!==void 0){const n=e.data.callSeconds;return c.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:6,...B("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--secondary)"},children:[c.jsx(ae,{name:"waveform",size:10}),`${t} · ${String(Math.floor(n/60)).padStart(2,"0")}:${String(n%60).padStart(2,"0")}`]})}switch(e.data.style){case"divider":return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 0"},children:[c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}}),c.jsx("span",{style:{...B("caption2"),color:"var(--tertiary)",textAlign:"center",maxWidth:260},children:t}),c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]});case"error":return c.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:12,borderRadius:12,background:"color-mix(in srgb, var(--danger) 12%, transparent)"},children:[c.jsx(ae,{name:"exclamationmark.triangle.fill",size:10,color:"var(--danger)"}),c.jsx("span",{className:"selectable",style:{...B("footnote"),color:"var(--text)"},children:t})]});default:return c.jsx("div",{style:{...B("footnote"),color:"var(--secondary)",textAlign:"center"},children:t})}}function yS({bot:e,thinking:t}){const[n,r]=x.useState(!1),l=ln(e);return c.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,paddingRight:40},children:c.jsxs("button",{className:"working",disabled:!t,onClick:()=>r(h=>!h),"aria-expanded":t?n:void 0,children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(on,{state:l?"listening":"working",size:16,color:l?"var(--warning)":"var(--secondary)"}),c.jsx("span",{style:{...B("subheadline"),color:l?"var(--warning)":"var(--secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.activity||"Working…"}),e.startedAt?c.jsx(Z8,{since:e.startedAt}):null,t?c.jsx("span",{style:{display:"flex",transform:`rotate(${n?180:0}deg)`,transition:"transform var(--layout)"},children:c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--tertiary)"})}):null]}),n&&t?c.jsx("div",{className:"selectable thinking",style:{...B("footnote"),color:"var(--secondary)"},ref:h=>{h&&(h.scrollTop=h.scrollHeight)},children:t}):null]})})}function Z8({since:e}){const[t,n]=x.useState(Date.now());x.useEffect(()=>{const p=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(p)},[]);const r=Math.max(0,Math.floor((t-e)/1e3)),l=Math.floor(r/3600),h=Math.floor(r%3600/60),d=String(r%60).padStart(2,"0");return c.jsx("span",{style:{...B("footnote"),fontVariantNumeric:"tabular-nums",color:"var(--tertiary)"},children:l?`${l}:${String(h).padStart(2,"0")}:${d}`:`${h}:${d}`})}function V_({entry:e}){const t=Or(),n=e.data.reactions;return n?.length?c.jsx("div",{style:{display:"flex",gap:4},children:n.map(r=>c.jsx("button",{className:"press reaction-chip",title:`Remove ${r}`,"aria-label":`Remove reaction ${r}`,onClick:()=>t.react(e,r),children:c.jsx("span",{style:{fontSize:Fh(13)},children:r})},r))}):null}function SS({visible:e,className:t,reactions:n,reply:r,trace:l,copy:h}){const[d,p]=x.useState(null),g=x.useRef(null),m=x.useRef(null),v=e||d!==null;return c.jsxs("div",{className:`message-actions ${t}`,style:{opacity:v?1:0,pointerEvents:v?"auto":"none"},"aria-hidden":!v,children:[c.jsx("button",{ref:g,className:"message-action",title:"Add reaction","aria-label":"Add reaction",onClick:()=>p("reactions"),children:c.jsx(ae,{name:"face.smiling",size:14})}),r?c.jsx(ke,{title:"Reply in thread",icon:"arrowshape.turn.up.left",size:26,onClick:r}):null,c.jsx("button",{ref:m,className:"message-action",title:"More message actions","aria-label":"More message actions",onClick:()=>p("more"),children:c.jsx(ae,{name:"ellipsis",size:14})}),c.jsx(Pa,{open:d==="reactions",onClose:()=>p(null),anchor:g,items:()=>[],reactions:n}),c.jsx(Pa,{open:d==="more",onClose:()=>p(null),anchor:m,items:()=>[{title:"Copy",icon:"square.on.square",action:h},...l?[{title:"Show what it did",icon:"list.bullet",action:l}]:[]]})]})}function X8(e){return e.key!=="Enter"||e.isComposing||e.keyCode===229?"ignore":e.shiftKey||e.altKey?"newline":e.repeat?"ignore":"send"}function Q8({file:e,remove:t}){const[n,r]=x.useState(null),[l,h]=x.useState(!1);return x.useEffect(()=>{if(!O3(e.name))return;const d=URL.createObjectURL(new Blob([e.data]));return r(d),()=>URL.revokeObjectURL(d)},[e]),n&&!l?c.jsxs("span",{className:"attachment-tile","aria-label":`Image attachment: ${e.name}`,title:e.name,children:[c.jsx("img",{src:n,alt:"",onError:()=>h(!0)}),c.jsx("button",{className:"press attachment-remove","aria-label":`Remove ${e.name}`,title:"Remove",onClick:t,children:c.jsx(ae,{name:"xmark",size:11,weight:"bold",color:"#fff"})})]}):c.jsxs("span",{className:"file-chip",children:[c.jsx(ae,{name:rS(e.name),size:10,color:"var(--secondary)"}),c.jsx("span",{style:{...B("footnote"),color:"var(--text)",maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),c.jsx("button",{"aria-label":`Remove ${e.name}`,title:"Remove",style:{display:"flex"},onClick:t,children:c.jsx(ae,{name:"xmark",size:10,weight:"bold",color:"var(--secondary)"})})]})}function xS({botId:e,thread:t=null,onCall:n,onInterrupt:r}){const l=Ne();return c.jsx(J8,{botId:e,thread:t,onCall:n,onInterrupt:r},JSON.stringify([l.contextId,l.computer.id,e,t]))}function J8({botId:e,thread:t,onCall:n,onInterrupt:r}){const l=Ne(),h=l.bots.get(e)??null,d=l.composerDrafts,p=x.useSyncExternalStore(d.subscribe,()=>d.get(e,t)),g=O=>d.set(e,t,O),[m,v]=x.useState([]),_=x.useRef(null),S=x.useRef(null),w=x.useRef(!1),b=!!h&&$2(h,e,t),E=!(!p.trim()&&!m.length)&&(l.connection.kind==="online"||l.canQueue&&!m.length),j=!!h&&!At(h),V=t?"Reply…":h&&At(h)?`Message ${h.name} · @ to ask one bot`:b?`Queue a message for ${h?.name??""}`:`Ask ${h?.name??""}`,A=l.routineDrafts.get(e);x.useEffect(()=>{if(t||A===void 0)return;const O=l.consumeRoutineDraft(e);if(O===void 0)return;const P=d.get(e,t);d.set(e,t,P?`${P}
-${O}`:O),_.current?.focus()},[A,t,e,l,d]),x.useLayoutEffect(()=>{const O=_.current,P=S.current;if(!O||!P)return;const te=()=>{const ce=getComputedStyle(O),re=parseFloat(ce.lineHeight),de=parseFloat(ce.paddingTop)+parseFloat(ce.paddingBottom),Ce=Math.min(P.getBoundingClientRect().height,re*8+de);O.style.height=`${Ce}px`};te();const Q=new ResizeObserver(te);return Q.observe(P),()=>Q.disconnect()},[]);const z=(()=>{if(!h||!At(h))return null;const O=p.lastIndexOf("@");if(O<0||O>0&&!/\s/.test(p[O-1]))return null;const P=p.slice(O+1);return/\n/.test(P)||P.length>24?null:P})(),F=z!==null&&h?l.members(h).filter(O=>!z||O.name.toLowerCase().includes(z.toLowerCase())):[],R=O=>{const P=p.lastIndexOf("@");P<0||(g(`${p.slice(0,P)}@${O.name} `),_.current?.focus())},I=O=>{if(!j)return;const P=[];for(const te of O){if(te.data.length>n8){l.setError(`${te.name} is larger than 100 MB.`);continue}P.push({id:crypto.randomUUID(),name:te.name,data:te.data})}v(te=>[...te,...P])},q=()=>{E&&(l.send(p,e,t,m),g(""),v([]),_.current?.focus())},U=r&&!p&&!m.length?"interrupt":b&&!p&&!m.length?"stop":n&&!p&&!m.length?"call":"send",[Y,$]={interrupt:["stop.fill","Interrupt"],stop:["stop.fill","Stop"],call:["waveform","Call"],send:["arrow.up","Send"]}[U],M=U==="interrupt"?"var(--danger)":U==="send"?E?"var(--accent-fill)":"var(--accent-dim)":"var(--accent-fill)",N=U==="interrupt"?"#fff":U==="send"?E?"var(--on-accent)":"var(--tertiary)":"var(--on-accent)",L=U!=="send"||E;return c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx($_,{open:F.length>0,children:c.jsx("div",{className:"mentions",children:F.map(O=>c.jsxs("button",{className:"press mention",onClick:()=>R(O),children:[c.jsx(Ui,{bot:O,size:18,animated:!1}),c.jsx("span",{style:{...B("subheadline"),color:"var(--text)"},children:O.name})]},O.id))})}),c.jsx("div",{className:"composer",onDragOver:O=>{j&&O.dataTransfer.types.includes("Files")&&O.preventDefault()},onDrop:O=>{j&&(O.preventDefault(),Promise.all([...O.dataTransfer.files].map(async P=>({name:P.name,data:new Uint8Array(await P.arrayBuffer())}))).then(I))},children:c.jsxs("div",{className:"composer-surface",children:[c.jsx($_,{open:m.length>0,children:c.jsx("div",{className:"file-chips",children:m.map(O=>c.jsx(Q8,{file:O,remove:()=>v(P=>P.filter(te=>te.id!==O.id))},O.id))})}),c.jsxs("div",{className:"composer-box",children:[j?c.jsx("button",{className:"press composer-add","aria-label":"Add files",title:"Add files",onClick:()=>{window.codync.app.pickFiles().then(I)},children:c.jsx(ae,{name:"plus",size:13,weight:"medium",color:"var(--text)"})}):null,c.jsxs("div",{className:"composer-field",children:[c.jsx("div",{ref:S,className:"composer-measure","aria-hidden":"true",children:p+"​"}),c.jsx("textarea",{ref:_,rows:1,value:p,placeholder:V,spellCheck:!0,"aria-label":t?"Reply":"Message","aria-keyshortcuts":"Enter Shift+Enter",onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onChange:O=>g(O.target.value),onKeyDown:O=>{const P=X8({key:O.key,shiftKey:O.shiftKey,altKey:O.altKey,repeat:O.repeat,isComposing:w.current||O.nativeEvent.isComposing,keyCode:O.keyCode});O.key==="Enter"&&O.repeat&&!O.shiftKey&&!O.altKey&&O.preventDefault(),P==="send"&&(O.preventDefault(),q())},onPaste:O=>{if(!j)return;const P=[...O.clipboardData.types];!P.includes("Files")||P.includes("text/plain")&&!O.clipboardData.files.length||(O.preventDefault(),window.codync.app.readClipboardFiles().then(Q=>Q.length?I(Q):Promise.all([...O.clipboardData.files].map(async ce=>({name:ce.name||`pasted-${Date.now()}.png`,data:new Uint8Array(await ce.arrayBuffer())}))).then(I)))}})]}),c.jsx("button",{className:"press composer-send",disabled:!L,"aria-label":$,title:$,style:{background:M,color:N},onClick:()=>{U==="interrupt"?r?.():U==="stop"?l.stop(e):U==="call"?n?.():q()},children:["stop.fill","waveform","arrow.up"].map(O=>c.jsx("span",{"aria-hidden":"true",className:`composer-symbol ${O===Y?"active":""}`,children:c.jsx(ae,{name:O,size:O==="stop.fill"?12:O==="waveform"?15:14,weight:"bold"})},O))})]})]})})]})}function $_({open:e,children:t}){const{mounted:n,shown:r}=er(e),l=x.useRef(t);return e&&(l.current=t),c.jsx("div",{className:`composer-reveal ${r?"shown":""}`,inert:!e,children:c.jsx("div",{children:n?e?t:l.current:null})})}function e7({open:e,width:t,children:n}){const{mounted:r,shown:l}=er(e,300,!1),h=x.useRef({width:t,children:n});e&&(h.current={width:t,children:n});const d=e?{width:t,children:n}:h.current;return c.jsx("div",{className:`side-panel ${l?"shown":""}`,inert:!e,style:{width:l?d.width+1:0},children:r?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"side-panel-border"}),c.jsx("div",{style:{width:d.width,height:"100%",flex:"none"},children:d.children})]}):null})}const t7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3ccircle%20cx='8'%20cy='8'%20r='7'%20stroke='currentColor'%20stroke-width='1.5'/%3e%3cpath%20d='M5.5%2010.5L8%204L10.5%2010.5'%20stroke='currentColor'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='6.25'%20y1='8.75'%20x2='9.75'%20y2='8.75'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'/%3e%3c/svg%3e",i7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.9197%2013.61L17.3816%2026.566L14.242%2027.4049L11.2645%2016.2643L0.119926%2013.2906L0.957817%2010.15L13.9197%2013.61Z'%20fill='currentColor'/%3e%3cpath%20d='M13.7391%2016.0892L4.88169%2024.9056L2.58872%2022.6019L11.4461%2013.7865L13.7391%2016.0892Z'%20fill='currentColor'/%3e%3cpath%20d='M18.9386%208.58315L22.4005%2021.5392L19.2609%2022.3781L16.2833%2011.2374L5.13879%208.26381L5.97668%205.12318L18.9386%208.58315Z'%20fill='currentColor'/%3e%3cpath%20d='M23.9803%203.55632L27.4422%2016.5124L24.3025%2017.3512L21.325%206.21062L10.1805%203.23698L11.0183%200.0963593L23.9803%203.55632Z'%20fill='currentColor'/%3e%3c/svg%3e",s7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.1452%2014.6818C14.9937%2015.3182%2016.2664%2014.894%2015.0997%2013.7273C11.5998%2010.3333%2012.3421%201%207.99366%201C3.64518%201%204.3876%2010.3333%200.887603%2013.7273C-0.385123%2015%200.993664%2015.3182%201.84215%2014.6818C5.13002%2012.4545%204.9179%208.5303%207.99366%208.5303C11.0694%208.5303%2010.8573%2012.4545%2014.1452%2014.6818Z'%20fill='currentColor'/%3e%3c/svg%3e",n7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M9.972%2013.193h2.577q.187%200%20.277-.09t.091-.294V10.47q0-.324.133-.59.135-.27.36-.424a1%201%200%200%201%20.099-.06%201%201%200%200%201-.1-.058%201.1%201.1%200%200%201-.359-.424%201.3%201.3%200%200%201-.133-.59v-2.33q0-.202-.091-.293t-.277-.089H9.972a.38.38%200%200%201-.294-.124.4.4%200%200%201-.108-.281q.002-.176.131-.293a.46.46%200%200%201%20.313-.111h2.775c.36%200%20.642.097.836.288q.293.29.294.832V8.24q0%20.39.152.562.148.168.555.178a.4.4%200%200%201%20.27.128.41.41%200%200%201%20.104.287.44.44%200%200%201-.1.282.34.34%200%200%201-.277.132c-.266.006-.452.066-.55.177q-.151.174-.152.573v2.318c0%20.235-.043.44-.128.607a.85.85%200%200%201-.389.387%201.3%201.3%200%200%201-.534.124V14h-2.854a.45.45%200%200%201-.315-.118.38.38%200%200%201-.129-.286q0-.164.109-.282a.38.38%200%200%201%20.293-.123zM1.103%209.108a.4.4%200%200%201%20.276-.128q.4-.008.55-.177.15-.173.151-.562V5.923q.002-.543.294-.832c.195-.191.477-.288.836-.288h2.775q.188%200%20.313.111a.37.37%200%200%201%20.131.293.4.4%200%200%201-.108.281.38.38%200%200%201-.293.123H3.45q-.186%200-.277.09t-.092.292v2.33c0%20.213-.044.413-.133.59a1.1%201.1%200%200%201-.359.424%201%201%200%200%201-.1.059%201%201%200%200%201%20.1.059q.225.156.359.423t.133.59v2.34q0%20.203.092.293.088.09.277.089h2.577a.38.38%200%200%201%20.294.123q.108.12.108.281a.38.38%200%200%201-.13.286.45.45%200%200%201-.314.118l-2.775-.003a1.4%201.4%200%200%201-.613-.126.87.87%200%200%201-.388-.387%201.34%201.34%200%200%201-.129-.608v-2.318q0-.4-.151-.572-.151-.168-.55-.177a.35.35%200%200%201-.278-.132.42.42%200%200%201-.102-.28q0-.173.103-.287'/%3e%3cpath%20fill='currentColor'%20d='M5.437%2010.36a.986.986%200%200%201-.994-.975c0-.538.446-.976.994-.976s.994.438.994.976a.986.986%200%200%201-.994.976M10.562%208.41c.548%200%20.994.437.994.975a.986.986%200%200%201-.994.976.986.986%200%200%201-.994-.976c0-.538.446-.976.994-.976M8.74%202c.37%200%20.446.15.446.275v.034q0%20.034-.009.201-.01.162-.017.549-.018.378-.044%201.06c0%20.106-.065.233-.375.233-.311%200-.376-.126-.376-.23l-.07-1.835v-.003c0-.13.078-.284.446-.284M7.256%202c.369%200%20.446.15.446.275v.034q0%20.034-.01.201-.007.162-.017.549-.017.378-.043%201.06c0%20.106-.065.233-.376.233-.31%200-.375-.126-.375-.23l-.07-1.835v-.003C6.81%202.154%206.887%202%207.256%202'/%3e%3c/svg%3e",r7="/demo/desktop/assets/autohand-bkvwPcbN.svg",a7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%201200%201200'%3e%3cpath%20fill='currentColor'%20d='M%20233.959793%20800.214905%20L%20468.644287%20668.536987%20L%20472.590637%20657.100647%20L%20468.644287%20650.738403%20L%20457.208069%20650.738403%20L%20417.986633%20648.322144%20L%20283.892639%20644.69812%20L%20167.597321%20639.865845%20L%2054.926208%20633.825623%20L%2026.577238%20627.785339%20L%203.3e-05%20592.751709%20L%202.73832%20575.27533%20L%2026.577238%20559.248352%20L%2060.724873%20562.228149%20L%20136.187973%20567.382629%20L%20249.422867%20575.194763%20L%20331.570496%20580.026978%20L%20453.261841%20592.671082%20L%20472.590637%20592.671082%20L%20475.328857%20584.859009%20L%20468.724915%20580.026978%20L%20463.570557%20575.194763%20L%20346.389313%20495.785217%20L%20219.543671%20411.865906%20L%20153.100723%20363.543762%20L%20117.181267%20339.060425%20L%2099.060455%20316.107361%20L%2091.248367%20266.01355%20L%20123.865784%20230.093994%20L%20167.677887%20233.073853%20L%20178.872513%20236.053772%20L%20223.248367%20270.201477%20L%20318.040283%20343.570496%20L%20441.825592%20434.738342%20L%20459.946411%20449.798706%20L%20467.194672%20444.64447%20L%20468.080597%20441.020203%20L%20459.946411%20427.409485%20L%20392.617493%20305.718323%20L%20320.778564%20181.932983%20L%20288.80542%20130.630859%20L%20280.348999%2099.865845%20C%20277.369171%2087.221436%20275.194641%2076.590698%20275.194641%2063.624268%20L%20312.322174%2013.20813%20L%20332.8591%206.604126%20L%20382.389313%2013.20813%20L%20403.248352%2031.328979%20L%20434.013519%20101.71814%20L%20483.865753%20212.537048%20L%20561.181274%20363.221497%20L%20583.812134%20407.919434%20L%20595.892639%20449.315491%20L%20600.40271%20461.959839%20L%20608.214783%20461.959839%20L%20608.214783%20454.711609%20L%20614.577271%20369.825623%20L%20626.335632%20265.61084%20L%20637.771851%20131.516846%20L%20641.718201%2093.745117%20L%20660.402832%2048.483276%20L%20697.530334%2024.000122%20L%20726.52356%2037.852417%20L%20750.362549%2072%20L%20747.060486%2094.067139%20L%20732.886047%20186.201416%20L%20705.100708%20330.52356%20L%20686.979919%20427.167847%20L%20697.530334%20427.167847%20L%20709.61084%20415.087341%20L%20758.496704%20350.174561%20L%20840.644348%20247.490051%20L%20876.885925%20206.738342%20L%20919.167847%20161.71814%20L%20946.308838%20140.29541%20L%20997.61084%20140.29541%20L%201035.38269%20196.429626%20L%201018.469849%20254.416199%20L%20965.637634%20321.422852%20L%20921.825562%20378.201538%20L%20859.006714%20462.765259%20L%20819.785278%20530.41626%20L%20823.409424%20535.812073%20L%20832.75177%20534.92627%20L%20974.657776%20504.724915%20L%201051.328979%20490.872559%20L%201142.818848%20475.167786%20L%201184.214844%20494.496582%20L%201188.724854%20514.147644%20L%201172.456421%20554.335693%20L%201074.604126%20578.496765%20L%20959.838989%20601.449829%20L%20788.939636%20641.879272%20L%20786.845764%20643.409485%20L%20789.261841%20646.389343%20L%20866.255127%20653.637634%20L%20899.194702%20655.409424%20L%20979.812134%20655.409424%20L%201129.932861%20666.604187%20L%201169.154419%20692.537109%20L%201192.671265%20724.268677%20L%201188.724854%20748.429688%20L%201128.322144%20779.194641%20L%201046.818848%20759.865845%20L%20856.590759%20714.604126%20L%20791.355774%20698.335754%20L%20782.335693%20698.335754%20L%20782.335693%20703.731567%20L%20836.69812%20756.885986%20L%20936.322205%20846.845581%20L%201061.073975%20962.81897%20L%201067.436279%20991.490112%20L%201051.409424%201014.120911%20L%201034.496704%201011.704712%20L%20924.885986%20929.234924%20L%20882.604126%20892.107544%20L%20786.845764%20811.48999%20L%20780.483276%20811.48999%20L%20780.483276%20819.946289%20L%20802.550415%20852.241699%20L%20919.087341%201027.409424%20L%20925.127625%201081.127686%20L%20916.671204%201098.604126%20L%20886.469849%201109.154419%20L%20853.288696%201103.114136%20L%20785.073914%201007.355835%20L%20714.684631%20899.516785%20L%20657.906067%20802.872498%20L%20650.979858%20806.81897%20L%20617.476624%201167.704834%20L%20601.771851%201186.147705%20L%20565.530212%201200%20L%20535.328857%201177.046997%20L%20519.302124%201139.919556%20L%20535.328857%201066.550537%20L%20554.657776%20970.792053%20L%20570.362488%20894.68457%20L%20584.536926%20800.134277%20L%20592.993347%20768.724976%20L%20592.429626%20766.630859%20L%20585.503479%20767.516968%20L%20514.22821%20865.369263%20L%20405.825531%201011.865906%20L%20320.053711%201103.677979%20L%20299.516815%201111.812256%20L%20263.919525%201093.369263%20L%20267.221497%201060.429688%20L%20287.114136%201031.114136%20L%20405.825531%20880.107361%20L%20477.422913%20786.52356%20L%20523.651062%20732.483276%20L%20523.328918%20724.671265%20L%20520.590698%20724.671265%20L%20205.288605%20929.395935%20L%20149.154434%20936.644409%20L%20124.993355%20914.01355%20L%20127.973183%20876.885986%20L%20139.409409%20864.80542%20L%20234.201385%20799.570435%20L%20233.879227%20799.8927%20Z'/%3e%3c/svg%3e",l7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2092%2096'%20fill='currentColor'%3e%3cpath%20d='M65.45%2016.3c10.89%200%2019.71%208.86%2019.71%2019.8v6.6l5.74%2011.46a4.48%204.48%200%200%201-.01%203.6L85.16%2069.1v6.6c0%2010.94-8.83%2019.8-19.71%2019.8H26.02c-10.89%200-19.71-8.86-19.71-19.8v-6.6L.45%2057.8a4.48%204.48%200%200%201-.01-3.67L6.31%2042.7v-6.6c0-10.94%208.83-19.8%2019.71-19.8h39.43zm-2.52%205.7H29.19c-9.32%200-16.87%207.56-16.87%2016.88v5.62l-4.88%209.46a4.48%204.48%200%200%200%20.01%203.68l4.87%209.36v5.62c0%209.32%207.55%2016.88%2016.87%2016.88h33.74c9.32%200%2016.87-7.55%2016.87-16.88V67l4.77-9.39a4.48%204.48%200%200%200%200-3.61L79.8%2044.5v-5.62C79.8%2029.56%2072.25%2022%2062.93%2022z'%20fill-rule='nonzero'/%3e%3ccircle%20cx='45.73'%20cy='11'%20r='11'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='31'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3crect%20stroke='currentColor'%20stroke-width='8'%20x='55'%20y='44.5'%20width='5'%20height='22'%20rx='2.5'/%3e%3c/svg%3e",o7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M12.13%201.25c.15-.14.16-.14.28-.15.18%200%20.36.08.64.34.68.62%201.61%201.89%202.2%202.97l.22.42.32.16c.3.16.81.48%201.02.65.09.08.11.08.21.04.45-.18%201.09.05%201.65.6.51.49%201%201.33%201.18%202.03.03.11.06.36.07.54.04.64-.16%201.14-.55%201.37-.08.04-.08.06-.08.26.02.95-.23%201.89-.74%202.82-.58%201.04-1.6%202.11-2.98%203.12-.74.55-2.5%201.58-3.3%201.95-1.9.86-3.43%201.2-4.76%201.03-.79-.09-1.69-.41-2.22-.77-.14-.1-.16-.1-.27-.07-.57.16-1.31-.18-1.94-.88-.25-.28-.66-.98-.79-1.35-.3-.87-.25-1.65.16-2.12.11-.12.09-.33.09-.33-.04-.33-.05-.82-.04-1.14v-.3l-.43-.79c-.68-1.23-1.12-2.25-1.28-3.04-.09-.43-.09-.62.02-.77.07-.09.28-.18.54-.22.66-.12%202.09-.01%203.69.27l.16.03.36-.32c.61-.54%201.01-.84%201.75-1.31.77-.48%201.64-.89%202.62-1.2l.32-.1.17-.46c.62-1.65%201.25-2.86%201.71-3.27h0Zm-5.19%208.45c-.7.41-1.05.61-1.3.84-1.04.93-1.43%202.39-.99%203.71.11.33.31.68.71%201.39.41.71.61%201.06.83%201.32.92%201.05%202.37%201.45%203.68%201%20.32-.11.68-.31%201.38-.72l4.02-2.34c.7-.41%201.05-.61%201.3-.84%201.04-.93%201.43-2.39.99-3.71-.11-.33-.31-.68-.71-1.39s-.61-1.06-.83-1.32c-.92-1.05-2.37-1.45-3.68-1-.32.11-.67.31-1.38.72l-4.02%202.34Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M8.02%2012.13c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.88-.29%201.09-.38.22-.86.09-1.09-.29l-.86-1.5c-.22-.38-.09-.87.29-1.09Z'/%3e%3cpath%20fill='currentColor'%20fill-opacity='0.4'%20d='M12.31%209.64c.38-.22.87-.09%201.09.29l.86%201.5c.22.38.09.87-.29%201.09s-.87.09-1.09-.29l-.86-1.5c-.22-.38-.09-.88.29-1.09Z'/%3e%3c/svg%3e",c7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.676l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v2.999l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e",h7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20362%20362'%20overflow='hidden'%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='M1562.63,107.07h-4.18v5.15h4.18c1.94,0,3.21-.87,3.21-2.53,0-1.75-1.17-2.62-3.21-2.62ZM1553.3,102.31h9.42c5.15,0,8.55,2.82,8.55,7.19,0,2.72-1.36,4.76-3.4,6.02l3.69,5.34v1.07h-5.34l-3.59-5.15h-4.18v5.15h-5.15v-19.62ZM1579.63,112.51c0-10.49-6.99-18.46-17.68-18.46s-17.49,7.58-17.49,18.46,6.99,18.46,17.49,18.46,17.68-7.97,17.68-18.46ZM1584,112.51c0,12.34-8.26,22.63-22.05,22.63s-21.86-10.39-21.86-22.63,8.16-22.63,21.86-22.63,22.05,10.3,22.05,22.63ZM348.21,156.4l-42.55,24.61,42.55,24.54c10.75,6.22,14.42,19.9,8.21,30.67-6.2,10.7-19.92,14.37-30.63,8.18l-76.21-44c-5.08-2.96-8.61-7.59-10.18-12.8-.74-2.4-1.09-4.87-1-7.31.04-1.76.3-3.53.79-5.29,1.52-5.48,5.1-10.38,10.39-13.46l76.21-43.97c10.71-6.19,24.43-2.51,30.63,8.22,6.22,10.72,2.54,24.41-8.21,30.61ZM307.93,275.68l-76.19-43.94c-4.09-2.38-8.63-3.3-12.99-2.93-11.62.83-20.75,10.53-20.75,22.34v87.98c0,12.4,10,22.45,22.42,22.45s22.45-10.05,22.45-22.45v-49.21l42.66,24.63c10.72,6.23,24.43,2.54,30.61-8.17,6.17-10.74,2.53-24.5-8.21-30.7ZM220.01,189.61l-31.67,31.63c-.91.93-2.65,1.69-3.98,1.69h-9.31c-1.28,0-3.06-.76-3.98-1.69l-31.66-31.63c-.91-.89-1.64-2.68-1.64-3.94v-9.33c0-1.29.73-3.09,1.64-3.99l31.66-31.63c.92-.93,2.7-1.66,3.98-1.66h9.31c1.29,0,3.07.73,3.98,1.66l31.67,31.63c.9.9,1.63,2.7,1.63,3.99v9.33c0,1.26-.73,3.05-1.63,3.94ZM194.7,180.83c0-1.28-.77-3.06-1.68-4l-9.17-9.13c-.9-.9-2.68-1.65-3.96-1.65h-.36c-1.28,0-3.05.75-3.94,1.65l-9.17,9.13c-.92.95-1.62,2.73-1.62,4v.36c0,1.26.7,3.03,1.62,3.95l9.17,9.16c.9.9,2.67,1.65,3.94,1.65h.36c1.28,0,3.06-.75,3.96-1.65l9.17-9.16c.9-.92,1.68-2.68,1.68-3.95v-.36ZM51.48,86.28l76.21,43.99c4.09,2.35,8.64,3.29,13.01,2.93,11.6-.86,20.75-10.58,20.75-22.37V22.84c0-12.37-10.06-22.41-22.42-22.41s-22.45,10.05-22.45,22.41v49.23l-42.7-24.66c-10.71-6.2-24.4-2.53-30.61,8.2-6.19,10.76-2.53,24.47,8.2,30.67ZM218.75,133.19c4.36.36,8.9-.57,12.99-2.93l76.19-43.99c10.74-6.2,14.38-19.91,8.21-30.67-6.18-10.72-19.89-14.4-30.61-8.2l-42.66,24.66V22.84c0-12.37-10.03-22.41-22.45-22.41s-22.42,10.05-22.42,22.41v87.98c0,11.8,9.13,21.51,20.75,22.37ZM140.71,228.8c-4.38-.37-8.92.54-13.01,2.93l-76.21,43.94c-10.72,6.2-14.38,19.96-8.2,30.7,6.22,10.71,19.91,14.4,30.61,8.17l42.7-24.63v49.21c0,12.4,10.03,22.45,22.45,22.45s22.42-10.05,22.42-22.45v-87.98c0-11.81-9.16-21.51-20.75-22.34ZM120.04,187.6c.76-2.4,1.08-4.87,1.02-7.31-.09-1.76-.32-3.53-.82-5.29-1.51-5.48-5.08-10.38-10.44-13.46l-76.15-43.97c-10.75-6.19-24.45-2.51-30.63,8.22-6.23,10.72-2.55,24.41,8.2,30.61l42.55,24.61-42.55,24.54c-10.75,6.22-14.41,19.9-8.2,30.67,6.17,10.7,19.88,14.37,30.63,8.18l76.15-44c5.14-2.96,8.63-7.59,10.23-12.8Z'/%3e%3c/svg%3e",u7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2012%2012'%3e%3cg%20transform='matrix(0.00160555,0,0,-0.0014599,-0.26812129,11.08482)'%20fill='currentColor'%3e%3cpath%20d='m%20297,6493%20c%20-4,-3%20-7,-1357%20-7,-3008%200,-2390%203,-3005%2012,-3012%2013,-10%201199,-9%201224,1%2011,4%2013,61%2010,295%20-2,159%20-7,294%20-10,299%20-4,7%20-112,11%20-312,11%20-168,0%20-309,3%20-314,6%20-12,7%20-13,4775%20-2,4792%206,10%2085,13%20317,15%20l%20310,3%20v%20600%20l%20-611,3%20c%20-336,1%20-614,-1%20-617,-5%20z'/%3e%3cpath%20d='m%206287,6493%20c%20-4,-3%20-7,-136%20-7,-294%200,-219%203,-290%2013,-296%206,-4%20152,-10%20322,-13%20l%20310,-5%203,-2394%20c%201,-1545%20-1,-2398%20-8,-2405%20-6,-6%20-127,-9%20-316,-7%20-246,2%20-309,0%20-315,-11%20-5,-7%20-9,-145%20-9,-305%20V%20470%20l%2023,-1%20c%20158,-4%201192,-2%201200,3%2014,9%2022,5964%207,6002%20l%20-10,26%20h%20-603%20c%20-332,0%20-607,-3%20-610,-7%20z'/%3e%3cg%20transform='matrix(1.0249,0,0,1.0566,-429.39,51.322)'%3e%3cpath%20d='m%202476.7,5111.6%20c%20-64.95,-6.2305%20-71.077,-28.66%20-73.528,-325.23%20-3.6765,-261.68%204.9018,-351.4%2036.764,-371.34%207.3528,-4.9844%20583.32,-12.461%201276.9,-16.199%20l%201262.2,-6.2306%2073.528,-34.891%20c%20191.17,-90.966%20300.24,-292.84%20284.31,-527.1%20-15.931,-223.05%20-134.8,-392.52%20-314.95,-449.85%20-61.274,-19.938%20-133.58,-21.184%20-727.93,-18.692%20-607.83,3.7384%20-661.75,2.4922%20-682.59,-17.446%20-22.058,-19.938%20-23.284,-43.614%20-23.284,-331.47%200,-190.65%204.9019,-320.25%2012.255,-335.2%2011.029,-21.184%2026.96,-23.676%20123.77,-23.676%20h%20110.29%20l%2066.176,-63.552%20c%2036.764,-34.891%20125,-125.86%20198.53,-201.87%2072.303,-76.013%20322.3,-333.96%20555.14,-571.96%20l%20424.01,-434.89%20519.6,3.7383%20c%20390.93,2.4922%20520.83,7.4767%20520.83,18.692%200,7.4766%20-223.04,249.22%20-496.32,534.58%20-562.49,589.41%20-666.66,701.56%20-660.53,707.79%202.451,2.4922%2052.695,8.7227%20111.52,13.707%20322.3,24.922%20593.13,194.39%20790.43,495.95%20129.9,199.38%20187.5,391.28%20196.08,660.44%208.5783,245.48%20-14.706,368.85%20-116.42,600.63%20-123.77,286.61%20-328.43,492.21%20-596.8,601.87%20-232.84,95.95%20-167.89,92.212%20-1574.7,93.458%20-691.17,1.2462%20-1274.5,1.2462%20-1295.3,-1.2461%20z'/%3e%3cpath%20d='m%202430.1,3942.7%20c%20-24.509,-18.692%20-24.509,-33.645%20-24.509,-1254.8%200,-1163.9%201.2255,-1238.6%2022.058,-1271%20l%2020.833,-33.645%20h%20337%20c%20289.21,0%20338.23,2.4922%20354.16,19.938%2018.382,17.446%2019.608,145.79%2018.382,1267.3%20-1.2255,1115.3%20-2.4509,1251.1%20-19.608,1271%20-18.382,18.692%20-50.244,21.184%20-351.71,21.184%20-276.96,-1.2461%20-335.78,-3.7383%20-356.61,-19.938%20z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",d7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%20366%20368'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='currentColor'%20d='m%2026,275.93574%20c%200.65,-9.32%208.46,-15.43%2015,-20.96%2015.43,-13.04%2035.67,-21.92%2053,-32.71%2020.67,-12.88%2061.58,-40.31%2080,-55.03%200,0%2021,-18.39%2021,-18.39%200,0%2028,-23.91%2028,-23.91%2010,-8.33%2014.1,-11.65%2025,-18.92%207.42,-4.94%2019.07,-12.550001%2024.52,-19.330001%207.17,-8.93%204.16,-18.82%20-4.53,-25.45%20-5.67,-4.32%20-23.5,-8.94%20-30.99,-10.66%20-3.1,-0.72%20-11.45,-1.57%20-13.38,-3.62%20-3.22,-3.43%201.67,-6.99%204.38,-8.45%206.61,-3.54%2017.51,-5.73%2025,-5.82%200,0%204,0%204,0%2016.51,-0.2%2018.85,-12.47%2040,-11.99%209.26,0.21%2021.16,2.48%2029,7.54%207.87,5.07%2012.2,11.73%2017.05,19.45%206.31,10.05%2012.35,21.16%2014.49,33%201.42,7.88%20-0.45,13.62%20-0.54,21.000001%20-0.28,24.26%206.68,37.92%20-2.44,63%20-5.9,16.24%20-14.87,35.36%20-23.98,50%20-9.34,15%20-20.81,30.64%20-35.58,40.64%200,0%20-16,9.36%20-16,9.36%20-3.3,1.9%20-6.18,2.94%20-6.64,7.04%20-0.68,2.83%20-0.16,7.11%200,9.96%200,0%201.29,8%201.29,8%201.62,5.16%208.51,12.15%2012.35,16%203.36,3.37%206.84,7.82%2012,7.89%204.2,0.06%208.14,-2.87%2012,-4.44%205.24,-2.13%2011.35,-3.55%2017,-3.94%206.33,-0.43%2017.05,1.85%2014,10.49%20-2.84,-3.54%20-6.09,-6.36%20-11,-5.57%20-2.47,0.4%20-10.06,3.6%20-8.09,7.08%201.19,2.08%207.67,3.01%2010.09,3.88%206.26,2.25%2010.83,5.76%2014,11.61%200,0%20-17,-6.33%20-17,-6.33%20-9.74,-2.08%20-18.73,0.62%20-28,3.33%205.49,3.71%208.06,5.51%2012,11%20-8.23,-1.96%20-13.6,-7.46%20-26,-6.96%20-9.64,0.39%20-11.89,4.13%20-27,3.96%20-9.42,-0.11%20-17.78,-4.36%20-27,-3.96%20-9.45,0.41%20-13.16,5.64%20-21,8.96%203.16,-14.88%2019.73,-16%2032,-16%20-7.31,-10.21%20-20.46,-18.11%20-23.28,-26%20-0.7,-1.97%20-0.69,-3.94%20-0.71,-6%200,0%200,-14%200,-14%200.23,-2.35%201.13,-5.62%200,-7.73%20-1.66,-2.77%20-8.94,-4.64%20-12.01,-5.55%20-20.1,-5.96%20-24.58,-0.84%20-43,2.01%200,0%20-14,2.11%20-14,2.11%20-9.78,1.06%20-18.83,0.92%20-28,5.02%200,0%20-15,7.88%20-15,7.88%20-16.76,8.6%20-42.02,22.27%20-59,27.93%20-9.14,3.04%20-16.2,6.24%20-26,6.33%200,0%205,-10%205,-10%20-3.92,0.18%20-15.76,3.08%20-17.92,-0.51%20-2.44,-4.07%205.28,-9.01%207.92,-10.91%200,0%2036,-24.58%2036,-24.58%200,0%20-19,3.25%20-19,3.25%20z%20m%20227,1.75%20c%20-2.98,0.84%20-11.45,3.61%20-12.96,6.27%20-0.95,1.89%20-0.18,5.54%200,7.73%200.04,2.47%20-0.13,4.56%200.61,7%201.52,5.07%2011.84,17.33%2016.35,19.88%203.38,1.91%2015.93,0.11%2020,-0.88%20-4.12,-8.71%20-16.66,-15.05%20-21.99,-24%20-3.43,-5.75%20-0.8,-10.06%20-2.01,-16%20z'%20/%3e%3c/svg%3e",f7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20466.73%20532.09'%3e%3cpath%20fill='currentColor'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",p7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20128%20128'%3e%3cpath%20fill='currentColor'%20d='M40.1024%2085.0722C47.6207%2077.5537%2051.8469%2067.3453%2051.8469%2056.7136C51.8469%2046.0818%2047.617%2035.8734%2040.1024%2028.355L11.7446%200C4.22995%207.5185%200%2017.7269%200%2028.3586C0%2038.9903%204.22995%2049.1987%2011.7446%2056.7172L40.0987%2085.0722H40.1024Z'/%3e%3cpath%20fill='currentColor'%20d='M99.4385%2087.698C91.9239%2080.1832%2081.7121%2075.9531%2071.0844%2075.9531C60.4566%2075.9531%2050.2448%2080.1832%2042.7266%2087.698L71.0844%20116.057C78.599%20123.571%2088.8107%20127.802%2099.4421%20127.802C110.074%20127.802%20120.282%20123.571%20127.8%20116.057L99.4421%2087.698H99.4385Z'/%3e%3cpath%20fill='currentColor'%20d='M11.8146%20115.987C19.3329%20123.502%2029.541%20127.732%2040.1724%20127.732V87.6289H0.0664062C0.0700559%2098.2606%204.29635%20108.469%2011.8146%20115.987Z'/%3e%3cpath%20fill='currentColor'%20d='M110.387%2045.7684C102.869%2038.2535%2092.6608%2034.0198%2082.0258%2034.0234C71.3943%2034.0234%2061.1863%2038.2535%2053.668%2045.772L82.0258%2074.1306L110.387%2045.7684Z'/%3e%3c/svg%3e",g7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20263%20300'%3e%3cpath%20fill='currentColor'%20d='M1.84577e-10%20100.797V38.6224C1.88813e-05%2035.8899%201.45777%2033.365%203.82414%2031.9988L57.6539%200.920185C60.0203%20-0.446051%2062.9358%20-0.446051%2065.3022%200.920185L119.132%2031.9988C121.498%2033.3651%20122.956%2035.8899%20122.956%2038.6224V70.375C123.192%2080.9262%20128.769%2091.103%20138.577%2096.7655C148.384%20102.428%20159.986%20102.169%20169.242%2097.0979L196.74%2081.2217C199.107%2079.8554%20202.022%2079.8554%20204.388%2081.2217L258.218%20112.3C260.585%20113.667%20262.042%20116.191%20262.042%20118.924V181.081C262.042%20183.814%20260.585%20186.339%20258.218%20187.705L204.388%20218.783C202.022%20220.15%20199.107%20220.15%20196.74%20218.783L169.464%20203.036C160.173%20197.847%20148.465%20197.536%20138.579%20203.244C128.772%20208.906%20123.195%20219.083%20122.959%20229.634V261.378C122.959%20264.111%20121.501%20266.635%20119.135%20268.002L65.3048%20299.08C62.9384%20300.447%2060.0229%20300.447%2057.6566%20299.08L3.82673%20268.002C1.46036%20266.635%200.00260562%20264.111%200.00260562%20261.378V199.221C0.0026245%20196.488%201.46038%20193.963%203.82675%20192.597L57.6565%20161.519C60.0229%20160.152%2062.9384%20160.152%2065.3048%20161.519L92.8656%20177.431C102.11%20182.467%20113.679%20182.711%20123.463%20177.062C133.349%20171.355%20138.934%20161.06%20139.086%20150.419C138.85%20139.868%20133.274%20128.601%20123.466%20122.938C113.658%20117.276%20102.056%20117.534%2092.8007%20122.606L65.1758%20138.645C62.7991%20140.025%2059.8649%20140.024%2057.4894%20138.642L3.80216%20107.407C1.44816%20106.038%20-1.88809e-05%20103.52%201.84577e-10%20100.797Z'/%3e%3c/svg%3e",m7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.12109%2011.0078H1.99902V5.49316H3.12109V11.0078ZM3.7041%205.49316C4.91979%205.49316%205.31142%205.57449%205.80762%205.7373C6.50208%205.97365%206.85299%206.40958%206.86133%207.04492V9.45605C6.86125%2010.207%206.37767%2010.6797%205.41016%2010.874C4.95546%2010.9633%204.69632%2011.0078%203.7041%2011.0078V10.6064C4.72131%2010.6064%204.95994%2010.5507%205.34863%2010.4404C5.91072%2010.2671%206.19576%209.93907%206.2041%209.45605V7.04492C6.20402%206.4883%205.83211%206.13886%205.08789%205.99707C4.74057%205.93405%204.58897%205.89978%203.7041%205.89453V5.49316ZM9.16797%205.49316V11.0078H8.0459V5.49316H9.16797ZM14%206.79297V11.0078H12.8779V8.0791L13.8877%206.79297H14ZM14%205.49316V5.7373L11.3594%208.97852H10.7852L9.74219%206.94531V6.07812H9.86719L11.0723%208.33203L13.4258%205.49316H14Z'%20fill='currentColor'/%3e%3c/svg%3e",v7="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJjdXJyZW50Q29sb3IiPgogIDx0ZXh0IHg9IjgiIHk9IjEwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LXNpemU9IjEwLjUiIGZvbnQtZmFtaWx5PSJHZW9yZ2lhLCBzZXJpZiIgZm9udC1zdHlsZT0iaXRhbGljIiBmaWxsPSJjdXJyZW50Q29sb3IiPs60PC90ZXh0PgogIDxsaW5lIHgxPSIxIiB5MT0iMTQiIHgyPSIxNSIgeTI9IjE0IiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLW9wYWNpdHk9IjAuNCIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8bGluZSB4MT0iOCIgeTE9IjE0IiB4Mj0iOCIgeTI9IjEyIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8Y2lyY2xlIGN4PSI4IiBjeT0iMTEuNSIgcj0iMC43IiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+Cg==",_7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%20900%20900'%20fill='none'%3e%3cpath%20fill='currentColor'%20d='M622.037%20192.524a10.58%2010.58%200%200%201-4.056-2.001%2010.573%2010.573%200%200%201-3.98-7.89%2010.595%2010.595%200%200%201%20.804-4.452c20.214-49.194%2029.134-88.555%2014.74-105.033-38.123-43.716-191.004%2043.219-239.75%2072.663a10.596%2010.596%200%200%201-10.841.041%2010.576%2010.576%200%200%201-4.396-5.07c-20.491-49.089-42.031-83.233-63.865-84.714-57.871-3.96-104.516%20165.624-118.17%20220.895a10.574%2010.574%200%200%201-1.993%204.057%2010.572%2010.572%200%200%201-7.884%203.977%2010.586%2010.586%200%200%201-4.447-.802c-49.194-20.215-88.572-29.134-105.033-14.74-43.717%2038.123%2043.202%20191.005%2072.644%20239.75a10.553%2010.553%200%200%201%201.454%204.279%2010.573%2010.573%200%200%201-6.481%2010.958c-49.072%2020.491-83.216%2042.031-84.715%2063.864-3.944%2057.871%20165.624%20104.516%20220.913%20118.171a10.566%2010.566%200%200%201%205.658%203.601%2010.57%2010.57%200%200%201%202.355%206.281%2010.58%2010.58%200%200%201-.799%204.442c-20.214%2049.194-29.134%2088.572-14.739%20105.033%2038.121%2043.717%20191.021-43.202%20239.767-72.644a10.566%2010.566%200%200%201%2015.238%205.027c20.489%2049.072%2042.013%2083.216%2063.862%2084.715%2057.871%203.944%20104.516-165.624%20118.153-220.913a10.603%2010.603%200%200%201%209.895-8.021%2010.566%2010.566%200%200%201%204.449.808c49.193%2020.214%2088.553%2029.116%20105.032%2014.738%2043.718-38.121-43.219-191.022-72.663-239.767a10.602%2010.602%200%200%201%201.326-12.655%2010.604%2010.604%200%200%201%203.703-2.582c49.089-20.49%2083.233-42.031%2084.714-63.863%203.96-57.871-165.624-104.516-220.895-118.153Zm-66.394-55.478c11.123%2019.938-46.196%20152.797-88.83%20245.724a8.36%208.36%200%200%201-8.239%204.855%208.374%208.374%200%200%201-7.412-6.043c-17.219-60.42-36.899-131.411-57.957-191.675a10.557%2010.557%200%200%201%204.924-12.759c52.586-28.721%20142.568-66.86%20157.514-40.102ZM303.635%20153.49c21.953%206.233%2075.365%20140.709%20110.92%20236.564a8.364%208.364%200%200%201-2.394%209.249%208.364%208.364%200%200%201-9.504.978c-54.943-30.493-119.013-66.824-176.522-94.546a10.565%2010.565%200%200%201-5.528-12.501c16.926-57.44%2053.532-148.095%2083.028-139.744ZM137.064%20343.322c19.921-11.123%20152.795%2046.197%20245.707%2088.83a8.369%208.369%200%200%201-1.189%2015.652c-60.401%2017.219-131.411%2036.899-191.675%2057.957a10.552%2010.552%200%200%201-12.742-4.925c-28.668-52.584-66.876-142.568-40.101-157.514Zm16.443%20252.009c6.217-21.953%20140.709-75.365%20236.564-110.921a8.368%208.368%200%200%201%2010.227%2011.898c-30.511%2054.945-66.842%20119.014-94.563%20176.507a10.548%2010.548%200%200%201-5.229%205.075%2010.544%2010.544%200%200%201-7.271.468c-57.441-16.822-148.095-53.531-139.728-83.027ZM343.34%20761.902c-11.14-19.922%2046.197-152.796%2088.829-245.707a8.383%208.383%200%200%201%205.713-4.66%208.38%208.38%200%200%201%207.182%201.664%208.371%208.371%200%200%201%202.758%204.184c17.217%2060.403%2036.898%20131.412%2057.957%20191.675a10.558%2010.558%200%200%201-4.942%2012.743c-52.568%2028.668-142.568%2066.875-157.445%2040.101h-.052Zm252.009-16.443c-21.971-6.216-75.383-140.709-110.939-236.564a8.37%208.37%200%200%201%2011.916-10.228c54.926%2030.494%20119.014%2066.842%20176.506%2094.563a10.538%2010.538%200%200%201%205.527%2012.502c-16.909%2057.526-53.515%20148.094-83.01%20139.727Zm166.57-189.834c-19.938%2011.141-152.796-46.197-245.724-88.83a8.367%208.367%200%200%201-2.993-12.892%208.378%208.378%200%200%201%204.182-2.759c60.419-17.218%20131.41-36.899%20191.675-57.958a10.577%2010.577%200%200%201%2012.758%204.943c28.652%2052.568%2066.86%20142.569%2040.102%20157.496Zm-16.444-252.009c-6.232%2021.971-140.709%2075.383-236.562%20110.94a8.371%208.371%200%200%201-10.229-11.917c30.495-54.926%2066.825-119.012%2094.547-176.505a10.555%2010.555%200%200%201%2012.5-5.528c57.441%2016.909%20148.096%2053.516%20139.744%2083.01Z'/%3e%3c/svg%3e",y7="/demo/desktop/assets/fast-agent-C0GPnwYP.svg",S7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M11.04%2019.32Q12%2021.51%2012%2024q0-2.49.93-4.68.96-2.19%202.58-3.81t3.81-2.55Q21.51%2012%2024%2012q-2.49%200-4.68-.93a12.3%2012.3%200%200%201-3.81-2.58%2012.3%2012.3%200%200%201-2.58-3.81Q12%202.49%2012%200q0%202.49-.96%204.68-.93%202.19-2.55%203.81a12.3%2012.3%200%200%201-3.81%202.58Q2.49%2012%200%2012q2.49%200%204.68.96%202.19.93%203.81%202.55t2.55%203.81'/%3e%3c/svg%3e",x7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.99816%2014.2779C12.0678%2014.2779%2014.9997%2011.6274%2014.9997%2010.9574V9.3189C14.939%208.77306%2014.4165%207.82349%2013.6074%207.48636C13.5959%207.42498%2013.5859%207.36153%2013.5756%207.29542C13.5506%207.13548%2013.5231%206.95977%2013.4649%206.75954C13.6409%206.31508%2013.6873%205.81187%2013.6873%205.31135C13.6873%204.54947%2013.5757%203.76321%2013.0811%203.13712C12.5745%202.4959%2011.7737%202.15372%2010.6972%202.03411C9.64215%201.91688%208.71828%202.06409%208.12157%202.70342C8.07827%202.74981%208.0345%202.79812%207.99655%202.84746C7.95861%202.79812%207.91805%202.74981%207.87475%202.70342C7.27804%202.06409%206.35416%201.91688%205.29908%202.03411C4.22263%202.15372%203.42181%202.4959%202.91521%203.13712C2.42057%203.76321%202.30905%204.54947%202.30905%205.31135C2.30905%205.81187%202.35539%206.31508%202.53142%206.75954C2.47323%206.95977%202.44574%207.13542%202.42072%207.29536C2.41037%207.3615%202.40044%207.42496%202.38893%207.48636C1.57983%207.82349%201.05728%208.77306%200.996582%209.3189V10.9574C0.996582%2011.6274%203.92849%2014.2779%207.99816%2014.2779ZM10.5523%203.33859C9.63863%203.23707%209.25001%203.41798%209.0811%203.59896C8.90273%203.79007%208.76738%204.19254%208.86971%205.0112C8.94909%205.64627%209.13423%206.08757%209.41018%206.36929C9.67188%206.63645%2010.0966%206.8426%2010.8435%206.8426C11.6506%206.8426%2011.9631%206.66867%2012.1051%206.51046C12.2619%206.33577%2012.3748%206.00462%2012.3748%205.31135C12.3748%204.64141%2012.2675%204.22455%2012.0513%203.95077C11.8469%203.69214%2011.4446%203.43773%2010.5523%203.33859ZM6.91639%203.59896C6.74748%203.41798%206.35886%203.23707%205.44518%203.33859C4.55289%203.43773%204.15058%203.69214%203.94624%203.95077C3.72994%204.22455%203.62271%204.64141%203.62271%205.31135C3.62271%206.00462%203.73563%206.33577%203.89239%206.51046C4.03436%206.66867%204.34693%206.8426%205.15396%206.8426C5.90092%206.8426%206.32561%206.63645%206.58731%206.36929C6.86326%206.08757%207.0484%205.64627%207.12778%205.0112C7.23011%204.19254%207.09476%203.79007%206.91639%203.59896ZM7.99818%2012.9788C9.99307%2012.9788%2012.0088%2012.0076%2012.3748%2011.7248V8.00133L12.3546%207.90026C11.9257%208.08369%2011.4142%208.1551%2010.8435%208.1551C9.84049%208.1551%209.04148%207.86851%208.47257%207.28773C8.28092%207.09208%208.12536%206.87308%207.99978%206.6378C7.8742%206.87308%207.71544%207.09208%207.52378%207.28773C6.95488%207.86851%206.15587%208.1551%205.15283%208.1551C4.58212%208.1551%204.07068%208.08369%203.6418%207.90026L3.62158%208.00133V11.7248C3.98755%2012.0076%206.00329%2012.9788%207.99818%2012.9788Z'%20fill='currentColor'/%3e%3cpath%20d='M6.46854%209.0301C6.83097%209.0301%207.12479%209.32391%207.12479%209.68635V10.9988C7.12479%2011.3613%206.83097%2011.6551%206.46854%2011.6551C6.1061%2011.6551%205.81229%2011.3613%205.81229%2010.9988V9.68635C5.81229%209.32391%206.1061%209.0301%206.46854%209.0301Z'%20fill='currentColor'/%3e%3cpath%20d='M10.1873%209.68635C10.1873%209.32391%209.89347%209.0301%209.53104%209.0301C9.1686%209.0301%208.87479%209.32391%208.87479%209.68635V10.9988C8.87479%2011.3613%209.1686%2011.6551%209.53104%2011.6551C9.89347%2011.6551%2010.1873%2011.3613%2010.1873%2010.9988V9.68635Z'%20fill='currentColor'/%3e%3c/svg%3e",w7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='currentColor'%20fill-rule='evenodd'%3e%3ctitle%3eZ.ai%3c/title%3e%3cpath%20d='M8.07%201.333L6.618%203.302H.435L1.887%201.333h6.184zM15.503%2012.699L14.052%2014.667h-6.161l1.449-1.968h6.163zM16%201.333L6.176%2014.667H0L9.824%201.333H16z'/%3e%3c/svg%3e",b7="/demo/desktop/assets/goose-y93b4F4V.svg",C7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M0.58392448,14.9254204%20L0.8326,14.66295%20C2.004465,13.42985%203.1678,12.2082%202.45814,10.48105%20C1.50813,8.1701%202.061355,5.4619%203.820575,3.70057%20C5.6495,1.8709%208.3431,1.40957%2010.59295,2.336505%20C11.0907,2.52161%2011.5245,2.785025%2011.86295,3.02993%20L9.98425,3.89849%20C8.235,3.163775%206.23115,3.66355%205.0081,4.88809%20C3.354105,6.5426%203.019895,9.4117%204.95835,11.2656%20L-0.335,15.99995%20C-0.066496,15.62975%200.2538896,15.275934%200.58392448,14.9254204%20Z%20M14.0391,2.288155%20L16.33165,2.57749377e-12%20L16.20795,0.172288%20C14.4658,2.574355%2013.6153,3.749045%2014.29795,6.6879%20C14.76445,8.68415%2014.261,10.90255%2012.63545,12.53005%20C10.5861,14.58325%207.3066,15.0403%204.6059,13.19215%20L6.48885,12.3193%20C8.2125,12.99705%2010.0983,12.69945%2011.4536,11.34255%20C12.80895,9.9856%2013.1133,8.00925%2012.4321,6.3647%20C12.30265,6.05285%2011.9144,5.97455%2011.64275,6.1753%20L6.102,10.27035%20L14.0391,2.288155%20Z'/%3e%3c/svg%3e",k7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M11.2%201.4%2014.6%204.8a1%201%200%200%201%200%201.4l-1.5%201.5-4.8-4.8%201.5-1.5a1%201%200%200%201%201.4%200ZM7.6%203.6l4.8%204.8-6.9%206.9a1%201%200%200%201-.5.27l-3.4.73a.6.6%200%200%201-.71-.71l.73-3.4a1%201%200%200%201%20.27-.5l5.6-5.6Zm-4.5%208.1-.4%201.9%201.9-.4-1.5-1.5Z'/%3e%3c/svg%3e",E7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%20fill='none'%3e%3cpath%20d='M25%2015H35V16.75C35%2029%2030.5001%2035%2016.5001%2035H15V25H16.5001C22.6251%2025%2025%2022.875%2025%2016.75V15Z'%20fill='currentColor'/%3e%3crect%20x='5'%20y='15'%20width='10'%20height='10'%20fill='currentColor'/%3e%3crect%20x='15'%20y='5'%20width='10'%20height='10'%20fill='currentColor'/%3e%3c/svg%3e",M7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M27.9998324,34.6666921h6.6666279v5.3333023h-8.3809037l-3.6190266-3.6190266v-8.3809037h5.3333023v6.6666279ZM39.9997627,26.2857884l-3.6190266-3.6190266h-8.3809037v5.3333023h6.6666279v6.6666279h5.3333023v-8.3809037ZM17.3332326,22.6667578h-5.3333023v5.3333023h5.3333023v-5.3333023ZM0,36.3809638l3.6190266,3.6190266h13.714206v-5.3333023H5.3333023v-11.9999302H0v13.714206ZM33.9600959,11.9999247V3.619021L30.3410693-.0000056h-7.6745392v5.3333023h5.9602634v6.6666279h-5.9602634v5.3333023h17.3332326v-5.3333023h-6.0396668ZM5.3333023,0H0v17.3332326h5.3333023v-5.9999651h6.6666279v5.9999651h5.3333023v-5.9999651l-5.3333023-5.3333023h-6.6666279V0ZM17.3332326,0h-5.3333023v5.9999651h5.3333023V0Z'/%3e%3c/svg%3e",j7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M3%201h2.5v5.5L9%201h3L8.5%206.5%2012.5%2013H9.5L6%208v5H3V1z'/%3e%3c/svg%3e",T7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M19.514%207.342C19.711%207.862%2019.814%208.413%2019.816%208.969C19.816%2012.494%2015.998%2014.697%2012.946%2012.934C11.529%2012.116%2010.657%2010.605%2010.657%208.969C10.657%205.646%2014.085%203.431%2017.115%204.793C15.26%203.373%2012.99%202.607%2010.655%202.612C4.772%202.614%200.005%207.381%200%2013.265C0.002%2019.148%204.772%2023.918%2010.655%2023.92C16.538%2023.916%2021.306%2019.147%2021.31%2013.265C21.312%2011.155%2020.687%209.095%2019.514%207.342ZM14.841%204.666C14.841%208.191%2018.657%2010.395%2021.709%208.632C23.127%207.814%2024%206.302%2024%204.666C24%201.14%2020.184-1.061%2017.13%200.699C15.714%201.519%2014.841%203.03%2014.841%204.666'/%3e%3c/svg%3e",D7="data:image/svg+xml,%3csvg%20width='1200'%20height='1200'%20viewBox='0%200%201200%201200'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='1200'%20height='1200'%20rx='260'%20fill='%239046FF'/%3e%3cmask%20id='mask0_1106_4856'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='272'%20y='202'%20width='655'%20height='796'%3e%3cpath%20d='M926.578%20202.793H272.637V997.857H926.578V202.793Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1106_4856)'%3e%3cpath%20d='M398.554%20818.914C316.315%201001.03%20491.477%201046.74%20620.672%20940.156C658.687%201059.66%20801.052%20970.473%20852.234%20877.795C964.787%20673.567%20919.318%20465.357%20907.64%20422.374C827.637%20129.443%20427.623%20128.946%20358.8%20423.865C342.651%20475.544%20342.402%20534.18%20333.458%20595.051C328.986%20625.86%20325.507%20645.488%20313.83%20677.785C306.873%20696.424%20297.68%20712.819%20282.773%20740.645C259.915%20783.881%20269.604%20867.113%20387.87%20823.883L399.051%20818.914H398.554Z'%20fill='white'/%3e%3cpath%20d='M636.123%20549.353C603.328%20549.353%20598.359%20510.097%20598.359%20486.742C598.359%20465.623%20602.086%20448.977%20609.293%20438.293C615.504%20428.852%20624.697%20424.131%20636.123%20424.131C647.555%20424.131%20657.492%20428.852%20664.447%20438.541C672.398%20449.474%20676.623%20466.12%20676.623%20486.742C676.623%20525.998%20661.471%20549.353%20636.375%20549.353H636.123Z'%20fill='black'/%3e%3cpath%20d='M771.24%20549.353C738.445%20549.353%20733.477%20510.097%20733.477%20486.742C733.477%20465.623%20737.203%20448.977%20744.41%20438.293C750.621%20428.852%20759.814%20424.131%20771.24%20424.131C782.672%20424.131%20792.609%20428.852%20799.564%20438.541C807.516%20449.474%20811.74%20466.12%20811.74%20486.742C811.74%20525.998%20796.588%20549.353%20771.492%20549.353H771.24Z'%20fill='black'/%3e%3c/g%3e%3c/svg%3e",R7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M2%203h3l3%205%203-5h3v10h-2V6.5l-4%206-4-6V13H2V3Z'/%3e%3c/svg%3e",A7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3crect%20fill='none'%20stroke='currentColor'%20stroke-width='1.1'%20x='4.5'%20y='2.5'%20width='7'%20height='10'%20rx='3.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='1'%20x1='3'%20y1='5.5'%20x2='13'%20y2='5.5'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='6.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='none'%20stroke='currentColor'%20stroke-width='1'%20cx='9.5'%20cy='5.5'%20r='1.6'/%3e%3ccircle%20fill='currentColor'%20cx='6.8'%20cy='5.6'%20r='0.55'/%3e%3ccircle%20fill='currentColor'%20cx='9.8'%20cy='5.6'%20r='0.55'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.6'%20stroke-linecap='round'%20d='M7%208.3%20Q8%209%209%208.3'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M4.5%208%20L3%209.5'/%3e%3cpath%20fill='none'%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20d='M11.5%208%20L13%209.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20x1='5'%20y1='9.5'%20x2='11'%20y2='9.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='6.5'%20y1='12.5'%20x2='6.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20x1='9.5'%20y1='12.5'%20x2='9.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='6.5'%20y1='14'%20x2='5.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.9'%20stroke-linecap='round'%20x1='9.5'%20y1='14'%20x2='10.5'%20y2='14'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='7.3'%20y2='0.8'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8'%20y2='0.5'/%3e%3cline%20stroke='currentColor'%20stroke-width='0.7'%20stroke-linecap='round'%20x1='8'%20y1='2.5'%20x2='8.7'%20y2='0.8'/%3e%3c/svg%3e",N7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.8147%205.35803H5.35791V8.46914H8.8147V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%205.35803H19.1851V8.46914H22.6419V5.35803Z'%20fill='currentColor'/%3e%3cpath%20d='M15.7283%2015.7284H12.2715V18.8395H15.7283V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M8.8147%2015.7284H5.35791V18.8395H8.8147V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2015.7284H19.1851V18.8395H22.6419V15.7284Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2715%208.81482H5.35791V11.9259H12.2715V8.81482Z'%20fill='currentColor'/%3e%3cpath%20d='M12.2718%2019.1852H1.90137V22.2963H12.2718V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M26.0989%2019.1852H15.7285V22.2963H26.0989V19.1852Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6419%2012.2716H5.35791V15.3827H22.6419V12.2716Z'%20fill='currentColor'/%3e%3cpath%20d='M22.6421%208.81482H15.7285V11.9259H22.6421V8.81482Z'%20fill='currentColor'/%3e%3c/svg%3e",L7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3ccircle%20cx='8'%20cy='8'%20r='6'%20fill='none'%20stroke='currentColor'%20stroke-width='1'/%3e%3ccircle%20cx='8'%20cy='8'%20r='4.5'%20fill='none'%20stroke='currentColor'%20stroke-width='0.3'%20opacity='0.5'/%3e%3cline%20x1='8'%20y1='8'%20x2='13.5'%20y2='13.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='14.5,14.5%2012.3,13.5%2013.5,12.3'%20fill='currentColor'/%3e%3cline%20x1='8'%20y1='8'%20x2='2.5'%20y2='2.5'%20stroke='currentColor'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cpolygon%20points='1.5,1.5%203.7,2.5%202.5,3.7'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='1.3'%20fill='currentColor'/%3e%3ccircle%20cx='8'%20cy='8'%20r='0.6'%20fill='none'%20stroke='currentColor'%20stroke-width='0.5'%20opacity='0.7'/%3e%3c/svg%3e",B7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%2014H3V2H13V14ZM10.5%204.4H5.5V11.6H10.5V4.4Z'%20fill='currentColor'/%3e%3c/svg%3e",O7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1%201H11.7692V7.9999H8.17942V11.4999H4.58982V15H1V1ZM4.58982%204.50005V7.9999H8.17942V4.50005H4.58982Z'%20fill='currentColor'/%3e%3cpath%20d='M11.7692%207.46154H15V15H11.7692V7.46154Z'%20fill='currentColor'/%3e%3c/svg%3e",z7="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.63653%205.50522L2.18735%205.28559C2.09852%205.46726%202.12787%205.68456%202.26172%205.83616C2.39558%205.98775%202.60757%206.04379%202.79884%205.97814L2.63653%205.50522ZM5.83578%206.94285L5.3732%207.13265L5.5645%207.59886L6.02919%207.40392L5.83578%206.94285ZM10.7441%209.44034L10.2614%209.57083L10.393%2010.0573L10.8784%209.92198L10.7441%209.44034ZM2.5%208.24963C2.4998%207.97349%202.27577%207.74979%201.99963%207.75C1.72349%207.75021%201.4998%207.97423%201.5%208.25037L2.5%208.24963ZM13.4143%2010.7751C12.0197%2013.6273%208.57701%2014.8089%205.72485%2013.4143L5.28559%2014.3126C8.63389%2015.9498%2012.6754%2014.5627%2014.3126%2011.2144L13.4143%2010.7751ZM3.08571%205.72485C4.48031%202.87269%207.92299%201.69111%2010.7751%203.08571L11.2144%202.18735C7.86611%200.550151%203.82455%201.93728%202.18735%205.28559L3.08571%205.72485ZM10.7751%203.08571C13.6273%204.48031%2014.8089%207.92299%2013.4143%2010.7751L14.3126%2011.2144C15.9498%207.86611%2014.5627%203.82455%2011.2144%202.18735L10.7751%203.08571ZM2.79884%205.97814C3.02201%205.90155%203.54835%205.84926%204.09141%206.00587C4.61256%206.15616%205.10736%206.48476%205.3732%207.13265L6.29835%206.75304C5.89213%205.76303%205.11508%205.26032%204.3685%205.04503C3.64385%204.83605%202.9066%204.8839%202.47422%205.0323L2.79884%205.97814ZM6.02919%207.40392C6.25314%207.30998%206.55771%207.25841%206.85281%207.36034C7.13062%207.45631%207.49214%207.72014%207.78743%208.4398L8.71257%208.0602C8.3358%207.14195%207.79046%206.62626%207.17931%206.41515C6.58544%206.21001%206.01893%206.32381%205.64236%206.48177L6.02919%207.40392ZM6.26827%207.19375C6.80493%206.26869%208.18817%204.18684%2011.1653%203.10654L10.8242%202.16652C7.53166%203.36127%205.99463%205.67263%205.40329%206.69195L6.26827%207.19375ZM14.3364%2010.8325C14.1845%2010.39%2013.7564%209.79897%2013.14%209.37995C12.504%208.94759%2011.6302%208.67426%2010.6099%208.9587L10.8784%209.92198C11.5634%209.73102%2012.1368%209.90713%2012.5779%2010.207C13.0385%2010.5201%2013.3174%2010.9441%2013.3905%2011.1571L14.3364%2010.8325ZM11.2268%209.30984C11.1236%208.92833%2010.8783%208.39265%2010.3638%208.02453C9.82769%207.6409%209.08331%207.49864%208.11574%207.76836L8.38426%208.73164C9.1221%208.52595%209.53979%208.66454%209.78189%208.83777C10.0457%209.02651%2010.1946%209.32371%2010.2614%209.57083L11.2268%209.30984ZM11.216%209.60556C11.6225%208.44463%2012.4244%205.47936%2011.4712%202.48487L10.5183%202.78819C11.3726%205.47172%2010.6545%208.18331%2010.2722%209.27512L11.216%209.60556ZM7.80082%208.03037L5.05604%2013.6438L5.9544%2014.0831L8.69918%208.46963L7.80082%208.03037ZM5.72485%2013.4143C3.68742%2012.4181%202.50158%2010.3763%202.5%208.24963L1.5%208.25037C1.50185%2010.7441%202.89229%2013.1424%205.28559%2014.3126L5.72485%2013.4143Z'%20fill='currentColor'/%3e%3c/svg%3e",H7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M8%201C4.134%201%201%204.134%201%208s3.134%207%207%207c1.5%200%202.9-.47%204.05-1.28l1.12%201.12a.75.75%200%201%200%201.06-1.06l-1.12-1.12A6.97%206.97%200%200%200%2015%208c0-3.866-3.134-7-7-7Zm0%202c2.761%200%205%202.239%205%205s-2.239%205-5%205-5-2.239-5-5%202.239-5%205-5Z'/%3e%3c/svg%3e",I7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20data-name='图层%202'%20viewBox='0%200%20141.38%20140'%20width='16'%20height='16'%3e%3cpath%20fill='currentColor'%20d='m140.93%2085-16.35-28.33-1.93-3.34%208.66-15a3.323%203.323%200%200%200%200-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33%203.33%200%200%200-2.89-1.67H51.43c-.59%200-1.17.16-1.66.45-.5.29-.92.71-1.22%201.22L32.19%2029.98l-1.92%203.33H12.96c-.59%200-1.17.16-1.66.45-.5.29-.93.71-1.22%201.22L.45%2051.66a3.323%203.323%200%200%200%200%203.34l18.28%2031.67-8.66%2015a3.32%203.32%200%200%200%200%203.34l9.62%2016.67c.3.51.72.93%201.22%201.22s1.07.45%201.67.45h36.56l8.66%2015a3.35%203.35%200%200%200%202.89%201.67h19.25a3.34%203.34%200%200%200%202.89-1.67l18.28-31.67h17.32c.6%200%201.17-.16%201.67-.45s.92-.71%201.22-1.22l9.62-16.67a3.323%203.323%200%200%200%200-3.34ZM51.44%203.33%2061.07%2020l-9.63%2016.66h76.98l-9.62%2016.66H45.67l-11.54-20zM57.21%20120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62%2016.67L68.78%20100l-11.55%2020Zm61.59-33.34-9.62-16.67-38.49%2066.67-9.63-16.67%209.63-16.66%2026.94-46.67h23.1l17.32%2030z'%20data-name='图层%201'/%3e%3c/svg%3e",U7="/demo/desktop/assets/sigit-DPmZBS3L.svg",P7="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20fill='currentColor'%20d='M6.53%204.412h5.883v3.587H9.471v3.588H3.588V7.999H6.53Z'/%3e%3c/svg%3e",q7="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMC41IDUuNUwyLjUgOCAwLjUgMTAuNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KICA8dGV4dCB4PSIzLjIiIHk9IjExLjUiIGZvbnQtZmFtaWx5PSInU0YgTW9ubycsICdGaXJhIENvZGUnLCAnQ29uc29sYXMnLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMTAiIGZvbnQtd2VpZ2h0PSI2MDAiIGxldHRlci1zcGFjaW5nPSItMC41IiBmaWxsPSJjdXJyZW50Q29sb3IiPlZUPC90ZXh0Pgo8L3N2Zz4=",V7=Object.assign({"../assets/agents/agoragentic-acp.svg":t7,"../assets/agents/amp-acp.svg":i7,"../assets/agents/antigravity-acp.svg":s7,"../assets/agents/auggie.svg":n7,"../assets/agents/autohand.svg":r7,"../assets/agents/claude-acp.svg":a7,"../assets/agents/cline.svg":l7,"../assets/agents/codebuddy-code.svg":o7,"../assets/agents/codex-acp.svg":c7,"../assets/agents/cortex-code.svg":h7,"../assets/agents/corust-agent.svg":u7,"../assets/agents/crow-cli.svg":d7,"../assets/agents/cursor.svg":f7,"../assets/agents/deepagents.svg":p7,"../assets/agents/devin.svg":g7,"../assets/agents/dimcode.svg":m7,"../assets/agents/dirac.svg":v7,"../assets/agents/factory-droid.svg":_7,"../assets/agents/fast-agent.svg":y7,"../assets/agents/gemini.svg":S7,"../assets/agents/github-copilot-cli.svg":x7,"../assets/agents/glm-acp-agent.svg":w7,"../assets/agents/goose.svg":b7,"../assets/agents/grok-build.svg":C7,"../assets/agents/harn.svg":k7,"../assets/agents/junie.svg":E7,"../assets/agents/kilo.svg":M7,"../assets/agents/kimchi.svg":j7,"../assets/agents/kimi.svg":T7,"../assets/agents/kiro.svg":D7,"../assets/agents/minimax-code.svg":R7,"../assets/agents/minion-code.svg":A7,"../assets/agents/mistral-vibe.svg":N7,"../assets/agents/nova.svg":L7,"../assets/agents/opencode.svg":B7,"../assets/agents/pi-acp.svg":O7,"../assets/agents/poolside.svg":z7,"../assets/agents/qoder.svg":H7,"../assets/agents/qwen-code.svg":I7,"../assets/agents/sigit.svg":U7,"../assets/agents/stakpak.svg":P7,"../assets/agents/vtcode.svg":q7}),$7=new Map(Object.entries(V7).map(([e,t])=>[e.split("/").pop().replace(".svg",""),t]));function l1(e){return e?$7.get(e)??null:null}function wS({registry:e,size:t,color:n="currentColor"}){const r=l1(e);return r?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",backgroundColor:n,WebkitMaskImage:`url("${r}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:"terminal",size:t*.8,scaled:!1,color:n})}const W_=e=>e[Math.floor(Math.random()*e.length)];function W7(){return{name:"",description:"",avatarColor:W_(Ah).id,avatarShape:W_(q3),backend:"claude",cwd:"",permission:"auto"}}const e2=e=>!e.id||e.name.trim()!=="",bS=e=>e.backend==="custom"?e:{...e,command:null};function t2(e,t,n){const r={...t},l=e.hello?.backends??[],h=l.find(d=>d.available);return l.find(d=>d.id===r.backend)?.available!==!0&&h&&(r.backend=h.id),r.connectors===void 0&&n.length&&(r.connectors=n.map(d=>d.id)),r}async function CS(e){const t=e.client;if(!t)return{connectors:[],skills:[]};const[n,r]=await Promise.allSettled([t.call("connectors"),t.call("skills")]);return{connectors:n.status==="fulfilled"?n.value.items:[],skills:r.status==="fulfilled"?r.value.items:[]}}function kS(e){const[t,n]=x.useState(null),r=e.connection.kind==="online";return x.useEffect(()=>{let l=!0;return CS(e).then(h=>l&&n(h)),()=>{l=!1}},[e,r]),t}async function F7(e){const{connectors:t}=await CS(e),n=await e.save(t2(e,W7(),t));return e.setSelection(n.id),n}const o1=e=>e.split("/").filter(Boolean).pop()??e,Ar=e=>e instanceof Error?e.message:String(e);function K7({backend:e,selection:t,onChange:n}){const r=Ne(),l=r.connection.kind==="online",[h,d]=x.useState(null),p=x.useRef(null),[g,m]=x.useState(!1),[v,_]=x.useState(null),[S,w]=x.useState(0),b=e==="custom",k=x.useRef(e);x.useEffect(()=>{k.current!==e&&(k.current=e,n(null))},[e,n]),x.useEffect(()=>{const I=`${r.computer.id}/${e}`;if(p.current!==I&&(d(null),p.current=I),_(null),m(!1),b)return;const q=r.client;if(!l||!q){_("Connect to this computer to load its models. You can still enter a model ID.");return}let U=!1;return m(!0),q.call("agentModels",{backend:e},3e5).then(Y=>!U&&d(Y)).catch(Y=>!U&&_(`Couldn't load models: ${Ar(Y)}`)).finally(()=>!U&&m(!1)),()=>{U=!0}},[r.computer.id,r.client,e,l,S,b]);const E=h?.models.find(I=>I.name.toLowerCase().startsWith("default")),j=(h?.models??[]).filter(I=>I.id!==E?.id),V=j.find(I=>I.id===h?.currentModelId)?.name,A=[{id:"",label:E?.name??(V?`Default · ${V}`:"Default")},...j.map(I=>({id:I.id,label:I.name}))];t&&t!==E?.id&&!j.some(I=>I.id===t)&&A.push({id:t,label:t});const z=t===E?.id?"":t??"",F=I=>n(I||null),R=h?.models.length===0;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap"},children:"Model"}),c.jsx("span",{style:{flex:1}}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[b?null:c.jsxs("div",{style:{width:28,height:28,display:"grid",placeItems:"center",flex:"none"},children:[c.jsx("div",{style:{gridArea:"1 / 1",opacity:g?0:1,transition:"opacity var(--fade)",pointerEvents:g?"none":void 0},children:c.jsx(ke,{title:v?"Retry model list":"Refresh model list",icon:"arrow.clockwise",disabled:g,onClick:()=>w(I=>I+1)})}),g?c.jsx("div",{className:"fade-in",style:{gridArea:"1 / 1",display:"flex"},"aria-label":"Loading available models",children:c.jsx(et,{size:12})}):null]}),b||!g&&(!h||R)?c.jsx(K3,{outlined:!0,style:{minWidth:0,maxWidth:160},children:c.jsx("input",{value:z,placeholder:"Default",spellCheck:!1,onChange:I=>F(I.target.value),style:{textAlign:"right",width:142,maxWidth:"100%",minWidth:0,color:"var(--text)",userSelect:"text"}})}):c.jsx("div",{style:{display:"flex",minWidth:0},children:c.jsx(Ci,{selection:z,options:A,onChange:F})})]})]}),!b&&!g&&v?c.jsx("span",{style:{...B("caption"),color:"var(--warning)"},children:v}):!b&&!g&&R?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"This agent doesn't advertise a model list. Leave Default or enter a model ID."}):null,c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"Changing the model starts a new agent session. Chat history is kept."})]})}function Y7({botId:e}){const n=Ne().client,[r,l]=x.useState([]),[h,d]=x.useState(!1),[p,g]=x.useState(!1),m=x.useCallback(async()=>{if(n){try{l((await n.call("memory",{botId:e})).facts)}catch{l([])}d(!0)}},[n,e]);x.useEffect(()=>{m()},[m]);const v=S=>{l(w=>w.filter(b=>b.id!==S.id)),n?.call("forgetMemory",{botId:e,id:S.id}).catch(()=>{}).then(m)},_=()=>{l([]),n?.call("clearMemory",{botId:e}).catch(()=>{}).then(m)};return c.jsxs(c.Fragment,{children:[c.jsxs(Ee,{title:"Memory",accessory:r.length?c.jsx("button",{className:"press",style:{display:"flex",color:"var(--secondary)"},title:"Forget everything","aria-label":"Forget everything",onClick:()=>g(!0),children:c.jsx(ae,{name:"trash",size:12})}):null,children:[r.length?null:c.jsx("span",{style:{color:"var(--secondary)"},children:h?"Nothing yet. The bot remembers who you are and what you work on as you chat.":"Loading…"}),r.map(S=>c.jsxs("div",{className:"fade-in",style:{display:"flex",alignItems:"baseline",gap:10},children:[c.jsx("span",{style:{display:"flex"},title:S.kind==="profile"?"About you":"History",children:c.jsx(ae,{name:S.kind==="profile"?"person":"clock",size:10,color:"var(--tertiary)"})}),c.jsx("span",{className:"selectable",style:{flex:1,minWidth:0,color:"var(--text)"},children:S.content}),c.jsx("button",{className:"press",style:{display:"flex",color:"var(--tertiary)"},title:"Forget","aria-label":"Forget",onClick:()=>v(S),children:c.jsx(ae,{name:"xmark",size:10})})]},S.id))]}),c.jsx(ts,{open:p,title:"Forget everything this bot remembers?",actions:[{title:"Forget everything",destructive:!0,action:_}],onClose:()=>g(!1)})]})}function po({label:e,detail:t,children:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]}),n]})}function i2({title:e,detail:t,on:n,onChange:r}){return c.jsx(rn,{on:n,onChange:r,children:c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.35},children:t}):null]})})}function c1({value:e,onChange:t,placeholder:n,minRows:r,maxRows:l,className:h,onKeyDown:d}){const p=x.useRef(null);return x.useLayoutEffect(()=>{const g=p.current;if(!g)return;const m=getComputedStyle(g),v=parseFloat(m.lineHeight)||15,_=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom);g.style.height="0px",g.style.height=`${Math.min(Math.max(g.scrollHeight,v*r+_),v*l+_)}px`},[e,r,l]),c.jsx("textarea",{ref:p,rows:r,className:h,value:e,placeholder:n,onChange:g=>t(g.target.value),onKeyDown:d})}function ES({bot:e,onRemove:t}){return c.jsxs("span",{className:"bot-chip",children:[c.jsx(Ui,{bot:e,size:20,animated:!1}),c.jsx("span",{style:{...B("body"),color:"var(--text)",maxWidth:220,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),c.jsx("button",{style:{width:18,height:18,display:"grid",placeItems:"center"},"aria-label":`Remove ${e.name}`,title:`Remove ${e.name}`,onClick:t,children:c.jsx(ae,{name:"xmark",size:10,weight:"semibold",color:"var(--secondary)"})})]})}function G7({open:e,onClose:t,anchor:n,children:r}){const{mounted:l,shown:h}=er(e,120),[d,p]=x.useState(null);if(x.useLayoutEffect(()=>{e&&n.current&&p(n.current.getBoundingClientRect())},[e,n]),x.useEffect(()=>{if(!e)return;const w=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),t())};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[e,t]),!l||!d)return null;const g=window.innerWidth,m=window.innerHeight,v=m-d.bottom>=d.top,_=d.left+d.width/2<g*.6,S=Math.max(8,g-Math.min(320,g-16)-8);return Kh.createPortal(c.jsx("div",{className:`anchored ${h?"shown":""}`,onMouseDown:w=>w.target===w.currentTarget&&t(),children:c.jsx("div",{className:"anchored-panel",style:{position:"absolute",[v?"top":"bottom"]:v?d.bottom+6:m-d.top+6,..._?{left:Math.min(Math.max(8,d.left),S)}:{right:Math.min(Math.max(8,g-d.right),S)},transformOrigin:`${v?"top":"bottom"} ${_?"left":"right"}`},children:r})}),document.body)}function Z7({draft:e}){const t=Ne(),n=ss(),r=kS(t),l=!e.id,[h,d]=x.useState(()=>l?t2(t,e,[]):e),[p,g]=x.useState(!1),[m,v]=x.useState(null),_=t.connection.kind==="online";x.useEffect(()=>{l&&r&&d(w=>t2(t,w,r.connectors))},[l,r,t]);const S=()=>{!e2(h)||p||!_||(g(!0),v(null),t.save(bS(h)).then(w=>{n(),l&&t.setSelection(w.id)}).catch(w=>v(Ar(w))).finally(()=>g(!1)))};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:l?"New bot":"Settings",trailing:p?c.jsx(et,{}):c.jsx(ke,{title:l?"Create":"Save",icon:"checkmark",disabled:!e2(h)||p||!_,onClick:S})}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsx(MS,{draft:h,onChange:d,error:m,plugins:r})})]})}function X7({botId:e}){const t=Ne(),n=kS(t),[r,l]=x.useState(null),[h,d]=x.useState(null),p=x.useCallback(g=>l(m=>m&&g(m)),[]);return x.useEffect(()=>{const g=t.bots.get(e);l(g?yo(g):null)},[e]),x.useEffect(()=>{const g=t.bots.get(e);if(!r||!g||JSON.stringify(r)===JSON.stringify(yo(g))||!e2(r))return;const m=setTimeout(()=>{t.save(bS(r)).then(()=>d(null)).catch(v=>d(Ar(v)))},600);return()=>clearTimeout(m)},[r]),r?c.jsx(MS,{draft:r,onChange:p,error:h,plugins:n}):null}function MS({draft:e,onChange:t,error:n,plugins:r}){const l=Ne(),[h,d]=x.useState(!1),[p,g]=x.useState(!1),m=x.useRef(null),v=(E,j)=>t(V=>({...V,[E]:j})),_=x.useCallback(E=>t(j=>({...j,model:E})),[t]),S=l.hello?.backends??[],w=S.find(E=>E.id===e.backend),b=r?.connectors??[],k=r?.skills??[];return c.jsxs("div",{className:"bot-form",children:[c.jsxs("div",{className:"bot-form-content",children:[c.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[c.jsx("button",{ref:m,className:"avatar-button",title:"Edit Bot avatar","aria-label":"Edit Bot avatar",onClick:()=>d(E=>!E),children:c.jsx(nn,{shape:e.avatarShape,color:e.avatarColor,size:56})}),c.jsx(G7,{open:h,onClose:()=>d(!1),anchor:m,children:c.jsx("div",{style:{padding:14,width:300},children:c.jsx(Q7,{shape:e.avatarShape,color:e.avatarColor,onShape:E=>v("avatarShape",E),onColor:E=>v("avatarColor",E)})})})]}),c.jsxs(Ee,{title:"Profile",children:[e.id?c.jsx(po,{label:"Name",children:c.jsx("input",{className:"field-box",value:e.name,placeholder:"Name",onChange:E=>v("name",E.target.value)})}):null,c.jsx(po,{label:"Standing instructions",detail:"Rules that always apply. Put task-specific requests in the chat instead.",children:c.jsx(c1,{className:"field-box",value:e.description,placeholder:"e.g. Reviews PRs. Never pushes without asking.",minRows:3,maxRows:8,onChange:E=>v("description",E)})})]}),c.jsxs(Ee,{title:"Agent",children:[c.jsx(Jt,{label:"Computer",children:c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.hostName})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx(Jt,{label:"Agent",children:c.jsx(Ci,{selection:e.backend,options:[...S.map(E=>({id:E.id,label:E.available?E.name:`${E.name} (not installed)`})),{id:"custom",label:"Custom command"}],onChange:E=>v("backend",E)})}),w&&!w.available?c.jsx("span",{style:{...B("caption"),color:"var(--warning)"},children:w.installHint}):null,e.backend==="custom"?c.jsx("input",{className:"field-box fade-in",style:B("callout",void 0,"monospaced"),value:e.command??"",placeholder:"ACP command, e.g. my-agent --acp",spellCheck:!1,onChange:E=>v("command",E.target.value||null)}):null]}),c.jsx(K7,{backend:e.backend,selection:e.model,onChange:_}),c.jsx(Jt,{label:"Workspace",detail:e.cwd?"This project is the default starting folder. The bot can work elsewhere when you ask.":"This bot has its own space for files. It can work in other folders when you ask.",children:c.jsx(Yh,{title:e.cwd||"A persistent workspace allocated for this bot",items:()=>[{title:"Personal workspace",selected:!e.cwd,action:()=>v("cwd","")},{title:"Choose project folder…",selected:!!e.cwd,action:()=>g(!0)}],children:c.jsxs(K3,{outlined:!0,style:{gap:6,color:"var(--text)"},children:[c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:160},children:e.cwd?o1(e.cwd):"Personal"}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold",color:"var(--secondary)"})]})})}),c.jsx(Jt,{label:"Permissions",detail:e.permission==="auto"?"Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply.":"You'll get an approval card and a notification whenever the agent asks.",children:c.jsx(Ci,{selection:e.permission,options:[{id:"ask",label:"Ask me"},{id:"auto",label:"Approve automatically"}],onChange:E=>v("permission",E)})})]}),c.jsxs(Ee,{title:"Activity",children:[c.jsx(i2,{title:"Notifications",detail:"Get notified when this bot finishes or needs you",on:e.notify??!0,onChange:E=>v("notify",E)}),l.screen?c.jsx(i2,{title:"Use the computer",detail:l.screen.enabled?"Let this bot see the screen and use the mouse and keyboard. You can watch and take over from your phone.":"Let this bot see the screen and use the mouse and keyboard. Turn on Remote screen in Codync's menu on the computer first.",on:e.computer??!1,onChange:E=>v("computer",E)}):null]}),c.jsx(F_,{title:"Connectors",empty:"No connectors yet. Add GitHub, Linear, Notion and more from Plugins.",items:b.map(E=>({id:E.id,name:E.name,detail:E.command??E.url??""})),selection:e.connectors??[],onChange:E=>v("connectors",E)}),c.jsx(F_,{title:"Skills",empty:"No skills yet. Get some from Plugins, or write your own.",items:k.map(E=>({id:E.id,name:E.name,detail:E.description})),selection:e.skills??[],onChange:E=>v("skills",E)}),e.id?c.jsx(Y7,{botId:e.id}):null,n?c.jsx("span",{className:"fade-in",style:{...B("footnote"),color:"var(--danger)"},children:n}):null]}),c.jsx($t,{open:p,onClose:()=>g(!1),width:460,height:520,children:c.jsx(J7,{start:e.cwd||l.hello?.home||null,onPick:E=>{v("cwd",E),g(!1)}})})]})}function F_({title:e,empty:t,items:n,selection:r,onChange:l}){return c.jsxs(Ee,{title:e,children:[n.length?null:c.jsx("span",{style:{color:"var(--secondary)"},children:t}),n.map(h=>c.jsx(i2,{title:h.name,detail:h.detail||null,on:r.includes(h.id),onChange:d=>l([...r.filter(p=>p!==h.id),...d?[h.id]:[]])},h.id))]})}function Q7({shape:e,color:t,onShape:n,onColor:r}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsx("div",{className:"swatch-row",children:q3.map(l=>c.jsx("button",{className:`swatch ${l===e?"on":""}`,"aria-label":`${l} shape`,"aria-pressed":l===e,onClick:()=>n(l),children:c.jsx(nn,{shape:l,color:t,size:36})},l))}),c.jsx("div",{className:"swatch-row",children:Ah.map(l=>c.jsx("button",{className:`swatch ${l.id===t?"on":""}`,"aria-label":l.label,"aria-pressed":l.id===t,onClick:()=>r(l.id),children:c.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:l.hex,display:"block"}})},l.id))})]})}function J7({start:e,onPick:t}){const[n,r]=x.useState([e]),[l,h]=x.useState(!0),d=n[n.length-1]??null;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.length>1?c.jsx("div",{className:"fade-in",style:{paddingLeft:10,display:"flex"},children:c.jsx(ke,{title:"Back",icon:"chevron.left",onClick:()=>{h(!1),r(p=>p.slice(0,-1))}})}):null,c.jsx("div",{style:{flex:1,minWidth:0},children:c.jsx(Lt,{title:d?o1(d):"Folders"})})]}),c.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:c.jsx(e9,{path:d,forward:l,onPick:t,onOpen:p=>{h(!0),r(g=>[...g,p])}},n.length)})]})}function e9({path:e,forward:t,onPick:n,onOpen:r}){const l=Ne(),[h,d]=x.useState(null),[p,g]=x.useState(null),[m,v]=x.useState("");x.useEffect(()=>{let S=!0;return l.listDirs(e).then(w=>S&&d(w)).catch(w=>S&&g(Ar(w))),()=>{S=!1}},[l,e]);const _=h?.dirs.filter(S=>!m||S.name.toLowerCase().includes(m.toLowerCase()))??[];return c.jsx("div",{className:`bot-form level-slide ${t?"from-trailing":"from-leading"}`,children:c.jsxs("div",{className:"bot-form-content",style:{gap:14},children:[c.jsx(WC,{value:m,onChange:v}),h?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{footer:h.path,children:c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,...B("headline"),color:"var(--accent)"},onClick:()=>n(h.path),children:[c.jsx(ae,{name:"checkmark.circle.fill",size:13}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`Use “${o1(h.path)}”`})]})}),_.length?c.jsx(Ee,{children:_.map(S=>c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:10},onClick:()=>r(S.path),children:[c.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:c.jsx(ae,{name:S.isGit?"arrow.triangle.branch":"folder",size:12,color:S.isGit?"var(--accent)":"var(--secondary)"})}),c.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:S.name}),c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},S.path))}):null]}):p?c.jsx("span",{style:{color:"var(--danger)"},children:p}):c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(et,{size:20})})]})})}const t9="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23000'%20fill-rule='evenodd'%20d='M12%201.8C9%201.8%207.6%204.2%207.6%207c0%201.6-.6%202.8-1.6%204.2C4.8%2012.9%204%2014.8%204%2016.8c0%201.2.4%202.2%201%203l-1%201.7c-.2.5.2.9.7.8l3.8-.7c1.1.4%202.3.6%203.5.6s2.4-.2%203.5-.6l3.8.7c.5.1.9-.3.7-.8l-1-1.7c.6-.8%201-1.8%201-3%200-2-.8-3.9-2-5.6-1-1.4-1.6-2.6-1.6-4.2%200-2.8-1.4-5.2-4.4-5.2ZM12%2010.6c-2.4%200-4%202.7-4%205.6%200%202.4%201.7%203.8%204%203.8s4-1.4%204-3.8c0-2.9-1.6-5.6-4-5.6ZM10.4%205.3a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8Zm3.2%200a.9.9%200%201%200%200%201.8.9.9%200%200%200%200-1.8ZM10.9%208.1h2.2L12%209.5Z'/%3e%3c/svg%3e",i9=e=>({laptop:"laptopcomputer",macmini:"macmini",macstudio:"macstudio",imac:"desktopcomputer",macpro:"macpro.gen3"})[e??""]??"desktopcomputer";function Va({computer:e,size:t=36}){const n=e?.color?ko(e.color):"var(--text)";return c.jsx("span",{"aria-hidden":!0,style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none",color:n},children:e?.device==="linux"?c.jsx("span",{style:{width:t*.55,height:t*.55,backgroundColor:n,WebkitMaskImage:`url("${t9}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:i9(e?.device),size:t*.5,weight:"medium"})})}const s9=e=>["pending","starting","running","recovering"].includes(e.status),n9=()=>({kind:"cron",amount:"1",unit:3600,calendarStyle:"daily",weekday:1,selectedDays:[],monthDay:1,minuteStep:15,hour:9,minute:0,at:0,expression:"",zone:"",original:[]}),K_=(e,t)=>!!e&&!!t&&JSON.stringify(e)===JSON.stringify(t),Kn=e=>e instanceof Error?e.message:String(e);function Wn({label:e,detail:t,children:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[c.jsx("span",{style:{color:"var(--text)"},children:e}),t?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",lineHeight:1.4},children:t}):null]}),n]})}function r9({botId:e,routineId:t}){const n=Ne(),[r,l]=x.useState(null),[h,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(null),[_,S]=x.useState(!1),[w,b]=x.useState(!1),k=async V=>{b(V);try{const A=await(await n.ready()).call("routineWebhook",{botId:e,id:t,rotate:V});l(A),V&&(v(null),g(!0)),d(null)}catch(A){d(Kn(A))}finally{b(!1)}};x.useEffect(()=>{k(!1)},[t]);const E=(V,A,z)=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 6px 8px 12px",background:"var(--bubble-user)",borderRadius:12},children:[c.jsx("span",{style:{...B("callout",void 0,"monospaced"),flex:1,minWidth:0,userSelect:"text",wordBreak:"break-all",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:V}),z,c.jsx(ke,{title:m===A?"Copied":"Copy",icon:m===A?"checkmark":"doc.on.doc",onClick:()=>{r&&(window.codync.app.copy(A==="key"?r.key:r.url??r.localUrl),v(A))}})]}),j={...B("caption"),paddingLeft:4,lineHeight:1.4};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[r?c.jsxs(c.Fragment,{children:[c.jsx(Wn,{label:r.url?"URL":"Local URL",children:E(r.url??r.localUrl,"url")}),c.jsx(Wn,{label:"Key",children:E(p?r.key:"•".repeat(16),"key",c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:p?"Hide key":"Show key",icon:p?"eye.slash":"eye",onClick:()=>g(V=>!V)}),c.jsx(ke,{title:"Replace key",icon:"arrow.triangle.2.circlepath",disabled:w||n.isOffline,onClick:()=>S(!0)})]}))}),c.jsx("span",{style:{...j,color:"var(--secondary)"},children:r.url?"POST with Authorization: Bearer <key>. For GitHub, use content type application/json and the key as the secret. Deliveries wait up to 72 hours while this computer is off. They pass through the Codync cloud, which can read them.":"The Codync cloud is off, so only this computer can send to it."})]}):h?c.jsx("span",{style:{...j,color:"var(--danger)"},children:h}):c.jsx("span",{style:{...j,color:"var(--secondary)"},children:"Loading webhook…"}),c.jsx(ts,{open:_,title:"Replace the key?",message:"Senders using the current key stop working until they get the new one.",actions:[{title:"Replace key",destructive:!0,action:()=>{k(!0)}}],onClose:()=>S(!1)})]})}const F0={...B("caption"),paddingLeft:4,lineHeight:1.4};function a9({botId:e,routine:t,saved:n}){const r=Ne(),[l,h]=x.useState(t?.name??""),[d,p]=x.useState(t?.instruction??""),[g,m]=x.useState(n9),[v,_]=x.useState(String(t?.timeoutSeconds??3600)),[S,w]=x.useState(!1),[b,k]=x.useState(null),[E,j]=x.useState(!1),[V,A]=x.useState(!1),[z,F]=x.useState(null),[R,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(!1),[M,N]=x.useState(!1),L=x.useRef(g);L.current=g;const O=t?t.triggers.length===1?!["cron","webhook"].includes(t.triggers[0].type):t.triggers.length>0:!1,P=[...t&&O?[{id:"keep",label:t.triggerDescriptions.join(" · ")}]:[],{id:"cron",label:"Schedule"},{id:"webhook",label:"Webhook"}],te=!!l.trim()&&!!d.trim()&&!r.isOffline&&!S&&V&&K_(q,g)&&R===null,Q=async()=>{try{const le=await(await r.ready()).call("routineSchedule",{triggers:t?.triggers??[],timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}),he={...le.draft,calendarStyle:"custom"};["cron","webhook"].includes(he.kind)||(he.kind="keep"),m(he),F(le),U(le.draft),A(!0),k(null)}catch(J){k(Kn(J))}},ce=async()=>{const J=L.current;F(null),I(null),U(null);try{const le=await(await r.ready()).call("routineSchedule",{draft:J});if(L.current!==J)return;F(le),U(J)}catch(le){if(L.current!==J)return;I(Kn(le))}};x.useEffect(()=>{Q()},[]),x.useEffect(()=>{if(!V)return;const J=setTimeout(()=>{ce()},300);return()=>clearTimeout(J)},[g]);const re=async()=>{if(te){document.activeElement?.blur(),w(!0),k(null);try{const le=await(await r.ready()).call("saveRoutine",{botId:e,id:t?.id??null,name:l,instruction:d,schedule:g,timeoutSeconds:v});n(le.routine)}catch(J){k(Kn(J))}finally{w(!1)}}},de=x.useRef(re);de.current=re,x.useEffect(()=>{const J=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),de.current())};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[]);const Ce=J=>m(le=>({...le,...J})),je=K_(q,g)?z:null,D=()=>{switch(g.kind){case"cron":return c.jsxs("div",{className:"routine-cron",style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{className:"routine-cron-fields",children:[c.jsx(Wn,{label:"Cron",children:c.jsx("input",{className:"routine-input",style:B("body",void 0,"monospaced"),value:g.expression,placeholder:"0 9 * * 1-5",spellCheck:!1,autoCorrect:"off",onChange:J=>Ce({expression:J.target.value})})}),c.jsx(Wn,{label:"Time zone",children:c.jsx("input",{className:"routine-input",value:g.zone,placeholder:"Asia/Taipei",spellCheck:!1,autoCorrect:"off",onChange:J=>Ce({zone:J.target.value})})})]}),c.jsx("div",{style:{paddingLeft:4},children:R?c.jsx("span",{style:{...B("caption"),color:"var(--danger)",lineHeight:1.4},children:R}):je?c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[c.jsx("span",{style:B("caption","medium"),children:je.summary}),je.nextRunAt?c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:["Next ",new Date(je.nextRunAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})]}):null,je.warning?c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:je.warning}):null]}):c.jsx("span",{style:{...B("caption",void 0,"monospaced"),color:"var(--tertiary)",whiteSpace:"pre"},children:"minute hour day month weekday"})})]});case"webhook":return t&&t.triggers.some(J=>J.type==="webhook"||J.type==="event")?c.jsx(r9,{botId:e,routineId:t.id}):c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"Runs each time something is posted to its URL. Save to get the URL and key."});default:return c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"Set up by the bot. Pick Schedule or Webhook to replace it."})}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",maxHeight:700,minHeight:0,background:"var(--background)",color:"var(--text)",...B(13)},children:[c.jsx(Lt,{title:t?"Edit routine":"Set up a routine"}),c.jsx("fieldset",{className:"routine-form",disabled:S||!V,style:{flex:"1 1 auto",minHeight:0,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,padding:20},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[c.jsx(Wn,{label:"Name",children:c.jsx("input",{className:"routine-input",value:l,placeholder:"e.g. Morning summary",onChange:J=>h(J.target.value)})}),c.jsx(Wn,{label:"Instruction",children:c.jsx("textarea",{className:"routine-input",value:d,placeholder:"Describe what this bot should do each time it runs.",onChange:J=>p(J.target.value)})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[c.jsx(Wn,{label:"When to run",children:c.jsx(Ci,{selection:g.kind,options:P,onChange:J=>Ce({kind:J}),fits:!0})}),V?D():c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--secondary)"},children:[c.jsx(ae,{name:"clock",size:12}),"Loading schedule…"]})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsxs("button",{className:"press","aria-expanded":E,onClick:()=>j(J=>!J),style:{display:"flex",alignItems:"center",gap:6,paddingLeft:4,...B("compactSecondary"),color:"var(--secondary)",width:"100%"},children:["Run settings",c.jsx("span",{style:{display:"flex",transform:`rotate(${E?180:0}deg)`,transition:"transform var(--layout)"},children:c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold"})}),c.jsx("span",{style:{flex:1}}),E?null:c.jsxs("span",{style:{color:"var(--tertiary)"},children:["Timeout ",v,"s"]})]}),E?c.jsxs("div",{className:"routine-fade",style:{display:"flex",flexDirection:"column",gap:12},children:[c.jsx(Wn,{label:"Timeout (seconds)",children:c.jsx("input",{className:"routine-input",value:v,placeholder:"3600",onChange:J=>_(J.target.value)})}),c.jsx("span",{style:{...F0,color:"var(--secondary)"},children:"A run is stopped after this long. 1 second to 24 hours."})]}):null]})]})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:20,flex:"none"},children:[R!==null?c.jsx("button",{className:"press",style:{alignSelf:"flex-start"},disabled:r.isOffline,onClick:()=>{ce()},children:"Check schedule again"}):null,!V&&b!==null?c.jsx("button",{className:"press",style:{alignSelf:"flex-start"},onClick:()=>{Q()},children:"Retry loading schedule"}):null,g.kind!=="cron"&&R?c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:R}):null,b?c.jsxs("span",{style:{display:"flex",gap:6,alignItems:"flex-start",...B("callout"),color:"var(--danger)",userSelect:"text"},children:[c.jsx(ae,{name:"exclamationmark.circle",size:12,style:{marginTop:1}}),b]}):null,r.isOffline?c.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center",...B("caption"),color:"var(--danger)"},children:[c.jsx(ae,{name:"wifi.slash",size:10}),"Connect to this computer to save your routine."]}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[t?c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:"Delete routine",icon:"trash",onClick:()=>$(!0)}),c.jsx(ke,{title:M?"Started":"Test run",icon:M?"checkmark":"play.circle",disabled:M||r.isOffline,onClick:async()=>{try{await(await r.ready()).call("runRoutine",{botId:e,id:t.id}),N(!0)}catch(J){k(Kn(J))}}})]}):null,c.jsx("span",{style:{flex:1}}),c.jsxs(Fe,{disabled:!te,onClick:()=>{re()},title:"Save (⌘S)",children:[S?c.jsx(et,{size:12}):null,S?"Saving…":t?"Save changes":"Create routine"]})]})]}),c.jsx(ts,{open:Y,title:"Delete routine?",message:"This deletes the routine and stops its future runs. This can't be undone.",actions:[{title:"Delete routine",destructive:!0,action:async()=>{if(t)try{await(await r.ready()).call("deleteRoutine",{botId:e,id:t.id}),n(null)}catch(J){k(Kn(J))}}}],onClose:()=>$(!1)})]})}function Y_(e){switch(e.status){case"pending":return"Queued";case"starting":return"Starting";case"running":return"Running";case"recovering":return"Resuming after restart";case"failed":return"Failed";case"interrupted":return"Interrupted";default:return e.status.charAt(0).toUpperCase()+e.status.slice(1)}}function l9({botId:e,initialId:t,onClose:n}){const r=Ne(),[l,h]=x.useState([]),[d,p]=x.useState([]),[g,m]=x.useState(null),[v,_]=x.useState(!1),[S,w]=x.useState(!1),[b,k]=x.useState(null),[E,j]=x.useState(null),V=x.useRef(e);V.current=e;const A=Y=>m({id:crypto.randomUUID(),routineId:Y}),z=async()=>{const Y=e;try{const $=await(await r.ready()).call("routines",{botId:Y});if(V.current!==Y)return;h($.routines),p($.runs),_(!0),j(null)}catch($){V.current===Y&&j(Kn($))}};x.useEffect(()=>{t&&A(t)},[t]),x.useEffect(()=>{h([]),p([]),_(!1);let Y=!1,$;const M=async()=>{await z(),Y||($=setTimeout(M,3e3))};return M(),()=>{Y=!0,clearTimeout($)}},[e]);const F=async(Y,$,M)=>{if(!S){w(!0);try{await(await r.ready()).call(Y,{botId:e,id:$.id,enabled:M??null}),k(null),await z()}catch(N){k(Kn(N))}finally{w(!1)}}},R=Y=>{const $=d.find(N=>N.routineId===Y.id&&s9(N));if($)return Y_($);if(Y.lastError)return"Schedule needs attention";const M=d.find(N=>N.routineId===Y.id);return M&&["failed","interrupted"].includes(M.status)?`Last run ${Y_(M).toLowerCase()}`:Y.triggerDescriptions.join(" · ")},I=(Y,$)=>{$&&h(M=>M.some(N=>N.id===$.id)?M.map(N=>N.id===$.id?$:N):[...M,$]),Y.routineId===null&&$&&$.triggers.some(M=>M.type==="webhook")?m({id:Y.id,routineId:$.id}):m(null),z()},q=l.find(Y=>Y.id===g?.routineId)??null,U={background:"var(--surface)",borderRadius:16};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:n?16:10,color:"var(--text)",...B(13)},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx("span",{style:{...B(13,"semibold"),paddingLeft:2},children:"Routines"}),c.jsx("span",{style:{flex:1}}),c.jsx(ke,{title:"Ask the bot for a routine",icon:"text.bubble",disabled:r.isOffline,onClick:()=>{r.setRoutineDraft(e,"I want a routine that "),n?.()}}),c.jsx(ke,{title:"Set up a routine",icon:"plus",disabled:r.isOffline,onClick:()=>A(null)}),n?c.jsx(ke,{title:"Close routines",icon:"xmark",onClick:n}):null]}),E?c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:E}):null,b?c.jsx("span",{style:{...B("caption"),color:"var(--danger)",userSelect:"text"},children:b}):null,l.length===0?c.jsx("div",{style:{...U,...B(12),lineHeight:1.45,color:"var(--secondary)",padding:14},children:v?"No routines yet. Ask the bot for one, or set it up yourself with +.":"Loading routines…"}):c.jsx("div",{style:{...U,padding:"0 14px"},children:l.map((Y,$)=>c.jsxs(x.Fragment,{children:[$>0?c.jsx($C,{}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[c.jsxs("button",{className:"routine-row",onClick:()=>A(Y.id),children:[c.jsx("span",{style:{color:"var(--text)"},children:Y.name}),c.jsx("span",{style:{...B("caption"),color:Y.lastError?"var(--danger)":"var(--secondary)"},children:R(Y)})]}),c.jsx("span",{"aria-label":Y.name,style:{display:"flex"},children:c.jsx(rn,{on:Y.enabled,disabled:S||r.isOffline,onChange:M=>{F("setRoutineEnabled",Y,M)}})})]})]},Y.id))}),c.jsx($t,{open:g!==null&&(g.routineId===null||q!==null),onClose:()=>m(null),width:540,children:g?c.jsx(a9,{botId:e,routine:q,saved:Y=>I(g,Y)},g.id):null})]})}function h1({title:e,icon:t,onClick:n,direction:r=[0,0],size:l=32,className:h}){return c.jsx("button",{className:`mac-chat-button ${h??""}`,title:e,"aria-label":e,onClick:n,style:{width:l,height:l,"--dx":r[0],"--dy":r[1]},children:c.jsx(ae,{name:t,size:l/2,weight:"medium"})})}const G_=window.codync.platform==="darwin";function o9({botId:e,routineId:t,editing:n,setEditing:r,editGroup:l,share:h,close:d}){const g=Ne().bots.get(e)??null,[m,v]=x.useState(!1);let _;return n?_=c.jsxs(c.Fragment,{children:[c.jsx(Gl,{label:"Back to details",symbol:"chevron.left",action:()=>{v(!0),r(!1)}}),c.jsx(K0,{children:"Settings"}),c.jsx("span",{style:{flex:1}})]}):g&&At(g)?_=c.jsxs(c.Fragment,{children:[c.jsx(K0,{children:"Members"}),c.jsx("span",{style:{flex:1}}),c.jsx(Gl,{label:"Edit group",symbol:"gearshape",action:l})]}):_=c.jsxs(c.Fragment,{children:[c.jsx(K0,{children:"Details"}),c.jsx("span",{style:{flex:1}}),c.jsx(Gl,{label:"Create template",symbol:"square.and.arrow.up",action:h}),c.jsx(Gl,{label:"Bot settings",symbol:"gearshape",action:()=>r(!0)})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:54,padding:"0 12px",flex:"none"},children:[_,c.jsx(Gl,{label:"Close details",symbol:"chevron.right.2",action:d})]}),c.jsx("div",{style:{flex:1,minHeight:0,position:"relative",overflow:"hidden"},children:g&&At(g)?c.jsx(c9,{group:g}):n?c.jsx("div",{className:"panel-slide from-trailing",style:{height:"100%"},children:c.jsx(X7,{botId:e})}):c.jsx("div",{className:m?"panel-slide from-leading":void 0,style:{height:"100%",overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28,padding:"4px 16px 24px"},children:[c.jsx(h9,{botId:e}),c.jsx(l9,{botId:e,initialId:t}),g?c.jsx(u9,{bot:g}):null]})})})]})}function K0({children:e}){return c.jsx("span",{style:{...B(15,"semibold"),color:"var(--text)",paddingLeft:4},children:e})}function Gl({label:e,symbol:t,action:n}){return c.jsx(h1,{title:e,icon:t,direction:t==="chevron.right.2"?[1,0]:[0,0],onClick:n})}function c9({group:e}){const t=Ne();return c.jsxs("div",{style:{height:"100%",overflowY:"auto",padding:"0 16px"},children:[c.jsxs("div",{style:{...B(13,"semibold"),paddingBottom:6},children:[e.members.length," bots"]}),t.members(e).map(n=>c.jsxs("button",{className:"press",title:`Open ${n.name}'s own chat`,onClick:()=>t.setSelection(n.id),style:{display:"flex",alignItems:"center",gap:10,padding:"6px 0",width:"100%"},children:[c.jsx(Ui,{bot:n,size:26}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0,flex:1},children:[c.jsx("span",{style:{...B(13),color:"var(--text)"},children:n.name}),c.jsx("span",{style:{...B(11),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Jn(n)?n.activity||"Working…":bo(n)})]})]},n.id))]})}function h9({botId:e}){const t=Ne(),n=t.screen,r=!t.isOffline&&!!n?.enabled&&n.connected&&n.capture,l=n?.enabled?n.connected?n.capture?n.agentBot===e?"cursorarrow.motionlines":"checkmark.circle":"exclamationmark.circle":"arrow.triangle.2.circlepath":"power",h=n?.enabled?n.connected?n.capture?n.agentBot===e?`This bot is using your ${G_?"Mac":"computer"}`:"Ready to connect":"Screen recording permission needed":"Connecting to computer…":"Remote screen is off";return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:16,background:"var(--surface)",borderRadius:16},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[c.jsx(Va,{computer:t.computer,size:32}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[c.jsx("span",{style:{...B(15,"medium"),color:"var(--text)",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:t.hostName}),c.jsx("span",{style:{...B(13),color:"var(--secondary)"},children:"Remote screen"})]})]}),t.isOffline?null:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B(13),color:"var(--text)"},children:[c.jsx(ae,{name:l,size:13}),h]}),r?c.jsxs("div",{style:{...B(12),color:"var(--secondary)",marginTop:-8},children:["View and control this ",G_?"Mac":"computer"," from your iPhone."]}):null]})}function Y0({label:e,children:t,title:n}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,...B(13)},children:[c.jsx("span",{style:{color:"var(--secondary)"},children:e}),c.jsx("span",{style:{flex:1,minWidth:8}}),c.jsx("span",{title:n,style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:6,minWidth:0},children:t})]})}function u9({bot:e}){const t=Ne();return c.jsxs(Ee,{title:"Agent",footer:e.description||null,children:[c.jsxs(Y0,{label:"Runtime",children:[c.jsx(wS,{registry:t.hello?.backends.find(n=>n.id===e.backend)?.registry,size:14}),c.jsx("span",{children:t.backendName(e.backend)})]}),c.jsx(Y0,{label:e.managedWorkspace?"Workspace":"Folder",title:e.managedWorkspace?"Personal workspace, managed by Codync":e.cwd,children:e.managedWorkspace?"Personal":bo(e)}),e.model?c.jsx(Y0,{label:"Model",children:e.model}):null]})}function jS({botId:e,thread:t=null}){const n=Ne(),r=new Map;for(const d of n.allEntries(e))(d.threadId??null)===t&&r.set(d.turn,[...r.get(d.turn)??[],d]);const l=[...r.entries()].sort((d,p)=>d[0]-p[0]),h=x.useRef(null);return x.useLayoutEffect(()=>{const d=h.current;d&&(d.scrollTop=d.scrollHeight)},[]),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:"Full conversation"}),c.jsx("div",{ref:h,style:{flex:1,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,padding:14,fontSize:"calc(12px * var(--scale))"},children:[l.length===0?c.jsx("span",{style:{color:"var(--tertiary)"},children:"Nothing yet."}):null,l.map(([d,p])=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsx("div",{style:{...B("compactSecondary","semibold"),color:"var(--text)",paddingLeft:4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.find(g=>g.kind==="user")?.data.text??`Turn ${d}`}),c.jsx(Ee,{children:p.map(g=>c.jsx(d9,{entry:g},g.id))})]},d))]})})]})}function hh({icon:e,children:t,style:n}){return c.jsxs("span",{style:{display:"flex",alignItems:"flex-start",gap:6,...n},children:[c.jsx("span",{style:{display:"flex",alignItems:"center",minHeight:"1.25em"},children:e}),c.jsx("span",{style:{minWidth:0},children:t})]})}function d9({entry:e}){const[t,n]=x.useState(!1),r=e.data;switch(e.kind){case"user":return c.jsx(hh,{icon:c.jsx(ae,{name:"person.fill",size:11,color:"var(--secondary)"}),style:B("subheadline"),children:c.jsx("span",{style:{color:"var(--text)"},children:r.text??""})});case"agent":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--tertiary)"},children:r.final?"Reply":"Said"}),c.jsx(lS,{text:r.text??""})]});case"thought":return c.jsx(G2,{expanded:t,onToggle:()=>n(l=>!l),label:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B("subheadline"),color:"var(--secondary)"},children:[c.jsx(on,{size:16,color:"var(--secondary)",animated:!1}),"Thinking"]}),children:c.jsx("div",{className:"selectable",style:{...B("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:r.text??""})});case"tool":return c.jsx(p9,{data:r});case"plan":return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx(hh,{icon:c.jsx(ae,{name:"checklist",size:11,weight:"bold"}),style:B("subheadline","bold"),children:"Plan"}),(r.entries??[]).map((l,h)=>c.jsx(hh,{style:B("footnote"),icon:c.jsx(ae,{name:l.status==="completed"?"checkmark.circle.fill":l.status==="in_progress"?"circle.dotted":"circle",size:10,color:l.status==="completed"?"var(--accent)":"var(--tertiary)"}),children:c.jsx("span",{style:{color:"var(--text)",textDecoration:l.status==="completed"?"line-through":void 0},children:l.content})},h))]});case"permission":return c.jsx(hh,{icon:c.jsx(ae,{name:"hand.raised",size:11}),style:{...B("subheadline"),color:"var(--secondary)"},children:r.title??"Approval"});default:return c.jsx("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:r.text??""})}}const f9=e=>({read:"doc.text",edit:"pencil",delete:"trash",move:"arrow.right.doc.on.clipboard",search:"magnifyingglass",execute:"terminal",think:"brain",fetch:"globe"})[e??""]??"wrench.and.screwdriver";function p9({data:e}){const[t,n]=x.useState(!1),r=!!e.output||!!e.diffs?.length,l=c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8,...B("caption"),flex:1,minWidth:0},children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:f9(e.toolKind),size:10})}),c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",flex:1,minWidth:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.title??"Tool"}),e.status==="completed"?c.jsx(ae,{name:"checkmark",size:10,color:"var(--accent)"}):e.status==="failed"?c.jsx(ae,{name:"xmark",size:10,color:"var(--danger)"}):c.jsx(on,{state:e.toolKind==="search"?"searching":e.toolKind==="fetch"?"connecting":"working",size:16,color:"var(--secondary)"})]});return r?c.jsx(G2,{expanded:t,onToggle:()=>n(h=>!h),label:l,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(e.diffs??[]).map((h,d)=>c.jsx(oS,{diff:h},d)),e.output?c.jsx(Wf,{text:e.output}):null]})}):l}function TS(e,t,n){const r=x.useId(),l=e.connection.kind;x.useEffect(()=>{const h=()=>e.setReading(r,t,n,document.visibilityState==="visible"&&document.hasFocus());return h(),window.addEventListener("focus",h),window.addEventListener("blur",h),document.addEventListener("visibilitychange",h),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",h),document.removeEventListener("visibilitychange",h),e.setReading(r,t,n,!1)}},[e,r,t,n,l])}function Z_({botId:e,rootId:t,close:n}){const r=Ne(),l=r.bots.get(e)??null,h=r.allEntries(e).find(b=>b.id===t),d=r.replies(e,t),p=!!l&&$2(l,e,t)&&!r.isOffline,g=Vf(d),m=sS([...g.map(b=>b.id),...p?["working"]:[]],!0),[v,_]=x.useState(!1),S=x.useRef(null);TS(r,e,t),x.useEffect(()=>{r.loadThread(e,t)},[r,e,t]),x.useLayoutEffect(()=>{const b=S.current;b&&(b.scrollTop=b.scrollHeight)},[d.length,d[d.length-1]?.data.text,p]);const w=()=>_(!0);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:48,padding:"0 10px 0 16px",flex:"none"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)"},children:"Thread"}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l?.name??""})]}),c.jsx(ke,{title:"Close thread",icon:"xmark",onClick:n})]}),c.jsx("div",{style:{height:.5,background:"var(--border)",flex:"none"}}),c.jsx("div",{ref:S,style:{flex:1,overflowY:"auto"},children:c.jsxs("div",{style:{padding:"8px 16px 0"},children:[h?c.jsxs(c.Fragment,{children:[c.jsx(Jf,{entry:h,groupStart:!0,chat:l,openTrace:w}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 0"},children:[c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap"},children:d.length===0?"No replies yet":d.length===1?"1 reply":`${d.length} replies`}),c.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]})]}):null,g.map(b=>b.kind==="entry"?c.jsx("div",{className:m.has(b.id)?nS(b):void 0,children:c.jsx(Jf,{entry:b.entry,groupStart:b.groupStart,chat:l,openTrace:w})},b.id):null),l&&p?c.jsx("div",{className:m.has("working")?"row-in":void 0,style:{paddingTop:6},children:c.jsx(yS,{bot:l,thinking:r.currentThinking(e,t)})}):null,c.jsx("div",{style:{height:8}})]})}),c.jsx("div",{style:{flex:"none"},children:r.mismatch?c.jsx("div",{style:{padding:"0 16px 8px"},children:c.jsx(J2,{})}):c.jsx(xS,{botId:e,thread:t})}),c.jsx($t,{open:v,onClose:()=>_(!1),width:620,height:560,children:c.jsx(jS,{botId:e,thread:t})})]})}function g9({group:e,members:t=[]}){const n=Ne(),r=ss(),l=e?.id??null,[h,d]=x.useState(e?.name??""),[p,g]=x.useState(e?.description??""),[m,v]=x.useState(e?.members??t),[_,S]=x.useState(""),[w,b]=x.useState(!1),[k,E]=x.useState(null),[j,V]=x.useState(null),A=m.map(M=>n.bots.get(M)).filter(M=>!!M),z=_.trim().toLowerCase(),F=n.roster.filter(M=>!At(M)&&!m.includes(M.id)&&(!z||M.name.toLowerCase().includes(z))),R=l===null,I=m.length>0&&!w,q=A.length?A.map(M=>M.name).join(", "):"Name",U=l?n.bots.get(l):void 0,Y=M=>{v(N=>N.includes(M)?N.filter(L=>L!==M):[...N,M]),S("")},$=()=>{b(!0),E(null);const N=h.trim()||q,L=p.trim(),O=l?n.updateGroup({id:l,kind:"group",name:N,description:L,members:m,pinned:n.bots.get(l)?.pinned}):n.createGroup(N,L,m);Promise.resolve(O).then(()=>r()).catch(P=>E(Ar(P))).finally(()=>b(!1))};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:R?"New group chat":"Group chat",trailing:w?c.jsx(et,{}):c.jsx(ke,{title:R?"Create":"Save",icon:"checkmark",disabled:!I,onClick:$})}),c.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16,...B("body")},children:[c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Eo,{members:A,size:72})}),c.jsxs(po,{label:`Bots · ${m.length}`,children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[A.length?c.jsx("div",{className:"chip-row",children:A.map(M=>c.jsx(ES,{bot:M,onRemove:()=>Y(M.id)},M.id))}):null,c.jsx("input",{className:"field-box",value:_,placeholder:A.length?"Add another bot":"Search bots",onChange:M=>S(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.nativeEvent.isComposing&&F[0]&&Y(F[0].id)}}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:F.map(M=>c.jsxs("button",{className:"press pick-row fade-in","aria-label":`Add ${M.name}`,onClick:()=>Y(M.id),children:[c.jsx(Ui,{bot:M,size:26,animated:!1}),c.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:M.name}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:bo(M)})]}),c.jsx(ae,{name:"plus.circle",size:20,color:"var(--tertiary)"})]},M.id))})]}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)"},children:"Everyone answers in turn unless you @mention someone. Each bot works in its own folder with its own tools."})]}),c.jsx(po,{label:"Name",children:c.jsx("input",{className:"field-box",value:h,placeholder:q,onChange:M=>d(M.target.value)})}),c.jsx(po,{label:"About",children:c.jsx(c1,{className:"field-box",value:p,placeholder:"What this group works on (optional)",minRows:2,maxRows:5,onChange:g})}),k?c.jsx("span",{className:"fade-in",style:{...B("footnote"),color:"var(--danger)"},children:k}):null,U?c.jsx("div",{style:{paddingTop:8},children:c.jsx(Fe,{kind:"secondary",onClick:()=>V(U),children:"Delete group chat"})}):null]})}),c.jsx(m9,{bot:j,onClose:()=>V(null),onDeleted:r})]})}function m9({bot:e,onClose:t,onDeleted:n}){const r=Ne();return c.jsx(ts,{open:e!==null,title:`Delete ${e?.name??"bot"}?`,message:e&&At(e)?"Its bots and their own chats stay.":"Files it changed on your computer stay as they are.",actions:[{title:"Delete bot and its conversation",destructive:!0,action:()=>{e&&r.delete(e),n()}}],onClose:t})}function v9(e){const{id:t,pinned:n,hidden:r,...l}=e,h=Object.fromEntries(Object.entries(l).filter(([,d])=>d!=null).sort(([d],[p])=>d<p?-1:d>p?1:0));return JSON.stringify(h,null,2).replace(/^(\s*"(?:[^"\\]|\\.)*"): /gm,"$1 : ")}function _9({draft:e}){const t=x.useMemo(()=>v9(e),[e]),[n,r]=x.useState(!1),l=()=>{navigator.clipboard.writeText(t).then(()=>r(!0))};return x.useEffect(()=>{const h=d=>{d.key==="Enter"&&!d.isComposing&&(d.preventDefault(),l())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)}),c.jsxs("div",{style:{width:560,height:540,display:"flex",flexDirection:"column",background:"var(--background)"},children:[c.jsx(Lt,{title:"Create template"}),c.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",gap:20,padding:"0 24px 24px"},children:[c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.name}),c.jsx("span",{style:{...B("callout"),color:"var(--secondary)"},children:"Copy this bot’s settings to reuse as a template. Conversation history and conversation ID are excluded."}),c.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",background:"var(--surface)",borderRadius:12},children:c.jsx("pre",{className:"selectable",style:{...B(12,"regular","monospaced"),margin:0,padding:16,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",flex:1},children:"Includes workspace preferences and agent configuration."}),c.jsxs("button",{className:"press",style:{...B(13,"semibold"),display:"flex",alignItems:"center",gap:6,padding:"9px 14px",color:"var(--on-accent)",background:"var(--accent-fill)",borderRadius:9},onClick:l,children:[c.jsx(ae,{name:n?"checkmark":"square.on.square",size:13,weight:"semibold",className:"fade-in"},n?"checkmark":"square.on.square"),n?"Copied":"Copy template"]})]})]})]})}const y9=["openai","gemini"],Xn={openai:{name:"OpenAI",keyPage:"https://platform.openai.com/api-keys",keyPrompt:"sk-…",defaults:{realtime:"gpt-realtime-2.1",transcribe:"gpt-transcribe",speech:"gpt-4o-mini-tts"},voices:["marin","cedar","alloy","ash","ballad","coral","echo","sage","shimmer","verse"]},gemini:{name:"Gemini",keyPage:"https://aistudio.google.com/apikey",keyPrompt:"AIza…",defaults:{realtime:"gemini-3.8-live",transcribe:"gemini-3.8-flash",speech:"gemini-3.8-flash-tts"},voices:["Kore","Puck","Charon","Fenrir","Aoede","Leda","Orus","Zephyr"]}},DS=e=>e==="openai"||e==="gemini",G0=(e,t)=>e.providers.some(n=>n.provider===t&&n.configured),RS=bi("callEngine","device"),AS=.5,NS=bi("callRate",AS),s2=bi("callPause",1.5),LS=bi("callLanguage","");function S9(e){const t=new Intl.DisplayNames([navigator.language],{type:"language"}),n=r=>{try{return t.of(r.replace("_","-"))??r}catch{return r}};return[{id:"",label:"System"},...e.map(r=>({id:r,label:n(r)})).sort((r,l)=>r.label.localeCompare(l.label))]}const Z0=new Map;function an(e,t){return Z0.has(e)||Z0.set(e,bi(e,t)),Z0.get(e)}const u1=e=>an(`callMode.${e}`,"realtime"),BS=e=>an(`callVoice.${e}`,null),OS=e=>an(`callDefaults.${e}`,null),X_=e=>an(`callModels.${e}`,null),zS={realtime:e=>an(`callModel.${e}`,null),transcribe:e=>an(`callSpeechToText.${e}`,null),speech:e=>an(`callSpeechModel.${e}`,null)},HS=e=>OS(e).get()??Xn[e].defaults;function IS(e,t){t&&OS(e).set(t)}function US(e){for(const t of e.providers)IS(t.provider,t.defaults)}const Js=(e,t)=>zS[t](e).get()??HS(e)[t];function x9(e,t,n){zS[t](e).set(!n||n===HS(e)[t]?null:n)}function PS(e){const t=BS(e).get();return t&&Xn[e].voices.includes(t)?t:Xn[e].voices[0]}const w9=(e,t)=>BS(e).set(t),qS=(e,t)=>`callUsage.${e}.${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}`;function b9(e,t,n=new Date){if(e<=0)return;const r=an(qS(t,n),0);r.set(r.get()+e)}const C9=(e,t=new Date)=>Math.floor((an(qS(e,t),0).get()+59)/60),k9=e=>e.call("voiceStatus"),Q_=(e,t,n)=>e.call("setVoiceKey",{provider:t,key:n},3e4),E9=async(e,t,n,r)=>(await e.call("voiceSession",{provider:t,model:n,voice:r},3e4)).credential,M9=(e,t)=>e.call("voiceModels",{provider:t},3e4),j9=(e,t,n,r,l)=>e.call("voiceSpeak",{provider:t,model:n,voice:r,text:l},9e4),uh=e=>Xn[e].name,T9={openai:600,gemini:150},J_=()=>window.codync.speech.available,Oh=()=>window.codync.platform==="darwin"?"On-device speech isn't available in this build.":"On-device speech isn't available on Linux.",Qi={provider:()=>{const e=RS.get();return DS(e)?e:null},model:e=>Js(e,"realtime"),transcribeModel:e=>Js(e,"transcribe"),speechModel:e=>Js(e,"speech"),voice:PS,isSpeechMode:e=>u1(e).get()==="speech",remember:US,pause:()=>s2.get()>0?s2.get():1.5,rate:()=>NS.get(),language:()=>LS.get()},D9=(e,t)=>b9(Math.floor(e),t);class Gh extends Br{phase="starting";failure=null;level=0;onActivityChanged=null;ended=!1;mutedValue=!1;get isActive(){return this.phase==="listening"||this.phase==="speaking"}get muted(){return this.mutedValue}set muted(t){t!==this.mutedValue&&(this.mutedValue=t,this.mutedChanged(t),this.changed())}mutedChanged(t){}setPhase(t){this.phase=t,this.changed(),this.onActivityChanged?.(!this.ended&&this.isActive)}fail(t){this.end(),this.failure=t,this.setPhase("failed")}}const Yn=e=>e instanceof Error?e.message:String(e),R9="Allow the microphone for Codync in Settings to talk to your bots.";async function VS(){try{return await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(e){throw e instanceof DOMException&&(e.name==="NotAllowedError"||e.name==="SecurityError")?new Error(R9):new Error(`Couldn't use the microphone: ${Yn(e)}`)}}async function $S(e){const t=await VS(),n=new AudioContext({sampleRate:16e3}),r=n.createMediaStreamSource(t),l=n.createScriptProcessor(2048,1,1);return l.onaudioprocess=h=>{const d=h.inputBuffer.getChannelData(0),p=new Int16Array(d.length);let g=0;for(let m=0;m<d.length;m++){const v=Math.max(-1,Math.min(1,d[m]));p[m]=v<0?v*32768:v*32767,g+=v*v}e(p,A9(g,d.length))},r.connect(l),l.connect(n.destination),n.state==="suspended"&&await n.resume(),()=>{l.onaudioprocess=null,r.disconnect(),l.disconnect();for(const h of t.getTracks())h.stop();n.close()}}function A9(e,t){const n=10*Math.log10(Math.max(e/Math.max(t,1),1e-10));return Math.min(1,Math.max(0,(n+50)/50))}function N9(e){const t=e.reduce((d,p)=>d+p.length,0),n=new Uint8Array(44+t*2),r=new DataView(n.buffer),l=(d,p)=>[...p].forEach((g,m)=>r.setUint8(d+m,g.charCodeAt(0)));l(0,"RIFF"),r.setUint32(4,36+t*2,!0),l(8,"WAVEfmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,16e3,!0),r.setUint32(28,32e3,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),l(36,"data"),r.setUint32(40,t*2,!0);let h=44;for(const d of e)for(let p=0;p<d.length;p++,h+=2)r.setInt16(h,d[p],!0);return n}function WS(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function FS(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function zh(e){const t=[[/```[\s\S]*?```/g,""],[/!?\[([^\]]*)\]\([^)]*\)/g,"$1"],[/`([^`]*)`/g,"$1"],[/^\s{0,3}(#{1,6}|>|[-*+]|\d+\.)\s+/gm,""],[/(\*\*|\*|~~)(\S[^\n]*?)\1/g,"$2"],[/^[ \t]*\|?[ \t:|-]{3,}\|?[ \t]*$/gm,""],[/^[ \t]*\|[ \t]*|[ \t]*\|[ \t]*$/gm,""],[/[ \t]*\|[ \t]*/g,", "],[/\n{2,}/g,`
-`]];let n=e;for(const[r,l]of t)n=n.replace(r,l);return n.trim()}const KS=window.codync.platform==="darwin",go=KS?"this Mac":"this computer";function $a({show:e,children:t,style:n}){const{mounted:r,shown:l}=er(e);return r?c.jsx("div",{className:`settings-reveal ${l?"shown":""}`,style:n,children:c.jsx("div",{children:t})}):null}function ey({title:e,children:t}){return c.jsxs("div",{className:"settings-section-header",children:[c.jsx("span",{role:"heading","aria-level":3,style:{...B(13,"semibold"),color:"var(--text)"},children:e}),c.jsx("span",{style:{flex:1}}),t]})}const Wa=e=>e instanceof Error?e.message:typeof e=="object"&&e&&"message"in e?String(e.message):String(e);function YS(e,t=new Date){const n=l=>new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime(),r=Math.round((n(t)-n(e))/864e5);return r===0?e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):r===1?"Yesterday":t.getTime()-e.getTime()<6*864e5?e.toLocaleDateString(void 0,{weekday:"long"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function n2(e){const t=e.connection;switch(t.kind){case"online":return e.mismatch?"Needs update":"Online";case"connecting":return"Connecting…";case"computerOffline":return t.lastSeen?`Offline · seen ${YS(new Date(t.lastSeen))}`:"Offline";case"offline":return"Can't reach";case"unauthorized":return t.message;case"unpaired":return"Not paired"}}const Hh=e=>e.connection.kind==="online"?e.client:null,L9=e=>e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e;function d1({showsHeader:e=!0}){const[t,n]=ni(RS),[r,l]=ni(NS),[h,d]=ni(LS),p=x.useMemo(()=>S9(window.codync.speech.locales()),[]),g=DS(t)?t:null,[m,v]=ni(u1(g??"openai")),_=g?`Your own ${Xn[g].name} key, billed by ${Xn[g].name}. Applies from the next call.`:window.codync.speech.available?"On-device speech, on this computer. Applies from the next call.":Oh();return c.jsxs("div",{style:{display:"flex",flexDirection:"column",background:"var(--background)",width:e?440:void 0,height:e?600:"100%"},children:[e?c.jsx(Lt,{title:"Voice chat"}):null,c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsxs(hi,{children:[c.jsx(Ee,{title:"Voice",footer:_,children:[c.jsx(Jt,{label:"Engine",children:c.jsx(Ci,{selection:t,options:[...window.codync.speech.available||t==="device"?[{id:"device",label:"On device"}]:[],...y9.map(S=>({id:S,label:Xn[S].name}))],onChange:n})},"engine"),...g?[c.jsx(Jt,{label:"Mode",detail:m==="speech"?"Sent when you pause, replies read aloud.":"A live conversation. Talk over replies.",children:c.jsx(Ci,{selection:m,options:[{id:"realtime",label:"Realtime"},{id:"speech",label:"Speech"}],onChange:v})},"mode"),...m==="speech"?[c.jsx(ty,{},"pause")]:[]]:[c.jsx(Jt,{label:"Language",detail:"The language you speak in calls.",children:c.jsx(Ci,{selection:h,options:p,onChange:d})},"language"),c.jsx(Jt,{label:"Reading speed",children:c.jsx(Ci,{selection:r,options:[{id:.42,label:"Slower"},{id:AS,label:"Normal"},{id:.56,label:"Faster"}],onChange:l})},"rate"),c.jsx(ty,{},"pause")]]}),g?c.jsx(B9,{provider:g},g):null]})})]})}function ty(){const[e,t]=ni(s2);return c.jsx("div",{className:"settings-appear",children:c.jsx(Jt,{label:"Send after a pause of",detail:"Longer leaves time to think mid-sentence.",children:c.jsx(Ci,{selection:e,options:[{id:1,label:"1 s"},{id:1.5,label:"1.5 s"},{id:2.5,label:"2.5 s"}],onChange:t})})})}function B9({provider:e}){const t=Ne(),n=Xn[e],[r]=ni(u1(e)),[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(""),[v,_]=x.useState(!1),[S,w]=x.useState(null),[b,k]=x.useState(()=>PS(e)),[E,j]=x.useState(()=>Js(e,"realtime")),[V,A]=x.useState(()=>Js(e,"transcribe")),[z,F]=x.useState(()=>Js(e,"speech")),[R,I]=x.useState(()=>X_(e).get()??{models:[],transcribe:[],speech:[]}),q=x.useRef(!1),U=r==="speech",Y=l===!0,$={ok:!1,text:`Not connected to ${t.hostName}.`},M=async re=>{let de;try{de=await M9(re,e)}catch{return}I(de),IS(e,de.defaults),j(Js(e,"realtime")),A(Js(e,"transcribe")),F(Js(e,"speech")),X_(e).set(de)};x.useEffect(()=>{let re=!1;return(async()=>{const de=Hh(t);if(!de)return h(!1),w($);let Ce;try{const je=await k9(de);US(je),Ce=G0(je,e)}catch(je){return re?void 0:(h(!1),w({ok:!1,text:Wa(je)}))}re||(h(Ce),Ce&&await M(de))})(),()=>{re=!0}},[e]);const N=(re,de)=>Ce=>{de(Ce),x9(e,re,Ce)},L=re=>{if(q.current)return;const de=Hh(t);if(!de)return w($);q.current=!0,_(!0),w(null),re(de).catch(Ce=>w({ok:!1,text:Wa(Ce)})).finally(()=>{q.current=!1,_(!1)})},O=()=>{const re=g.trim();!re&&!Y||L(async de=>{!re||!d&&Y?(U?await j9(de,e,z,b,"OK"):await E9(de,e,E,b),w({ok:!0,text:"Key works"})):(h(G0(await Q_(de,e,re),e)),m(""),p(!1),w({ok:!0,text:`Key works and is saved on ${t.hostName}`})),await M(de)})},P=()=>L(async re=>{h(G0(await Q_(re,e,""),e)),w(null)}),te=(re,de,Ce)=>{const je=de.includes(re)?de:[re,...de];return c.jsx(Ci,{selection:re,options:je.map(D=>({id:D,label:D})),onChange:Ce})},Q={opacity:Y?1:.55,pointerEvents:Y?void 0:"none",transition:"opacity var(--layout)"},ce=c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[Y&&!d?c.jsxs("div",{className:"settings-row",children:[c.jsx(ae,{name:"key.fill",size:13,color:"var(--secondary)"}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:{color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Key saved"}),c.jsxs("span",{style:{...B("caption"),color:"var(--tertiary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["Stays on ",t.hostName]})]}),v?c.jsx(et,{}):c.jsxs(c.Fragment,{children:[c.jsx(ke,{title:"Test key",icon:"checkmark.seal",onClick:O}),c.jsx(ke,{title:"Replace key",icon:"pencil",onClick:()=>{p(!0),w(null)}}),c.jsx(ke,{title:"Remove key",icon:"trash",onClick:P})]})]}):c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("div",{className:"settings-row",style:{gap:8},children:[c.jsx("input",{type:"password","aria-label":"API key",placeholder:n.keyPrompt,value:g,spellCheck:!1,autoComplete:"off",style:{flex:1,minWidth:0},onChange:re=>m(re.target.value),onKeyDown:re=>re.key==="Enter"&&O()}),v?c.jsx(et,{}):c.jsx(Fe,{onClick:O,disabled:!g.trim(),children:"Save"})]}),c.jsxs("div",{className:"settings-row",style:B("footnote"),children:[c.jsxs("button",{style:{color:"var(--text)",textDecoration:"underline"},onClick:()=>window.codync.app.openExternal(n.keyPage),children:["Get a key from ",n.name]}),c.jsx("span",{style:{flex:1}}),d?c.jsx("button",{style:{color:"var(--secondary)"},onClick:()=>{p(!1),m(""),w(null)},children:"Cancel"}):null]})]}),c.jsx($a,{show:S!==null,children:S?c.jsxs("span",{style:{...B("footnote"),display:"flex",alignItems:"center",gap:5,color:S.ok?"var(--secondary)":"var(--danger)"},children:[c.jsx(ae,{name:S.ok?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10}),S.text]}):null})]},"key");return c.jsx(Ee,{title:n.name,footer:Y?null:`Add a key to choose from ${n.name}'s models.`,children:[ce,...U?[c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Speech to text",children:te(V,R.transcribe,N("transcribe",A))})},"stt"),c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Text to speech",children:te(z,R.speech,N("speech",F))})},"tts")]:[c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Model",children:te(E,R.models,N("realtime",j))})},"model")],c.jsx("div",{style:Q,children:c.jsx(Jt,{label:"Voice",children:c.jsx(Ci,{selection:b,options:n.voices.map(re=>({id:re,label:re})),onChange:re=>{k(re),w9(e,re)}})})},"voice"),c.jsx("div",{style:Q,children:c.jsxs(Jt,{label:"This month",children:["≈ ",C9(e)," min"]})},"minutes")]})}const GS=[{name:"send_to_bot",description:"Send a message to the bot on the computer, exactly as if the user typed it. Its reply arrives later.",parameters:{type:"object",properties:{text:{type:"string",description:"The message"}},required:["text"]}},{name:"bot_status",description:"Whether the bot is idle or working, what it is doing, and any approval it is waiting for.",parameters:{type:"object",properties:{}}},{name:"recent_messages",description:"The latest messages in the chat with the bot, oldest first.",parameters:{type:"object",properties:{count:{type:"integer",description:"How many, 1–20"}}}},{name:"answer_approval",description:"Answer the bot's pending approval request with one of its options.",parameters:{type:"object",properties:{option:{type:"string",description:"The option's name"}},required:["option"]}}];class O9{constructor(t,n){this.store=t,this.botId=n}store;botId;get instructions(){const t=this.store.bots.get(this.botId),n=t?.name??"the bot",r=t?.description?` (${t.description})`:"";return[`You are the voice on a phone call between the user and ${n}${r}, a coding agent running on the user's computer. ${n} does all the actual work; you relay.`,"- When the user asks for something to be done, changed, checked or answered about their code or computer, call send_to_bot with their request in their own words (keep details, names and code terms exactly). Don't do the work or invent results yourself.",'- Use bot_status and recent_messages for "what are you doing?" or "what did it say?".',"- Call answer_approval only after the user has clearly said which option to pick.",`- Messages starting with [${n} replied] or [Notice] come from the computer: tell the user what they say, shortened for speech (no code blocks, no long lists, no URLs).`,"- Reply in the user's language. Keep spoken answers short and natural."].join(`
-`)}call(t,n){let r;switch(t){case"send_to_bot":r=this.send(typeof n.text=="string"?n.text:"");break;case"bot_status":r=this.status();break;case"recent_messages":r=this.recent(typeof n.count=="number"?Math.trunc(n.count):6);break;case"answer_approval":r=this.answer(typeof n.option=="string"?n.option:"");break;default:r={error:`Unknown tool ${t}.`}}return JSON.stringify(r)}reply(t){return`[${this.store.bots.get(this.botId)?.name??"Bot"} replied] ${zh(t)}`}notice(t){return`[Notice] ${t}`}send(t){const n=t.trim();return n?(this.store.send(n,this.botId),{sent:!0,note:"The bot's reply will arrive as a separate message."}):{error:"Nothing to send."}}status(){const t=this.store.bots.get(this.botId);if(!t)return{error:"The bot isn't available."};const n={status:t.status,activity:t.activity},r=this.pendingApproval;return r&&(n.approval={request:r.data.title??r.data.command??"",options:(r.data.options??[]).map(l=>l.name)}),n}recent(t){const n=this.store.bots.get(this.botId)?.name??"bot",r=Math.min(Math.max(t,1),20);return{messages:this.store.chat(this.botId).filter(_o).slice(-r).map(h=>({from:h.kind==="user"?"user":h.kind==="agent"?n:h.kind==="permission"?"approval request":"notice",text:zh(h.data.text??h.data.title??"")}))}}answer(t){const n=this.pendingApproval;if(!n)return{error:"Nothing is waiting for approval."};const r=n.data.options??[],l=t.toLowerCase(),h=r.find(d=>d.name.toLowerCase()===l||d.optionId===t)??r.find(d=>d.name.toLowerCase().includes(l)||l.includes(d.name.toLowerCase()));return h?(this.store.respond(n,h.optionId),{answered:h.name}):{error:"No such option.",options:r.map(d=>d.name)}}get pendingApproval(){return this.store.chat(this.botId).findLast(t=>t.kind==="permission"&&t.data.status==="pending")}}const z9=.3,H9=16e3*3/10,I9=16e3*20,U9=16e3*4/10;function P9(e,t){const n=[];let r="",l="";const h=()=>{const p=r.trim();p&&n.push(p),r=""},d=p=>{[...r].length+[...p].length>t&&h();let g=[...p];for(;g.length>t;)n.push(g.slice(0,t).join("")),g=g.slice(t);r+=g.join("")};for(const p of e)l+=p,`.!?。!?
-`.includes(p)&&(d(l),l="");return d(l),h(),n}class q9 extends Gh{constructor(t,n){super(),this.provider=t,this.speech=n,this.chunk=T9[t]}provider;speech;stopMic=null;chunk;preroll=[];prerollSamples=0;utterance=[];utteranceSamples=0;speaking=!1;quietSince=null;voiced=0;deafUntil=0;transcribing=Promise.resolve();queue=[];player=null;next=null;speakGeneration=0;async start(){try{const t=await $S((n,r)=>this.heard(n,r));if(this.ended)return t();this.stopMic=t}catch(t){return this.fail(Yn(t))}this.setPhase("listening")}end(){this.ended=!0,this.onActivityChanged?.(!1),this.stopSpeaking(),this.stopMic?.(),this.stopMic=null}mutedChanged(t){t&&this.dropUtterance()}interrupt(){this.phase==="speaking"&&(this.stopSpeaking(),this.setPhase("listening"))}speak(t){this.say(zh(t))}announce(t){this.say(t)}heard(t,n){if(!(this.ended||this.muted||this.phase!=="listening"||Date.now()<this.deafUntil))if(this.level=n,n>z9?(this.speaking=!0,this.quietSince=null,this.voiced+=t.length):this.speaking&&this.quietSince===null&&(this.quietSince=Date.now()),this.speaking)this.utterance.push(t),this.utteranceSamples+=t.length,(this.quietSince!==null&&Date.now()-this.quietSince>=Qi.pause()*1e3||this.utteranceSamples>=I9)&&this.submit();else for(this.preroll.push(t),this.prerollSamples+=t.length;this.preroll.length>1&&this.prerollSamples-this.preroll[0].length>=H9;)this.prerollSamples-=this.preroll.shift().length}submit(){const t=N9([...this.preroll,...this.utterance]),n=this.voiced>=U9;this.dropUtterance(),n&&(this.transcribing=this.transcribing.then(async()=>{try{const r=(await this.speech.transcribe(t)).trim();!this.ended&&r&&this.speech.send(r)}catch(r){console.error("transcribe:",Yn(r)),this.ended||this.fail(Yn(r))}}))}dropUtterance(){this.preroll=[],this.prerollSamples=0,this.utterance=[],this.utteranceSamples=0,this.speaking=!1,this.quietSince=null,this.voiced=0,this.level=0}say(t){this.ended||this.phase==="failed"||this.phase==="starting"||!t||(this.queue.push(...P9(t,this.chunk)),!this.player&&!this.next&&this.playNext())}playNext(){if(this.ended)return;const t=this.speakGeneration,n=this.next??this.fetch(this.queue.shift()??null);this.next=null,n.then(r=>{if(!(t!==this.speakGeneration||this.ended)){if(!r)return this.finishedSpeaking();this.play(r),this.queue.length&&(this.next=this.fetch(this.queue.shift()))}})}async fetch(t){if(t===null)return null;try{return await this.speech.speak(t)}catch(n){return console.error("speak:",Yn(n)),null}}play(t){const n=t.format==="aac"?"audio/aac":t.format==="wav"?"audio/wav":`audio/${t.format}`,r=URL.createObjectURL(new Blob([t.audio],{type:n})),l=new Audio(r),h=this.speakGeneration;let d=!1;const p=()=>{d||(d=!0,URL.revokeObjectURL(r),this.played(h))};l.onended=p,l.onerror=()=>{console.error("play: unreadable clip"),p()},this.player=l,this.dropUtterance(),this.setPhase("speaking"),l.play().catch(()=>l.onerror?.(new Event("error")))}played(t){t===this.speakGeneration&&(this.player=null,!this.queue.length&&!this.next?this.finishedSpeaking():this.playNext())}finishedSpeaking(){this.player=null,this.deafUntil=Date.now()+400,this.phase==="speaking"&&this.setPhase("listening")}stopSpeaking(){this.speakGeneration++,this.queue=[],this.next=null,this.player&&(this.player.onended=null,this.player.onerror=null,this.player.pause(),URL.revokeObjectURL(this.player.src)),this.player=null}}const V9="wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained";function ZS(e){const t={};for(const[n,r]of Object.entries(e))n==="type"&&typeof r=="string"?t[n]=r.toUpperCase():n==="properties"&&r&&typeof r=="object"?t[n]=Object.fromEntries(Object.entries(r).map(([l,h])=>[l,ZS(h)])):t[n]=r;return t}class $9 extends Gh{constructor(t,n,r,l){super(),this.model=t,this.voice=n,this.credential=r,this.op=l}model;voice;credential;op;provider="gemini";socket=null;ready=!1;resumeHandle=null;reconnects=0;stopMic=null;output=null;sources=new Set;nextStart=0;queued=0;playGeneration=0;turnDone=!0;dropping=!1;pending=[];async start(){await this.connect()}async connect(){try{const t=await this.credential();if(this.ended)return;const n=new WebSocket(`${V9}?access_token=${encodeURIComponent(t)}`);n.binaryType="arraybuffer",this.socket=n,this.ready=!1,n.onopen=()=>this.sendSetup(n),n.onmessage=r=>{this.socket===n&&this.received(typeof r.data=="string"?r.data:new TextDecoder().decode(r.data))},n.onclose=r=>this.closed(n,r.reason)}catch(t){this.ended||this.fail(Yn(t))}}sendSetup(t){const n=GS.map(l=>({name:l.name,description:l.description,...Object.keys(l.parameters.properties).length?{parameters:ZS(l.parameters)}:{}})),r={model:`models/${this.model}`,generationConfig:{responseModalities:["AUDIO"],speechConfig:{voiceConfig:{prebuiltVoiceConfig:{voiceName:this.voice}}}},systemInstruction:{parts:[{text:this.op.instructions}]},tools:[{functionDeclarations:n}],contextWindowCompression:{slidingWindow:{}},sessionResumption:this.resumeHandle?{handle:this.resumeHandle}:{}};this.send({setup:r},t)}end(){this.ended=!0,this.onActivityChanged?.(!1);const t=this.socket;this.socket=null,t?.close(1e3),this.stopPlayback(),this.stopMic?.(),this.stopMic=null,this.output?.close(),this.output=null}mutedChanged(t){this.level=0,t&&this.send({realtimeInput:{audioStreamEnd:!0}})}interrupt(){this.phase==="speaking"&&(this.stopPlayback(),this.dropping=!this.turnDone,this.setPhase("listening"))}speak(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.reply(t)),this.flush())}announce(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.notice(t)),this.flush())}closed(t,n){this.ended||this.socket!==t||(this.socket=null,this.ready=!1,this.resumeHandle&&this.reconnects<3?(this.reconnects++,this.connect()):this.fail(n||"Lost the connection to Gemini."))}received(t){if(this.ended)return;let n;try{n=JSON.parse(t)}catch{return}n.setupComplete!==void 0&&(this.ready=!0,this.reconnects=0,this.stopMic||this.startAudio(),this.phase==="starting"&&this.setPhase("listening"),this.flush());const r=n.serverContent;if(r){r.interrupted===!0&&(this.stopPlayback(),this.dropping=!1,this.phase==="speaking"&&this.setPhase("listening"));const d=r.modelTurn?.parts;if(Array.isArray(d)){this.turnDone=!1;for(const p of d){const g=p?.inlineData?.data;typeof g=="string"&&!this.dropping&&this.play(g)}}r.turnComplete===!0&&(this.turnDone=!0,this.dropping=!1,this.queued===0&&this.phase==="speaking"&&this.setPhase("listening"),this.flush())}const l=n.toolCall?.functionCalls;if(Array.isArray(l)){const d=l.filter(p=>typeof p?.id=="string"&&typeof p?.name=="string").map(p=>{const g=this.op.call(p.name,p.args??{});return{id:p.id,name:p.name,response:{result:JSON.parse(g)}}});this.send({toolResponse:{functionResponses:d}})}const h=n.sessionResumptionUpdate;h?.resumable===!0&&typeof h.newHandle=="string"&&(this.resumeHandle=h.newHandle),n.goAway!==void 0&&this.socket?.close(1e3)}send(t,n){const r=n??(this.ready?this.socket:null);r?.readyState===WebSocket.OPEN&&r.send(JSON.stringify(t))}flush(){if(!this.ready||!this.turnDone||this.queued!==0||!this.pending.length)return;const t=this.pending.join(`
-
-`);this.pending=[],this.turnDone=!1,this.send({clientContent:{turns:[{role:"user",parts:[{text:t}]}],turnComplete:!0}})}async startAudio(){try{this.output=new AudioContext({sampleRate:24e3});const t=await $S((n,r)=>this.captured(n,r));if(this.ended)return t();this.stopMic=t}catch(t){this.ended||this.fail(Yn(t))}}captured(t,n){this.ended||this.muted||!this.isActive||(this.level=this.phase==="speaking"?0:n,this.send({realtimeInput:{audio:{data:WS(new Uint8Array(t.buffer)),mimeType:"audio/pcm;rate=16000"}}}))}play(t){const n=this.output;if(!n)return;const r=FS(t),l=r.length>>1;if(!l)return;const h=new DataView(r.buffer),d=n.createBuffer(1,l,24e3),p=d.getChannelData(0);for(let v=0;v<l;v++)p[v]=h.getInt16(v*2,!0)/32768;const g=n.createBufferSource();g.buffer=d,g.connect(n.destination),this.nextStart=Math.max(this.nextStart,n.currentTime),g.start(this.nextStart),this.nextStart+=d.duration,this.sources.add(g),this.queued++,this.level=0,this.phase!=="speaking"&&this.setPhase("speaking");const m=this.playGeneration;g.onended=()=>{this.sources.delete(g),this.played(m)}}played(t){t!==this.playGeneration||this.ended||(this.queued=Math.max(0,this.queued-1),!(this.queued!==0||!this.turnDone)&&(this.phase==="speaking"&&this.setPhase("listening"),this.flush()))}stopPlayback(){this.playGeneration++,this.queued=0,this.nextStart=0;for(const t of this.sources){t.onended=null;try{t.stop()}catch{}}this.sources.clear()}}function W9(e){const t=l=>e.match(l)?.length??0,n=t(/[A-Za-z]/g),r=navigator.language;if(t(/[぀-ヿ]/g)>0)return"ja";if(t(/[가-힯]/g)>n/3)return"ko";if(t(new RegExp("\\p{Script=Han}","gu"))>n/3){const l=navigator.languages.find(h=>h.startsWith("zh"));return l?/Hant|TW|HK|MO/.test(l)?/HK/.test(l)?"zh-HK":"zh-TW":"zh-CN":"zh-TW"}return/^(zh|ja|ko)/.test(r)?"en":r.split("-")[0]}function F9(e){const t=W9(e),n=speechSynthesis.getVoices().filter(l=>l.lang.replace("_","-").startsWith(t)),r=l=>(l.lang.replace("_","-")===navigator.language?4:0)+(/premium|enhanced/i.test(l.name)?2:0)+(l.localService?1:0);return n.sort((l,h)=>r(h)-r(l))[0]??null}class K9 extends Gh{constructor(t){super(),this.send=t}send;provider=null;heard="";recognizing=!1;started=!1;everStarted=!1;lastRestart=0;silence=null;offEvents=null;speakGeneration=0;async start(){if(!window.codync.speech.available)return this.fail(Oh());speechSynthesis.getVoices(),this.offEvents=window.codync.speech.onEvent(t=>this.event(t)),this.listen()}end(){this.ended=!0,this.onActivityChanged?.(!1),this.stopListening(),this.offEvents?.(),this.offEvents=null,this.speakGeneration++,speechSynthesis.cancel()}mutedChanged(t){this.phase==="listening"&&(t?this.stopListening():this.listen())}speak(t){const n=zh(t);if(this.ended||!n||this.phase==="starting"||this.phase==="failed")return;this.stopListening(),this.setPhase("speaking");const r=++this.speakGeneration;speechSynthesis.cancel();const l=new SpeechSynthesisUtterance(n),h=F9(n);h&&(l.voice=h,l.lang=h.lang);const d=Qi.rate();l.rate=d>0?Math.min(10,Math.max(.1,d/.5)):1,l.onend=()=>r===this.speakGeneration&&this.finishedSpeaking(),l.onerror=()=>r===this.speakGeneration&&this.finishedSpeaking(),speechSynthesis.speak(l)}announce(t){this.speak(t)}interrupt(){this.phase==="speaking"&&(this.speakGeneration++,speechSynthesis.cancel(),this.listen())}listen(){this.heard="",this.phase!=="listening"&&this.everStarted&&this.setPhase("listening"),!(this.muted||this.ended)&&(this.recognizing=!0,this.started=!1,window.codync.speech.start(Qi.language()||null))}stopListening(){this.silence&&clearTimeout(this.silence),this.silence=null,this.recognizing&&window.codync.speech.stop(),this.recognizing=!1,this.started=!1,this.level=0}event(t){if(!(this.ended||!this.recognizing))switch(t.type){case"started":this.started=!0,this.everStarted||(this.everStarted=!0,this.setPhase("listening"));break;case"level":this.phase==="listening"&&(this.level=t.value);break;case"partial":case"final":this.recognized(t.text,t.type==="final");break;case"error":if(!this.started)return this.fail(t.message);this.restart(t.message);break;case"stopped":if(!this.started)return this.fail("Speech recognition stopped.");this.restart("Speech recognition stopped.");break}}restart(t){if(Date.now()-this.lastRestart<1e3)return this.fail(t);this.lastRestart=Date.now(),this.submit()}recognized(t,n){if(this.phase==="listening"){if(this.heard=t,this.silence&&clearTimeout(this.silence),n)return this.submit();this.silence=setTimeout(()=>this.submit(),Qi.pause()*1e3)}}submit(){const t=this.heard.trim();this.stopListening(),t&&this.send(t),this.listen()}finishedSpeaking(){this.phase==="speaking"&&this.listen()}fail(t){this.stopListening(),this.failure=t,this.setPhase("failed")}}class Y9 extends Gh{constructor(t,n){super(),this.credential=t,this.op=n}credential;op;provider="openai";pc=null;events=null;stream=null;audio=null;responding=!1;pending=[];dropTimer=null;async start(){try{if(this.stream=await VS(),this.ended)return this.release();const t=await this.credential();if(this.ended)return;await this.connect(t)}catch(t){this.ended||this.fail(Yn(t))}}async connect(t){const n=new RTCPeerConnection({bundlePolicy:"max-bundle"});this.pc=n;const r=this.stream.getAudioTracks()[0];if(!r)throw new Error("Couldn't start the call audio.");r.enabled=!this.muted,n.addTrack(r,this.stream);const l=new Audio;l.autoplay=!0,this.audio=l,n.ontrack=m=>{l.srcObject=m.streams[0]??new MediaStream([m.track])},n.oniceconnectionstatechange=()=>this.iceChanged(n.iceConnectionState);const h=n.createDataChannel("oai-events");h.onopen=()=>this.opened(),h.onmessage=m=>typeof m.data=="string"&&this.received(m.data),this.events=h;const d=await n.createOffer();await n.setLocalDescription(d);const p=await fetch("https://api.openai.com/v1/realtime/calls",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"},body:d.sdp,signal:AbortSignal.timeout(15e3)}),g=await p.text();if(!this.ended){if(!p.ok){let m;try{m=JSON.parse(g).error?.message}catch{}throw new Error(m??`OpenAI answered ${p.status}.`)}await n.setRemoteDescription({type:"answer",sdp:g}),this.dropTimer=setTimeout(()=>{!this.ended&&this.phase==="starting"&&this.fail("Couldn't reach OpenAI.")},15e3)}}release(){for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null}end(){this.ended=!0,this.onActivityChanged?.(!1),this.dropTimer&&clearTimeout(this.dropTimer),this.events?.close(),this.pc?.close(),this.events=null,this.pc=null,this.release(),this.audio&&(this.audio.srcObject=null,this.audio=null)}mutedChanged(t){for(const n of this.stream?.getAudioTracks()??[])n.enabled=!t;t&&(this.level=0)}interrupt(){this.phase==="speaking"&&(this.send({type:"response.cancel"}),this.send({type:"output_audio_buffer.clear"}),this.setPhase("listening"))}speak(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.reply(t)),this.flush())}announce(t){this.ended||this.phase==="failed"||(this.pending.push(this.op.notice(t)),this.flush())}opened(){this.ended||(this.dropTimer&&clearTimeout(this.dropTimer),this.send({type:"session.update",session:{type:"realtime",instructions:this.op.instructions,tools:GS.map(t=>({type:"function",name:t.name,description:t.description,parameters:t.parameters})),audio:{input:{turn_detection:{type:"semantic_vad"}}}}}),this.setPhase("listening"),this.flush())}received(t){if(this.ended)return;let n;try{n=JSON.parse(t)}catch{return}switch(n.type){case"input_audio_buffer.speech_started":this.level=this.muted?0:.7;break;case"input_audio_buffer.speech_stopped":this.level=0;break;case"output_audio_buffer.started":this.setPhase("speaking");break;case"output_audio_buffer.stopped":case"output_audio_buffer.cleared":this.phase==="speaking"&&this.setPhase("listening");break;case"response.created":this.responding=!0;break;case"response.done":this.responding=!1,this.flush();break;case"response.function_call_arguments.done":{if(typeof n.call_id!="string"||typeof n.name!="string")return;let r={};try{typeof n.arguments=="string"&&(r=JSON.parse(n.arguments))}catch{}const l=this.op.call(n.name,r);this.send({type:"conversation.item.create",item:{type:"function_call_output",call_id:n.call_id,output:l}}),this.pending.push("");break}case"error":console.error("realtime:",n.error?.message??"?");break}}iceChanged(t){if(!this.ended)switch(t){case"connected":case"completed":this.dropTimer&&clearTimeout(this.dropTimer);break;case"disconnected":this.dropTimer&&clearTimeout(this.dropTimer),this.dropTimer=setTimeout(()=>!this.ended&&this.fail("Lost the connection to OpenAI."),5e3);break;case"failed":this.fail("Lost the connection to OpenAI.");break}}flush(){if(!(this.responding||!this.isActive||this.events?.readyState!=="open"||!this.pending.length)){for(const t of this.pending)t&&this.send({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:t}]}});this.pending=[],this.responding=!0,this.send({type:"response.create"})}}send(t){this.events?.readyState==="open"&&this.events.send(JSON.stringify(t))}}function G9(e,t,n){let r=0;for(const d of e.bots.values())r=Math.max(r,d.rev);for(const d of e.entries.values())for(const p of d)r=Math.max(r,p.rev);const l=new Set(e.allEntries(t).filter(d=>d.data.final).map(d=>d.id));let h=(()=>{const d=e.bots.get(t);return d?ln(d):!1})();return e.subscribe(()=>{for(const g of e.allEntries(t))!g.data.final||l.has(g.id)||(l.add(g.id),g.kind==="agent"&&!g.threadId&&g.rev>r&&g.data.text&&n.speak(g.data.text));const d=e.bots.get(t),p=d?ln(d):!1;d&&p&&!h&&n.announce(`${d.name} needs your approval in the chat.`),h=p})}const XS=x.createContext(null);function Z9({botId:e,onSpeaking:t,interrupt:n,onEnd:r}){const l=Ne(),[h,d]=x.useState(null);cn(h);const[p,g]=x.useState(null),[m,v]=x.useState(null),[_,S]=x.useState(!1),w=x.useContext(XS),b=x.useRef(null),k=x.useRef(null),E=x.useRef(!1),j=l.bots.get(e),V=j?ko(j.avatarColor):null,A=()=>{const L=b.current?.provider;!L||k.current===null||(D9((Date.now()-k.current)/1e3,L),k.current=null)},z=(L,O,P)=>async()=>(await(await l.ready()).call("voiceSession",{provider:L,model:O,voice:P},3e4)).credential,F=L=>{if(E.current)return;if(!L&&!J_())return void I();const O=new O9(l,e),P=ce=>l.send(ce,e);let te;if(L&&Qi.isSpeechMode(L)){const ce=Qi.transcribeModel(L),re=Qi.speechModel(L),de=Qi.voice(L);te=new q9(L,{transcribe:async Ce=>(await(await l.ready()).call("voiceTranscribe",{provider:L,model:ce,audio:WS(Ce)},6e4)).text,speak:async Ce=>{const je=await(await l.ready()).call("voiceSpeak",{provider:L,model:re,voice:de,text:Ce},9e4);return{audio:FS(je.audio),format:je.format}},send:P}),k.current=Date.now()}else if(L){const ce=Qi.model(L),re=Qi.voice(L);te=L==="openai"?new Y9(z(L,ce,re),O):new $9(ce,re,z(L,ce,re),O),k.current=Date.now()}else te=new K9(P);L&&R();let Q=null;te.onActivityChanged=ce=>{ce&&!Q?Q=G9(l,e,{speak:re=>te.speak(re),announce:re=>te.announce(re)}):!ce&&Q&&(Q(),Q=null)},b.current=te,d(te),te.start()},R=async()=>{try{const L=await(await l.ready()).call("voiceStatus");return Qi.remember(L),L}catch{return null}},I=async()=>{const L=(await R())?.providers.find(O=>O.configured)?.provider;E.current||(L?(g(`${Oh()} Using ${uh(L)}.`),F(L)):v(`${Oh()} Add an OpenAI or Gemini key in call settings.`))};x.useEffect(()=>{const L=Date.now();return F(Qi.provider()),()=>{E.current=!0,b.current?.end(),A(),t(!1),n.current=null,l.logCall(e,Math.floor((Date.now()-L)/1e3))}},[]);const q=h?.phase??null;x.useEffect(()=>{h&&(t(q==="speaking"),n.current=q==="speaking"?()=>h.interrupt():null,q==="failed"&&h.provider&&J_()&&(A(),g(`${uh(h.provider)} isn't available (${h.failure}). Using on-device voice.`),F(null)))},[h,q]);const U=q==="speaking",Y=h?.muted===!0,$=j?Jn(j):!1,M=q===null||q==="starting"?"Connecting":q==="speaking"?"Speaking":q==="failed"?"Can't listen":Y?"Muted":$?"Working, listening":"Listening",N=m??(q==="failed"?h?.failure:null);return c.jsxs("div",{className:"call",children:[c.jsxs("div",{className:"call-bar",children:[c.jsx("button",{className:`call-avatar ${U?"speaking":""}`,disabled:!U,"aria-label":U?"Interrupt":j?.name??"",title:U?"Interrupt":void 0,onClick:()=>h?.interrupt(),children:j?c.jsx(Ui,{bot:j,size:34}):c.jsx("span",{style:{width:34,height:34}})}),c.jsx(X9,{engine:h,working:$,color:V,label:M}),h?.provider?c.jsx("span",{style:{...B("caption2","semibold"),color:"var(--secondary)"},"aria-label":`Voice by ${uh(h.provider)}`,children:uh(h.provider)}):null,c.jsx("button",{className:"call-round",title:"Call settings","aria-label":"Call settings",onClick:()=>w?w():S(!0),children:c.jsx(ae,{name:"gearshape",size:16,weight:"medium",scaled:!1})}),c.jsx("button",{className:`call-round ${Y?"on":""}`,title:Y?"Unmute":"Mute","aria-label":Y?"Unmute":"Mute",onClick:()=>h&&(h.muted=!h.muted),children:c.jsx(ae,{name:Y?"mic.slash":"mic",size:16,weight:"medium",scaled:!1})}),c.jsx("button",{className:"call-round end",title:"End call","aria-label":"End call",onClick:r,children:c.jsx(ae,{name:"xmark",size:16,weight:"semibold",scaled:!1})})]}),N?c.jsx("div",{className:"call-line",style:{color:"var(--danger)"},children:N},"failure"):p?c.jsx("div",{className:"call-line",style:{color:"var(--secondary)"},children:p},p):null,c.jsx($t,{open:_,onClose:()=>S(!1),children:c.jsx(d1,{})})]})}const dh=120,Zl=16;function X9({engine:e,working:t,color:n,label:r}){const l=x.useRef(null),h=F2(),d=Ka(),p=x.useRef({engine:e,working:t,color:n,dark:h,reduceMotion:d});return p.current={engine:e,working:t,color:n,dark:h,reduceMotion:d},x.useEffect(()=>{const g=l.current,m=g?.getContext("2d");if(!g||!m)return;const v=window.devicePixelRatio||1;g.width=dh*v,g.height=Zl*v;let _=0;const S=w=>{const{engine:b,working:k,color:E,dark:j,reduceMotion:V}=p.current,A=V?0:w/1e3,z=b?.phase==="speaking",F=b?.level??0,R=j?"#ffffff":"#000000",I=z?R:E??R;m.setTransform(v,0,0,v,0,0),m.clearRect(0,0,dh,Zl);const q=8,U=Math.max(1,Math.floor(dh/q));for(let Y=0;Y<U;Y++){const $=Y*q+q/2,M=(Math.sin(Y*.55-A*6)+1)/2,N=z?.5+.5*M:F>.05?Math.max(.2,F)*(.45+.55*M):k?.25*((Math.sin(A*2.4)+1)/2):.08,L=4+N*(Zl-4);m.fillStyle=Eb(I,.5+.5*N),m.beginPath(),m.roundRect($-1.25,(Zl-L)/2,2.5,L,1.25),m.fill()}_=requestAnimationFrame(S)};return _=requestAnimationFrame(S),()=>cancelAnimationFrame(_)},[]),c.jsx("canvas",{ref:l,role:"img","aria-label":r,style:{width:dh,height:Zl,flex:"none"}})}const Q9=680;function J9({botId:e}){const t=Ne(),n=t.bots.get(e)??null,[r,l]=x.useState(!1),[h,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(null),[_,S]=x.useState(!0),[w,b]=x.useState(!1),[k,E]=x.useState(!1),[j,V]=x.useState(!1),[A,z]=x.useState(!1),F=x.useRef(null),[R,I]=x.useState(null),[q,U]=x.useState(0),Y=x.useRef(null),$=x.useRef(null),[M,N]=x.useState(800);TS(t,e,null),x.useLayoutEffect(()=>{const de=Y.current;if(!de)return;const Ce=new ResizeObserver(([D])=>N(D.contentRect.width));Ce.observe(de);const je=new ResizeObserver(([D])=>de.style.setProperty("--composer-height",`${Math.ceil(D.borderBoxSize[0].blockSize)}px`));return $.current&&je.observe($.current),()=>{Ce.disconnect(),je.disconnect()}},[]);const L=M>=Q9;x.useEffect(()=>{L&&E(!1)},[L]);const O=x.useCallback(()=>{L?h?(d(null),S(!0)):S(de=>!de):(d(null),E(de=>!de))},[L,h]);x.useEffect(()=>window.codync.app.onCommand(de=>{de.kind==="toggleDetails"&&O()}),[O]);const P=x.useCallback(()=>l(!0),[]),te=x.useCallback(de=>d(de.id),[]),Q=x.useCallback(()=>d(null),[]),ce=de=>{I(de),U(Ce=>Ce+1),b(!1),d(null),S(!0),L||E(!0)},re=c.jsx(o9,{botId:e,routineId:R,editing:w,setEditing:b,editGroup:()=>g(!0),share:()=>{E(!1),n&&v(yo(n))},close:()=>{S(!1),E(!1)}},q);return c.jsxs("div",{className:"thread-view",ref:Y,children:[c.jsxs("div",{className:"conversation",children:[c.jsxs("div",{className:"top-chrome",children:[c.jsx(ek,{}),c.jsxs("div",{className:"top-chrome-row",children:[c.jsx("span",{style:{flex:1}}),(!_||h||!L)&&!k?c.jsx(h1,{title:"Conversation details",icon:"chevron.left.2",direction:[-1,0],onClick:O}):null]}),c.jsxs("button",{className:`title-pill ${j?"hidden-by-call":""}`,inert:j,onClick:O,"aria-label":"View conversation details",title:"View conversation details",children:[c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7},children:[n?At(n)?c.jsx(Eo,{members:t.members(n),size:22}):c.jsx(Ui,{bot:n,size:22}):null,c.jsx("span",{style:{...B(14,"semibold"),color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n?.name??""})]}),t.shownConnection.kind!=="online"||t.mismatch?c.jsx(tk,{}):null]})]}),c.jsx(ik,{botId:e,openTrace:P,openThread:te,openRoutine:ce}),c.jsxs("div",{className:"composer-dock",ref:$,children:[c.jsx("div",{className:"composer-fade"}),t.mismatch?c.jsx("div",{style:{padding:"0 16px 8px"},children:c.jsx(J2,{})}):c.jsx(xS,{botId:e,onCall:!j&&n&&!At(n)?()=>V(!0):null,onInterrupt:A?()=>F.current?.():null})]}),j?c.jsx("div",{className:"call-overlay",children:c.jsx(Z9,{botId:e,onSpeaking:z,interrupt:F,onEnd:()=>V(!1)})}):null]}),c.jsx(e7,{open:L&&(!!h||_),width:h?Math.min(420,M*.45):292,children:h?c.jsx(Z_,{botId:e,rootId:h,close:Q},h):re}),c.jsx($t,{open:k,onClose:()=>E(!1),width:340,height:600,children:re}),c.jsx($t,{open:h!==null&&!L,onClose:Q,width:440,height:600,children:h?c.jsx(Z_,{botId:e,rootId:h,close:Q}):null}),c.jsx($t,{open:r,onClose:()=>l(!1),width:620,height:560,children:c.jsx(jS,{botId:e})}),c.jsx($t,{open:m!==null,onClose:()=>v(null),children:m?c.jsx(_9,{draft:m}):null}),c.jsx($t,{open:p,onClose:()=>g(!1),width:420,height:560,children:c.jsx(g9,{group:n})})]})}function ek(){return c.jsx("div",{className:"top-fade"})}function tk(){const e=Ne(),t=e.shownConnection.kind==="connecting",n=e.connection.kind!=="online"?"wifi.slash":e.hostRoute==="relay"?"cloud":e.hostRoute==="direct"?"wifi":e.hostRoute==="loopback"?"desktopcomputer":"network",r=(()=>{switch(e.shownConnection.kind){case"connecting":return"Connecting";case"computerOffline":case"offline":return"Offline";case"unauthorized":return"No access";case"unpaired":return"Not paired"}return e.mismatch?"Needs update":e.hostRoute==="relay"?"Connected through Cloudflare":e.hostRoute==="direct"?"Connected over Wi-Fi or Tailscale":e.hostRoute==="loopback"?"Connected locally":"Connected"})();return c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,...B(10,"medium"),color:"var(--secondary)"},title:`${e.hostName} · ${r}`,"aria-label":`${e.hostName}, ${r}`,children:[c.jsx("span",{style:{width:12,display:"flex",justifyContent:"center"},children:t?c.jsx(et,{size:8}):c.jsx(ae,{name:n,size:8,weight:"medium"})}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.connectionLabel})]})}const iy=40;function ik({botId:e,openTrace:t,openThread:n,openRoutine:r}){const l=Ne(),h=l.bots.get(e)??null,d=l.chat(e),p=!!h&&$2(h,e,null)&&!l.isOffline,g=Vf(d),[m,v]=x.useState(null),[_,S]=x.useState(!1),w=m?g.findIndex(M=>M.id===m):-1,b=w>=0?w:Math.max(0,g.length-iy),k=g.slice(b),E=b>0||!l.historyComplete.has(e)&&d.length>=50,[j,V]=x.useState(!0),A=x.useRef(!0);A.current=j;const z=x.useRef(null),F=x.useRef(0),R=x.useRef(null),I=k[k.length-1],q=sS([...k.map(M=>M.id),...p?["working"]:[]],j),U=(M=!1)=>{const N=z.current;N&&N.scrollTo({top:N.scrollHeight,behavior:M?"smooth":"auto"})};x.useEffect(()=>{!m&&k[0]&&v(k[0].id)},[m,k]);const Y=async()=>{if(_)return;S(!0);const M=z.current;R.current=M?M.scrollHeight-M.scrollTop:null;let N=g,L=b;if(L===0){const O=N[0]?.id;await l.loadOlder(e),N=Vf(l.chat(e)),L=O?Math.max(0,N.findIndex(P=>P.id===O)):0}L>0&&v(N[Math.max(0,L-iy)].id),S(!1)};x.useLayoutEffect(()=>{const M=z.current;M&&(R.current!==null&&!A.current?(M.scrollTop=M.scrollHeight-R.current,R.current=null):A.current&&U())});const $=I?.kind==="entry"&&I.entry.kind==="user";return x.useEffect(()=>{$&&V(!0)},[I?.id,$]),x.useEffect(()=>{const M=z.current;if(!M)return;const N=new ResizeObserver(()=>{A.current&&U()});return N.observe(M.firstElementChild),N.observe(M),()=>N.disconnect()},[]),c.jsxs("div",{className:"transcript-frame",children:[c.jsx("div",{className:"transcript",ref:z,onScroll:M=>{const N=M.currentTarget,L=N.scrollHeight-N.scrollTop-N.clientHeight<8;N.scrollTop<F.current-1&&!L?V(!1):L&&V(!0),F.current=N.scrollTop,E&&N.scrollTop<200&&!_&&Y()},children:c.jsxs("div",{className:"transcript-content",children:[E?c.jsx("button",{className:"load-earlier",disabled:_,onClick:()=>{Y()},children:_?c.jsx(et,{size:14}):"Load earlier messages"}):null,k.length===0&&h?c.jsx("div",{style:{paddingTop:40},children:At(h)?c.jsx(nk,{group:h}):c.jsx(rk,{bot:h})}):null,k.map(M=>c.jsx("div",{className:q.has(M.id)?nS(M):void 0,children:c.jsx(sk,{item:M,chat:h,openTrace:t,openThread:n,openRoutine:r})},M.id)),h&&p?c.jsx("div",{className:q.has("working")?"row-in":void 0,style:{paddingTop:6},children:c.jsx(yS,{bot:h,thinking:l.currentThinking(e,null)})}):null,c.jsx("div",{style:{height:8}})]})}),!j&&k.length?c.jsx("div",{className:"jump-to-latest",style:{bottom:"calc(var(--composer-height, 70px) + 10px)"},children:c.jsx(h1,{title:"Jump to latest",icon:"arrow.down",direction:[0,1],onClick:()=>{V(!0),U(!0)}})}):null]})}function sk({item:e,chat:t,openTrace:n,openThread:r,openRoutine:l}){if(e.kind==="separator")return c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",textAlign:"center",padding:"18px 0 6px"},children:e1.separator(e.date)});const h=e.entry;return h.kind==="notice"&&h.data.routineId?c.jsxs("button",{onClick:()=>l(h.data.routineId),style:{display:"flex",alignItems:"center",gap:6,...B("footnote"),color:"var(--secondary)",padding:"10px 0",margin:"0 auto"},children:[c.jsx(ae,{name:"clock.arrow.circlepath",size:10}),h.data.text??"Routine"]}):c.jsx(Jf,{entry:h,groupStart:e.groupStart,chat:t,openTrace:n,openThread:r})}function nk({group:e}){const n=Ne().members(e);return c.jsxs("div",{className:"intro-card",children:[c.jsx(Eo,{members:n,size:72}),c.jsx("div",{style:{...B("title2","semibold"),color:"var(--text)"},children:e.name}),c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:n.map(r=>r.name).join(" · ")}),e.description?c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.description}):null,c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",paddingTop:4},children:"Everyone answers in turn. @mention a bot to ask just that one. Each bot works in its own folder."})]})}function rk({bot:e}){const t=Ne();return c.jsxs("div",{className:"intro-card",children:[c.jsx(Ui,{bot:e,size:72}),c.jsx("div",{style:{...B("title2","semibold"),color:"var(--text)"},children:e.name}),c.jsx("div",{style:{...B("footnote",void 0,"monospaced"),color:"var(--tertiary)"},children:e.managedWorkspace?`${t.backendName(e.backend)} · Personal workspace`:`${t.backendName(e.backend)} in ${e.cwd}`}),e.description?c.jsx("div",{style:{...B("subheadline"),color:"var(--secondary)"},children:e.description}):null,c.jsx("div",{style:{...B("footnote"),color:"var(--tertiary)",paddingTop:4},children:"Tell it what you need. You'll get a notification when it's done or needs you."})]})}function ak({group:e,onClose:t}){const n=Ne(),[r,l]=x.useState(""),[h,d]=x.useState(""),[p,g]=x.useState([]),[m,v]=x.useState(!1),_=x.useRef(null),S=x.useRef(null),w=r.trim().toLowerCase(),b=n.roster.filter(U=>!p.includes(U.id)&&!(At(U)&&(e||p.length>0))&&(!w||U.name.toLowerCase().includes(w))),k=p.map(U=>n.bots.get(U)).filter(U=>!!U),E=e?p.length<2?"Add bots to the group":"Add another bot":p.length?"Add another bot":"Search or create bots",j=e?k.length<2?"Pick at least two bots":"Message the group":k.length===0?"Message Bot":`Message ${k.map(U=>U.name).join(", ")}`;x.useEffect(()=>{_.current?.focus()},[]),x.useLayoutEffect(()=>{const U=S.current;U&&U.scrollTo({left:U.scrollWidth,behavior:"smooth"})},[p]);const V=U=>{const Y=h.trim();n.setSelection(U),Y&&n.send(Y,U),t()},A=U=>{if(At(U))return V(U.id);g(Y=>[...Y,U.id]),l(""),_.current?.focus()},z=U=>g(Y=>Y.filter($=>$!==U)),F=()=>{if(p.length!==0){if(p.length===1){e||V(p[0]);return}n.createGroup(k.map(U=>U.name).join(", "),"",p).then(U=>V(U.id)).catch(U=>n.setError(Ar(U)))}},R=()=>{if(m)return;v(!0);const U=r.trim(),Y=p.length===0&&!e;(async()=>{try{let $=await F7(n);U&&($=await n.save({...yo($),name:U})),Y?V($.id):(n.setSelection(null),A($))}catch($){n.setError(Ar($))}v(!1)})()},I=()=>{w?b[0]?A(b[0]):R():F()},q=x.useRef({create:R,choose:A,matches:b,onClose:t});return q.current={create:R,choose:A,matches:b,onClose:t},x.useEffect(()=>{const U=Y=>{if(Y.key==="Escape"){Y.preventDefault(),q.current.onClose();return}if(!Y.metaKey||Y.shiftKey||Y.altKey||Y.ctrlKey)return;const $=Number(Y.key);if(!(!Number.isInteger($)||$<1||$>9))if(Y.preventDefault(),$===1)q.current.create();else{const M=q.current.matches[$-2];M&&q.current.choose(M)}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px",...B("title3")},children:[c.jsx("span",{style:{color:"var(--secondary)",flex:"none"},children:"To:"}),c.jsxs("div",{ref:S,className:"chip-row",style:{flex:1},children:[k.map(U=>c.jsx(ES,{bot:U,onRemove:()=>z(U.id)},U.id)),c.jsx("input",{ref:_,value:r,placeholder:E,style:{minWidth:200,flex:1,color:"var(--text)",userSelect:"text"},onChange:U=>l(U.target.value),onKeyDown:U=>{U.nativeEvent.isComposing||U.keyCode===229||(U.key==="Enter"?(U.preventDefault(),I()):U.key==="Backspace"&&!r&&p.length&&(U.preventDefault(),z(p[p.length-1])))}})]}),c.jsx(ke,{title:"Close",icon:"xmark",onClick:t})]}),c.jsx("div",{className:"hairline"}),c.jsxs("div",{className:"compose-list",children:[c.jsx(sy,{shortcut:1,onClick:R,icon:c.jsx("span",{style:{width:26,height:26,borderRadius:"50%",background:"var(--bubble-agent)",display:"grid",placeItems:"center"},children:c.jsx(ae,{name:m?"hourglass":"plus",size:13,weight:"medium",className:"fade-in"},m?"hourglass":"plus")}),children:r?`Create “${r}”`:"Create new Bot"}),b.map((U,Y)=>c.jsx(sy,{shortcut:Y+2<=9?Y+2:null,onClick:()=>A(U),icon:At(U)?c.jsx(Eo,{members:n.members(U),size:26,animated:!1}):c.jsx(Ui,{bot:U,size:26,animated:!1}),children:U.name},U.id))]}),c.jsx("div",{style:{flex:1}}),c.jsx("div",{className:"compose-box",children:c.jsx(c1,{value:h,onChange:d,placeholder:j,minRows:1,maxRows:6,onKeyDown:U=>{U.key==="Enter"&&!U.shiftKey&&!U.nativeEvent.isComposing&&U.keyCode!==229&&(U.preventDefault(),F())}})})]})}function sy({shortcut:e,onClick:t,icon:n,children:r}){return c.jsxs("button",{className:"press pick-row hover fade-in",onClick:t,children:[n,c.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r}),e!==null?c.jsxs("span",{style:{display:"flex",gap:3},children:[c.jsx("span",{className:"key-cap",children:"⌘"}),c.jsx("span",{className:"key-cap",children:e})]}):null]})}var lk=2,ok=1,ck=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),l=Math.max(0,parseInt(n.getPropertyValue("width"))),h=window.getComputedStyle(this._terminal.element),d={top:parseInt(h.getPropertyValue("padding-top")),bottom:parseInt(h.getPropertyValue("padding-bottom")),right:parseInt(h.getPropertyValue("padding-right")),left:parseInt(h.getPropertyValue("padding-left"))},p=d.top+d.bottom,g=d.right+d.left,m=r-p,v=l-g-t;return{cols:Math.max(lk,Math.floor(v/e.css.cell.width)),rows:Math.max(ok,Math.floor(m/e.css.cell.height))}}};var hk=class{constructor(t,n,r,l={}){this._terminal=t,this._regex=n,this._handler=r,this._options=l}provideLinks(t,n){let r=dk.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,l)=>{if(this._options.hover){let{range:h}=n;this._options.hover(r,l,h)}},n))}};function uk(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var dk=class bh{static computeLink(t,n,r,l){let h=new RegExp(n.source,(n.flags||"")+"g"),[d,p]=bh._getWindowedLineStrings(t-1,r),g=d.join(""),m,v=[];for(;m=h.exec(g);){let _=m[0];if(!uk(_))continue;let[S,w]=bh._mapStrIdx(r,p,0,m.index),[b,k]=bh._mapStrIdx(r,S,w,_.length);if(S===-1||w===-1||b===-1||k===-1)continue;let E={start:{x:w+1,y:S+1},end:{x:k,y:b+1}};v.push({range:E,text:_,activate:l})}return v}static _getWindowedLineStrings(t,n){let r,l=t,h=t,d=0,p="",g=[];if(r=n.buffer.active.getLine(t)){let m=r.translateToString(!0);if(r.isWrapped&&m[0]!==" "){for(d=0;(r=n.buffer.active.getLine(--l))&&d<2048&&(p=r.translateToString(!0),d+=p.length,g.push(p),!(!r.isWrapped||p.indexOf(" ")!==-1)););g.reverse()}for(g.push(m),d=0;(r=n.buffer.active.getLine(++h))&&r.isWrapped&&d<2048&&(p=r.translateToString(!0),d+=p.length,g.push(p),p.indexOf(" ")===-1););}return[g,l]}static _mapStrIdx(t,n,r,l){let h=t.buffer.active,d=h.getNullCell(),p=r;for(;l;){let g=h.getLine(n);if(!g)return[-1,-1];for(let m=p;m<g.length;++m){g.getCell(m,d);let v=d.getChars();if(d.getWidth()&&(l-=v.length||1,m===g.length-1&&v==="")){let _=h.getLine(n+1);_&&_.isWrapped&&(_.getCell(0,d),d.getWidth()===2&&(l+=1))}if(l<0)return[n,m]}n++,p=0}return[n,p]}},fk=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function pk(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var gk=class{constructor(t=pk,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||fk;this._linkProvider=this._terminal.registerLinkProvider(new hk(this._terminal,r,this._handler,n))}dispose(){this._linkProvider?.dispose()}};var QS=Object.defineProperty,mk=Object.getOwnPropertyDescriptor,vk=(e,t)=>{for(var n in t)QS(e,n,{get:t[n],enumerable:!0})},_t=(e,t,n,r)=>{for(var l=r>1?void 0:r?mk(t,n):t,h=e.length-1,d;h>=0;h--)(d=e[h])&&(l=(r?d(t,n,l):d(l))||l);return r&&l&&QS(t,n,l),l},me=(e,t)=>(n,r)=>t(n,r,e),ny="Terminal input",r2={get:()=>ny,set:e=>ny=e},ry="Too much output to announce, navigate to rows manually to read",a2={get:()=>ry,set:e=>ry=e};function _k(e){return e.replace(/\r?\n/g,"\r")}function yk(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Sk(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function xk(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");JS(l,t,n,r)}}function JS(e,t,n,r){e=_k(e),e=yk(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function ex(e,t,n){let r=n.getBoundingClientRect(),l=e.clientX-r.left-10,h=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${h}px`,t.style.zIndex="1000",t.focus()}function ay(e,t,n,r,l){ex(e,t,n),l&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Fn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Zh(e,t=0,n=e.length){let r="";for(let l=t;l<n;++l){let h=e[l];h>65535?(h-=65536,r+=String.fromCharCode((h>>10)+55296)+String.fromCharCode(h%1024+56320)):r+=String.fromCharCode(h)}return r}var wk=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,l=0;if(this._interim){let h=e.charCodeAt(l++);56320<=h&&h<=57343?t[r++]=(this._interim-55296)*1024+h-56320+65536:(t[r++]=this._interim,t[r++]=h),this._interim=0}for(let h=l;h<n;++h){let d=e.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=n)return this._interim=d,r;let p=e.charCodeAt(h);56320<=p&&p<=57343?t[r++]=(d-55296)*1024+p-56320+65536:(t[r++]=d,t[r++]=p);continue}d!==65279&&(t[r++]=d)}return r}},bk=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,l,h,d,p,g=0,m=0;if(this.interim[0]){let S=!1,w=this.interim[0];w&=(w&224)===192?31:(w&240)===224?15:7;let b=0,k;for(;(k=this.interim[++b]&63)&&b<4;)w<<=6,w|=k;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,j=E-b;for(;m<j;){if(m>=n)return 0;if(k=e[m++],(k&192)!==128){m--,S=!0;break}else this.interim[b++]=k,w<<=6,w|=k&63}S||(E===2?w<128?m--:t[r++]=w:E===3?w<2048||w>=55296&&w<=57343||w===65279||(t[r++]=w):w<65536||w>1114111||(t[r++]=w)),this.interim.fill(0)}let v=n-4,_=m;for(;_<n;){for(;_<v&&!((l=e[_])&128)&&!((h=e[_+1])&128)&&!((d=e[_+2])&128)&&!((p=e[_+3])&128);)t[r++]=l,t[r++]=h,t[r++]=d,t[r++]=p,_+=4;if(l=e[_++],l<128)t[r++]=l;else if((l&224)===192){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(g=(l&31)<<6|h&63,g<128){_--;continue}t[r++]=g}else if((l&240)===224){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,r;if(d=e[_++],(d&192)!==128){_--;continue}if(g=(l&15)<<12|(h&63)<<6|d&63,g<2048||g>=55296&&g<=57343||g===65279)continue;t[r++]=g}else if((l&248)===240){if(_>=n)return this.interim[0]=l,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,r;if(d=e[_++],(d&192)!==128){_--;continue}if(_>=n)return this.interim[0]=l,this.interim[1]=h,this.interim[2]=d,r;if(p=e[_++],(p&192)!==128){_--;continue}if(g=(l&7)<<18|(h&63)<<12|(d&63)<<6|p&63,g<65536||g>1114111)continue;t[r++]=g}}return r}},tx="",Gn=" ",Mo=class ix{constructor(){this.fg=0,this.bg=0,this.extended=new Ih}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ix;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ih=class sx{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new sx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},is=class nx extends Mo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ih,this.combinedData=""}static fromCharData(t){let n=new nx;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Fn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(r-55296)*1024+l-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ly="di$target",l2="di$dependencies",X0=new Map;function Ck(e){return e[l2]||[]}function Wt(e){if(X0.has(e))return X0.get(e);let t=function(n,r,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");kk(t,n,l)};return t._id=e,X0.set(e,t),t}function kk(e,t,n){t[ly]===t?t[l2].push({id:e,index:n}):(t[l2]=[{id:e,index:n}],t[ly]=t)}var ui=Wt("BufferService"),rx=Wt("CoreMouseService"),zr=Wt("CoreService"),Ek=Wt("CharsetService"),f1=Wt("InstantiationService"),ax=Wt("LogService"),di=Wt("OptionsService"),lx=Wt("OscLinkService"),Mk=Wt("UnicodeService"),jo=Wt("DecorationService"),o2=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],l=this._optionsService.rawOptions.linkHandler,h=new is,d=n.getTrimmedLength(),p=-1,g=-1,m=!1;for(let v=0;v<d;v++)if(!(g===-1&&!n.hasContent(v))){if(n.loadCell(v,h),h.hasExtendedAttrs()&&h.extended.urlId)if(g===-1){g=v,p=h.extended.urlId;continue}else m=h.extended.urlId!==p;else g!==-1&&(m=!0);if(m||g!==-1&&v===d-1){let _=this._oscLinkService.getLinkData(p)?.uri;if(_){let S={start:{x:g+1,y:e},end:{x:v+(!m&&v===d-1?1:0),y:e}},w=!1;if(!l?.allowNonHttpProtocols)try{let b=new URL(_);["http:","https:"].includes(b.protocol)||(w=!0)}catch{w=!0}w||r.push({text:_,range:S,activate:(b,k)=>l?l.activate(b,k,S):jk(b,k),hover:(b,k)=>l?.hover?.(b,k,S),leave:(b,k)=>l?.leave?.(b,k,S)})}m=!1,h.hasExtendedAttrs()&&h.extended.urlId?(g=v,p=h.extended.urlId):(g=-1,p=-1)}}t(r)}};o2=_t([me(0,ui),me(1,di),me(2,lx)],o2);function jk(e,t){if(confirm(`Do you want to navigate to ${t}?
-
-WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Xh=Wt("CharSizeService"),un=Wt("CoreBrowserService"),p1=Wt("MouseService"),dn=Wt("RenderService"),Tk=Wt("SelectionService"),ox=Wt("CharacterJoinerService"),Za=Wt("ThemeService"),cx=Wt("LinkProviderService"),Dk=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?oy.isErrorNoTelemetry(e)?new oy(e.message+`
-
-`+e.stack):new Error(e.message+`
-
-`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Rk=new Dk;function Ch(e){Ak(e)||Rk.onUnexpectedError(e)}var c2="Canceled";function Ak(e){return e instanceof Nk?!0:e instanceof Error&&e.name===c2&&e.message===c2}var Nk=class extends Error{constructor(){super(c2),this.name=this.message}};function Lk(e){return new Error(`Illegal argument: ${e}`)}var oy=class h2 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof h2)return t;let n=new h2;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},u2=class hx extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,hx.prototype)}};function zi(e,t=0){return e[e.length-(1+t)]}var Bk;(e=>{function t(h){return h<0}e.isLessThan=t;function n(h){return h<=0}e.isLessThanOrEqual=n;function r(h){return h>0}e.isGreaterThan=r;function l(h){return h===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Bk||={});function Ok(e,t){let n=this,r=!1,l;return function(){return r||(r=!0,t||(l=e.apply(n,arguments))),l}}var ux;(e=>{function t(z){return z&&typeof z=="object"&&typeof z[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*l(z){yield z}e.single=l;function h(z){return t(z)?z:l(z)}e.wrap=h;function d(z){return z||n}e.from=d;function*p(z){for(let F=z.length-1;F>=0;F--)yield z[F]}e.reverse=p;function g(z){return!z||z[Symbol.iterator]().next().done===!0}e.isEmpty=g;function m(z){return z[Symbol.iterator]().next().value}e.first=m;function v(z,F){let R=0;for(let I of z)if(F(I,R++))return!0;return!1}e.some=v;function _(z,F){for(let R of z)if(F(R))return R}e.find=_;function*S(z,F){for(let R of z)F(R)&&(yield R)}e.filter=S;function*w(z,F){let R=0;for(let I of z)yield F(I,R++)}e.map=w;function*b(z,F){let R=0;for(let I of z)yield*F(I,R++)}e.flatMap=b;function*k(...z){for(let F of z)yield*F}e.concat=k;function E(z,F,R){let I=R;for(let q of z)I=F(I,q);return I}e.reduce=E;function*j(z,F,R=z.length){for(F<0&&(F+=z.length),R<0?R+=z.length:R>z.length&&(R=z.length);F<R;F++)yield z[F]}e.slice=j;function V(z,F=Number.POSITIVE_INFINITY){let R=[];if(F===0)return[R,z];let I=z[Symbol.iterator]();for(let q=0;q<F;q++){let U=I.next();if(U.done)return[R,e.empty()];R.push(U.value)}return[R,{[Symbol.iterator](){return I}}]}e.consume=V;async function A(z){let F=[];for await(let R of z)F.push(R);return Promise.resolve(F)}e.asyncToArray=A})(ux||={});function Nr(e){if(ux.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function zk(...e){return ht(()=>Nr(e))}function ht(e){return{dispose:Ok(()=>{e()})}}var dx=class fx{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Nr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?fx.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};dx.DISABLE_DISPOSED_WARNING=!1;var Qn=dx,He=class{constructor(){this._store=new Qn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};He.None=Object.freeze({dispose(){}});var Fa=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},sn=typeof window=="object"?window:globalThis,d2=class f2{constructor(t){this.element=t,this.next=f2.Undefined,this.prev=f2.Undefined}};d2.Undefined=new d2(void 0);var dt=d2,cy=class{constructor(){this._first=dt.Undefined,this._last=dt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===dt.Undefined}clear(){let e=this._first;for(;e!==dt.Undefined;){let t=e.next;e.prev=dt.Undefined,e.next=dt.Undefined,e=t}this._first=dt.Undefined,this._last=dt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new dt(e);if(this._first===dt.Undefined)this._first=n,this._last=n;else if(t){let l=this._last;this._last=n,n.prev=l,l.next=n}else{let l=this._first;this._first=n,n.next=l,l.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==dt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==dt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==dt.Undefined&&e.next!==dt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===dt.Undefined&&e.next===dt.Undefined?(this._first=dt.Undefined,this._last=dt.Undefined):e.next===dt.Undefined?(this._last=this._last.prev,this._last.next=dt.Undefined):e.prev===dt.Undefined&&(this._first=this._first.next,this._first.prev=dt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==dt.Undefined;)yield e.element,e=e.next}},Hk=globalThis.performance&&typeof globalThis.performance.now=="function",Ik=class px{static create(t){return new px(t)}constructor(t){this._now=Hk&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ei;(e=>{e.None=()=>He.None;function t(M,N){return _(M,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(M){return(N,L=null,O)=>{let P=!1,te;return te=M(Q=>{if(!P)return te?te.dispose():P=!0,N.call(L,Q)},null,O),P&&te.dispose(),te}}e.once=n;function r(M,N,L){return m((O,P=null,te)=>M(Q=>O.call(P,N(Q)),null,te),L)}e.map=r;function l(M,N,L){return m((O,P=null,te)=>M(Q=>{N(Q),O.call(P,Q)},null,te),L)}e.forEach=l;function h(M,N,L){return m((O,P=null,te)=>M(Q=>N(Q)&&O.call(P,Q),null,te),L)}e.filter=h;function d(M){return M}e.signal=d;function p(...M){return(N,L=null,O)=>{let P=zk(...M.map(te=>te(Q=>N.call(L,Q))));return v(P,O)}}e.any=p;function g(M,N,L,O){let P=L;return r(M,te=>(P=N(P,te),P),O)}e.reduce=g;function m(M,N){let L,O={onWillAddFirstListener(){L=M(P.fire,P)},onDidRemoveLastListener(){L?.dispose()}},P=new ue(O);return N?.add(P),P.event}function v(M,N){return N instanceof Array?N.push(M):N&&N.add(M),M}function _(M,N,L=100,O=!1,P=!1,te,Q){let ce,re,de,Ce=0,je,D={leakWarningThreshold:te,onWillAddFirstListener(){ce=M(le=>{Ce++,re=N(re,le),O&&!de&&(J.fire(re),re=void 0),je=()=>{let he=re;re=void 0,de=void 0,(!O||Ce>1)&&J.fire(he),Ce=0},typeof L=="number"?(clearTimeout(de),de=setTimeout(je,L)):de===void 0&&(de=0,queueMicrotask(je))})},onWillRemoveListener(){P&&Ce>0&&je?.()},onDidRemoveLastListener(){je=void 0,ce.dispose()}},J=new ue(D);return Q?.add(J),J.event}e.debounce=_;function S(M,N=0,L){return e.debounce(M,(O,P)=>O?(O.push(P),O):[P],N,void 0,!0,void 0,L)}e.accumulate=S;function w(M,N=(O,P)=>O===P,L){let O=!0,P;return h(M,te=>{let Q=O||!N(te,P);return O=!1,P=te,Q},L)}e.latch=w;function b(M,N,L){return[e.filter(M,N,L),e.filter(M,O=>!N(O),L)]}e.split=b;function k(M,N=!1,L=[],O){let P=L.slice(),te=M(re=>{P?P.push(re):ce.fire(re)});O&&O.add(te);let Q=()=>{P?.forEach(re=>ce.fire(re)),P=null},ce=new ue({onWillAddFirstListener(){te||(te=M(re=>ce.fire(re)),O&&O.add(te))},onDidAddFirstListener(){P&&(N?setTimeout(Q):Q())},onDidRemoveLastListener(){te&&te.dispose(),te=null}});return O&&O.add(ce),ce.event}e.buffer=k;function E(M,N){return(L,O,P)=>{let te=N(new V);return M(function(Q){let ce=te.evaluate(Q);ce!==j&&L.call(O,ce)},void 0,P)}}e.chain=E;let j=Symbol("HaltChainable");class V{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(L=>(N(L),L)),this}filter(N){return this.steps.push(L=>N(L)?L:j),this}reduce(N,L){let O=L;return this.steps.push(P=>(O=N(O,P),O)),this}latch(N=(L,O)=>L===O){let L=!0,O;return this.steps.push(P=>{let te=L||!N(P,O);return L=!1,O=P,te?P:j}),this}evaluate(N){for(let L of this.steps)if(N=L(N),N===j)break;return N}}function A(M,N,L=O=>O){let O=(...ce)=>Q.fire(L(...ce)),P=()=>M.on(N,O),te=()=>M.removeListener(N,O),Q=new ue({onWillAddFirstListener:P,onDidRemoveLastListener:te});return Q.event}e.fromNodeEventEmitter=A;function z(M,N,L=O=>O){let O=(...ce)=>Q.fire(L(...ce)),P=()=>M.addEventListener(N,O),te=()=>M.removeEventListener(N,O),Q=new ue({onWillAddFirstListener:P,onDidRemoveLastListener:te});return Q.event}e.fromDOMEventEmitter=z;function F(M){return new Promise(N=>n(M)(N))}e.toPromise=F;function R(M){let N=new ue;return M.then(L=>{N.fire(L)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=R;function I(M,N){return M(L=>N.fire(L))}e.forward=I;function q(M,N,L){return N(L),M(O=>N(O))}e.runAndSubscribe=q;class U{constructor(N,L){this._observable=N,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new ue(O),L&&L.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,L){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(M,N){return new U(M,N).emitter.event}e.fromObservable=Y;function $(M){return(N,L,O)=>{let P=0,te=!1,Q={beginUpdate(){P++},endUpdate(){P--,P===0&&(M.reportChanges(),te&&(te=!1,N.call(L)))},handlePossibleChange(){},handleChange(){te=!0}};M.addObserver(Q),M.reportChanges();let ce={dispose(){M.removeObserver(Q)}};return O instanceof Qn?O.add(ce):Array.isArray(O)&&O.push(ce),ce}}e.fromObservableLight=$})(ei||={});var p2=class g2{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${g2._idPool++}`,g2.all.add(this)}start(t){this._stopWatch=new Ik,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};p2.all=new Set,p2._idPool=0;var Uk=p2,Pk=-1,gx=class mx{constructor(t,n,r=(mx._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[h,d]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(p),console.warn(h);let g=new $k(p,h);this._errorHandler(g)}return()=>{let h=this._stacks.get(t.value)||0;this._stacks.set(t.value,h-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,l]of this._stacks)(!t||n<l)&&(t=[r,l],n=l);return t}};gx._idPool=1;var qk=gx,Vk=class vx{constructor(t){this.value=t}static create(){let t=new Error;return new vx(t.stack??"")}print(){console.warn(this.value.split(`
-`).slice(2).join(`
-`))}},$k=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Wk=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Fk=0,Q0=class{constructor(e){this.value=e,this.id=Fk++}},Kk=2,Yk,ue=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new qk(e?.onListenerError??Ch,this._options?.leakWarningThreshold??Pk):void 0,this._perfMon=this._options?._profName?new Uk(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new Wk(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Ch)(g),He.None}if(this._disposed)return He.None;t&&(e=e.bind(t));let r=new Q0(e),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Vk.create(),l=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Q0?(this._deliveryQueue??=new Gk,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let h=ht(()=>{l?.(),this._removeListener(r)});return n instanceof Qn?n.add(h):Array.isArray(n)&&n.push(h),h},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Kk<=t.length){let l=0;for(let h=0;h<t.length;h++)t[h]?t[l++]=t[h]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Ch;if(!n){e.value(t);return}try{e.value(t)}catch(r){n(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Q0)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Gk=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},m2=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};m2.INSTANCE=new m2;var g1=m2;function Zk(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}g1.INSTANCE.onDidChangeZoomLevel;function Xk(e){return g1.INSTANCE.getZoomFactor(e)}g1.INSTANCE.onDidChangeFullscreen;var Xa=typeof navigator=="object"?navigator.userAgent:"",v2=Xa.indexOf("Firefox")>=0,Qk=Xa.indexOf("AppleWebKit")>=0,m1=Xa.indexOf("Chrome")>=0,Jk=!m1&&Xa.indexOf("Safari")>=0;Xa.indexOf("Electron/")>=0;Xa.indexOf("Android")>=0;var J0=!1;if(typeof sn.matchMedia=="function"){let e=sn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=sn.matchMedia("(display-mode: fullscreen)");J0=e.matches,Zk(sn,e,({matches:n})=>{J0&&t.matches||(J0=n)})}var Ia="en",_2=!1,y2=!1,kh=!1,_x=!1,fh,Eh=Ia,hy=Ia,eE,Qs,Rr=globalThis,Ii;typeof Rr.vscode<"u"&&typeof Rr.vscode.process<"u"?Ii=Rr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ii=process);var tE=typeof Ii?.versions?.electron=="string",iE=tE&&Ii?.type==="renderer";if(typeof Ii=="object"){_2=Ii.platform==="win32",y2=Ii.platform==="darwin",kh=Ii.platform==="linux",kh&&Ii.env.SNAP&&Ii.env.SNAP_REVISION,Ii.env.CI||Ii.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fh=Ia,Eh=Ia;let e=Ii.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);fh=t.userLocale,hy=t.osLocale,Eh=t.resolvedLanguage||Ia,eE=t.languagePack?.translationsConfigFile}catch{}_x=!0}else typeof navigator=="object"&&!iE?(Qs=navigator.userAgent,_2=Qs.indexOf("Windows")>=0,y2=Qs.indexOf("Macintosh")>=0,(Qs.indexOf("Macintosh")>=0||Qs.indexOf("iPad")>=0||Qs.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kh=Qs.indexOf("Linux")>=0,Qs?.indexOf("Mobi")>=0,Eh=globalThis._VSCODE_NLS_LANGUAGE||Ia,fh=navigator.language.toLowerCase(),hy=fh):console.error("Unable to resolve platform.");var yx=_2,Ns=y2,sE=kh,uy=_x,Ls=Qs,Pn=Eh,nE;(e=>{function t(){return Pn}e.value=t;function n(){return Pn.length===2?Pn==="en":Pn.length>=3?Pn[0]==="e"&&Pn[1]==="n"&&Pn[2]==="-":!1}e.isDefaultVariant=n;function r(){return Pn==="en"}e.isDefault=r})(nE||={});var rE=typeof Rr.postMessage=="function"&&!Rr.importScripts;(()=>{if(rE){let e=[];Rr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,l=e.length;r<l;r++){let h=e[r];if(h.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),h.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Rr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var aE=!!(Ls&&Ls.indexOf("Chrome")>=0);Ls&&Ls.indexOf("Firefox")>=0;!aE&&Ls&&Ls.indexOf("Safari")>=0;Ls&&Ls.indexOf("Edg/")>=0;Ls&&Ls.indexOf("Android")>=0;var La=typeof navigator=="object"?navigator:{};uy||document.queryCommandSupported&&document.queryCommandSupported("copy")||La&&La.clipboard&&La.clipboard.writeText,uy||La&&La.clipboard&&La.clipboard.readText;var v1=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ef=new v1,dy=new v1,fy=new v1,lE=new Array(230),Sx;(e=>{function t(p){return ef.keyCodeToStr(p)}e.toString=t;function n(p){return ef.strToKeyCode(p)}e.fromString=n;function r(p){return dy.keyCodeToStr(p)}e.toUserSettingsUS=r;function l(p){return fy.keyCodeToStr(p)}e.toUserSettingsGeneral=l;function h(p){return dy.strToKeyCode(p)||fy.strToKeyCode(p)}e.fromUserSettings=h;function d(p){if(p>=98&&p<=113)return null;switch(p){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ef.keyCodeToStr(p)}e.toElectronAccelerator=d})(Sx||={});var oE=class xx{constructor(t,n,r,l,h){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=l,this.keyCode=h}equals(t){return t instanceof xx&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${n}${r}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new cE([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},cE=class{constructor(e){if(e.length===0)throw Lk("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function hE(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Sx.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(v2)switch(t){case 59:return 85;case 60:if(sE)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ns)return 57;break}else if(Qk&&(Ns&&t===93||!Ns&&t===92))return 57;return lE[t]||0}var uE=Ns?256:2048,dE=512,fE=1024,pE=Ns?2048:256,py=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=hE(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=uE),this.altKey&&(t|=dE),this.shiftKey&&(t|=fE),this.metaKey&&(t|=pE),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new oE(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},gy=new WeakMap;function gE(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var mE=class{static getSameOriginWindowChain(e){let t=gy.get(e);if(!t){t=[],gy.set(e,t);let n=e,r;do r=gE(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,l=this.getSameOriginWindowChain(e);for(let h of l){let d=h.window.deref();if(n+=d?.scrollY??0,r+=d?.scrollX??0,d===t||!h.iframeElement)break;let p=h.iframeElement.getBoundingClientRect();n+=p.top,r+=p.left}return{top:n,left:r}}},ph=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=mE.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},my=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(m1){let l=navigator.userAgent.match(/Chrome\/(\d+)/);r=(l?parseInt(l[1]):123)<=122}if(e){let l=e,h=e,d=e.view?.devicePixelRatio||1;if(typeof l.wheelDeltaY<"u")r?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?v2&&!Ns?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")Jk&&yx?this.deltaX=-(l.wheelDeltaX/120):r?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?v2&&!Ns?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},wx=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),vE;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof _E?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ei.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:wx})})(vE||={});var _E=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?wx:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},_1=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new u2("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new u2("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},yE=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new u2("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=ht(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},SE;(e=>{async function t(r){let l,h=await Promise.all(r.map(d=>d.then(p=>p,p=>{l||(l=p)})));if(typeof l<"u")throw l;return h}e.settled=t;function n(r){return new Promise(async(l,h)=>{try{await r(l,h)}catch(d){h(d)}})}e.withAsyncBody=n})(SE||={});var vy=class Xi{static fromArray(t){return new Xi(n=>{n.emitMany(t)})}static fromPromise(t){return new Xi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Xi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Xi(async n=>{await Promise.all(t.map(async r=>{for await(let l of r)n.emitOne(l)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ue,queueMicrotask(async()=>{let r={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(r)),this.resolve()}catch(l){this.reject(l)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ei.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Xi(async r=>{for await(let l of t)r.emitOne(n(l))})}map(t){return Xi.map(this,t)}static filter(t,n){return new Xi(async r=>{for await(let l of t)n(l)&&r.emitOne(l)})}filter(t){return Xi.filter(this,t)}static coalesce(t){return Xi.filter(t,n=>!!n)}coalesce(){return Xi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Xi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};vy.EMPTY=vy.fromArray([]);var{getWindow:As,getWindowId:xE,onDidRegisterWindow:wE}=(function(){let e=new Map,t={window:sn,disposables:new Qn};e.set(sn.vscodeWindowId,t);let n=new ue,r=new ue,l=new ue;function h(d,p){return(typeof d=="number"?e.get(d):void 0)??(p?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:r.event,registerWindow(d){if(e.has(d.vscodeWindowId))return He.None;let p=new Qn,g={window:d,disposables:p.add(new Qn)};return e.set(d.vscodeWindowId,g),p.add(ht(()=>{e.delete(d.vscodeWindowId),r.fire(d)})),p.add(Te(d,Ut.BEFORE_UNLOAD,()=>{l.fire(d)})),n.fire(g),p},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:h,getWindow(d){let p=d;if(p?.ownerDocument?.defaultView)return p.ownerDocument.defaultView.window;let g=d;return g?.view?g.view.window:sn},getDocument(d){return As(d).document}}})(),bE=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Te(e,t,n,r){return new bE(e,t,n,r)}var _y=function(e,t,n,r){return Te(e,t,n,r)},y1,CE=class extends yE{constructor(e){super(),this.defaultTarget=e&&As(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},yy=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ch(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,l=h=>{n.set(h,!1);let d=e.get(h)??[];for(t.set(h,d),e.set(h,[]),r.set(h,!0);d.length>0;)d.sort(yy.sort),d.shift().execute();r.set(h,!1)};y1=(h,d,p=0)=>{let g=xE(h),m=new yy(d,p),v=e.get(g);return v||(v=[],e.set(g,v)),v.push(m),n.get(g)||(n.set(g,!0),h.requestAnimationFrame(()=>l(g))),m}})();function kE(e){let t=e.getBoundingClientRect(),n=As(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Ut={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},EE=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=wi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=wi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=wi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=wi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=wi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=wi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=wi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=wi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=wi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=wi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=wi(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=wi(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=wi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=wi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function wi(e){return typeof e=="number"?`${e}px`:e}function mo(e){return new EE(e)}var bx=class{constructor(){this._hooks=new Qn,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=l;let h=e;try{e.setPointerCapture(t),this._hooks.add(ht(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{h=As(e)}this._hooks.add(Te(h,Ut.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(Te(h,Ut.POINTER_UP,d=>this.stopMonitoring(!0)))}};function ME(e,t,n){let r=null,l=null;if(typeof n.value=="function"?(r="value",l=n.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",l=n.get),!l)throw new Error("not supported");let h=`$memoize$${t}`;n[r]=function(...d){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,d)}),this[h]}}var Ds;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ds||={});var ao=class si extends He{constructor(){super(),this.dispatched=!1,this.targets=new cy,this.ignoreTargets=new cy,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ei.runAndSubscribe(wE,({window:t,disposables:n})=>{n.add(Te(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(Te(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(Te(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:sn,disposables:this._store}))}static addTarget(t){if(!si.isTouchDevice())return He.None;si.INSTANCE||(si.INSTANCE=new si);let n=si.INSTANCE.targets.push(t);return ht(n)}static ignoreTarget(t){if(!si.isTouchDevice())return He.None;si.INSTANCE||(si.INSTANCE=new si);let n=si.INSTANCE.ignoreTargets.push(t);return ht(n)}static isTouchDevice(){return"ontouchstart"in sn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,l=t.targetTouches.length;r<l;r++){let h=t.targetTouches.item(r);this.activeTouches[h.identifier]={id:h.identifier,initialTarget:h.target,initialTimeStamp:n,initialPageX:h.pageX,initialPageY:h.pageY,rollingTimestamps:[n],rollingPageX:[h.pageX],rollingPageY:[h.pageY]};let d=this.newGestureEvent(Ds.Start,h.target);d.pageX=h.pageX,d.pageY=h.pageY,this.dispatchEvent(d)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),l=Object.keys(this.activeTouches).length;for(let h=0,d=n.changedTouches.length;h<d;h++){let p=n.changedTouches.item(h);if(!this.activeTouches.hasOwnProperty(String(p.identifier))){console.warn("move of an UNKNOWN touch",p);continue}let g=this.activeTouches[p.identifier],m=Date.now()-g.initialTimeStamp;if(m<si.HOLD_DELAY&&Math.abs(g.initialPageX-zi(g.rollingPageX))<30&&Math.abs(g.initialPageY-zi(g.rollingPageY))<30){let v=this.newGestureEvent(Ds.Tap,g.initialTarget);v.pageX=zi(g.rollingPageX),v.pageY=zi(g.rollingPageY),this.dispatchEvent(v)}else if(m>=si.HOLD_DELAY&&Math.abs(g.initialPageX-zi(g.rollingPageX))<30&&Math.abs(g.initialPageY-zi(g.rollingPageY))<30){let v=this.newGestureEvent(Ds.Contextmenu,g.initialTarget);v.pageX=zi(g.rollingPageX),v.pageY=zi(g.rollingPageY),this.dispatchEvent(v)}else if(l===1){let v=zi(g.rollingPageX),_=zi(g.rollingPageY),S=zi(g.rollingTimestamps)-g.rollingTimestamps[0],w=v-g.rollingPageX[0],b=_-g.rollingPageY[0],k=[...this.targets].filter(E=>g.initialTarget instanceof Node&&E.contains(g.initialTarget));this.inertia(t,k,r,Math.abs(w)/S,w>0?1:-1,v,Math.abs(b)/S,b>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(Ds.End,g.initialTarget)),delete this.activeTouches[p.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Ds.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>si.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Ds.Change||t.type===Ds.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let l=0,h=t.initialTarget;for(;h&&h!==r;)l++,h=h.parentElement;n.push([l,r])}n.sort((r,l)=>r[0]-l[0]);for(let[r,l]of n)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,l,h,d,p,g,m){this.handle=y1(t,()=>{let v=Date.now(),_=v-r,S=0,w=0,b=!0;l+=si.SCROLL_FRICTION*_,p+=si.SCROLL_FRICTION*_,l>0&&(b=!1,S=h*l*_),p>0&&(b=!1,w=g*p*_);let k=this.newGestureEvent(Ds.Change);k.translationX=S,k.translationY=w,n.forEach(E=>E.dispatchEvent(k)),b||this.inertia(t,n,v,l,h,d+S,p,g,m+w)})}onTouchMove(t){let n=Date.now();for(let r=0,l=t.changedTouches.length;r<l;r++){let h=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("end of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],p=this.newGestureEvent(Ds.Change,d.initialTarget);p.translationX=h.pageX-zi(d.rollingPageX),p.translationY=h.pageY-zi(d.rollingPageY),p.pageX=h.pageX,p.pageY=h.pageY,this.dispatchEvent(p),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(h.pageX),d.rollingPageY.push(h.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ao.SCROLL_FRICTION=-.005,ao.HOLD_DELAY=700,ao.CLEAR_TAP_COUNT_TIME=400,_t([ME],ao,"isTouchDevice",1);var jE=ao,S1=class extends He{onclick(e,t){this._register(Te(e,Ut.CLICK,n=>t(new ph(As(e),n))))}onmousedown(e,t){this._register(Te(e,Ut.MOUSE_DOWN,n=>t(new ph(As(e),n))))}onmouseover(e,t){this._register(Te(e,Ut.MOUSE_OVER,n=>t(new ph(As(e),n))))}onmouseleave(e,t){this._register(Te(e,Ut.MOUSE_LEAVE,n=>t(new ph(As(e),n))))}onkeydown(e,t){this._register(Te(e,Ut.KEY_DOWN,n=>t(new py(n))))}onkeyup(e,t){this._register(Te(e,Ut.KEY_UP,n=>t(new py(n))))}oninput(e,t){this._register(Te(e,Ut.INPUT,t))}onblur(e,t){this._register(Te(e,Ut.BLUR,t))}onfocus(e,t){this._register(Te(e,Ut.FOCUS,t))}onchange(e,t){this._register(Te(e,Ut.CHANGE,t))}ignoreGesture(e){return jE.ignoreTarget(e)}},Sy=11,TE=class extends S1{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Sy+"px",this.domNode.style.height=Sy+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new bx),this._register(_y(this.bgDomNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(_y(this.domNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new CE),this._pointerdownScheduleRepeatTimer=this._register(new _1)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,As(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},DE=class S2{constructor(t,n,r,l,h,d,p){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,l=l|0,h=h|0,d=d|0,p=p|0),this.rawScrollLeft=l,this.rawScrollTop=p,n<0&&(n=0),l+n>r&&(l=r-n),l<0&&(l=0),h<0&&(h=0),p+h>d&&(p=d-h),p<0&&(p=0),this.width=n,this.scrollWidth=r,this.scrollLeft=l,this.height=h,this.scrollHeight=d,this.scrollTop=p}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new S2(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new S2(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,h=this.scrollLeft!==t.scrollLeft,d=this.height!==t.height,p=this.scrollHeight!==t.scrollHeight,g=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:l,scrollLeftChanged:h,heightChanged:d,scrollHeightChanged:p,scrollTopChanged:g}}},RE=class extends He{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new DE(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new wy(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=wy.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},xy=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function tf(e,t){let n=t-e;return function(r){return e+n*LE(r)}}function AE(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var wy=class x2{constructor(t,n,r,l){this.from=t,this.to=n,this.duration=l,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let l,h;return t<n?(l=t+.75*r,h=n-.75*r):(l=t-.75*r,h=n+.75*r),AE(tf(t,l),tf(h,n),.33)}return tf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),l=this.scrollTop(n);return new xy(r,l,!1)}return new xy(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return x2.start(t,n,r)}static start(t,n,r){r=r+10;let l=Date.now()-10;return new x2(t,n,l,r)}};function NE(e){return Math.pow(e,3)}function LE(e){return 1-NE(1-e)}var BE=class extends He{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new _1)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},OE=140,Cx=class extends S1{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new BE(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new bx),this._shouldRender=!0,this.domNode=mo(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Te(this.domNode.domNode,Ut.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new TE(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=mo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,Ut.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),l=this._sliderPointerPosition(e);n<=l&&l<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let l=kE(this.domNode.domNode);t=e.pageX-l.left,n=e.pageY-l.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,l=>{let h=this._sliderOrthogonalPointerPosition(l),d=Math.abs(h-n);if(yx&&d>OE){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let p=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(p))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},kx=class w2{constructor(t,n,r,l,h,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=h,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new w2(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,l,h){let d=Math.max(0,r-t),p=Math.max(0,d-2*n),g=l>0&&l>r;if(!g)return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(p),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(r*p/l))),v=(p-m)/(l-r),_=h*v;return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(m),computedSliderRatio:v,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=w2._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},zE=class extends Cx{constructor(e,t,n){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kx(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,l.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},HE=class extends Cx{constructor(e,t,n){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kx(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,l.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},IE=500,by=50,UE=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},b2=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,l=this._rear;do{let h=l===this._front?t:Math.pow(2,-r);if(t-=h,n+=this._memory[l].score*h,l===this._front)break;l=(this._capacity+l-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(m1){let n=As(t.browserEvent),r=Xk(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let l=null,h=new UE(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=h,this._front=0,this._rear=0):(l=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=h),h.score=this._computeScore(h,l)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let l=Math.abs(t.deltaX),h=Math.abs(t.deltaY),d=Math.abs(n.deltaX),p=Math.abs(n.deltaY),g=Math.max(Math.min(l,d),1),m=Math.max(Math.min(h,p),1),v=Math.max(l,d),_=Math.max(h,p);v%g===0&&_%m===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};b2.INSTANCE=new b2;var PE=b2,qE=class extends S1{constructor(e,t,n){super(),this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ue),this.onWillScroll=this._onWillScroll.event,this._options=$E(t),this._scrollable=n,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let r={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new HE(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new zE(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=mo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=mo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=mo(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new _1),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Nr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Ns&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new my(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Nr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new my(n))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Ut.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=PE.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+l===0?h=l=0:Math.abs(l)>=Math.abs(h)?h=0:l=0),this._options.flipAxes&&([l,h]=[h,l]);let d=!Ns&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),g={};if(l){let m=by*l,v=p.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(g,v)}if(h){let m=by*h,v=p.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(g,v)}g=this._scrollable.validateScrollPosition(g),(p.scrollLeft!==g.scrollLeft||p.scrollTop!==g.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(g):this._scrollable.setScrollPositionNow(g),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",l=t?" top":"",h=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${h}${l}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),IE)}},VE=class extends qE{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function $E(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ns&&(t.className+=" mac"),t}var C2=class extends He{constructor(e,t,n,r,l,h,d,p){super(),this._bufferService=n,this._optionsService=d,this._renderService=p,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new RE({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>y1(r.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new VE(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},g)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ei.runAndSubscribe(h.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=h.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ht(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ht(()=>this._styleElement.remove())),this._register(ei.runAndSubscribe(h.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${h.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${h.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${h.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
-`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(m=>this._handleScroll(m)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};C2=_t([me(2,ui),me(3,un),me(4,rx),me(5,Za),me(6,di),me(7,dn)],C2);var k2=class extends He{constructor(e,t,n,r,l){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=l,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(h=>this._removeDecoration(h))),this._register(ht(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};k2=_t([me(1,ui),me(2,un),me(3,jo),me(4,dn)],k2);var WE=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ms={full:0,left:0,center:0,right:0},qn={full:0,left:0,center:0,right:0},Xl={full:0,left:0,center:0,right:0},Uh=class extends He{constructor(e,t,n,r,l,h,d,p){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=l,this._optionsService=h,this._themeService=d,this._coreBrowserService=p,this._colorZoneStore=new WE,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(ht(()=>this._canvas?.remove()));let g=this._canvas.getContext("2d");if(g)this._ctx=g;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);qn.full=this._canvas.width,qn.left=e,qn.center=t,qn.right=e,this._refreshDrawHeightConstants(),Xl.full=1,Xl.left=1,Xl.center=1+qn.left,Xl.right=1+qn.left+qn.center}_refreshDrawHeightConstants(){Ms.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ms.left=t,Ms.center=t,Ms.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ms.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Xl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ms[e.position||"full"]/2),qn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ms[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Uh=_t([me(2,ui),me(3,jo),me(4,dn),me(5,di),me(6,Za),me(7,un)],Uh);var ne;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
-`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ne||={});var Mh;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Mh||={});var Ex;(e=>e.ST=`${ne.ESC}\\`)(Ex||={});var E2=class{constructor(e,t,n,r,l,h){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=l,this._renderService=h,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ne.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};E2=_t([me(2,ui),me(3,di),me(4,zr),me(5,dn)],E2);var Pt=0,qt=0,Vt=0,vt=0,Cy={css:"#00000000",rgba:0},Et;(e=>{function t(l,h,d,p){return p!==void 0?`#${Mr(l)}${Mr(h)}${Mr(d)}${Mr(p)}`:`#${Mr(l)}${Mr(h)}${Mr(d)}`}e.toCss=t;function n(l,h,d,p=255){return(l<<24|h<<16|d<<8|p)>>>0}e.toRgba=n;function r(l,h,d,p){return{css:e.toCss(l,h,d,p),rgba:e.toRgba(l,h,d,p)}}e.toColor=r})(Et||={});var ot;(e=>{function t(g,m){if(vt=(m.rgba&255)/255,vt===1)return{css:m.css,rgba:m.rgba};let v=m.rgba>>24&255,_=m.rgba>>16&255,S=m.rgba>>8&255,w=g.rgba>>24&255,b=g.rgba>>16&255,k=g.rgba>>8&255;Pt=w+Math.round((v-w)*vt),qt=b+Math.round((_-b)*vt),Vt=k+Math.round((S-k)*vt);let E=Et.toCss(Pt,qt,Vt),j=Et.toRgba(Pt,qt,Vt);return{css:E,rgba:j}}e.blend=t;function n(g){return(g.rgba&255)===255}e.isOpaque=n;function r(g,m,v){let _=jh.ensureContrastRatio(g.rgba,m.rgba,v);if(_)return Et.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=r;function l(g){let m=(g.rgba|255)>>>0;return[Pt,qt,Vt]=jh.toChannels(m),{css:Et.toCss(Pt,qt,Vt),rgba:m}}e.opaque=l;function h(g,m){return vt=Math.round(m*255),[Pt,qt,Vt]=jh.toChannels(g.rgba),{css:Et.toCss(Pt,qt,Vt,vt),rgba:Et.toRgba(Pt,qt,Vt,vt)}}e.opacity=h;function d(g,m){return vt=g.rgba&255,h(g,vt*m/255)}e.multiplyOpacity=d;function p(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=p})(ot||={});var ft;(e=>{let t,n;try{let l=document.createElement("canvas");l.width=1,l.height=1;let h=l.getContext("2d",{willReadFrequently:!0});h&&(t=h,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return Pt=parseInt(l.slice(1,2).repeat(2),16),qt=parseInt(l.slice(2,3).repeat(2),16),Vt=parseInt(l.slice(3,4).repeat(2),16),Et.toColor(Pt,qt,Vt);case 5:return Pt=parseInt(l.slice(1,2).repeat(2),16),qt=parseInt(l.slice(2,3).repeat(2),16),Vt=parseInt(l.slice(3,4).repeat(2),16),vt=parseInt(l.slice(4,5).repeat(2),16),Et.toColor(Pt,qt,Vt,vt);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let h=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(h)return Pt=parseInt(h[1]),qt=parseInt(h[2]),Vt=parseInt(h[3]),vt=Math.round((h[5]===void 0?1:parseFloat(h[5]))*255),Et.toColor(Pt,qt,Vt,vt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Pt,qt,Vt,vt]=t.getImageData(0,0,1,1).data,vt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Et.toRgba(Pt,qt,Vt,vt),css:l}}e.toColor=r})(ft||={});var ci;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,l,h){let d=r/255,p=l/255,g=h/255,m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),_=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4);return m*.2126+v*.7152+_*.0722}e.relativeLuminance2=n})(ci||={});var jh;(e=>{function t(d,p){if(vt=(p&255)/255,vt===1)return p;let g=p>>24&255,m=p>>16&255,v=p>>8&255,_=d>>24&255,S=d>>16&255,w=d>>8&255;return Pt=_+Math.round((g-_)*vt),qt=S+Math.round((m-S)*vt),Vt=w+Math.round((v-w)*vt),Et.toRgba(Pt,qt,Vt)}e.blend=t;function n(d,p,g){let m=ci.relativeLuminance(d>>8),v=ci.relativeLuminance(p>>8);if(Xs(m,v)<g){if(v<m){let w=r(d,p,g),b=Xs(m,ci.relativeLuminance(w>>8));if(b<g){let k=l(d,p,g),E=Xs(m,ci.relativeLuminance(k>>8));return b>E?w:k}return w}let _=l(d,p,g),S=Xs(m,ci.relativeLuminance(_>>8));if(S<g){let w=r(d,p,g),b=Xs(m,ci.relativeLuminance(w>>8));return S>b?_:w}return _}}e.ensureContrastRatio=n;function r(d,p,g){let m=d>>24&255,v=d>>16&255,_=d>>8&255,S=p>>24&255,w=p>>16&255,b=p>>8&255,k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));for(;k<g&&(S>0||w>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));return(S<<24|w<<16|b<<8|255)>>>0}e.reduceLuminance=r;function l(d,p,g){let m=d>>24&255,v=d>>16&255,_=d>>8&255,S=p>>24&255,w=p>>16&255,b=p>>8&255,k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));for(;k<g&&(S<255||w<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=Xs(ci.relativeLuminance2(S,w,b),ci.relativeLuminance2(m,v,_));return(S<<24|w<<16|b<<8|255)>>>0}e.increaseLuminance=l;function h(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=h})(jh||={});function Mr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xs(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var FE=class extends Mo{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ph=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new is}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),l=0,h=0,d=0,p=t.getFg(0),g=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==g){if(m-l>1){let v=this._getJoinedRanges(r,d,h,t,l);for(let _=0;_<v.length;_++)n.push(v[_])}l=m,d=h,p=this._workCell.fg,g=this._workCell.bg}h+=this._workCell.getChars().length||Gn.length}if(this._bufferService.cols-l>1){let m=this._getJoinedRanges(r,d,h,t,l);for(let v=0;v<m.length;v++)n.push(m[v])}return n}_getJoinedRanges(e,t,n,r,l){let h=e.substring(t,n),d=[];try{d=this._characterJoiners[0].handler(h)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let g=this._characterJoiners[p].handler(h);for(let m=0;m<g.length;m++)Ph._mergeRanges(d,g[m])}catch(g){console.error(g)}return this._stringRangesToCellRanges(d,r,l),d}_stringRangesToCellRanges(e,t,n){let r=0,l=!1,h=0,d=e[r];if(d){for(let p=n;p<this._bufferService.cols;p++){let g=t.getWidth(p),m=t.getString(p).length||Gn.length;if(g!==0){if(!l&&d[0]<=h&&(d[0]=p,l=!0),d[1]<=h){if(d[1]=p,d=e[++r],!d)break;d[0]<=h?(d[0]=p,l=!0):l=!1}h+=m}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let l=e[r];if(n){if(t[1]<=l[0])return e[r-1][1]=t[1],e;if(t[1]<=l[1])return e[r-1][1]=Math.max(t[1],l[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=l[0])return e.splice(r,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Ph=_t([me(0,ui)],Ph);function KE(e){return 57508<=e&&e<=57558}function YE(e){return 9472<=e&&e<=9631}function GE(e){return KE(e)||YE(e)}function ZE(){return{css:{canvas:gh(),cell:gh()},device:{canvas:gh(),cell:gh(),char:{width:0,height:0,left:0,top:0}}}}function gh(){return{width:0,height:0}}var M2=class{constructor(e,t,n,r,l,h,d){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=l,this._decorationService=h,this._themeService=d,this._workCell=new is,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,l,h,d,p,g,m,v){let _=[],S=this._characterJoinerService.getJoinedCharacters(t),w=this._themeService.colors,b=e.getNoBgTrimmedLength();n&&b<h+1&&(b=h+1);let k,E=0,j="",V=0,A=0,z=0,F=0,R=!1,I=0,q=!1,U=0,Y=0,$=[],M=m!==-1&&v!==-1;for(let N=0;N<b;N++){e.loadCell(N,this._workCell);let L=this._workCell.getWidth();if(L===0)continue;let O=!1,P=N>=Y,te=N,Q=this._workCell;if(S.length>0&&N===S[0][0]&&P){let Re=S.shift(),fi=this._isCellInSelection(Re[0],t);for(V=Re[0]+1;V<Re[1];V++)P&&=fi===this._isCellInSelection(V,t);P&&=!n||h<Re[0]||h>=Re[1],P?(O=!0,Q=new FE(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),te=Re[1]-1,L=Q.getWidth()):Y=Re[1]}let ce=this._isCellInSelection(N,t),re=n&&N===h,de=M&&N>=m&&N<=v,Ce=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Re=>{Ce=!0});let je=Q.getChars()||Gn;if(je===" "&&(Q.isUnderline()||Q.isOverline())&&(je=" "),U=L*p-g.get(je,Q.isBold(),Q.isItalic()),!k)k=this._document.createElement("span");else if(E&&(ce&&q||!ce&&!q&&Q.bg===A)&&(ce&&q&&w.selectionForeground||Q.fg===z)&&Q.extended.ext===F&&de===R&&U===I&&!re&&!O&&!Ce&&P){Q.isInvisible()?j+=Gn:j+=je,E++;continue}else E&&(k.textContent=j),k=this._document.createElement("span"),E=0,j="";if(A=Q.bg,z=Q.fg,F=Q.extended.ext,R=de,I=U,q=ce,O&&h>=N&&h<=te&&(h=N),!this._coreService.isCursorHidden&&re&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&$.push("xterm-cursor-blink"),$.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(Q.isBold()&&$.push("xterm-bold"),Q.isItalic()&&$.push("xterm-italic"),Q.isDim()&&$.push("xterm-dim"),Q.isInvisible()?j=Gn:j=Q.getChars()||Gn,Q.isUnderline()&&($.push(`xterm-underline-${Q.extended.underlineStyle}`),j===" "&&(j=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Mo.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let Re=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&Re<8&&(Re+=8),k.style.textDecorationColor=w.ansi[Re].css}Q.isOverline()&&($.push("xterm-overline"),j===" "&&(j=" ")),Q.isStrikethrough()&&$.push("xterm-strikethrough"),de&&(k.style.textDecoration="underline");let D=Q.getFgColor(),J=Q.getFgColorMode(),le=Q.getBgColor(),he=Q.getBgColorMode(),we=!!Q.isInverse();if(we){let Re=D;D=le,le=Re;let fi=J;J=he,he=fi}let xe,be,pe=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Re=>{Re.options.layer!=="top"&&pe||(Re.backgroundColorRGB&&(he=50331648,le=Re.backgroundColorRGB.rgba>>8&16777215,xe=Re.backgroundColorRGB),Re.foregroundColorRGB&&(J=50331648,D=Re.foregroundColorRGB.rgba>>8&16777215,be=Re.foregroundColorRGB),pe=Re.options.layer==="top")}),!pe&&ce&&(xe=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,le=xe.rgba>>8&16777215,he=50331648,pe=!0,w.selectionForeground&&(J=50331648,D=w.selectionForeground.rgba>>8&16777215,be=w.selectionForeground)),pe&&$.push("xterm-decoration-top");let _e;switch(he){case 16777216:case 33554432:_e=w.ansi[le],$.push(`xterm-bg-${le}`);break;case 50331648:_e=Et.toColor(le>>16,le>>8&255,le&255),this._addStyle(k,`background-color:#${ky((le>>>0).toString(16),"0",6)}`);break;default:we?(_e=w.foreground,$.push("xterm-bg-257")):_e=w.background}switch(xe||Q.isDim()&&(xe=ot.multiplyOpacity(_e,.5)),J){case 16777216:case 33554432:Q.isBold()&&D<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(D+=8),this._applyMinimumContrast(k,_e,w.ansi[D],Q,xe,void 0)||$.push(`xterm-fg-${D}`);break;case 50331648:let Re=Et.toColor(D>>16&255,D>>8&255,D&255);this._applyMinimumContrast(k,_e,Re,Q,xe,be)||this._addStyle(k,`color:#${ky(D.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,_e,w.foreground,Q,xe,be)||we&&$.push("xterm-fg-257")}$.length&&(k.className=$.join(" "),$.length=0),!re&&!O&&!Ce&&P?E++:k.textContent=j,U!==this.defaultSpacing&&(k.style.letterSpacing=`${U}px`),_.push(k),N=te}return k&&E&&(k.textContent=j),_}_applyMinimumContrast(e,t,n,r,l,h){if(this._optionsService.rawOptions.minimumContrastRatio===1||GE(r.getCode()))return!1;let d=this._getContrastCache(r),p;if(!l&&!h&&(p=d.getColor(t.rgba,n.rgba)),p===void 0){let g=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);p=ot.ensureContrastRatio(l||t,h||n,g),d.setColor((l||t).rgba,(h||n).rgba,p??null)}return p?(this._addStyle(e,`color:${p.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};M2=_t([me(1,ox),me(2,di),me(3,un),me(4,zr),me(5,jo),me(6,Za)],M2);function ky(e,t,n){for(;e.length<n;)e=t+e;return e}var XE=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let h=e.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[n,r,l,h],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(l),this._container.appendChild(h),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let d=this._measure(e,0);return d>0&&(this._flat[r]=d),d}let l=e;t&&(l+="B"),n&&(l+="I");let h=this._holey.get(l);if(h===void 0){let d=0;t&&(d|=1),n&&(d|=2),h=this._measure(e,d),h>0&&this._holey.set(l,h)}return h}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},QE=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let l=e.buffers.active.ydisp,h=t[1]-l,d=n[1]-l,p=Math.max(h,0),g=Math.min(d,e.rows-1);if(p>=e.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=h,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=g,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function JE(){return new QE}var sf="xterm-dom-renderer-owner-",Zi="xterm-rows",mh="xterm-fg-",Ey="xterm-bg-",Ql="xterm-focus",vh="xterm-selection",eM=1,j2=class extends He{constructor(e,t,n,r,l,h,d,p,g,m,v,_,S,w){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=l,this._helperContainer=h,this._linkifier2=d,this._charSizeService=g,this._optionsService=m,this._bufferService=v,this._coreService=_,this._coreBrowserService=S,this._themeService=w,this._terminalClass=eM++,this._rowElements=[],this._selectionRenderModel=JE(),this.onRequestRedraw=this._register(new ue).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Zi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(vh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=ZE(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(M2,document),this._element.classList.add(sf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(ht(()=>{this._element.classList.remove(sf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new XE(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Zi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Zi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Zi} .xterm-dim { color: ${ot.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${vh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${vh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${vh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[h,d]of e.ansi.entries())t+=`${this._terminalSelector} .${mh}${h} { color: ${d.css}; }${this._terminalSelector} .${mh}${h}.xterm-dim { color: ${ot.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${Ey}${h} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${mh}257 { color: ${ot.opaque(e.background).css}; }${this._terminalSelector} .${mh}257.xterm-dim { color: ${ot.multiplyOpacity(ot.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ey}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ql),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ql),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,l=this._selectionRenderModel.viewportEndRow,h=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(n){let g=e[0]>t[0];p.appendChild(this._createSelectionElement(h,g?t[0]:e[0],g?e[0]:t[0],d-h+1))}else{let g=r===h?e[0]:0,m=h===l?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(h,g,m));let v=d-h-1;if(p.appendChild(this._createSelectionElement(h+1,0,this._bufferService.cols,v)),h!==d){let _=l===d?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(d,0,_))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,n,r=1){let l=this._document.createElement("div"),h=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-t);return h+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-h),l.style.height=`${r*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${h}px`,l.style.width=`${d}px`,l}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,l=Math.min(n.x,this._bufferService.cols-1),h=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=e;g<=t;g++){let m=g+n.ydisp,v=this._rowElements[g],_=n.lines.get(m);if(!v||!_)break;v.replaceChildren(...this._rowFactory.createRow(_,m,m===r,d,p,l,h,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${sf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,l,h){n<0&&(e=0),r<0&&(t=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),r=Math.max(Math.min(r,d),0),l=Math.min(l,this._bufferService.cols);let p=this._bufferService.buffer,g=p.ybase+p.y,m=Math.min(p.x,l-1),v=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let w=n;w<=r;++w){let b=w+p.ydisp,k=this._rowElements[w],E=p.lines.get(b);if(!k||!E)break;k.replaceChildren(...this._rowFactory.createRow(E,b,b===g,_,S,m,v,this.dimensions.css.cell.width,this._widthCache,h?w===n?e:0:-1,h?(w===r?t:l)-1:-1))}}};j2=_t([me(7,f1),me(8,Xh),me(9,di),me(10,ui),me(11,zr),me(12,un),me(13,Za)],j2);var T2=class extends He{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ue),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new iM(this._optionsService))}catch{this._measureStrategy=this._register(new tM(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};T2=_t([me(2,di)],T2);var Mx=class extends He{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},tM=class extends Mx{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},iM=class extends Mx{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},sM=class extends He{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new nM(this._window)),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ue),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},nM=class extends He{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Fa),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ht(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},rM=class extends He{constructor(){super(),this.linkProviders=[],this._register(ht(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function x1(e,t,n){let r=n.getBoundingClientRect(),l=e.getComputedStyle(n),h=parseInt(l.getPropertyValue("padding-left")),d=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-r.left-h,t.clientY-r.top-d]}function aM(e,t,n,r,l,h,d,p,g){if(!h)return;let m=x1(e,t,n);if(m)return m[0]=Math.ceil((m[0]+(g?d/2:0))/d),m[1]=Math.ceil(m[1]/p),m[0]=Math.min(Math.max(m[0],1),r+(g?1:0)),m[1]=Math.min(Math.max(m[1],1),l),m}var D2=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,l){return aM(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let n=x1(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};D2=_t([me(0,dn),me(1,Xh)],D2);var lM=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},jx={};vk(jx,{getSafariVersion:()=>cM,isChromeOS:()=>Ax,isFirefox:()=>Tx,isIpad:()=>hM,isIphone:()=>uM,isLegacyEdge:()=>oM,isLinux:()=>w1,isMac:()=>qh,isNode:()=>Qh,isSafari:()=>Dx,isWindows:()=>Rx});var Qh=typeof process<"u"&&"title"in process,To=Qh?"node":navigator.userAgent,Do=Qh?"node":navigator.platform,Tx=To.includes("Firefox"),oM=To.includes("Edge"),Dx=/^((?!chrome|android).)*safari/i.test(To);function cM(){if(!Dx)return 0;let e=To.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var qh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Do),hM=Do==="iPad",uM=Do==="iPhone",Rx=["Windows","Win16","Win32","WinCE"].includes(Do),w1=Do.indexOf("Linux")>=0,Ax=/\bCrOS\b/.test(To),Nx=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),l=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),l=e.timeRemaining(),n*1.5>l){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=l}this.clear()}},dM=class extends Nx{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},fM=class extends Nx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Vh=!Qh&&"requestIdleCallback"in window?fM:dM,pM=class{constructor(){this._queue=new Vh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},R2=class extends He{constructor(e,t,n,r,l,h,d,p,g){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=l,this._coreBrowserService=p,this._renderer=this._register(new Fa),this._pausedResizeTask=new pM,this._observerDisposable=this._register(new Fa),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new ue),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ue),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ue),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new lM((m,v)=>this._renderRows(m,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new gM(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ht(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(h.onDecorationRegistered(()=>this._fullRefresh())),this._register(h.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(g.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=ht(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};R2=_t([me(2,di),me(3,Xh),me(4,zr),me(5,jo),me(6,ui),me(7,un),me(8,Za)],R2);var gM=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function mM(e,t,n,r){let l=n.buffer.x,h=n.buffer.y;if(!n.buffer.hasScrollback)return yM(l,h,e,t,n,r)+Jh(h,t,n,r)+SM(l,h,e,t,n,r);let d;if(h===t)return d=l>e?"D":"C",xo(Math.abs(l-e),So(d,r));d=h>t?"D":"C";let p=Math.abs(h-t),g=_M(h>t?e:l,n)+(p-1)*n.cols+1+vM(h>t?l:e);return xo(g,So(d,r))}function vM(e,t){return e-1}function _M(e,t){return t.cols-e}function yM(e,t,n,r,l,h){return Jh(t,r,l,h).length===0?"":xo(Bx(e,t,e,t-Lr(t,l),!1,l).length,So("D",h))}function Jh(e,t,n,r){let l=e-Lr(e,n),h=t-Lr(t,n),d=Math.abs(l-h)-xM(e,t,n);return xo(d,So(Lx(e,t),r))}function SM(e,t,n,r,l,h){let d;Jh(t,r,l,h).length>0?d=r-Lr(r,l):d=t;let p=r,g=wM(e,t,n,r,l,h);return xo(Bx(e,d,n,p,g==="C",l).length,So(g,h))}function xM(e,t,n){let r=0,l=e-Lr(e,n),h=t-Lr(t,n);for(let d=0;d<Math.abs(l-h);d++){let p=Lx(e,t)==="A"?-1:1;n.buffer.lines.get(l+p*d)?.isWrapped&&r++}return r}function Lr(e,t){let n=0,r=t.buffer.lines.get(e),l=r?.isWrapped;for(;l&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),l=r?.isWrapped;return n}function wM(e,t,n,r,l,h){let d;return Jh(n,r,l,h).length>0?d=r-Lr(r,l):d=t,e<n&&d<=r||e>=n&&d<r?"C":"D"}function Lx(e,t){return e>t?"A":"B"}function Bx(e,t,n,r,l,h){let d=e,p=t,g="";for(;(d!==n||p!==r)&&p>=0&&p<h.buffer.lines.length;)d+=l?1:-1,l&&d>h.cols-1?(g+=h.buffer.translateBufferLineToString(p,!1,e,d),d=0,e=0,p++):!l&&d<0&&(g+=h.buffer.translateBufferLineToString(p,!1,0,e+1),d=h.cols-1,e=d,p--);return g+h.buffer.translateBufferLineToString(p,!1,e,d)}function So(e,t){let n=t?"O":"[";return ne.ESC+n+e}function xo(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var bM=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function My(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var nf=50,CM=15,kM=50,EM=500,MM=" ",jM=new RegExp(MM,"g"),A2=class extends He{constructor(e,t,n,r,l,h,d,p,g){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=l,this._mouseService=h,this._optionsService=d,this._renderService=p,this._coreBrowserService=g,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new is,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ue),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ue),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new bM(this._bufferService),this._activeSelectionMode=0,this._register(ht(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let l=e[0]<t[0]?e[0]:t[0],h=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let p=n.translateBufferLineToString(d,!0,l,h);r.push(p)}}else{let l=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],l));for(let h=e[1]+1;h<=t[1]-1;h++){let d=n.lines.get(h),p=n.translateBufferLineToString(h,!0);d?.isWrapped?r[r.length-1]+=p:r.push(p)}if(e[1]!==t[1]){let h=n.lines.get(t[1]),d=n.translateBufferLineToString(t[1],!0,0,t[0]);h&&h.isWrapped?r[r.length-1]+=d:r.push(d)}}return r.map(l=>l.replace(jM," ")).join(Rx?`\r
-`:`
-`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),w1&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=My(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=x1(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-nf),nf),t/=nf,t/Math.abs(t)+Math.round(t*(CM-1)))}shouldForceSelection(e){return qh?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),kM)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(qh&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<EM&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=mM(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let l=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:l>1&&t!==r&&(n+=l-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let l=this._bufferService.buffer,h=l.lines.get(e[1]);if(!h)return;let d=l.translateBufferLineToString(e[1],!1),p=this._convertViewportColToCharacterIndex(h,e[0]),g=p,m=e[0]-p,v=0,_=0,S=0,w=0;if(d.charAt(p)===" "){for(;p>0&&d.charAt(p-1)===" ";)p--;for(;g<d.length&&d.charAt(g+1)===" ";)g++}else{let E=e[0],j=e[0];h.getWidth(E)===0&&(v++,E--),h.getWidth(j)===2&&(_++,j++);let V=h.getString(j).length;for(V>1&&(w+=V-1,g+=V-1);E>0&&p>0&&!this._isCharWordSeparator(h.loadCell(E-1,this._workCell));){h.loadCell(E-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):A>1&&(S+=A-1,p-=A-1),p--,E--}for(;j<h.length&&g+1<d.length&&!this._isCharWordSeparator(h.loadCell(j+1,this._workCell));){h.loadCell(j+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,j++):A>1&&(w+=A-1,g+=A-1),g++,j++}}g++;let b=p+m-v+S,k=Math.min(this._bufferService.cols,g-p+v+_-S-w);if(!(!t&&d.slice(p,g).trim()==="")){if(n&&b===0&&h.getCodePoint(0)!==32){let E=l.lines.get(e[1]-1);if(E&&h.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let j=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(j){let V=this._bufferService.cols-j.start;b-=V,k+=V}}}if(r&&b+k===this._bufferService.cols&&h.getCodePoint(this._bufferService.cols-1)!==32){let E=l.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let j=this._getWordAt([0,e[1]+1],!1,!1,!0);j&&(k+=j.length)}}return{start:b,length:k}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=My(n,this._bufferService.cols)}};A2=_t([me(3,ui),me(4,zr),me(5,p1),me(6,di),me(7,dn),me(8,un)],A2);var jy=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Ty=class{constructor(){this._color=new jy,this._css=new jy}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Tt=Object.freeze((()=>{let e=[ft.toColor("#2e3436"),ft.toColor("#cc0000"),ft.toColor("#4e9a06"),ft.toColor("#c4a000"),ft.toColor("#3465a4"),ft.toColor("#75507b"),ft.toColor("#06989a"),ft.toColor("#d3d7cf"),ft.toColor("#555753"),ft.toColor("#ef2929"),ft.toColor("#8ae234"),ft.toColor("#fce94f"),ft.toColor("#729fcf"),ft.toColor("#ad7fa8"),ft.toColor("#34e2e2"),ft.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],l=t[n/6%6|0],h=t[n%6];e.push({css:Et.toCss(r,l,h),rgba:Et.toRgba(r,l,h)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Et.toCss(r,r,r),rgba:Et.toRgba(r,r,r)})}return e})()),jr=ft.toColor("#ffffff"),lo=ft.toColor("#000000"),Dy=ft.toColor("#ffffff"),Ry=lo,Jl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},TM=jr,N2=class extends He{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ty,this._halfContrastCache=new Ty,this._onChangeColors=this._register(new ue),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:jr,background:lo,cursor:Dy,cursorAccent:Ry,selectionForeground:void 0,selectionBackgroundTransparent:Jl,selectionBackgroundOpaque:ot.blend(lo,Jl),selectionInactiveBackgroundTransparent:Jl,selectionInactiveBackgroundOpaque:ot.blend(lo,Jl),scrollbarSliderBackground:ot.opacity(jr,.2),scrollbarSliderHoverBackground:ot.opacity(jr,.4),scrollbarSliderActiveBackground:ot.opacity(jr,.5),overviewRulerBorder:jr,ansi:Tt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=it(e.foreground,jr),t.background=it(e.background,lo),t.cursor=ot.blend(t.background,it(e.cursor,Dy)),t.cursorAccent=ot.blend(t.background,it(e.cursorAccent,Ry)),t.selectionBackgroundTransparent=it(e.selectionBackground,Jl),t.selectionBackgroundOpaque=ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=it(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?it(e.selectionForeground,Cy):void 0,t.selectionForeground===Cy&&(t.selectionForeground=void 0),ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ot.opacity(t.selectionBackgroundTransparent,.3)),ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=it(e.scrollbarSliderBackground,ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=it(e.scrollbarSliderHoverBackground,ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=it(e.scrollbarSliderActiveBackground,ot.opacity(t.foreground,.5)),t.overviewRulerBorder=it(e.overviewRulerBorder,TM),t.ansi=Tt.slice(),t.ansi[0]=it(e.black,Tt[0]),t.ansi[1]=it(e.red,Tt[1]),t.ansi[2]=it(e.green,Tt[2]),t.ansi[3]=it(e.yellow,Tt[3]),t.ansi[4]=it(e.blue,Tt[4]),t.ansi[5]=it(e.magenta,Tt[5]),t.ansi[6]=it(e.cyan,Tt[6]),t.ansi[7]=it(e.white,Tt[7]),t.ansi[8]=it(e.brightBlack,Tt[8]),t.ansi[9]=it(e.brightRed,Tt[9]),t.ansi[10]=it(e.brightGreen,Tt[10]),t.ansi[11]=it(e.brightYellow,Tt[11]),t.ansi[12]=it(e.brightBlue,Tt[12]),t.ansi[13]=it(e.brightMagenta,Tt[13]),t.ansi[14]=it(e.brightCyan,Tt[14]),t.ansi[15]=it(e.brightWhite,Tt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=it(e.extendedAnsi[r],Tt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};N2=_t([me(0,di)],N2);function it(e,t){if(e!==void 0)try{return ft.toColor(e)}catch{}return t}var DM=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},RM=class{constructor(){this._services=new DM,this._services.set(f1,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Ck(e).sort((h,d)=>h.index-d.index),r=[];for(let h of n){let d=this._services.get(h.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${h.id._id}.`);r.push(d)}let l=n.length>0?n[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},AM={trace:0,debug:1,info:2,warn:3,error:4,off:5},NM="xterm.js: ",L2=class extends He{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=AM[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":NM)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};L2=_t([me(0,di)],L2);var Ay=class extends He{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ue),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ue),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ue),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let l=t-1;l>=0;l--)this.set(e+l+n,this.get(e+l));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ze=3,kt=Object.freeze(new Mo),_h=0,rf=2,oo=class Ox{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ze);let l=n||is.fromCharData([0,tx,1,0]);for(let h=0;h<t;++h)this.setCell(h,l);this.length=t}get(t){let n=this._data[t*ze+0],r=n&2097151;return[this._data[t*ze+1],n&2097152?this._combined[t]:r?Fn(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*ze+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*ze+0]=t|2097152|n[2]<<22):this._data[t*ze+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*ze+0]>>22}hasWidth(t){return this._data[t*ze+0]&12582912}getFg(t){return this._data[t*ze+1]}getBg(t){return this._data[t*ze+2]}hasContent(t){return this._data[t*ze+0]&4194303}getCodePoint(t){let n=this._data[t*ze+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*ze+0]&2097152}getString(t){let n=this._data[t*ze+0];return n&2097152?this._combined[t]:n&2097151?Fn(n&2097151):""}isProtected(t){return this._data[t*ze+2]&536870912}loadCell(t,n){return _h=t*ze,n.content=this._data[_h+0],n.fg=this._data[_h+1],n.bg=this._data[_h+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*ze+0]=n.content,this._data[t*ze+1]=n.fg,this._data[t*ze+2]=n.bg}setCellFromCodepoint(t,n,r,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*ze+0]=n|r<<22,this._data[t*ze+1]=l.fg,this._data[t*ze+2]=l.bg}addCodepointToCell(t,n,r){let l=this._data[t*ze+0];l&2097152?this._combined[t]+=Fn(n):l&2097151?(this._combined[t]=Fn(l&2097151)+Fn(n),l&=-2097152,l|=2097152):l=n|1<<22,r&&(l&=-12582913,l|=r<<22),this._data[t*ze+0]=l}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let l=new is;for(let h=this.length-t-n-1;h>=0;--h)this.setCell(t+n+h,this.loadCell(t+h,l));for(let h=0;h<n;++h)this.setCell(t+h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let l=new is;for(let h=0;h<this.length-t-n;++h)this.setCell(t+h,this.loadCell(t+n+h,l));for(let h=this.length-n;h<this.length;++h)this.setCell(h,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*rf<this._data.buffer.byteLength;let r=t*ze;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let l=new Uint32Array(r);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,n)}else{this._data=this._data.subarray(0,r);let l=Object.keys(this._combined);for(let d=0;d<l.length;d++){let p=parseInt(l[d],10);p>=t&&delete this._combined[p]}let h=Object.keys(this._extendedAttrs);for(let d=0;d<h.length;d++){let p=parseInt(h[d],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,r*4*rf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*rf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Ox(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303)return t+(this._data[t*ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303||this._data[t*ze+2]&50331648)return t+(this._data[t*ze+0]>>22);return 0}copyCellsFrom(t,n,r,l,h){let d=t._data;if(h)for(let g=l-1;g>=0;g--){for(let m=0;m<ze;m++)this._data[(r+g)*ze+m]=d[(n+g)*ze+m];d[(n+g)*ze+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[n+g])}else for(let g=0;g<l;g++){for(let m=0;m<ze;m++)this._data[(r+g)*ze+m]=d[(n+g)*ze+m];d[(n+g)*ze+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[n+g])}let p=Object.keys(t._combined);for(let g=0;g<p.length;g++){let m=parseInt(p[g],10);m>=n&&(this._combined[m-n+r]=t._combined[m])}}translateToString(t,n,r,l){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),l&&(l.length=0);let h="";for(;n<r;){let d=this._data[n*ze+0],p=d&2097151,g=d&2097152?this._combined[n]:p?Fn(p):Gn;if(h+=g,l)for(let m=0;m<g.length;++m)l.push(n);n+=d>>22||1}return l&&l.push(n),h}};function LM(e,t,n,r,l,h){let d=[];for(let p=0;p<e.length-1;p++){let g=p,m=e.get(++g);if(!m.isWrapped)continue;let v=[e.get(p)];for(;g<e.length&&m.isWrapped;)v.push(m),m=e.get(++g);if(!h&&r>=p&&r<g){p+=v.length-1;continue}let _=0,S=wo(v,_,t),w=1,b=0;for(;w<v.length;){let E=wo(v,w,t),j=E-b,V=n-S,A=Math.min(j,V);v[_].copyCellsFrom(v[w],b,S,A,!1),S+=A,S===n&&(_++,S=0),b+=A,b===E&&(w++,b=0),S===0&&_!==0&&v[_-1].getWidth(n-1)===2&&(v[_].copyCellsFrom(v[_-1],n-1,S++,1,!1),v[_-1].setCell(n-1,l))}v[_].replaceCells(S,n,l);let k=0;for(let E=v.length-1;E>0&&(E>_||v[E].getTrimmedLength()===0);E--)k++;k>0&&(d.push(p+v.length-k),d.push(k)),p+=v.length-1}return d}function BM(e,t){let n=[],r=0,l=t[r],h=0;for(let d=0;d<e.length;d++)if(l===d){let p=t[++r];e.onDeleteEmitter.fire({index:d-h,amount:p}),d+=p-1,h+=p,l=t[++r]}else n.push(d);return{layout:n,countRemoved:h}}function OM(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function zM(e,t,n){let r=[],l=e.map((g,m)=>wo(e,m,t)).reduce((g,m)=>g+m),h=0,d=0,p=0;for(;p<l;){if(l-p<n){r.push(l-p);break}h+=n;let g=wo(e,d,t);h>g&&(h-=g,d++);let m=e[d].getWidth(h-1)===2;m&&h--;let v=m?n-1:n;r.push(v),p+=v}return r}function wo(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,l=e[t+1].getWidth(0)===2;return r&&l?n-1:n}var zx=class Hx{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Hx._nextId++,this._onDispose=this.register(new ue),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Nr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};zx._nextId=1;var HM=zx,Nt={},Tr=Nt.B;Nt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Nt.A={"#":"£"};Nt.B=void 0;Nt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Nt.C=Nt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Nt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Nt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Nt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Nt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Nt.E=Nt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Nt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Nt.H=Nt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Nt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Ny=4294967295,Ly=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=kt.clone(),this.savedCharset=Tr,this.markers=[],this._nullCell=is.fromCharData([0,tx,1,0]),this._whitespaceCell=is.fromCharData([0,Gn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Vh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ay(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Ih),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Ih),this._whitespaceCell}getBlankLine(e,t){return new oo(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Ny?Ny:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=kt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Ay(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(kt),r=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)r+=+this.lines.get(d).resize(e,n);let h=0;if(this._rows<t)for(let d=this._rows;d<t;d++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new oo(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+h+1?(this.ybase--,h++,this.ydisp>0&&this.ydisp--):this.lines.push(new oo(e,n)));else for(let d=this._rows;d>t;d--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){let d=this.lines.length-l;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),h&&(this.y+=h),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let h=0;h<this.lines.length;h++)r+=+this.lines.get(h).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=LM(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(kt),n);if(r.length>0){let l=BM(this.lines,r);OM(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(kt),l=n;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new oo(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(kt),l=[],h=0;for(let d=this.lines.length-1;d>=0;d--){let p=this.lines.get(d);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;let g=[p];for(;p.isWrapped&&d>0;)p=this.lines.get(--d),g.unshift(p);if(!n){let A=this.ybase+this.y;if(A>=d&&A<d+g.length)continue}let m=g[g.length-1].getTrimmedLength(),v=zM(g,this._cols,e),_=v.length-g.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+_):S=Math.max(0,this.lines.length-this.lines.maxLength+_);let w=[];for(let A=0;A<_;A++){let z=this.getBlankLine(kt,!0);w.push(z)}w.length>0&&(l.push({start:d+g.length+h,newLines:w}),h+=w.length),g.push(...w);let b=v.length-1,k=v[b];k===0&&(b--,k=v[b]);let E=g.length-_-1,j=m;for(;E>=0;){let A=Math.min(j,k);if(g[b]===void 0)break;if(g[b].copyCellsFrom(g[E],j-A,k-A,A,!0),k-=A,k===0&&(b--,k=v[b]),j-=A,j===0){E--;let z=Math.max(E,0);j=wo(g,z,this._cols)}}for(let A=0;A<g.length;A++)v[A]<e&&g[A].setCell(v[A],r);let V=_-S;for(;V-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+h)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(l.length>0){let d=[],p=[];for(let k=0;k<this.lines.length;k++)p.push(this.lines.get(k));let g=this.lines.length,m=g-1,v=0,_=l[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);let S=0;for(let k=Math.min(this.lines.maxLength-1,g+h-1);k>=0;k--)if(_&&_.start>m+S){for(let E=_.newLines.length-1;E>=0;E--)this.lines.set(k--,_.newLines[E]);k++,d.push({index:m+1,amount:_.newLines.length}),S+=_.newLines.length,_=l[++v]}else this.lines.set(k,p[m--]);let w=0;for(let k=d.length-1;k>=0;k--)d[k].index+=w,this.lines.onInsertEmitter.fire(d[k]),w+=d[k].amount;let b=Math.max(0,g+h-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,t,n=0,r){let l=this.lines.get(e);return l?l.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new HM(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},IM=class extends He{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ue),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Ly(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Ly(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Ix=2,Ux=1,B2=class extends He{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Ix),this.rows=Math.max(e.rawOptions.rows||0,Ux),this.buffers=this._register(new IM(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let l=n.ybase+n.scrollTop,h=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;h===n.lines.length-1?d?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(h+1,0,r.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=h-l+1;n.lines.shiftElements(l+1,d-1,-1),n.lines.set(h,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};B2=_t([me(0,di)],B2);var Ba={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:qh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},UM=["normal","bold","100","200","300","400","500","600","700","800","900"],PM=class extends He{constructor(e){super(),this._onOptionChange=this._register(new ue),this.onOptionChange=this._onOptionChange.event;let t={...Ba};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ht(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Ba))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Ba))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ba[e]),!qM(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ba[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=UM.includes(t)?t:Ba[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function qM(e){return e==="block"||e==="underline"||e==="bar"}function co(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&co(e[r],t-1);return n}var By=Object.freeze({insertMode:!1}),Oy=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),O2=class extends He{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ue),this.onData=this._onData.event,this._onUserInput=this._register(new ue),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ue),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=co(By),this.decPrivateModes=co(Oy)}reset(){this.modes=co(By),this.decPrivateModes=co(Oy)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};O2=_t([me(0,ui),me(1,ax),me(2,di)],O2);var zy={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function af(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var lf=String.fromCharCode,Hy={DEFAULT:e=>{let t=[af(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${lf(t[0])}${lf(t[1])}${lf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${af(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${af(e,!0)};${e.x};${e.y}${t}`}},z2=class extends He{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ue),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(zy))this.addProtocol(r,zy[r]);for(let r of Object.keys(Hy))this.addEncoding(r,Hy[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=r+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};z2=_t([me(0,ui),me(1,zr),me(2,di)],z2);var of=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],VM=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Dt;function $M(e,t){let n=0,r=t.length-1,l;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(l=n+r>>1,e>t[l][1])n=l+1;else if(e<t[l][0])r=l-1;else return!0;return!1}var WM=class{constructor(){if(this.version="6",!Dt){Dt=new Uint8Array(65536),Dt.fill(1),Dt[0]=0,Dt.fill(0,1,32),Dt.fill(0,127,160),Dt.fill(2,4352,4448),Dt[9001]=2,Dt[9002]=2,Dt.fill(2,11904,42192),Dt[12351]=1,Dt.fill(2,44032,55204),Dt.fill(2,63744,64256),Dt.fill(2,65040,65050),Dt.fill(2,65072,65136),Dt.fill(2,65280,65377),Dt.fill(2,65504,65511);for(let e=0;e<of.length;++e)Dt.fill(0,of[e][0],of[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Dt[e]:$M(e,VM)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let l=Dr.extractWidth(t);l===0?r=!1:l>n&&(n=l)}return Dr.createPropertyValue(0,n,r)}},Dr=class Th{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ue,this.onChange=this._onChange.event;let t=new WM;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,l=t.length;for(let h=0;h<l;++h){let d=t.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=l)return n+this.wcwidth(d);let m=t.charCodeAt(h);56320<=m&&m<=57343?d=(d-55296)*1024+m-56320+65536:n+=this.wcwidth(m)}let p=this.charProperties(d,r),g=Th.extractWidth(p);Th.extractShouldJoin(p)&&(g-=Th.extractWidth(r)),n+=g,r=p}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},FM=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Iy(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var eo=2147483647,KM=256,Px=class H2{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>KM)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new H2;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let l=t[r];if(Array.isArray(l))for(let h=0;h<l.length;++h)n.addSubParam(l[h]);else n.addParam(l)}return n}clone(){let t=new H2(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,l=this._subParamsIdx[n]&255;l-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,l))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>eo?eo:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>eo?eo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,l=this._subParamsIdx[n]&255;l-r>0&&(t[n]=this._subParams.slice(r,l))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,l=r[n-1];r[n-1]=~l?Math.min(l*10+t,eo):t}},to=[],YM=class{constructor(){this._state=0,this._active=to,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=to}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=to,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||to,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Zh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=to,this._id=-1,this._state=0}}},Hi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Zh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},io=[],GM=class{constructor(){this._handlers=Object.create(null),this._active=io,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=io}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=io,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||io,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Zh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=io,this._ident=0}},ho=new Px;ho.addParam(0);var Uy=class{constructor(e){this._handler=e,this._data="",this._params=ho,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ho,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Zh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=ho,this._data="",this._hitLimit=!1,n));return this._params=ho,this._data="",this._hitLimit=!1,t}},ZM=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let l=0;l<e.length;l++)this.table[t<<8|e[l]]=n<<4|r}},es=160,XM=(function(){let e=new ZM(4095),t=Array.apply(null,Array(256)).map((p,g)=>g),n=(p,g)=>t.slice(p,g),r=n(32,127),l=n(0,24);l.push(25),l.push.apply(l,n(28,32));let h=n(0,14),d;e.setDefault(1,0),e.addMany(r,0,2,0);for(d in h)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(es,0,2,0),e.add(es,8,5,8),e.add(es,6,0,6),e.add(es,11,0,11),e.add(es,13,13,13),e})(),QM=class extends He{constructor(e=XM){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Px,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ht(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new YM),this._dcsParser=this._register(new GM),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let l=0;l<e.intermediates.length;++l){let h=e.intermediates.charCodeAt(l);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=h}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=l}parse(e,t,n){let r=0,l=0,h=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,h=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let p=this._parseStack.handlers,g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&g>-1){for(;g>=0&&(d=p[g](this._params),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&g>-1){for(;g>=0&&(d=p[g](),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(r!==24&&r!==26,n),d)return d;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],d=this._oscParser.end(r!==24&&r!==26,n),d)return d;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,h=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let p=h;p<t;++p){switch(r=e[p],l=this._transitions.table[this.currentState<<8|(r<160?r:es)],l>>4){case 2:for(let S=p+1;;++S){if(S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<es){this._printHandler(e,p,S),p=S-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:p,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let g=this._csiHandlers[this._collect<<8|r],m=g?g.length-1:-1;for(;m>=0&&(d=g[m](this._params),d!==!0);m--)if(d instanceof Promise)return this._preserveStack(3,g,m,l,p),d;m<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++p<t&&(r=e[p])>47&&r<60);p--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let v=this._escHandlers[this._collect<<8|r],_=v?v.length-1:-1;for(;_>=0&&(d=v[_](),d!==!0);_--)if(d instanceof Promise)return this._preserveStack(4,v,_,l,p),d;_<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let S=p+1;;++S)if(S>=t||(r=e[S])===24||r===26||r===27||r>127&&r<es){this._dcsParser.put(e,p,S),p=S-1;break}break;case 14:if(d=this._dcsParser.unhook(r!==24&&r!==26),d)return this._preserveStack(6,[],0,l,p),d;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let S=p+1;;S++)if(S>=t||(r=e[S])<32||r>127&&r<es){this._oscParser.put(e,p,S),p=S-1;break}break;case 6:if(d=this._oscParser.end(r!==24&&r!==26),d)return this._preserveStack(5,[],0,l,p),d;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},JM=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,ej=/^[\da-f]+$/;function Py(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=JM.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),ej.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let l=0;l<3;++l){let h=parseInt(t.slice(n*l,n*l+n),16);r[l]=n===1?h<<4:n===2?h:n===3?h>>4:h>>8}return r}}function cf(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function tj(e,t=16){let[n,r,l]=e;return`rgb:${cf(n,t)}/${cf(r,t)}/${cf(l,t)}`}var ij={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Vn=131072,qy=10;function Vy(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var $y=5e3,Wy=0,sj=class extends He{constructor(e,t,n,r,l,h,d,p,g=new QM){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=l,this._oscLinkService=h,this._coreMouseService=d,this._unicodeService=p,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wk,this._utf8Decoder=new bk,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=kt.clone(),this._eraseAttrDataInternal=kt.clone(),this._onRequestBell=this._register(new ue),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ue),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ue),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ue),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ue),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ue),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ue),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ue),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ue),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new I2(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:v.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,v,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:v,data:_})}),this._parser.setDcsHandlerFallback((m,v,_)=>{v==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:v,payload:_})}),this._parser.setPrintHandler((m,v,_)=>this.print(m,v,_)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(ne.BEL,()=>this.bell()),this._parser.setExecuteHandler(ne.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ne.BS,()=>this.backspace()),this._parser.setExecuteHandler(ne.HT,()=>this.tab()),this._parser.setExecuteHandler(ne.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ne.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Mh.IND,()=>this.index()),this._parser.setExecuteHandler(Mh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Mh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Hi(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new Hi(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new Hi(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new Hi(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new Hi(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new Hi(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new Hi(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new Hi(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new Hi(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new Hi(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new Hi(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new Hi(m=>this.restoreCursorColor(m))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let m in Nt)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Uy((m,v)=>this.requestStatusString(m,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),$y))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${$y} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,l=this._activeBuffer.y,h=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Vn&&(h=this._parseStack.position+Vn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Vn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Vn))),d||this._dirtyRowTracker.clearRange(),e.length>Vn)for(let m=h;m<e.length;m+=Vn){let v=m+Vn<e.length?m+Vn:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(m,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,v),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(r,l,_,m),this._logSlowResolvingAsync(n),n}else if(!d){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,m))return this._preserveStack(r,l,m,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let p=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),g=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);g<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(g,this._bufferService.rows-1),end:Math.min(p,this._bufferService.rows-1)})}print(e,t,n){let r,l,h=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,p=this._bufferService.cols,g=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,v=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let S=this._parser.precedingJoinState;for(let w=t;w<n;++w){if(r=e[w],r<127&&h){let j=h[String.fromCharCode(r)];j&&(r=j.charCodeAt(0))}let b=this._unicodeService.charProperties(r,S);l=Dr.extractWidth(b);let k=Dr.extractShouldJoin(b),E=k?Dr.extractWidth(S):0;if(S=b,d&&this._onA11yChar.fire(Fn(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-E>p){if(g){let j=_,V=this._activeBuffer.x-E;for(this._activeBuffer.x=E,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&_ instanceof oo&&_.copyCellsFrom(j,V,0,E,!1);V<p;)j.setCellFromCodepoint(V++,0,1,v)}else if(this._activeBuffer.x=p-1,l===2)continue}if(k&&this._activeBuffer.x){let j=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-j,r,l);for(let V=l-E;--V>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(m&&(_.insertCells(this._activeBuffer.x,l-E,this._activeBuffer.getNullCell(v)),_.getWidth(p-1)===2&&_.setCellFromCodepoint(p-1,0,1,v)),_.setCellFromCodepoint(this._activeBuffer.x++,r,l,v),l>0)for(;--l;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=S,this._activeBuffer.x<p&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Vy(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Uy(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Hi(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,l=!1){let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);h.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),l),r&&(h.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(l-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(kt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Dr.extractWidth(t),l=this._activeBuffer.x-r,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),d=new Uint32Array(h.length*n),p=0;for(let m=0;m<h.length;){let v=h.codePointAt(m)||0;d[p++]=v,m+=v>65535?2:1}let g=p;for(let m=1;m<n;++m)d.copyWithin(g,0,p),g+=p;return this.print(d,0,g),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ne.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ne.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ne.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ne.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ne.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Tr),this._charsetService.setgCharset(1,Tr),this._charsetService.setgCharset(2,Tr),this._charsetService.setgCharset(3,Tr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:h}=this._coreMouseService,d=this._coreService,{buffers:p,cols:g}=this._bufferService,{active:m,alt:v}=p,_=this._optionsService.rawOptions,S=(k,E)=>(d.triggerDataEvent(`${ne.ESC}[${t?"":"?"}${k};${E}$y`),!0),w=k=>k?1:2,b=e.params[0];return t?b===2?S(b,4):b===4?S(b,w(d.modes.insertMode)):b===12?S(b,3):b===20?S(b,w(_.convertEol)):S(b,0):b===1?S(b,w(r.applicationCursorKeys)):b===3?S(b,_.windowOptions.setWinLines?g===80?2:g===132?1:0:0):b===6?S(b,w(r.origin)):b===7?S(b,w(r.wraparound)):b===8?S(b,3):b===9?S(b,w(l==="X10")):b===12?S(b,w(_.cursorBlink)):b===25?S(b,w(!d.isCursorHidden)):b===45?S(b,w(r.reverseWraparound)):b===66?S(b,w(r.applicationKeypad)):b===67?S(b,4):b===1e3?S(b,w(l==="VT200")):b===1002?S(b,w(l==="DRAG")):b===1003?S(b,w(l==="ANY")):b===1004?S(b,w(r.sendFocus)):b===1005?S(b,4):b===1006?S(b,w(h==="SGR")):b===1015?S(b,4):b===1016?S(b,w(h==="SGR_PIXELS")):b===1048?S(b,1):b===47||b===1047||b===1049?S(b,w(m===v)):b===2004?S(b,w(r.bracketedPasteMode)):b===2026?S(b,w(r.synchronizedOutput)):S(b,0)}_updateAttrColor(e,t,n,r,l){return t===2?(e|=50331648,e&=-16777216,e|=Mo.fromColorRGB([n,r,l])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],l=0,h=0;do{if(r[h+l]=e.params[t+h],e.hasSubParams(t+h)){let d=e.getSubParams(t+h),p=0;do r[1]===5&&(l=1),r[h+p+1+l]=d[p];while(++p<d.length&&p+h+1+l<r.length);break}if(r[1]===5&&h+l>=2||r[1]===2&&h+l>=5)break;r[1]&&(l=1)}while(++h+t<e.length&&h+l<r.length);for(let d=2;d<r.length;++d)r[d]===-1&&(r[d]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return h}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=kt.fg,e.bg=kt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let l=0;l<t;l++)n=e.params[l],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=kt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=kt.bg&16777215):n===38||n===48||n===58?l+=this._extractColor(e,l,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=kt.fg&16777215,r.bg&=-67108864,r.bg|=kt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ne.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=kt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Vy(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ne.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>qy&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>qy&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),l=n.shift();if(/^\d+$/.exec(r)){let h=parseInt(r);if(Fy(h))if(l==="?")t.push({type:0,index:h});else{let d=Py(l);d&&t.push({type:1,index:h,color:d})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,l=n.findIndex(h=>h.startsWith("id="));return l!==-1&&(r=n[l].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=Py(n[r]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let l=parseInt(n[r]);Fy(l)&&t.push({type:2,index:l})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Tr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ij[e[0]],Nt[e[1]]||Tr),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=kt.clone(),this._eraseAttrDataInternal=kt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new is;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=d=>(this._coreService.triggerDataEvent(`${ne.ESC}${d}${ne.ESC}\\`),!0),r=this._bufferService.buffer,l=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},I2=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Wy=e,e=t,t=Wy),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};I2=_t([me(0,ui)],I2);function Fy(e){return 0<=e&&e<256}var nj=5e7,Ky=12,rj=50,aj=class extends He{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>nj)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],l=this._action(r,t);if(l){let d=p=>performance.now()-n>=Ky?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(n,p);l.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(d);return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=Ky)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>rj&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},U2=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let p=t.addMarker(t.ybase+t.y),g={data:e,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(g,p)),this._dataByLinkId.set(g.id,g),g.id}let n=e,r=this._getEntryIdKey(n),l=this._entriesWithId.get(r);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let h=t.addMarker(t.ybase+t.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};U2=_t([me(0,ui)],U2);var Yy=!1,lj=class extends He{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Fa),this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onData=this._register(new ue),this.onData=this._onData.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ue),this._instantiationService=new RM,this.optionsService=this._register(new PM(e)),this._instantiationService.setService(di,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(B2)),this._instantiationService.setService(ui,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(L2)),this._instantiationService.setService(ax,this._logService),this.coreService=this._register(this._instantiationService.createInstance(O2)),this._instantiationService.setService(zr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(z2)),this._instantiationService.setService(rx,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Dr)),this._instantiationService.setService(Mk,this.unicodeService),this._charsetService=this._instantiationService.createInstance(FM),this._instantiationService.setService(Ek,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(U2),this._instantiationService.setService(lx,this._oscLinkService),this._inputHandler=this._register(new sj(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ei.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ei.forward(this._bufferService.onResize,this._onResize)),this._register(ei.forward(this.coreService.onData,this._onData)),this._register(ei.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new aj((t,n)=>this._inputHandler.parse(t,n))),this._register(ei.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ue),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Yy&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Yy=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Ix),t=Math.max(t,Ux),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Iy.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Iy(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ht(()=>{for(let t of e)t.dispose()})}}},oj={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function cj(e,t,n,r){let l={type:0,cancel:!1,key:void 0},h=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?l.key=ne.ESC+"OA":l.key=ne.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=ne.ESC+"OD":l.key=ne.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=ne.ESC+"OC":l.key=ne.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=ne.ESC+"OB":l.key=ne.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":ne.DEL,e.altKey&&(l.key=ne.ESC+l.key);break;case 9:if(e.shiftKey){l.key=ne.ESC+"[Z";break}l.key=ne.HT,l.cancel=!0;break;case 13:l.key=e.altKey?ne.ESC+ne.CR:ne.CR,l.cancel=!0;break;case 27:l.key=ne.ESC,e.altKey&&(l.key=ne.ESC+ne.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"D":t?l.key=ne.ESC+"OD":l.key=ne.ESC+"[D";break;case 39:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"C":t?l.key=ne.ESC+"OC":l.key=ne.ESC+"[C";break;case 38:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"A":t?l.key=ne.ESC+"OA":l.key=ne.ESC+"[A";break;case 40:if(e.metaKey)break;h?l.key=ne.ESC+"[1;"+(h+1)+"B":t?l.key=ne.ESC+"OB":l.key=ne.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=ne.ESC+"[2~");break;case 46:h?l.key=ne.ESC+"[3;"+(h+1)+"~":l.key=ne.ESC+"[3~";break;case 36:h?l.key=ne.ESC+"[1;"+(h+1)+"H":t?l.key=ne.ESC+"OH":l.key=ne.ESC+"[H";break;case 35:h?l.key=ne.ESC+"[1;"+(h+1)+"F":t?l.key=ne.ESC+"OF":l.key=ne.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=ne.ESC+"[5;"+(h+1)+"~":l.key=ne.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=ne.ESC+"[6;"+(h+1)+"~":l.key=ne.ESC+"[6~";break;case 112:h?l.key=ne.ESC+"[1;"+(h+1)+"P":l.key=ne.ESC+"OP";break;case 113:h?l.key=ne.ESC+"[1;"+(h+1)+"Q":l.key=ne.ESC+"OQ";break;case 114:h?l.key=ne.ESC+"[1;"+(h+1)+"R":l.key=ne.ESC+"OR";break;case 115:h?l.key=ne.ESC+"[1;"+(h+1)+"S":l.key=ne.ESC+"OS";break;case 116:h?l.key=ne.ESC+"[15;"+(h+1)+"~":l.key=ne.ESC+"[15~";break;case 117:h?l.key=ne.ESC+"[17;"+(h+1)+"~":l.key=ne.ESC+"[17~";break;case 118:h?l.key=ne.ESC+"[18;"+(h+1)+"~":l.key=ne.ESC+"[18~";break;case 119:h?l.key=ne.ESC+"[19;"+(h+1)+"~":l.key=ne.ESC+"[19~";break;case 120:h?l.key=ne.ESC+"[20;"+(h+1)+"~":l.key=ne.ESC+"[20~";break;case 121:h?l.key=ne.ESC+"[21;"+(h+1)+"~":l.key=ne.ESC+"[21~";break;case 122:h?l.key=ne.ESC+"[23;"+(h+1)+"~":l.key=ne.ESC+"[23~";break;case 123:h?l.key=ne.ESC+"[24;"+(h+1)+"~":l.key=ne.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=ne.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=ne.DEL:e.keyCode===219?l.key=ne.ESC:e.keyCode===220?l.key=ne.FS:e.keyCode===221&&(l.key=ne.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let d=oj[e.keyCode]?.[e.shiftKey?1:0];if(d)l.key=ne.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,g=String.fromCharCode(p);e.shiftKey&&(g=g.toUpperCase()),l.key=ne.ESC+g}else if(e.keyCode===32)l.key=ne.ESC+(e.ctrlKey?ne.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),l.key=ne.ESC+p,l.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=ne.US),e.key==="@"&&(l.key=ne.NUL));break}return l}var St=0,hj=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Vh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Vh,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((l,h)=>this._getKey(l)-this._getKey(h)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<r.length;l++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[l]=e[t],t++):r[l]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(St=this._search(t),St===-1)||this._getKey(this._array[St])!==t)return!1;do if(this._array[St]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,h)=>l-h),t=0,n=new Array(this._array.length-e.length),r=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:n[r++]=this._array[l];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do t(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,l=this._getKey(this._array[r]);if(l>e)n=r-1;else if(l<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},hf=0,Gy=0,uj=class extends He{constructor(){super(),this._decorations=new hj(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ue),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ue),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ht(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new dj(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,l=0;for(let h of this._decorations.getKeyIterator(t))r=h.options.x??0,l=r+(h.options.width??1),e>=r&&e<l&&(!n||(h.options.layer??"bottom")===n)&&(yield h)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,l=>{hf=l.options.x??0,Gy=hf+(l.options.width??1),e>=hf&&e<Gy&&(!n||(l.options.layer??"bottom")===n)&&r(l)})}},dj=class extends Qn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ue),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ue),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ft.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ft.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},fj=1e3,pj=class{constructor(e,t=fj){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=r-this._lastRefreshMs,h=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},h)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Zy=20,$h=class extends He{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let h=0;h<this._terminal.rows;h++)this._rowElements[h]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[h]);if(this._topBoundaryFocusListener=h=>this._handleBoundaryFocus(h,0),this._bottomBoundaryFocusListener=h=>this._handleBoundaryFocus(h,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new pj(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(h=>this._handleResize(h.rows))),this._register(this._terminal.onRender(h=>this._refreshRows(h.start,h.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(h=>this._handleChar(h))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
-`))),this._register(this._terminal.onA11yTab(h=>this._handleTab(h))),this._register(this._terminal.onKey(h=>this._handleKey(h.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(l,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ht(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Zy+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
-`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Zy+1&&(this._liveRegion.textContent+=a2.get())))}_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){let n=this._terminal.buffer,r=n.lines.length.toString();for(let l=e;l<=t;l++){let h=n.lines.get(n.ydisp+l),d=[],p=h?.translateToString(!0,void 0,void 0,d)||"",g=(n.ydisp+l+1).toString(),m=this._rowElements[l];m&&(p.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=p,this._rowColumns.set(m,d)),m.setAttribute("aria-posinset",g),m.setAttribute("aria-setsize",r),this._alignRowWidth(m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],l=n.getAttribute("aria-posinset"),h=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===h||e.relatedTarget!==r)return;let d,p;if(t===0?(d=n,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(d=this._rowElements.shift(),p=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}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(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let l=({node:p,offset:g})=>{let m=p instanceof Text?p.parentNode:p,v=parseInt(m?.getAttribute("aria-posinset"),10)-1;if(isNaN(v))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(m);if(!_)return console.warn("columns is null. Race condition?"),null;let S=g<_.length?_[g]:_.slice(-1)[0]+1;return S>=this._terminal.cols&&(++v,S=0),{row:v,column:S}},h=l(t),d=l(n);if(!(!h||!d)){if(h.row>d.row||h.row===d.row&&h.column>=d.column)throw new Error("invalid range");this._terminal.select(h.column,h.row,(d.row-h.row)*this._terminal.cols-h.column+d.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(){let 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){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}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]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};$h=_t([me(1,f1),me(2,un),me(3,dn)],$h);var P2=class extends He{constructor(e,t,n,r,l){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ue),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ue),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ht(()=>{Nr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let l=n[r];if(l.classList.contains("xterm"))break;if(l.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(r=>{r?.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,l]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):l.provideLinks(e.y,h=>{if(this._isMouseOut)return;let d=h?.map(p=>({link:p}));this._activeProviderReplies?.set(r,d),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let l=t.get(r);if(l)for(let h=0;h<l.length;h++){let d=l[h],p=d.link.range.start.y<e?0:d.link.range.start.x,g=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let m=p;m<=g;m++){if(n.has(m)){l.splice(h--,1);break}n.add(m)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),l=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(l=!0);if(!l&&r){let h=r.find(d=>this._linkAtPosition(d.link,t));h&&(n=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let h=0;h<this._activeProviderReplies.size;h++){let d=this._activeProviderReplies.get(h)?.find(p=>this._linkAtPosition(p.link,t));if(d){n=!0,this._handleNewLink(d);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&gj(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Nr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(r,l),this._lastMouseEvent)){let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._askForLink(h,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,l=t.y*this._bufferService.cols+t.x;return n<=l&&l<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,l){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:l}}};P2=_t([me(1,p1),me(2,dn),me(3,ui),me(4,cx)],P2);function gj(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var mj=class extends lj{constructor(e={}){super(e),this._linkifier=this._register(new Fa),this.browser=jx,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Fa),this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ue),this.onKey=this._onKey.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ue),this.onBell=this._onBell.event,this._onFocus=this._register(new ue),this._onBlur=this._register(new ue),this._onA11yCharEmitter=this._register(new ue),this._onA11yTabEmitter=this._register(new ue),this._onWillOpen=this._register(new ue),this._setup(),this._decorationService=this._instantiationService.createInstance(uj),this._instantiationService.setService(jo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rM),this._instantiationService.setService(cx,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(o2)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(ei.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ei.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ei.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ei.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ht(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let l=ot.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ne.ESC}]${r};${tj(l)}${Ex.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(h=>h.ansi[t.index]=Et.toColor(...t.color));else{let h=n;this._themeService.modifyColors(d=>d[h]=Et.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($h,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,l=t.getWidth(n),h=this._renderService.dimensions.css.cell.width*l,d=this.buffer.y*this._renderService.dimensions.css.cell.height,p=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=p+"px",this.textarea.style.top=d+"px",this.textarea.style.width=h+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&Sk(t,this._selectionService)}));let e=t=>xk(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),Tx?this._register(Te(this.element,"mousedown",t=>{t.button===2&&ay(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{ay(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),w1&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&ex(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Te(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",r2.get()),Ax||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(sM,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(un,this._coreBrowserService),this._register(Te(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(T2,this._document,this._helperContainer),this._instantiationService.setService(Xh,this._charSizeService),this._themeService=this._instantiationService.createInstance(N2),this._instantiationService.setService(Za,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ph),this._instantiationService.setService(ox,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(R2,this.rows,this.screenElement)),this._instantiationService.setService(dn,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(E2,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(D2),this._instantiationService.setService(p1,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(P2,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(C2,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(A2,this.element,this.screenElement,r)),this._instantiationService.setService(Tk,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(ei.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(k2,this.screenElement)),this._register(Te(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($h,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(j2,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(h){let d=e._mouseService.getMouseReportCoords(h,e.screenElement);if(!d)return!1;let p,g;switch(h.overrideType||h.type){case"mousemove":g=32,h.buttons===void 0?(p=3,h.button!==void 0&&(p=h.button<3?h.button:3)):p=h.buttons&1?0:h.buttons&4?1:h.buttons&2?2:3;break;case"mouseup":g=0,p=h.button<3?h.button:3;break;case"mousedown":g=1,p=h.button<3?h.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(h)===!1)return!1;let m=h.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;g=m<0?0:1,p=4;break;default:return!1}return g===void 0||p===void 0||p>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:p,action:g,ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:h=>(n(h),h.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(h)),wheel:h=>(n(h),this.cancel(h,!0)),mousedrag:h=>{h.buttons&&n(h)},mousemove:h=>{h.buttons||n(h)}};this._register(this.coreMouseService.onProtocolChange(h=>{h?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(h)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),h&8?r.mousemove||(t.addEventListener("mousemove",l.mousemove),r.mousemove=l.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),h&16?r.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),r.wheel=l.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),h&2?r.mouseup||(r.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),h&4?r.mousedrag||(r.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",h=>{if(h.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(h)))return n(h),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(h)})),this._register(Te(t,"wheel",h=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(h)===!1)return!1;if(!this.buffer.hasScrollback){if(h.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(h,!0);let d=ne.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(h.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(h,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){JS(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=cj(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ne.ETX||n.key===ne.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(vj(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(kt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(ne.ESC+"[I"):this.coreService.triggerDataEvent(ne.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[6;${l};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function vj(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var _j=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},yj=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new is)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Xy=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new yj(t)}getNullCell(){return new is}},Sj=class extends He{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ue),this.onBufferChange=this._onBufferChange.event,this._normal=new Xy(this._core.buffers.normal,"normal"),this._alternate=new Xy(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},xj=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},wj=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},bj=["cols","rows"],js=0,Cj=class extends He{constructor(e){super(),this._core=this._register(new mj(e)),this._addonManager=this._register(new _j),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,l)=>{this._checkReadonlyOptions(r),this._core.options[r]=l};for(let r in this._core.options){let l={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,l)}}_checkReadonlyOptions(e){if(bj.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new xj(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new wj(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Sj(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
-`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return r2.get()},set promptLabel(e){r2.set(e)},get tooMuchOutput(){return a2.get()},set tooMuchOutput(e){a2.set(e)}}}_verifyIntegers(...e){for(js of e)if(js===1/0||isNaN(js)||js%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(js of e)if(js&&(js===1/0||isNaN(js)||js%1!==0||js<0))throw new Error("This API only accepts positive integers")}};const Qy=e=>{/^https?:/i.test(e)&&window.codync.app.openExternal(e)};function Jy({backend:e,step:t,method:n,back:r}){const l=Ne(),h=x.useRef(null),[d,p]=x.useState(null),[g,m]=x.useState(null);x.useEffect(()=>{const _=h.current;if(!_)return;const S=getComputedStyle(document.documentElement),w=parseFloat(S.getPropertyValue("--scale"))||1,b=new Cj({fontFamily:S.getPropertyValue("--mono").trim()||"monospace",fontSize:12*w,cursorBlink:!0,allowTransparency:!0,theme:{background:S.getPropertyValue("--background").trim(),foreground:S.getPropertyValue("--text").trim(),cursor:S.getPropertyValue("--text").trim(),selectionBackground:`rgba(${S.getPropertyValue("--text-rgb").trim()}, 0.2)`},linkHandler:{activate:(L,O)=>Qy(O)}}),k=new ck;b.loadAddon(k),b.loadAddon(new gk((L,O)=>Qy(O))),b.open(_),k.fit(),b.focus();let E=!1,j=null,V=null,A={cols:b.cols,rows:b.rows},z={cols:0,rows:0},F=null,R=Promise.resolve();const I=new TextEncoder,q=()=>{const L=l.client;!L||!V||A.cols===z.cols&&A.rows===z.rows||(z=A,Ae.termResize(L,V,A.cols,A.rows).catch(()=>{}))},U=L=>{const O=l.client;if(j!==null||!O||!V)return;const P=V;R=R.then(()=>Ae.termInput(O,P,X3(L)).then(()=>{},()=>{}))},Y=[b.onData(L=>U(I.encode(L))),b.onBinary(L=>U(Uint8Array.from(L,O=>O.charCodeAt(0)&255))),b.onResize(({cols:L,rows:O})=>{A={cols:L,rows:O},q()})],$=new ResizeObserver(()=>k.fit());$.observe(_);let M=0;const N=(L,O)=>new Promise(P=>{b.reset(),F=L.transport.stream(`/term/${encodeURIComponent(O)}`,te=>{M=0;let Q;try{Q=JSON.parse(te)}catch{return}Q.type==="output"&&Q.data?b.write(Q3(Q.data)):Q.type==="exit"&&(j=Q.code??-1,p(j))},te=>{F=null,te?.status===404?(m(te.message),P("done")):te?(M+=1,M>5?(m(te.message),P("done")):P("retry")):P("retry")})});return(async()=>{try{const L=await l.ready(),O=await Ae.agentSetup(L,e.id,t,n?.id??null,A.cols,A.rows);if(E){Ae.termClose(L,O).catch(()=>{});return}for(V=O,z=A,q();j===null&&!E&&await N(L,O)!=="done";)j===null&&!E&&await new Promise(P=>setTimeout(P,1e3))}catch(L){E||m(L instanceof Ji?L.message:lt(L));return}E||await l.refreshBackends()})(),()=>{E=!0,$.disconnect(),Y.forEach(O=>O.dispose()),F?.();const L=l.client;j===null&&L&&V&&Ae.termClose(L,V).catch(()=>{}),b.dispose()}},[l,e.id,t,n?.id]);const v=t==="install"?`Install ${e.name}`:n?.name??`Sign in to ${e.name}`;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:v,onBack:r}),c.jsx("div",{className:"setup-terminal",children:c.jsx("div",{ref:h,style:{width:"100%",height:"100%"}})}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 16px",...B("footnote")},children:[g?c.jsx("span",{style:{color:"var(--danger)",...uf},children:g}):d!==null?c.jsxs(c.Fragment,{children:[c.jsx(ae,{name:d===0?"checkmark.circle.fill":"exclamationmark.circle.fill",size:10,color:d===0?"var(--added)":"var(--warning)"}),c.jsx("span",{style:{color:"var(--secondary)",...uf},children:d===0?"Finished.":`Ended with an error (${d}).`})]}):c.jsxs(c.Fragment,{children:[c.jsx(on,{size:14,color:"var(--secondary)"}),c.jsxs("span",{style:{color:"var(--secondary)",...uf},children:["Running on ",l.hostName,". Links open on this device."]})]}),c.jsx("span",{style:{flex:1}}),d!==null?c.jsx(Fe,{className:"fade-in",onClick:r,children:"Done"}):null]})]})}const uf={display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"};function kj(e){switch(e){case"claude-acp":return"rgb(217, 120, 87)";case"gemini":return"linear-gradient(to top right, rgb(71, 150, 227), rgb(145, 120, 199), rgb(201, 102, 115))";case"antigravity-acp":return"rgb(66, 133, 245)";case"mistral-vibe":return"rgb(250, 82, 15)";case"qwen-code":return"rgb(97, 92, 237)";case"amp-acp":return"rgb(242, 79, 64)";case"kiro":return"rgb(143, 69, 255)";case"cortex-code":return"rgb(41, 181, 232)";default:return"var(--text)"}}function qx({registry:e,icon:t,tile:n,radius:r}){return c.jsx("div",{style:{width:n,height:n,flex:"none",borderRadius:r,background:"var(--bubble-agent)",display:"grid",placeItems:"center",color:"var(--text)"},children:c.jsx(Ej,{registry:e,size:t})})}function Ej({registry:e,size:t}){const n=l1(e);return n?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:t,height:t,flex:"none",background:kj(e),WebkitMaskImage:`url("${n}")`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):c.jsx(ae,{name:"terminal",size:t*.8,scaled:!1})}function Mj({initial:e}){const t=Ne(),[n,r]=x.useState(null),[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(null),[v,_]=x.useState(null),S=x.useRef(!1),w=t.hello?.backends.find($=>$.id===e.id)??e,b=w.installed===!0,k=w.curated===!0,E=l?.signedIn??w.signedIn??null,j=t.hostName,V=async()=>{const $=t.client;if(!(!$||S.current)){S.current=!0,p(!0);try{h(await Ae.agentAuth($,w.id)),_(null)}catch(M){_(lt(M))}S.current=!1,p(!1),await t.refreshBackends()}},A=async $=>{const M=t.client;if(M){m($.id);try{h(await Ae.agentAuthenticate(M,w.id,$.id)),_(null)}catch(N){_(lt(N))}m(null),await t.refreshBackends()}};x.useEffect(()=>{w.signedIn!==!0&&V()},[]);const z=x.useRef(!1);x.useEffect(()=>{n===null&&z.current&&V(),z.current=n!==null},[n]);const F=()=>r(null),R=n===null?null:n.kind==="install"?c.jsx(Jy,{backend:w,step:"install",back:F}):n.kind==="terminal"?c.jsx(Jy,{backend:w,step:"login",method:n.method,back:F}):c.jsx(jj,{backend:w,method:n.method,saved:l?.savedEnv??[],back:F,done:h}),I=d?l===null?`Checking with ${w.name}… The first check can download it.`:"Checking…":E===!0?"Signed in.":E===!1?"Not signed in yet.":`Couldn't tell. Skip this if you've already signed in on ${j}.`,q=($,M,N,L,O,P=!1)=>c.jsxs("button",{className:"option-row",disabled:g!==null,onClick:O,children:[c.jsx("span",{"aria-hidden":!0,style:{width:26,display:"flex",justifyContent:"center",color:"var(--secondary)",flex:"none"},children:c.jsx(ae,{name:L,size:13})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)"},children:M}),c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:N})]}),c.jsx("span",{style:{minWidth:8}}),P?c.jsx(on,{size:16,color:"var(--secondary)"}):c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]},$),U=[];if(E!==!0&&!d){l?.login&&U.push(q("login","Sign in",`In a terminal on ${j}. Links open here.`,"terminal",()=>r({kind:"terminal",method:null})));for(const $ of l?.methods??[])$.kind==="terminal"?U.push(q($.id,$.name,$.description??`In a terminal on ${j}.`,"terminal",()=>r({kind:"terminal",method:$}))):$.kind==="envVar"?U.push(q($.id,$.name,$.description??`Saved on ${j} only.`,"key",()=>r({kind:"keys",method:$}))):U.push(q($.id,$.name,g===$.id?`Finish signing in in the browser on ${j}…`:$.description??`Opens a browser on ${j}.`,"safari",()=>{A($)},g===$.id))}const Y=c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(Lt,{title:w.name}),c.jsxs(hi,{children:[c.jsx(Ee,{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"4px 0"},children:[c.jsx(qx,{registry:w.registry,icon:30,tile:52,radius:14}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[c.jsx("span",{style:B("title3","semibold"),children:w.name}),w.description?c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",...Gf(3)},children:w.description}):null]})]})}),k?c.jsx(Ee,{children:c.jsx(e3,{number:1,title:"Install",detail:b?`Installed on ${j}.`:w.canInstall?`Runs the official installer on ${j}.`:w.installHint,done:b,action:b||!w.canInstall?null:{label:"Install",run:()=>r({kind:"install"})}})}):null,c.jsxs(Ee,{footer:E!==!0&&l?.methods.some($=>$.kind==="agent")?`Browser sign-ins open on ${j} itself. Away from it? Use Remote screen to finish there.`:null,children:[c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx("div",{style:{flex:1,minWidth:0},children:c.jsx(e3,{number:k?2:1,title:"Sign in",detail:I,done:E===!0,action:null})}),d?c.jsx(on,{state:"connecting",size:16,color:"var(--secondary)"}):c.jsx("button",{title:"Check again","aria-label":"Check again",style:{display:"flex",color:"var(--secondary)"},onClick:()=>{V()},children:c.jsx(ae,{name:"arrow.clockwise",size:13})})]}),E!==!0&&l?.detail?c.jsx("span",{className:"selectable",style:{...B("footnote"),color:"var(--secondary)",whiteSpace:"pre-wrap"},children:l.detail}):null,U]}),v?c.jsx(Ee,{children:c.jsx(hn,{text:v})}):null]})]});return c.jsx(pS,{base:Y,top:R})}function jj({backend:e,method:t,saved:n,back:r,done:l}){const h=Ne(),[d,p]=x.useState({}),[g,m]=x.useState(!1),[v,_]=x.useState(null),S=t.vars??[],w=async k=>{const E=h.client;if(E){m(!0);try{l(await Ae.setAgentEnv(E,e.id,k)),r()}catch(j){_(lt(j))}m(!1)}},b=S.some(k=>!k.optional&&!d[k.name]&&!n.includes(k.name));return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:t.name,onBack:r,trailing:g?c.jsx(et,{}):c.jsx(ke,{title:"Save",icon:"checkmark",disabled:b,onClick:()=>{w(n1(d))}})}),c.jsxs(hi,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx(Ee,{title:t.name,children:S.map(k=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[c.jsx(Mt,{label:k.label,value:d[k.name]??"",secret:k.secret,placeholder:n.includes(k.name)?"Saved (type to replace)":k.name,onChange:E=>p(j=>({...j,[k.name]:E}))}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:k.label+(k.optional?" (optional)":"")})]},k.name))}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"0 4px",...B("caption"),color:"var(--tertiary)"},children:[t.description?c.jsx("span",{children:t.description}):null,c.jsxs("span",{children:["Saved on ",h.hostName," only and given to ",e.name," when it starts."]}),t.link&&URL.canParse(t.link)?c.jsx(i1,{title:"Get a key",url:t.link}):null]})]}),n.length?c.jsx(Ee,{children:c.jsx("button",{style:{color:"var(--danger)"},onClick:()=>{w(Object.fromEntries(S.map(k=>[k.name,""])))},children:"Remove saved keys"})}):null,v?c.jsx(Ee,{children:c.jsx(hn,{text:v})}):null]})]})}function e3({number:e,title:t,detail:n,done:r,action:l}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"4px 0"},"aria-label":`${t}. ${n}${r?". Done":""}`,children:[c.jsx("span",{"aria-hidden":!0,style:{width:26,height:26,borderRadius:"50%",flex:"none",display:"grid",placeItems:"center",background:r?"var(--accent-fill)":"var(--bubble-agent)",transition:"background-color var(--fade)"},children:r?c.jsx(ae,{name:"checkmark",size:10,weight:"bold",color:"var(--on-accent)"}):c.jsx("span",{style:{...B("caption","semibold"),color:"var(--secondary)"},children:e})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{...B("body","medium"),color:"var(--text)"},children:t}),c.jsx("span",{className:"selectable",style:{...B("subheadline"),color:"var(--secondary)"},children:n})]}),c.jsx("span",{style:{minWidth:8}}),l?c.jsx("button",{className:"capsule-action",style:{...B("subheadline","semibold"),padding:"7px 14px"},onClick:l.run,children:l.label}):null]})}const t3=e=>e.name;function Tj({computers:e,computer:t,onComputer:n}){const r=Ne(),l=Ga(r),h=ss(),[d,p]=x.useState(""),[g,m]=x.useState(0),[v,_]=x.useState(Lh),[S,w]=x.useState(null),[b,k]=x.useState(!1),[E,j]=x.useState([]),[V,A]=x.useState(!0),[z,F]=x.useState(!0),[R,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(null),[M,N]=x.useState(!1),[L,O]=x.useState(!1),[P,te]=x.useState(null),[Q,ce]=x.useState(10),[re,de]=x.useState(!1),[Ce,je]=x.useState(!1),D=x.useRef(0),J=x.useRef(""),le=d.trim(),he=ge=>(ge??"").toLowerCase().includes(le.toLowerCase()),we=(r.hello?.backends??[]).filter(ge=>ge.available||ge.installed===!0||ge.curated===!0),xe=le?we.filter(ge=>he(ge.name)):we,be=le?E.filter(ge=>he(ge.name)||he(ge.description)):E,pe=l.installedConnectors.length+l.installedSkills.length,_e=async(ge=le)=>{const Ke=++D.current;J.current=ge,A(!0),k(!1);try{const ki=await Ae.marketConnectors(await r.ready(),ge);if(D.current!==Ke)return;_(hS(ki.items,t3)),w(ki.next),I(null)}catch(ki){if(D.current!==Ke)return;_(Lh()),w(null),I(lt(ki))}finally{D.current===Ke&&A(!1)}},Re=async()=>{if(b||V)return;if(Kf(v)){_(Ff);return}if(!S)return;const ge=D.current;k(!0);try{const Ke=await Ae.marketConnectors(await r.ready(),J.current,S);if(D.current!==ge)return;_(ki=>Ff(cS(ki,Ke.items,t3))),w(Ke.next),I(null)}catch(Ke){D.current===ge&&I(lt(Ke))}finally{D.current===ge&&k(!1)}};x.useEffect(()=>(l.refresh(),r.refreshBackends(),_e(""),(async()=>{try{j(await Ae.marketSkills(await r.ready()))}catch(ge){I(lt(ge))}F(!1)})(),()=>{D.current++}),[]);const fi=ge=>{m(Ke=>Ke+1),_e(ge)},pi=async ge=>{$(ge.source);try{await l.installSkill(ge.source)}catch(Ke){I(lt(Ke))}$(null)},Bt=c.jsxs("div",{style:{display:"flex",alignItems:"center",paddingTop:28,gap:8},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[c.jsx(Va,{computer:r.computer,size:32}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,whiteSpace:"nowrap"},children:[c.jsx("span",{style:{...B("title2","semibold"),color:"var(--text)"},children:"Marketplace"}),e.length>1?c.jsxs(Yh,{title:"Switch computer",style:{display:"flex",alignItems:"center",gap:4,...B("subheadline"),color:"var(--secondary)",minWidth:0},items:()=>e.map(ge=>({title:ge.name,selected:ge.id===t,action:()=>n(ge.id)})),children:[c.jsx("span",{"aria-label":`Computer: ${r.hostName}`,style:{overflow:"hidden",textOverflow:"ellipsis"},children:r.hostName}),c.jsx(ae,{name:"chevron.down",size:10,weight:"semibold"})]}):c.jsx("span",{style:{...B("subheadline"),color:"var(--secondary)",overflow:"hidden",textOverflow:"ellipsis"},children:r.hostName})]})]}),c.jsx("span",{style:{flex:1}}),pe>0?c.jsxs("button",{className:"press",style:{display:"flex",alignItems:"center",gap:8,flex:"none"},onClick:()=>de(!0),children:[c.jsx("span",{style:{display:"flex"},children:l.installedConnectors.slice(0,3).map((ge,Ke)=>c.jsx("span",{style:{marginLeft:Ke?-8:0,display:"flex"},children:c.jsx(Xf,{name:ge.name,registryName:ge.registryName,size:26})},ge.id))}),c.jsxs("span",{style:{color:"var(--secondary)",whiteSpace:"nowrap"},children:[pe," installed"]}),c.jsx(ae,{name:"chevron.right",size:10,weight:"semibold",color:"var(--tertiary)"})]}):null]}),pt=c.jsxs("div",{className:"market-search",children:[c.jsx(ae,{name:"magnifyingglass",size:13,color:"var(--secondary)"}),c.jsx("input",{value:d,placeholder:"Search agents, connectors and skills","aria-label":"Search agents, connectors and skills",spellCheck:!1,onChange:ge=>{p(ge.target.value),ce(10)},onKeyDown:ge=>{ge.key==="Enter"&&!ge.nativeEvent.isComposing&&fi(d.trim())}}),d?c.jsx("button",{"aria-label":"Clear search",title:"Clear search",style:{display:"flex",color:"var(--tertiary)"},onClick:()=>{p(""),ce(10),fi("")},children:c.jsx(ae,{name:"xmark.circle.fill",size:13})}):null]}),$e=ge=>c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:ge}),gi=c.jsxs("div",{className:"market-page",children:[c.jsx("div",{className:"market-scroll",children:c.jsxs("div",{className:"market-page-content",children:[Bt,pt,xe.length>0?c.jsxs(ro,{title:le?`Agents matching “${le}”`:"Agents",children:[c.jsx("div",{className:"agent-grid",children:xe.slice(0,Q).map(ge=>c.jsx(Dj,{backend:ge,onClick:()=>te(ge)},ge.id))}),xe.length>Q?$e(c.jsx(Fe,{kind:"secondary",onClick:()=>ce(ge=>ge+10),children:"Load more agents"})):null]}):null,c.jsx(ro,{title:"Connectors",children:V?c.jsx(Zf,{}):v.items.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:le?`No connectors match “${le}”.`:"Couldn't load connectors."}):c.jsxs(c.Fragment,{children:[c.jsx(uo,{children:uS(v).map(ge=>c.jsx(Ha,{title:ge.title,subtitle:ge.description??ge.name,added:ge.installed,icon:c.jsx(Xf,{website:ge.website,name:ge.title,registryName:ge.name}),onAdd:()=>U(ge)},ge.name))}),Kf(v)||S?$e(c.jsx(Fe,{kind:"secondary",disabled:b,onClick:()=>{Re()},children:b?"Loading…":"Load more connectors"})):null]})}),c.jsx(O8,{query:le,searchToken:g}),c.jsx(ro,{title:"Skills",children:z?c.jsx(Zf,{}):c.jsx(uo,{children:be.map(ge=>c.jsx(Ha,{title:ge.name,subtitle:ge.description,added:ge.installed||l.installedSkills.some(Ke=>Ke.id===ge.source.toLowerCase()),busy:Y===ge.source,icon:c.jsx(fS,{}),onAdd:()=>{pi(ge)}},ge.source))})}),c.jsx("div",{children:c.jsxs(Fe,{kind:"secondary",onClick:()=>je(!0),children:[c.jsx(ae,{name:"lock.shield",size:11}),"Credentials"]})}),c.jsx(ro,{title:"Make your own",children:c.jsxs(uo,{children:[c.jsx(Ha,{title:"Custom connector",subtitle:"Any MCP server: a command or a URL",added:!1,addLabel:"New",icon:c.jsx(Qf,{name:"point.3.connected.trianglepath.dotted"}),onAdd:()=>N(!0)}),c.jsx(Ha,{title:"Your own skill",subtitle:"Write instructions a bot can follow",added:!1,addLabel:"New",icon:c.jsx(Qf,{name:"square.and.pencil"}),onAdd:()=>O(!0)})]})}),R?c.jsx("span",{style:{...B("footnote"),color:"var(--danger)"},children:R}):null,c.jsxs("span",{style:{...B("footnote"),color:"var(--tertiary)"},children:["Connectors come from the official MCP Registry, apps through Composio, skills from Anthropic, agents from the ACP registry. Everything installs on ",r.hostName,"."]})]})}),c.jsx("div",{className:"market-close",children:c.jsx(ke,{title:"Close",icon:"xmark",onClick:h})})]});return c.jsxs(c.Fragment,{children:[c.jsx(pS,{base:gi,top:re?c.jsx(Rj,{back:()=>de(!1)}):null}),c.jsx(Rs,{open:q!==null,onClose:()=>U(null),children:q?c.jsx(mS,{item:q,done:()=>{_e(J.current)}},q.name):null}),c.jsx(Rs,{open:Ce,onClose:()=>je(!1),width:560,height:720,children:c.jsx(P8,{})}),c.jsx(Rs,{open:M,onClose:()=>N(!1),children:c.jsx(H8,{})}),c.jsx(Rs,{open:L,onClose:()=>O(!1),children:c.jsx(I8,{})}),c.jsx(Rs,{open:P!==null,onClose:()=>te(null),width:560,height:560,children:P?c.jsx(Mj,{initial:P},P.id):null})]})}function Dj({backend:e,onClick:t}){const n=e.installed===!0?e.signedIn===!1?"Not signed in":"Installed":e.curated===!0?"Not installed":"Sets up on first use";return c.jsxs("button",{className:"agent-card",title:e.name,onClick:t,children:[c.jsx(qx,{registry:e.registry,icon:34,tile:64,radius:18}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,maxWidth:"100%"},children:[c.jsx("span",{style:{...B("subheadline","semibold"),color:"var(--text)",...Wh},children:e.name}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",...Wh},children:n})]})]})}const Wh={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"};function Rj({back:e}){const t=Ne(),n=Ga(t),[r,l]=x.useState(null),[h,d]=x.useState(null),p=n.installedConnectors.length===0&&n.installedSkills.length===0,g=async v=>{d(v);try{await n.signIn(v)}catch(_){t.setError(lt(_))}d(null)},m=async v=>{try{v.isSkill?await n.removeSkill(v.id):await n.removeConnector(v.id)}catch(_){t.setError(lt(_))}};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--background)"},children:[c.jsx(s1,{title:"Installed",onBack:e}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsxs(hi,{children:[p?c.jsx(Aj,{icon:"shippingbox",title:"Nothing installed",detail:"Connectors and skills you add show up here."}):null,n.installedConnectors.length?c.jsx(Ee,{title:"Connectors",children:n.installedConnectors.map(v=>c.jsx(i3,{title:v.name,subtitle:qa(v)?"Sign in so bots can use it":v.command??v.url??v.description,icon:v.kind==="composio"?c.jsx(t1,{url:v.logo,name:v.name,size:32}):c.jsx(Xf,{name:v.name,registryName:v.registryName,size:32}),accessory:h===v.id?c.jsx(et,{}):qa(v)?c.jsx(Fe,{onClick:()=>{g(v.id)},children:"Sign in"}):null,onRemove:()=>l({id:v.id,name:v.name,isSkill:!1})},v.id))}):null,n.installedSkills.length?c.jsx(Ee,{title:"Skills",children:n.installedSkills.map(v=>c.jsx(i3,{title:v.name,subtitle:v.description,icon:c.jsx(fS,{size:32}),onRemove:()=>l({id:v.id,name:v.name,isSkill:!0})},v.id))}):null]})}),c.jsx(ts,{open:r!==null,title:`Remove ${r?.name??""}?`,message:r?r.isSkill?"Bots stop using this skill.":"Bots lose this connector, and the keys saved for it are deleted.":null,actions:r?[{title:"Remove",destructive:!0,action:()=>{m(r)}}]:[],onClose:()=>l(null)})]})}function Aj({icon:e,title:t,detail:n}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"40px 0",textAlign:"center"},children:[c.jsx(ae,{name:e,size:28,color:"var(--tertiary)"}),c.jsx("span",{style:{...B("compactBody","semibold"),color:"var(--text)"},children:t}),c.jsx("span",{style:{...B("compactSecondary"),color:"var(--secondary)"},children:n})]})}function i3({title:e,subtitle:t,icon:n,accessory:r,onRemove:l}){return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},title:t,children:[n,c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},children:[c.jsx("span",{style:{color:"var(--text)",...Wh},children:e}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)",...Wh},children:t})]}),c.jsx("span",{style:{minWidth:12}}),r,c.jsx("button",{title:"Remove","aria-label":`Remove ${e}`,style:{minWidth:44,minHeight:44,display:"grid",placeItems:"center",color:"var(--secondary)",margin:"-8px 0"},onClick:l,children:c.jsx(ae,{name:"trash",size:13})})]})}var Oa={},df,s3;function Nj(){return s3||(s3=1,df=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),df}var ff={},$n={},n3;function Hr(){if(n3)return $n;n3=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return $n.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},$n.getSymbolTotalCodewords=function(r){return t[r]},$n.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},$n.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},$n.isKanjiModeEnabled=function(){return typeof e<"u"},$n.toSJIS=function(r){return e(r)},$n}var pf={},r3;function b1(){return r3||(r3=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,l){if(e.isValid(r))return r;try{return t(r)}catch{return l}}})(pf)),pf}var gf,a3;function Lj(){if(a3)return gf;a3=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let r=0;r<n;r++)this.putBit((t>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},gf=e,gf}var mf,l3;function Bj(){if(l3)return mf;l3=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,r,l){const h=t*this.size+n;this.data[h]=r,l&&(this.reservedBit[h]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},mf=e,mf}var vf={},o3;function Oj(){return o3||(o3=1,(function(e){const t=Hr().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const l=Math.floor(r/7)+2,h=t(r),d=h===145?26:Math.ceil((h-13)/(2*l-2))*2,p=[h-7];for(let g=1;g<l-1;g++)p[g]=p[g-1]-d;return p.push(6),p.reverse()},e.getPositions=function(r){const l=[],h=e.getRowColCoords(r),d=h.length;for(let p=0;p<d;p++)for(let g=0;g<d;g++)p===0&&g===0||p===0&&g===d-1||p===d-1&&g===0||l.push([h[p],h[g]]);return l}})(vf)),vf}var _f={},c3;function zj(){if(c3)return _f;c3=1;const e=Hr().getSymbolSize,t=7;return _f.getPositions=function(r){const l=e(r);return[[0,0],[l-t,0],[0,l-t]]},_f}var yf={},h3;function Hj(){return h3||(h3=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const h=l.size;let d=0,p=0,g=0,m=null,v=null;for(let _=0;_<h;_++){p=g=0,m=v=null;for(let S=0;S<h;S++){let w=l.get(_,S);w===m?p++:(p>=5&&(d+=t.N1+(p-5)),m=w,p=1),w=l.get(S,_),w===v?g++:(g>=5&&(d+=t.N1+(g-5)),v=w,g=1)}p>=5&&(d+=t.N1+(p-5)),g>=5&&(d+=t.N1+(g-5))}return d},e.getPenaltyN2=function(l){const h=l.size;let d=0;for(let p=0;p<h-1;p++)for(let g=0;g<h-1;g++){const m=l.get(p,g)+l.get(p,g+1)+l.get(p+1,g)+l.get(p+1,g+1);(m===4||m===0)&&d++}return d*t.N2},e.getPenaltyN3=function(l){const h=l.size;let d=0,p=0,g=0;for(let m=0;m<h;m++){p=g=0;for(let v=0;v<h;v++)p=p<<1&2047|l.get(m,v),v>=10&&(p===1488||p===93)&&d++,g=g<<1&2047|l.get(v,m),v>=10&&(g===1488||g===93)&&d++}return d*t.N3},e.getPenaltyN4=function(l){let h=0;const d=l.data.length;for(let g=0;g<d;g++)h+=l.data[g];return Math.abs(Math.ceil(h*100/d/5)-10)*t.N4};function n(r,l,h){switch(r){case e.Patterns.PATTERN000:return(l+h)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return h%3===0;case e.Patterns.PATTERN011:return(l+h)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(h/3))%2===0;case e.Patterns.PATTERN101:return l*h%2+l*h%3===0;case e.Patterns.PATTERN110:return(l*h%2+l*h%3)%2===0;case e.Patterns.PATTERN111:return(l*h%3+(l+h)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(l,h){const d=h.size;for(let p=0;p<d;p++)for(let g=0;g<d;g++)h.isReserved(g,p)||h.xor(g,p,n(l,g,p))},e.getBestMask=function(l,h){const d=Object.keys(e.Patterns).length;let p=0,g=1/0;for(let m=0;m<d;m++){h(m),e.applyMask(m,l);const v=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(m,l),v<g&&(g=v,p=m)}return p}})(yf)),yf}var yh={},u3;function Vx(){if(u3)return yh;u3=1;const e=b1(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return yh.getBlocksCount=function(l,h){switch(h){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},yh.getTotalCodewordsCount=function(l,h){switch(h){case e.L:return n[(l-1)*4+0];case e.M:return n[(l-1)*4+1];case e.Q:return n[(l-1)*4+2];case e.H:return n[(l-1)*4+3];default:return}},yh}var Sf={},so={},d3;function Ij(){if(d3)return so;d3=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let l=0;l<255;l++)e[l]=r,t[r]=l,r<<=1,r&256&&(r^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),so.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},so.exp=function(r){return e[r]},so.mul=function(r,l){return r===0||l===0?0:e[t[r]+t[l]]},so}var f3;function Uj(){return f3||(f3=1,(function(e){const t=Ij();e.mul=function(r,l){const h=new Uint8Array(r.length+l.length-1);for(let d=0;d<r.length;d++)for(let p=0;p<l.length;p++)h[d+p]^=t.mul(r[d],l[p]);return h},e.mod=function(r,l){let h=new Uint8Array(r);for(;h.length-l.length>=0;){const d=h[0];for(let g=0;g<l.length;g++)h[g]^=t.mul(l[g],d);let p=0;for(;p<h.length&&h[p]===0;)p++;h=h.slice(p)}return h},e.generateECPolynomial=function(r){let l=new Uint8Array([1]);for(let h=0;h<r;h++)l=e.mul(l,new Uint8Array([1,t.exp(h)]));return l}})(Sf)),Sf}var xf,p3;function Pj(){if(p3)return xf;p3=1;const e=Uj();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(r.length+this.degree);l.set(r);const h=e.mod(l,this.genPoly),d=this.degree-h.length;if(d>0){const p=new Uint8Array(this.degree);return p.set(h,d),p}return h},xf=t,xf}var wf={},bf={},Cf={},g3;function $x(){return g3||(g3=1,Cf.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Cf}var Ts={},m3;function Wx(){if(m3)return Ts;m3=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
-]))+`;Ts.KANJI=new RegExp(n,"g"),Ts.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ts.BYTE=new RegExp(r,"g"),Ts.NUMERIC=new RegExp(e,"g"),Ts.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+n+"$"),h=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ts.testKanji=function(g){return l.test(g)},Ts.testNumeric=function(g){return h.test(g)},Ts.testAlphanumeric=function(g){return d.test(g)},Ts}var v3;function Ir(){return v3||(v3=1,(function(e){const t=$x(),n=Wx();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(h,d){if(!h.ccBits)throw new Error("Invalid mode: "+h);if(!t.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?h.ccBits[0]:d<27?h.ccBits[1]:h.ccBits[2]},e.getBestModeForData=function(h){return n.testNumeric(h)?e.NUMERIC:n.testAlphanumeric(h)?e.ALPHANUMERIC:n.testKanji(h)?e.KANJI:e.BYTE},e.toString=function(h){if(h&&h.id)return h.id;throw new Error("Invalid mode")},e.isValid=function(h){return h&&h.bit&&h.ccBits};function r(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(h,d){if(e.isValid(h))return h;try{return r(h)}catch{return d}}})(bf)),bf}var _3;function qj(){return _3||(_3=1,(function(e){const t=Hr(),n=Vx(),r=b1(),l=Ir(),h=$x(),d=7973,p=t.getBCHDigit(d);function g(S,w,b){for(let k=1;k<=40;k++)if(w<=e.getCapacity(k,b,S))return k}function m(S,w){return l.getCharCountIndicator(S,w)+4}function v(S,w){let b=0;return S.forEach(function(k){const E=m(k.mode,w);b+=E+k.getBitsLength()}),b}function _(S,w){for(let b=1;b<=40;b++)if(v(S,b)<=e.getCapacity(b,w,l.MIXED))return b}e.from=function(w,b){return h.isValid(w)?parseInt(w,10):b},e.getCapacity=function(w,b,k){if(!h.isValid(w))throw new Error("Invalid QR Code version");typeof k>"u"&&(k=l.BYTE);const E=t.getSymbolTotalCodewords(w),j=n.getTotalCodewordsCount(w,b),V=(E-j)*8;if(k===l.MIXED)return V;const A=V-m(k,w);switch(k){case l.NUMERIC:return Math.floor(A/10*3);case l.ALPHANUMERIC:return Math.floor(A/11*2);case l.KANJI:return Math.floor(A/13);case l.BYTE:default:return Math.floor(A/8)}},e.getBestVersionForData=function(w,b){let k;const E=r.from(b,r.M);if(Array.isArray(w)){if(w.length>1)return _(w,E);if(w.length===0)return 1;k=w[0]}else k=w;return g(k.mode,k.getLength(),E)},e.getEncodedBits=function(w){if(!h.isValid(w)||w<7)throw new Error("Invalid QR Code version");let b=w<<12;for(;t.getBCHDigit(b)-p>=0;)b^=d<<t.getBCHDigit(b)-p;return w<<12|b}})(wf)),wf}var kf={},y3;function Vj(){if(y3)return kf;y3=1;const e=Hr(),t=1335,n=21522,r=e.getBCHDigit(t);return kf.getEncodedBits=function(h,d){const p=h.bit<<3|d;let g=p<<10;for(;e.getBCHDigit(g)-r>=0;)g^=t<<e.getBCHDigit(g)-r;return(p<<10|g)^n},kf}var Ef={},Mf,S3;function $j(){if(S3)return Mf;S3=1;const e=Ir();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let l,h,d;for(l=0;l+3<=this.data.length;l+=3)h=this.data.substr(l,3),d=parseInt(h,10),r.put(d,10);const p=this.data.length-l;p>0&&(h=this.data.substr(l),d=parseInt(h,10),r.put(d,p*3+1))},Mf=t,Mf}var jf,x3;function Wj(){if(x3)return jf;x3=1;const e=Ir(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(r){this.mode=e.ALPHANUMERIC,this.data=r}return n.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(l){let h;for(h=0;h+2<=this.data.length;h+=2){let d=t.indexOf(this.data[h])*45;d+=t.indexOf(this.data[h+1]),l.put(d,11)}this.data.length%2&&l.put(t.indexOf(this.data[h]),6)},jf=n,jf}var Tf,w3;function Fj(){if(w3)return Tf;w3=1;const e=Ir();function t(n){this.mode=e.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return t.getBitsLength=function(r){return r*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){for(let r=0,l=this.data.length;r<l;r++)n.put(this.data[r],8)},Tf=t,Tf}var Df,b3;function Kj(){if(b3)return Df;b3=1;const e=Ir(),t=Hr();function n(r){this.mode=e.KANJI,this.data=r}return n.getBitsLength=function(l){return l*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let l;for(l=0;l<this.data.length;l++){let h=t.toSJIS(this.data[l]);if(h>=33088&&h<=40956)h-=33088;else if(h>=57408&&h<=60351)h-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`
-Make sure your charset is UTF-8`);h=(h>>>8&255)*192+(h&255),r.put(h,13)}},Df=n,Df}var Rf={exports:{}},C3;function Yj(){return C3||(C3=1,(function(e){var t={single_source_shortest_paths:function(n,r,l){var h={},d={};d[r]=0;var p=t.PriorityQueue.make();p.push(r,0);for(var g,m,v,_,S,w,b,k,E;!p.empty();){g=p.pop(),m=g.value,_=g.cost,S=n[m]||{};for(v in S)S.hasOwnProperty(v)&&(w=S[v],b=_+w,k=d[v],E=typeof d[v]>"u",(E||k>b)&&(d[v]=b,p.push(v,b),h[v]=m))}if(typeof l<"u"&&typeof d[l]>"u"){var j=["Could not find a path from ",r," to ",l,"."].join("");throw new Error(j)}return h},extract_shortest_path_from_predecessor_list:function(n,r){for(var l=[],h=r;h;)l.push(h),n[h],h=n[h];return l.reverse(),l},find_path:function(n,r,l){var h=t.single_source_shortest_paths(n,r,l);return t.extract_shortest_path_from_predecessor_list(h,l)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,l={},h;n=n||{};for(h in r)r.hasOwnProperty(h)&&(l[h]=r[h]);return l.queue=[],l.sorter=n.sorter||r.default_sorter,l},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var l={value:n,cost:r};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Rf)),Rf.exports}var k3;function Gj(){return k3||(k3=1,(function(e){const t=Ir(),n=$j(),r=Wj(),l=Fj(),h=Kj(),d=Wx(),p=Hr(),g=Yj();function m(j){return unescape(encodeURIComponent(j)).length}function v(j,V,A){const z=[];let F;for(;(F=j.exec(A))!==null;)z.push({data:F[0],index:F.index,mode:V,length:F[0].length});return z}function _(j){const V=v(d.NUMERIC,t.NUMERIC,j),A=v(d.ALPHANUMERIC,t.ALPHANUMERIC,j);let z,F;return p.isKanjiModeEnabled()?(z=v(d.BYTE,t.BYTE,j),F=v(d.KANJI,t.KANJI,j)):(z=v(d.BYTE_KANJI,t.BYTE,j),F=[]),V.concat(A,z,F).sort(function(I,q){return I.index-q.index}).map(function(I){return{data:I.data,mode:I.mode,length:I.length}})}function S(j,V){switch(V){case t.NUMERIC:return n.getBitsLength(j);case t.ALPHANUMERIC:return r.getBitsLength(j);case t.KANJI:return h.getBitsLength(j);case t.BYTE:return l.getBitsLength(j)}}function w(j){return j.reduce(function(V,A){const z=V.length-1>=0?V[V.length-1]:null;return z&&z.mode===A.mode?(V[V.length-1].data+=A.data,V):(V.push(A),V)},[])}function b(j){const V=[];for(let A=0;A<j.length;A++){const z=j[A];switch(z.mode){case t.NUMERIC:V.push([z,{data:z.data,mode:t.ALPHANUMERIC,length:z.length},{data:z.data,mode:t.BYTE,length:z.length}]);break;case t.ALPHANUMERIC:V.push([z,{data:z.data,mode:t.BYTE,length:z.length}]);break;case t.KANJI:V.push([z,{data:z.data,mode:t.BYTE,length:m(z.data)}]);break;case t.BYTE:V.push([{data:z.data,mode:t.BYTE,length:m(z.data)}])}}return V}function k(j,V){const A={},z={start:{}};let F=["start"];for(let R=0;R<j.length;R++){const I=j[R],q=[];for(let U=0;U<I.length;U++){const Y=I[U],$=""+R+U;q.push($),A[$]={node:Y,lastCount:0},z[$]={};for(let M=0;M<F.length;M++){const N=F[M];A[N]&&A[N].node.mode===Y.mode?(z[N][$]=S(A[N].lastCount+Y.length,Y.mode)-S(A[N].lastCount,Y.mode),A[N].lastCount+=Y.length):(A[N]&&(A[N].lastCount=Y.length),z[N][$]=S(Y.length,Y.mode)+4+t.getCharCountIndicator(Y.mode,V))}}F=q}for(let R=0;R<F.length;R++)z[F[R]].end=0;return{map:z,table:A}}function E(j,V){let A;const z=t.getBestModeForData(j);if(A=t.from(V,z),A!==t.BYTE&&A.bit<z.bit)throw new Error('"'+j+'" cannot be encoded with mode '+t.toString(A)+`.
- Suggested mode is: `+t.toString(z));switch(A===t.KANJI&&!p.isKanjiModeEnabled()&&(A=t.BYTE),A){case t.NUMERIC:return new n(j);case t.ALPHANUMERIC:return new r(j);case t.KANJI:return new h(j);case t.BYTE:return new l(j)}}e.fromArray=function(V){return V.reduce(function(A,z){return typeof z=="string"?A.push(E(z,null)):z.data&&A.push(E(z.data,z.mode)),A},[])},e.fromString=function(V,A){const z=_(V,p.isKanjiModeEnabled()),F=b(z),R=k(F,A),I=g.find_path(R.map,"start","end"),q=[];for(let U=1;U<I.length-1;U++)q.push(R.table[I[U]].node);return e.fromArray(w(q))},e.rawSplit=function(V){return e.fromArray(_(V,p.isKanjiModeEnabled()))}})(Ef)),Ef}var E3;function Zj(){if(E3)return ff;E3=1;const e=Hr(),t=b1(),n=Lj(),r=Bj(),l=Oj(),h=zj(),d=Hj(),p=Vx(),g=Pj(),m=qj(),v=Vj(),_=Ir(),S=Gj();function w(R,I){const q=R.size,U=h.getPositions(I);for(let Y=0;Y<U.length;Y++){const $=U[Y][0],M=U[Y][1];for(let N=-1;N<=7;N++)if(!($+N<=-1||q<=$+N))for(let L=-1;L<=7;L++)M+L<=-1||q<=M+L||(N>=0&&N<=6&&(L===0||L===6)||L>=0&&L<=6&&(N===0||N===6)||N>=2&&N<=4&&L>=2&&L<=4?R.set($+N,M+L,!0,!0):R.set($+N,M+L,!1,!0))}}function b(R){const I=R.size;for(let q=8;q<I-8;q++){const U=q%2===0;R.set(q,6,U,!0),R.set(6,q,U,!0)}}function k(R,I){const q=l.getPositions(I);for(let U=0;U<q.length;U++){const Y=q[U][0],$=q[U][1];for(let M=-2;M<=2;M++)for(let N=-2;N<=2;N++)M===-2||M===2||N===-2||N===2||M===0&&N===0?R.set(Y+M,$+N,!0,!0):R.set(Y+M,$+N,!1,!0)}}function E(R,I){const q=R.size,U=m.getEncodedBits(I);let Y,$,M;for(let N=0;N<18;N++)Y=Math.floor(N/3),$=N%3+q-8-3,M=(U>>N&1)===1,R.set(Y,$,M,!0),R.set($,Y,M,!0)}function j(R,I,q){const U=R.size,Y=v.getEncodedBits(I,q);let $,M;for($=0;$<15;$++)M=(Y>>$&1)===1,$<6?R.set($,8,M,!0):$<8?R.set($+1,8,M,!0):R.set(U-15+$,8,M,!0),$<8?R.set(8,U-$-1,M,!0):$<9?R.set(8,15-$-1+1,M,!0):R.set(8,15-$-1,M,!0);R.set(U-8,8,1,!0)}function V(R,I){const q=R.size;let U=-1,Y=q-1,$=7,M=0;for(let N=q-1;N>0;N-=2)for(N===6&&N--;;){for(let L=0;L<2;L++)if(!R.isReserved(Y,N-L)){let O=!1;M<I.length&&(O=(I[M]>>>$&1)===1),R.set(Y,N-L,O),$--,$===-1&&(M++,$=7)}if(Y+=U,Y<0||q<=Y){Y-=U,U=-U;break}}}function A(R,I,q){const U=new n;q.forEach(function(L){U.put(L.mode.bit,4),U.put(L.getLength(),_.getCharCountIndicator(L.mode,R)),L.write(U)});const Y=e.getSymbolTotalCodewords(R),$=p.getTotalCodewordsCount(R,I),M=(Y-$)*8;for(U.getLengthInBits()+4<=M&&U.put(0,4);U.getLengthInBits()%8!==0;)U.putBit(0);const N=(M-U.getLengthInBits())/8;for(let L=0;L<N;L++)U.put(L%2?17:236,8);return z(U,R,I)}function z(R,I,q){const U=e.getSymbolTotalCodewords(I),Y=p.getTotalCodewordsCount(I,q),$=U-Y,M=p.getBlocksCount(I,q),N=U%M,L=M-N,O=Math.floor(U/M),P=Math.floor($/M),te=P+1,Q=O-P,ce=new g(Q);let re=0;const de=new Array(M),Ce=new Array(M);let je=0;const D=new Uint8Array(R.buffer);for(let xe=0;xe<M;xe++){const be=xe<L?P:te;de[xe]=D.slice(re,re+be),Ce[xe]=ce.encode(de[xe]),re+=be,je=Math.max(je,be)}const J=new Uint8Array(U);let le=0,he,we;for(he=0;he<je;he++)for(we=0;we<M;we++)he<de[we].length&&(J[le++]=de[we][he]);for(he=0;he<Q;he++)for(we=0;we<M;we++)J[le++]=Ce[we][he];return J}function F(R,I,q,U){let Y;if(Array.isArray(R))Y=S.fromArray(R);else if(typeof R=="string"){let O=I;if(!O){const P=S.rawSplit(R);O=m.getBestVersionForData(P,q)}Y=S.fromString(R,O||40)}else throw new Error("Invalid data");const $=m.getBestVersionForData(Y,q);if(!$)throw new Error("The amount of data is too big to be stored in a QR Code");if(!I)I=$;else if(I<$)throw new Error(`
-The chosen QR Code version cannot contain this amount of data.
-Minimum version required to store current data is: `+$+`.
-`);const M=A(I,q,Y),N=e.getSymbolSize(I),L=new r(N);return w(L,I),b(L),k(L,I),j(L,q,0),I>=7&&E(L,I),V(L,M),isNaN(U)&&(U=d.getBestMask(L,j.bind(null,L,q))),d.applyMask(U,L),j(L,q,U),{modules:L,version:I,errorCorrectionLevel:q,maskPattern:U,segments:Y}}return ff.create=function(I,q){if(typeof I>"u"||I==="")throw new Error("No input text");let U=t.M,Y,$;return typeof q<"u"&&(U=t.from(q.errorCorrectionLevel,t.M),Y=m.from(q.version),$=d.from(q.maskPattern),q.toSJISFunc&&e.setToSJISFunction(q.toSJISFunc)),F(I,Y,U,$)},ff}var Af={},Nf={},M3;function Fx(){return M3||(M3=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(h){return[h,h]}))),r.length===6&&r.push("F","F");const l=parseInt(r.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const l=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,h=r.width&&r.width>=21?r.width:void 0,d=r.scale||4;return{width:h,scale:h?4:d,margin:l,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,l){return l.width&&l.width>=r+l.margin*2?l.width/(r+l.margin*2):l.scale},e.getImageWidth=function(r,l){const h=e.getScale(r,l);return Math.floor((r+l.margin*2)*h)},e.qrToImageData=function(r,l,h){const d=l.modules.size,p=l.modules.data,g=e.getScale(d,h),m=Math.floor((d+h.margin*2)*g),v=h.margin*g,_=[h.color.light,h.color.dark];for(let S=0;S<m;S++)for(let w=0;w<m;w++){let b=(S*m+w)*4,k=h.color.light;if(S>=v&&w>=v&&S<m-v&&w<m-v){const E=Math.floor((S-v)/g),j=Math.floor((w-v)/g);k=_[p[E*d+j]?1:0]}r[b++]=k.r,r[b++]=k.g,r[b++]=k.b,r[b]=k.a}}})(Nf)),Nf}var j3;function Xj(){return j3||(j3=1,(function(e){const t=Fx();function n(l,h,d){l.clearRect(0,0,h.width,h.height),h.style||(h.style={}),h.height=d,h.width=d,h.style.height=d+"px",h.style.width=d+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(h,d,p){let g=p,m=d;typeof g>"u"&&(!d||!d.getContext)&&(g=d,d=void 0),d||(m=r()),g=t.getOptions(g);const v=t.getImageWidth(h.modules.size,g),_=m.getContext("2d"),S=_.createImageData(v,v);return t.qrToImageData(S.data,h,g),n(_,m,v),_.putImageData(S,0,0),m},e.renderToDataURL=function(h,d,p){let g=p;typeof g>"u"&&(!d||!d.getContext)&&(g=d,d=void 0),g||(g={});const m=e.render(h,d,g),v=g.type||"image/png",_=g.rendererOpts||{};return m.toDataURL(v,_.quality)}})(Af)),Af}var Lf={},T3;function Qj(){if(T3)return Lf;T3=1;const e=Fx();function t(l,h){const d=l.a/255,p=h+'="'+l.hex+'"';return d<1?p+" "+h+'-opacity="'+d.toFixed(2).slice(1)+'"':p}function n(l,h,d){let p=l+h;return typeof d<"u"&&(p+=" "+d),p}function r(l,h,d){let p="",g=0,m=!1,v=0;for(let _=0;_<l.length;_++){const S=Math.floor(_%h),w=Math.floor(_/h);!S&&!m&&(m=!0),l[_]?(v++,_>0&&S>0&&l[_-1]||(p+=m?n("M",S+d,.5+w+d):n("m",g,0),g=0,m=!1),S+1<h&&l[_+1]||(p+=n("h",v),v=0)):g++}return p}return Lf.render=function(h,d,p){const g=e.getOptions(d),m=h.modules.size,v=h.modules.data,_=m+g.margin*2,S=g.color.light.a?"<path "+t(g.color.light,"fill")+' d="M0 0h'+_+"v"+_+'H0z"/>':"",w="<path "+t(g.color.dark,"stroke")+' d="'+r(v,m,g.margin)+'"/>',b='viewBox="0 0 '+_+" "+_+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(g.width?'width="'+g.width+'" height="'+g.width+'" ':"")+b+' shape-rendering="crispEdges">'+S+w+`</svg>
-`;return typeof p=="function"&&p(null,E),E},Lf}var D3;function Jj(){if(D3)return Oa;D3=1;const e=Nj(),t=Zj(),n=Xj(),r=Qj();function l(h,d,p,g,m){const v=[].slice.call(arguments,1),_=v.length,S=typeof v[_-1]=="function";if(!S&&!e())throw new Error("Callback required as last argument");if(S){if(_<2)throw new Error("Too few arguments provided");_===2?(m=p,p=d,d=g=void 0):_===3&&(d.getContext&&typeof m>"u"?(m=g,g=void 0):(m=g,g=p,p=d,d=void 0))}else{if(_<1)throw new Error("Too few arguments provided");return _===1?(p=d,d=g=void 0):_===2&&!d.getContext&&(g=p,p=d,d=void 0),new Promise(function(w,b){try{const k=t.create(p,g);w(h(k,d,g))}catch(k){b(k)}})}try{const w=t.create(p,g);m(null,h(w,d,g))}catch(w){m(w)}}return Oa.create=t.create,Oa.toCanvas=l.bind(null,n.render),Oa.toDataURL=l.bind(null,n.renderToDataURL),Oa.toString=l.bind(null,function(h,d,p){return r.render(h,p)}),Oa}var eT=Jj();const Kx=gb(eT),R3="brew install leepokai/codync/codync-host && codync-host install",tT=()=>({id:crypto.randomUUID(),host:"",port:null,user:null,identityFile:null,remotePort:19222,computerId:null,name:""}),eu=()=>window.codync.ssh??null;class iT extends Br{state={profiles:[],status:{},attachments:[]};started=!1;start(){const t=eu();this.started||!t||(this.started=!0,t.onChange(n=>this.apply(n)),t.state().then(n=>this.apply(n)))}apply(t){this.state=t,this.changed()}status(t){return this.state.status[t]??{kind:"idle"}}isSSH(t){return this.state.attachments.some(n=>n.computer.id===t)}}const vo=new iT;function sT(){return x.useEffect(()=>vo.start(),[]),cn(vo)}function nT(e){x.useEffect(()=>{vo.start();const t=new Map,n=()=>{const l=new Map(vo.state.attachments.map(h=>[h.computer.id,h]));for(const[h,d]of l){const p=`${d.baseURL}|${d.token}`;if(t.get(h)===p)continue;const g=e.computers.find(v=>v.id===h),m={...d.computer,urls:[],color:g?.color??null,device:g?.device??null};e.attach(m,new J3(m,!0,()=>new Z2(d.baseURL,d.token))),t.set(h,p)}for(const h of[...t.keys()])l.has(h)||(t.delete(h),e.detach(h))};n();const r=vo.subscribe(n);return()=>{r();for(const l of t.keys())e.detach(l)}},[e])}function rT(){const e=ns(),t=Ya(),n=sT(),r=cn(e.cloud),[l,h]=x.useState(null),d=e.managedStores,p=new Set(d.map(v=>v.computer.id)),g=e.computers.filter(v=>!p.has(v.id)),m=r.computers.filter(v=>!p.has(v.computerId)&&!g.some(_=>_.id===v.computerId));return c.jsxs("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:26,padding:"14px 14px 20px"},children:[d.map(v=>c.jsx(oT,{store:v,ssh:n.isSSH(v.computer.id)},v.computer.id)),c.jsxs("div",{children:[c.jsx(ey,{title:"Over SSH",children:eu()?c.jsx(ke,{title:"Add SSH computer",icon:"plus",onClick:()=>h({profile:tT(),isNew:!0})}):null}),c.jsx($a,{show:n.state.profiles.length===0,children:c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Run bots on another computer you reach with SSH. It needs codync-host installed; your SSH keys stay on ",go,"."]})}),n.state.profiles.map(v=>c.jsx(uT,{profile:v,status:n.status(v.id),edit:()=>h({profile:v,isNew:!1})},v.id))]}),c.jsxs("div",{children:[c.jsx(ey,{title:"In your account",children:t.isSignedIn?c.jsx(ke,{title:"Refresh",icon:"arrow.clockwise",onClick:()=>{r.refresh()}}):null}),t.isSignedIn?g.length===0&&m.length===0?c.jsx("div",{style:{...B("callout"),color:"var(--secondary)"},children:"No other computers in your account yet."}):null:c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Sign in to reach the other computers in your account from ",go,"."]}),g.map(v=>{const _=e.store(v.id);if(!_)return null;const S=r.computers.find(b=>b.computerId===v.id),w=!!S&&r.isOlderCopy(S)&&_.connection.kind!=="unauthorized";return c.jsx("div",{className:"settings-card settings-appear",children:c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:_.computer,size:22}),c.jsxs("div",{className:"settings-stack",children:[c.jsx("span",{style:B("callout","medium"),children:_.hostName}),c.jsx("span",{style:{...B("caption"),color:w?"var(--warning)":"var(--secondary)"},children:w?`Older copy of this computer · ${n2(_)}`:n2(_)})]}),c.jsx(aT,{store:_}),c.jsx("span",{style:{flex:1}}),c.jsx(ke,{title:`Remove from ${go}`,icon:"minus.circle",onClick:()=>e.detach(v.id)})]})},v.id)}),m.map(v=>c.jsx("div",{className:"settings-card settings-appear",children:c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:{id:v.computerId,name:v.name,signKey:v.signKey,urls:[],device:v.device??null},size:22}),c.jsxs("div",{className:"settings-stack",children:[c.jsx("span",{style:B("callout","medium"),children:v.name}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:v.online?"Online":"Offline"})]})]})},v.computerId))]})]}),c.jsx($t,{open:l!==null,onClose:()=>h(null),width:460,children:l?c.jsx(dT,{profile:l.profile,isNew:l.isNew},l.profile.id):null})]})}function aT({store:e}){if(e.connection.kind!=="online"||!e.hostRoute||e.hostRoute==="loopback")return null;const t=e.hostRoute==="relay";return c.jsx("span",{title:t?"Through Cloudflare (encrypted)":"Direct: Wi-Fi or Tailscale","aria-label":t?"Through Cloudflare":"Wi-Fi or Tailscale",style:{display:"flex",color:"var(--tertiary)"},children:c.jsx(ae,{name:t?"cloud":"wifi",size:12})})}const lT=go==="this Mac"?"This Mac":"This computer";function oT({store:e,ssh:t}){const n=ns(),r=Ya();cn(e);const[l,h]=x.useState(null),[d,p]=x.useState(!1),[g,m]=x.useState(!1),[v,_]=x.useState(!1),[S,w]=x.useState(null),[b,k]=x.useState(!1),[E,j]=x.useState(!1),V=e.cloud,A=V?.approval==="auto",z=e.connection.kind==="online",F=e.hostName,R=M=>{p(!0),M().finally(()=>p(!1))},I=x.useCallback(async()=>{const M=Hh(e);if(M)try{h((await M.call("devices")).devices)}catch{}},[e]);x.useEffect(()=>{I()},[I,z,e.accessRequests.length]);const q=M=>R(async()=>{try{await(await e.ready()).call("setApproval",{approval:M})}catch(N){e.setError(Wa(N))}}),U=V?.enabled?V.lastError??(V.connected?"Reachable from anywhere through Cloudflare (encrypted).":"Connecting to Cloudflare…"):"Off: only Wi-Fi and Tailscale reach it, nothing goes through Cloudflare.",Y=V?.owner??null,$=c.jsxs("div",{className:"settings-row",style:{gap:8},children:[c.jsx(ae,{name:Y?"person.crop.circle.badge.checkmark":"person.crop.circle.badge.plus",size:13,color:"var(--secondary)"}),c.jsx("span",{style:{...B("callout"),flex:1},children:Y?Y.userId===r.user?.userId?"In your account":`In ${Y.email??"another"} account`:r.isSignedIn?"Not in your account":"Sign in to add it to your account"}),Y?c.jsx(Fe,{kind:"secondary",onClick:()=>k(!0),disabled:d||!z,children:"Remove from account"}):r.isSignedIn?c.jsx(Fe,{kind:"secondary",onClick:()=>R(async()=>{await n.cloud.claim(e)}),disabled:d||!z,children:d?"Adding…":"Add to account"}):null]});return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:28},children:[c.jsx(Ee,{children:[c.jsxs("div",{className:"settings-row",children:[c.jsx(Va,{computer:e.computer,size:26}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:B("headline"),children:F}),c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:[t?"Over SSH":lT," · ",n2(e)]})]}),t?c.jsx(ke,{title:"Voice chat",icon:"waveform",selected:v,disabled:!z,onClick:()=>_(M=>!M)}):null,c.jsx(ke,{title:"Pair iPhone",icon:"qrcode",selected:g,disabled:!z,onClick:()=>m(M=>!M)})]},"header"),c.jsx(rn,{on:V?.enabled??!1,disabled:d||!z,onChange:M=>R(()=>n.cloud.setCloud(e,M)),children:c.jsxs("span",{className:"settings-stack",children:[c.jsx("span",{children:"Reach from anywhere"}),c.jsx("span",{style:{...B("caption"),color:V?.lastError?"var(--warning)":"var(--secondary)"},children:U})]})},"cloud"),$,...Y?[c.jsx(rn,{on:A,disabled:d||!z,onChange:M=>M?j(!0):q("code"),children:c.jsxs("span",{className:"settings-stack settings-appear",children:[c.jsx("span",{children:"Skip the 6-digit check"}),c.jsx("span",{style:{...B("caption"),color:A?"var(--warning)":"var(--secondary)"},children:A?"Devices on your account get in on their own.":"Each new device shows a code you approve here."})]})},"approval")]:[]]}),c.jsx(Ee,{title:`Devices that can use ${F}`,children:l===null?[c.jsx(et,{},"loading")]:[...l.length===0?[c.jsx("span",{style:{color:"var(--secondary)"},children:"None yet. Pair an iPhone, or approve one from your account."},"none")]:[],...l.map(M=>c.jsxs("div",{className:"settings-row settings-appear",style:{gap:8},children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:M.platform==="macos"?"laptopcomputer":"iphone",size:13})}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{children:M.name}),c.jsx("span",{style:{...B("caption"),color:"var(--tertiary)"},children:cT(M)})]}),c.jsx(ke,{title:"Revoke access",icon:"xmark.circle",onClick:()=>w(M)})]},M.key))]}),c.jsx($t,{open:v,onClose:()=>_(!1),children:c.jsx(en.Provider,{value:e,children:c.jsx(d1,{})})}),c.jsxs($t,{open:g,onClose:()=>m(!1),width:340,children:[c.jsx(Lt,{title:`Pair iPhone with ${F}`}),c.jsx(hT,{store:e})]}),c.jsx(ts,{open:S!==null,title:`Revoke ${S?.name??"device"}?`,message:"It disconnects right away and has to pair or ask again.",actions:S?[{title:"Revoke access",destructive:!0,action:()=>R(async()=>{try{await(await e.ready()).call("revokeDevice",{key:S.key})}catch(M){e.setError(Wa(M))}await I()})}]:[],onClose:()=>w(null)}),c.jsx(ts,{open:E,title:"Let account devices in without a code?",message:`Any device signed in to your account gets full control of ${F}: its files, terminals and bots, with no check here. If someone gets into your account, or Codync's cloud is ever compromised, they could add their own device and you'd have no chance to stop it. Devices paired with a QR code aren't affected.`,actions:[{title:"Skip the check",destructive:!0,action:()=>q("auto")}],onClose:()=>j(!1)}),c.jsx(ts,{open:b,title:`Remove ${F} from the account?`,message:"Devices that were approved through the account lose access. Devices paired with a QR code keep it.",actions:[{title:"Remove from account",destructive:!0,action:()=>R(()=>n.cloud.unclaim(e))}],onClose:()=>k(!1)})]})}function cT(e){const t=[e.source==="account"?"Approved through the account":"Paired with a QR code"];return e.connected?t.push("connected"):e.lastSeenAt&&t.push(`seen ${YS(new Date(e.lastSeenAt))}`),t.join(" · ")}function hT({store:e}){cn(e);const[t,n]=x.useState(null),[r,l]=x.useState(null),[h,d]=x.useState(null),p=e.hostName,g=x.useCallback(async()=>{const v=Hh(e);if(!v)return d(`${e.hostName} isn't connected.`);try{const _=await v.call("pairing");l(await Kx.toDataURL(_.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),n(_),d(null)}catch(_){d(Wa(_))}},[e]);x.useEffect(()=>{g()},[g]),x.useEffect(()=>{if(!t?.expiresAt)return;const v=setTimeout(()=>{g()},Math.max(1e3,t.expiresAt-Date.now()));return()=>clearTimeout(v)},[t?.expiresAt,g]);const m={...B("caption"),textAlign:"center"};return c.jsx("div",{style:{padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:t&&r?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"settings-appear",style:{padding:10,background:"#fff",borderRadius:12},children:c.jsx("img",{src:r,alt:`Pairing code for ${p}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),c.jsx("div",{style:{...m,color:"var(--secondary)"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),e.cloud?.enabled!==!0?c.jsx("div",{style:{...m,color:"var(--warning)"},children:t.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${p} on the same network.`}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.expiresAt?c.jsxs("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(t.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,c.jsx(ke,{title:"New code",icon:"arrow.clockwise",onClick:()=>{g()}}),c.jsx(ke,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(t.pairingUrl)})]})]}):h?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{...m,color:"var(--danger)"},children:h}),c.jsx(ke,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{g()}})]}):c.jsx(et,{size:20})})}function uT({profile:e,status:t,edit:n}){const r=eu(),l=`${e.user?`${e.user}@`:""}${e.host}${e.port!==null?`:${e.port}`:""}`,h=(()=>{switch(t.kind){case"idle":return`${l} · Not connected`;case"connecting":return t.step;case"confirmHostKey":return`${l} · Confirm the host key`;case"connected":return`${l} · Connected`;case"retrying":return`${t.message} Retrying…`;case"failed":return t.message;case"notInstalled":return`codync-host isn't installed on ${e.host}. Install it there:`}})(),d=t.kind==="retrying"||t.kind==="failed"||t.kind==="notInstalled",p=t.kind==="connected"||t.kind==="connecting"||t.kind==="retrying";return c.jsxs("div",{className:"settings-card settings-appear",children:[c.jsxs("div",{className:"settings-row",children:[c.jsx("span",{style:{width:22,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:"terminal",size:13})}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:B("callout","medium"),children:e.name||e.host}),c.jsx("span",{style:{...B("caption"),color:d?"var(--warning)":"var(--secondary)"},children:h})]}),p?c.jsx(ke,{title:"Disconnect",icon:"stop.circle",onClick:()=>r?.disconnect(e.id)}):c.jsx(ke,{title:"Connect",icon:"arrow.clockwise",onClick:()=>r?.connect(e.id)}),c.jsx(ke,{title:"Edit",icon:"pencil",onClick:n}),c.jsx(ke,{title:"Remove",icon:"trash",onClick:()=>r?.remove(e.id)})]}),c.jsx($a,{show:t.kind==="confirmHostKey",children:t.kind==="confirmHostKey"?c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("span",{style:{...B("caption"),color:"var(--secondary)"},children:["First connection to ",t.name,". Check that its host key fingerprint matches what the computer's owner sees (",c.jsx("code",{style:{fontFamily:"var(--mono)"},children:"ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub"}),")."]}),t.fingerprints.map(g=>c.jsx("span",{className:"selectable",style:B("caption",void 0,"monospaced"),children:g},g)),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsx(Fe,{onClick:()=>r?.trustHostKey(e.id),children:"Trust and connect"}),c.jsx(Fe,{kind:"secondary",onClick:()=>r?.disconnect(e.id),children:"Cancel"})]})]}):null}),c.jsx($a,{show:t.kind==="notInstalled",children:c.jsxs("div",{className:"settings-row",style:{gap:6},children:[c.jsx("span",{className:"settings-code selectable",children:R3}),c.jsx(ke,{title:"Copy install command",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(R3)})]})})]})}function dT({profile:e,isNew:t}){const n=ss(),[r,l]=x.useState(e),[h,d]=x.useState(e.port?.toString()??""),[p,g]=x.useState(String(e.remotePort)),[m,v]=x.useState(e.user??""),[_,S]=x.useState(null),w=eu(),b=async()=>{const E=R=>/^-?\d+$/.test(R),j=h.trim();if(j&&!E(j))return S("The SSH port must be a number.");const V=p.trim();if(!E(V))return S("The Codync port must be a number.");const A=m.trim(),z={...r,host:r.host.trim(),name:r.name.trim(),user:A||null,port:j?Number(j):null,remotePort:Number(V)},F=w?await w.save(z):"SSH computers need a newer build of Codync.";if(F)return S(F);n()},k=(E,j,V,A)=>c.jsxs("div",{className:"settings-row",style:{gap:12},children:[c.jsx("span",{style:{color:"var(--text)"},children:E}),c.jsx("input",{className:"settings-field","aria-label":E,placeholder:A,value:j,spellCheck:!1,onChange:z=>V(z.target.value)})]});return c.jsxs("div",{style:{width:460,display:"flex",flexDirection:"column"},onKeyDown:E=>E.key==="Enter"&&E.target instanceof HTMLInputElement&&void b(),children:[c.jsx(Lt,{title:t?"Add SSH computer":"Edit SSH computer",trailing:c.jsx(ke,{title:t?"Add":"Save",icon:"checkmark",onClick:()=>{b()}})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"4px 20px 20px"},children:[c.jsxs(Ee,{children:[k("Name",r.name,E=>l({...r,name:E}),"Optional"),k("Host",r.host,E=>l({...r,host:E}),"SSH alias or hostname"),k("User",m,v,"From SSH config"),k("SSH port",h,d,"From SSH config"),c.jsxs("div",{className:"settings-row",children:[c.jsx("span",{children:"Key"}),c.jsx("span",{style:{flex:1}}),c.jsx("span",{style:{color:"var(--secondary)"},children:r.identityFile?.split("/").pop()??"ssh-agent / SSH config"}),c.jsx(ke,{title:"Choose key file",icon:"key",onClick:()=>{w?.chooseKey().then(E=>E&&l(j=>({...j,identityFile:E})))}}),r.identityFile?c.jsx("span",{className:"settings-appear",style:{display:"flex"},children:c.jsx(ke,{title:"Use ssh-agent",icon:"xmark.circle",onClick:()=>l({...r,identityFile:null})})}):null]}),k("Codync port",p,g,"")]}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:"Codync opens an SSH tunnel to codync-host on that computer's loopback. It uses your SSH config and ssh-agent; agent forwarding stays off."}),c.jsx($a,{show:_!==null,children:c.jsx("span",{style:{...B("caption"),color:"var(--danger)"},children:_})})]})]})}function Yx(e){return e==="claude"?"#D97757":Co()?"#FFFFFF":"#000000"}const Gx=e=>e==="claude"?"#D97757":"var(--accent)",Zx=e=>["claude","codex"].includes(e)?`${e}-acp`:e,Xx=e=>e==="codex"?"hex":"blob",Qx=e=>e.windows.reduce((t,n)=>!t||n.percent>t.percent?n:t,null);function Jx(e){return e.label==="5-hour"?"Session":e.label.split(" · ")[1]??e.label}const fT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function pT(e,t=new Date){const n=/^(?:(\w{3}) (\d{1,2}) at )?(\d{1,2})(?::(\d{2}))?(am|pm)(?: \(([^)]+)\))?$/.exec(e);if(!n)return null;const r=n[6],l=gT(t,r);let h=l.month,d=l.day;if(n[1]){const _=fT.indexOf(n[1]);if(_<0)return null;h=_+1,d=Number(n[2])}const p=Number(n[3])%12+(n[5]==="pm"?12:0),g=n[4]?Number(n[4]):0,m=(_,S,w)=>mT(_,S,w,p,g,r);let v=m(l.year,h,d);return(v.getTime()<t.getTime()-864e5||!n[1]&&v<t)&&(v=n[1]?m(l.year+1,h,d):new Date(v.getTime()+864e5)),v}function gT(e,t){try{const n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric"}),r=Object.fromEntries(n.formatToParts(e).map(l=>[l.type,l.value]));return{year:Number(r.year),month:Number(r.month),day:Number(r.day)}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}}function mT(e,t,n,r,l,h){const d=Date.UTC(e,t-1,n,r,l);try{const p=new Intl.DateTimeFormat("en-US",{timeZone:h,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}),g=Object.fromEntries(p.formatToParts(new Date(d)).map(v=>[v.type,v.value])),m=Date.UTC(Number(g.year),Number(g.month)-1,Number(g.day),Number(g.hour),Number(g.minute));return new Date(d-(m-d))}catch{return new Date(e,t-1,n,r,l)}}function ew(e){return e.resetsAt?new Date(e.resetsAt):e.resetsText?pT(e.resetsText):null}function tw(e,t=new Date){const n=Math.max(0,(e.getTime()-t.getTime())/1e3),r=Math.floor(n/3600),l=Math.floor(n%3600/60);return r>=48?`${Math.floor(r/24)}d`:r>0?`${r}h ${l}m`:`${l}m`}function vT(e){const t=ew(e);return t?`resets in ${tw(t)}`:e.resetsText?`resets ${e.resetsText.replace(/ \(.*\)$/,"")}`:null}function _T({provider:e,size:t,style:n="character"}){const r=(Qx(e)?.percent??0)>=90;return n==="original"?c.jsx("span",{style:{width:t,height:t,display:"grid",placeItems:"center",flex:"none"},children:c.jsx(wS,{registry:Zx(e.id),size:t*.84,color:Gx(e.id)})}):c.jsxs("span",{style:{position:"relative",width:t,height:t,flex:"none",display:"block"},children:[c.jsx(nn,{shape:Xx(e.id),color:"",tint:Yx(e.id),size:t,mood:r?"needsInput":"idle"}),r?c.jsx("span",{style:{position:"absolute",top:-t*.12,right:-t*.12,display:"flex",color:"var(--danger)",background:"#fff",borderRadius:"50%"},children:c.jsx(ae,{name:"exclamationmark.circle.fill",size:t*.34,weight:"bold",scaled:!1})}):null]})}const A3=new Map;function yT(e,t,n,r){const h=document.createElement("canvas");h.width=t*2,h.height=t*2;const d=h.getContext("2d");d.scale(2,2);const p=e.id==="claude"?"#D97757":r?"#FFFFFF":"#000000";if(n==="original"){const m=l1(Zx(e.id));if(!m)return null;const v=A3.get(m);if(!v){const S=new Image;return S.src=m,S.onload=()=>A3.set(m,S),null}const _=t*.08;return d.drawImage(v,_,_,t-_*2,t-_*2),d.globalCompositeOperation="source-in",d.fillStyle=p,d.fillRect(0,0,t,t),h.toDataURL("image/png")}const g=(Qx(e)?.percent??0)>=90;return K2(d,{shape:Xx(e.id),fill:p,size:t,mood:g?"needsInput":"idle",dark:r,t:0,still:!0}),g&&(d.beginPath(),d.arc(t*.92,t*.08,t*.17,0,Math.PI*2),d.fillStyle=r?"#F0A7A7":"#C23A2B",d.fill()),h.toDataURL("image/png")}function ST({usage:e}){const[t]=ni(Rt.usageIconStyle);return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:18},children:e.providers.map(n=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsx(_T,{provider:n,size:18,style:t}),c.jsx("span",{style:{...B(13,"semibold"),color:"var(--text)"},children:n.name})]}),n.windows.map(r=>c.jsxs("div",{style:{...B(12),display:"flex",alignItems:"center",gap:10,whiteSpace:"nowrap"},children:[c.jsx("span",{style:{width:64,flex:"none",overflow:"hidden",textOverflow:"ellipsis",color:"var(--text)"},children:Jx(r)}),c.jsx(xT,{percent:r.percent,tint:Gx(n.id)}),c.jsxs("span",{style:{width:36,flex:"none",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text)"},children:[Math.round(r.percent),"%"]}),c.jsx("span",{style:{width:130,flex:"none",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",color:"var(--secondary)"},children:vT(r)??""})]},r.id))]},n.id))})}function xT({percent:e,tint:t}){const n=e>=90?"var(--danger)":e>=70?"var(--warning)":t;return c.jsx("span",{style:{flex:1,minWidth:0,height:6,borderRadius:3,background:"var(--bubble-agent)",overflow:"hidden"},children:c.jsx("span",{style:{display:"block",height:"100%",borderRadius:3,background:n,width:`${Math.min(1,Math.max(.02,e/100))*100}%`,transition:"width var(--layout)"}})})}const q2=KS?"This Mac":"This computer",N3=[{id:"general",title:"General",group:"Personal",icon:"gearshape"},{id:"computers",title:"Computers & devices",label:"Computers",group:q2,icon:"desktopcomputer"},{id:"voice",title:"Voice chat",group:"Personal",icon:"waveform"},{id:"usage",title:"Usage",group:"Personal",icon:"gauge.with.dots.needle.33percent"},{id:"updates",title:"Updates",group:q2,icon:"arrow.down.circle"}];function wT({page:e}){const[t,n]=x.useState(e),r=ns(),l=ss(),h=N3.find(d=>d.id===t);return c.jsxs("div",{className:"settings",children:[c.jsx("nav",{className:"settings-sidebar",children:["Personal",q2].map(d=>c.jsxs("div",{style:{display:"contents"},children:[c.jsx("div",{className:"settings-group",style:{paddingTop:d==="Personal"?0:16},children:d}),N3.filter(p=>p.group===d).map(p=>c.jsxs("button",{className:`settings-item ${p.id===t?"selected":""}`,"aria-selected":p.id===t,onClick:()=>n(p.id),children:[c.jsx("span",{style:{width:18,display:"flex",justifyContent:"center",color:"var(--secondary)"},children:c.jsx(ae,{name:p.icon,size:13})}),c.jsx("span",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.label??p.title}),p.id==="computers"&&r.approvals.length>0?c.jsx("span",{style:{...B(11,"semibold"),color:"var(--secondary)"},children:r.approvals.length}):null]},p.id))]},d))}),c.jsx("div",{className:"settings-divider"}),c.jsxs("div",{className:"settings-main",children:[c.jsx("div",{style:{...B(24,"semibold"),color:"var(--text)",padding:"30px 32px 8px"},children:h.title}),c.jsx("div",{className:"settings-page",children:c.jsx(bT,{page:t})},t)]}),c.jsx("span",{className:"settings-close",children:c.jsx(ke,{title:"Close",icon:"xmark",onClick:l})})]})}function bT({page:e}){const t=ns();switch(e){case"general":return c.jsx(CT,{});case"computers":return c.jsx(rT,{});case"voice":return t.local?c.jsx(en.Provider,{value:t.local,children:c.jsx(d1,{showsHeader:!1})}):c.jsx(hi,{children:c.jsxs("span",{style:{color:"var(--secondary)"},children:["Voice keys are kept by ",go,"'s host, which isn't running."]})});case"usage":return c.jsx(hi,{children:c.jsx(kT,{})});case"updates":return c.jsx(ET,{})}}function CT(){const e=Ya(),[t,n]=ni(Rt.textSize),[r,l]=ni(Rt.usageIconStyle),[h,d]=ni(Rt.sidebarCompact),[p,g]=x.useState(!0);x.useEffect(()=>{window.codync.app.showInDock().then(g)},[]);const[m,v]=x.useState(!1);return x.useEffect(()=>{window.codync.app.launchAtLogin().then(v)},[]),c.jsxs(hi,{children:[c.jsx(Ee,{title:"Account",footer:e.errorMessage,children:c.jsxs("div",{className:"settings-row",children:[c.jsx(ae,{name:"person.crop.circle",size:26,color:"var(--secondary)"}),c.jsxs("div",{className:"settings-stack",style:{flex:1},children:[c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.isSignedIn?e.user?.email??"Signed in":"Not signed in"}),c.jsx("span",{style:{...B("caption"),color:"var(--secondary)"},children:e.isSignedIn?"Reach your computers from anywhere":"Sign in to reach your computers from anywhere"})]}),e.isSignedIn?c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signOut()},disabled:e.isBusy,children:e.isBusy?"Please wait…":"Sign out"}):c.jsxs(c.Fragment,{children:[c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signIn("apple")},disabled:e.isBusy,children:"Apple"}),c.jsx(Fe,{kind:"secondary",onClick:()=>{e.signIn("google")},disabled:e.isBusy,children:"Google"})]})]})}),c.jsxs(Ee,{title:"Appearance",children:[c.jsx(Jt,{label:"Text size",children:c.jsx(Ci,{selection:t,options:Uf.map(_=>({id:_,label:_===Ua?`${_} pt (Default)`:`${_} pt`})),onChange:n})}),c.jsx(Jt,{label:"Usage icons",children:c.jsx(Ci,{selection:r,options:[{id:"character",label:"Character"},{id:"original",label:"Original"}],onChange:l})}),c.jsx(rn,{on:h,onChange:d,children:"Compact sidebar"})]}),c.jsxs(Ee,{title:"System",children:[window.codync.platform==="darwin"?c.jsx(rn,{on:p,onChange:_=>{window.codync.app.setShowInDock(_).then(g)},children:"Show in Dock"}):null,c.jsx(rn,{on:m,onChange:_=>{window.codync.app.setLaunchAtLogin(_).then(v)},children:"Open at login"})]})]})}function kT(){const e=ns(),t=e.computers.flatMap(r=>e.store(r.id)??[]),n=t.filter(r=>r.usage.providers.length>0);return n.length===0?c.jsx("span",{style:{color:"var(--secondary)"},children:"No usage information yet."}):c.jsx(c.Fragment,{children:n.flatMap(r=>[t.length>1?c.jsxs("div",{style:{...B("headline"),display:"flex",alignItems:"center",gap:6},children:[c.jsx(Va,{computer:r.computer,size:16}),r.hostName]},`${r.computer.id}-label`):null,c.jsx(ST,{usage:r.usage},r.computer.id)])})}function ET(){const[e,t]=x.useState(null);if(x.useEffect(()=>(window.codync.updates.state().then(t),window.codync.updates.onChange(t)),[]),!e)return null;const n=e.supported?e.waitingForApp?`Waiting for iPhone app ${e.waitingForApp} to pass App Store review.`:null:"Updates are available in release builds.",r=e.lastCheck?`Last checked ${new Date(e.lastCheck).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}`:null;return c.jsx(hi,{children:c.jsx(Ee,{title:"Codync",footer:n,children:[c.jsx(Jt,{label:"Version",detail:r,children:c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{children:window.codync.appVersion}),c.jsx(Fe,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:!e.canCheck&&!e.staged,children:e.availableVersion?`Update to ${e.availableVersion}`:"Check for updates"})]})},"version"),c.jsx(rn,{on:e.autoCheck,onChange:l=>window.codync.updates.setAutoCheck(l),disabled:!e.supported,children:"Automatically check for updates"},"check"),c.jsx(rn,{on:e.autoDownload,onChange:l=>window.codync.updates.setAutoDownload(l),disabled:!e.supported,children:"Automatically download and install"},"download"),...e.error?[c.jsxs("div",{className:"settings-row settings-appear",children:[c.jsx("span",{style:{flex:1,color:"var(--warning)"},children:e.error}),c.jsx(Fe,{kind:"secondary",onClick:()=>window.codync.updates.check(),disabled:e.checking,children:"Retry"})]},"error")]:[]]})})}function MT({approval:e}){const t=ns(),[n,r]=x.useState(!1),[l,h]=x.useState(null),d=e.request,p=async m=>{r(!0);try{await t.decide(e,m),t.deferApproval(e)}catch(v){h(Wa(v))}finally{r(!1)}},g={textAlign:"center"};return c.jsxs("div",{style:{width:420,display:"flex",flexDirection:"column"},children:[c.jsx(Lt,{title:"Access request"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,padding:"0 24px 24px"},children:[c.jsx(ae,{name:d.platform==="macos"?"laptopcomputer":"iphone",size:40,weight:"light",color:"var(--secondary)"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[c.jsxs("div",{style:{...B("title3","semibold"),...g},children:[d.deviceName," wants to use ",e.store.hostName]}),d.email?c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Signed in as ",d.email]}):null]}),d.code?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"selectable settings-appear",style:{...B(48,"semibold","monospaced"),color:"var(--text)"},"aria-label":`Code ${d.code.split("").join(" ")}`,children:L9(d.code)}),c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)",...g},children:["Approve only if ",d.deviceName," shows exactly this code. If it doesn't, deny: someone may be trying to get in."]})]}):c.jsxs(c.Fragment,{children:[c.jsx(et,{}),c.jsxs("div",{style:{...B("callout"),color:"var(--secondary)"},children:["Waiting for ",d.deviceName," to show its code…"]})]}),c.jsx($a,{show:l!==null,children:c.jsx("div",{style:{...B("caption"),color:"var(--danger)",...g},children:l})}),c.jsxs("div",{style:{display:"flex",gap:12},children:[c.jsx(Fe,{kind:"secondary",onClick:()=>{p(!1)},disabled:n,children:"Deny"}),c.jsx(Fe,{onClick:()=>{p(!0)},disabled:n||!d.code,children:"Approve"})]})]})]})}const iw="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%3e%3cpath%20fill='%23EA4335'%20d='M24%209.5c3.54%200%206.71%201.22%209.21%203.6l6.85-6.85C35.9%202.38%2030.47%200%2024%200%2014.62%200%206.51%205.38%202.56%2013.22l7.98%206.19C12.43%2013.72%2017.74%209.5%2024%209.5z'/%3e%3cpath%20fill='%234285F4'%20d='M46.98%2024.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58%202.96-2.26%205.48-4.78%207.18l7.73%206c4.51-4.18%207.09-10.36%207.09-17.65z'/%3e%3cpath%20fill='%23FBBC05'%20d='M10.53%2028.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92%2016.46%200%2020.12%200%2024c0%203.88.92%207.54%202.56%2010.78l7.97-6.19z'/%3e%3cpath%20fill='%2334A853'%20d='M24%2048c6.48%200%2011.93-2.13%2015.89-5.81l-7.73-6c-2.15%201.45-4.92%202.3-8.16%202.3-6.26%200-11.57-4.22-13.47-9.91l-7.98%206.19C6.51%2042.62%2014.62%2048%2024%2048z'/%3e%3c/svg%3e",Bf=window.codync.platform==="darwin"?"Mac":"computer";function jT({onContinue:e}){const t=Ya(),n=Ka(),[r,l]=x.useState(n?4:0);if(x.useEffect(()=>{t.isSignedIn&&e()},[t.isSignedIn,e]),x.useEffect(()=>{if(n)return l(4);const d=[150,430,710,990].map((p,g)=>setTimeout(()=>l(g+1),p));return()=>d.forEach(clearTimeout)},[n]),!t.isReady)return c.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14},children:[c.jsx(et,{size:24}),c.jsx("div",{style:{...B("callout"),color:"var(--secondary)"},children:"Checking for a saved account…"}),c.jsxs("button",{style:{color:"var(--secondary)"},onClick:e,children:["Continue on this ",Bf]})]});const h=d=>({opacity:d?1:0,transform:d?"none":"translateY(14px)",transition:"opacity 0.6s cubic-bezier(0.34, 1.3, 0.64, 1), transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"});return c.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--background)"},children:c.jsxs("div",{style:{minHeight:"100%",maxWidth:480,margin:"0 auto",display:"flex",flexDirection:"column",padding:"0 24px 12px"},children:[c.jsx("div",{style:{flex:1,minHeight:24}}),c.jsx(DT,{shown:r>=1}),c.jsx("div",{style:{flex:1,minHeight:24}}),c.jsx("div",{style:{paddingBottom:24},children:c.jsx(RT,{shown:r>=2})}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=3)},children:[c.jsxs("div",{style:{fontSize:34,fontWeight:600,letterSpacing:-.6,color:"var(--text)",lineHeight:1.15},children:["Your coding agents,",c.jsx("br",{}),"as teammates."]}),c.jsx("div",{style:{...B("body"),color:"var(--secondary)"},children:"Give each one a name and a project. They work on your computer while you're away."})]}),c.jsx("div",{style:{flex:1,minHeight:32}}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,...h(r>=4)},children:[c.jsxs(Fe,{onClick:e,style:{...B("headline"),minHeight:50,width:"100%"},children:["Continue on this ",Bf]}),c.jsx(Fe,{onClick:()=>{t.signIn("apple")},disabled:!t.isConfigured||t.isBusy,style:{...B("headline"),minHeight:50,width:"100%"},children:t.isBusy?c.jsx(et,{size:18}):c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx(ae,{name:"apple.logo",size:20}),"Continue with Apple"]})}),c.jsx(Fe,{kind:"secondary",onClick:()=>{t.signIn("google")},disabled:!t.isConfigured||t.isBusy,style:{...B("headline"),minHeight:50,width:"100%"},children:t.isBusy?c.jsx(et,{size:18}):c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:10},children:[c.jsx("img",{src:iw,alt:"",width:20,height:20}),"Continue with Google"]})}),t.isConfigured?null:c.jsxs("div",{style:{...B("footnote"),color:"var(--tertiary)"},children:["Sign-in isn't configured in this build. You can still use Codync on this ",Bf,"."]}),t.errorMessage?c.jsx("div",{style:{...B("footnote"),color:"var(--warning)"},children:t.errorMessage}):null]})]})})}const TT=[{shape:"blob",color:"blue",size:92,x:0,y:0,mood:"working"},{shape:"squircle",color:"orange",size:64,x:-104,y:-34,mood:"idle"},{shape:"teardrop",color:"violet",size:58,x:100,y:-46,mood:"working"},{shape:"hex",color:"green",size:48,x:-76,y:64,mood:"idle"},{shape:"cloud",color:"magenta",size:52,x:84,y:58,mood:"needsInput"}];function DT({shown:e}){const t=Ka(),[n,r]=x.useState(0);return x.useEffect(()=>{if(t||!e)return;let l=0;const h=d=>{r(d/1e3),l=requestAnimationFrame(h)};return l=requestAnimationFrame(h),()=>cancelAnimationFrame(l)},[t,e]),c.jsx("div",{"aria-hidden":!0,style:{position:"relative",height:170},children:TT.map((l,h)=>c.jsx("div",{style:{position:"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${l.x}px), calc(-50% + ${l.y+(t?0:Math.sin(n*1.3+h*1.7)*5)}px)) scale(${e?1:.3})`,opacity:e?1:0,transition:`opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s, scale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) ${h*.07}s`},children:c.jsx(nn,{shape:l.shape,color:l.color,size:l.size,mood:l.mood})},l.shape))})}function RT({shown:e}){const t=Ka(),[n,r]=x.useState(!1);x.useEffect(()=>{if(!e)return;const h=setTimeout(()=>r(!0),t?0:1600);return()=>clearTimeout(h)},[e,t]);const l={opacity:e?1:0,transform:e?"none":"translateY(14px)",transition:"opacity 0.6s, transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1)"};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[c.jsx("div",{style:{display:"flex",justifyContent:"flex-end",...l},children:c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-user)",borderRadius:18},children:"Fix the flaky login test"})}),c.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,...l},children:[c.jsx(nn,{shape:"blob",color:"blue",size:28,mood:n?"idle":"working"}),n?c.jsx("span",{style:{...B("subheadline"),color:"var(--text)",padding:"9px 14px",background:"var(--bubble-agent)",borderRadius:18,animation:"bubble-in 0.45s cubic-bezier(0.34, 1.3, 0.64, 1) both",transformOrigin:"bottom left"},children:"Done. It raced the session refresh; tests pass on fix/login."}):c.jsx("span",{style:{...B("subheadline"),color:"var(--tertiary)"},children:"Working…"})]}),c.jsx("style",{children:"@keyframes bubble-in { from { opacity: 0; transform: scale(0.92) } }"})]})}function L3(){const{user:e,isBusy:t}=Ya();return c.jsxs("span",{className:"profile-avatar","aria-hidden":!0,style:{position:"relative",overflow:"hidden"},children:[e?.avatarURL?c.jsx("img",{src:e.avatarURL,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):c.jsx(ae,{name:"person.fill",size:15,weight:"medium",color:"var(--secondary)"}),t?c.jsx("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:c.jsx(et,{size:14})}):null]})}function AT({compact:e,approvals:t,onDismiss:n,onUsage:r,onSettings:l}){const[h,d]=x.useState("main"),{user:p,isBusy:g,errorMessage:m}=Ya(),v=p!==null,_=v?[{title:g?"Please wait…":"Sign out",icon:"rectangle.portrait.and.arrow.right",disabled:g,action:()=>{n(),Zn.signOut()}}]:[{title:"Continue with Apple",icon:"apple.logo",disabled:g,action:()=>{n(),Zn.signIn("apple")}},{title:"Continue with Google",icon:"person.crop.circle.badge.plus",image:iw,disabled:g,action:()=>{n(),Zn.signIn("google")}}],S=b=>{n(),window.codync.app.openExternal(b)},w=h==="support"?[{title:"Support",icon:"chevron.left",action:()=>d("main")},{title:"Help & documentation",icon:"book",chevron:!0,action:()=>S("https://github.com/leepokai/codync#readme")},{title:"Report an issue",icon:"bubble.left",chevron:!0,action:()=>S("https://github.com/leepokai/codync/issues")}]:[{title:"Usage",icon:"gauge.with.dots.needle.33percent",chevron:!0,action:r},{title:"Get Codync for mobile",icon:"iphone",action:()=>S("https://apps.apple.com/app/id6760984418")},{title:"Support",icon:"book.closed",chevron:!0,action:()=>d("support")},{title:"Settings",icon:"gearshape",detail:t>0?String(t):null,action:l},..._];return c.jsx("div",{className:"context-layer",onMouseDown:b=>b.target===b.currentTarget&&n(),children:c.jsxs("div",{className:"account-panel",style:{width:Math.min(260,window.innerWidth-32),left:16,bottom:e?68:64},children:[c.jsx(sw,{items:w,onDismiss:n,after:b=>h==="main"&&b===3?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"panel-divider"}),c.jsxs("div",{className:"panel-identity",children:[c.jsx(ae,{name:"person.crop.circle",size:15}),c.jsx("span",{style:{...B(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p?.email??"Account"}),v?null:c.jsx("span",{style:B(11),children:"Not signed in"})]})]}):h==="support"&&b===0?c.jsx("div",{className:"panel-divider"}):null}),h==="main"&&m?c.jsx("div",{style:{...B(12),color:"var(--warning)",padding:"8px 10px"},children:m}):null]})})}function sw({items:e,onDismiss:t,after:n,dismissOnActivate:r=!1}){const[l,h]=x.useState(0);return x.useEffect(()=>{const d=p=>{if(p.key==="Escape")p.preventDefault(),t();else if(p.key==="ArrowDown"||p.key==="Tab"&&!p.shiftKey)p.preventDefault(),h(g=>(g+1)%e.length);else if(p.key==="ArrowUp"||p.key==="Tab"&&p.shiftKey)p.preventDefault(),h(g=>(g-1+e.length)%e.length);else if(p.key==="Enter"||p.key===" "){p.preventDefault();const g=e[l];g&&!g.disabled&&(r&&t(),g.action())}};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l,t,r]),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:e.map((d,p)=>c.jsxs("div",{children:[c.jsxs("button",{className:`panel-row ${l===p?"highlight":""}`,style:{color:d.destructive?"var(--danger)":"var(--text)"},disabled:d.disabled,onMouseEnter:()=>h(p),onClick:()=>{r&&t(),d.action()},children:[c.jsx("span",{style:{width:20,display:"flex",justifyContent:"center"},children:d.image?c.jsx("img",{src:d.image,alt:"",width:14,height:14}):c.jsx(ae,{name:d.icon,size:14})}),c.jsx("span",{style:{...B(12),flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d.title}),d.detail?c.jsx("span",{style:{...B(13),color:"var(--secondary)"},children:d.detail}):null,d.chevron?c.jsx(ae,{name:"chevron.right",size:11,color:"var(--secondary)"}):null]}),n?.(p)]},d.title))})}function NT({items:e,onDismiss:t,style:n}){const r=e.map(l=>({title:l.title,icon:l.icon??"circle",destructive:l.destructive,action:l.action}));return c.jsx("div",{className:"action-menu",style:n,children:c.jsx(sw,{items:r,onDismiss:t,dismissOnActivate:!0,after:l=>e[l+1]?.divider?c.jsx("div",{className:"panel-divider"}):null})})}const LT=window.codync.platform==="darwin",B3=new Map;function nw(e,t,n,r){const l=`${e}|${Co()}`,h=B3.get(l);if(h)return h;const d=2,p=document.createElement("canvas");p.width=t*d,p.height=n*d;const g=p.getContext("2d");g.scale(d,d),r(g);const m=p.toDataURL("image/png");return B3.set(l,m),m}function BT(e){const t=`bot|${e.id}|${e.avatarShape}|${e.avatarColor}|${e.status}|${e.unread>0}`;return nw(t,20,20,n=>{const r=Co();K2(n,{shape:e.avatarShape,fill:ko(e.avatarColor),size:20,mood:$3(e,!1),dark:r,t:0,still:!0});const l=ln(e)?"#F0A030":e.unread>0?r?"#FFFFFF":"#000000":null;if(l){const h=ln(e)?3.6:2.8;n.beginPath(),n.arc(20-h,20-h,h+1,0,Math.PI*2),n.fillStyle=r?"#1e1e1e":"#f2f2f2",n.fill(),n.beginPath(),n.arc(20-h,20-h,h,0,Math.PI*2),n.fillStyle=l,n.fill()}})}function OT(e,t){const n=Math.round(t.percent);return nw(`bar|${e}|${n}`,60,16,r=>{const l=Co(),h=t.percent>=90?l?"#F0A7A7":"#C23A2B":t.percent>=70?"#F0A030":Yx(e);r.fillStyle=l?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.12)",r.beginPath(),r.roundRect(0,5.5,60,5,2.5),r.fill(),t.percent>0&&(r.fillStyle=h,r.beginPath(),r.roundRect(0,5.5,Math.max(5,60*Math.min(1,t.percent/100)),5,2.5),r.fill())})}function zT(e){const t=ew(e);return`${Jx(e)} · ${Math.round(e.percent)}%${t?` · resets in ${tw(t)}`:""}`}function HT(e){const t=[...e.stores.values()];Y3(t);const[n]=ni(Rt.textSize),[r]=ni(Rt.usageIconStyle);x.useEffect(()=>{const l=setTimeout(()=>{const h=e.local,d=e.roster.filter(v=>!At(v.bot)),p=e.approvals.length?"A device asks for access":e.needsAttention?"A bot needs you":e.working>0?`${e.working} bot${e.working===1?"":"s"} working`:"Connected",g=h?.screen,m={status:p,canPair:!!h,approval:e.approvals[0]?.request.deviceName??null,bots:d.map(v=>({ref:`${v.ref.computerId}/${v.ref.botId}`,name:e.computers.length>1?`${v.bot.name} · ${v.computer.name}`:v.bot.name,detail:ln(v.bot)?"Needs your response":Jn(v.bot)?v.bot.activity||"Working…":v.bot.lastMessage??bo(v.bot),working:Jn(v.bot),avatar:BT(v.bot)})),usage:(h?.usage.providers??[]).map(v=>({name:v.name,icon:yT(v,16,r,Co()),lines:v.windows.map(_=>({title:zT(_),bar:OT(v.id,_)}))})),screen:g?{enabled:g.enabled,subtitle:IT(e),needsLoginItem:e.screenNeedsApproval,needsCapture:g.enabled&&g.connected&&!g.capture,needsInput:g.enabled&&g.connected&&!g.input,error:e.screenError}:null,version:h?.hello?.version??null,needsAttention:e.needsAttention,textSize:n,usageIconStyle:r};window.codync.app.setTraySummary(m)},150);return()=>clearTimeout(l)})}function IT(e){const t=e.local,n=t?.screen;if(!t||!n||!n.enabled)return`Control this ${LT?"Mac":"computer"} from your iPhone`;if(e.screenNeedsApproval)return"Needs approval in System Settings";if(!n.connected)return"Starting Codync Screen…";if(!n.capture||!n.input)return"Needs permission";if(n.viewers>0)return n.viewers===1?"Your iPhone is viewing":`${n.viewers} viewers`;const r=n.agentBot?t.bots.get(n.agentBot):null;if(r)return`${r.name} is using it`;const l=n.displays.find(h=>h.main)?.name??n.displays[0]?.name;return l?`Ready · ${l}`:"Ready"}const V2=window.codync.platform==="darwin";function UT(){const e=ns(),[t,n]=ni(Rt.onboardingDone),[r,l]=x.useState(!1);HT(e),nT(e);const h=e.host.state.kind==="running"||e.computers.length>0;x.useEffect(()=>window.codync.app.onCommand(p=>{switch(p.kind){case"confirmReset":return l(!0);case"reviewApprovals":return e.reviewApprovals();case"setTextSize":return Rt.textSize.set(p.size);case"stepTextSize":return Rt.textSize.set(p.up===null?Ua:YC(Rt.textSize.get(),p.up));case"setUsageIconStyle":return Rt.usageIconStyle.set(p.style);case"openBot":{const g=D_(p.ref);g&&e.select(g);return}case"stopBot":{const g=D_(p.ref);g&&e.store(g.computerId)?.stop(g.botId);return}case"setRemoteScreen":e.setRemoteScreen(p.on);return}}),[e]);const d=e.currentApproval;return c.jsxs("div",{className:"chat-window",children:[t?h?c.jsx(qT,{}):c.jsx(PT,{}):c.jsx(jT,{onContinue:()=>n(!0)}),c.jsx(ts,{open:r,title:"Reset all data?",message:"Signs out every account and deletes this computer's bots, conversations, keys and settings. Codync then starts over from the welcome screen.",actions:[{title:"Reset everything",destructive:!0,action:()=>{window.codync.app.resetAllData()}}],onClose:()=>l(!1)}),c.jsx($t,{open:d!==null,onClose:()=>d&&e.deferApproval(d),children:d?c.jsx(MT,{approval:d},d.id):null})]})}function PT(){const t=ns().host.state;switch(t.kind){case"notInstalled":return c.jsx(Sh,{icon:"desktopcomputer",title:`Set up this ${V2?"Mac":"computer"}`,message:`Codync runs your coding agents through the host, a small background service on this ${V2?"Mac":"computer"}.`,action:["Install host",()=>window.codync.host.install()]});case"missingBinary":return c.jsx(Sh,{icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host is missing",message:"This copy of Codync doesn't include codync-host. Download Codync again from codync.dev or GitHub."});case"failed":return c.jsx(Sh,{icon:"desktopcomputer.trianglebadge.exclamationmark",title:"The host isn't running",message:t.message,action:["Try again",()=>window.codync.host.restart()]});default:return c.jsx(Sh,{icon:"desktopcomputer",title:"Starting the host…",message:"This takes a few seconds."})}}function Sh({icon:e,title:t,message:n,action:r}){return c.jsxs("div",{className:"empty-state",children:[c.jsx(ae,{name:e,size:36,weight:"light",color:"var(--tertiary)"}),c.jsx("div",{style:{...B("title3","semibold"),color:"var(--text)"},children:t}),c.jsx("div",{style:{...B("callout"),color:"var(--secondary)",textAlign:"center",maxWidth:360},children:n}),r?c.jsx(Fe,{onClick:r[1],style:{marginTop:4},children:r[0]}):null]})}function qT(){const e=ns(),[t,n]=ni(Rt.sidebarCompact),[r,l]=ni(Rt.sidebarWidth),[h,d]=ni(Rt.hiddenComputers),[p,g]=x.useState(""),[m,v]=x.useState(!1),[_,S]=x.useState(!1),[w,b]=x.useState(null),k=x.useRef(null),[E,j]=x.useState(!1),[V,A]=x.useState(!1),[z,F]=x.useState(null),[R,I]=x.useState(null),[q,U]=x.useState(null),[Y,$]=x.useState(null),[M,N]=x.useState(null),[L,O]=x.useState(null),[P,te]=x.useState(null),Q=x.useCallback(()=>te("voice"),[]),[ce,re]=x.useState(!1),[de,Ce]=x.useState({width:window.innerWidth,height:window.innerHeight}),je=x.useRef(null),D=x.useRef(null),J=x.useRef(null),le=x.useRef(null);Y3([...e.stores.values()]),x.useEffect(()=>{const oe=()=>{Ce({width:window.innerWidth,height:window.innerHeight}),l(Math.min(Rt.sidebarWidth.get(),Math.max(260,window.innerWidth-420)))};return window.addEventListener("resize",oe),()=>window.removeEventListener("resize",oe)},[l]);const he=Math.max(420,de.height-76),we=e.computers.map(oe=>e.store(oe.id)).filter(oe=>!!oe),xe=new Set(iS(e.computers.map(oe=>oe.id),h).shown),be=we.filter(oe=>xe.has(oe.computer.id)&&oe.connection.kind==="online"&&!oe.mismatch),pe=e.selectedStore,_e=w?e.store(w):null,Re=p.trim().toLowerCase(),fi=e.roster.filter(oe=>xe.has(oe.ref.computerId)&&(t||!Re||oe.bot.name.toLowerCase().includes(Re)||(oe.bot.lastMessage??"").toLowerCase().includes(Re))),pi=(oe=!1)=>{S(oe);const Ze=[pe,e.local].find(ti=>ti&&be.includes(ti))??be[0];Ze&&(m||(k.current=e.selection),b(Ze.computer.id),e.select(null),v(!0))};x.useEffect(()=>{e.selection&&v(!1)},[e.selection]),x.useEffect(()=>window.codync.app.onCommand(oe=>{oe.kind==="newChat"&&be.length&&pi(),oe.kind==="search"&&(n(!1),setTimeout(()=>je.current?.focus(),0)),oe.kind==="toggleSidebar"&&n(!Rt.sidebarCompact.get())}));const Bt=x.useRef(!1);x.useEffect(()=>{const oe=window.codync.debugOpen;if(!(!oe||Bt.current))if(oe==="compose"||oe==="group"){if(!be.length)return;Bt.current=!0,pi(oe==="group")}else if(oe==="plugins"){if(!e.local)return;Bt.current=!0,O(e.local.computer.id)}else if(oe==="computers")Bt.current=!0,te("computers");else{const Ze=e.roster.find(ti=>ti.bot.name===oe);if(!Ze)return;Bt.current=!0,e.select(Ze.ref)}});const pt=()=>[{title:"New chat",icon:"square.and.pencil",action:()=>pi()},{title:"New group chat",icon:"person.2",action:()=>pi(!0)}],$e=()=>O((pe??e.local??be[0])?.computer.id??null),gi=(oe,Ze)=>[{title:oe.pinned?"Unpin":"Pin",icon:"pin",action:()=>Ze.setPinned(oe,!oe.pinned)},{title:"Mark as Read",icon:"bell.badge",action:()=>Ze.markAllRead(oe.id)},{title:"Edit Profile…",icon:"square.and.pencil",divider:!0,action:()=>U({id:crypto.randomUUID(),draft:yo(oe),store:Ze})},{title:"Copy conversation ID",icon:"square.on.square",divider:!0,action:()=>window.codync.app.copy(oe.id)},{title:"New session",icon:"arrow.counterclockwise",action:()=>N({bot:oe,store:Ze})},{title:"Hide from sidebar",icon:"eye.slash",divider:!0,action:()=>Ze.setHidden(oe,!0)},{title:"Delete",icon:"trash",destructive:!0,action:()=>$({bot:oe,store:Ze})}],ge=oe=>{if(oe.key!=="ArrowUp"&&oe.key!=="ArrowDown")return;const Ze=fi.map(ir=>ir.ref);if(!Ze.length)return;oe.preventDefault();const ti=Ze.findIndex(ir=>R_(ir,e.selection)),ls=oe.key==="ArrowDown"?Math.min(ti+1,Ze.length-1):Math.max(ti-1,0);e.select(Ze[ls])},Ke=x.useRef(null),ki=oe=>{oe.target.setPointerCapture(oe.pointerId),Ke.current={x:oe.clientX,width:t?76:r}},Ur=oe=>{if(!Ke.current)return;const Ze=Ke.current.width+oe.clientX-Ke.current.x,ti=Ze<180;ti!==t&&n(ti),ti||l(Math.min(Math.max(260,Ze),Math.min(420,window.innerWidth-420)))},Bs=e.errorMessage,Pr=we.filter(oe=>xe.has(oe.computer.id)&&oe.mismatch),rs=e.selection,Qa=rs&&pe?.bots.get(rs.botId);let tr;m&&_e?tr=c.jsxs("div",{className:"detail-column",children:[be.length>1?c.jsx($T,{stores:be,value:_e.computer.id,onChange:b}):null,c.jsx(en.Provider,{value:_e,children:c.jsx(ak,{group:_,onClose:()=>{v(!1),e.selection||e.select(k.current)}})})]},`${_e.computer.id}-${_}`):rs&&pe&&Qa?tr=c.jsx(en.Provider,{value:pe,children:c.jsx(J9,{botId:rs.botId},T_(rs))}):tr=c.jsxs("div",{className:"empty-detail",children:[c.jsxs("div",{style:{display:"flex"},children:[c.jsx(nn,{shape:"blob",color:"blue",size:60,mood:"working"}),c.jsx(nn,{shape:"squircle",color:"orange",size:60,style:{marginLeft:-10}}),c.jsx(nn,{shape:"teardrop",color:"violet",size:60,mood:"working",style:{marginLeft:-10}})]}),c.jsx("div",{style:B("title2","semibold"),children:"Your coding agents, as teammates."}),c.jsx("div",{style:{color:"var(--secondary)",textAlign:"center",maxWidth:420},children:"Pick a bot, or create one for each kind of work and point it at a project."}),c.jsx(Fe,{onClick:()=>pi(),disabled:!be.length,children:"New Bot"})]});const as=t?76:r;return c.jsxs("div",{className:"split",style:{pointerEvents:ce||R?"none":void 0},children:[c.jsxs("aside",{className:`sidebar ${t?"compact":""}`,style:{width:as},children:[c.jsxs("div",{className:"sidebar-header drag",style:{paddingLeft:t?0:V2?80:18,opacity:t?0:1,pointerEvents:t?"none":void 0},"aria-hidden":t,children:[c.jsx("span",{style:{flex:1}}),c.jsxs("div",{className:"no-drag",style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx(O_,{hidden:h,setHidden:d,manage:()=>te("computers")}),c.jsx(ke,{title:"New",icon:"plus",buttonRef:D,onClick:()=>j(oe=>!oe),disabled:!be.length})]}),c.jsx(Pa,{open:E,onClose:()=>j(!1),anchor:D,items:pt})]}),t?c.jsx("div",{style:{width:70,alignSelf:"center"},className:"drag",children:c.jsx("div",{className:"no-drag",style:{display:"flex",justifyContent:"center"},children:c.jsx(O_,{hidden:h,setHidden:d,manage:()=>te("computers"),compact:!0})})}):null,t?null:c.jsxs("div",{className:"search",children:[c.jsx(ae,{name:"magnifyingglass",size:13,color:"var(--secondary)"}),c.jsx("input",{ref:je,value:p,placeholder:"Search","aria-label":"Search bots",spellCheck:!1,onChange:oe=>g(oe.target.value),onKeyDown:oe=>{oe.key==="Escape"&&(g(""),je.current?.blur())}}),p?c.jsx("button",{className:"search-clear","aria-label":"Clear search",title:"Clear search",onClick:()=>g(""),children:c.jsx(ae,{name:"xmark.circle.fill",size:13,color:"var(--secondary)"})}):null]}),c.jsxs("div",{className:"roster",ref:le,tabIndex:0,onKeyDown:ge,children:[t?null:Pr.map(oe=>c.jsx("div",{style:{paddingBottom:8},children:c.jsx(en.Provider,{value:oe,children:c.jsx(J2,{})})},oe.computer.id)),fi.map(oe=>{const Ze=T_(oe.ref),ti=R_(oe.ref,rs);return c.jsx("button",{className:"roster-row",style:{padding:t?0:"0 8px",background:ti?"var(--bubble-user)":z===Ze?"var(--bubble-agent)":"transparent"},"aria-label":we.length>1?`${oe.bot.name}, on ${oe.store.hostName}`:oe.bot.name,"aria-selected":ti,title:we.length>1?`${oe.bot.name} · ${oe.store.hostName}`:oe.bot.name,onMouseEnter:()=>F(Ze),onMouseLeave:()=>F(ls=>ls===Ze?null:ls),onClick:()=>e.select(oe.ref),onContextMenu:ls=>{ls.preventDefault(),I({target:{bot:oe.bot,store:oe.store},x:ls.clientX,y:ls.clientY})},children:c.jsx(m8,{bot:oe.bot,store:oe.store,compact:t,usingComputer:oe.store.screen?.agentBot===oe.bot.id,members:At(oe.bot)?oe.store.members(oe.bot):VT})},Ze)}),fi.length===0&&!t&&Pr.length===0?c.jsxs("div",{className:"roster-empty",children:[c.jsx("div",{style:B(13,"medium"),children:p?"No matching bots":"No bots yet"}),c.jsx("div",{style:{...B(12),color:"var(--secondary)"},children:p?"Try another name or message.":"Use + to start a new chat."})]}):null]}),t?c.jsxs("div",{className:"rail-actions",children:[c.jsx(ke,{title:"New",icon:"plus",size:36,buttonRef:J,disabled:!be.length,onClick:()=>A(oe=>!oe)}),c.jsx(Pa,{open:V,onClose:()=>A(!1),anchor:J,items:pt}),c.jsx(ke,{title:"Marketplace",icon:"square.grid.2x2",size:36,onClick:$e}),c.jsx("button",{className:"rail-profile",style:{background:ce?"var(--bubble-agent)":void 0},"aria-label":"Open account menu for Account",title:"Account",onClick:()=>re(oe=>!oe),children:c.jsx(L3,{})})]}):c.jsxs("div",{className:"sidebar-footer",children:[c.jsxs("button",{className:"footer-row",onClick:$e,children:[c.jsx("span",{className:"footer-icon",children:c.jsx(ae,{name:"square.grid.2x2",size:14})}),c.jsx("span",{children:"Marketplace"})]}),c.jsxs("button",{className:`footer-row account ${ce?"active":""}`,"aria-label":"Open account menu for Account",title:"Account menu",onClick:()=>re(oe=>!oe),children:[c.jsx(L3,{}),c.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Account"})]})]})]}),c.jsx("div",{className:"sidebar-divider",onPointerDown:ki,onPointerMove:Ur,onPointerUp:()=>Ke.current=null,role:"separator","aria-label":"Resize sidebar","aria-valuenow":as}),c.jsx("main",{className:"detail",children:c.jsx(XS.Provider,{value:Q,children:tr})}),ce?c.jsx(AT,{compact:t,approvals:e.approvals.length,onDismiss:()=>re(!1),onUsage:()=>{re(!1),te("usage")},onSettings:()=>{re(!1),te("general")}}):null,R?c.jsx("div",{className:"context-layer",onMouseDown:oe=>oe.target===oe.currentTarget&&I(null),children:c.jsx(NT,{items:gi(R.target.bot,R.target.store),onDismiss:()=>I(null),style:{left:Math.min(Math.max(8,R.x),de.width-268),top:Math.min(Math.max(8,R.y),Math.max(8,de.height-344))}})}):null,c.jsx($t,{open:q!==null,onClose:()=>U(null),width:520,height:Math.min(680,he),children:q?c.jsx(en.Provider,{value:q.store,children:c.jsx(Z7,{draft:q.draft},q.id)}):null}),c.jsx($t,{open:L!==null,onClose:()=>O(null),width:Math.min(920,de.width-80),height:he,children:L&&e.store(L)?c.jsx(en.Provider,{value:e.store(L),children:c.jsx(Tj,{computers:be.map(oe=>({id:oe.computer.id,name:oe.hostName})),computer:L,onComputer:O},L)}):null}),c.jsx($t,{open:P!==null,onClose:()=>te(null),width:Math.min(800,de.width-80),height:Math.min(620,he),children:P?c.jsx(wT,{page:P}):null}),c.jsx(ts,{open:M!==null,title:"Start a new session?",message:"The conversation stays here, but the agent starts with a fresh context.",actions:M?[{title:"New session",action:()=>M.store.newSession(M.bot.id)}]:[],onClose:()=>N(null)}),c.jsx(ts,{open:Y!==null,title:`Delete ${Y?.bot.name??"bot"}?`,message:"Files it changed on your computer stay as they are.",actions:Y?[{title:"Delete bot and its conversation",destructive:!0,action:()=>Y.store.delete(Y.bot)}]:[],onClose:()=>$(null)}),c.jsx(ts,{open:Bs!==null,title:"Something went wrong",message:Bs,actions:[],cancel:"OK",onClose:()=>e.clearErrors()})]})}const VT=[];function $T({stores:e,value:t,onChange:n}){const r=x.useMemo(()=>e.map(l=>({id:l.computer.id,label:l.hostName})),[e]);return c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 22px 0",...B("callout")},children:[c.jsx("span",{style:{color:"var(--secondary)"},children:"On"}),c.jsx(Ci,{selection:t,options:r,onChange:n})]})}function WT(){const t=ns().host.local,[n,r]=x.useState(null),[l,h]=x.useState(null),[d,p]=x.useState(null),[g,m]=x.useState("this computer"),[v,_]=x.useState(null),S=x.useCallback(async()=>{if(!t)return _("This computer's host isn't connected.");const w=new Z2(t.baseURL,t.token);try{const[b,k,E]=await Promise.all([w.call("pairing",{},2e4),w.call("cloudStatus",{},2e4).catch(()=>null),w.call("hello",{},2e4).catch(()=>null)]);r(b),p(k),E?.name&&m(E.name),h(await Kx.toDataURL(b.pairingUrl,{errorCorrectionLevel:"M",margin:0,width:400,color:{dark:"#000000",light:"#ffffff"}})),_(null)}catch(b){_(b instanceof Error?b.message:String(b))}},[t]);return x.useEffect(()=>(S(),window.codync.app.onCommand(w=>w.kind==="reviewApprovals"&&void S())),[S]),x.useEffect(()=>{if(!n?.expiresAt)return;const w=setTimeout(()=>{S()},Math.max(1e3,n.expiresAt-Date.now()));return()=>clearTimeout(w)},[n?.expiresAt,S]),c.jsx("div",{style:{width:340,padding:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:n&&l?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{padding:10,background:"#fff",borderRadius:12},children:c.jsx("img",{src:l,alt:`Pairing code for ${g}`,width:200,height:200,style:{display:"block",imageRendering:"pixelated"}})}),c.jsx("div",{style:{...B("caption"),color:"var(--secondary)",textAlign:"center"},children:"Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else."}),d?.enabled!==!0?c.jsx("div",{style:{...B("caption"),color:"var(--warning)",textAlign:"center"},children:n.urls.length===0?"No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on.":`“Reach from anywhere” is off, so the iPhone only reaches ${g} on the same network.`}):null,c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[n.expiresAt?c.jsxs("span",{style:{...B("caption2"),color:"var(--tertiary)"},children:["Works once, until ",new Date(n.expiresAt).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})]}):null,c.jsx(ke,{title:"New code",icon:"arrow.clockwise",onClick:()=>{S()}}),c.jsx(ke,{title:"Copy pairing link",icon:"doc.on.doc",onClick:()=>window.codync.app.copy(n.pairingUrl)})]})]}):v?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{...B("caption"),color:"var(--danger)",textAlign:"center"},children:v}),c.jsx(ke,{title:"Try again",icon:"arrow.clockwise",onClick:()=>{S()}})]}):c.jsx(et,{size:20})})}const C1=new URLSearchParams(location.search).get("window")??"chat";document.documentElement.dataset.platform=window.codync.platform;G3(Rt.textSize.get());const rw=new h8(C1!=="pairing");rw.start();C1!=="pairing"&&Zn.start();Cb.createRoot(document.getElementById("root")).render(c.jsx(Z3.Provider,{value:rw,children:C1==="pairing"?c.jsx(WT,{}):c.jsx(UT,{})}));
diff --git a/web/public/demo/desktop/assets/index-DLwuTq6o.css b/web/public/demo/desktop/assets/index-DLwuTq6o.css
deleted file mode 100644
index 7033a7ee..00000000
--- a/web/public/demo/desktop/assets/index-DLwuTq6o.css
+++ /dev/null
@@ -1 +0,0 @@
-:root{color-scheme:light dark;--background: #ffffff;--surface: #f4f4f4;--bubble-agent: #f0f0f0;--bubble-user: #e2e2e2;--border: #e6e6e6;--text: #141414;--text-rgb: 20, 20, 20;--secondary: #6b6b6b;--tertiary: #9b9b9b;--accent-fill: #000000;--accent: #000000;--on-accent: #ffffff;--accent-dim: #d9d9d9;--danger: #c23a2b;--warning: #f0a030;--code-background: #f4f4f4;--added: #2e7d32;--removed: #c62828;--panel: #fafafa;--chat-agent: #eeeeee;--chat-user: #e2e2e2;--chat-button: #eeeeee;--frosted: rgba(244, 244, 244, .82);--scale: 1;--conversation: 12px;--md-scale: var(--scale);--ease: cubic-bezier(.25, .1, .25, 1);--hover: .12s var(--ease);--fade: .12s var(--ease);--press: .05s var(--ease);--morph: .2s cubic-bezier(.22, 1, .36, 1);--spring: linear(0, .0712, .2244, .3992, .5638, .7018, .8077, .8834, .9342, .9663, .9853, .9958, 1.0009, 1.0028, 1.0029, 1);--layout: .3s var(--spring);--conversation-motion: .42s var(--spring);--font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;--mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace}@media all{:root{--background: #0a0a0a;--surface: #141414;--bubble-agent: #1c1c1c;--bubble-user: #3a3a3a;--border: #262626;--text: #f2f2f2;--text-rgb: 242, 242, 242;--secondary: #9a9a9a;--tertiary: #6e6e6e;--accent-fill: #ffffff;--accent: #ffffff;--on-accent: #000000;--accent-dim: #333333;--danger: #f0a7a7;--code-background: #111111;--added: #8fd18b;--removed: #f0a7a7;--panel: #1b1b1b;--chat-agent: #262626;--chat-user: #545454;--chat-button: #303030;--frosted: rgba(35, 35, 35, .82)}}@media(prefers-reduced-motion:reduce){:root{--hover: 0s;--fade: 0s;--press: 0s;--morph: 0s;--layout: 0s;--conversation-motion: 0s}}*,*:before,*:after{box-sizing:border-box}html,body,#root{margin:0;height:100%;overflow:hidden}body{background:var(--background);color:var(--text);font-family:var(--font);font-size:calc(13px * var(--scale));line-height:normal;-webkit-font-smoothing:antialiased;-webkit-user-select:none;user-select:none;cursor:default}::-webkit-scrollbar{display:none}*{scrollbar-width:none}button{font:inherit;color:inherit;background:none;border:none;padding:0;margin:0;cursor:default;text-align:inherit}button:focus-visible{outline:none}button:disabled{cursor:default}input,textarea{font:inherit;color:inherit;background:transparent;border:none;outline:none;padding:0;margin:0;resize:none}input::placeholder,textarea::placeholder{color:var(--tertiary)}.selectable{-webkit-user-select:text;user-select:text;cursor:text}::selection{background:rgba(var(--text-rgb),.2)}a{color:inherit}.press{transition:transform var(--press)}.press:active:not(:disabled){transform:scale(.98)}.drag{-webkit-app-region:drag}.no-drag{-webkit-app-region:no-drag}.modal-card{position:fixed;inset:0;z-index:100;display:grid;place-items:center}.modal-dim{position:absolute;inset:0;background:#0006;opacity:0;transition:opacity var(--layout)}.modal-content{position:relative;background:var(--background);border-radius:20px;overflow:hidden;box-shadow:0 12px 60px #0000004d;opacity:0;transform:scale(.96);transition:opacity var(--layout),transform var(--layout);display:flex;flex-direction:column}.modal-card.shown .modal-dim{opacity:1}.modal-card.shown .modal-content{opacity:1;transform:none}.modal-header{display:flex;align-items:center;gap:8px;height:48px;padding:0 10px 0 16px;flex:none}.dialog{position:fixed;inset:0;z-index:200;display:grid;place-items:center;opacity:0;transform:scale(.98);transition:opacity var(--fade),transform var(--fade)}.dialog.shown{opacity:1;transform:none}.dialog-dim{position:absolute;inset:0;background:#00000059}.dialog-card{position:relative;width:min(320px,calc(100vw - 48px));padding:18px;background:var(--bubble-agent);border-radius:22px;box-shadow:0 10px 48px #00000040;display:flex;flex-direction:column;gap:14px}.dialog-text{display:flex;flex-direction:column;gap:6px;text-align:center;color:var(--text)}.dialog-buttons{display:flex;flex-direction:column;gap:8px}.dialog-button{font-size:calc(12px * var(--scale));font-weight:500;text-align:center;padding:8px 0;border-radius:999px;background:var(--bubble-user);color:var(--text);transition:transform var(--press),opacity var(--press)}.dialog-button.prominent{background:var(--accent-fill);color:var(--on-accent)}.dialog-button.destructive{background:var(--danger);color:#fff}.dialog-button:active{transform:scale(.98);opacity:.85}.anchored{position:fixed;inset:0;z-index:300;opacity:0;transition:opacity var(--fade)}.anchored.shown{opacity:1}.anchored-panel{background:var(--bubble-agent);border-radius:14px;box-shadow:0 8px 40px #00000040;overflow:hidden;transform:scale(.98);transition:transform var(--layout)}.anchored.shown .anchored-panel{transform:none}.menu-panel{padding:6px;display:flex;flex-direction:column;gap:2px;overflow-y:auto}.menu-divider{height:.5px;background:rgba(var(--text-rgb),.1);margin:4px 10px}.menu-row{display:flex;align-items:center;gap:10px;width:100%;padding:6px 10px;border-radius:8px;font-size:calc(12px * var(--scale));color:var(--text);transition:background-color var(--hover)}.menu-row.destructive{color:var(--danger)}.menu-row.highlight{background:rgba(var(--text-rgb),.07)}.menu-icon{width:18px;display:flex;justify-content:center;flex:none}.menu-title{flex:1;margin-right:16px}.reaction-button{display:grid;place-items:center;transition:background-color var(--hover),transform var(--press)}.reaction-button span{transition:transform var(--hover)}.reaction-button:hover{background:rgba(var(--text-rgb),.06)}.reaction-button:hover span{transform:scale(1.15)}.reaction-button:active span{transform:scale(.85)}.reaction-button.chosen{background:rgba(var(--text-rgb),.12)}.icon-button{display:grid;place-items:center;color:var(--secondary);flex:none;transition:background-color var(--hover),color var(--hover),transform var(--press)}.icon-button:hover:not(:disabled){color:var(--text);background:rgba(var(--text-rgb),.08)}.icon-button:active:not(:disabled){background:rgba(var(--text-rgb),.14);transform:scale(.98)}.icon-button.selected{background:var(--accent-fill);color:var(--on-accent)}.icon-button:disabled{opacity:.35}html[data-platform=darwin] .modal-card,html[data-platform=darwin] .dialog{padding-top:28px}.styled-button{font-size:calc(12px * var(--scale));font-weight:500;padding:6px 12px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:transform var(--press),opacity var(--press)}.styled-button.primary{background:var(--accent-fill);color:var(--on-accent)}.styled-button.secondary{background:var(--bubble-user);color:var(--text)}.styled-button:active:not(:disabled){transform:scale(.98);opacity:.85}.styled-button:disabled{opacity:.4}.spinner{animation:spin .8s linear infinite;flex:none}@keyframes spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation:none}}.switch{display:flex;align-items:center;gap:12px;width:100%}.switch:disabled{opacity:.4}.switch-label{flex:1;min-width:0}.switch-track{position:relative;width:34px;height:20px;border-radius:999px;background:var(--bubble-user);flex:none;transition:background-color var(--hover)}.switch-track.on{background:var(--accent-fill)}.switch-knob{position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform var(--hover),background-color var(--hover)}.switch-track.on .switch-knob{transform:translate(14px);background:var(--on-accent)}.choice-picker{display:inline-flex;align-items:center;gap:6px;font-size:calc(12px * var(--scale));color:var(--text);padding:5px 9px;border-radius:10px;max-width:100%}.choice-picker.outlined{box-shadow:inset 0 0 0 1px var(--border)}.choice-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.segmented{position:relative;display:flex;gap:2px;padding:3px;background:var(--bubble-user);border-radius:999px}.segmented-thumb{position:absolute;top:3px;bottom:3px;left:3px;border-radius:999px;background:var(--background);transition:transform var(--morph)}.segmented-option{position:relative;flex:1;text-align:center;font-size:calc(11px * var(--scale));font-weight:500;color:var(--secondary);padding:5px 0;white-space:nowrap}.segmented-option.on{color:var(--text)}.choice-row{display:flex;align-items:center;gap:10px;width:100%}.card-form{height:100%;overflow-y:auto;background:var(--background)}.card-form-content{display:flex;flex-direction:column;gap:28px;padding:14px;font-size:calc(12px * var(--scale))}.card-section{display:flex;flex-direction:column;gap:10px;width:100%}.card-section-title{display:flex;align-items:center;gap:8px;padding-left:2px}.card-section-rows{background:var(--surface);border-radius:16px;display:flex;flex-direction:column}.card-row{min-height:52px;padding:12px 16px;display:flex;align-items:center}.card-row>*{flex:1;min-width:0}.card-section-footer{font-size:calc(10px * var(--scale));color:var(--secondary);line-height:1.4;padding:0 2px}.hairline{height:1px;background:var(--border);flex:none}@media(min-resolution:2dppx){.hairline{height:.5px}}.hairline.inset{margin:0 16px}.value-row{display:flex;align-items:center;width:100%}.search-field{display:flex;align-items:center;gap:8px;padding:7px 10px;background:var(--bubble-agent);border-radius:999px;font-size:calc(12px * var(--scale))}.search-field input{flex:1;min-width:0}.disclosure-label{display:flex;align-items:center;gap:6px;width:100%}.pill{display:inline-flex;align-items:center;padding:5px 9px;border-radius:10px}.market-page{position:relative;height:100%;background:var(--background)}.market-scroll{height:100%;overflow-y:auto}.market-page-content{display:flex;flex-direction:column;gap:28px;padding:20px 44px;max-width:980px;margin:0 auto}.market-close{position:absolute;top:8px;right:8px}.market-stack{position:relative;height:100%;overflow:hidden;background:var(--background)}.market-layer{position:absolute;inset:0;display:flex;flex-direction:column;transition:transform var(--layout),opacity var(--layout)}.market-layer.off-leading{transform:translate(-100%);opacity:0;pointer-events:none}.market-layer.off-trailing{transform:translate(100%);opacity:0;pointer-events:none}.market-search{display:flex;align-items:center;gap:10px;padding:0 14px;height:38px;background:var(--bubble-agent);border-radius:999px}.market-search input{flex:1;min-width:0}.market-section{display:flex;flex-direction:column;gap:12px}.agent-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}.item-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));column-gap:10px;row-gap:4px}.agent-card{display:flex;flex-direction:column;align-items:center;gap:12px;padding:18px 10px;border-radius:18px;min-width:0;background:color-mix(in srgb,var(--bubble-agent) 45%,transparent);transition:background-color var(--hover),transform var(--press)}.agent-card:hover{background:color-mix(in srgb,var(--bubble-agent) 80%,transparent)}.agent-card:active{transform:scale(.98)}.market-row{display:flex;align-items:center;gap:14px;padding:10px 12px;border-radius:16px;min-width:0;transition:background-color var(--hover)}.market-row:hover{background:color-mix(in srgb,var(--bubble-agent) 60%,transparent)}.capsule-action{font-weight:600;color:var(--text);padding:7px 16px;background:var(--bubble-agent);border-radius:999px;white-space:nowrap;flex:none;transition:transform var(--press),opacity var(--press)}.capsule-action:active:not(:disabled){transform:scale(.98);opacity:.85}.skeleton{animation:market-pulse .9s ease-in-out infinite alternate}@keyframes market-pulse{to{opacity:.5}}@media(prefers-reduced-motion:reduce){.skeleton{animation:none}}.plain-link{color:var(--text);text-decoration:underline;text-align:left}.option-row{display:flex;align-items:center;gap:12px;width:100%}.option-row:disabled{opacity:.5}.plain-row-button{display:flex;align-items:center;width:100%}.market-field{width:100%;display:block}textarea.market-field{field-sizing:content}.setup-terminal{flex:1;min-height:0;padding:6px 10px 0}.setup-terminal .xterm{height:100%}.setup-terminal .xterm-viewport{background:transparent!important}.fade-in{animation:market-fade-in var(--fade) both}@keyframes market-fade-in{0%{opacity:0}}.field-box{display:block;width:100%;padding:8px 10px;background:var(--background);border-radius:12px;color:var(--text);-webkit-user-select:text;user-select:text;cursor:text}textarea.field-box{line-height:1.3}.bot-form{height:100%;overflow-y:auto;background:var(--background)}.bot-form-content{display:flex;flex-direction:column;gap:24px;padding:14px;font-size:calc(12px * var(--scale))}.avatar-button{padding:12px;background:var(--bubble-agent);border-radius:20px;display:flex}.swatch{padding:4px;border-radius:50%;flex:none;display:flex;box-shadow:inset 0 0 0 2px transparent;transition:box-shadow var(--hover)}.swatch.on{box-shadow:inset 0 0 0 2px var(--accent)}.swatch-row{display:flex;gap:10px;padding:4px;overflow-x:auto}.bot-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 6px 5px 8px;background:var(--bubble-agent);border-radius:999px;flex:none;animation:chip-in var(--layout) both}@keyframes chip-in{0%{opacity:0;transform:scale(.85)}}.chip-row{display:flex;align-items:center;gap:6px;overflow-x:auto;min-width:0}.pick-row{display:flex;align-items:center;gap:12px;width:100%;padding:8px 12px;border-radius:12px;transition:background-color var(--hover),transform var(--press)}.pick-row.hover:hover{background:var(--bubble-agent)}.key-cap{min-width:18px;min-height:18px;display:grid;place-items:center;border-radius:4px;background:var(--background);color:var(--secondary);font-family:var(--mono);font-size:calc(10px * var(--scale))}.compose-list{max-height:460px;overflow-y:auto;background:var(--surface);border-radius:18px;box-shadow:0 6px 32px #00000014;max-width:620px;margin:10px 22px 0;padding:8px;display:flex;flex-direction:column;gap:2px}.compose-box{display:flex;align-items:flex-end;margin:16px;padding:6px 6px 6px 18px;background:var(--bubble-user);border-radius:24px;box-shadow:0 2px 20px #0000000f}.compose-box textarea{flex:1;min-width:0;font-size:var(--conversation);line-height:round(up,calc(var(--conversation) * 1.25),1px);padding:11px 0;-webkit-user-select:text;user-select:text;cursor:text}.level-slide{animation:level-in var(--layout) both}.level-slide.from-trailing{--from: 40px}.level-slide.from-leading{--from: -40px}@keyframes level-in{0%{opacity:0;transform:translate(var(--from))}}.fade-in{animation:fade-in var(--fade) both}@keyframes fade-in{0%{opacity:0}}.routine-input{width:100%;padding:12px;border:none;outline:none;border-radius:12px;background:var(--bubble-user);color:var(--text);font:inherit;-webkit-user-select:text;user-select:text;resize:none}.routine-input::placeholder{color:var(--secondary)}textarea.routine-input{field-sizing:content;min-height:calc(3lh + 24px);max-height:calc(8lh + 24px)}.routine-form{border:none;margin:0;padding:0;min-width:0}.routine-form:disabled{opacity:.6}.routine-cron{container-type:inline-size}.routine-cron-fields{display:flex;align-items:flex-start;gap:10px}.routine-cron-fields>:first-child{flex:1;min-width:220px}.routine-cron-fields>:last-child{width:170px;flex:none}@container (max-width: 400px){.routine-cron-fields{flex-direction:column;align-items:stretch;gap:14px}.routine-cron-fields>:first-child,.routine-cron-fields>:last-child{width:auto;min-width:0}}.routine-row{display:flex;flex-direction:column;gap:3px;padding:10px 0;flex:1;min-width:0;text-align:left}.routine-fade{animation:routine-fade var(--hover) both}@keyframes routine-fade{0%{opacity:0}}.settings{display:flex;height:100%;background:var(--background);position:relative}.settings-sidebar{width:200px;flex:none;display:flex;flex-direction:column;gap:2px;padding:30px 10px 10px}.settings-group{font-size:calc(12px * var(--scale));font-weight:500;color:var(--tertiary);padding:0 10px 4px}.settings-item{display:flex;align-items:center;gap:10px;height:32px;padding:0 10px;border-radius:10px;font-size:calc(13px * var(--scale));color:var(--text);transition:background-color var(--hover)}.settings-item.selected{background:rgba(var(--text-rgb),.08)}.settings-divider{width:1px;flex:none;background:var(--border)}.settings-main{flex:1;min-width:0;display:flex;flex-direction:column}.settings-page{flex:1;min-height:0;padding:0 18px;animation:settings-fade var(--fade) both}.settings-close{position:absolute;top:14px;right:14px}@keyframes settings-fade{0%{opacity:0}}.settings-card{padding:16px;width:100%;background:var(--surface);border-radius:16px;margin-bottom:8px;display:flex;flex-direction:column;gap:8px}.settings-section-header{display:flex;align-items:center;min-height:24px;padding:0 0 10px 2px}.settings-row{display:flex;align-items:center;gap:10px;width:100%}.settings-stack{display:flex;flex-direction:column;gap:1px;min-width:0}.settings-field{flex:1;min-width:0;text-align:right}.settings-code{font-family:var(--mono);font-size:calc(10px * var(--scale));padding:6px;flex:1;min-width:0;background:var(--code-background);border-radius:6px}.settings-appear{animation:settings-fade var(--layout) both}.settings-reveal{display:grid;grid-template-rows:0fr;opacity:0;transform:translateY(-4px);transition:grid-template-rows var(--layout),opacity var(--layout),transform var(--layout)}.settings-reveal.shown{grid-template-rows:1fr;opacity:1;transform:none}.settings-reveal>div{min-height:0;overflow:hidden}.call{-webkit-app-region:no-drag;display:flex;flex-direction:column;align-items:center;gap:6px;padding:0 12px;max-width:100%}.call-bar{display:flex;align-items:center;gap:10px;padding:10px 10px 10px 18px;border-radius:999px;background:var(--frosted);backdrop-filter:blur(24px) saturate(1.8);-webkit-backdrop-filter:blur(24px) saturate(1.8);box-shadow:0 8px 40px #00000040}.call-avatar{display:flex;transition:transform var(--layout)}.call-avatar.speaking{animation:call-pulse .6s ease-in-out infinite alternate}@keyframes call-pulse{to{transform:scale(1.1)}}.call-round{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;flex:none;background:var(--bubble-user);color:var(--secondary);transition:background-color var(--hover),color var(--hover),transform var(--press)}.call-round.on{background:var(--accent-fill);color:var(--on-accent)}.call-round.end{background:var(--danger);color:#fff}.call-round:active{transform:scale(.98)}.call-line{font-size:calc(10px * var(--scale));text-align:center;padding:8px 12px;border-radius:999px;background:var(--bubble-user);box-shadow:0 2px 20px #0000000f;animation:call-line-in var(--fade) both}@keyframes call-line-in{0%{opacity:0}}@media(prefers-reduced-motion:reduce){.call-avatar.speaking{animation:none}}.thread-view{display:flex;height:100%;overflow:hidden}.conversation{--conversation: var(--chat);--md-scale: var(--chat-scale);flex:1;min-width:0;height:100%;position:relative;display:flex;flex-direction:column;background:var(--background)}.top-chrome{position:absolute;top:0;left:0;right:0;z-index:5;padding:10px 16px 14px;display:grid;place-items:center;pointer-events:none;-webkit-app-region:drag}.top-chrome>*{grid-area:1 / 1}.top-chrome-row{display:flex;width:100%;align-items:center;gap:8px}.top-chrome-row>*,.title-pill{pointer-events:auto;-webkit-app-region:no-drag}.top-fade{grid-area:auto!important;position:absolute;inset:0 0 -24px;pointer-events:none;background:linear-gradient(to bottom,var(--background) 0%,color-mix(in srgb,var(--background) 60%,transparent) 35%,transparent 100%)}.top-fade:before{content:"";position:absolute;inset:0;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);-webkit-mask-image:linear-gradient(to bottom,#000,transparent 50%);mask-image:linear-gradient(to bottom,#000,transparent 50%)}.title-pill{position:relative;display:flex;flex-direction:column;align-items:center;gap:2px;padding:9px 16px 9px 10px;background:var(--surface);border-radius:999px;box-shadow:0 4px 32px #0000001f;max-width:60%}.title-pill{transition:opacity var(--layout),transform var(--layout)}.title-pill.hidden-by-call{opacity:0;transform:translateY(-8px)}.frosted-circle{border-radius:50%;background:var(--frosted);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);display:flex}.frosted-circle .icon-button{border-radius:50%!important}.round-button{width:32px;height:32px;border-radius:50%;background:var(--frosted);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);display:grid;place-items:center;flex:none}.transcript-frame{position:absolute;inset:0}.transcript{height:100%;overflow-y:auto;overflow-anchor:none}.transcript-content{container-type:inline-size;max-width:820px;margin:0 auto;padding:72px 16px var(--composer-height, 70px)}.load-earlier{display:block;width:100%;text-align:center;padding:12px 0;font-size:calc(10px * var(--scale));color:var(--secondary)}.intro-card{display:flex;flex-direction:column;align-items:center;gap:12px;padding:0 24px;text-align:center}.composer-dock{flex:none}.message{display:flex;flex-direction:column;width:100%}.message.user{align-items:flex-end;padding-left:56px}.message.agent{align-items:flex-start}.message-body{position:relative;display:flex;flex-direction:column;gap:4px;min-width:0;max-width:100%}.message.user .message-body{align-items:flex-end;margin-left:88px;max-width:calc(100% - 88px)}.message.agent .message-body{align-items:flex-start;max-width:max(80px,min((100cqw + 32px) * .8 - 32px,100cqw - 88px));margin-right:88px}.bubble{padding:8px 12px;border-radius:22px;max-width:100%;min-width:0}.bubble.user{background:var(--chat-user);color:var(--text);font-size:var(--conversation);white-space:pre-wrap;overflow-wrap:anywhere}.bubble.agent{background:var(--chat-agent)}.message-actions{position:absolute;bottom:0;display:flex;align-items:center;gap:2px;transition:opacity var(--hover)}.message-actions.leading{right:calc(100% + 6px)}.message-actions.trailing{left:calc(100% + 6px)}.message-action{width:26px;height:26px;display:grid;place-items:center;color:var(--secondary)}.message-action:hover{color:var(--text)}.reaction-chip{padding:3px 8px;border-radius:999px;background:var(--surface)}.thread-chip{display:flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;background:var(--surface)}.working{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:22px;background:var(--bubble-agent);text-align:left;min-width:0}.thinking{max-height:180px;overflow-y:auto;white-space:pre-wrap;text-align:left}.mentions{display:flex;gap:6px;padding:0 16px 6px;overflow-x:auto}.mention{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:var(--surface);flex:none}.composer{display:flex;align-items:flex-end;gap:8px;padding:6px 16px 16px;max-width:820px;margin:0 auto;width:100%}.composer-add{width:28px;height:28px;border-radius:50%;background:var(--bubble-user);box-shadow:0 2px 20px #0000000f;display:grid;place-items:center;flex:none;margin-bottom:max(0px,(round(up,calc(var(--conversation) * 1.25),1px) + 14px - 28px) / 2)}.composer-surface{flex:1;min-width:0;background:var(--bubble-user);border-radius:24px;box-shadow:0 2px 20px #0000000f;display:flex;flex-direction:column}.composer-box{display:flex;align-items:flex-end;gap:8px;padding:4px 6px 4px 8px}.composer-field{flex:1;min-width:0;position:relative}.composer-box textarea,.composer-measure{flex:1;min-width:0;font-size:var(--conversation);line-height:round(up,calc(var(--conversation) * 1.25),1px);padding:7px 0;color:var(--text);-webkit-user-select:text;user-select:text;cursor:text}.composer-box textarea{display:block;width:100%;height:calc(round(up,calc(var(--conversation) * 1.25),1px) + 14px);transition:height var(--layout)}.composer-measure{position:absolute;inset:0 0 auto;visibility:hidden;pointer-events:none;white-space:pre-wrap;overflow-wrap:break-word}.composer-reveal{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows var(--layout),opacity var(--morph)}.composer-reveal.shown{grid-template-rows:1fr;opacity:1}.composer-reveal>div{min-height:0;overflow:hidden}.composer-symbol{grid-area:1 / 1;display:grid;place-items:center;opacity:0;transform:scale(.55) rotate(-35deg);transition:opacity var(--morph),transform var(--morph)}.composer-symbol.active{opacity:1;transform:scale(1) rotate(0)}.composer-send{width:28px;height:28px;border-radius:999px;display:grid;place-items:center;flex:none;margin-bottom:max(0px,(round(up,calc(var(--conversation) * 1.25),1px) + 14px - 28px) / 2);transition:background-color var(--morph),color var(--morph),transform var(--press)}.symbol-swap{animation:symbol-in var(--morph) both}@keyframes symbol-in{0%{opacity:0;transform:scale(.6)}}.file-chips{display:flex;gap:6px;padding:8px 10px 0;overflow-x:auto}.file-chips:has(.attachment-tile){align-items:flex-start}.attachment-tile{position:relative;width:80px;height:80px;flex:none;border-radius:16px;overflow:hidden;background:var(--surface)}.attachment-tile img{width:100%;height:100%;object-fit:contain}.attachment-remove{position:absolute;top:4px;right:4px;width:22px;height:22px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#000000bf}.file-chip{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:var(--surface);flex:none}.call-overlay{position:absolute;top:16px;left:0;right:0;z-index:6;display:flex;justify-content:center;animation:call-in var(--layout) both}@keyframes call-in{0%{opacity:0;transform:translateY(-100%)}}.side-panel{height:100%;display:flex;flex:none;opacity:0;transition:width var(--layout),opacity var(--morph);overflow:hidden}.side-panel.shown{opacity:1}.side-panel-border{width:1px;background:var(--border);flex:none}@keyframes panel-slide{0%{opacity:0;transform:translate(20px)}}.panel-slide.from-trailing{animation:from-trailing var(--layout) both}.panel-slide.from-leading{animation:from-leading var(--layout) both}@keyframes from-trailing{0%{opacity:0;transform:translate(30%)}}@keyframes from-leading{0%{opacity:0;transform:translate(-30%)}}.row-in{animation:row-in .24s cubic-bezier(.23,1,.32,1) both;transform-origin:bottom left}.row-in.mine{transform-origin:bottom right}@keyframes row-in{0%{opacity:0;transform:translateY(12px) scale(.94)}}@media(prefers-reduced-motion:reduce){.row-in{animation:row-fade .12s both}}@keyframes row-fade{0%{opacity:0}}.mac-chat-button{border-radius:50%;background:var(--chat-button);color:var(--secondary);display:grid;place-items:center;flex:none;position:relative;overflow:hidden;transition:transform var(--morph),color var(--hover)}.mac-chat-button:after{content:"";position:absolute;inset:0;border-radius:50%;background:rgba(var(--text-rgb),0);transition:background-color var(--hover)}.mac-chat-button>*{transition:translate var(--morph)}.mac-chat-button:hover{color:var(--text)}.mac-chat-button:hover:after{background:rgba(var(--text-rgb),.06)}.mac-chat-button:hover>*{translate:calc(var(--dx) * 1px) calc(var(--dy) * 1px)}.mac-chat-button:active{transform:scale(.94);transition:transform var(--press)}.mac-chat-button:active:after{background:rgba(var(--text-rgb),.12)}.mac-chat-button:active>*{translate:calc(var(--dx) * 1.5px) calc(var(--dy) * 1.5px)}@media(prefers-reduced-motion:reduce){.mac-chat-button:hover>*,.mac-chat-button:active>*{translate:none}.mac-chat-button:active{transform:none}}.composer-dock{position:absolute;left:0;right:0;bottom:0;z-index:4}.composer-fade{position:absolute;z-index:-1;inset:-24px 0 0;pointer-events:none;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);-webkit-mask-image:linear-gradient(to top,#000 40%,transparent);mask-image:linear-gradient(to top,#000 40%,transparent);background:linear-gradient(to top,color-mix(in srgb,var(--background) 90%,transparent) 0%,color-mix(in srgb,var(--background) 45%,transparent) 40%,transparent 100%)}.jump-to-latest{position:absolute;left:50%;z-index:5;transform:translate(-50%);border-radius:50%;box-shadow:0 3px 20px #0000001f;animation:jump-in var(--morph) both}@keyframes jump-in{0%{opacity:0;translate:0 6px}}.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.chat-window{height:100%;min-width:760px;min-height:500px;background:var(--background);position:relative}.empty-state{height:100%;padding:32px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}.split{display:flex;height:100%}.sidebar{flex:none;height:100%;background:var(--surface);display:flex;flex-direction:column;overflow:hidden;transition:width var(--layout)}.sidebar-header{display:flex;align-items:center;gap:6px;height:44px;padding-right:18px;flex:none;transition:opacity var(--layout),padding var(--layout)}.search{display:flex;align-items:center;gap:6px;height:28px;margin:4px 12px 8px;padding:0 9px;border-radius:8px;background:var(--bubble-agent);font-size:calc(13px * var(--scale));flex:none}.search input{flex:1;min-width:0}.search-clear{display:flex}.roster{flex:1;overflow-y:auto;padding:4px 12px 0;display:flex;flex-direction:column;gap:2px;outline:none;position:relative}.sidebar.compact .roster{padding-top:4px}.roster-row{width:100%;border-radius:10px;display:flex;transition:background-color var(--hover);flex:none}.roster-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;pointer-events:none}.sidebar-footer{display:flex;flex-direction:column;gap:4px;padding:6px 12px 10px;font-size:calc(13px * var(--scale));font-weight:500;color:var(--text);flex:none}.footer-row{display:flex;align-items:center;gap:10px;height:36px;padding:0 8px;border-radius:10px;transition:background-color var(--hover)}.footer-row.account{height:38px}.footer-row:hover,.footer-row.active{background:var(--bubble-agent)}.footer-icon{width:30px;height:30px;border-radius:50%;background:rgba(var(--text-rgb),.025);display:grid;place-items:center;flex:none}.profile-avatar{width:28px;height:28px;border-radius:50%;background:var(--bubble-user);display:grid;place-items:center;flex:none}.rail-actions{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 0 10px;flex:none}.rail-profile{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;margin-top:4px}.sidebar-divider{width:1px;flex:none;background:var(--border);position:relative;z-index:2}.sidebar-divider:after{content:"";position:absolute;top:0;bottom:0;left:-4px;width:9px;cursor:col-resize}.detail{flex:1;min-width:420px;height:100%;position:relative;overflow:hidden}.detail-column{display:flex;flex-direction:column;height:100%}.empty-detail{height:100%;padding:32px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px}.context-layer{position:fixed;inset:0;z-index:50;pointer-events:auto}.account-panel,.action-menu{position:absolute;padding:7px;background:var(--panel);box-shadow:0 8px 40px #00000040;animation:panel-in var(--fade) both}.account-panel{border-radius:18px;transform-origin:bottom left}.action-menu{width:260px;border-radius:14px}@keyframes panel-in{0%{opacity:0;transform:scale(.97)}}.panel-row{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 10px;border-radius:10px}.panel-row.highlight{background:rgba(var(--text-rgb),.08)}.panel-row:disabled{opacity:.4}.panel-divider{height:.5px;background:rgba(var(--text-rgb),.13);margin:5px 10px}.panel-identity{display:flex;align-items:center;gap:8px;height:30px;padding:0 10px;color:var(--secondary)}
diff --git a/web/public/demo/desktop/symbols/arrow.down.to.line.black.png b/web/public/demo/desktop/symbols/arrow.down.to.line.black.png
new file mode 100644
index 00000000..0994f99d
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.down.to.line.black.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.down.to.line.bold.png b/web/public/demo/desktop/symbols/arrow.down.to.line.bold.png
new file mode 100644
index 00000000..345efe38
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.down.to.line.bold.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.down.to.line.light.png b/web/public/demo/desktop/symbols/arrow.down.to.line.light.png
new file mode 100644
index 00000000..d87014d9
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.down.to.line.light.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.down.to.line.medium.png b/web/public/demo/desktop/symbols/arrow.down.to.line.medium.png
new file mode 100644
index 00000000..814554c1
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.down.to.line.medium.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.down.to.line.regular.png b/web/public/demo/desktop/symbols/arrow.down.to.line.regular.png
new file mode 100644
index 00000000..19a33fd7
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.down.to.line.regular.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.down.to.line.semibold.png b/web/public/demo/desktop/symbols/arrow.down.to.line.semibold.png
new file mode 100644
index 00000000..0201ea6c
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.down.to.line.semibold.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.left.arrow.right.black.png b/web/public/demo/desktop/symbols/arrow.left.arrow.right.black.png
new file mode 100644
index 00000000..d9aa5255
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.left.arrow.right.black.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.left.arrow.right.bold.png b/web/public/demo/desktop/symbols/arrow.left.arrow.right.bold.png
new file mode 100644
index 00000000..7395eaff
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.left.arrow.right.bold.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.left.arrow.right.light.png b/web/public/demo/desktop/symbols/arrow.left.arrow.right.light.png
new file mode 100644
index 00000000..bbdf4e26
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.left.arrow.right.light.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.left.arrow.right.medium.png b/web/public/demo/desktop/symbols/arrow.left.arrow.right.medium.png
new file mode 100644
index 00000000..25ce078e
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.left.arrow.right.medium.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.left.arrow.right.regular.png b/web/public/demo/desktop/symbols/arrow.left.arrow.right.regular.png
new file mode 100644
index 00000000..3583f91e
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.left.arrow.right.regular.png differ
diff --git a/web/public/demo/desktop/symbols/arrow.left.arrow.right.semibold.png b/web/public/demo/desktop/symbols/arrow.left.arrow.right.semibold.png
new file mode 100644
index 00000000..d45b98f1
Binary files /dev/null and b/web/public/demo/desktop/symbols/arrow.left.arrow.right.semibold.png differ
diff --git a/web/public/demo/desktop/symbols/bubble.left.fill.black.png b/web/public/demo/desktop/symbols/bubble.left.fill.black.png
new file mode 100644
index 00000000..3f183c36
Binary files /dev/null and b/web/public/demo/desktop/symbols/bubble.left.fill.black.png differ
diff --git a/web/public/demo/desktop/symbols/bubble.left.fill.bold.png b/web/public/demo/desktop/symbols/bubble.left.fill.bold.png
new file mode 100644
index 00000000..bcbf87ff
Binary files /dev/null and b/web/public/demo/desktop/symbols/bubble.left.fill.bold.png differ
diff --git a/web/public/demo/desktop/symbols/bubble.left.fill.light.png b/web/public/demo/desktop/symbols/bubble.left.fill.light.png
new file mode 100644
index 00000000..ce9fbcc6
Binary files /dev/null and b/web/public/demo/desktop/symbols/bubble.left.fill.light.png differ
diff --git a/web/public/demo/desktop/symbols/bubble.left.fill.medium.png b/web/public/demo/desktop/symbols/bubble.left.fill.medium.png
new file mode 100644
index 00000000..86b53a28
Binary files /dev/null and b/web/public/demo/desktop/symbols/bubble.left.fill.medium.png differ
diff --git a/web/public/demo/desktop/symbols/bubble.left.fill.regular.png b/web/public/demo/desktop/symbols/bubble.left.fill.regular.png
new file mode 100644
index 00000000..726f45fe
Binary files /dev/null and b/web/public/demo/desktop/symbols/bubble.left.fill.regular.png differ
diff --git a/web/public/demo/desktop/symbols/bubble.left.fill.semibold.png b/web/public/demo/desktop/symbols/bubble.left.fill.semibold.png
new file mode 100644
index 00000000..fd7b21bd
Binary files /dev/null and b/web/public/demo/desktop/symbols/bubble.left.fill.semibold.png differ
diff --git a/web/public/demo/desktop/symbols/face.smiling.black.png b/web/public/demo/desktop/symbols/face.smiling.black.png
index 08632537..10145e7b 100644
Binary files a/web/public/demo/desktop/symbols/face.smiling.black.png and b/web/public/demo/desktop/symbols/face.smiling.black.png differ
diff --git a/web/public/demo/desktop/symbols/face.smiling.bold.png b/web/public/demo/desktop/symbols/face.smiling.bold.png
index b393a0d2..b606144a 100644
Binary files a/web/public/demo/desktop/symbols/face.smiling.bold.png and b/web/public/demo/desktop/symbols/face.smiling.bold.png differ
diff --git a/web/public/demo/desktop/symbols/face.smiling.light.png b/web/public/demo/desktop/symbols/face.smiling.light.png
index 1dc87be3..785a305b 100644
Binary files a/web/public/demo/desktop/symbols/face.smiling.light.png and b/web/public/demo/desktop/symbols/face.smiling.light.png differ
diff --git a/web/public/demo/desktop/symbols/face.smiling.medium.png b/web/public/demo/desktop/symbols/face.smiling.medium.png
index 75a46be7..f90dd8db 100644
Binary files a/web/public/demo/desktop/symbols/face.smiling.medium.png and b/web/public/demo/desktop/symbols/face.smiling.medium.png differ
diff --git a/web/public/demo/desktop/symbols/face.smiling.regular.png b/web/public/demo/desktop/symbols/face.smiling.regular.png
index 4fe144c8..306875af 100644
Binary files a/web/public/demo/desktop/symbols/face.smiling.regular.png and b/web/public/demo/desktop/symbols/face.smiling.regular.png differ
diff --git a/web/public/demo/desktop/symbols/face.smiling.semibold.png b/web/public/demo/desktop/symbols/face.smiling.semibold.png
index ef0110a7..20ac5ce6 100644
Binary files a/web/public/demo/desktop/symbols/face.smiling.semibold.png and b/web/public/demo/desktop/symbols/face.smiling.semibold.png differ
diff --git a/web/public/demo/desktop/symbols/house.fill.black.png b/web/public/demo/desktop/symbols/house.fill.black.png
new file mode 100644
index 00000000..8d09b0d0
Binary files /dev/null and b/web/public/demo/desktop/symbols/house.fill.black.png differ
diff --git a/web/public/demo/desktop/symbols/house.fill.bold.png b/web/public/demo/desktop/symbols/house.fill.bold.png
new file mode 100644
index 00000000..ffed1187
Binary files /dev/null and b/web/public/demo/desktop/symbols/house.fill.bold.png differ
diff --git a/web/public/demo/desktop/symbols/house.fill.light.png b/web/public/demo/desktop/symbols/house.fill.light.png
new file mode 100644
index 00000000..6ab25e5e
Binary files /dev/null and b/web/public/demo/desktop/symbols/house.fill.light.png differ
diff --git a/web/public/demo/desktop/symbols/house.fill.medium.png b/web/public/demo/desktop/symbols/house.fill.medium.png
new file mode 100644
index 00000000..36c3c3ed
Binary files /dev/null and b/web/public/demo/desktop/symbols/house.fill.medium.png differ
diff --git a/web/public/demo/desktop/symbols/house.fill.regular.png b/web/public/demo/desktop/symbols/house.fill.regular.png
new file mode 100644
index 00000000..ba9987e1
Binary files /dev/null and b/web/public/demo/desktop/symbols/house.fill.regular.png differ
diff --git a/web/public/demo/desktop/symbols/house.fill.semibold.png b/web/public/demo/desktop/symbols/house.fill.semibold.png
new file mode 100644
index 00000000..bbd351e2
Binary files /dev/null and b/web/public/demo/desktop/symbols/house.fill.semibold.png differ
diff --git a/web/public/demo/desktop/symbols/manifest.json b/web/public/demo/desktop/symbols/manifest.json
index 0f87403c..65571f5d 100644
--- a/web/public/demo/desktop/symbols/manifest.json
+++ b/web/public/demo/desktop/symbols/manifest.json
@@ -1 +1 @@
-{"bubble.left.and.bubble.right":{"baseline":0.3,"h":1.3,"w":1.675},"ellipsis.circle":{"baseline":0.2375,"w":1.175,"h":1.175},"folder":{"baseline":0.17500000000000002,"h":1.075,"w":1.375},"globe":{"w":1.175,"baseline":0.2375,"h":1.175},"doc.richtext":{"baseline":0.2625,"w":1.075,"h":1.225},"chevron.up":{"baseline":-0.05,"w":1.1,"h":0.675},"arrow.counterclockwise":{"baseline":0.19999999999999998,"w":1.05,"h":1.225},"arrow.down.circle":{"h":1.175,"baseline":0.2375,"w":1.175},"clock":{"w":1.175,"baseline":0.2375,"h":1.175},"exclamationmark.triangle":{"baseline":0.2,"h":1.125,"w":1.225},"doc.on.clipboard.fill":{"baseline":0.4125,"w":1.275,"h":1.475},"checklist":{"baseline":0.225,"w":1.35,"h":1.175},"safari":{"baseline":0.2375,"h":1.175,"w":1.175},"server.rack":{"baseline":0.1875,"h":1.075,"w":1.425},"arrow.right.doc.on.clipboard":{"h":1.425,"baseline":0.35,"w":1.25},"photo":{"baseline":0.1875,"h":1.075,"w":1.425},"exclamationmark.triangle.fill":{"baseline":0.2,"h":1.125,"w":1.225},"arrow.triangle.2.circlepath":{"h":1.175,"baseline":0.2375,"w":1.225},"plus":{"baseline":0.1375,"h":1,"w":1.075},"checkmark":{"h":1.025,"w":1.1,"baseline":0.1625},"xmark.circle.fill":{"baseline":0.2375,"h":1.175,"w":1.175},"square.on.square":{"baseline":0.25,"w":1.3,"h":1.2},"point.3.connected.trianglepath.dotted":{"w":1.3,"baseline":0.1625,"h":1.05},"arrow.right.to.line":{"w":1.275,"baseline":0.1,"h":0.925},"slider.horizontal.3":{"w":1.25,"baseline":0.15,"h":1.025},"macpro.gen3":{"h":1.425,"baseline":0.325,"w":1.275},"pin.fill":{"w":1.15,"baseline":0.325,"h":1.325},"circle.dotted":{"h":1.175,"baseline":0.225,"w":1.175},"laptopcomputer":{"w":1.675,"baseline":0.1375,"h":0.975},"mic":{"h":1.225,"w":1,"baseline":0.225},"tray":{"w":1.425,"baseline":0.15,"h":1.025},"person":{"h":1.1,"baseline":0.18749999999999997,"w":1.125},"chevron.right.2":{"baseline":0.1625,"w":1.175,"h":1.025},"qrcode":{"h":1.075,"baseline":0.1875,"w":1.15},"bolt":{"h":1.325,"baseline":0.3,"w":0.975},"key.fill":{"w":0.875,"baseline":0.35,"h":1.4},"list.bullet.rectangle":{"baseline":0.1875,"h":1.075,"w":1.425},"key":{"baseline":0.35,"w":0.925,"h":1.4},"chevron.left.2":{"w":1.175,"baseline":0.1625,"h":1.025},"mic.fill":{"baseline":0.225,"w":1,"h":1.225},"play.circle":{"baseline":0.2375,"w":1.175,"h":1.175},"arrow.triangle.branch":{"baseline":0.2125,"w":1.15,"h":1.1},"link":{"baseline":0.275,"h":1.275,"w":1.275},"square.grid.2x2":{"h":1.075,"w":1.15,"baseline":0.1875},"display":{"w":1.425,"baseline":0.25,"h":1.175},"eye.slash":{"h":1.225,"w":1.55,"baseline":0.25},"macmini":{"w":1.525,"baseline":0,"h":0.7},"arrow.up.right.square":{"baseline":0.1875,"h":1.075,"w":1.15},"person.crop.circle.badge.checkmark":{"baseline":0.3,"h":1.25,"w":1.35},"person.crop.circle.badge.plus":{"baseline":0.3,"w":1.35,"h":1.25},"doc.plaintext":{"h":1.225,"w":1.075,"baseline":0.2625},"chevron.up.chevron.down":{"w":0.9,"baseline":0.2,"h":1.125},"arrow.down.right.and.arrow.up.left":{"baseline":0.2,"w":1.2,"h":1.125},"wifi":{"h":1,"baseline":0.1375,"w":1.325},"bell.badge":{"w":1.125,"baseline":0.2375,"h":1.275},"mic.slash.fill":{"baseline":0.225,"h":1.225,"w":1},"minus.circle":{"baseline":0.2375,"h":1.175,"w":1.175},"square.and.pencil":{"h":1.225,"w":1.225,"baseline":0.1875},"record.circle":{"h":1.175,"baseline":0.2375,"w":1.175},"arrow.clockwise":{"h":1.225,"baseline":0.19999999999999998,"w":1.05},"book.closed":{"baseline":0.2625,"h":1.225,"w":1.075},"circle":{"w":1.175,"baseline":0.2375,"h":1.175},"bubble.left":{"h":1.2,"w":1.35,"baseline":0.275},"macstudio":{"baseline":0.0625,"h":0.825,"w":1.45},"doc":{"baseline":0.2625,"w":1.075,"h":1.225},"pencil":{"baseline":0.125,"w":1.025,"h":0.975},"text.bubble":{"h":1.2,"w":1.35,"baseline":0.275},"ellipsis":{"baseline":-0.175,"w":1.1,"h":0.375},"desktopcomputer":{"h":1.175,"baseline":0.25,"w":1.425},"rotate.right":{"w":1.125,"baseline":0.1875,"h":1.275},"pin":{"baseline":0.325,"w":1.15,"h":1.325},"plus.circle":{"baseline":0.2375,"h":1.175,"w":1.175},"hourglass":{"h":1.075,"baseline":0.1875,"w":0.825},"eye":{"baseline":0.15,"h":1.025,"w":1.55},"shippingbox":{"h":1.275,"baseline":0.275,"w":1.25},"network":{"baseline":0.2375,"h":1.175,"w":1.175},"hand.raised":{"h":1.25,"baseline":0.2375,"w":1.175},"exclamationmark.circle.fill":{"h":1.175,"baseline":0.2375,"w":1.175},"doc.on.doc":{"w":1.25,"baseline":0.35,"h":1.425},"cpu":{"baseline":0.225,"w":1.25,"h":1.175},"list.bullet":{"h":0.9,"baseline":0.0875,"w":1.25},"rectangle.and.hand.point.up.left":{"h":1.325,"baseline":0.3,"w":1.425},"wifi.slash":{"w":1.325,"baseline":0.175,"h":1.225},"phone.down.fill":{"w":1.35,"baseline":-0.05,"h":0.6},"waveform":{"baseline":0.25,"w":1.15,"h":1.2},"sparkles":{"w":1.125,"baseline":0.25,"h":1.3},"doc.on.clipboard":{"h":1.425,"w":1.25,"baseline":0.35},"checkmark.circle":{"baseline":0.2375,"h":1.175,"w":1.175},"photo.on.rectangle":{"baseline":0.225,"w":1.475,"h":1.175},"chevron.down":{"h":0.675,"baseline":0,"w":1.1},"magnifyingglass":{"baseline":0.2125,"h":1.15,"w":1.2},"xmark":{"h":0.975,"baseline":0.125,"w":1.05},"music.note":{"baseline":0.2375,"h":1.175,"w":0.85},"film":{"h":1.075,"baseline":0.1875,"w":1.425},"calendar":{"w":1.225,"baseline":0.1875,"h":1.075},"person.crop.circle":{"h":1.175,"baseline":0.2375,"w":1.175},"arrow.right":{"baseline":0.1,"h":0.925,"w":1.175},"doc.text":{"h":1.225,"w":1.075,"baseline":0.2625},"arrow.up":{"baseline":0.2,"h":1.1,"w":1},"pin.slash":{"h":1.325,"w":1.175,"baseline":0.325},"mic.slash":{"baseline":0.225,"w":1,"h":1.225},"checkmark.circle.fill":{"h":1.175,"w":1.175,"baseline":0.2375},"trash":{"baseline":0.2375,"h":1.275,"w":1.1},"arrowshape.turn.up.left":{"h":1.075,"w":1.25,"baseline":0.1875},"display.trianglebadge.exclamationmark":{"baseline":0.3125,"w":1.625,"h":1.225},"speaker.slash.fill":{"w":1.05,"baseline":0.3,"h":1.225},"stop.circle":{"w":1.175,"baseline":0.2375,"h":1.175},"arrow.left":{"baseline":0.1,"w":1.175,"h":0.925},"apple.logo":{"h":1.15,"baseline":0.1875,"w":0.9},"lock.display":{"baseline":0.25,"h":1.175,"w":1.425},"speaker.wave.2.fill":{"baseline":0.1625,"h":1.05,"w":1.4},"book.pages":{"h":1.4,"baseline":0.325,"w":1.15},"cursorarrow.motionlines":{"h":1.375,"baseline":0.325,"w":1.225},"clock.arrow.circlepath":{"h":1.175,"baseline":0.2375,"w":1.2},"lock.shield":{"h":1.175,"baseline":0.2375,"w":1.075},"chart.bar":{"h":1.1,"baseline":0.2,"w":1.5},"keyboard.chevron.compact.down":{"w":1.5,"baseline":0.3875,"h":1.225},"person.2":{"w":1.625,"baseline":0.25,"h":1.15},"arrow.up.doc.on.clipboard":{"baseline":0.35,"w":1.25,"h":1.425},"face.smiling":{"h":1.175,"w":1.175,"baseline":0.2375},"wrench.and.screwdriver":{"baseline":0.35,"h":1.375,"w":1.425},"iphone":{"baseline":0.25,"w":1.025,"h":1.225},"exclamationmark":{"baseline":0.2,"w":0.4,"h":1.125},"person.fill":{"h":1.075,"baseline":0.17500000000000002,"w":1.075},"doc.zipper":{"baseline":0.2625,"w":1.075,"h":1.3},"gauge.with.dots.needle.33percent":{"baseline":0.2375,"h":1.175,"w":1.175},"info.circle":{"baseline":0.2375,"w":1.175,"h":1.175},"power":{"baseline":0.2375,"h":1.2,"w":1.175},"chevron.left":{"h":1.025,"baseline":0.1625,"w":0.75},"xmark.circle":{"baseline":0.2375,"h":1.175,"w":1.175},"exclamationmark.circle":{"h":1.175,"baseline":0.2375,"w":1.175},"display.2":{"w":1.825,"baseline":0.25,"h":1.175},"book":{"h":1.1,"baseline":0.18749999999999997,"w":1.35},"rectangle.portrait.and.arrow.right":{"baseline":0.2625,"w":1.4,"h":1.225},"desktopcomputer.trianglebadge.exclamationmark":{"h":1.225,"w":1.625,"baseline":0.3125},"brain":{"baseline":0.275,"h":1.275,"w":1.475},"hand.point.up.left":{"baseline":0.25,"w":1.05,"h":1.175},"doc.badge.plus":{"baseline":0.4125,"h":1.4,"w":1.225},"cloud":{"baseline":0.1125,"w":1.325,"h":0.95},"chevron.right":{"baseline":0.1625,"w":0.75,"h":1.025},"gearshape":{"baseline":0.2625,"h":1.225,"w":1.225},"stop.fill":{"baseline":0.1375,"w":1.05,"h":0.975},"square.and.arrow.up":{"h":1.35,"baseline":0.2375,"w":1.125},"terminal":{"h":1.075,"baseline":0.1875,"w":1.425},"sidebar.left":{"w":1.425,"baseline":0.1875,"h":1.075},"hand.raised.slash":{"baseline":0.325,"w":1.175,"h":1.325},"hammer":{"h":1.4,"baseline":0.3375,"w":1.475},"speaker.wave.2":{"w":1.4,"baseline":0.1625,"h":1.05},"square.grid.3x3":{"baseline":0.2,"w":1.225,"h":1.125},"arrow.down":{"baseline":0.2,"h":1.1,"w":1},"checkmark.seal":{"h":1.325,"baseline":0.3,"w":1.3}}
\ No newline at end of file
+{"iphone":{"h":1.225,"w":1.025,"baseline":0.25},"speaker.slash.fill":{"h":1.225,"w":1.05,"baseline":0.3},"checkmark":{"h":1.025,"w":1.1,"baseline":0.1625},"lock.display":{"h":1.175,"w":1.425,"baseline":0.25},"bolt":{"h":1.325,"w":0.975,"baseline":0.3},"checkmark.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"eye":{"h":1.025,"w":1.55,"baseline":0.15},"arrow.up":{"h":1.1,"w":1,"baseline":0.2},"pencil":{"h":0.975,"w":1.025,"baseline":0.125},"sparkles":{"h":1.3,"w":1.125,"baseline":0.25},"chevron.right":{"h":1.025,"w":0.75,"baseline":0.1625},"arrow.triangle.2.circlepath":{"h":1.175,"w":1.225,"baseline":0.2375},"exclamationmark.circle.fill":{"h":1.175,"w":1.175,"baseline":0.2375},"circle.dotted":{"h":1.175,"w":1.175,"baseline":0.225},"ellipsis.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"brain":{"h":1.275,"w":1.475,"baseline":0.275},"display":{"h":1.175,"w":1.425,"baseline":0.25},"book.pages":{"h":1.4,"w":1.15,"baseline":0.325},"face.smiling":{"h":1.175,"w":1.175,"baseline":0.2375},"wrench.and.screwdriver":{"h":1.375,"w":1.425,"baseline":0.35},"square.on.square":{"h":1.2,"w":1.3,"baseline":0.25},"person.fill":{"h":1.075,"w":1.075,"baseline":0.17500000000000002},"speaker.wave.2":{"h":1.05,"w":1.4,"baseline":0.1625},"keyboard.chevron.compact.down":{"h":1.225,"w":1.5,"baseline":0.3875},"checklist":{"h":1.175,"w":1.35,"baseline":0.225},"lock.shield":{"h":1.175,"w":1.075,"baseline":0.2375},"mic.fill":{"h":1.225,"w":1,"baseline":0.225},"arrow.up.right.square":{"h":1.075,"w":1.15,"baseline":0.1875},"doc.richtext":{"h":1.225,"w":1.075,"baseline":0.2625},"play.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"macpro.gen3":{"baseline":0.325,"w":1.275,"h":1.425},"desktopcomputer":{"h":1.175,"w":1.425,"baseline":0.25},"plus.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"trash":{"h":1.275,"w":1.1,"baseline":0.2375},"hourglass":{"h":1.075,"w":0.825,"baseline":0.1875},"sidebar.left":{"h":1.075,"w":1.425,"baseline":0.1875},"speaker.wave.2.fill":{"h":1.05,"w":1.4,"baseline":0.1625},"square.grid.2x2":{"h":1.075,"w":1.15,"baseline":0.1875},"terminal":{"h":1.075,"w":1.425,"baseline":0.1875},"checkmark.circle.fill":{"h":1.175,"w":1.175,"baseline":0.2375},"person.crop.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"mic.slash":{"h":1.225,"w":1,"baseline":0.225},"stop.fill":{"h":0.975,"w":1.05,"baseline":0.1375},"photo.on.rectangle":{"h":1.175,"w":1.475,"baseline":0.225},"calendar":{"h":1.075,"w":1.225,"baseline":0.1875},"record.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"arrowshape.turn.up.left":{"h":1.075,"w":1.25,"baseline":0.1875},"bubble.left":{"h":1.2,"w":1.35,"baseline":0.275},"music.note":{"h":1.175,"w":0.85,"baseline":0.2375},"pin.slash":{"baseline":0.325,"w":1.175,"h":1.325},"bubble.left.fill":{"h":1.2,"w":1.35,"baseline":0.275},"arrow.down.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"phone.down.fill":{"h":0.6,"w":1.35,"baseline":-0.05},"cursorarrow.motionlines":{"baseline":0.325,"w":1.225,"h":1.375},"wifi":{"h":1,"w":1.325,"baseline":0.1375},"house.fill":{"h":1.225,"w":1.425,"baseline":0.25},"square.grid.3x3":{"h":1.125,"w":1.225,"baseline":0.2},"doc.on.clipboard.fill":{"h":1.475,"w":1.275,"baseline":0.4125},"arrow.left.arrow.right":{"h":1.35,"w":1.225,"baseline":0.3125},"cpu":{"h":1.175,"w":1.25,"baseline":0.225},"eye.slash":{"h":1.225,"w":1.55,"baseline":0.25},"doc":{"h":1.225,"w":1.075,"baseline":0.2625},"arrow.right.to.line":{"h":0.925,"w":1.275,"baseline":0.1},"arrow.down":{"h":1.1,"w":1,"baseline":0.2},"arrow.clockwise":{"h":1.225,"w":1.05,"baseline":0.19999999999999998},"doc.badge.plus":{"h":1.4,"w":1.225,"baseline":0.4125},"laptopcomputer":{"h":0.975,"w":1.675,"baseline":0.1375},"macstudio":{"baseline":0.0625,"w":1.45,"h":0.825},"safari":{"h":1.175,"w":1.175,"baseline":0.2375},"book.closed":{"h":1.225,"w":1.075,"baseline":0.2625},"text.bubble":{"h":1.2,"w":1.35,"baseline":0.275},"globe":{"h":1.175,"w":1.175,"baseline":0.2375},"slider.horizontal.3":{"h":1.025,"w":1.25,"baseline":0.15},"person.crop.circle.badge.plus":{"h":1.25,"w":1.35,"baseline":0.3},"person.crop.circle.badge.checkmark":{"h":1.25,"w":1.35,"baseline":0.3},"arrow.right":{"baseline":0.1,"w":1.175,"h":0.925},"xmark":{"h":0.975,"w":1.05,"baseline":0.125},"power":{"h":1.2,"w":1.175,"baseline":0.2375},"doc.zipper":{"h":1.3,"w":1.075,"baseline":0.2625},"waveform":{"h":1.2,"w":1.15,"baseline":0.25},"chevron.left":{"h":1.025,"w":0.75,"baseline":0.1625},"plus":{"h":1,"w":1.075,"baseline":0.1375},"exclamationmark.triangle.fill":{"h":1.125,"w":1.225,"baseline":0.2},"mic":{"h":1.225,"w":1,"baseline":0.225},"wifi.slash":{"h":1.225,"w":1.325,"baseline":0.175},"arrow.down.right.and.arrow.up.left":{"h":1.125,"w":1.2,"baseline":0.2},"macmini":{"h":0.7,"w":1.525,"baseline":0},"clock.arrow.circlepath":{"h":1.175,"w":1.2,"baseline":0.2375},"book":{"h":1.1,"w":1.35,"baseline":0.18749999999999997},"hand.point.up.left":{"h":1.175,"w":1.05,"baseline":0.25},"chevron.right.2":{"baseline":0.1625,"w":1.175,"h":1.025},"arrow.down.to.line":{"h":1.2,"w":1,"baseline":0.2375},"apple.logo":{"h":1.15,"w":0.9,"baseline":0.1875},"magnifyingglass":{"h":1.15,"w":1.2,"baseline":0.2125},"doc.text":{"h":1.225,"w":1.075,"baseline":0.2625},"list.bullet.rectangle":{"h":1.075,"w":1.425,"baseline":0.1875},"gearshape":{"h":1.225,"w":1.225,"baseline":0.2625},"shippingbox":{"h":1.275,"w":1.25,"baseline":0.275},"ellipsis":{"h":0.375,"w":1.1,"baseline":-0.175},"server.rack":{"h":1.075,"w":1.425,"baseline":0.1875},"exclamationmark":{"h":1.125,"w":0.4,"baseline":0.2},"xmark.circle.fill":{"h":1.175,"w":1.175,"baseline":0.2375},"display.2":{"h":1.175,"w":1.825,"baseline":0.25},"gauge.with.dots.needle.33percent":{"h":1.175,"w":1.175,"baseline":0.2375},"arrow.triangle.branch":{"h":1.1,"w":1.15,"baseline":0.2125},"circle":{"h":1.175,"w":1.175,"baseline":0.2375},"key.fill":{"h":1.4,"w":0.875,"baseline":0.35},"clock":{"h":1.175,"w":1.175,"baseline":0.2375},"photo":{"h":1.075,"w":1.425,"baseline":0.1875},"chart.bar":{"h":1.1,"w":1.5,"baseline":0.2},"rectangle.and.hand.point.up.left":{"h":1.325,"w":1.425,"baseline":0.3},"arrow.left":{"h":0.925,"w":1.175,"baseline":0.1},"person.2":{"h":1.15,"w":1.625,"baseline":0.25},"cloud":{"h":0.95,"w":1.325,"baseline":0.1125},"folder":{"h":1.075,"w":1.375,"baseline":0.17500000000000002},"bubble.left.and.bubble.right":{"h":1.3,"w":1.675,"baseline":0.3},"doc.on.clipboard":{"h":1.425,"w":1.25,"baseline":0.35},"key":{"h":1.4,"w":0.925,"baseline":0.35},"arrow.counterclockwise":{"h":1.225,"w":1.05,"baseline":0.19999999999999998},"hand.raised":{"h":1.25,"w":1.175,"baseline":0.2375},"display.trianglebadge.exclamationmark":{"h":1.225,"w":1.625,"baseline":0.3125},"desktopcomputer.trianglebadge.exclamationmark":{"h":1.225,"w":1.625,"baseline":0.3125},"hand.raised.slash":{"h":1.325,"w":1.175,"baseline":0.325},"exclamationmark.triangle":{"h":1.125,"w":1.225,"baseline":0.2},"star":{"h":1.225,"w":1.3,"baseline":0.225},"film":{"h":1.075,"w":1.425,"baseline":0.1875},"pin.fill":{"h":1.325,"w":1.15,"baseline":0.325},"exclamationmark.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"rotate.right":{"h":1.275,"w":1.125,"baseline":0.1875},"pin":{"h":1.325,"w":1.15,"baseline":0.325},"qrcode":{"h":1.075,"w":1.15,"baseline":0.1875},"square.and.arrow.up":{"h":1.35,"w":1.125,"baseline":0.2375},"xmark.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"link":{"h":1.275,"w":1.275,"baseline":0.275},"chevron.left.2":{"h":1.025,"w":1.175,"baseline":0.1625},"checkmark.seal":{"h":1.325,"w":1.3,"baseline":0.3},"person":{"h":1.1,"w":1.125,"baseline":0.18749999999999997},"stop.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"arrow.up.doc.on.clipboard":{"h":1.425,"w":1.25,"baseline":0.35},"chevron.up.chevron.down":{"h":1.125,"w":0.9,"baseline":0.2},"point.3.connected.trianglepath.dotted":{"h":1.05,"w":1.3,"baseline":0.1625},"doc.on.doc":{"h":1.425,"w":1.25,"baseline":0.35},"network":{"h":1.175,"w":1.175,"baseline":0.2375},"chevron.down":{"h":0.675,"w":1.1,"baseline":0},"arrow.right.doc.on.clipboard":{"h":1.425,"w":1.25,"baseline":0.35},"list.bullet":{"h":0.9,"w":1.25,"baseline":0.0875},"square.and.pencil":{"h":1.225,"w":1.225,"baseline":0.1875},"mic.slash.fill":{"h":1.225,"w":1,"baseline":0.225},"hammer":{"h":1.4,"w":1.475,"baseline":0.3375},"bell.badge":{"h":1.275,"w":1.125,"baseline":0.2375},"minus.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"doc.plaintext":{"h":1.225,"w":1.075,"baseline":0.2625},"rectangle.portrait.and.arrow.right":{"h":1.225,"w":1.4,"baseline":0.2625},"chevron.up":{"baseline":-0.05,"w":1.1,"h":0.675},"info.circle":{"h":1.175,"w":1.175,"baseline":0.2375},"tray":{"h":1.025,"w":1.425,"baseline":0.15}}
\ No newline at end of file
diff --git a/web/public/demo/desktop/symbols/star.black.png b/web/public/demo/desktop/symbols/star.black.png
new file mode 100644
index 00000000..eabde94e
Binary files /dev/null and b/web/public/demo/desktop/symbols/star.black.png differ
diff --git a/web/public/demo/desktop/symbols/star.bold.png b/web/public/demo/desktop/symbols/star.bold.png
new file mode 100644
index 00000000..4878ff2c
Binary files /dev/null and b/web/public/demo/desktop/symbols/star.bold.png differ
diff --git a/web/public/demo/desktop/symbols/star.light.png b/web/public/demo/desktop/symbols/star.light.png
new file mode 100644
index 00000000..fc67908b
Binary files /dev/null and b/web/public/demo/desktop/symbols/star.light.png differ
diff --git a/web/public/demo/desktop/symbols/star.medium.png b/web/public/demo/desktop/symbols/star.medium.png
new file mode 100644
index 00000000..045f04dc
Binary files /dev/null and b/web/public/demo/desktop/symbols/star.medium.png differ
diff --git a/web/public/demo/desktop/symbols/star.regular.png b/web/public/demo/desktop/symbols/star.regular.png
new file mode 100644
index 00000000..6213bb04
Binary files /dev/null and b/web/public/demo/desktop/symbols/star.regular.png differ
diff --git a/web/public/demo/desktop/symbols/star.semibold.png b/web/public/demo/desktop/symbols/star.semibold.png
new file mode 100644
index 00000000..dfc93d74
Binary files /dev/null and b/web/public/demo/desktop/symbols/star.semibold.png differ