@design.estate/dees-catalog 24.0.0 → 24.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_bundle/bundle.js +40 -23
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-D2VWVF66.js → chunk-K2UNUD5D.js} +4 -4
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-K2UNUD5D.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-MQBVXIOT.js → dees-workspace-terminal-EEY5WEF4.js} +2 -2
- package/dist_bundle/third-party-notices.md +2 -2
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/cdn.js +2 -2
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarymenu/dees-appui-secondarymenu.d.ts +14 -1
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarymenu/dees-appui-secondarymenu.js +41 -23
- package/dist_ts_web/elements/00group-workspace/dees-workspace/typescript-intellisense.d.ts +1 -1
- package/dist_ts_web/elements/00group-workspace/dees-workspace-diff-editor/dees-workspace-diff-editor.d.ts +1 -1
- package/dist_ts_web/elements/00group-workspace/dees-workspace-monaco/dees-workspace-monaco.d.ts +1 -1
- package/dist_ts_web/services/DeesServiceLibLoader.d.ts +2 -2
- package/dist_ts_web/services/DeesServiceLibLoader.js +1 -1
- package/dist_ts_web/services/monacoversion.d.ts +1 -1
- package/dist_ts_web/services/monacoversion.js +1 -1
- package/dist_ts_web/services/versions.d.ts +1 -1
- package/dist_ts_web/services/versions.js +2 -2
- package/package.json +2 -2
- package/readme.md +4 -2
- package/scripts/check-third-party-notices.mjs +1 -1
- package/scripts/update-monaco-version.cjs +4 -4
- package/third-party-notices.md +2 -2
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/cdn.ts +1 -1
- package/ts_web/elements/00group-appui/dees-appui-secondarymenu/dees-appui-secondarymenu.ts +40 -24
- package/ts_web/elements/00group-input/dees-input-code/dees-input-code.ts +1 -1
- package/ts_web/elements/00group-workspace/dees-workspace/dees-workspace.ts +1 -1
- package/ts_web/elements/00group-workspace/dees-workspace/typescript-intellisense.ts +1 -1
- package/ts_web/elements/00group-workspace/dees-workspace-diff-editor/dees-workspace-diff-editor.ts +1 -1
- package/ts_web/elements/00group-workspace/dees-workspace-monaco/dees-workspace-monaco.ts +1 -1
- package/ts_web/services/DeesServiceLibLoader.ts +2 -2
- package/ts_web/services/monacoversion.ts +1 -1
- package/ts_web/services/versions.ts +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-D2VWVF66.js.map +0 -1
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-MQBVXIOT.js.map → dees-workspace-terminal-EEY5WEF4.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../ts_web/elements/00group-appui/dees-appui-tabs/dees-appui-tabs.demo.ts","../../../ts_web/elements/00group-appui/appui.roving.ts","../../../ts_web/elements/00group-appui/appui.labels.ts","../../../ts_web/elements/00group-appui/dees-appui-tabs/dees-appui-tabs.ts","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/internal/constants.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/internal/TypedEventTarget.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/internal/tokens.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/internal/iframe-url.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/internal/code.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/internal/reset-promise.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/internal/auth-state.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/preview-message-types.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/vendor/index.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/utils/is-preview-message.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/utils/null-prototype.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/utils/file-system.js","../../../node_modules/.pnpm/@tempfix+webcontainer__api@1.6.1/node_modules/@tempfix/webcontainer__api/dist/index.js","../../../ts_web/elements/00group-runtime/environments/WebContainerEnvironment.ts","../../../ts_web/elements/00group-feedback/dees-actionbar/dees-actionbar.demo.ts","../../../ts_web/elements/00group-feedback/dees-actionbar/dees-actionbar.ts","../../../ts_web/elements/00group-terminal/dees-terminal-view/dees-terminal-view.demo.ts","../../../ts_web/elements/00group-terminal/terminal.styles.ts","../../../ts_web/services/monacoversion.ts","../../../ts_web/services/versions.ts","../../../ts_web/services/DeesServiceLibLoader.ts","../../../ts_web/elements/00group-terminal/dees-terminal-view/dees-terminal-view.ts","../../../ts_web/elements/00group-workspace/dees-workspace-terminal/dees-workspace-terminal.ts"],"sourcesContent":["import { html, cssManager, css, DeesElement, customElement, state } from '@design.estate/dees-element';\nimport * as interfaces from '../../interfaces/index.js';\nimport { themeDefaultStyles } from '../../00theme.js';\n\n// Interactive demo component for closeable tabs with action buttons\n@customElement('demo-closeable-tabs')\nclass DemoCloseableTabs extends DeesElement {\n @state()\n accessor tabs: interfaces.IMenuItem[] = [\n { key: 'Main', iconName: 'lucide:home', action: () => console.log('Main clicked') },\n ];\n\n @state()\n accessor tabCounter: number = 0;\n\n static styles = [\n css`\n :host {\n display: block;\n }\n .info {\n margin-top: 16px;\n padding: 12px 16px;\n background: ${cssManager.bdTheme('rgba(0,0,0,0.02)', 'rgba(255,255,255,0.02)')};\n border-radius: 6px;\n font-size: 13px;\n color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};\n }\n `\n ];\n\n private addTab() {\n this.tabCounter++;\n const tabKey = `Document ${this.tabCounter}`;\n this.tabs = [\n ...this.tabs,\n {\n key: tabKey,\n iconName: 'lucide:file',\n action: () => console.log(`${tabKey} clicked`),\n closeable: true,\n onClose: () => this.removeTab(tabKey)\n }\n ];\n }\n\n private removeTab(tabKey: string) {\n this.tabs = this.tabs.filter(t => t.key !== tabKey);\n }\n\n private clearAll() {\n this.tabs = [];\n this.tabCounter = 0;\n }\n\n render() {\n const rightActions: interfaces.ITabAction[] = [\n { id: 'add', iconName: 'lucide:plus', action: () => this.addTab(), tooltip: 'New Tab' },\n { id: 'clear', iconName: 'lucide:trash2', action: () => this.clearAll(), tooltip: 'Clear All Tabs' },\n ];\n\n return html`\n <dees-appui-tabs\n .tabs=${this.tabs}\n .actionsRight=${rightActions}\n @tab-close=${(e: CustomEvent) => this.removeTab(e.detail.tab.key)}\n ></dees-appui-tabs>\n <div class=\"info\">\n Click the X button on tabs to close them. Use the + button to add tabs and the trash button to clear all.\n <br>Current tabs: ${this.tabs.length}\n </div>\n `;\n }\n}\n\n// Record tabs as an app opens them: a fixed view, then closeable records, in a tab bar and in a sidebar list\n@customElement('demo-record-tabs')\nclass DemoRecordTabs extends DeesElement {\n @state()\n accessor closedKeys: string[] = [];\n\n @state()\n accessor selectedKey: string = 'customer-4711';\n\n static styles = [\n themeDefaultStyles,\n css`\n :host {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 240px;\n gap: 24px;\n align-items: start;\n }\n .sidebar {\n padding: 8px 0;\n border: 1px solid var(--dees-color-border-subtle);\n border-radius: 8px;\n }\n `\n ];\n\n private get tabs(): interfaces.IMenuItem[] {\n const select = (key: string) => () => { this.selectedKey = key; };\n const close = (key: string) => () => { this.closedKeys = [...this.closedKeys, key]; };\n const tabs: interfaces.IMenuItem[] = [\n { key: 'overview', label: 'Übersicht', iconName: 'lucide:layoutDashboard', action: select('overview') },\n { key: 'customer-4711', label: 'Browser Kunde GmbH', iconName: 'lucide:building2', closeable: true, action: select('customer-4711'), onClose: close('customer-4711') },\n { key: 'invoice-0003', label: 'RE-2026-0003', iconName: 'lucide:fileText', badge: 2, closeable: true, action: select('invoice-0003'), onClose: close('invoice-0003') },\n { key: 'supplier-12', label: 'Lieferant mit einem sehr langen Firmennamen GmbH & Co. KG', iconName: 'lucide:truck', closeable: true, action: select('supplier-12'), onClose: close('supplier-12') },\n ];\n return tabs.filter(tab => !this.closedKeys.includes(tab.key));\n }\n\n render() {\n const tabs = this.tabs;\n const selectedTab = tabs.find(tab => tab.key === this.selectedKey) ?? null;\n const actionsRight: interfaces.ITabAction[] = [\n { id: 'reopen', iconName: 'lucide:rotateCcw', action: () => { this.closedKeys = []; }, tooltip: 'Reopen closed tabs', disabled: this.closedKeys.length === 0 },\n ];\n return html`\n <dees-appui-tabs .tabs=${tabs} .selectedTab=${selectedTab} .actionsRight=${actionsRight}></dees-appui-tabs>\n <div class=\"sidebar\">\n <dees-appui-tabs appearance=\"sidebar\" .tabStyle=${'vertical'} .tabs=${tabs} .selectedTab=${selectedTab}></dees-appui-tabs>\n </div>\n `;\n }\n}\n\n// Interactive demo for auto-hide feature\n@customElement('demo-autohide-tabs')\nclass DemoAutoHideTabs extends DeesElement {\n @state()\n accessor tabs: interfaces.IMenuItem[] = [\n { key: 'Tab 1', iconName: 'lucide:file', action: () => console.log('Tab 1') },\n { key: 'Tab 2', iconName: 'lucide:file', action: () => console.log('Tab 2') },\n ];\n\n @state()\n accessor autoHide: boolean = true;\n\n @state()\n accessor threshold: number = 1;\n\n static styles = [\n css`\n :host {\n display: block;\n }\n .tabs-container {\n min-height: 60px;\n border: 1px dashed ${cssManager.bdTheme('#e5e7eb', '#27272a')};\n border-radius: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .tabs-container dees-appui-tabs {\n width: 100%;\n }\n .placeholder {\n color: ${cssManager.bdTheme('#a1a1aa', '#71717a')};\n font-size: 13px;\n font-style: italic;\n }\n .controls {\n display: flex;\n gap: 8px;\n margin-top: 16px;\n flex-wrap: wrap;\n }\n button {\n background: ${cssManager.bdTheme('rgba(59, 130, 246, 0.1)', 'rgba(59, 130, 246, 0.1)')};\n border: 1px solid ${cssManager.bdTheme('rgba(59, 130, 246, 0.3)', 'rgba(59, 130, 246, 0.3)')};\n color: ${cssManager.bdTheme('#3b82f6', '#60a5fa')};\n padding: 8px 16px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 13px;\n transition: all 0.15s ease;\n }\n button:hover {\n background: ${cssManager.bdTheme('rgba(59, 130, 246, 0.2)', 'rgba(59, 130, 246, 0.2)')};\n }\n button.danger {\n background: ${cssManager.bdTheme('rgba(239, 68, 68, 0.1)', 'rgba(239, 68, 68, 0.1)')};\n border-color: ${cssManager.bdTheme('rgba(239, 68, 68, 0.3)', 'rgba(239, 68, 68, 0.3)')};\n color: ${cssManager.bdTheme('#ef4444', '#f87171')};\n }\n button.danger:hover {\n background: ${cssManager.bdTheme('rgba(239, 68, 68, 0.2)', 'rgba(239, 68, 68, 0.2)')};\n }\n .info {\n margin-top: 16px;\n padding: 12px 16px;\n background: ${cssManager.bdTheme('rgba(0,0,0,0.02)', 'rgba(255,255,255,0.02)')};\n border-radius: 6px;\n font-size: 13px;\n color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};\n }\n `\n ];\n\n private tabCounter = 2;\n\n private addTab() {\n this.tabCounter++;\n this.tabs = [...this.tabs, {\n key: `Tab ${this.tabCounter}`,\n iconName: 'lucide:file',\n action: () => console.log(`Tab ${this.tabCounter}`)\n }];\n }\n\n private removeLastTab() {\n if (this.tabs.length > 0) {\n this.tabs = this.tabs.slice(0, -1);\n }\n }\n\n private clearTabs() {\n this.tabs = [];\n }\n\n render() {\n const shouldHide = this.autoHide && this.tabs.length <= this.threshold;\n\n return html`\n <div class=\"tabs-container\">\n ${shouldHide\n ? html`<span class=\"placeholder\">Tabs hidden (${this.tabs.length} tabs ≤ threshold ${this.threshold})</span>`\n : html`<dees-appui-tabs\n .tabs=${this.tabs}\n .autoHide=${this.autoHide}\n .autoHideThreshold=${this.threshold}\n ></dees-appui-tabs>`\n }\n </div>\n <div class=\"controls\">\n <button @click=${() => this.addTab()}>+ Add Tab</button>\n <button class=\"danger\" @click=${() => this.removeLastTab()}>- Remove Tab</button>\n <button class=\"danger\" @click=${() => this.clearTabs()}>Clear All</button>\n <button @click=${() => { this.threshold = 0; }}>Threshold: 0</button>\n <button @click=${() => { this.threshold = 1; }}>Threshold: 1</button>\n <button @click=${() => { this.threshold = 2; }}>Threshold: 2</button>\n </div>\n <div class=\"info\">\n Auto-hide: ${this.autoHide ? 'ON' : 'OFF'} | Threshold: ${this.threshold} | Tabs: ${this.tabs.length}\n <br>Tabs will hide when count ≤ threshold.\n </div>\n `;\n }\n}\n\nexport const demoFunc = () => {\n const horizontalTabs: interfaces.IMenuItem[] = [\n { key: 'Home', iconName: 'lucide:home', action: () => console.log('Home clicked') },\n { key: 'Analytics Dashboard', iconName: 'lucide:lineChart', action: () => console.log('Analytics clicked') },\n { key: 'Reports', iconName: 'lucide:fileText', action: () => console.log('Reports clicked') },\n { key: 'User Settings', iconName: 'lucide:settings', action: () => console.log('Settings clicked') },\n { key: 'Help', iconName: 'lucide:helpCircle', action: () => console.log('Help clicked') },\n ];\n\n const verticalTabs: interfaces.IMenuItem[] = [\n { key: 'Profile', iconName: 'lucide:user', action: () => console.log('Profile clicked') },\n { key: 'Security', iconName: 'lucide:shield', action: () => console.log('Security clicked') },\n { key: 'Notifications', iconName: 'lucide:bell', action: () => console.log('Notifications clicked') },\n { key: 'Integrations', iconName: 'lucide:link', action: () => console.log('Integrations clicked') },\n { key: 'Advanced', iconName: 'lucide:code', action: () => console.log('Advanced clicked') },\n ];\n\n const noIndicatorTabs: interfaces.IMenuItem[] = [\n { key: 'All', action: () => console.log('All clicked') },\n { key: 'Active', action: () => console.log('Active clicked') },\n { key: 'Completed', action: () => console.log('Completed clicked') },\n { key: 'Archived', action: () => console.log('Archived clicked') },\n ];\n\n const actionsLeft: interfaces.ITabAction[] = [\n { id: 'back', iconName: 'lucide:arrowLeft', action: () => console.log('Back'), tooltip: 'Go Back' },\n ];\n\n const actionsRight: interfaces.ITabAction[] = [\n { id: 'add', iconName: 'lucide:plus', action: () => console.log('Add tab'), tooltip: 'New Tab' },\n { id: 'search', iconName: 'lucide:search', action: () => console.log('Search'), tooltip: 'Search Tabs' },\n { id: 'disabled', iconName: 'lucide:lock', action: () => {}, tooltip: 'Disabled Action', disabled: true },\n ];\n\n const demoContent = (text: string) => html`\n <div style=\"padding: 24px; color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};\">\n ${text}\n </div>\n `;\n\n return html`\n <style>\n .demo-container {\n display: flex;\n flex-direction: column;\n gap: 32px;\n padding: 48px;\n background: ${cssManager.bdTheme('#f8f9fa', '#0a0a0a')};\n min-height: 100vh;\n }\n\n .section {\n background: ${cssManager.bdTheme('#ffffff', '#18181b')};\n border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};\n border-radius: 8px;\n padding: 24px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n }\n\n .section-title {\n font-size: 18px;\n font-weight: 600;\n margin-bottom: 16px;\n color: ${cssManager.bdTheme('#09090b', '#fafafa')};\n }\n\n .two-column {\n display: grid;\n grid-template-columns: 200px 1fr;\n gap: 24px;\n align-items: start;\n }\n </style>\n <div class=\"demo-container\">\n <div class=\"section\">\n <div class=\"section-title\">Horizontal Tabs with Animated Indicator</div>\n <dees-appui-tabs .tabs=${horizontalTabs}></dees-appui-tabs>\n ${demoContent('Select a tab to see the smooth sliding animation of the indicator. The indicator automatically adjusts its width to match the tab content with minimal padding.')}\n </div>\n\n <div class=\"section\">\n <div class=\"section-title\">Tabs with Action Buttons</div>\n <dees-appui-tabs\n .tabs=${horizontalTabs}\n .actionsLeft=${actionsLeft}\n .actionsRight=${actionsRight}\n ></dees-appui-tabs>\n ${demoContent('Action buttons can be placed on either side of the tab bar. They remain fixed while tabs scroll. The lock icon shows a disabled action.')}\n </div>\n\n <div class=\"section\">\n <div class=\"section-title\">Closeable Record Tabs</div>\n <demo-record-tabs></demo-record-tabs>\n ${demoContent('The close button is a round mark at the tab\\'s end, with a hit area that reaches from the label to the tab\\'s edge. Selected and unselected tabs, a badge and a long label show the spacing; the long label ends in an ellipsis at the tab bar\\'s max width (--dees-tabs-max-width, 240px by default) and in the sidebar. Tab to a close button for its focus ring, or press Delete on a focused tab.')}\n </div>\n\n <div class=\"section\">\n <div class=\"section-title\">Closeable Tabs with Actions</div>\n <demo-closeable-tabs></demo-closeable-tabs>\n </div>\n\n <div class=\"section\">\n <div class=\"section-title\">Auto-hide Tabs</div>\n <demo-autohide-tabs></demo-autohide-tabs>\n </div>\n\n <div class=\"section\">\n <div class=\"section-title\">Vertical Tabs Layout</div>\n <div class=\"two-column\">\n <dees-appui-tabs .tabStyle=${'vertical'} .tabs=${verticalTabs}></dees-appui-tabs>\n ${demoContent('Vertical tabs work great for settings pages and navigation menus. The animated indicator smoothly transitions between selections.')}\n </div>\n </div>\n\n <div class=\"section\">\n <div class=\"section-title\">Without Indicator</div>\n <dees-appui-tabs .showTabIndicator=${false} .tabs=${noIndicatorTabs}></dees-appui-tabs>\n ${demoContent('Tabs can also be used without the animated indicator by setting showTabIndicator to false.')}\n </div>\n </div>\n `;\n};\n","/**\n * The keyboard behaviour every navigation list in the app UI group shares: one\n * Tab stop for the whole list, Arrow keys along its orientation, Home and End\n * to its ends. The rows themselves stay the element's own markup; this module\n * only decides which row is reachable and where the focus goes.\n */\n\nexport type TRovingOrientation = 'vertical' | 'horizontal';\n\n/**\n * The index a roving list moves to for a key, or `null` when the key means\n * nothing to it. A negative `currentIndex` (nothing focused yet) enters the\n * list at the end the key comes from.\n */\nexport const nextRovingIndex = (\n key: string,\n currentIndex: number,\n count: number,\n orientation: TRovingOrientation,\n): number | null => {\n if (count <= 0) return null;\n if (key === 'Home') return 0;\n if (key === 'End') return count - 1;\n const forward = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';\n const backward = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';\n if (key !== forward && key !== backward) return null;\n if (currentIndex < 0) return key === forward ? 0 : count - 1;\n return (currentIndex + (key === forward ? 1 : -1) + count) % count;\n};\n\n/**\n * A row takes part while it is enabled, rendered and outside an inert subtree,\n * so a collapsed group, a hidden overflow menu and a disabled row are skipped\n * without the element having to model them a second time.\n */\nconst isReachable = (row: HTMLElement): boolean =>\n !row.matches(':disabled, [aria-disabled=\"true\"]')\n && !row.closest('[inert]')\n && row.getClientRects().length > 0;\n\nexport interface IRovingRingOptions {\n /** The element whose shadow root holds the rows. */\n host: HTMLElement;\n /** Selector matching every row of the ring, in DOM order. */\n selector: string;\n orientation: TRovingOrientation;\n /**\n * The row that owns the Tab stop while the reader has not moved inside the\n * ring yet — normally the selected one. Without it the first row owns it.\n */\n activeRow?: (rows: HTMLElement[]) => HTMLElement | null;\n}\n\n/**\n * One roving Tab stop over the rows a selector matches. The element calls\n * `sync()` after every render and `handleKeydown()` from the list's keydown\n * listener; `reset()` hands the Tab stop back to the selected row after the\n * selection changed.\n */\nexport class RovingRing {\n private visitedRow: HTMLElement | null = null;\n\n constructor(private readonly options: IRovingRingOptions) {}\n\n /** The rows a reader can reach right now, in DOM order. */\n public rows(): HTMLElement[] {\n const root = this.options.host.shadowRoot;\n if (!root) return [];\n return [...root.querySelectorAll<HTMLElement>(this.options.selector)].filter(isReachable);\n }\n\n /** Give the Tab stop back to the row the element considers active. */\n public reset(): void {\n this.visitedRow = null;\n }\n\n /** Put the single Tab stop on the visited row, else on the active one. */\n public sync(): void {\n const rows = this.rows();\n if (rows.length === 0) {\n this.visitedRow = null;\n return;\n }\n if (this.visitedRow && !rows.includes(this.visitedRow)) this.visitedRow = null;\n const stop = this.visitedRow ?? this.options.activeRow?.(rows) ?? rows[0];\n for (const row of rows) row.tabIndex = row === stop ? 0 : -1;\n }\n\n /**\n * Moves the focus for a navigation key that started on one of the rows.\n * Returns whether the key was consumed, so the caller can keep handling its\n * own keys.\n */\n public handleKeydown(event: KeyboardEvent): boolean {\n const rows = this.rows();\n const current = this.indexOfEventRow(event, rows);\n if (current < 0) return false;\n const next = nextRovingIndex(event.key, current, rows.length, this.options.orientation);\n if (next === null) return false;\n event.preventDefault();\n this.focusRow(rows[next], rows);\n return true;\n }\n\n /** Move the focus and the Tab stop to one row the ring holds. */\n public focus(row: HTMLElement): void {\n this.focusRow(row, this.rows());\n }\n\n private indexOfEventRow(event: KeyboardEvent, rows: HTMLElement[]): number {\n for (const node of event.composedPath()) {\n const index = rows.indexOf(node as HTMLElement);\n if (index >= 0) return index;\n }\n return -1;\n }\n\n private focusRow(row: HTMLElement, rows: HTMLElement[]): void {\n this.visitedRow = row;\n for (const candidate of rows) candidate.tabIndex = candidate === row ? 0 : -1;\n row.focus();\n }\n}\n","import type { IAppuiLabels } from '../interfaces/appuilabels.js';\nimport { dcMessages, type TDcLocalizer, type TDcMessages } from '../../i18n/messages.js';\nimport type * as smarti18n from '@push.rocks/smarti18n';\n\n/** A label field that is a word: every field of `IAppuiLabels` but its `locale`. */\nexport type TAppuiLabelKey = Exclude<keyof IAppuiLabels, 'locale'>;\n\n/**\n * Every word field of `IAppuiLabels`. Each one is the catalog message\n * `appui.<field>` of `dcMessages`; the compiler checks that each has one.\n */\nexport const appuiLabelKeys = [\n 'skipLink', 'viewAnnouncement', 'compactNavigation', 'compactMainMenu', 'compactSections', 'compactClose',\n 'leaveHeading', 'leaveConfirm', 'leaveCancel', 'linkInvalid', 'linkForeign', 'linkUnavailable', 'loadingBar',\n 'loadError', 'retry', 'resizeSecondary', 'resizeActivity', 'resizeAssistant', 'resizeReset', 'sidePanel',\n 'showActivity', 'showAssistant', 'closeSidePanel', 'assistantTitle',\n 'paletteName', 'palettePlaceholder', 'paletteResults', 'paletteEmpty', 'paletteViews', 'paletteMenu',\n 'paletteAccount', 'paletteSections', 'paletteTabs', 'paletteSidePanel', 'paletteCommands',\n 'appMenu', 'appMenuOverflow', 'breadcrumbs', 'search', 'account', 'accountMenu', 'activityToggle', 'assistantToggle',\n 'locationInput', 'locationTrail', 'locationParents', 'locationEdit', 'locationEditHint', 'locationCopy',\n 'locationCopyHint', 'locationCopied', 'locationCopiedHint', 'locationStopped', 'locationFailed', 'locationClipboard',\n 'mainNavigation', 'expandSidebar', 'collapseSidebar',\n 'sectionNavigation', 'sectionName', 'expandSection', 'collapseSection', 'confirmCancel',\n 'tabsName', 'closeTab', 'renameTab',\n 'trayName', 'trayToggle', 'trayKeep', 'trayRemove', 'trayEmpty', 'trayClose',\n 'activityTitle', 'activityCount', 'activityLive', 'activityClose', 'activityEmpty', 'activitySearch',\n 'activitySearchPlaceholder', 'today', 'yesterday', 'activityCopy', 'activityFilterUser', 'activityFilterType',\n 'activityClearFilters',\n] as const satisfies ReadonlyArray<TAppuiLabelKey>;\n\n/** Fails to compile while `appuiLabelKeys` misses a field of `IAppuiLabels`. */\ntype TEveryLabelListed = [Exclude<TAppuiLabelKey, (typeof appuiLabelKeys)[number]>] extends [never] ? true : never;\nconst everyLabelListed: TEveryLabelListed = true;\nvoid everyLabelListed;\n\n/**\n * The English the app UI speaks, the source words of `dcMessages`, as\n * labels. Components no longer read it: they speak the catalog in the\n * language of the provided `I18n`, and a label a host configures overrides\n * the catalog's word.\n */\nexport const appuiDefaultLabels: Readonly<IAppuiLabels> = Object.freeze(\n Object.fromEntries(appuiLabelKeys.map((key) => [key, dcMessages.entries[`appui.${key}`].message])) as Record<TAppuiLabelKey, string>,\n);\n\n/**\n * The labels a configuration asks for, over the English defaults. A label it\n * leaves out, or sets to `undefined`, keeps its default.\n */\nexport const resolveAppuiLabels = (labels: Partial<IAppuiLabels> = {}): IAppuiLabels => ({\n ...appuiDefaultLabels,\n ...ownAppuiLabels(labels),\n});\n\n/** The labels a configuration sets, without the ones it sets to `undefined`. */\nexport const ownAppuiLabels = (labels: Partial<IAppuiLabels> = {}): Partial<IAppuiLabels> =>\n Object.fromEntries(Object.entries(labels).filter(([, value]) => value !== undefined));\n\n/**\n * A pattern label with its placeholders filled in: `{view}` becomes\n * `values.view`. A placeholder without a value stays as written, so a\n * misspelt one shows up instead of vanishing.\n */\nexport const formatAppuiLabel = (pattern: string, values: Record<string, string>): string =>\n pattern.replace(/\\{(\\w+)\\}/g, (placeholder, name: string) => values[name] ?? placeholder);\n\n/** The values a label's message takes: `{ view }` for `loadError`, none for `skipLink`. */\ntype TAppuiLabelValues<K extends TAppuiLabelKey> = smarti18n.TMessageParams<TDcMessages[`appui.${K}`]>;\n\n/**\n * A part's words: `word('skipLink')`, `word('loadError', { view })`. The\n * host's label when it configured one, its placeholders filled in; else the\n * catalog's message in the language the part speaks.\n */\nexport interface IAppuiWords {\n <K extends TAppuiLabelKey>(\n key: K,\n ...values: keyof TAppuiLabelValues<K> extends never ? [] : [TAppuiLabelValues<K>]\n ): string;\n}\n\n/**\n * The words of an app UI part: its `localize` translator and its configured\n * labels, read at the time a word is asked for, so in `render()`.\n */\nexport const appuiWords = (t: TDcLocalizer, labels: () => Partial<IAppuiLabels>): IAppuiWords =>\n // `values` is typed per key by `IAppuiWords`. A host's label fills its\n // placeholders with text; the catalog's message takes the values as they\n // are, so a number reaches a `{count, plural, …}` as a number.\n (key: TAppuiLabelKey, values?: unknown): string => {\n const given = typeof values === 'object' && values !== null ? values : undefined;\n const own = labels()[key];\n if (own !== undefined) {\n return given\n ? formatAppuiLabel(own, Object.fromEntries(Object.entries(given).map(([name, value]) => [name, String(value)])))\n : own;\n }\n const message: `appui.${TAppuiLabelKey}` = `appui.${key}`;\n return given ? t(message, given) : t(message);\n };\n\n/** The labels `dees-appui-location` reads. */\nexport type TAppuiLocationLabels = Pick<\n IAppuiLabels,\n | 'locationInput'\n | 'locationTrail'\n | 'locationParents'\n | 'locationEdit'\n | 'locationEditHint'\n | 'locationCopy'\n | 'locationCopyHint'\n | 'locationCopied'\n | 'locationCopiedHint'\n | 'locationStopped'\n | 'locationFailed'\n | 'locationClipboard'\n>;\n\n/** The labels `dees-appui-profiledropdown` reads. */\nexport type TAppuiProfileDropdownLabels = Pick<IAppuiLabels, 'accountMenu'>;\n\n/** The labels `dees-appui-appbar` reads, with those of the location field and the account menu it shows. */\nexport type TAppuiAppbarLabels = Pick<\n IAppuiLabels,\n 'appMenu' | 'appMenuOverflow' | 'breadcrumbs' | 'search' | 'account' | 'activityToggle' | 'assistantToggle'\n> & TAppuiLocationLabels & TAppuiProfileDropdownLabels;\n\n/** The labels `dees-appui-mainmenu` reads. */\nexport type TAppuiMainmenuLabels = Pick<IAppuiLabels, 'mainNavigation' | 'expandSidebar' | 'collapseSidebar'>;\n\n/** The labels `dees-appui-secondarymenu` reads. */\nexport type TAppuiSecondarymenuLabels = Pick<\n IAppuiLabels,\n 'sectionNavigation' | 'sectionName' | 'expandSection' | 'collapseSection' | 'confirmCancel'\n>;\n\n/** The labels `dees-appui-tabs` reads, and `dees-appui-maincontent` hands to its tab bar. */\nexport type TAppuiTabsLabels = Pick<IAppuiLabels, 'tabsName' | 'closeTab' | 'renameTab'>;\n\n/** The labels `dees-appui-tray` reads. */\nexport type TAppuiTrayLabels = Pick<IAppuiLabels, 'trayName' | 'trayKeep' | 'trayRemove' | 'trayEmpty' | 'trayClose'>;\n\n/** The labels `dees-appui-activitylog` reads, its locale included. */\nexport type TAppuiActivitylogLabels = Pick<\n IAppuiLabels,\n | 'locale'\n | 'activityTitle'\n | 'activityCount'\n | 'activityLive'\n | 'activityClose'\n | 'activityEmpty'\n | 'activitySearch'\n | 'activitySearchPlaceholder'\n | 'today'\n | 'yesterday'\n | 'activityCopy'\n | 'activityFilterUser'\n | 'activityFilterType'\n | 'activityClearFilters'\n>;\n\n/** The labels `dees-appui-commandpalette` reads. The shell names the groups it hands over itself. */\nexport type TAppuiCommandpaletteLabels = Pick<\n IAppuiLabels,\n 'paletteName' | 'palettePlaceholder' | 'paletteResults' | 'paletteEmpty'\n>;\n","import * as interfaces from '../../interfaces/index.js';\n\nimport {\n DeesElement,\n type TemplateResult,\n property,\n state,\n customElement,\n html,\n css,\n cssManager,\n} from '@design.estate/dees-element';\n\nimport * as domtools from '@design.estate/dees-domtools';\nimport { demoFunc } from './dees-appui-tabs.demo.js';\nimport { themeDefaultStyles } from '../../00theme.js';\nimport { prefersReducedMotion } from '../../00motion.js';\nimport { OverlayScrollbarController, overlayScrollbarStyles } from '../../00scrollbars.js';\nimport { badgeTone } from '../../00group-feedback/dees-badge/dees-badge.js';\nimport { DeesContextmenu } from '../../00group-overlay/dees-contextmenu/dees-contextmenu.js';\nimport { nextRovingIndex } from '../appui.roving.js';\nimport { appuiWords, type TAppuiTabsLabels } from '../appui.labels.js';\nimport { dcLocalize } from '../../../i18n/localize.js';\n\n@customElement('dees-appui-tabs')\nexport class DeesAppuiTabs extends DeesElement {\n public static demo = demoFunc;\n public static demoGroups = ['App UI'];\n\n // INSTANCE\n @property({\n type: Array,\n })\n accessor tabs: interfaces.IMenuItem[] = [];\n\n @property({ type: Object })\n accessor selectedTab: interfaces.IMenuItem | null = null;\n\n @property({ type: Boolean, reflect: true })\n accessor showTabIndicator: boolean = true;\n\n @property({ type: String, reflect: true })\n accessor tabStyle: 'horizontal' | 'vertical' = 'horizontal';\n\n /** Flat navigation rows for a tab list embedded in a sidebar. */\n @property({ type: String, reflect: true })\n accessor appearance: 'default' | 'sidebar' = 'default';\n\n @property({ type: Boolean, reflect: true })\n accessor autoHide: boolean = false;\n\n @property({ type: Number, reflect: true })\n accessor autoHideThreshold: number = 0;\n\n @property({ type: Array })\n accessor actionsLeft: interfaces.ITabAction[] = [];\n\n @property({ type: Array })\n accessor actionsRight: interfaces.ITabAction[] = [];\n\n /**\n * The id of the panel these tabs control, for a panel that shares this\n * element's root. An IDREF cannot cross a shadow boundary, so a panel rendered\n * by another element is named through `controlsElement` instead.\n */\n @property({ type: String, reflect: true })\n accessor controls: string = '';\n\n /** The panel element these tabs control, wherever in the page it lives. */\n @property({ attribute: false })\n accessor controlsElement: HTMLElement | undefined = undefined;\n\n /**\n * Words the host says its own way, over the catalog's words in the\n * language of the provided `I18n` (English without one); `dees-appui`\n * passes its configured labels.\n */\n @property({ attribute: false })\n accessor labels: Partial<TAppuiTabsLabels> = {};\n\n private readonly t = dcLocalize(this);\n private readonly word = appuiWords(this.t, () => this.labels);\n\n // Scroll state for fade indicators\n @state()\n private accessor canScrollLeft: boolean = false;\n\n @state()\n private accessor canScrollRight: boolean = false;\n\n private resizeObserver: ResizeObserver | null = null;\n\n /** The horizontal strip's scrollbar, shown while it scrolls. */\n private readonly scrollbars = new OverlayScrollbarController(\n this,\n () => this.shadowRoot?.querySelector<HTMLElement>('.tabsContainer.horizontal'),\n );\n private renaming = false;\n\n public static styles = [\n themeDefaultStyles,\n cssManager.defaultStyles,\n overlayScrollbarStyles,\n css`\n @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }\n\n :host {\n display: block;\n position: relative;\n width: 100%;\n min-width: 0;\n overflow: hidden;\n }\n\n .tabs-wrapper {\n position: relative;\n min-width: 0;\n }\n\n .tabs-wrapper.horizontal-wrapper {\n height: var(--dees-appui-row-height);\n background: var(--dees-appui-chrome-bg);\n border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);\n box-sizing: border-box;\n overflow: hidden;\n display: flex;\n align-items: stretch;\n }\n\n /* Scroll fade indicators */\n .scroll-fade {\n position: absolute;\n top: 0;\n bottom: 1px;\n width: 20px;\n pointer-events: none;\n opacity: 0;\n transition: opacity var(--dees-transition-default) var(--dees-ease-standard);\n z-index: 10;\n }\n\n .scroll-fade-left {\n left: 0;\n background: linear-gradient(to right,\n var(--dees-appui-chrome-bg) 0%,\n transparent 100%);\n }\n\n .scroll-fade-right {\n right: 0;\n background: linear-gradient(to left,\n var(--dees-appui-chrome-bg) 0%,\n transparent 100%);\n }\n\n .scroll-fade.visible {\n opacity: 1;\n }\n\n /* The strip's scrollbar draws over the fades at its ends. */\n .scroll-area > .overlayScrollbar {\n z-index: 11;\n }\n\n .scroll-area {\n position: relative;\n flex: 1;\n min-width: 0;\n overflow: hidden;\n display: flex;\n }\n\n /* Tab action buttons */\n .tab-actions {\n display: flex;\n align-items: center;\n gap: var(--dees-spacing-2xs);\n flex-shrink: 0;\n padding: 0 4px;\n }\n\n .tab-actions.left {\n padding-left: 12px;\n padding-right: 8px;\n }\n\n .tab-actions.right {\n padding-right: 12px;\n padding-left: 8px;\n }\n\n .tab-action-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n border-radius: 6px;\n cursor: pointer;\n transition: background var(--dees-transition-fast) var(--dees-ease-standard), color var(--dees-transition-fast) var(--dees-ease-standard);\n background: transparent;\n color: var(--dees-color-text-muted);\n flex-shrink: 0;\n }\n\n .tab-action-button:hover {\n background: var(--dees-color-active);\n color: var(--dees-color-text-primary);\n }\n\n .tab-action-button:active {\n background: var(--dees-color-pressed);\n }\n\n .tab-action-button.disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .tab-action-button.disabled:hover {\n background: transparent;\n color: var(--dees-color-text-muted);\n }\n\n .tab-action-button dees-icon {\n font-size: var(--dees-icon-size-md);\n }\n\n .tabsContainer {\n position: relative;\n user-select: none;\n min-width: 0;\n }\n\n .tabsContainer.horizontal {\n display: flex;\n align-items: center;\n font-size: var(--dees-tabs-font-size, var(--dees-font-control-size));\n overflow-x: auto;\n overflow-y: hidden;\n overscroll-behavior: contain;\n height: 100%;\n width: 100%;\n padding: 4px 12px 0;\n gap: 4px;\n }\n\n .tabsContainer.vertical {\n display: flex;\n flex-direction: column;\n padding: 8px;\n font-size: var(--dees-tabs-font-size, 14px);\n gap: var(--dees-spacing-2xs);\n position: relative;\n background: var(--dees-tabs-vertical-bg, var(--dees-color-fill-secondary));\n border-radius: var(--dees-radius-md);\n }\n\n .tab {\n color: var(--dees-color-text-secondary);\n white-space: nowrap;\n cursor: pointer;\n transition: color var(--dees-transition-fast) var(--dees-ease-standard);\n font-weight: 500;\n position: relative;\n z-index: 2;\n }\n\n /* A long label ends in an ellipsis at the tab's max width; the full\n label stays in the tab's title and accessible name. */\n .horizontal .tab {\n padding: 0 12px;\n height: 28px;\n flex-shrink: 0;\n max-width: var(--dees-tabs-max-width, 240px);\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n gap: 8px;\n position: relative;\n border-radius: var(--dees-radius-md);\n corner-shape: var(--dees-corner-shape);\n transition: background-color var(--dees-transition-fast) var(--dees-ease-standard);\n }\n \n\n \n .horizontal .tab .tab-content {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n }\n\n .vertical .tab {\n padding: 10px 16px;\n border-radius: 6px;\n width: 100%;\n display: flex;\n align-items: center;\n gap: 8px;\n transition: color var(--dees-transition-fast) var(--dees-ease-standard), background var(--dees-transition-fast) var(--dees-ease-standard);\n }\n\n .tab:hover {\n color: var(--dees-color-text-primary);\n }\n \n .horizontal .tab:hover {\n background: var(--dees-color-hover);\n }\n \n .horizontal .tab:hover::after,\n .horizontal .tab:hover + .tab::after {\n opacity: 0;\n }\n\n .vertical .tab:hover {\n background: color-mix(in srgb, var(--dees-color-badge-default-bg) 50%, transparent);\n }\n\n .horizontal .tab.selectedTab {\n color: var(--dees-color-text-primary);\n }\n \n .horizontal .tab.selectedTab::after,\n .horizontal .tab.selectedTab + .tab::after {\n opacity: 0;\n }\n\n .vertical .tab.selectedTab {\n color: var(--dees-color-text-primary);\n }\n\n .tab dees-icon {\n font-size: var(--dees-icon-size-md);\n }\n\n .vertical-wrapper {\n position: relative;\n }\n\n /* The selection surface belongs to its tab, including while scrolling,\n resizing or loading fonts; no measured overlay or layout timers. */\n .tab.has-indicator, .tab.has-indicator:hover {\n background: var(--dees-appui-tab-selected-bg);\n box-shadow: var(--dees-shadow-xs);\n color: var(--dees-color-text-primary);\n }\n\n button { font: inherit; border: 0; background: transparent; color: inherit; cursor: pointer; }\n button:focus-visible { outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring); outline-offset: -2px; }\n .tab-select { display: flex; align-items: center; gap: 8px; align-self: stretch; padding: 0; flex: 1; text-align: left; }\n .tabsContainer { font: 13px var(--dees-font-family); }\n .tab-content { display: flex; align-items: center; gap: 8px; }\n .tab-select, .tab-content, .tab-label { min-width: 0; }\n .tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .tab-content dees-icon, .tab-content dees-badge { flex-shrink: 0; }\n :host([appearance='sidebar']) .tabsContainer.vertical { padding: 4px 6px; gap: var(--dees-spacing-2xs); background: transparent; border-radius: 0; }\n :host([appearance='sidebar']) .vertical .tab { min-height: 30px; padding: 0 8px; gap: 4px; border-radius: var(--dees-radius-sm); }\n :host([appearance='sidebar']) .vertical .tab.has-indicator { background: var(--dees-color-sidebar-selection); color: var(--dees-color-text-primary); box-shadow: none; }\n :host([appearance='sidebar']) .vertical .tab dees-icon { font-size: var(--dees-icon-size-sm); }\n /* Close button. The button is the hit area; a span inside it draws the\n 20px circle (a pseudo-element would draw the same, but a touch near\n the edge of the hit area then goes to a neighbouring target). Towards\n the label the circle keeps the tab's own gap; towards the end it keeps\n what puts the glyph (inset 6px in the circle) as far from the tab's\n end as the label is from the tab's start. For a mouse the hit area\n runs from the label to the tab's end and over the tab's full height. */\n @media not (pointer: coarse) {\n .tabsContainer .tab.closeable,\n :host([appearance='sidebar']) .vertical .tab.closeable {\n padding-inline-end: 0;\n column-gap: 0;\n }\n }\n\n .tab-close {\n --tab-close-start: 8px;\n --tab-close-end: 6px;\n flex: none;\n align-self: stretch;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: calc(var(--tab-close-start) + 20px + var(--tab-close-end));\n padding: 0;\n padding-inline: var(--tab-close-start) var(--tab-close-end);\n color: var(--dees-color-text-muted);\n transition: color var(--dees-transition-fast) var(--dees-ease-standard);\n }\n\n /* Over the vertical tab's block padding, so the row keeps its height. */\n .vertical .tab-close {\n --tab-close-end: 10px;\n margin-block: -10px;\n }\n\n /* Two pixels from the row's end would crowd the circle; it keeps the gap. */\n :host([appearance='sidebar']) .vertical .tab-close {\n --tab-close-start: 4px;\n --tab-close-end: 4px;\n margin-block: 0;\n }\n\n .tab-close-circle {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n transition: background-color var(--dees-transition-fast) var(--dees-ease-standard);\n }\n\n .tab:hover .tab-close,\n .tab.selectedTab .tab-close {\n color: var(--dees-color-text-secondary);\n }\n\n .tab.selectedTab:hover .tab-close,\n .tab .tab-close:hover,\n .tab .tab-close:focus-visible {\n color: var(--dees-color-text-primary);\n }\n\n .tab-close:hover .tab-close-circle {\n background: var(--dees-color-active);\n }\n\n .tab-close:active .tab-close-circle {\n background: var(--dees-color-pressed);\n }\n\n /* The ring goes round the circle, not the hit area. */\n .tab-close:focus-visible {\n outline: none;\n }\n\n .tab-close:focus-visible .tab-close-circle {\n outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);\n }\n\n /* The browser moves a touch onto the best of the targets around it, so\n on a touch screen the 44px target keeps its distance from the label\n and the tab's end, and the circle sits in its middle. */\n @media (pointer: coarse) {\n .tab-close, .tab-action-button { min-width: var(--dees-control-height-touch); min-height: var(--dees-control-height-touch); }\n .tab-select { min-height: var(--dees-control-height-touch); }\n .horizontal .tab { height: var(--dees-control-height-touch); }\n .tabsContainer.horizontal { padding-block: 0; }\n .tabsContainer .tab-close {\n --tab-close-start: 0px;\n --tab-close-end: 0px;\n margin-block: 0;\n margin-inline-start: 8px;\n }\n :host([appearance='sidebar']) .vertical .tab-close {\n --tab-close-start: 0px;\n --tab-close-end: 0px;\n margin-inline-start: 0;\n }\n }\n `,\n ];\n\n public render(): TemplateResult {\n // Auto-hide when enabled and tab count is at or below threshold\n if (this.autoHide && this.tabs.length <= this.autoHideThreshold) {\n return html``;\n }\n return html`\n ${this.renderTabsWrapper()}\n `;\n }\n\n private renderTabsWrapper(): TemplateResult {\n const isHorizontal = this.tabStyle === 'horizontal';\n const wrapperClass = isHorizontal ? 'tabs-wrapper horizontal-wrapper' : 'vertical-wrapper';\n const containerClass = `tabsContainer ${this.tabStyle}`;\n\n if (isHorizontal) {\n const hasLeftActions = this.actionsLeft && this.actionsLeft.length > 0;\n const hasRightActions = this.actionsRight && this.actionsRight.length > 0;\n\n return html`\n <div class=\"${wrapperClass}\">\n ${hasLeftActions ? this.renderActions(this.actionsLeft, 'left') : ''}\n <div class=\"scroll-area\">\n <div class=\"scroll-fade scroll-fade-left ${this.canScrollLeft ? 'visible' : ''}\"></div>\n <div role=\"tablist\" aria-label=${this.word('tabsName')} aria-orientation=${this.tabStyle} class=\"${containerClass}\" @scroll=${this.handleScroll}>\n ${this.tabs.map(tab => this.renderTab(tab, isHorizontal))}\n </div>\n <div class=\"scroll-fade scroll-fade-right ${this.canScrollRight ? 'visible' : ''}\"></div>\n </div>\n ${hasRightActions ? this.renderActions(this.actionsRight, 'right') : ''}\n </div>\n `;\n }\n\n return html`\n <div class=\"${wrapperClass}\">\n <div role=\"tablist\" aria-label=${this.word('tabsName')} aria-orientation=${this.tabStyle} class=\"${containerClass}\">\n ${this.tabs.map(tab => this.renderTab(tab, isHorizontal))}\n </div>\n </div>\n `;\n }\n\n private renderActions(actions: interfaces.ITabAction[], position: 'left' | 'right'): TemplateResult {\n return html`<div class=\"tab-actions ${position}\">${actions.map(action => html`\n <button type=\"button\" class=\"tab-action-button ${action.disabled ? 'disabled' : ''}\" ?disabled=${action.disabled}\n aria-label=${action.tooltip || action.id} title=${action.tooltip || action.id} @click=${() => action.action()}>\n <dees-icon .icon=${action.iconName}></dees-icon>\n </button>`)}</div>`;\n }\n\n private renderTab(tab: interfaces.IMenuItem, _isHorizontal: boolean): TemplateResult {\n const isSelected = this.isTabSelected(tab);\n const label = tab.label ?? tab.key;\n return html`<div class=\"tab ${tab.closeable ? 'closeable' : ''} ${isSelected ? 'selectedTab' : ''} ${isSelected && this.showTabIndicator ? 'has-indicator' : ''}\" role=\"presentation\">\n <button type=\"button\" class=\"tab-select\" role=\"tab\" title=${label} aria-selected=${isSelected} tabindex=${isSelected ? 0 : -1}\n @dblclick=${() => this.renameTab(tab)} @contextmenu=${(event: MouseEvent) => this.openRenameMenu(event, tab)}\n @keydown=${(event: KeyboardEvent) => this.handleTabKey(event, tab)} @click=${() => this.selectTab(tab)}>\n <span class=\"tab-content\">${this.renderTabIcon(tab)}<span class=\"tab-label\">${label}</span>${tab.badge !== undefined ? html`<dees-badge .text=${String(tab.badge)} .tone=${badgeTone(tab.badgeVariant)}></dees-badge>` : ''}</span>\n </button>\n ${tab.closeable ? html`<button type=\"button\" class=\"tab-close\" aria-label=${this.word('closeTab', { name: label })} @click=${(event: Event) => this.closeTab(event, tab)}>\n <span class=\"tab-close-circle\"><dees-icon icon=\"lucide:X\" .iconSize=${14}></dees-icon></span></button>` : ''}\n </div>`;\n }\n\n private handleTabKey(event: KeyboardEvent, tab: interfaces.IMenuItem) {\n if (event.key === 'F2' && tab.onRename) { event.preventDefault(); void this.renameTab(tab); return; }\n if (tab.onRename && (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10'))) {\n event.preventDefault();\n const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n void this.openRenameMenu(new MouseEvent('contextmenu', { clientX: rect.left, clientY: rect.bottom }), tab);\n return;\n }\n if (event.key === 'Delete' && tab.closeable) { event.preventDefault(); this.closeTab(event, tab); return; }\n const target = nextRovingIndex(\n event.key,\n this.tabs.indexOf(tab),\n this.tabs.length,\n this.tabStyle === 'horizontal' ? 'horizontal' : 'vertical',\n );\n if (target === null) return;\n event.preventDefault();\n this.shadowRoot!.querySelectorAll<HTMLButtonElement>('.tab-select')[target]?.focus();\n }\n\n private async renameTab(tab: interfaces.IMenuItem) {\n if (!tab.onRename || this.renaming) return;\n this.renaming = true;\n try { await tab.onRename(); } finally { this.renaming = false; }\n await this.updateComplete;\n const index = this.tabs.findIndex(item => item.key === tab.key);\n this.shadowRoot?.querySelectorAll<HTMLButtonElement>('.tab-select')[index]?.focus();\n }\n\n private async openRenameMenu(event: MouseEvent, tab: interfaces.IMenuItem) {\n if (!tab.onRename) return;\n event.preventDefault(); event.stopPropagation();\n await DeesContextmenu.openContextMenuWithOptions(event, [{\n name: this.word('renameTab'), iconName: 'lucide:pencil', action: async () => { await this.renameTab(tab); },\n }], { i18n: this.t.i18n });\n }\n\n private renderTabIcon(tab: interfaces.IMenuItem): TemplateResult | '' {\n return tab.iconName ? html`<dees-icon .icon=${tab.iconName}></dees-icon>` : '';\n }\n\n /**\n * The stable identity of a tab descriptor. `key` is the documented\n * identifier; `label` is the fallback for descriptors that carry only a\n * display name.\n */\n private tabKey(tabArg: interfaces.IMenuItem | null | undefined): string | undefined {\n return tabArg ? (tabArg.key ?? tabArg.label) : undefined;\n }\n\n /** The current descriptor for a selection, matched by key rather than by object identity. */\n private findTabByKey(tabArg: interfaces.IMenuItem | null): interfaces.IMenuItem | undefined {\n const key = this.tabKey(tabArg);\n if (key === undefined) return this.tabs.find((tab) => tab === tabArg);\n return this.tabs.find((tab) => this.tabKey(tab) === key);\n }\n\n private isTabSelected(tabArg: interfaces.IMenuItem): boolean {\n if (!this.selectedTab) return false;\n if (tabArg === this.selectedTab) return true;\n const key = this.tabKey(tabArg);\n return key !== undefined && key === this.tabKey(this.selectedTab);\n }\n\n private selectTab(tabArg: interfaces.IMenuItem) {\n // A new selection scrolls into view once it renders (updated()); the selected tab again, at once.\n if (tabArg === this.selectedTab) this.scrollTabIntoView(tabArg);\n this.selectedTab = tabArg;\n tabArg.action();\n\n // Emit tab-select event\n this.dispatchEvent(new CustomEvent('tab-select', {\n detail: { tab: tabArg },\n bubbles: true,\n composed: true\n }));\n }\n\n private async closeTab(e: Event, tab: interfaces.IMenuItem) {\n const index = this.tabs.indexOf(tab);\n e.stopPropagation(); // Don't select tab when closing\n\n // Call the tab's onClose callback if defined\n if (tab.onClose) {\n tab.onClose();\n }\n\n // Also emit event for parent components\n this.dispatchEvent(new CustomEvent('tab-close', {\n detail: { tab },\n bubbles: true,\n composed: true\n }));\n await this.updateComplete;\n const buttons = this.shadowRoot!.querySelectorAll<HTMLButtonElement>('.tab-select');\n buttons[Math.min(index, buttons.length - 1)]?.focus();\n }\n\n firstUpdated() {\n // Tab selection is handled by updated() lifecycle\n this.setupResizeObserver();\n\n requestAnimationFrame(() => {\n this.updateScrollState();\n });\n }\n\n async disconnectedCallback() {\n await super.disconnectedCallback();\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n }\n\n private setupResizeObserver() {\n if (this.tabStyle !== 'horizontal') return;\n\n this.resizeObserver = new ResizeObserver(() => {\n this.updateScrollState();\n });\n\n const container = this.shadowRoot?.querySelector('.tabsContainer.horizontal');\n if (container) {\n this.resizeObserver.observe(container);\n }\n }\n\n private handleScroll = () => {\n this.updateScrollState();\n };\n\n private updateScrollState() {\n const container = this.shadowRoot?.querySelector('.tabsContainer.horizontal') as HTMLElement;\n if (!container) return;\n\n const scrollLeft = container.scrollLeft;\n const scrollWidth = container.scrollWidth;\n const clientWidth = container.clientWidth;\n\n // Small threshold to account for rounding\n const threshold = 2;\n\n this.canScrollLeft = scrollLeft > threshold;\n this.canScrollRight = scrollLeft < scrollWidth - clientWidth - threshold;\n }\n\n /**\n * Scroll the strip, and only the strip, the least distance that shows the tab whole and clear of\n * the scroll fades at its ends (at once under reduced motion). A tab already in view stays put.\n */\n private scrollTabIntoView(tab: interfaces.IMenuItem) {\n if (this.tabStyle !== 'horizontal') return;\n\n const current = this.findTabByKey(tab);\n const tabIndex = current ? this.tabs.indexOf(current) : -1;\n if (tabIndex === -1) return;\n\n const container = this.shadowRoot?.querySelector('.tabsContainer.horizontal') as HTMLElement;\n const tabElement = container?.querySelector(`.tab:nth-child(${tabIndex + 1})`) as HTMLElement;\n if (!tabElement || !container) return;\n\n const view = container.getBoundingClientRect();\n const rect = tabElement.getBoundingClientRect();\n // The fades are 20px wide; a tab too wide to clear both shows from its start.\n const clearance = Math.min(20, Math.max(0, (view.width - rect.width) / 2));\n let distance = 0;\n if (rect.left < view.left + clearance || rect.width > view.width) distance = rect.left - view.left - clearance;\n else if (rect.right > view.right - clearance) distance = rect.right - view.right + clearance;\n if (Math.abs(distance) < 1) return;\n container.scrollTo({ left: container.scrollLeft + distance, behavior: prefersReducedMotion() ? 'auto' : 'smooth' });\n }\n\n /**\n * A host that binds a literal `.tabs=${[...]}` hands us new descriptor\n * objects on every render. The selection follows the descriptor key, so the\n * open view survives a rerender; adopting the fresh object here keeps index\n * lookups (close, scroll-into-view) working without re-running the action.\n */\n public willUpdate(changedProperties: Map<PropertyKey, unknown>) {\n super.willUpdate(changedProperties);\n if (!changedProperties.has('tabs') || !this.selectedTab) return;\n const current = this.findTabByKey(this.selectedTab);\n if (current && current !== this.selectedTab) this.selectedTab = current;\n }\n\n /**\n * Point every tab at the panel it controls. `controlsElement` is the form that\n * works across shadow roots, where an `aria-controls` IDREF does not resolve;\n * `controls` is the IDREF for a panel that shares this element's root.\n */\n private syncPanelRelation(): void {\n for (const button of this.shadowRoot?.querySelectorAll<HTMLElement>('.tab-select') ?? []) {\n if (this.controlsElement) {\n button.removeAttribute('aria-controls');\n button.ariaControlsElements = [this.controlsElement];\n } else if (this.controls) {\n button.ariaControlsElements = null;\n button.setAttribute('aria-controls', this.controls);\n } else {\n button.ariaControlsElements = null;\n button.removeAttribute('aria-controls');\n }\n }\n }\n\n async updated(changedProperties: Map<PropertyKey, unknown>) {\n super.updated(changedProperties);\n this.syncPanelRelation();\n\n if (changedProperties.has('tabs')) {\n if (!this.tabs || this.tabs.length === 0) {\n // Only a selection this element still held is reported as lost. A host\n // that emptied the list and the selection together gets no echo back.\n if (this.selectedTab) {\n this.selectedTab = null;\n this.dispatchEvent(new CustomEvent('tab-select', {\n detail: { tab: null },\n bubbles: true,\n composed: true,\n }));\n }\n } else if (this.selectedTab && !this.findTabByKey(this.selectedTab)) {\n // Selected tab was removed => select first available\n this.selectTab(this.tabs[0]);\n } else if (!this.selectedTab) {\n // Tabs exist but nothing selected => select first\n this.selectTab(this.tabs[0]);\n }\n }\n\n if (changedProperties.has('selectedTab') || changedProperties.has('tabs')) {\n await this.updateComplete;\n this.updateScrollState();\n // However the selection came — a click, the host's `selectedTab`, a new list — it shows whole.\n if (this.selectedTab && this.isConnected) this.scrollTabIntoView(this.selectedTab);\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'dees-appui-tabs': DeesAppuiTabs;\n }\n}\n","export const DEFAULT_EDITOR_ORIGIN = 'https://stackblitz.com';\nexport const SEARCH_PARAM_AUTH_CODE = 'code';\nexport const SEARCH_PARAM_ERROR = 'error';\nexport const SEARCH_PARAM_ERROR_DESCRIPTION = 'error_description';\nexport const BROADCAST_CHANNEL_NAME = '__wc_api_bc__';\nexport const STORAGE_TOKENS_NAME = '__wc_api_tokens__';\nexport const STORAGE_CODE_VERIFIER_NAME = '__wc_api_verifier__';\nexport const STORAGE_POPUP_NAME = '__wc_api_popup__';\n","export class TypedEventTarget {\n _bus = new EventTarget();\n listen(listener) {\n function wrappedListener(event) {\n listener(event.data);\n }\n this._bus.addEventListener('message', wrappedListener);\n return () => this._bus.removeEventListener('message', wrappedListener);\n }\n fireEvent(data) {\n this._bus.dispatchEvent(new MessageEvent('message', { data }));\n }\n}\n","import { STORAGE_TOKENS_NAME } from './constants.js';\nimport { TypedEventTarget } from './TypedEventTarget.js';\nconst IGNORED_ERROR = new Error();\nIGNORED_ERROR.stack = '';\nconst accessTokenChangedListeners = new TypedEventTarget();\n/**\n * @internal\n */\nexport class Tokens {\n origin;\n refresh;\n access;\n expires;\n _revoked = new AbortController();\n constructor(\n // editor origin that those tokens are bound to, mostly used for development\n origin, \n // token to use to get a new access token\n refresh, \n // token to provide to webcontainer\n access, \n // time in UTC when the token expires\n expires) {\n this.origin = origin;\n this.refresh = refresh;\n this.access = access;\n this.expires = expires;\n }\n async activate(onFailedRefresh) {\n if (this._revoked.signal.aborted) {\n throw new Error('Token revoked');\n }\n // if the access token expired we fetch a new one\n if (this.expires < Date.now()) {\n if (!(await this._fetchNewAccessToken())) {\n return false;\n }\n }\n this._sync();\n this._startRefreshTokensLoop(onFailedRefresh);\n return true;\n }\n async revoke(clientId, ignoreRevokeError) {\n this._revoked.abort();\n try {\n const response = await fetch(`${this.origin}/oauth/revoke`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: new URLSearchParams({ token: this.refresh, token_type_hint: 'refresh_token', client_id: clientId }),\n mode: 'cors',\n });\n if (!response.ok) {\n throw new Error(`Failed to logout`);\n }\n }\n catch (error) {\n if (!ignoreRevokeError) {\n throw error;\n }\n }\n clearTokensInStorage();\n }\n static fromStorage() {\n const savedTokens = readTokensFromStorage();\n if (!savedTokens) {\n return null;\n }\n return new Tokens(savedTokens.origin, savedTokens.refresh, savedTokens.access, savedTokens.expires);\n }\n static async fromAuthCode({ editorOrigin, clientId, codeVerifier, authCode, redirectUri, }) {\n const response = await fetch(`${editorOrigin}/oauth/token`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: new URLSearchParams({\n client_id: clientId,\n code: authCode,\n code_verifier: codeVerifier,\n grant_type: 'authorization_code',\n redirect_uri: redirectUri,\n }),\n mode: 'cors',\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch token: ${response.status}`);\n }\n const tokenResponse = await response.json();\n assertTokenResponse(tokenResponse);\n const { access_token: access, refresh_token: refresh } = tokenResponse;\n const expires = getExpiresFromTokenResponse(tokenResponse);\n return new Tokens(editorOrigin, refresh, access, expires);\n }\n async _fetchNewAccessToken() {\n try {\n const response = await fetch(`${this.origin}/oauth/token`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: new URLSearchParams({\n grant_type: 'refresh_token',\n refresh_token: this.refresh,\n }),\n mode: 'cors',\n signal: this._revoked.signal,\n });\n if (!response.ok) {\n throw IGNORED_ERROR;\n }\n const tokenResponse = await response.json();\n assertTokenResponse(tokenResponse);\n const { access_token: access, refresh_token: refresh } = tokenResponse;\n const expires = getExpiresFromTokenResponse(tokenResponse);\n this.access = access;\n this.expires = expires;\n this.refresh = refresh;\n return true;\n }\n catch {\n clearTokensInStorage();\n return false;\n }\n }\n _sync() {\n persistTokensInStorage(this);\n fireAccessTokenChanged(this.access);\n }\n async _startRefreshTokensLoop(onFailedRefresh) {\n while (true) {\n const expiresIn = this.expires - Date.now() - 1000;\n await wait(Math.max(expiresIn, 1000));\n if (this._revoked.signal.aborted) {\n return;\n }\n if (!this._fetchNewAccessToken()) {\n onFailedRefresh();\n return;\n }\n this._sync();\n }\n }\n}\n/**\n * @internal\n */\nexport function clearTokensInStorage() {\n localStorage.removeItem(STORAGE_TOKENS_NAME);\n}\n/**\n * @internal\n */\nexport function addAccessTokenChangedListener(listener) {\n return accessTokenChangedListeners.listen(listener);\n}\nfunction readTokensFromStorage() {\n const serializedTokens = localStorage.getItem(STORAGE_TOKENS_NAME);\n if (!serializedTokens) {\n return null;\n }\n try {\n return JSON.parse(serializedTokens);\n }\n catch {\n return null;\n }\n}\nfunction persistTokensInStorage(tokens) {\n localStorage.setItem(STORAGE_TOKENS_NAME, JSON.stringify(tokens));\n}\nfunction getExpiresFromTokenResponse({ created_at, expires_in }) {\n return (created_at + expires_in) * 1000;\n}\nfunction assertTokenResponse(token) {\n if (typeof token !== 'object' || !token) {\n throw new Error('Invalid Token Response');\n }\n if (typeof token.access_token !== 'string' ||\n typeof token.refresh_token !== 'string' ||\n typeof token.created_at !== 'number' ||\n typeof token.expires_in !== 'number') {\n throw new Error('Invalid Token Response');\n }\n}\nfunction wait(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\nfunction fireAccessTokenChanged(accessToken) {\n accessTokenChangedListeners.fireEvent(accessToken);\n}\n","import { DEFAULT_EDITOR_ORIGIN } from './constants.js';\nconst params = {};\nlet editorOrigin = null;\nexport const iframeSettings = {\n get editorOrigin() {\n if (editorOrigin == null) {\n editorOrigin = new URL(globalThis.WEBCONTAINER_API_IFRAME_URL ?? DEFAULT_EDITOR_ORIGIN).origin;\n }\n return editorOrigin;\n },\n set editorOrigin(newOrigin) {\n editorOrigin = new URL(newOrigin).origin;\n },\n setQueryParam(key, value) {\n params[key] = value;\n },\n get url() {\n const url = new URL(this.editorOrigin);\n url.pathname = '/headless';\n for (const param in params) {\n url.searchParams.set(param, params[param]);\n }\n url.searchParams.set('version', \"1.6.1\");\n return url;\n },\n};\n","/**\n * Implementation of https://www.rfc-editor.org/rfc/rfc7636#section-4.2 that can\n * run in the browser.\n *\n * @internal\n *\n * @param input Code verifier.\n */\nexport async function S256(input) {\n // input here is assumed to match https://www.rfc-editor.org/rfc/rfc3986#section-2.3\n const ascii = new TextEncoder().encode(input);\n const sha256 = new Uint8Array(await crypto.subtle.digest('SHA-256', ascii));\n // base64url encode, based on https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem\n return btoa(sha256.reduce((binary, byte) => binary + String.fromCodePoint(byte), ''))\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n}\n/**\n * Implementation of https://www.rfc-editor.org/rfc/rfc7636#section-4.1 with\n * a slight deviation:\n *\n * - We use 128 characters (it's expected to be between 43 and 128)\n * - We use 64 characters instead of 66\n *\n * So the entropy is lower given the space size is 64^128 instead of 66^128.\n * It still satisfies the entropy constraint given that 64^128 > 66^43.\n *\n * @internal\n */\nexport function newCodeVerifier() {\n const random = new Uint8Array(96);\n crypto.getRandomValues(random);\n let codeVerifier = '';\n for (let i = 0; i < 32; ++i) {\n codeVerifier += nextFourChars(random[3 * i + 0], random[3 * i + 1], random[3 * i + 2]);\n }\n return codeVerifier;\n}\nfunction nextFourChars(byte1, byte2, byte3) {\n const char1 = byte1 >> 2;\n const char2 = ((byte1 & 3) << 4) | (byte2 >> 4);\n const char3 = (byte2 & 15) | ((byte3 & 192) >> 2);\n const char4 = byte3 & 63;\n return [char1, char2, char3, char4].map(unreservedCharacters).join('');\n}\nfunction unreservedCharacters(code) {\n let offset;\n if (code < 26) {\n offset = code + 65; // [A-Z]\n }\n else if (code < 52) {\n offset = code - 26 + 97; // [a-z]\n }\n else if (code < 62) {\n offset = code - 52 + 48; // [0-9]\n }\n else {\n offset = code === 62 ? 30 /* _ */ : 45 /* - */;\n }\n return String.fromCharCode(offset);\n}\n","/**\n * @internal\n */\nexport function resettablePromise() {\n let resolve;\n let promise;\n function reset() {\n promise = new Promise((_resolve) => (resolve = _resolve));\n }\n reset();\n return {\n get promise() {\n return promise;\n },\n resolve(value) {\n return resolve(value);\n },\n reset,\n };\n}\n","import { Tokens, clearTokensInStorage } from './tokens.js';\nimport { SEARCH_PARAM_AUTH_CODE, SEARCH_PARAM_ERROR, STORAGE_CODE_VERIFIER_NAME, BROADCAST_CHANNEL_NAME, STORAGE_POPUP_NAME, SEARCH_PARAM_ERROR_DESCRIPTION, } from './constants.js';\nimport { iframeSettings } from './iframe-url.js';\nimport { S256, newCodeVerifier } from './code.js';\nimport { resettablePromise } from './reset-promise.js';\nimport { TypedEventTarget } from './TypedEventTarget.js';\n/**\n * @internal\n */\nexport const authState = {\n initialized: false,\n bootCalled: false,\n authComplete: resettablePromise(),\n clientId: '',\n oauthScope: '',\n broadcastChannel: null,\n get editorOrigin() {\n return iframeSettings.editorOrigin;\n },\n tokens: null,\n};\nconst authFailedListeners = new TypedEventTarget();\nconst loggedOutListeners = new TypedEventTarget();\nfunction broadcastMessage(message) {\n if (!authState.broadcastChannel) {\n return;\n }\n authState.broadcastChannel.postMessage(message);\n // check if we are in a popup mode\n if (localStorage.getItem(STORAGE_POPUP_NAME) === 'true' && message.type !== 'auth-logout') {\n localStorage.removeItem(STORAGE_POPUP_NAME);\n // wait a tick to make sure the posted message has been sent\n setTimeout(() => {\n window.close();\n });\n }\n}\nexport const auth = {\n init({ editorOrigin, clientId, scope }) {\n if (authState.initialized) {\n throw new Error('Init should only be called once');\n }\n let enterprise = true;\n if (enterprise && authState.bootCalled) {\n throw new Error('`auth.init` should always be called before `WebContainer.boot`');\n }\n authState.initialized = true;\n authState.tokens = Tokens.fromStorage();\n authState.clientId = clientId;\n authState.oauthScope = scope;\n authState.broadcastChannel = new BroadcastChannel(BROADCAST_CHANNEL_NAME);\n // configure iframe url\n iframeSettings.setQueryParam('client_id', clientId);\n if (editorOrigin) {\n iframeSettings.editorOrigin = new URL(editorOrigin).origin;\n }\n loggedOutListeners.listen(() => authState.authComplete.reset());\n // if authentication or logout are done in another page, we want to reflect the state on this page as well\n authState.broadcastChannel.addEventListener('message', onChannelMessage);\n async function onChannelMessage(event) {\n const typedEvent = event.data;\n if (typedEvent.type === 'auth-complete') {\n authState.tokens = Tokens.fromStorage();\n // we ignore the possible error here because they can't have expired just yet\n await authState.tokens.activate(onFailedTokenRefresh);\n authState.authComplete.resolve();\n return;\n }\n if (typedEvent.type === 'auth-failed') {\n authFailedListeners.fireEvent(typedEvent);\n return;\n }\n if (typedEvent.type === 'auth-logout') {\n loggedOutListeners.fireEvent();\n return;\n }\n }\n if (authState.tokens) {\n const tokens = authState.tokens;\n if (tokens.origin === authState.editorOrigin) {\n /**\n * Here we assume that the refresh token never expires which\n * might not be correct. If that is the case though, we will\n * emit a 'logged-out' event to signal that the user has been\n * logged out, which could also happen at a later time anyway.\n *\n * Because this flow is done entirely locally, we do not broadcast\n * anything to the other tabs. They should be performing a similar\n * check.\n */\n (async () => {\n const success = await tokens.activate(onFailedTokenRefresh);\n if (!success) {\n // if we got new token in the meantime we discard this error\n if (authState.tokens !== tokens) {\n return;\n }\n loggedOutListeners.fireEvent();\n return;\n }\n authState.authComplete.resolve();\n })();\n return { status: 'authorized' };\n }\n clearTokensInStorage();\n authState.tokens = null;\n }\n const locationURL = new URL(window.location.href);\n const { searchParams } = locationURL;\n const updateURL = () => window.history.replaceState({}, document.title, locationURL);\n // check for errors first, aka the user declined the authorisation or stackblitz did\n if (searchParams.has(SEARCH_PARAM_ERROR)) {\n const error = searchParams.get(SEARCH_PARAM_ERROR);\n const description = searchParams.get(SEARCH_PARAM_ERROR_DESCRIPTION);\n searchParams.delete(SEARCH_PARAM_ERROR);\n searchParams.delete(SEARCH_PARAM_ERROR_DESCRIPTION);\n updateURL();\n broadcastMessage({ type: 'auth-failed', error, description });\n return { status: 'auth-failed', error, description };\n }\n // if there's an auth code\n if (searchParams.has(SEARCH_PARAM_AUTH_CODE)) {\n const authCode = searchParams.get(SEARCH_PARAM_AUTH_CODE);\n const editorOrigin = authState.editorOrigin;\n searchParams.delete(SEARCH_PARAM_AUTH_CODE);\n updateURL();\n const codeVerifier = localStorage.getItem(STORAGE_CODE_VERIFIER_NAME);\n if (!codeVerifier) {\n return { status: 'need-auth' };\n }\n localStorage.removeItem(STORAGE_CODE_VERIFIER_NAME);\n Tokens.fromAuthCode({\n editorOrigin,\n clientId: authState.clientId,\n authCode,\n codeVerifier,\n redirectUri: defaultRedirectUri(),\n })\n .then(async (tokens) => {\n authState.tokens = tokens;\n assertAuthTokens(authState.tokens);\n const success = await authState.tokens.activate(onFailedTokenRefresh);\n // if authentication failed we throw, and we'll mark auth as failed\n if (!success) {\n throw new Error();\n }\n authState.authComplete.resolve();\n broadcastMessage({ type: 'auth-complete' });\n })\n .catch((error) => {\n // this should never happen unless the rails app is now down for some reason?\n console.error(error);\n // treat it as a logged out event so that the user can retry to login\n loggedOutListeners.fireEvent();\n broadcastMessage({ type: 'auth-logout' });\n });\n return { status: 'authorized' };\n }\n return { status: 'need-auth' };\n },\n async startAuthFlow({ popup } = {}) {\n if (!authState.initialized) {\n throw new Error('auth.init must be called first');\n }\n if (popup) {\n localStorage.setItem(STORAGE_POPUP_NAME, 'true');\n const height = 500;\n const width = 620;\n const left = window.screenLeft + (window.outerWidth - width) / 2;\n const top = window.screenTop + (window.outerHeight - height) / 2;\n window.open(await generateOAuthRequest(), '_blank', `popup,width=${width},height=${height},left=${left},top=${top}`);\n }\n else {\n window.location.href = await generateOAuthRequest();\n }\n },\n async logout({ ignoreRevokeError } = {}) {\n await authState.tokens?.revoke(authState.clientId, ignoreRevokeError ?? false);\n loggedOutListeners.fireEvent();\n broadcastMessage({ type: 'auth-logout' });\n },\n loggedIn() {\n return authState.authComplete.promise;\n },\n on(event, listener) {\n switch (event) {\n case 'auth-failed': {\n return authFailedListeners.listen(listener);\n }\n case 'logged-out': {\n return loggedOutListeners.listen(listener);\n }\n default: {\n throw new Error(`Unsupported event type '${event}'.`);\n }\n }\n },\n};\nfunction onFailedTokenRefresh() {\n loggedOutListeners.fireEvent();\n broadcastMessage({ type: 'auth-logout' });\n}\nfunction defaultRedirectUri() {\n return window.location.href;\n}\nasync function generateOAuthRequest() {\n const codeVerifier = newCodeVerifier();\n localStorage.setItem(STORAGE_CODE_VERIFIER_NAME, codeVerifier);\n const codeChallenge = await S256(codeVerifier);\n const url = new URL('/oauth/authorize', authState.editorOrigin);\n const { searchParams } = url;\n searchParams.append('response_type', 'code');\n searchParams.append('client_id', authState.clientId);\n searchParams.append('redirect_uri', defaultRedirectUri());\n searchParams.append('scope', authState.oauthScope);\n searchParams.append('code_challenge', codeChallenge);\n searchParams.append('code_challenge_method', 'S256');\n return url.toString();\n}\n/**\n * @internal\n */\nexport function assertAuthTokens(tokens) {\n if (!tokens) {\n throw new Error('Oops! Tokens is not defined when it always should be.');\n }\n}\n","/**\n * This type is in a separate module so that localservice can import it\n * without bundling all the other webcontainer specific stuff.\n */\nexport var PreviewMessageType;\n(function (PreviewMessageType) {\n PreviewMessageType[\"UncaughtException\"] = \"PREVIEW_UNCAUGHT_EXCEPTION\";\n PreviewMessageType[\"UnhandledRejection\"] = \"PREVIEW_UNHANDLED_REJECTION\";\n PreviewMessageType[\"ConsoleError\"] = \"PREVIEW_CONSOLE_ERROR\";\n})(PreviewMessageType || (PreviewMessageType = {}));\n","var __defProp = Object.defineProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\n\n// dist/vendor/comlink.js\nvar comlink_exports = {};\n__export(comlink_exports, {\n createEndpoint: () => createEndpoint,\n expose: () => expose,\n proxy: () => proxy,\n proxyMarker: () => proxyMarker,\n releaseProxy: () => releaseProxy,\n transfer: () => transfer,\n transferHandlers: () => transferHandlers,\n windowEndpoint: () => windowEndpoint,\n wrap: () => wrap\n});\n\n// ../../node_modules/comlink/dist/esm/comlink.mjs\nvar proxyMarker = Symbol(\"Comlink.proxy\");\nvar createEndpoint = Symbol(\"Comlink.endpoint\");\nvar releaseProxy = Symbol(\"Comlink.releaseProxy\");\nvar throwMarker = Symbol(\"Comlink.thrown\");\nvar isObject = (val) => typeof val === \"object\" && val !== null || typeof val === \"function\";\nvar proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n }\n};\nvar throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack\n }\n };\n } else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n }\n};\nvar transferHandlers = /* @__PURE__ */ new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler]\n]);\nfunction expose(obj, ep = self) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj2, prop) => obj2[prop], obj);\n const rawValue = path.reduce((obj2, prop) => obj2[prop], obj);\n switch (type) {\n case 0:\n {\n returnValue = rawValue;\n }\n break;\n case 1:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case 2:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case 3:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case 4:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case 5:\n {\n returnValue = void 0;\n }\n break;\n }\n } catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue).catch((value) => {\n return { value, [throwMarker]: 0 };\n }).then((returnValue2) => {\n const [wireValue, transferables] = toWireValue(returnValue2);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === 5) {\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n }\n });\n });\n if (ep.start) {\n ep.start();\n }\n}\nfunction isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n}\nfunction closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n}\nfunction wrap(ep, target) {\n return createProxy(ep, [], target);\n}\nfunction throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n}\nfunction createProxy(ep, path = [], target = function() {\n}) {\n let isProxyReleased = false;\n const proxy2 = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n return requestResponseMessage(ep, {\n type: 5,\n path: path.map((p) => p.toString())\n }).then(() => {\n closeEndPoint(ep);\n isProxyReleased = true;\n });\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy2 };\n }\n const r = requestResponseMessage(ep, {\n type: 0,\n path: path.map((p) => p.toString())\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: 1,\n path: [...path, prop].map((p) => p.toString()),\n value\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: 4\n }).then(fromWireValue);\n }\n if (last === \"bind\") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: 2,\n path: path.map((p) => p.toString()),\n argumentList\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: 3,\n path: path.map((p) => p.toString()),\n argumentList\n }, transferables).then(fromWireValue);\n }\n });\n return proxy2;\n}\nfunction myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n}\nfunction processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\nvar transferCache = /* @__PURE__ */ new WeakMap();\nfunction transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n}\nfunction proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n}\nfunction windowEndpoint(w, context = self, targetOrigin = \"*\") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context)\n };\n}\nfunction toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: 3,\n name,\n value: serializedValue\n },\n transferables\n ];\n }\n }\n return [\n {\n type: 0,\n value\n },\n transferCache.get(value) || []\n ];\n}\nfunction fromWireValue(value) {\n switch (value.type) {\n case 3:\n return transferHandlers.get(value.name).deserialize(value.value);\n case 0:\n return value.value;\n }\n}\nfunction requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n ep.addEventListener(\"message\", function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener(\"message\", l);\n resolve(ev.data);\n });\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n}\nfunction generateUUID() {\n return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join(\"-\");\n}\nexport {\n comlink_exports as Comlink\n};\n","import { PreviewMessageType } from '../preview-message-types.js';\nconst PREVIEW_MESSAGE_TYPES = [\n PreviewMessageType.ConsoleError,\n PreviewMessageType.UncaughtException,\n PreviewMessageType.UnhandledRejection,\n];\nexport function isPreviewMessage(data) {\n if (data == null || typeof data !== 'object') {\n return false;\n }\n if (!('type' in data) || !PREVIEW_MESSAGE_TYPES.includes(data.type)) {\n return false;\n }\n return true;\n}\n","/**\n * @internal\n */\nexport function nullPrototype(source) {\n const prototype = Object.create(null);\n if (!source) {\n return prototype;\n }\n return Object.assign(prototype, source);\n}\n","import { nullPrototype } from './null-prototype.js';\nconst binaryDecoder = new TextDecoder('latin1');\n/**\n * @internal\n */\nexport function toInternalFileSystemTree(tree) {\n const newTree = { d: {} };\n for (const name of Object.keys(tree)) {\n const entry = tree[name];\n if ('file' in entry) {\n if ('symlink' in entry.file) {\n newTree.d[name] = { f: { l: entry.file.symlink } };\n continue;\n }\n const contents = entry.file.contents;\n const stringContents = typeof contents === 'string' ? contents : binaryDecoder.decode(contents);\n const binary = typeof contents === 'string' ? {} : { b: true };\n newTree.d[name] = { f: { c: stringContents, ...binary } };\n continue;\n }\n const newEntry = toInternalFileSystemTree(entry.directory);\n newTree.d[name] = newEntry;\n }\n return newTree;\n}\n/**\n * @internal\n */\nexport function toExternalFileSystemTree(tree) {\n const newTree = nullPrototype();\n if ('f' in tree) {\n throw new Error('It is not possible to export a single file in the JSON format.');\n }\n if ('d' in tree) {\n for (const name of Object.keys(tree.d)) {\n const entry = tree.d[name];\n if ('d' in entry) {\n newTree[name] = nullPrototype({\n directory: toExternalFileSystemTree(entry),\n });\n }\n else if ('f' in entry) {\n if ('c' in entry.f) {\n newTree[name] = nullPrototype({\n file: nullPrototype({\n contents: entry.f.b ? fromBinaryString(entry.f.c) : entry.f.c,\n }),\n });\n }\n else if ('l' in entry.f) {\n newTree[name] = nullPrototype({\n file: nullPrototype({\n symlink: entry.f.l,\n }),\n });\n }\n }\n }\n }\n return newTree;\n}\nfunction fromBinaryString(s) {\n const encoded = new Uint8Array(s.length);\n for (let i = 0; i < s.length; i++) {\n encoded[i] = s[i].charCodeAt(0);\n }\n return encoded;\n}\n","/**\n * The WebContainer Public API allows you build custom applications on top of an in-browser Node.js runtime.\n *\n * Its main entrypoint is the {@link WebContainer} class.\n *\n * @packageDocumentation\n */\nimport { authState, assertAuthTokens } from './internal/auth-state.js';\nimport { PreviewMessageType } from './preview-message-types.js';\nimport { Comlink } from './vendor/index.js';\nimport { auth as authImpl } from './internal/auth-state.js';\nimport { addAccessTokenChangedListener } from './internal/tokens.js';\nimport { iframeSettings } from './internal/iframe-url.js';\nimport { isPreviewMessage } from './utils.js';\nimport { toExternalFileSystemTree, toInternalFileSystemTree } from './utils/file-system.js';\nexport const auth = authImpl;\nexport { PreviewMessageType };\nexport * from './utils.js';\nlet bootPromise = null;\nlet cachedServerPromise = null;\nlet cachedBootOptions = {};\nconst decoder = new TextDecoder();\nconst encoder = new TextEncoder();\n/**\n * The main export of this library. An instance of `WebContainer` represents a runtime\n * ready to be used.\n */\nexport class WebContainer {\n _instance;\n _runtimeInfo;\n /**\n * Gives access to the underlying file system.\n */\n fs;\n /** @internal */\n static _instance = null;\n /** @internal */\n static _teardownPromise = null;\n _tornDown = false;\n _unsubscribeFromTokenChangedListener = () => { };\n /** @internal */\n constructor(\n /** @internal */\n _instance, fs, previewScript, \n /** @internal */\n _runtimeInfo) {\n this._instance = _instance;\n this._runtimeInfo = _runtimeInfo;\n this.fs = new FileSystemAPIClient(fs);\n // forward the credentials to webcontainer if needed\n if (authState.initialized) {\n this._unsubscribeFromTokenChangedListener = addAccessTokenChangedListener((accessToken) => {\n this._instance.setCredentials({ accessToken, editorOrigin: authState.editorOrigin });\n });\n (async () => {\n await authState.authComplete.promise;\n if (this._tornDown) {\n return;\n }\n assertAuthTokens(authState.tokens);\n await this._instance.setCredentials({\n accessToken: authState.tokens.access,\n editorOrigin: authState.editorOrigin,\n });\n })().catch((error) => {\n // print the error as this is likely a bug in webcontainer\n console.error(error);\n });\n }\n }\n async spawn(command, optionsOrArgs, options) {\n let args = [];\n if (Array.isArray(optionsOrArgs)) {\n args = optionsOrArgs;\n }\n else {\n options = optionsOrArgs;\n }\n let output = undefined;\n let outputStream = new ReadableStream();\n if (options?.output !== false) {\n const result = streamWithPush();\n output = result.push;\n outputStream = result.stream;\n }\n let stdout = undefined;\n let stdoutStream;\n let stderr = undefined;\n let stderrStream;\n const wrappedOutput = proxyListener(binaryListener(output));\n const wrappedStdout = proxyListener(binaryListener(stdout));\n const wrappedStderr = proxyListener(binaryListener(stderr));\n const process = await this._instance.run({\n command,\n args,\n cwd: options?.cwd,\n env: options?.env,\n terminal: options?.terminal,\n }, wrappedStdout, wrappedStderr, wrappedOutput);\n return new WebContainerProcessImpl(process, outputStream, stdoutStream, stderrStream);\n }\n async export(path, options) {\n const serializeOptions = {\n format: options?.format ?? 'json',\n includes: options?.includes,\n excludes: options?.excludes,\n external: true,\n };\n const result = await this._instance.serialize(path, serializeOptions);\n if (serializeOptions.format === 'json') {\n const data = JSON.parse(decoder.decode(result));\n return toExternalFileSystemTree(data);\n }\n return result;\n }\n on(event, listener) {\n if (event === 'preview-message') {\n const originalListener = listener;\n listener = ((message) => {\n if (isPreviewMessage(message)) {\n originalListener(message);\n }\n });\n }\n const { listener: wrapped, subscribe } = syncSubscription(listener);\n return subscribe(this._instance.on(event, Comlink.proxy(wrapped)));\n }\n /**\n * Mounts a tree of files into the filesystem. This can be specified as a tree object ({@link FileSystemTree})\n * or as a binary snapshot generated by [`@webcontainer/snapshot`](https://www.npmjs.com/package/@webcontainer/snapshot).\n *\n * @param snapshotOrTree - A tree of files, or a binary snapshot. Note that binary payloads will be transferred.\n * @param options.mountPoint - Specifies a nested path where the tree should be mounted.\n */\n mount(snapshotOrTree, options) {\n const payload = snapshotOrTree instanceof Uint8Array\n ? snapshotOrTree\n : snapshotOrTree instanceof ArrayBuffer\n ? new Uint8Array(snapshotOrTree)\n : encoder.encode(JSON.stringify(toInternalFileSystemTree(snapshotOrTree)));\n return this._instance.loadFiles(Comlink.transfer(payload, [payload.buffer]), {\n mountPoints: options?.mountPoint,\n });\n }\n /**\n * Set a custom script to be injected into all previews. When this function is called, every\n * future page reload will contain the provided script tag on all HTML responses.\n *\n * Note:\n *\n * When this function resolves, every preview reloaded _after_ will have the new script.\n * Existing preview have to be explicitely reloaded.\n *\n * To reload a preview you can use `reloadPreview`.\n *\n * @param scriptSrc Source for the script tag.\n * @param options Options to define which type of script this is.\n */\n setPreviewScript(scriptSrc, options) {\n return this._instance.setPreviewScript(scriptSrc, options);\n }\n /**\n * The default value of the `PATH` environment variable for processes started through {@link spawn}.\n */\n get path() {\n return this._runtimeInfo.path;\n }\n /**\n * The full path to the working directory (see {@link FileSystemAPI}).\n */\n get workdir() {\n return this._runtimeInfo.cwd;\n }\n /**\n * Destroys the WebContainer instance, turning it unusable, and releases its resources. After this,\n * a new WebContainer instance can be obtained by calling {@link WebContainer.boot | `boot`}.\n *\n * All entities derived from this instance (e.g. processes, the file system, etc.) also become unusable\n * after calling this method.\n */\n teardown() {\n if (this._tornDown) {\n throw new Error('WebContainer already torn down');\n }\n this._tornDown = true;\n this._unsubscribeFromTokenChangedListener();\n const teardownFn = async () => {\n try {\n await this.fs._teardown();\n await this._instance.teardown();\n }\n finally {\n this._instance[Comlink.releaseProxy]();\n if (WebContainer._instance === this) {\n WebContainer._instance = null;\n }\n }\n };\n WebContainer._teardownPromise = teardownFn();\n }\n /**\n * Boots a WebContainer. Only a single instance of WebContainer can be booted concurrently\n * (see {@link WebContainer.teardown | `teardown`}).\n *\n * Booting WebContainer is an expensive operation.\n */\n static async boot(options = {}) {\n await this._teardownPromise;\n WebContainer._teardownPromise = null;\n const { workdirName } = options;\n if (window.crossOriginIsolated && options.coep === 'none') {\n console.warn(`A Cross-Origin-Embedder-Policy header is required in cross origin isolated environments.\\nSet the 'coep' option to 'require-corp'.`);\n }\n if (workdirName?.includes('/') || workdirName === '..' || workdirName === '.') {\n throw new Error('workdirName should be a valid folder name');\n }\n // signal that boot was called to auth module as calling auth.init after boot is likely incorrect\n authState.bootCalled = true;\n // try to \"acquire the lock\", i.e. wait for any ongoing boot request to finish\n while (bootPromise) {\n await bootPromise;\n }\n if (WebContainer._instance) {\n throw new Error('Only a single WebContainer instance can be booted');\n }\n const instancePromise = unsynchronizedBoot(options);\n // the \"lock\" is a promise for the ongoing boot that never fails\n bootPromise = instancePromise.catch(() => { });\n try {\n const instance = await instancePromise;\n WebContainer._instance = instance;\n return instance;\n }\n finally {\n // release the \"lock\"\n bootPromise = null;\n }\n }\n}\n/**\n * Configure an API key to be used for this instance of WebContainer.\n *\n * @param key WebContainer API key.\n */\nexport function configureAPIKey(key) {\n if (authState.bootCalled) {\n throw new Error('`configureAPIKey` should always be called before `WebContainer.boot`');\n }\n iframeSettings.setQueryParam('client_id', key);\n}\nconst DIR_ENTRY_TYPE_FILE = 1;\nconst DIR_ENTRY_TYPE_DIR = 2;\n/**\n * @internal\n */\nclass DirEntImpl {\n name;\n _type;\n constructor(name, _type) {\n this.name = name;\n this._type = _type;\n }\n isFile() {\n return this._type === DIR_ENTRY_TYPE_FILE;\n }\n isDirectory() {\n return this._type === DIR_ENTRY_TYPE_DIR;\n }\n}\nclass FSWatcher {\n _apiClient;\n _path;\n _options;\n _listener;\n _wrappedListener;\n _watcher;\n _closed = false;\n constructor(_apiClient, _path, _options, _listener) {\n this._apiClient = _apiClient;\n this._path = _path;\n this._options = _options;\n this._listener = _listener;\n this._apiClient._watchers.add(this);\n this._wrappedListener = (event, filename) => {\n if (this._listener && !this._closed) {\n this._listener(event, filename);\n }\n };\n this._apiClient._fs\n .watch(this._path, this._options, proxyListener(this._wrappedListener))\n .then((_watcher) => {\n this._watcher = _watcher;\n if (this._closed) {\n return this._teardown();\n }\n return undefined;\n })\n .catch(console.error);\n }\n async close() {\n if (!this._closed) {\n this._closed = true;\n this._apiClient._watchers.delete(this);\n await this._teardown();\n }\n }\n /**\n * @internal\n */\n async _teardown() {\n await this._watcher?.close().finally(() => {\n this._watcher?.[Comlink.releaseProxy]();\n });\n }\n}\n/**\n * @internal\n */\nclass WebContainerProcessImpl {\n output;\n input;\n exit;\n _process;\n stdout;\n stderr;\n constructor(process, output, stdout, stderr) {\n this.output = output;\n this._process = process;\n this.input = new WritableStream({\n write: (data) => {\n // this promise is not supposed to fail anyway\n this._getProcess()\n ?.write(data)\n .catch(() => { });\n },\n });\n this.exit = this._onExit();\n this.stdout = stdout;\n this.stderr = stderr;\n }\n kill() {\n this._process?.kill();\n }\n resize(dimensions) {\n this._getProcess()?.resize(dimensions);\n }\n async _onExit() {\n try {\n return await this._process.onExit;\n }\n finally {\n this._process?.[Comlink.releaseProxy]();\n this._process = null;\n }\n }\n _getProcess() {\n if (this._process == null) {\n console.warn('This process already exited');\n }\n return this._process;\n }\n}\n/**\n * @internal\n */\nclass FileSystemAPIClient {\n _fs;\n _watchers = new Set([]);\n constructor(fs) {\n this._fs = fs;\n }\n rm(...args) {\n return this._fs.rm(...args);\n }\n async readFile(path, encoding) {\n return await this._fs.readFile(path, encoding);\n }\n async rename(oldPath, newPath) {\n return await this._fs.rename(oldPath, newPath);\n }\n async writeFile(path, data, options) {\n if (data instanceof Uint8Array) {\n const buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n data = Comlink.transfer(new Uint8Array(buffer), [buffer]);\n }\n await this._fs.writeFile(path, data, options);\n }\n async readdir(path, options) {\n const result = await this._fs.readdir(path, options);\n if (isStringArray(result)) {\n return result;\n }\n if (isTypedArrayCollection(result)) {\n return result;\n }\n const entries = result.map((entry) => new DirEntImpl(entry.name, entry['Symbol(type)']));\n return entries;\n }\n async mkdir(path, options) {\n return await this._fs.mkdir(path, options);\n }\n watch(path, options, listener) {\n if (typeof options === 'function') {\n listener = options;\n options = null;\n }\n return new FSWatcher(this, path, options, listener);\n }\n /**\n * @internal\n */\n async _teardown() {\n this._fs[Comlink.releaseProxy]();\n await Promise.all([...this._watchers].map((watcher) => watcher.close()));\n }\n}\nasync function unsynchronizedBoot(options) {\n const { serverPromise } = serverFactory(options);\n const server = await serverPromise;\n const instance = await server.build({\n host: window.location.host,\n version: \"1.6.1\",\n workdirName: options.workdirName,\n forwardPreviewErrors: options.forwardPreviewErrors,\n });\n const [fs, previewScript, runtimeInfo] = await Promise.all([\n instance.fs(),\n instance.previewScript(),\n instance.runtimeInfo(),\n ]);\n return new WebContainer(instance, fs, previewScript, runtimeInfo);\n}\nfunction binaryListener(listener) {\n if (listener == null) {\n return undefined;\n }\n return (data) => {\n if (data instanceof Uint8Array) {\n listener(decoder.decode(data));\n }\n else if (data == null) {\n listener(null);\n }\n };\n}\nfunction proxyListener(listener) {\n if (listener == null) {\n return undefined;\n }\n return Comlink.proxy(listener);\n}\nfunction serverFactory(options) {\n if (cachedServerPromise != null) {\n if (options.coep !== cachedBootOptions.coep) {\n console.warn(`Attempting to boot WebContainer with 'coep: ${options.coep}'`);\n console.warn(`First boot had 'coep: ${cachedBootOptions.coep}', new settings will not take effect!`);\n }\n return { serverPromise: cachedServerPromise };\n }\n if (options.coep) {\n iframeSettings.setQueryParam('coep', options.coep);\n }\n if (options.experimentalNode) {\n iframeSettings.setQueryParam('experimental_node', '1');\n }\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.setAttribute('allow', 'cross-origin-isolated');\n const url = iframeSettings.url;\n iframe.src = url.toString();\n const { origin } = url;\n cachedBootOptions = { ...options };\n cachedServerPromise = new Promise((resolve) => {\n const onMessage = (event) => {\n if (event.origin !== origin) {\n return;\n }\n const { data } = event;\n if (data.type === 'init') {\n resolve(Comlink.wrap(event.ports[0]));\n return;\n }\n if (data.type === 'warning') {\n console[data.level].call(console, data.message);\n return;\n }\n };\n window.addEventListener('message', onMessage);\n });\n document.body.insertBefore(iframe, null);\n return { serverPromise: cachedServerPromise };\n}\nfunction isStringArray(list) {\n return typeof list[0] === 'string';\n}\nfunction isTypedArrayCollection(list) {\n return list[0] instanceof Uint8Array;\n}\nfunction streamWithPush() {\n let controller = null;\n const stream = new ReadableStream({\n start(controller_) {\n controller = controller_;\n },\n });\n const push = (item) => {\n if (item != null) {\n controller?.enqueue(item);\n }\n else {\n controller?.close();\n controller = null;\n }\n };\n return { stream, push };\n}\nfunction syncSubscription(listener) {\n let stopped = false;\n let unsubscribe = () => { };\n const wrapped = ((...args) => {\n if (stopped) {\n return;\n }\n listener(...args);\n });\n return {\n subscribe(promise) {\n promise.then((unsubscribe_) => {\n unsubscribe = unsubscribe_;\n if (stopped) {\n unsubscribe();\n }\n });\n return () => {\n stopped = true;\n unsubscribe();\n };\n },\n listener: wrapped,\n };\n}\n","import * as webcontainer from '@tempfix/webcontainer__api';\nimport type {\n IExecutionEnvironment,\n IFileEntry,\n IFileWatcher,\n IProcessHandle,\n IProcessSpawnOptions,\n IShellCommand,\n} from '../interfaces/IExecutionEnvironment.js';\n\n/**\n * WebContainer-based execution environment.\n * Runs Node.js and shell commands in the browser using WebContainer API.\n */\nexport class WebContainerEnvironment implements IExecutionEnvironment {\n // Static shared state - WebContainer only allows ONE boot per page\n private static sharedContainer: webcontainer.WebContainer | null = null;\n private static bootPromise: Promise<webcontainer.WebContainer> | null = null;\n\n private _ready: boolean = false;\n\n public readonly type = 'webcontainer' as const;\n\n public get ready(): boolean {\n return this._ready;\n }\n\n private get container(): webcontainer.WebContainer | null {\n return WebContainerEnvironment.sharedContainer;\n }\n\n // ============ Lifecycle ============\n\n public async init(): Promise<void> {\n // Already initialized (this instance)\n if (this._ready && WebContainerEnvironment.sharedContainer) {\n return;\n }\n\n // If boot is in progress (by any instance), wait for it\n if (WebContainerEnvironment.bootPromise) {\n await WebContainerEnvironment.bootPromise;\n this._ready = true;\n return;\n }\n\n // If already booted by another instance, just mark ready\n if (WebContainerEnvironment.sharedContainer) {\n this._ready = true;\n return;\n }\n\n // Check if SharedArrayBuffer is available (required for WebContainer)\n if (typeof SharedArrayBuffer === 'undefined') {\n throw new Error(\n 'WebContainer requires SharedArrayBuffer which is not available. ' +\n 'Ensure your server sends these headers:\\n' +\n ' Cross-Origin-Opener-Policy: same-origin\\n' +\n ' Cross-Origin-Embedder-Policy: require-corp'\n );\n }\n\n // Start boot process\n WebContainerEnvironment.bootPromise = webcontainer.WebContainer.boot();\n\n try {\n WebContainerEnvironment.sharedContainer = await WebContainerEnvironment.bootPromise;\n this._ready = true;\n } catch (error) {\n // Reset promise on failure so retry is possible\n WebContainerEnvironment.bootPromise = null;\n throw error;\n }\n }\n\n public async destroy(): Promise<void> {\n if (WebContainerEnvironment.sharedContainer) {\n WebContainerEnvironment.sharedContainer.teardown();\n WebContainerEnvironment.sharedContainer = null;\n WebContainerEnvironment.bootPromise = null;\n this._ready = false;\n }\n }\n\n // ============ Filesystem Operations ============\n\n public async readFile(path: string): Promise<string> {\n this.ensureReady();\n return await this.container!.fs.readFile(path, 'utf-8');\n }\n\n public async writeFile(path: string, contents: string): Promise<void> {\n this.ensureReady();\n await this.container!.fs.writeFile(path, contents, 'utf-8');\n }\n\n public async readDir(path: string): Promise<IFileEntry[]> {\n this.ensureReady();\n const entries = await this.container!.fs.readdir(path, { withFileTypes: true });\n\n return entries.map((entry) => ({\n type: entry.isDirectory() ? 'directory' as const : 'file' as const,\n name: entry.name,\n path: path === '/' ? `/${entry.name}` : `${path}/${entry.name}`,\n }));\n }\n\n public async mkdir(path: string): Promise<void> {\n this.ensureReady();\n await this.container!.fs.mkdir(path, { recursive: true });\n }\n\n public async rm(path: string, options?: { recursive?: boolean }): Promise<void> {\n this.ensureReady();\n await this.container!.fs.rm(path, { recursive: options?.recursive ?? false });\n }\n\n public async exists(path: string): Promise<boolean> {\n this.ensureReady();\n try {\n await this.container!.fs.readFile(path);\n return true;\n } catch {\n try {\n await this.container!.fs.readdir(path);\n return true;\n } catch {\n return false;\n }\n }\n }\n\n public async rename(fromPath: string, toPath: string): Promise<void> {\n this.ensureReady();\n await this.container!.fs.rename(fromPath, toPath);\n }\n\n public watch(\n path: string,\n callback: (event: 'rename' | 'change', filename: string | null) => void,\n options?: { recursive?: boolean }\n ): IFileWatcher {\n this.ensureReady();\n const watcher = this.container!.fs.watch(\n path,\n { recursive: options?.recursive ?? false },\n callback as (event: 'rename' | 'change', filename: string | Uint8Array) => void\n );\n return {\n stop: () => watcher.close(),\n };\n }\n\n // ============ Process Execution ============\n\n public async spawn(\n command: string,\n args: string[] = [],\n options: IProcessSpawnOptions = {}\n ): Promise<IProcessHandle> {\n this.ensureReady();\n\n const process = await this.container!.spawn(command, args, options);\n\n return {\n output: process.output as unknown as ReadableStream<string>,\n input: process.input as unknown as { getWriter(): WritableStreamDefaultWriter<string> },\n exit: process.exit,\n kill: () => process.kill(),\n resize: (dimensions) => process.resize(dimensions),\n };\n }\n\n public getShellCommand(): IShellCommand {\n return {\n command: 'jsh',\n label: 'jsh',\n prompt: '~/',\n };\n }\n\n // ============ WebContainer-specific methods ============\n\n /**\n * Mount files into the virtual filesystem.\n * This is a WebContainer-specific operation.\n * @param files - File tree structure to mount\n */\n public async mount(files: webcontainer.FileSystemTree): Promise<void> {\n this.ensureReady();\n await this.container!.mount(files);\n }\n\n /**\n * Get the underlying WebContainer instance.\n * Use sparingly - prefer the interface methods.\n */\n public getContainer(): webcontainer.WebContainer {\n this.ensureReady();\n return this.container!;\n }\n\n // ============ Private Helpers ============\n\n private ensureReady(): void {\n if (!this._ready || !this.container) {\n throw new Error('WebContainerEnvironment not initialized. Call init() first.');\n }\n }\n}\n","import { html } from '@design.estate/dees-element';\nimport type { DeesActionbar } from './dees-actionbar.js';\n\nexport const demoFunc = () => {\n const getActionbar = (e: Event) => {\n const button = e.currentTarget as HTMLElement;\n const container = button.closest('.demo-container');\n return container?.querySelector('dees-actionbar') as DeesActionbar | null;\n };\n\n const showActionBar = async (e: Event) => {\n const actionbar = getActionbar(e);\n if (!actionbar) return;\n const result = await actionbar.show({\n message: 'File changed externally. Reload?',\n type: 'warning',\n icon: 'lucide:alertTriangle',\n actions: [\n { id: 'reload', label: 'Reload', primary: true },\n { id: 'ignore', label: 'Ignore' },\n ],\n timeout: { duration: 5000, defaultActionId: 'reload' },\n dismissible: true,\n });\n console.log('Action bar result:', result);\n };\n\n const showErrorBar = async (e: Event) => {\n const actionbar = getActionbar(e);\n if (!actionbar) return;\n const result = await actionbar.show({\n message: 'Process failed with exit code 1',\n type: 'error',\n icon: 'lucide:xCircle',\n actions: [\n { id: 'retry', label: 'Retry', primary: true },\n { id: 'dismiss', label: 'Dismiss' },\n ],\n timeout: { duration: 10000, defaultActionId: 'dismiss' },\n });\n console.log('Error bar result:', result);\n };\n\n const showQuestionBar = async (e: Event) => {\n const actionbar = getActionbar(e);\n if (!actionbar) return;\n const result = await actionbar.show({\n message: 'Save changes before closing?',\n type: 'question',\n icon: 'lucide:helpCircle',\n actions: [\n { id: 'save', label: 'Save', primary: true },\n { id: 'discard', label: 'Discard' },\n { id: 'cancel', label: 'Cancel' },\n ],\n });\n console.log('Question bar result:', result);\n };\n\n return html`\n <style>\n .demo-container {\n display: flex;\n flex-direction: column;\n height: 300px;\n border: 1px solid #333;\n border-radius: 8px;\n overflow: hidden;\n }\n .demo-content {\n flex: 1;\n padding: 16px;\n display: flex;\n gap: 8px;\n align-items: flex-start;\n }\n </style>\n <div class=\"demo-container\">\n <div class=\"demo-content\">\n <dees-button @click=${showActionBar}>Warning</dees-button>\n <dees-button @click=${showErrorBar}>Error</dees-button>\n <dees-button @click=${showQuestionBar}>Question</dees-button>\n </div>\n <dees-actionbar></dees-actionbar>\n </div>\n `;\n};\n","import {\n customElement,\n DeesElement,\n type TemplateResult,\n html,\n css,\n state,\n cssManager,\n} from '@design.estate/dees-element';\nimport { themeDefaultStyles } from '../../00theme.js';\nimport { WidthMotionController } from '../../00widthmotion.js';\nimport '../../00group-utility/dees-icon/dees-icon.js';\nimport type {\n IActionBarOptions,\n IActionBarResult,\n IActionBarQueueItem,\n IActionBarAction,\n} from './actionbar.interfaces.js';\nimport { demoFunc } from './dees-actionbar.demo.js';\nimport type { TDcLocalizer } from '../../../i18n/messages.js';\nimport { dcLocalize } from '../../../i18n/localize.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'dees-actionbar': DeesActionbar;\n }\n}\n\n/**\n * The `(Ns)` countdown the default action shows while the bar's timeout runs,\n * if one runs, with the seconds written as the reader's number format writes\n * them (`(5s)`, `(5 s)`).\n */\nconst countdownLabelOf = (\n barArg: IActionBarOptions | null,\n timeRemainingArg: number,\n formatsArg: TDcLocalizer['format'],\n): string | undefined =>\n barArg?.timeout && timeRemainingArg > 0\n ? `(${formatsArg.intlNumberFormat({ style: 'unit', unit: 'second', unitDisplay: 'narrow' }).format(Math.ceil(timeRemainingArg / 1000))})`\n : undefined;\n\n@customElement('dees-actionbar')\nexport class DeesActionbar extends DeesElement {\n private readonly t = dcLocalize(this);\n\n // STATIC\n public static demoGroups = ['Feedback', 'Overlay'];\n public static demo = demoFunc;\n\n // Queue of pending action bars\n private queue: IActionBarQueueItem[] = [];\n\n // Current active bar state\n @state() accessor currentBar: IActionBarOptions | null = null;\n @state() accessor timeRemaining: number = 0;\n @state() accessor progressPercent: number = 100;\n @state() accessor isVisible: boolean = false;\n\n // Timeout handling\n private timeoutInterval: ReturnType<typeof setInterval> | null = null;\n private currentResolve: ((result: IActionBarResult) => void) | null = null;\n\n /** the collapse of the bar that is leaving; its content is cleared once the collapse has played */\n private hideTimer: ReturnType<typeof setTimeout> | undefined = undefined;\n\n /** eases the default action's width as its countdown changes */\n private readonly countdownMotion = new WidthMotionController(this);\n\n public static styles = [\n themeDefaultStyles,\n cssManager.defaultStyles,\n css`\n :host {\n /* purple status accent (dark default, bright override below) */\n --actionbar-purple: hsl(270 70% 60%);\n display: block;\n }\n\n :host([gobright]) {\n --actionbar-purple: hsl(270 70% 50%);\n }\n\n .actionbar-item {\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease-out;\n background: var(--dees-color-bg-tertiary);\n border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-default);\n }\n\n :host(.visible) .actionbar-item {\n grid-template-rows: 1fr;\n }\n\n .actionbar-content {\n overflow: hidden;\n min-height: 0;\n opacity: 0;\n transition: opacity 0.2s ease-out;\n }\n\n :host(.visible) .actionbar-content {\n opacity: 1;\n }\n\n .progress-bar {\n height: 3px;\n background: color-mix(in srgb, var(--dees-color-text-primary) 9%, var(--dees-color-bg-primary));\n overflow: hidden;\n }\n\n .progress-bar-fill {\n height: 100%;\n background: var(--dees-color-accent-primary);\n transition: width 0.1s linear;\n }\n\n .progress-bar-fill.warning {\n background: var(--dees-color-accent-warning);\n }\n\n .progress-bar-fill.error {\n background: var(--dees-color-text-error);\n }\n\n .progress-bar-fill.question {\n background: var(--actionbar-purple);\n }\n\n .content {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n gap: 12px;\n min-height: 32px;\n }\n\n .message-section {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n }\n\n .message-icon {\n flex-shrink: 0;\n color: var(--dees-color-text-muted);\n }\n\n .message-icon.info {\n color: var(--dees-color-accent-primary);\n }\n\n .message-icon.warning {\n color: var(--dees-color-text-warning);\n }\n\n .message-icon.error {\n color: var(--dees-color-text-error);\n }\n\n .message-icon.question {\n color: var(--actionbar-purple);\n }\n\n .message-text {\n font-size: 13px;\n color: var(--dees-color-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .actions-section {\n display: flex;\n align-items: center;\n gap: 8px;\n flex-shrink: 0;\n }\n\n .action-button {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 4px 10px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 500;\n cursor: pointer;\n border: var(--dees-line-width-hairline) solid transparent;\n transition: all 0.15s ease;\n white-space: nowrap;\n }\n\n .action-button.secondary {\n background: transparent;\n color: var(--dees-color-text-secondary);\n border-color: var(--dees-color-border-strong);\n }\n\n .action-button.secondary:hover {\n background: color-mix(in srgb, var(--dees-color-text-primary) 8%, var(--dees-color-bg-primary));\n }\n\n .action-button.primary {\n background: var(--dees-color-accent-primary);\n color: white;\n }\n\n .action-button.primary:hover {\n background: color-mix(in srgb, var(--dees-color-accent-primary) 88%, var(--dees-color-text-primary));\n }\n\n .action-button.primary.warning {\n background: color-mix(in srgb, var(--dees-color-accent-warning) 92%, var(--dees-color-text-primary));\n }\n\n .action-button.primary.warning:hover {\n background: color-mix(in srgb, var(--dees-color-accent-warning) 82%, var(--dees-color-text-primary));\n }\n\n .action-button.primary.error {\n background: var(--dees-color-text-error);\n }\n\n .action-button.primary.error:hover {\n background: color-mix(in srgb, var(--dees-color-accent-error) 88%, var(--dees-color-text-primary));\n }\n\n .action-button.primary.question {\n background: color-mix(in srgb, var(--actionbar-purple) 92%, var(--dees-color-text-primary));\n }\n\n .action-button.primary.question:hover {\n background: color-mix(in srgb, var(--actionbar-purple) 82%, var(--dees-color-text-primary));\n }\n\n .countdown {\n font-size: 11px;\n opacity: 0.8;\n margin-left: var(--dees-spacing-2xs);\n }\n\n .dismiss-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 4px;\n cursor: pointer;\n color: var(--dees-color-text-muted);\n transition: all 0.15s ease;\n }\n\n .dismiss-button:hover {\n background: var(--dees-color-border-default);\n color: var(--dees-color-text-secondary);\n }\n `,\n ];\n\n /**\n * The default action's `(Ns)` countdown moves the button's width as a digit goes and when the\n * countdown ends, and the button eases between the two. A new bar is no countdown change: it\n * renders its buttons, which lit carries over from the bar before it, at their own widths, so a\n * motion still running on one of them lands.\n */\n public willUpdate(changedArg: Map<PropertyKey, unknown>): void {\n if (changedArg.has('currentBar')) {\n this.countdownMotion.land();\n return;\n }\n if (changedArg.has('timeRemaining')) {\n this.captureCountdownChange(changedArg.get('timeRemaining') as number);\n }\n }\n\n /** Hands the countdown's button to its width motion when the countdown on screen changes or ends. */\n private captureCountdownChange(previousRemainingArg: number): void {\n const shown = countdownLabelOf(this.currentBar, previousRemainingArg, this.t.format);\n if (shown === undefined || shown === countdownLabelOf(this.currentBar, this.timeRemaining, this.t.format)) {\n return;\n }\n const button = this.shadowRoot?.querySelector('.countdown')?.closest<HTMLElement>('.action-button');\n if (button) {\n this.countdownMotion.capture(button);\n }\n }\n\n public render(): TemplateResult {\n const bar = this.currentBar;\n const type = bar?.type || 'info';\n const countdown = countdownLabelOf(bar, this.timeRemaining, this.t.format);\n const hasTimeout = countdown !== undefined;\n\n // ALWAYS render wrapper - required for grid animation to work\n return html`\n <div class=\"actionbar-item\">\n <div class=\"actionbar-content\">\n ${bar ? html`\n ${hasTimeout ? html`\n <div class=\"progress-bar\">\n <div\n class=\"progress-bar-fill ${type}\"\n style=\"width: ${this.progressPercent}%\"\n ></div>\n </div>\n ` : ''}\n <div class=\"content\">\n <div class=\"message-section\">\n ${bar.icon ? html`\n <dees-icon\n class=\"message-icon ${type}\"\n .icon=${bar.icon}\n iconSize=\"16\"\n ></dees-icon>\n ` : ''}\n <span class=\"message-text\">${bar.message}</span>\n </div>\n <div class=\"actions-section\">\n ${bar.actions.map(action => this.renderActionButton(action, bar, countdown))}\n ${bar.dismissible ? html`\n <div\n class=\"dismiss-button\"\n @click=${() => this.handleDismiss()}\n title=${this.t('common.dismiss')}\n >\n <dees-icon .icon=${'lucide:x'} iconSize=\"14\"></dees-icon>\n </div>\n ` : ''}\n </div>\n </div>\n ` : ''}\n </div>\n </div>\n `;\n }\n\n private renderActionButton(\n action: IActionBarAction,\n bar: IActionBarOptions,\n countdownArg: string | undefined\n ): TemplateResult {\n const isPrimary = action.primary;\n const type = bar.type || 'info';\n const countdown = bar.timeout?.defaultActionId === action.id ? countdownArg : undefined;\n\n return html`\n <button\n class=\"action-button ${isPrimary ? `primary ${type}` : 'secondary'}\"\n @click=${() => this.handleAction(action.id, false)}\n >\n ${action.icon ? html`\n <dees-icon .icon=${action.icon} iconSize=\"12\"></dees-icon>\n ` : ''}\n <span>${action.label}</span>\n ${countdown ? html`\n <span class=\"countdown\">${countdown}</span>\n ` : ''}\n </button>\n `;\n }\n\n // ========== Public API ==========\n\n /**\n * Show an action bar with the given options.\n * Returns a promise that resolves when an action is taken.\n */\n public async show(options: IActionBarOptions): Promise<IActionBarResult> {\n return new Promise((resolve) => {\n // Add to queue\n this.queue.push({ options, resolve });\n\n // If no current bar, process queue\n if (!this.currentBar) {\n this.processQueue();\n }\n });\n }\n\n /**\n * Dismiss the current action bar without triggering any action.\n */\n public dismiss(): void {\n this.handleDismiss();\n }\n\n /**\n * Clear all pending action bars in the queue.\n */\n public clearQueue(): void {\n // Resolve all queued items with dismiss\n for (const item of this.queue) {\n item.resolve({ actionId: 'dismissed', timedOut: false });\n }\n this.queue = [];\n }\n\n // ========== Private Methods ==========\n\n /**\n * Hide the current actionbar with animation.\n * Removes visible class first to trigger CSS transition, then clears content after animation.\n * A bar shown in the meantime has waited in the queue behind the leaving one, and comes up now.\n */\n private hideCurrentBar(): void {\n // Remove visible class to start close animation\n this.classList.remove('visible');\n this.isVisible = false;\n\n // Clear content once the animation has played (200ms transition + buffer)\n clearTimeout(this.hideTimer);\n this.hideTimer = setTimeout(() => {\n this.finishCollapse();\n if (this.queue.length > 0) {\n this.processQueue();\n }\n }, 220);\n }\n\n /** Clears the bar that is leaving: it was answered as it left, and holds the actionbar no longer. */\n private finishCollapse(): void {\n clearTimeout(this.hideTimer);\n this.hideTimer = undefined;\n this.currentBar = null;\n this.currentResolve = null;\n }\n\n private async processQueue(): Promise<void> {\n // Off the page no bar comes up: its countdown would run out where nobody sees it and answer\n // for the reader. No collapse plays there either, so the answered bar's collapse finishes at\n // once, and the queue waits for `connectedCallback`.\n if (!this.isConnected) {\n this.hideCurrentBar();\n this.finishCollapse();\n return;\n }\n\n if (this.queue.length === 0) {\n this.hideCurrentBar();\n return;\n }\n\n // A bar that takes over from one still leaving keeps the actionbar open: the leaving bar's\n // collapse must not clear it.\n clearTimeout(this.hideTimer);\n this.hideTimer = undefined;\n\n const item = this.queue.shift()!;\n this.currentBar = item.options;\n this.currentResolve = item.resolve;\n this.isVisible = true;\n\n // The countdown starts with the bar, so its first render shows the bar's own full count, not\n // the count the bar before it stopped at.\n if (item.options.timeout) {\n this.startTimeout(item.options.timeout.duration, item.options.timeout.defaultActionId);\n }\n\n // Wait for Lit render, then add class on next frame to trigger animation\n await this.updateComplete;\n requestAnimationFrame(() => {\n this.classList.add('visible');\n });\n }\n\n private startTimeout(duration: number, defaultActionId: string): void {\n this.timeRemaining = duration;\n this.progressPercent = 100;\n\n const startTime = Date.now();\n const updateInterval = 50; // Update every 50ms for smooth animation\n\n this.timeoutInterval = setInterval(() => {\n const elapsed = Date.now() - startTime;\n this.timeRemaining = Math.max(0, duration - elapsed);\n this.progressPercent = (this.timeRemaining / duration) * 100;\n\n if (this.timeRemaining <= 0) {\n this.clearTimeoutInterval();\n this.handleAction(defaultActionId, true);\n }\n }, updateInterval);\n }\n\n private clearTimeoutInterval(): void {\n if (this.timeoutInterval) {\n clearInterval(this.timeoutInterval);\n this.timeoutInterval = null;\n }\n }\n\n private handleAction(actionId: string, timedOut: boolean): void {\n this.clearTimeoutInterval();\n\n if (this.currentResolve) {\n this.currentResolve({ actionId, timedOut });\n }\n\n // Process next item in queue\n this.processQueue();\n }\n\n private handleDismiss(): void {\n this.handleAction('dismissed', false);\n }\n\n /**\n * A bar that waited while the actionbar was off the page, shown to it there or queued when it\n * left, comes up once it is on the page, with its own full countdown. It comes up as soon as the\n * base class has connected the element, not after the base class's asynchronous setup, which a\n * quick disconnect could overtake.\n */\n public async connectedCallback(): Promise<void> {\n const connected = super.connectedCallback();\n if (!this.currentBar && this.queue.length > 0) {\n this.processQueue();\n }\n await connected;\n }\n\n /**\n * Leaving the page stops the countdown on screen and finishes a collapse in progress on the spot,\n * without bringing up the bar waiting behind it: a countdown nobody sees would answer for the\n * reader when it ran out. The waiting bar comes up with `connectedCallback`. Both happen at once\n * rather than after the base class's asynchronous cleanup, which a move outruns by connecting\n * the actionbar again first: a late stop would cut the countdown of the bar it brings up.\n */\n public async disconnectedCallback(): Promise<void> {\n this.clearTimeoutInterval();\n if (this.hideTimer !== undefined) {\n this.finishCollapse();\n }\n await super.disconnectedCallback();\n }\n}\n","import { html } from '@design.estate/dees-element';\nimport { demoPage } from '../../../demos/templates.js';\nimport type { ITerminalResizeDetail } from './dees-terminal-view.js';\n\n// A serialized terminal state as a host would receive it on reattach, e.g. from xterm's\n// serialize addon: styled rows at the grid the PTY had when it was taken.\nconst sampleSnapshotSize: ITerminalResizeDetail = { cols: 64, rows: 12 };\nconst samplePrompt = '\\x1b[1;32m➜\\x1b[0m \\x1b[36mdees-catalog\\x1b[0m ';\nconst sampleSnapshot = [\n `${samplePrompt}pnpm build`,\n '\\x1b[2mtsbuild \\x1b[0m compiled the web folder',\n '\\x1b[2mtsbundle\\x1b[0m wrote dist_bundle/bundle.js',\n '',\n `${samplePrompt}pnpm test`,\n ' \\x1b[32m✔\\x1b[0m restore() sizes, parses, fits and reveals',\n ' \\x1b[32m✔\\x1b[0m writes during a restore follow the snapshot',\n ' \\x1b[32m✔\\x1b[0m a newer restore supersedes an older one',\n '',\n samplePrompt,\n].join('\\r\\n');\n\nconst restoreSample = (event: Event): void => {\n const view = (event.currentTarget as HTMLElement)\n .closest('.terminalDemoStack')\n ?.querySelector('dees-terminal-view');\n if (!view) return;\n // A click handler's promise is dropped by the DOM, so both outcomes are settled here: leaving\n // the demo page mid-restore rejects, and nobody would be left to observe it.\n view.restore(sampleSnapshot, sampleSnapshotSize).then(\n () => view.focus(),\n () => undefined,\n );\n};\n\n// A loopback demo: keystrokes echo straight back into the terminal so the\n// component is explorable without a live PTY behind it.\nexport const demoFunc = () => demoPage('Terminal', 'A terminal surface with local keyboard echo. Type to try the input and resize behavior, or restore a serialized snapshot: it is painted invisibly at its own grid and appears fitted, in one step.', html`\n <style>\n .terminalDemo {\n height: 380px;\n border: 1px solid var(--dees-color-border-default);\n border-radius: var(--dees-radius-xl);\n overflow: hidden;\n }\n </style>\n <div class=\"terminalDemoStack dees-demo-stack\">\n <div class=\"dees-demo-row\">\n <dees-button @clicked=${restoreSample}>Restore a snapshot</dees-button>\n </div>\n <div class=\"terminalDemo\">\n <dees-terminal-view\n @terminal-input=${(event: CustomEvent<{ data: string }>) => {\n const view = event.currentTarget as HTMLElementTagNameMap['dees-terminal-view'];\n const data = event.detail.data;\n view.write(data === '\\r' ? '\\r\\n' : data);\n }}\n @terminal-resize=${(event: CustomEvent<ITerminalResizeDetail>) => {\n console.log('terminal size', event.detail);\n }}\n ></dees-terminal-view>\n </div>\n </div>\n`);\n","import { css, type CSSResult } from '@design.estate/dees-element';\n\n/**\n * xterm.js' stylesheet — the catalog's single copy of it.\n *\n * xterm renders into the element `open()` was called on, so in this catalog\n * every node it creates lives inside a component's shadow root, where a\n * document-level sheet never reaches. Each terminal surface therefore puts this\n * CSSResult into its own `static styles`; no component fetches or injects a\n * stylesheet of its own. Since 6.0 that is the whole story: the DOM renderer's\n * width cache measures inside the terminal's own helper container, so xterm\n * adds nothing to `document.body` and the page needs no rule of ours.\n *\n * Derived from @xterm/xterm 6.0.0 (`node_modules/@xterm/xterm/css/xterm.css`),\n * the version pinned in `ts_web/services/versions.ts` — MIT, Copyright (c) 2014\n * The xterm.js authors, Copyright (c) 2012-2013 Christopher Jeffrey. The\n * scrollbar block is xterm's own port of the VS Code scrollable element.\n * Re-derive this file whenever that pin moves: the rules track xterm's own DOM.\n *\n * Deliberate deviations from upstream, and nothing else:\n * - Ligatures are switched off on the grid. xterm joins ligature glyphs only\n * with its ligatures addon, which the catalog does not load, so a host whose\n * mono font has them would otherwise break cell alignment.\n * - The viewport background and the composition view take the terminal tokens\n * (`--dees-color-terminal-bg` / `-fg`, the CSS side of `terminalTheme()`)\n * instead of upstream's black on white. xterm paints the live grid background\n * on its scrollable element from the theme, so these are what shows around it\n * and before the first paint.\n * - The slider's fade is a courtesy, not information, so it is off under\n * prefers-reduced-motion like every other motion in the catalog.\n * - Two upstream rule groups are left out because the nodes they style cannot\n * exist here: `> .scrollbar > .scra` (xterm's port throws on scrollbar\n * arrows) and the five `> .shadow` rules (xterm builds its scrollable element\n * with `useShadows: false`, and their `--vscode-scrollbar-shadow` hook has no\n * place in a themed catalog).\n * The slider colours themselves are not CSS: xterm writes them into the shadow\n * root from `ITheme`, so they live in `terminalTheme()` with the rest of the\n * palette. Upstream's `outline: none` on a focused terminal is kept: xterm's own\n * outline sits on the grid element, and `dees-terminal-view` flashes the house\n * focus ring around the whole surface instead when the focus arrives from the\n * keyboard or the window returns to a focused terminal.\n */\nexport const xtermStyles: CSSResult = css`\n .xterm {\n cursor: text;\n position: relative;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n font-feature-settings: 'liga' 0;\n }\n\n .xterm.focus,\n .xterm:focus {\n outline: none;\n }\n\n .xterm .xterm-helpers {\n position: absolute;\n top: 0;\n /* Above the rows, so an IME appears on top of them. */\n z-index: 5;\n }\n\n .xterm .xterm-helper-textarea {\n padding: 0;\n border: 0;\n margin: 0;\n /* Off-screen, so the real caret stays invisible. */\n position: absolute;\n opacity: 0;\n left: -9999em;\n top: 0;\n width: 0;\n height: 0;\n z-index: -5;\n white-space: nowrap;\n overflow: hidden;\n resize: none;\n }\n\n .xterm .composition-view {\n background: var(--dees-color-terminal-bg);\n color: var(--dees-color-terminal-fg);\n display: none;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n }\n\n .xterm .composition-view.active {\n display: block;\n }\n\n .xterm .xterm-viewport {\n background-color: var(--dees-color-terminal-bg);\n overflow-y: scroll;\n cursor: default;\n position: absolute;\n right: 0;\n left: 0;\n top: 0;\n bottom: 0;\n }\n\n .xterm .xterm-screen {\n position: relative;\n }\n\n .xterm .xterm-screen canvas {\n position: absolute;\n left: 0;\n top: 0;\n }\n\n .xterm-char-measure-element {\n display: inline-block;\n visibility: hidden;\n position: absolute;\n top: 0;\n left: -9999em;\n line-height: normal;\n }\n\n .xterm.enable-mouse-events {\n /* An application that tracks the mouse gets the standard pointer. */\n cursor: default;\n }\n\n .xterm.xterm-cursor-pointer,\n .xterm .xterm-cursor-pointer {\n cursor: pointer;\n }\n\n .xterm.column-select.focus {\n cursor: crosshair;\n }\n\n .xterm .xterm-accessibility:not(.debug),\n .xterm .xterm-message {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10;\n color: transparent;\n pointer-events: none;\n }\n\n .xterm .xterm-accessibility-tree:not(.debug) *::selection {\n color: transparent;\n }\n\n .xterm .xterm-accessibility-tree {\n font-family: monospace;\n user-select: text;\n white-space: pre;\n }\n\n .xterm .xterm-accessibility-tree > div {\n transform-origin: left;\n width: fit-content;\n }\n\n .xterm .live-region {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n }\n\n .xterm-dim {\n /* Dim is encoded in the foreground colour xterm generates, so the element\n itself stays fully opaque; its background must not fade with it. */\n opacity: 1 !important;\n }\n\n .xterm-underline-1 { text-decoration: underline; }\n .xterm-underline-2 { text-decoration: double underline; }\n .xterm-underline-3 { text-decoration: wavy underline; }\n .xterm-underline-4 { text-decoration: dotted underline; }\n .xterm-underline-5 { text-decoration: dashed underline; }\n\n .xterm-overline {\n text-decoration: overline;\n }\n\n .xterm-overline.xterm-underline-1 { text-decoration: overline underline; }\n .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }\n .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }\n .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }\n .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }\n\n .xterm-strikethrough {\n text-decoration: line-through;\n }\n\n .xterm-screen .xterm-decoration-container .xterm-decoration {\n z-index: 6;\n position: absolute;\n }\n\n .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {\n z-index: 7;\n }\n\n .xterm-decoration-overview-ruler {\n z-index: 8;\n position: absolute;\n top: 0;\n right: 0;\n pointer-events: none;\n }\n\n .xterm-decoration-top {\n z-index: 2;\n position: relative;\n }\n\n /* The scrollbar of the grid: xterm's port of the VS Code scrollable element,\n which shows the slider while it is used and fades it out afterwards. */\n .xterm .xterm-scrollable-element > .scrollbar {\n cursor: default;\n }\n\n .xterm .xterm-scrollable-element > .visible {\n opacity: 1;\n /* Transparent, but painted, so the track still takes the pointer. */\n background: rgba(0, 0, 0, 0);\n transition: opacity 100ms linear;\n /* In front of the rows. */\n z-index: 11;\n }\n\n .xterm .xterm-scrollable-element > .invisible {\n opacity: 0;\n pointer-events: none;\n }\n\n .xterm .xterm-scrollable-element > .invisible.fade {\n transition: opacity 800ms linear;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .xterm .xterm-scrollable-element > .visible,\n .xterm .xterm-scrollable-element > .invisible.fade {\n transition: none;\n }\n }\n`;\n","// Auto-generated by scripts/update-monaco-version.cjs\nexport const MONACO_VERSION = '0.55.1';\n","import { MONACO_VERSION } from './monacoversion.js';\n\n/**\n * The versions the catalog once loaded from the CDN. Every entry is\n * deprecated: the libraries are bundled from the package dependencies, and\n * the pins stay at the versions their CDN URLs name until the next major\n * removes them (`echarts` names 5.6.0; the bundled dependency is 6.x).\n * Monaco's version is `MONACO_VERSION`, in `CDN_MONACO_BASE_URL`.\n *\n * This module and `./monacoversion.ts` import nothing else, so the\n * `@design.estate/dees-catalog/cdn` entry that re-exports them loads in Node.\n */\nexport const CDN_VERSIONS = {\n /**\n * @deprecated @xterm/xterm is bundled with the catalog (the `@xterm/xterm`\n * dependency) and no longer loaded from the CDN; nothing reads this pin.\n * Removed at the next major.\n */\n xterm: '6.0.0',\n /**\n * @deprecated @xterm/addon-fit is bundled with the catalog (the `@xterm/addon-fit`\n * dependency) and no longer loaded from the CDN; nothing reads this pin.\n * Removed at the next major.\n */\n xtermAddonFit: '0.11.0',\n /**\n * @deprecated @xterm/addon-search is bundled with the catalog (the `@xterm/addon-search`\n * dependency) and no longer loaded from the CDN; nothing reads this pin.\n * Removed at the next major.\n */\n xtermAddonSearch: '0.16.0',\n /**\n * @deprecated @xterm/addon-serialize is bundled with the catalog (the `@xterm/addon-serialize`\n * dependency) and no longer loaded from the CDN; nothing reads this pin.\n * Removed at the next major.\n */\n xtermAddonSerialize: '0.14.0',\n /**\n * @deprecated @xterm/addon-web-links is bundled with the catalog (the `@xterm/addon-web-links`\n * dependency) and no longer loaded from the CDN; nothing reads this pin.\n * Removed at the next major.\n */\n xtermAddonWebLinks: '0.12.0',\n /**\n * @deprecated highlight.js is bundled with the catalog (the `highlight.js`\n * dependency) and no longer loaded from the CDN; nothing reads this pin.\n */\n highlightJs: '11.11.1',\n /**\n * @deprecated ECharts is bundled with the catalog (the `echarts`\n * dependency, now 6.x) and no longer loaded from the CDN; nothing reads this\n * pin. Removed at the next major.\n */\n echarts: '5.6.0',\n /**\n * @deprecated Tiptap is bundled with the catalog (the `@tiptap/*`\n * dependencies) and was never loaded from the CDN by this pin; nothing reads\n * it. Removed at the next major.\n */\n tiptap: '2.27.2',\n} as const;\n\n/**\n * Base CDN URL for jsdelivr ESM imports\n */\nexport const CDN_BASE = 'https://cdn.jsdelivr.net/npm';\n\n/**\n * The ESM build of every @xterm package, at the path its manifest's `module`\n * field names. Each one is self-contained (no bare imports), so the browser\n * loads exactly this file; jsdelivr's `+esm` rewriting has nothing left to do\n * and would only put another build between the pin and the page.\n */\nconst xtermModuleUrl = (packageArg: string, versionArg: string, fileArg: string): string =>\n `${CDN_BASE}/@xterm/${packageArg}@${versionArg}/lib/${fileArg}.mjs`;\n\n/**\n * Module URLs `DeesServiceLibLoader` once imported from the CDN, one per\n * library. Every one of them is deprecated: xterm and its addons, ECharts and\n * highlight.js are bundled with the catalog and load from none of these URLs,\n * so a Content Security Policy needs none of them. Monaco is the one library\n * still loaded from the CDN by default, from `CDN_MONACO_BASE_URL`. The\n * entries are removed at the next major.\n */\nexport const CDN_SCRIPT_URLS = {\n /**\n * @deprecated @xterm/xterm is bundled with the catalog and no longer loaded from\n * the CDN; a Content Security Policy does not need to allow this URL.\n * Removed at the next major.\n */\n xterm: xtermModuleUrl('xterm', CDN_VERSIONS.xterm, 'xterm'),\n /**\n * @deprecated @xterm/addon-fit is bundled with the catalog and no longer loaded from\n * the CDN; a Content Security Policy does not need to allow this URL.\n * Removed at the next major.\n */\n xtermAddonFit: xtermModuleUrl('addon-fit', CDN_VERSIONS.xtermAddonFit, 'addon-fit'),\n /**\n * @deprecated @xterm/addon-search is bundled with the catalog and no longer loaded from\n * the CDN; a Content Security Policy does not need to allow this URL.\n * Removed at the next major.\n */\n xtermAddonSearch: xtermModuleUrl('addon-search', CDN_VERSIONS.xtermAddonSearch, 'addon-search'),\n /**\n * @deprecated @xterm/addon-serialize is bundled with the catalog and no longer loaded from\n * the CDN; a Content Security Policy does not need to allow this URL.\n * Removed at the next major.\n */\n xtermAddonSerialize: xtermModuleUrl('addon-serialize', CDN_VERSIONS.xtermAddonSerialize, 'addon-serialize'),\n /**\n * @deprecated @xterm/addon-web-links is bundled with the catalog and no longer loaded from\n * the CDN; a Content Security Policy does not need to allow this URL.\n * Removed at the next major.\n */\n xtermAddonWebLinks: xtermModuleUrl('addon-web-links', CDN_VERSIONS.xtermAddonWebLinks, 'addon-web-links'),\n /**\n * @deprecated highlight.js is bundled with the catalog and no longer loaded\n * from the CDN; a Content Security Policy does not need to allow this URL.\n */\n highlightJs: `${CDN_BASE}/highlight.js@${CDN_VERSIONS.highlightJs}/+esm`,\n /**\n * @deprecated ECharts is bundled with the catalog and no longer loaded from\n * the CDN; a Content Security Policy does not need to allow this URL.\n * Removed at the next major.\n */\n echarts: `${CDN_BASE}/echarts@${CDN_VERSIONS.echarts}/dist/echarts.esm.min.js`,\n} as const;\n\n/**\n * Monaco's `min/vs` directory on the CDN, where `DeesServiceLibLoader` loads\n * Monaco from unless a host calls `provideMonacoBaseUrl` (see\n * `monacoVsDirectoryUrl` in the `cdn` entry for serving it from the host's\n * own origin). Monaco is not one\n * module: its `loader.js` and the modules it requires load from below this\n * directory, and its `editor/editor.main.css` is fetched from there.\n */\nexport const CDN_MONACO_BASE_URL = `${CDN_BASE}/monaco-editor@${MONACO_VERSION}/min/vs`;\n","import { CDN_MONACO_BASE_URL } from './versions.js';\n\n// Type imports (no runtime overhead)\nimport type { Terminal } from '@xterm/xterm';\nimport type { FitAddon } from '@xterm/addon-fit';\nimport type { SearchAddon } from '@xterm/addon-search';\nimport type { SerializeAddon } from '@xterm/addon-serialize';\nimport type { WebLinksAddon } from '@xterm/addon-web-links';\nimport type { HLJSApi } from 'highlight.js';\nimport type {\n createChart as createChartType,\n createChartEx as createChartExType,\n defaultHorzScaleBehavior as defaultHorzScaleBehaviorType,\n IChartApi,\n ISeriesApi,\n UTCTimestamp,\n MouseEventParams,\n DeepPartial,\n TimeChartOptions,\n} from 'lightweight-charts';\nimport type { Editor, EditorOptions } from '@tiptap/core';\nimport type { StarterKitOptions } from '@tiptap/starter-kit';\nimport type { UnderlineOptions } from '@tiptap/extension-underline';\nimport type { TextAlignOptions } from '@tiptap/extension-text-align';\nimport type { LinkOptions } from '@tiptap/extension-link';\nimport type * as monaco from 'monaco-editor';\n\n/**\n * Bundle type for @xterm/xterm\n */\nexport interface IXtermBundle {\n Terminal: typeof Terminal;\n}\n\n/**\n * Bundle type for @xterm/addon-fit\n */\nexport interface IXtermFitAddonBundle {\n FitAddon: typeof FitAddon;\n}\n\n/**\n * Bundle type for @xterm/addon-search\n */\nexport interface IXtermSearchAddonBundle {\n SearchAddon: typeof SearchAddon;\n}\n\n/**\n * Bundle type for @xterm/addon-serialize\n */\nexport interface IXtermSerializeAddonBundle {\n SerializeAddon: typeof SerializeAddon;\n}\n\n/**\n * Bundle type for @xterm/addon-web-links\n */\nexport interface IXtermWebLinksAddonBundle {\n WebLinksAddon: typeof WebLinksAddon;\n}\n\n/**\n * Bundle type for TradingView Lightweight Charts\n */\nexport interface ILightweightChartsBundle {\n createChart: typeof createChartType;\n createChartEx: typeof createChartExType;\n defaultHorzScaleBehavior: typeof defaultHorzScaleBehaviorType;\n AreaSeries: any;\n LineSeries: any;\n ColorType: {\n Solid: string;\n VerticalGradient: string;\n };\n LineType: {\n Simple: number;\n WithSteps: number;\n Curved: number;\n };\n CrosshairMode: {\n Normal: number;\n Magnet: number;\n Hidden: number;\n };\n}\n\n/**\n * Minimal type for an ECharts instance\n */\nexport interface IEchartsInstance {\n setOption(option: Record<string, any>, notMerge?: boolean): void;\n resize(opts?: { width?: number; height?: number }): void;\n dispose(): void;\n on(eventName: string, handler: (...args: any[]) => void): void;\n off(eventName: string, handler?: (...args: any[]) => void): void;\n getOption(): Record<string, any>;\n convertToPixel(finder: Record<string, any>, value: number | number[]): number | number[];\n getWidth(): number;\n getHeight(): number;\n clear(): void;\n}\n\n/**\n * Bundle type for Apache ECharts\n */\nexport interface IEchartsBundle {\n init: (dom: HTMLElement, theme?: string | object | null, opts?: Record<string, any>) => IEchartsInstance;\n dispose: (chart: IEchartsInstance | HTMLElement | string) => void;\n getInstanceByDom: (dom: HTMLElement) => IEchartsInstance | undefined;\n}\n\n/**\n * Bundle type for Tiptap editor and extensions\n */\nexport interface ITiptapBundle {\n Editor: typeof Editor;\n Node: typeof import('@tiptap/core').Node;\n Extension: typeof import('@tiptap/core').Extension;\n StarterKit: { configure: (options?: Partial<StarterKitOptions>) => any };\n CodeBlock: typeof import('@tiptap/extension-code-block').CodeBlock;\n Underline: { configure: (options?: Partial<UnderlineOptions>) => any };\n TextAlign: { configure: (options?: Partial<TextAlignOptions>) => any };\n Link: { configure: (options?: Partial<LinkOptions>) => any };\n Typography: { configure: (options?: any) => any };\n}\n\n/**\n * Bundle type for the Monaco editor: its API, and the stylesheet every editor\n * surface adopts into its own shadow root, where Monaco renders.\n */\nexport interface IMonacoBundle {\n monaco: typeof monaco;\n stylesheet: string;\n}\n\n/** The AMD loader Monaco's `min/vs` build installs as the page's `require`. */\ninterface IMonacoAmdRequire {\n (dependencies: string[], onLoad: () => void, onError: (error: unknown) => void): void;\n config(options: { paths: Record<string, string> }): void;\n /** Starts a new module registry; the loader keeps the modules it loaded, and the failures, until then. */\n reset(): void;\n}\n\n/** A global Monaco's `min/vs` build installs on the page: its loader as `require`, `define` and `AMDLoader`, its API as `monaco`. */\nconst pageGlobal = (nameArg: 'require' | 'define' | 'AMDLoader' | 'monaco'): unknown =>\n (globalThis as { [name: string]: unknown })[nameArg];\n\n/**\n * Whether `requireArg` is Monaco's AMD loader. RequireJS and other AMD loaders offer\n * `require.config` as well; Monaco's is the one whose `moduleManager` is an instance of the\n * `ModuleManager` its `AMDLoader` namespace exports.\n */\nconst isMonacoLoader = (requireArg: unknown, amdLoaderArg: unknown): requireArg is IMonacoAmdRequire =>\n typeof requireArg === 'function' &&\n typeof amdLoaderArg === 'object' && amdLoaderArg !== null &&\n 'ModuleManager' in amdLoaderArg && typeof amdLoaderArg.ModuleManager === 'function' &&\n 'moduleManager' in requireArg && requireArg.moduleManager instanceof amdLoaderArg.ModuleManager;\n\n/** The page's `require`, when it is Monaco's AMD loader. */\nconst monacoLoader = (): IMonacoAmdRequire | null => {\n const candidate = pageGlobal('require');\n return isMonacoLoader(candidate, pageGlobal('AMDLoader')) ? candidate : null;\n};\n\n/** Whether the page runs an AMD loader, whose `define.amd` Monaco's loader stands aside for. */\nconst pageRunsAmdLoader = (): boolean => {\n const define = pageGlobal('define');\n return typeof define === 'function' && 'amd' in define;\n};\n\n/**\n * Installs Monaco's AMD loader from `urlArg`, unless the page already has one, installed by the\n * host or by another copy of this catalog. Monaco's loader installs once per page and stays: its\n * script declares page-wide constants, so it cannot run a second time. It also stands aside for\n * any AMD loader the page already runs, which is refused here, before anything is appended. A\n * loader that cannot be fetched rejects, and its script element leaves the page, which is then as\n * it was.\n */\nconst installMonacoLoader = (urlArg: string): Promise<IMonacoAmdRequire> => {\n const installed = monacoLoader();\n if (installed) return Promise.resolve(installed);\n if (pageRunsAmdLoader()) {\n return Promise.reject(new Error(`Monaco's loader from ${urlArg} cannot install beside the AMD loader this page already runs.`));\n }\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n const fail = (messageArg: string) => {\n script.remove();\n reject(new Error(messageArg));\n };\n script.src = urlArg;\n script.onload = () => {\n const loader = monacoLoader();\n if (loader) resolve(loader);\n else fail(`${urlArg} is not Monaco's loader.`);\n };\n script.onerror = () => fail(`Monaco's loader did not load from ${urlArg}.`);\n document.head.append(script);\n });\n};\n\n/**\n * Requires Monaco's API through its loader. The loader keeps a module that failed as failed, and\n * would replay that failure to every later attempt, so a failure resets its registry: the next\n * attempt fetches Monaco again. A loader the host installed and shares loses its registry and\n * configuration to that reset as well.\n */\nconst requireMonacoApi = (amdRequireArg: IMonacoAmdRequire, baseUrlArg: string): Promise<typeof monaco> =>\n new Promise((resolve, reject) => {\n const fail = (messageArg: string, causeArg?: unknown) => {\n amdRequireArg.reset();\n reject(new Error(messageArg, { cause: causeArg }));\n };\n amdRequireArg(['vs/editor/editor.main'], () => {\n const loaded = pageGlobal('monaco');\n if (loaded) resolve(loaded as typeof monaco);\n else fail(`${baseUrlArg}/editor/editor.main.js did not install Monaco.`);\n }, (error) => fail(`Monaco did not load from ${baseUrlArg}.`, error));\n });\n\n/** Fetches a text resource, naming the URL when it is not there. */\nconst fetchText = async (urlArg: string, cacheArg: RequestCache = 'default'): Promise<string> => {\n const response = await fetch(urlArg, { cache: cacheArg });\n if (!response.ok) throw new Error(`${urlArg} answered ${response.status}.`);\n return response.text();\n};\n\n/** The page's stylesheet links to `urlArg`. */\nconst stylesheetLinksTo = (urlArg: string): HTMLLinkElement[] => {\n const href = new URL(urlArg, document.baseURI).href;\n return [...document.head.querySelectorAll<HTMLLinkElement>('link[rel=\"stylesheet\"]')].filter((link) => link.href === href);\n};\n\n/**\n * Monaco's stylesheet as text, for the editor surfaces to adopt into their shadow roots, loaded\n * once. Monaco's `editor.main` links `editor/editor.main.css` into the document head itself, which\n * the page needs (its accessibility live region sits in `document.body`), so the text is read\n * after that link loaded, from the HTTP cache it filled (`force-cache`, which takes a stored\n * response without revalidating it); fetched alongside, the same file loaded twice. A link that\n * did not load (a `style-src` that blocks it, say) leaves the text to an ordinary fetch, which\n * names the URL if it fails as well, and so does the absence of a new link: Monaco's API was\n * loaded before, its link long settled. `linkArg` was appended in the task that resolved\n * Monaco's API, whose microtasks this runs in, so its load or error event, always a task of its\n * own, has not fired yet.\n */\nconst readMonacoStylesheet = async (urlArg: string, linkArg: HTMLLinkElement | undefined): Promise<string> => {\n const linkLoaded = linkArg\n ? await new Promise<boolean>((resolve) => {\n linkArg.addEventListener('load', () => resolve(true), { once: true });\n linkArg.addEventListener('error', () => resolve(false), { once: true });\n })\n : false;\n return fetchText(urlArg, linkLoaded ? 'force-cache' : 'default');\n};\n\n/**\n * Singleton service for loading heavy libraries on demand.\n *\n * Libraries are initialized only when needed and cached after first load.\n *\n * @example\n * ```typescript\n * const libLoader = DeesServiceLibLoader.getInstance();\n * const xterm = await libLoader.loadXterm();\n * const terminal = new xterm.Terminal({ ... });\n * ```\n */\nexport class DeesServiceLibLoader {\n private static instance: DeesServiceLibLoader;\n\n // Cached library references\n private xtermLib: IXtermBundle | null = null;\n private xtermFitAddonLib: IXtermFitAddonBundle | null = null;\n private xtermSearchAddonLib: IXtermSearchAddonBundle | null = null;\n private xtermSerializeAddonLib: IXtermSerializeAddonBundle | null = null;\n private xtermWebLinksAddonLib: IXtermWebLinksAddonBundle | null = null;\n private highlightJsLib: HLJSApi | null = null;\n private lightweightChartsLib: ILightweightChartsBundle | null = null;\n private echartsLib: IEchartsBundle | null = null;\n private tiptapLib: ITiptapBundle | null = null;\n private monacoLib: IMonacoBundle | null = null;\n\n /** Where monaco-editor's `min/vs` directory is served; see provideMonacoBaseUrl. */\n private monacoBaseUrl: string = CDN_MONACO_BASE_URL;\n /** Whether a load reached Monaco's loader, which binds the page to `monacoBaseUrl`. */\n private monacoBaseUrlBound = false;\n\n // Loading promises to prevent duplicate concurrent loads\n private xtermLoadingPromise: Promise<IXtermBundle> | null = null;\n private xtermFitAddonLoadingPromise: Promise<IXtermFitAddonBundle> | null = null;\n private xtermSearchAddonLoadingPromise: Promise<IXtermSearchAddonBundle> | null = null;\n private xtermSerializeAddonLoadingPromise: Promise<IXtermSerializeAddonBundle> | null = null;\n private xtermWebLinksAddonLoadingPromise: Promise<IXtermWebLinksAddonBundle> | null = null;\n private highlightJsLoadingPromise: Promise<HLJSApi> | null = null;\n private lightweightChartsLoadingPromise: Promise<ILightweightChartsBundle> | null = null;\n private echartsLoadingPromise: Promise<IEchartsBundle> | null = null;\n private tiptapLoadingPromise: Promise<ITiptapBundle> | null = null;\n private monacoLoadingPromise: Promise<IMonacoBundle> | null = null;\n\n private constructor() {}\n\n /**\n * Get the singleton instance of DeesServiceLibLoader\n */\n public static getInstance(): DeesServiceLibLoader {\n if (!DeesServiceLibLoader.instance) {\n DeesServiceLibLoader.instance = new DeesServiceLibLoader();\n }\n return DeesServiceLibLoader.instance;\n }\n\n /**\n * Shares one in-flight load between concurrent callers — but only for as long\n * as that load can still succeed. A rejected load clears its own cache entry,\n * so the next call makes a fresh attempt instead of replaying a stale failure\n * for the lifetime of the page. Every load below goes through this.\n */\n private shareLoad<T>(\n loadArg: () => Promise<T>,\n readArg: () => Promise<T> | null,\n writeArg: (promiseArg: Promise<T> | null) => void,\n ): Promise<T> {\n const pending = loadArg();\n writeArg(pending);\n pending.catch(() => {\n // Retract only this attempt; a newer one may already own the entry.\n if (readArg() === pending) writeArg(null);\n });\n return pending;\n }\n\n /**\n * xterm for the catalog's terminal surfaces: the module a host provided\n * (provideXtermModules), otherwise the catalog's own, bundled from the\n * `@xterm/xterm` dependency. Nothing is fetched from a CDN.\n * @returns Promise resolving to xterm module with Terminal class\n */\n public async loadXterm(): Promise<IXtermBundle> {\n if (this.xtermLib) {\n return this.xtermLib;\n }\n\n if (this.xtermLoadingPromise) {\n return this.xtermLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const module = await import('@xterm/xterm');\n\n // A host may have provided its own while the bundled one loaded; it stays.\n this.xtermLib ??= { Terminal: module.Terminal };\n return this.xtermLib;\n },\n () => this.xtermLoadingPromise,\n (promiseArg) => {\n this.xtermLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Provides xterm modules from the host application instead of the copies\n * the catalog bundles, for a host that ships its own xterm build (another\n * version, or one instance shared with its own terminals). Call it before\n * any terminal component initializes. Each module passed here is served from\n * the cache by its loader — loadXterm / loadXtermFitAddon /\n * loadXtermSearchAddon / loadXtermSerializeAddon / loadXtermWebLinksAddon —\n * and the bundled one is not loaded; a module left out comes from the\n * bundled dependency when a surface needs it. No stylesheet is passed and\n * nothing is added to the page: every terminal surface carries xterm's\n * stylesheet in its own shadow root, which is where xterm renders.\n */\n public provideXtermModules(input: {\n xterm: IXtermBundle;\n fitAddon?: IXtermFitAddonBundle;\n searchAddon?: IXtermSearchAddonBundle;\n serializeAddon?: IXtermSerializeAddonBundle;\n webLinksAddon?: IXtermWebLinksAddonBundle;\n }): void {\n this.xtermLib = { Terminal: input.xterm.Terminal };\n if (input.fitAddon) {\n this.xtermFitAddonLib = { FitAddon: input.fitAddon.FitAddon };\n }\n if (input.searchAddon) {\n this.xtermSearchAddonLib = { SearchAddon: input.searchAddon.SearchAddon };\n }\n if (input.serializeAddon) {\n this.xtermSerializeAddonLib = { SerializeAddon: input.serializeAddon.SerializeAddon };\n }\n if (input.webLinksAddon) {\n this.xtermWebLinksAddonLib = { WebLinksAddon: input.webLinksAddon.WebLinksAddon };\n }\n }\n\n /**\n * Load @xterm/addon-fit: the module a host provided, otherwise the bundled dependency\n * @returns Promise resolving to FitAddon class\n */\n public async loadXtermFitAddon(): Promise<IXtermFitAddonBundle> {\n if (this.xtermFitAddonLib) {\n return this.xtermFitAddonLib;\n }\n\n if (this.xtermFitAddonLoadingPromise) {\n return this.xtermFitAddonLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const module = await import('@xterm/addon-fit');\n\n // A host may have provided its own while the bundled one loaded; it stays.\n this.xtermFitAddonLib ??= { FitAddon: module.FitAddon };\n return this.xtermFitAddonLib;\n },\n () => this.xtermFitAddonLoadingPromise,\n (promiseArg) => {\n this.xtermFitAddonLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Load @xterm/addon-search: the module a host provided, otherwise the bundled dependency\n * @returns Promise resolving to SearchAddon class\n */\n public async loadXtermSearchAddon(): Promise<IXtermSearchAddonBundle> {\n if (this.xtermSearchAddonLib) {\n return this.xtermSearchAddonLib;\n }\n\n if (this.xtermSearchAddonLoadingPromise) {\n return this.xtermSearchAddonLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const module = await import('@xterm/addon-search');\n\n // A host may have provided its own while the bundled one loaded; it stays.\n this.xtermSearchAddonLib ??= { SearchAddon: module.SearchAddon };\n return this.xtermSearchAddonLib;\n },\n () => this.xtermSearchAddonLoadingPromise,\n (promiseArg) => {\n this.xtermSearchAddonLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Load @xterm/addon-serialize: the module a host provided, otherwise the bundled dependency\n * @returns Promise resolving to SerializeAddon class\n */\n public async loadXtermSerializeAddon(): Promise<IXtermSerializeAddonBundle> {\n if (this.xtermSerializeAddonLib) {\n return this.xtermSerializeAddonLib;\n }\n\n if (this.xtermSerializeAddonLoadingPromise) {\n return this.xtermSerializeAddonLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const module = await import('@xterm/addon-serialize');\n\n // A host may have provided its own while the bundled one loaded; it stays.\n this.xtermSerializeAddonLib ??= { SerializeAddon: module.SerializeAddon };\n return this.xtermSerializeAddonLib;\n },\n () => this.xtermSerializeAddonLoadingPromise,\n (promiseArg) => {\n this.xtermSerializeAddonLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Load @xterm/addon-web-links: the module a host provided, otherwise the bundled dependency\n * @returns Promise resolving to WebLinksAddon class\n */\n public async loadXtermWebLinksAddon(): Promise<IXtermWebLinksAddonBundle> {\n if (this.xtermWebLinksAddonLib) {\n return this.xtermWebLinksAddonLib;\n }\n\n if (this.xtermWebLinksAddonLoadingPromise) {\n return this.xtermWebLinksAddonLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const module = await import('@xterm/addon-web-links');\n\n // A host may have provided its own while the bundled one loaded; it stays.\n this.xtermWebLinksAddonLib ??= { WebLinksAddon: module.WebLinksAddon };\n return this.xtermWebLinksAddonLib;\n },\n () => this.xtermWebLinksAddonLoadingPromise,\n (promiseArg) => {\n this.xtermWebLinksAddonLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Provides the host application's own highlight.js instead of the one the\n * catalog bundles, for a host that already ships highlight.js with more\n * languages or plugins. Every code view uses it from then on, including a\n * view whose loadHighlightJs call is still resolving the bundled one.\n */\n public provideHighlightJs(hljs: HLJSApi): void {\n this.highlightJsLib = hljs;\n this.highlightJsLoadingPromise = null;\n }\n\n /**\n * highlight.js for the catalog's code views: the instance a host provided\n * (provideHighlightJs), otherwise the catalog's own, bundled from the\n * package dependency with the languages its views name. Nothing is fetched\n * from a CDN, so it works under any Content Security Policy.\n * @returns Promise resolving to highlight.js API\n */\n public async loadHighlightJs(): Promise<HLJSApi> {\n if (this.highlightJsLib) {\n return this.highlightJsLib;\n }\n\n if (this.highlightJsLoadingPromise) {\n return this.highlightJsLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const { createBundledHighlightJs } = await import('./highlightjs.js');\n // A host may have provided its own while the bundled one loaded; it stays.\n this.highlightJsLib ??= createBundledHighlightJs();\n return this.highlightJsLib;\n },\n () => this.highlightJsLoadingPromise,\n (promiseArg) => {\n this.highlightJsLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Load TradingView Lightweight Charts from the package dependency\n * @returns Promise resolving to Lightweight Charts bundle\n */\n public async loadLightweightCharts(): Promise<ILightweightChartsBundle> {\n if (this.lightweightChartsLib) {\n return this.lightweightChartsLib;\n }\n\n if (this.lightweightChartsLoadingPromise) {\n return this.lightweightChartsLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const module = await import('lightweight-charts');\n\n this.lightweightChartsLib = {\n createChart: module.createChart,\n createChartEx: module.createChartEx,\n defaultHorzScaleBehavior: module.defaultHorzScaleBehavior,\n AreaSeries: module.AreaSeries,\n LineSeries: module.LineSeries,\n ColorType: module.ColorType,\n LineType: module.LineType,\n CrosshairMode: module.CrosshairMode,\n };\n return this.lightweightChartsLib;\n },\n () => this.lightweightChartsLoadingPromise,\n (promiseArg) => {\n this.lightweightChartsLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Apache ECharts for the catalog's charts, bundled from the `echarts`\n * dependency with only the series, components and renderer they draw with\n * (see `./echarts.ts`). Nothing is fetched from a CDN.\n * @returns Promise resolving to ECharts bundle\n */\n public async loadEcharts(): Promise<IEchartsBundle> {\n if (this.echartsLib) {\n return this.echartsLib;\n }\n\n if (this.echartsLoadingPromise) {\n return this.echartsLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const module = await import('./echarts.js');\n\n this.echartsLib = {\n init: module.init,\n // ECharts' own `dispose` types its instance as its own class; for an instance it calls\n // the instance's `dispose`, which is what an IEchartsInstance offers.\n dispose: (chartArg) => {\n if (typeof chartArg === 'string' || chartArg instanceof HTMLElement) module.dispose(chartArg);\n else chartArg.dispose();\n },\n getInstanceByDom: module.getInstanceByDom,\n };\n return this.echartsLib;\n },\n () => this.echartsLoadingPromise,\n (promiseArg) => {\n this.echartsLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Load Tiptap rich text editor and extensions from the package dependencies\n * @returns Promise resolving to Tiptap bundle with Editor and extensions\n */\n public async loadTiptap(): Promise<ITiptapBundle> {\n if (this.tiptapLib) {\n return this.tiptapLib;\n }\n\n if (this.tiptapLoadingPromise) {\n return this.tiptapLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n // Import directly from npm packages — bundled by esbuild into a single\n // module graph. CDN loading caused duplicate ProseMirror instances because\n // jsdelivr resolves each package's dependencies independently.\n const [coreModule, starterKitModule, codeBlockModule, underlineModule, textAlignModule, linkModule, typographyModule] = await Promise.all([\n import('@tiptap/core'),\n import('@tiptap/starter-kit'),\n import('@tiptap/extension-code-block'),\n import('@tiptap/extension-underline'),\n import('@tiptap/extension-text-align'),\n import('@tiptap/extension-link'),\n import('@tiptap/extension-typography'),\n ]);\n\n this.tiptapLib = {\n Editor: coreModule.Editor,\n Node: coreModule.Node,\n Extension: coreModule.Extension,\n StarterKit: starterKitModule.default || starterKitModule.StarterKit,\n CodeBlock: codeBlockModule.default || codeBlockModule.CodeBlock,\n Underline: underlineModule.default || underlineModule.Underline,\n TextAlign: textAlignModule.default || textAlignModule.TextAlign,\n Link: linkModule.default || linkModule.Link,\n Typography: typographyModule.default || typographyModule.Typography,\n };\n\n return this.tiptapLib;\n },\n () => this.tiptapLoadingPromise,\n (promiseArg) => {\n this.tiptapLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Serves Monaco from the host's own origin instead of the CDN. `baseUrl` is\n * where the host serves monaco-editor's `min/vs` directory — a copy of\n * `node_modules/monaco-editor/min/vs` at the version this catalog pins,\n * which `monacoVsDirectoryUrl()` from `@design.estate/dees-catalog/cdn`\n * locates on the server.\n * Hosts whose CSP forbids CDN scripts, or that must work offline, call this\n * before the first editor mounts. Monaco's loader installs once per page\n * and keeps what it loaded from its base URL, so the URL can move only\n * until a load reaches that loader: from then on, and while a load is in\n * flight, a different one throws, even when that load failed. A load whose\n * `loader.js` could not be fetched installed nothing and binds nothing.\n */\n public provideMonacoBaseUrl(baseUrl: string): void {\n const normalized = baseUrl.replace(/\\/+$/, '');\n if (normalized !== this.monacoBaseUrl && (this.monacoBaseUrlBound || this.monacoLoadingPromise)) {\n throw new Error(\n `Monaco already loads from ${this.monacoBaseUrl}; provide its base URL before the first editor mounts.`,\n );\n }\n this.monacoBaseUrl = normalized;\n }\n\n /**\n * Load the Monaco editor, from the CDN or from the base URL a host provided.\n * Every editor surface shares this one load. A failure rejects with the URL\n * that failed instead of leaving editors waiting, and leaves nothing the\n * next call inherits: that call tries again and fetches what failed.\n * @returns Promise resolving to Monaco's API and its stylesheet\n */\n public async loadMonaco(): Promise<IMonacoBundle> {\n if (this.monacoLib) {\n return this.monacoLib;\n }\n\n if (this.monacoLoadingPromise) {\n return this.monacoLoadingPromise;\n }\n\n return this.shareLoad(\n async () => {\n const baseUrl = this.monacoBaseUrl;\n const amdRequire = await installMonacoLoader(`${baseUrl}/loader.js`);\n this.monacoBaseUrlBound = true;\n amdRequire.config({ paths: { vs: baseUrl } });\n const stylesheetUrl = `${baseUrl}/editor/editor.main.css`;\n const linkedBefore = stylesheetLinksTo(stylesheetUrl);\n const api = await requireMonacoApi(amdRequire, baseUrl);\n const monacoLink = stylesheetLinksTo(stylesheetUrl).find((link) => !linkedBefore.includes(link));\n const stylesheet = await readMonacoStylesheet(stylesheetUrl, monacoLink);\n this.monacoLib = { monaco: api, stylesheet };\n return this.monacoLib;\n },\n () => this.monacoLoadingPromise,\n (promiseArg) => {\n this.monacoLoadingPromise = promiseArg;\n },\n );\n }\n\n /**\n * Preload multiple libraries in parallel\n * Useful for warming the cache before components are rendered\n */\n public async preloadAll(): Promise<void> {\n await Promise.all([\n this.loadXterm(),\n this.loadXtermFitAddon(),\n this.loadXtermSearchAddon(),\n this.loadXtermSerializeAddon(),\n this.loadXtermWebLinksAddon(),\n this.loadHighlightJs(),\n this.loadLightweightCharts(),\n this.loadEcharts(),\n this.loadTiptap(),\n ]);\n }\n\n /**\n * Check if a specific library is already loaded\n */\n public isLoaded(library: 'xterm' | 'xtermFitAddon' | 'xtermSearchAddon' | 'xtermSerializeAddon' | 'xtermWebLinksAddon' | 'highlightJs' | 'lightweightCharts' | 'echarts' | 'tiptap' | 'monaco'): boolean {\n switch (library) {\n case 'xterm':\n return this.xtermLib !== null;\n case 'xtermFitAddon':\n return this.xtermFitAddonLib !== null;\n case 'xtermSearchAddon':\n return this.xtermSearchAddonLib !== null;\n case 'xtermSerializeAddon':\n return this.xtermSerializeAddonLib !== null;\n case 'xtermWebLinksAddon':\n return this.xtermWebLinksAddonLib !== null;\n case 'highlightJs':\n return this.highlightJsLib !== null;\n case 'lightweightCharts':\n return this.lightweightChartsLib !== null;\n case 'echarts':\n return this.echartsLib !== null;\n case 'tiptap':\n return this.tiptapLib !== null;\n case 'monaco':\n return this.monacoLib !== null;\n default:\n return false;\n }\n }\n}\n","import { demoFunc } from './dees-terminal-view.demo.js';\nimport {\n DeesElement,\n html,\n css,\n customElement,\n type TemplateResult,\n property,\n} from '@design.estate/dees-element';\nimport type { ITerminalAddon, Terminal } from '@xterm/xterm';\nimport type { FitAddon } from '@xterm/addon-fit';\nimport type { SerializeAddon } from '@xterm/addon-serialize';\nimport * as plugins from '../../00plugins.js';\nimport { themeDefaultStyles, terminalFontFamily, terminalTheme } from '../../00theme.js';\nimport { reducedMotionQuery } from '../../00motion.js';\nimport { xtermStyles } from '../terminal.styles.js';\nimport { DeesServiceLibLoader } from '../../../services/index.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'dees-terminal-view': DeesTerminalView;\n }\n}\n\n/** Detail of `terminal-input`: bytes the user typed, as a UTF-8 string. */\nexport interface ITerminalInputDetail {\n data: string;\n}\n\n/**\n * A terminal grid size. It is the detail of `terminal-resize`, fired after the\n * terminal refits its container, and the size `restore()` paints a snapshot at.\n */\nexport interface ITerminalResizeDetail {\n rows: number;\n cols: number;\n}\n\n/**\n * Detail of `terminal-error`: xterm could not be loaded, or the live terminal\n * refused output. The element stays usable and keeps buffering.\n */\nexport interface ITerminalErrorDetail {\n error: unknown;\n}\n\n/**\n * What `serialize()` returns and `restore()` takes: the serialized terminal\n * state and the grid it was taken at. The two travel together because a\n * snapshot is exact only in a grid of that size.\n */\nexport interface ITerminalSnapshot {\n data: string;\n size: ITerminalResizeDetail;\n}\n\n/**\n * Upper bound on output buffered while no terminal is live, in bytes.\n * `Uint8Array` chunks count their `byteLength`, strings their UTF-16 memory\n * (two bytes per code unit). Beyond the bound the oldest chunks are dropped,\n * and the flush then emits RIS before the survivors so a truncated prefix is\n * never rendered as if it were contiguous output.\n */\nexport const maxPendingWriteBytes = 8 * 1024 * 1024;\n\n/**\n * RIS (ESC c), a hard reset carried *inside* the write stream: xterm parses it\n * in order and routes it to the very same `Terminal.reset()` (InputHandler's\n * ESC-c handler calls `fullReset()`, which fires `onRequestReset`, which\n * `Terminal` handles with `reset()`), whereas calling `reset()` directly is\n * documented as out of band with the pending write queue.\n */\nconst RIS = '\\x1bc';\n\n/** Memory cost of one buffered chunk, in bytes. */\nconst chunkByteLength = (chunkArg: string | Uint8Array): number =>\n typeof chunkArg === 'string' ? chunkArg.length * 2 : chunkArg.byteLength;\n\n/** Identity of a grid size, as compared when deciding whether to report a refit. */\nconst gridKey = (sizeArg: ITerminalResizeDetail): string => `${sizeArg.rows}x${sizeArg.cols}`;\n\n/**\n * Grid bounds `restore()` accepts. xterm silently widens anything narrower than\n * two columns (a wide character needs two cells), which would paint a snapshot\n * at a size other than the one it was serialized at; a PTY window size is a\n * 16-bit field, so no real snapshot is larger than the upper bound.\n */\nconst minRestoreCols = 2;\nconst minRestoreRows = 1;\nconst maxRestoreGridSize = 0xffff;\n\nconst isGridDimension = (valueArg: number, minArg: number): boolean =>\n Number.isInteger(valueArg) && valueArg >= minArg && valueArg <= maxRestoreGridSize;\n\n/**\n * One `restore()` call: the snapshot, the grid it was serialized at, and the\n * deferred whose promise is handed back to the caller. Its rejections are\n * lifecycle outcomes, not programming errors, so, as with `ready`, an\n * unawaited promise never surfaces as an unhandled rejection; a caller that\n * awaits it still observes the reason.\n */\nclass TerminalRestore {\n public readonly deferred = plugins.smartpromise.defer<void>();\n\n constructor(\n public readonly data: string | Uint8Array,\n public readonly size: ITerminalResizeDetail,\n ) {\n this.deferred.promise.catch(() => undefined);\n }\n}\n\n/** Everything buffered while no terminal is live, in replay order. */\ninterface IPendingOutput {\n /** The base of the writes; it resets everything that was buffered before it. */\n restore: TerminalRestore | undefined;\n writes: Array<string | Uint8Array>;\n /** Whether older output was dropped, so the replay has to reset before the writes. */\n dropped: boolean;\n}\n\n/**\n * A registered addon and the instance loaded into the terminal of the current\n * connection. The terminal is rebuilt on every connection, so a host registers\n * a factory rather than an instance and reads the live one from `current`.\n */\nexport interface ITerminalAddonHandle<T extends ITerminalAddon = ITerminalAddon> {\n /** The addon of the live terminal, or undefined while none is up. */\n readonly current: T | undefined;\n /** Unregisters the addon and disposes the live instance. */\n dispose(): void;\n}\n\n/** How the terminal draws its caret when it is not the focused surface. */\nconst inactiveCursor = 'outline';\n\n/** One registered addon factory and the instance of the live terminal. */\ninterface IAddonRegistration<T extends ITerminalAddon = ITerminalAddon> {\n create(): T;\n current: T | undefined;\n}\n\n/**\n * Transport-agnostic xterm.js surface, and the one terminal surface of the\n * catalog: the host pipes remote PTY output into `write()` and receives\n * keystrokes via `terminal-input` — no process, runtime, or socket coupling.\n * `terminal-resize` reports the grid size after every refit so the host can\n * negotiate a PTY size. Output that arrives while no terminal is live is\n * buffered up to `maxPendingWriteBytes` and replayed in order on the next\n * connection, so a replay may start before the element is ready and survives\n * being detached. `serialize()` takes a snapshot of the whole grid and\n * `restore()` paints one invisibly at the size it was taken at, then fits it to\n * the container. A URL in the output is a link, opened in a new tab. xterm and\n * the addons behind those two capabilities load through DeesServiceLibLoader;\n * CSP-locked hosts can pre-register bundled modules with\n * `provideXtermModules()` to avoid the CDN.\n *\n * The element draws no frame of its own — a host that wants one (a tile, a\n * panel, a card) draws it around the element, which fills whatever box it is\n * given. Sizing comes from that host: give it a bounded height.\n */\n@customElement('dees-terminal-view')\nexport class DeesTerminalView extends DeesElement {\n public static demo = demoFunc;\n public static demoGroups = ['Terminal'];\n\n /** Font size in px for the terminal grid; applied live. */\n @property({ type: Number, reflect: true })\n accessor fontSize: number = 13;\n\n /**\n * Lines the grid keeps above the viewport. A log view sizes this to its entry\n * cap and a short-lived output pane keeps it small, so it is a property\n * rather than the shell-sized constant it used to be. Applied live; xterm\n * drops the oldest lines when the bound shrinks.\n */\n @property({ type: Number, reflect: true })\n accessor scrollback: number = 10_000;\n\n /**\n * Start a line feed at column one, as xterm's `convertEol` does. A PTY ends\n * its lines with CRLF itself, so a shell surface leaves this off; a host that\n * composes the text instead of forwarding a PTY turns it on rather than\n * rewriting the line endings of everything it writes. Both output views of\n * the catalog do: `dees-workspace-terminal-preview` writes a transcript line\n * by line, and `dees-chart-log` formats log entries and streams container\n * output that ends its lines with a bare LF. Applied live.\n */\n @property({ type: Boolean, reflect: true })\n accessor convertEol: boolean = false;\n\n /**\n * A surface nobody types into: xterm's stdin is disabled and no caret is\n * drawn, in either focus state. This is what an output view composes (a\n * command preview, a log stream); a shell leaves it off.\n */\n @property({ type: Boolean, reflect: true })\n accessor readOnly: boolean = false;\n\n /**\n * Accessible name of the surface. A host with more than one terminal on\n * screen names each one (\"Build output\", \"Session 2\"); the default names the\n * single terminal of a page.\n */\n @property({ type: String, reflect: true })\n accessor label: string = 'Terminal';\n\n /**\n * Opt-in screen-reader support. xterm then maintains a parallel accessibility\n * tree and a live region for the output, which costs work on every render, so\n * a host turns it on for a surface a screen reader is actually pointed at.\n * Applied live: xterm builds or drops that tree when the option changes.\n */\n @property({ type: Boolean, reflect: true })\n accessor screenReaderMode: boolean = false;\n\n /**\n * Stops keystrokes from reaching the host: no `terminal-input` is emitted,\n * xterm's own stdin is closed so a keystroke is dropped at the source, and\n * the state is exposed as `aria-disabled`. Output, selection and scrolling\n * are unaffected.\n */\n @property({ type: Boolean, reflect: true })\n accessor disabled: boolean = false;\n\n private terminal: Terminal | undefined;\n private fitAddon: FitAddon | undefined;\n /** The addon `serialize()` reads through, for the terminal of this connection. */\n private serializeAddon: SerializeAddon | undefined;\n private resizeObserver: ResizeObserver | undefined;\n private inputDisposable: { dispose(): void } | undefined;\n private lastReportedSize = '';\n // Output that arrives before xterm is live is replayed in order, bounded by\n // maxPendingWriteBytes and retained across a disconnect. A buffered restore\n // resets everything before it, so there is at most one and it is the base\n // of the chunks buffered after it; its bytes count towards the bound.\n private pendingRestore: TerminalRestore | undefined;\n private pendingWrites: Array<string | Uint8Array> = [];\n private pendingWriteBytes = 0;\n private pendingWritesDropped = false;\n private setupPromise: Promise<void> | undefined;\n /**\n * The restore handed to the live terminal whose snapshot is not parsed yet. While it is set the\n * grid belongs to the snapshot: the terminal stays invisible and nothing refits it.\n */\n private activeRestore: TerminalRestore | undefined;\n /**\n * Set only by an explicit `focus()` that arrived before the terminal existed. Nothing else sets\n * it, so a re-render, a write, or a resize can never move the caret into this element.\n */\n private focusWhenReady = false;\n /** Registered addon factories, one live instance each per connection. */\n private addonRegistrations = new Set<IAddonRegistration>();\n /** Owned for the length of a connection, so a cursor stops blinking live. */\n private reducedMotion: MediaQueryList | undefined;\n /**\n * What the reader last pressed in this window, a key or a pointer, so a focus that lands on the\n * terminal can be told apart as keyboard-initiated. Nothing is known before the first press, and\n * a focus nobody asked for, such as one on page load, flashes nothing.\n */\n private lastInteraction: 'keyboard' | 'pointer' | undefined;\n /** The flash of the house ring now playing, which alone may take its class off when it ends. */\n private focusFlash: Animation | undefined;\n private readyPending = true;\n private readyResolve: () => void = () => undefined;\n private readyReject: (reasonArg: unknown) => void = () => undefined;\n\n /**\n * Resolves once the terminal of the current connection is live; a fresh\n * promise is created for every connection. It rejects with the load error\n * when xterm cannot be loaded (`terminal-error` carries the same error), and\n * when the element is disconnected before the terminal came up.\n */\n public ready: Promise<void>;\n\n constructor() {\n super();\n this.ready = this.createReadyPromise();\n // The house lifecycle: startup runs on every connection with an abort\n // signal, garbage on every disconnection, so a reattached element is a\n // live surface again instead of a permanently dead one.\n this.registerStartupFunction(async (signalArg) => {\n // The query belongs to the connection, like the terminal it steers.\n this.reducedMotion = window.matchMedia(reducedMotionQuery);\n this.reducedMotion.addEventListener('change', this.applyCursorBlink);\n window.addEventListener('keydown', this.recordKeyboardInteraction, true);\n window.addEventListener('pointerdown', this.recordPointerInteraction, true);\n window.addEventListener('focus', this.handleWindowFocus);\n await this.ensureTerminal(signalArg);\n });\n this.registerGarbageFunction(() => {\n this.reducedMotion?.removeEventListener('change', this.applyCursorBlink);\n this.reducedMotion = undefined;\n window.removeEventListener('keydown', this.recordKeyboardInteraction, true);\n window.removeEventListener('pointerdown', this.recordPointerInteraction, true);\n window.removeEventListener('focus', this.handleWindowFocus);\n this.lastInteraction = undefined;\n this.teardownTerminal();\n });\n this.addEventListener('focusin', this.handleFocusIn);\n }\n\n public static styles = [\n themeDefaultStyles,\n xtermStyles,\n css`\n :host {\n display: block;\n min-height: 0;\n height: 100%;\n background: var(--dees-color-bg-primary);\n }\n\n .terminalHost {\n width: 100%;\n height: 100%;\n padding: var(--dees-spacing-xs);\n box-sizing: border-box;\n border-radius: var(--dees-radius-sm);\n }\n\n /*\n * xterm suppresses its own focus outline (see xtermStyles), and the surface\n * draws no lasting ring either: the caret already shows where typing goes.\n * The house ring flashes once when the focus arrives from the keyboard or\n * the window returns to a focused terminal (see flashFocusRing), and fades.\n * xterm's input is a textarea, which the platform counts as\n * :focus-visible after a click too, so :focus-visible cannot tell the two\n * apart. Under reduced motion the ring holds and then goes, without a fade.\n */\n .terminalHost.focusFlash {\n outline-offset: -2px;\n animation: terminalFocusFlash calc(var(--dees-transition-slower) * 2) var(--dees-ease-in);\n }\n\n @keyframes terminalFocusFlash {\n 0%,\n 50% {\n outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);\n }\n 100% {\n outline: var(--dees-line-width-focus-ring) solid transparent;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .terminalHost.focusFlash {\n animation-timing-function: step-end;\n }\n }\n\n /*\n * A restore paints invisibly. The grid keeps its layout, so fitting still measures it, and\n * it stays focusable: visibility: hidden would blur the input surface and refuse focus().\n */\n .terminalHost.restoring {\n opacity: 0;\n }\n `,\n ];\n\n public render(): TemplateResult {\n return html`<div class=\"terminalHost\"></div>`;\n }\n\n public connectedCallback(): Promise<void> {\n // A consumer awaiting readiness after reattaching must not be handed the\n // settled promise of the previous connection.\n if (!this.readyPending) this.ready = this.createReadyPromise();\n // A named group: assistive technology finds one surface with a name, and\n // the keyboard semantics stay on the input xterm renders inside it.\n this.setAttribute('role', 'group');\n this.setAttribute('aria-label', this.label);\n this.setAttribute('aria-disabled', String(this.disabled));\n return super.connectedCallback();\n }\n\n public updated(changedPropertiesArg: Map<string | number | symbol, unknown>): void {\n super.updated(changedPropertiesArg);\n if (changedPropertiesArg.has('label')) this.setAttribute('aria-label', this.label);\n if (changedPropertiesArg.has('disabled')) this.setAttribute('aria-disabled', String(this.disabled));\n const terminal = this.terminal;\n if (!terminal) return;\n // Every option below is one xterm reads on change, so a host can drive the\n // surface with property bindings instead of remounting it.\n if (changedPropertiesArg.has('fontSize')) {\n terminal.options.fontSize = this.fontSize;\n this.refit();\n }\n if (changedPropertiesArg.has('scrollback')) terminal.options.scrollback = this.scrollback;\n if (changedPropertiesArg.has('convertEol')) terminal.options.convertEol = this.convertEol;\n if (changedPropertiesArg.has('screenReaderMode')) {\n terminal.options.screenReaderMode = this.screenReaderMode;\n }\n if (changedPropertiesArg.has('readOnly') || changedPropertiesArg.has('disabled')) {\n terminal.options.disableStdin = this.stdinDisabled;\n terminal.options.cursorInactiveStyle = this.readOnly ? 'none' : inactiveCursor;\n terminal.options.cursorBlink = this.cursorBlinks;\n terminal.options.theme = this.surfaceTheme();\n }\n }\n\n /**\n * The grid follows the catalog theme live. DeesElement calls this before the\n * startup functions run, so the terminal of a connection that is still coming\n * up is themed by `createTerminal` from the same `goBright` instead.\n */\n protected themeChanged(_goBrightArg: boolean): void {\n if (this.terminal) this.terminal.options.theme = this.surfaceTheme();\n }\n\n /**\n * Registers an xterm addon with the surface, for a capability the element does\n * not own itself — a log view adds xterm's search addon this way. The terminal\n * is rebuilt on every connection, so the host hands over a factory: one\n * instance is created and loaded per terminal, reachable through\n * `handle.current`, and disposed with that terminal.\n *\n * An addon is a capability of the host, not the surface itself: a factory or\n * an `activate()` that throws is reported through `terminal-error` and leaves\n * `handle.current` undefined, while the terminal comes up and keeps working —\n * a broken search addon must not cost the reader the terminal. Unlike a setup\n * failure it therefore never settles `ready`. The registration survives, so\n * the factory is tried again for the terminal of the next connection.\n */\n public addAddon<T extends ITerminalAddon>(createArg: () => T): ITerminalAddonHandle<T> {\n const registration: IAddonRegistration<T> = { create: createArg, current: undefined };\n this.addonRegistrations.add(registration);\n if (this.terminal && this.isConnected) this.loadAddon(this.terminal, registration);\n return {\n get current(): T | undefined {\n return registration.current;\n },\n dispose: () => {\n this.addonRegistrations.delete(registration);\n registration.current?.dispose();\n registration.current = undefined;\n },\n };\n }\n\n /**\n * Scrolls to the newest output. A view that follows a live stream calls this\n * after writing; it is a no-op while no terminal is live, so a host does not\n * have to guard the call.\n */\n public scrollToBottom(): void {\n this.terminal?.scrollToBottom();\n }\n\n /** Feed remote output into the terminal; safe to call before setup finishes. */\n public write(dataArg: string | Uint8Array): void {\n // While detached the terminal is about to be disposed, so output belongs in\n // the buffer rather than in a surface nobody will see again.\n if (this.terminal && this.isConnected) {\n this.writeToTerminal(this.terminal, dataArg);\n return;\n }\n this.bufferWrite(dataArg);\n }\n\n /**\n * Reset the screen and scrollback, e.g. before a full replay. Before the terminal exists it also\n * replaces a buffered `restore()`, whose promise then resolves as superseded.\n */\n public clear(): void {\n const terminal = this.terminal;\n if (terminal && this.isConnected) {\n this.writeToTerminal(terminal, RIS);\n return;\n }\n // Without a terminal the reset is expressed as a buffered sentinel, so the\n // flush of the next connection still performs it in the right order.\n this.discardPendingOutput();\n this.bufferWrite(RIS);\n }\n\n /**\n * A snapshot of the terminal — screen, scrollback, modes and cursor — with the grid it was taken\n * at, which is the pair `restore()` takes: this is how a host moves a live terminal to another\n * element or persists it across a reload.\n *\n * It reads the live grid, so it is `undefined` while none is up: a detached element holds\n * buffered output, not a terminal, and the host's own copy of that output is what survives the\n * move. It is also `undefined` while a `restore()` is still being parsed, because the grid is\n * then half of the old state and half of the new, and while the serialize addon of this\n * connection could not be loaded — `terminal-error` reported that, and no snapshot is better\n * than a truncated one.\n */\n public serialize(): ITerminalSnapshot | undefined {\n const size = this.currentSize;\n if (!this.serializeAddon || !size || this.activeRestore) return undefined;\n return { data: this.serializeAddon.serialize(), size };\n }\n\n /**\n * Replace the terminal state with a serialized snapshot — one `serialize()` took here, or one a\n * host serialized elsewhere — and show it only once it is complete. A snapshot is exact only in\n * a grid of the size it was serialized at, so the terminal is fully reset (screen, scrollback,\n * modes, alternate buffer), set to `sizeArg`, fed `dataArg` while invisible, then fitted to its\n * container and revealed.\n * `terminal-resize` fires at the end when the fitted grid differs from `sizeArg`, which is the\n * host's cue to resize the PTY so the application redraws at the new size. Until then\n * `currentSize` reports `sizeArg`, so the closing event, or this promise, is what a host\n * negotiates a PTY size on.\n *\n * The restore is part of the output stream: writes issued after it are applied after the\n * snapshot, in order, at the fitted size. Like `write()` it is safe before the terminal exists\n * and while the element is detached; a buffered restore replaces everything buffered before\n * it. The terminal keeps its focus and keeps forwarding input while the restore runs.\n *\n * The promise resolves once the snapshot is on screen, and also, without revealing anything,\n * when a newer `restore()` supersedes this one or `clear()` replaces it while it is buffered.\n * It rejects, without ever surfacing as an unhandled rejection, when the element is\n * disconnected while the snapshot is being parsed (the terminal is disposed with it, as with\n * any live output), when output buffered after it pushes it out of `maxPendingWriteBytes`, and\n * when xterm refuses the data (`terminal-error` carries the same error). Buffered output is\n * dropped oldest first and the restore is the oldest entry, so a buffered snapshot that alone\n * exceeds the bound is dropped by the next buffered write of any size. An invalid size is a\n * programming error: the promise rejects with a `RangeError` and nothing changes; unlike the\n * reasons above this one is not pre-handled, so a `restore()` nobody observes reports it as an\n * unhandled rejection.\n *\n * There is a fourth outcome: a restore that is still buffered when the element is disconnected\n * stays pending, because the snapshot survives the move like buffered output and is applied on\n * the next connection. A host that discards the element instead of reattaching it must not await\n * that promise.\n *\n * @param dataArg The serialized terminal state.\n * @param sizeArg The grid the snapshot was serialized at: integer `cols` in [2, 65535] and\n * `rows` in [1, 65535].\n */\n public restore(dataArg: string | Uint8Array, sizeArg: ITerminalResizeDetail): Promise<void> {\n const { cols, rows } = sizeArg;\n if (!isGridDimension(cols, minRestoreCols) || !isGridDimension(rows, minRestoreRows)) {\n return Promise.reject(\n new RangeError(\n `restore() needs integer cols in [${minRestoreCols}, ${maxRestoreGridSize}] and rows in ` +\n `[${minRestoreRows}, ${maxRestoreGridSize}], got ${cols}x${rows}`,\n ),\n );\n }\n const restore = new TerminalRestore(dataArg, { cols, rows });\n const terminal = this.terminal;\n if (terminal && this.isConnected) {\n this.startRestore(terminal, restore);\n } else {\n this.discardPendingOutput();\n this.pendingRestore = restore;\n this.pendingWriteBytes = chunkByteLength(dataArg);\n }\n return restore.deferred.promise;\n }\n\n /**\n * Moves the caret into the terminal's input surface, so the next keystroke goes to the pty\n * rather than to whatever the page focused last. This is the call a host makes when the user\n * selects a terminal in a list.\n *\n * The terminal is created asynchronously — the xterm modules are loaded on first connection —\n * so a call that arrives before it exists is remembered and applied once it is ready, exactly\n * once. The same applies to an element that is focused while detached and then reattached: the\n * pending request is dropped on disconnect, because by then the user's intent has expired, and\n * a fresh `focus()` after the move is what a host should issue.\n *\n * Only this method arms that behaviour; re-renders, buffered output and background updates\n * never steal focus.\n */\n public focus(optionsArg?: FocusOptions): void {\n const terminal = this.terminal;\n if (terminal && this.isConnected) {\n this.focusWhenReady = false;\n terminal.focus();\n return;\n }\n // Preventing scroll is a hint for the eventual focus, not a reason to skip it.\n void optionsArg;\n this.focusWhenReady = true;\n }\n\n /** True while an explicit `focus()` is waiting for the terminal to come up. */\n public get focusPending(): boolean {\n return this.focusWhenReady;\n }\n\n /**\n * Current grid size, or undefined while no terminal is live. While a snapshot is being parsed\n * this is the grid the snapshot was serialized at; the closing `terminal-resize`, or the promise\n * `restore()` returned, is the grid to negotiate a PTY size on.\n */\n public get currentSize(): ITerminalResizeDetail | undefined {\n if (!this.terminal) return undefined;\n return { rows: this.terminal.rows, cols: this.terminal.cols };\n }\n\n private createReadyPromise(): Promise<void> {\n this.readyPending = true;\n const promise = new Promise<void>((resolveArg, rejectArg) => {\n this.readyResolve = () => {\n this.readyPending = false;\n resolveArg();\n };\n this.readyReject = (reasonArg) => {\n this.readyPending = false;\n rejectArg(reasonArg);\n };\n });\n // A readiness promise nobody awaits must never surface as an unhandled\n // rejection; consumers that do await it still observe the reason.\n promise.catch(() => undefined);\n return promise;\n }\n\n private bufferWrite(chunkArg: string | Uint8Array): void {\n this.pendingWrites.push(chunkArg);\n this.pendingWriteBytes += chunkByteLength(chunkArg);\n // Oldest first, and never the newest entry: a buffered restore is older\n // than every chunk, so it goes before any of them.\n while (\n this.pendingWriteBytes > maxPendingWriteBytes &&\n this.pendingWrites.length > (this.pendingRestore ? 0 : 1)\n ) {\n const droppedRestore = this.pendingRestore;\n if (droppedRestore) {\n this.pendingRestore = undefined;\n this.pendingWriteBytes -= chunkByteLength(droppedRestore.data);\n droppedRestore.deferred.reject(\n new Error(\n 'dees-terminal-view dropped a buffered restore: the output buffered after it exceeded maxPendingWriteBytes',\n ),\n );\n } else {\n this.pendingWriteBytes -= chunkByteLength(this.pendingWrites.shift()!);\n }\n this.pendingWritesDropped = true;\n }\n }\n\n /** Hands the buffered output over and leaves the buffer empty. */\n private takePendingOutput(): IPendingOutput {\n const output: IPendingOutput = {\n restore: this.pendingRestore,\n writes: this.pendingWrites,\n dropped: this.pendingWritesDropped,\n };\n this.pendingRestore = undefined;\n this.pendingWrites = [];\n this.pendingWriteBytes = 0;\n this.pendingWritesDropped = false;\n return output;\n }\n\n /** Empties the buffer ahead of a reset; a buffered restore is superseded by it. */\n private discardPendingOutput(): void {\n this.takePendingOutput().restore?.deferred.resolve();\n }\n\n private flushPendingWrites(terminalArg: Terminal): void {\n const { restore, writes, dropped } = this.takePendingOutput();\n if (restore && !this.startRestore(terminalArg, restore)) return;\n if (dropped && !this.writeToTerminal(terminalArg, RIS)) return;\n for (const chunk of writes) {\n if (!this.writeToTerminal(terminalArg, chunk)) return;\n }\n }\n\n /**\n * Queues a restore into xterm's write stream. Resetting and resizing happen in the callback of\n * the reset, so they take effect exactly at the restore's position in the stream, and the\n * restore ends in the callback of its snapshot, before xterm parses the next chunk.\n */\n private startRestore(terminalArg: Terminal, restoreArg: TerminalRestore): boolean {\n this.activeRestore?.deferred.resolve();\n this.activeRestore = restoreArg;\n this.terminalHost?.classList.add('restoring');\n try {\n terminalArg.write(RIS, () => this.applyRestoreSize(terminalArg, restoreArg));\n terminalArg.write(restoreArg.data, () => this.finishRestore(restoreArg));\n return true;\n } catch (error) {\n // xterm refused the snapshot at its flow-control watermark. A reset it did accept is parsed\n // later, finds the restore inactive and leaves the grid alone.\n this.endRestore();\n this.reportError(error);\n restoreArg.deferred.reject(error);\n return false;\n }\n }\n\n private applyRestoreSize(terminalArg: Terminal, restoreArg: TerminalRestore): void {\n if (this.activeRestore !== restoreArg) return;\n terminalArg.resize(restoreArg.size.cols, restoreArg.size.rows);\n // The host serialized the snapshot at this grid, so it is the size the host already knows:\n // the closing refit reports only a difference from it.\n this.lastReportedSize = gridKey(restoreArg.size);\n }\n\n private finishRestore(restoreArg: TerminalRestore): void {\n // A superseded restore was settled when the newer one started.\n if (this.activeRestore !== restoreArg) return;\n this.endRestore();\n restoreArg.deferred.resolve();\n }\n\n /**\n * Hands the grid back to the container: one refit, then the terminal is revealed. The refit\n * dispatches `terminal-resize` synchronously, and a restore its listener starts keeps the\n * terminal hidden.\n */\n private endRestore(): void {\n this.activeRestore = undefined;\n this.refit();\n if (!this.activeRestore) this.terminalHost?.classList.remove('restoring');\n }\n\n /** xterm throws at its own flow-control watermark; that has to reach the host. */\n private writeToTerminal(terminalArg: Terminal, chunkArg: string | Uint8Array): boolean {\n try {\n terminalArg.write(chunkArg);\n return true;\n } catch (error) {\n this.reportError(error);\n return false;\n }\n }\n\n /** A failure of the surface itself: it also settles `ready` for this connection. */\n private reportError(errorArg: unknown): void {\n if (this.readyPending) this.readyReject(errorArg);\n this.dispatchError(errorArg);\n }\n\n private dispatchError(errorArg: unknown): void {\n const detail: ITerminalErrorDetail = { error: errorArg };\n this.dispatchEvent(\n new CustomEvent('terminal-error', { detail, bubbles: true, composed: true }),\n );\n }\n\n private get terminalHost(): HTMLElement | null {\n return this.shadowRoot?.querySelector<HTMLElement>('.terminalHost') ?? null;\n }\n\n private ensureTerminal(signalArg: AbortSignal): Promise<void> {\n if (this.terminal) return Promise.resolve();\n if (!this.setupPromise) this.setupPromise = this.setupTerminal(signalArg);\n return this.setupPromise;\n }\n\n private async setupTerminal(signalArg: AbortSignal): Promise<void> {\n try {\n await this.createTerminal(signalArg);\n } catch (error) {\n this.reportError(error);\n } finally {\n // Nothing came up: release the guard so the next connection retries.\n if (!this.terminal) this.setupPromise = undefined;\n }\n }\n\n private async createTerminal(signalArg: AbortSignal): Promise<void> {\n await this.updateComplete;\n const libLoader = DeesServiceLibLoader.getInstance();\n const [xterm, fit, serialize, webLinks] = await Promise.all([\n libLoader.loadXterm(),\n libLoader.loadXtermFitAddon(),\n // Two capabilities of the surface, neither of them the surface: a\n // snapshot to hand to `restore()`, and clickable URLs. A load that fails\n // is reported like a broken addon and costs only its capability.\n this.optionalModule(libLoader.loadXtermSerializeAddon()),\n this.optionalModule(libLoader.loadXtermWebLinksAddon()),\n ]);\n // The load was awaited: the element may have been detached meanwhile.\n if (signalArg.aborted || !this.isConnected) return;\n const host = this.terminalHost;\n if (!host) return;\n const terminal = new xterm.Terminal({\n fontSize: this.fontSize,\n fontFamily: terminalFontFamily,\n cursorBlink: this.cursorBlinks,\n cursorInactiveStyle: this.readOnly ? 'none' : inactiveCursor,\n disableStdin: this.stdinDisabled,\n screenReaderMode: this.screenReaderMode,\n allowProposedApi: true,\n scrollback: this.scrollback,\n convertEol: this.convertEol,\n theme: this.surfaceTheme(),\n });\n let fitAddon: FitAddon;\n try {\n fitAddon = new fit.FitAddon();\n terminal.loadAddon(fitAddon);\n terminal.open(host);\n } catch (error) {\n // The element does not own this instance yet, so teardown cannot reach\n // it; a half-opened terminal would otherwise leak with its DOM attached.\n try {\n terminal.dispose();\n } catch {\n // Disposing a half-opened terminal must not mask the real failure.\n }\n throw error;\n }\n this.terminal = terminal;\n this.fitAddon = fitAddon;\n if (serialize) {\n this.serializeAddon = this.createAddon(terminal, () => new serialize.SerializeAddon());\n }\n if (webLinks) {\n // The instance is disposed with the terminal, so nothing holds it here.\n this.createAddon(terminal, () => new webLinks.WebLinksAddon(this.openLink));\n }\n for (const registration of this.addonRegistrations) this.loadAddon(terminal, registration);\n this.inputDisposable = terminal.onData((dataArg) => {\n if (this.disabled) return;\n const detail: ITerminalInputDetail = { data: dataArg };\n this.dispatchEvent(\n new CustomEvent('terminal-input', { detail, bubbles: true, composed: true }),\n );\n });\n this.flushPendingWrites(terminal);\n this.refit();\n this.resizeObserver = new ResizeObserver(() => this.refit());\n this.resizeObserver.observe(host);\n // An explicit focus() that arrived before the terminal existed is honoured now, once.\n if (this.focusWhenReady) {\n this.focusWhenReady = false;\n terminal.focus();\n }\n this.readyResolve();\n }\n\n /**\n * The addon of one registration, loaded into the terminal of this connection.\n * A factory or an `activate()` that throws is isolated: the host hears about\n * it through `terminal-error`, the registration keeps no instance, and the\n * terminal itself is unaffected (see `addAddon`).\n */\n private loadAddon(terminalArg: Terminal, registrationArg: IAddonRegistration): void {\n registrationArg.current = this.createAddon(terminalArg, registrationArg.create);\n }\n\n /**\n * One addon into the terminal, isolated: an addon carries a capability, and\n * no capability is worth the terminal, so a factory or an `activate()` that\n * throws is reported through `terminal-error` and leaves the capability off\n * for this connection. Used for the host's registrations and for the two\n * addons the view loads for itself.\n */\n private createAddon<T extends ITerminalAddon>(\n terminalArg: Terminal,\n createArg: () => T,\n ): T | undefined {\n try {\n const addon = createArg();\n terminalArg.loadAddon(addon);\n return addon;\n } catch (error) {\n this.dispatchError(error);\n return undefined;\n }\n }\n\n /**\n * A module the surface can do without. Its load failure is reported like a\n * broken addon rather than through `ready`, because a CDN that is missing one\n * addon must not cost the reader the terminal.\n */\n private async optionalModule<T>(loadArg: Promise<T>): Promise<T | undefined> {\n try {\n return await loadArg;\n } catch (error) {\n this.dispatchError(error);\n return undefined;\n }\n }\n\n /**\n * Opens a link from the terminal output, as xterm's own handler does: a new\n * tab with no opener, so the page cannot be reached back through\n * `window.opener`. A surface the host marked `disabled` is not operable, so\n * nothing opens from it; `readOnly` is about typing, not about reading, and a\n * log or a transcript is exactly where a link is worth following.\n */\n private readonly openLink = (_eventArg: MouseEvent, uriArg: string): void => {\n if (this.disabled) return;\n window.open(uriArg, '_blank', 'noopener');\n };\n\n /** The theme of the surface: read-only means no caret, in either focus state. */\n private surfaceTheme(): ReturnType<typeof terminalTheme> {\n const theme = terminalTheme(this.goBright);\n // xterm has no cursor style that hides a focused caret, so a read-only\n // surface paints it in its own background.\n return this.readOnly ? { ...theme, cursor: theme.background } : theme;\n }\n\n /** xterm's own input gate; the host-facing contract is `terminal-input`. */\n private get stdinDisabled(): boolean {\n return this.readOnly || this.disabled;\n }\n\n /** A blinking caret is motion, and a read-only surface has no caret at all. */\n private get cursorBlinks(): boolean {\n return !this.readOnly && !this.reducedMotion?.matches;\n }\n\n private readonly applyCursorBlink = (): void => {\n if (this.terminal) this.terminal.options.cursorBlink = this.cursorBlinks;\n };\n\n private readonly recordKeyboardInteraction = (): void => {\n this.lastInteraction = 'keyboard';\n };\n\n private readonly recordPointerInteraction = (): void => {\n this.lastInteraction = 'pointer';\n };\n\n /** The input xterm types into, while the terminal of this connection is up. */\n private get terminalInput(): HTMLTextAreaElement | undefined {\n return this.terminal?.textarea;\n }\n\n /**\n * The focus arrived on xterm's input. It flashes the ring when a key brought it there — Tab, a\n * host's shortcut, a list entry chosen with Enter — and not when a pointer did: a reader who\n * clicked the terminal already knows where typing goes.\n */\n private readonly handleFocusIn = (eventArg: FocusEvent): void => {\n const input = this.terminalInput;\n if (!input || eventArg.composedPath()[0] !== input) return;\n if (this.lastInteraction === 'keyboard') this.flashFocusRing();\n };\n\n /**\n * The window became active again, from another tab or another application, with the focus still\n * on this terminal: typing goes straight into it, which the flash says before the first key.\n */\n private readonly handleWindowFocus = (eventArg: FocusEvent): void => {\n if (eventArg.target !== window) return;\n const input = this.terminalInput;\n if (input && this.shadowRoot?.activeElement === input) this.flashFocusRing();\n };\n\n /**\n * Plays the ring once from the start; a flash still running starts over. The class goes when the\n * flash ends or is cancelled — a surface hidden mid-flash cancels it — so a surface shown again\n * does not replay a flash nobody asked for. A surface that plays nothing, being hidden already,\n * keeps no class either.\n */\n private flashFocusRing(): void {\n const host = this.terminalHost;\n if (!host) return;\n host.classList.remove('focusFlash');\n // Reading the layout ends the removed animation, so the class added next starts a new one.\n void host.offsetWidth;\n host.classList.add('focusFlash');\n const flash = host\n .getAnimations()\n .find((animationArg) => (animationArg as CSSAnimation).animationName === 'terminalFocusFlash');\n this.focusFlash = flash;\n if (!flash) {\n host.classList.remove('focusFlash');\n return;\n }\n const endFlash = (): void => {\n // A flash that was started over settles after the new one took the class.\n if (this.focusFlash !== flash) return;\n this.focusFlash = undefined;\n host.classList.remove('focusFlash');\n };\n flash.finished.then(endFlash, endFlash);\n }\n\n private refit(): void {\n // A restore owns the grid until its snapshot is parsed and refits once when it ends.\n if (!this.terminal || !this.fitAddon || this.activeRestore) return;\n // A hidden tab, a collapsed panel or a pane mid-drag measures zero, and a fit\n // there would snap the grid to xterm's 2x1 minimum and reflow the scrollback\n // around it. The same ResizeObserver reports the box again when it returns,\n // and that observation is the fit — no timer waits for it. The element is\n // measured rather than the padded grid host, whose client box never reaches\n // zero while the padding is there.\n if (!this.isConnected || !this.terminalHost) return;\n if (this.clientWidth === 0 || this.clientHeight === 0) return;\n try {\n this.fitAddon.fit();\n } catch {\n return;\n }\n const size = gridKey(this.terminal);\n if (size === this.lastReportedSize) return;\n this.lastReportedSize = size;\n const detail: ITerminalResizeDetail = {\n rows: this.terminal.rows,\n cols: this.terminal.cols,\n };\n this.dispatchEvent(\n new CustomEvent('terminal-resize', { detail, bubbles: true, composed: true }),\n );\n }\n\n private teardownTerminal(): void {\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n this.inputDisposable?.dispose();\n this.inputDisposable = undefined;\n // A disposed terminal never parses the rest of its queue, so a restore in flight would\n // otherwise stay pending forever; the snapshot is lost with the terminal, like live output.\n const interruptedRestore = this.activeRestore;\n this.activeRestore = undefined;\n this.terminalHost?.classList.remove('restoring');\n // Disposing the terminal disposes the addons loaded into it, so the\n // registrations only lose the instance of the connection that ended.\n this.terminal?.dispose();\n this.terminal = undefined;\n this.fitAddon = undefined;\n this.serializeAddon = undefined;\n for (const registration of this.addonRegistrations) registration.current = undefined;\n // Instance state of the finished connection: a reattached element has to\n // re-announce its grid and may retry a load that failed.\n this.lastReportedSize = '';\n this.setupPromise = undefined;\n // A focus request belongs to the connection it was made in; a reattached element must not\n // grab the caret from wherever the user moved it meanwhile.\n this.focusWhenReady = false;\n // Buffered output deliberately survives, so a replay that arrived while the\n // element was detached still reaches the next connection.\n if (this.readyPending) {\n this.readyReject(\n new Error('dees-terminal-view was disconnected before the terminal became ready'),\n );\n }\n interruptedRestore?.deferred.reject(\n new Error('dees-terminal-view was disconnected before the restore completed'),\n );\n }\n}\n","import {\n DeesElement,\n property,\n html,\n customElement,\n type TemplateResult,\n css,\n cssManager,\n directives,\n state,\n} from '@design.estate/dees-element';\nimport type { TDcTranslator } from '../../../i18n/messages.js';\nimport { dcLocalize } from '../../../i18n/localize.js';\n\nimport { themeDefaultStyles } from '../../00theme.js';\nimport { OverlayScrollbarController, overlayScrollbarStyles } from '../../00scrollbars.js';\nimport '../../00group-appui/dees-appui-tabs/dees-appui-tabs.js';\nimport type { IMenuItem } from '../../interfaces/tab.js';\nimport { DeesModal } from '../../00group-overlay/dees-modal/dees-modal.js';\nimport type { IExecutionEnvironment, IProcessHandle } from '../../00group-runtime/index.js';\nimport { WebContainerEnvironment } from '../../00group-runtime/index.js';\nimport '../../00group-utility/dees-icon/dees-icon.js';\nimport '../../00group-feedback/dees-actionbar/dees-actionbar.js';\nimport type { DeesActionbar } from '../../00group-feedback/dees-actionbar/dees-actionbar.js';\nimport type {\n IActionBarAction,\n IActionBarResult,\n} from '../../00group-feedback/dees-actionbar/actionbar.interfaces.js';\nimport '../../00group-terminal/dees-terminal-view/dees-terminal-view.js';\nimport {\n DeesTerminalView,\n type ITerminalErrorDetail,\n type ITerminalInputDetail,\n type ITerminalResizeDetail,\n} from '../../00group-terminal/dees-terminal-view/dees-terminal-view.js';\nimport type {\n ITerminalTab,\n ITerminalTabCommand,\n ICreateTerminalTabOptions,\n TTerminalTabType,\n} from './interfaces.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'dees-workspace-terminal': DeesWorkspaceTerminal;\n }\n}\n\n/** Below this width the tab strip lies down along the bottom edge. */\nconst compactWidth = 520;\n\n/** The label and icon a tab gets when the host names neither. */\nconst tabDefaults: Record<\n TTerminalTabType,\n { icon: string; label: (tArg: TDcTranslator, metadataArg?: ITerminalTab['metadata']) => string }\n> = {\n shell: { icon: 'lucide:terminal', label: (tArg) => tArg('terminal.shell') },\n script: { icon: 'lucide:play', label: (tArg, metadataArg) => metadataArg?.scriptName || tArg('terminal.script') },\n 'package-update': {\n icon: 'lucide:packageCheck',\n label: (tArg, metadataArg) => (metadataArg?.packageName\n ? tArg('terminal.updatePackage', { name: metadataArg.packageName })\n : tArg('terminal.update')),\n },\n custom: { icon: 'lucide:code', label: (tArg, metadataArg) => metadataArg?.command || tArg('terminal.process') },\n};\n\ntype TStatusTone = 'muted' | 'alert';\n\n/**\n * A line the panel writes into a session itself rather than something the\n * process printed, so it is bracketed and carries one of two palette colours:\n * bright black for a note, red for a failure. SGR is how a terminal takes\n * colour, and both codes resolve through `terminalTheme()` to catalog tokens.\n */\nconst statusLine = (textArg: string, toneArg: TStatusTone): string =>\n `\\x1b[${toneArg === 'alert' ? 31 : 90}m${textArg}\\x1b[0m\\r\\n`;\n\n/** The same line where it interrupts output, so it starts on a line of its own. */\nconst interruptingLine = (textArg: string, toneArg: TStatusTone): string =>\n `\\r\\n${statusLine(textArg, toneArg)}`;\n\nconst errorText = (errorArg: unknown): string =>\n errorArg instanceof Error ? errorArg.message : String(errorArg);\n\n/** What the bar of an ended session says about it. */\nconst endedMessage = (tArg: TDcTranslator, tabArg: ITerminalTab): string => {\n if (tabArg.exitCode === null) return tArg('terminal.couldNotRun', { label: tabArg.label });\n if (tabArg.exitCode === 0) return tArg('terminal.completed', { label: tabArg.label });\n return tArg('terminal.exited', { label: tabArg.label, code: String(tabArg.exitCode) });\n};\n\n/**\n * Terminal sessions for a workspace: a tab strip, and per tab one\n * `dees-terminal-view` wired to a process of the host's `IExecutionEnvironment`.\n * The panel drives no xterm API of its own — the view is the surface, this is\n * the session bookkeeping and the process plumbing around it. Every view is\n * created with its tab and stays mounted for the tab's whole life; switching\n * tabs only changes which one is visible, so a session keeps its scrollback,\n * and a background session keeps tracking the panel size instead of reflowing\n * when the reader comes back to it.\n *\n * A session lives inside one connection. The DOM cannot tell a host that moves\n * this element from a host that throws it away, while a process of an execution\n * environment outlives the DOM, so disconnecting ends every session: the\n * processes are killed, the streams released and the tabs dropped. Reconnecting\n * opens a fresh default session, so a reattached panel is a live terminal again\n * rather than an empty one. Both consumers discard this element by removing it\n * (`dees-workspace` when its runtime goes away, `dees-simple-appdash` when the\n * reader closes the terminal layer) and neither has a disposal hook, so this is\n * the contract that never leaves a process running behind a panel nobody sees.\n *\n * Nothing closes by itself: a session whose process ended keeps its tab and its\n * output until the reader closes it or runs the command again.\n */\n@customElement('dees-workspace-terminal')\nexport class DeesWorkspaceTerminal extends DeesElement {\n public static demo = () => {\n const env = new WebContainerEnvironment();\n return html`<dees-workspace-terminal .executionEnvironment=${env}></dees-workspace-terminal>`;\n };\n public static demoGroups = ['Workspace'];\n\n private readonly t = dcLocalize(this);\n\n // INSTANCE\n\n /**\n * The execution environment sessions run in. Without one the panel says so\n * and opens nothing: there is no shell to guess.\n */\n @property({ type: Object })\n accessor executionEnvironment: IExecutionEnvironment | null = null;\n\n /**\n * Written to the first session's stdin as soon as its shell is running. The\n * PTY buffers it until the shell reads it, so no prompt is waited for.\n */\n @property({ reflect: true })\n accessor setupCommand = '';\n\n /**\n * Width of the tab bar in pixels\n */\n @property({ type: Number, reflect: true })\n accessor tabBarWidth: number = 160;\n\n /**\n * Whether to show the tab bar\n */\n @property({ type: Boolean, reflect: true })\n accessor showTabBar: boolean = true;\n\n /** Open sessions, oldest first. The tab holds its own surface and streams. */\n @state()\n accessor tabs: ITerminalTab[] = [];\n\n @state()\n accessor activeTabId: string | null = null;\n\n @state() private accessor compact = false;\n\n private terminalActionbar: DeesActionbar | null = null;\n /** Watches this element's own box, for the one thing CSS cannot do: the strip's orientation. */\n private resizeObserver: ResizeObserver | undefined;\n /** The signal of the live connection; every step that awaits re-checks it. */\n private connectionSignal: AbortSignal | undefined;\n private tabCounter = 0;\n\n constructor() {\n super();\n // The house lifecycle: a connection opens its default session and a\n // disconnection ends every session, so the element is never half-alive.\n this.registerStartupFunction(async (signalArg) => {\n this.connectionSignal = signalArg;\n this.compact = this.clientWidth <= compactWidth;\n this.resizeObserver = new ResizeObserver(() => {\n this.compact = this.clientWidth <= compactWidth;\n });\n this.resizeObserver.observe(this);\n await this.openDefaultSession();\n });\n this.registerGarbageFunction(() => {\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n this.connectionSignal = undefined;\n this.endAllSessions();\n });\n }\n\n /** The session list's scrollbar, shown while it scrolls. */\n private readonly scrollbars = new OverlayScrollbarController(\n this,\n () => this.shadowRoot?.querySelector<HTMLElement>('.tab-list'),\n );\n\n public static styles = [\n themeDefaultStyles,\n cssManager.defaultStyles,\n overlayScrollbarStyles,\n css`\n @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }\n button { border: 0; font: inherit; background: transparent; }\n button:focus-visible { outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring); outline-offset: -2px; }\n :host {\n background: var(--dees-color-bg-primary);\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n min-width: 0;\n container-type: inline-size;\n }\n\n * {\n box-sizing: border-box;\n }\n\n .terminal-container {\n display: flex;\n flex-direction: row;\n width: 100%;\n height: 100%;\n }\n\n .terminal-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: var(--dees-color-bg-primary);\n }\n\n /*\n * Every session is stacked in the same box, so all of them are laid out at\n * the size of the panel and the one on top needs no refit when it is\n * revealed. visibility, not display: none, is what keeps that true, and it\n * takes the hidden ones out of the tab order and out of assistive tech.\n */\n .sessions {\n position: relative;\n flex: 1;\n min-height: 0;\n margin: var(--dees-spacing-sm);\n }\n\n .session {\n position: absolute;\n inset: 0;\n visibility: hidden;\n }\n\n .session.active {\n visibility: visible;\n }\n\n .terminal-content dees-actionbar {\n flex-shrink: 0;\n }\n\n /* Tab bar on the right side, the box the session list's overlay scrollbar is placed in */\n .tab-bar {\n position: relative;\n display: flex;\n flex-direction: column;\n background: var(--dees-color-bg-secondary);\n border-left: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);\n flex-shrink: 0;\n overflow: hidden;\n }\n\n .tab-bar-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--dees-spacing-sm) var(--dees-spacing-md);\n border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);\n font-size: var(--dees-font-caption2-size);\n font-weight: 600;\n color: var(--dees-color-text-muted);\n }\n\n .tab-bar-title {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .tab-bar-actions {\n display: flex;\n gap: var(--dees-spacing-2xs);\n }\n\n .tab-action {\n width: 22px;\n height: 22px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--dees-radius-sm);\n cursor: pointer;\n color: var(--dees-color-text-muted);\n transition: all var(--dees-transition-fast) var(--dees-ease-standard);\n }\n\n .tab-action:hover {\n background: color-mix(in srgb, var(--dees-color-text-primary) 8%, transparent);\n color: var(--dees-color-text-secondary);\n }\n\n .tab-list {\n flex: 1;\n overflow-y: auto;\n padding: 4px;\n }\n\n @container (max-width: 520px) {\n .terminal-container { flex-direction: column; }\n .tab-bar { width: 100% !important; height: 40px; flex-direction: row; border-left: 0; border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle); }\n .tab-bar-title { display: none; }\n .tab-bar-header { padding: 0 8px; border: 0; }\n .tab-list { padding: 0; min-width: 0; overflow: hidden; }\n dees-appui-tabs { --dees-appui-row-height: 40px; --dees-appui-chrome-bg: var(--dees-color-bg-secondary); }\n }\n .empty-state {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n color: var(--dees-color-text-muted);\n font-size: 13px;\n gap: 8px;\n }\n `,\n ];\n\n public render(): TemplateResult {\n const terminalTabs: IMenuItem[] = this.tabs.map(tab => ({\n key: tab.id, label: tab.label, iconName: tab.iconName,\n badge: tab.exited ? this.exitBadge(tab) : undefined,\n badgeVariant: tab.exitCode === 0 ? 'success' : 'error',\n action: () => { this.activateTab(tab.id, true); }, closeable: tab.closeable,\n onClose: () => { this.closeTab(tab.id); },\n onRename: async () => {\n await DeesModal.prompt({\n heading: this.t('terminal.renameSession'), label: this.t('terminal.sessionName'), value: tab.label,\n confirmLabel: this.t('common.rename'), i18n: this.t.i18n,\n onConfirm: (label) => {\n if (!this.tabs.includes(tab)) throw new Error(this.t('terminal.sessionClosed'));\n this.renameTab(tab, label);\n },\n });\n },\n }));\n\n return html`\n <div class=\"terminal-container\">\n <!-- Main terminal area -->\n <div class=\"terminal-content\">\n <div class=\"sessions\">\n ${directives.repeat(this.tabs, (tab) => tab.id, (tab) => html`\n <div class=\"session ${tab.id === this.activeTabId ? 'active' : ''}\">${tab.view}</div>\n `)}\n ${this.tabs.length ? '' : html`\n <div class=\"empty-state\">\n <dees-icon .icon=${'lucide:terminal'} iconSize=\"32\"></dees-icon>\n <span>${this.emptyStateMessage}</span>\n </div>\n `}\n </div>\n <dees-actionbar></dees-actionbar>\n </div>\n\n <!-- Vertical tab bar on the right -->\n ${this.showTabBar ? html`\n <div class=\"tab-bar\" style=\"width: ${this.tabBarWidth}px\">\n <div class=\"tab-bar-header\">\n <span class=\"tab-bar-title\">${this.t('terminal.sessions')}</span>\n <div class=\"tab-bar-actions\">\n ${this.canOpenShell ? html`\n <button type=\"button\" class=\"tab-action\" @click=${this.handleAddTab} aria-label=${this.t('terminal.newTerminal')} title=${this.t('terminal.newTerminal')}>\n <dees-icon .icon=${'lucide:plus'} iconSize=\"14\"></dees-icon>\n </button>\n ` : ''}\n </div>\n </div>\n\n <div class=\"tab-list\">\n <dees-appui-tabs appearance=\"sidebar\" style=\"--dees-tabs-font-size: 12px\" .tabs=${terminalTabs} .selectedTab=${terminalTabs.find(tab => tab.key === this.activeTabId) ?? null} .tabStyle=${this.compact ? 'horizontal' : 'vertical'}></dees-appui-tabs>\n </div>\n </div>\n ` : ''}\n </div>\n `;\n }\n\n public updated(changedPropertiesArg: Map<string | number | symbol, unknown>): void {\n super.updated(changedPropertiesArg);\n // A host that resolves its runtime after mounting the panel gets its default\n // session then, instead of an empty panel that never fills.\n if (changedPropertiesArg.has('executionEnvironment')) void this.openDefaultSession();\n }\n\n // ========== Sessions ==========\n\n /** Whether the host's environment runs processes and can say which shell a session should run. */\n private get canOpenShell(): boolean {\n return this.executionEnvironment?.spawn !== undefined\n && this.executionEnvironment.getShellCommand !== undefined;\n }\n\n /** Why there is no session, so an unconfigured panel does not look broken. */\n private get emptyStateMessage(): string {\n if (!this.executionEnvironment) return this.t('terminal.noEnvironment');\n if (!this.executionEnvironment.spawn) return this.t('terminal.noProcesses');\n if (!this.canOpenShell) return this.t('terminal.noShell');\n return this.t('terminal.noSession');\n }\n\n /** True while the connection that started an awaited step is still the live one. */\n private get connectionLive(): boolean {\n const signal = this.connectionSignal;\n return this.isConnected && signal !== undefined && !signal.aborted;\n }\n\n private isLiveTab(tabArg: ITerminalTab): boolean {\n return this.connectionLive && this.tabs.includes(tabArg);\n }\n\n private tabOf(tabIdArg: string): ITerminalTab | undefined {\n return this.tabs.find((tab) => tab.id === tabIdArg);\n }\n\n /** The session a connected panel starts with; it does not take the caret. */\n private async openDefaultSession(): Promise<void> {\n if (!this.connectionLive || !this.canOpenShell || this.tabs.length) return;\n await this.openShellSession(false);\n }\n\n /** Opens a shell session and puts a refusal of the environment on screen. */\n private async openShellSession(focusArg: boolean): Promise<void> {\n try {\n await this.openShell(undefined, focusArg);\n } catch (error) {\n this.reportFailure(this.t('terminal.startFailed', { reason: errorText(error) }));\n }\n }\n\n private handleAddTab(): void {\n void this.openShellSession(true);\n }\n\n private async openShell(labelArg: string | undefined, focusArg: boolean): Promise<string | null> {\n const environment = this.executionEnvironment;\n if (!environment?.spawn || !environment.getShellCommand) return null;\n const shell = await environment.getShellCommand();\n if (!this.connectionLive) return null;\n const tab = this.createTab({\n type: 'shell',\n label: labelArg || `${shell.label || shell.command} ${this.tabs.length + 1}`,\n // The session a panel opens by itself is the one the reader cannot lose.\n closeable: this.tabs.length > 0,\n });\n this.activateTab(tab.id, focusArg);\n await this.startProcess(tab, { command: shell.command, args: shell.args ?? [] });\n if (this.setupCommand && this.tabs.length === 1) this.sendInput(tab, this.setupCommand);\n this.announceTab(tab);\n return tab.id;\n }\n\n /** A tab and its surface. The view is mounted by the next render and stays. */\n private createTab(optionsArg: ICreateTerminalTabOptions): ITerminalTab {\n this.tabCounter++;\n const defaults = tabDefaults[optionsArg.type];\n const label = optionsArg.label || defaults.label(this.t, optionsArg.metadata);\n const view = new DeesTerminalView();\n view.label = label;\n const tab: ITerminalTab = {\n id: `terminal-${this.tabCounter}-${Date.now()}`,\n label,\n iconName: optionsArg.iconName || defaults.icon,\n type: optionsArg.type,\n closeable: optionsArg.closeable ?? optionsArg.type !== 'shell',\n view,\n process: null,\n stdin: null,\n outputPipe: null,\n command: null,\n exited: false,\n exitCode: null,\n createdAt: Date.now(),\n metadata: optionsArg.metadata,\n };\n view.addEventListener('terminal-input', (eventArg) => {\n this.sendInput(tab, (eventArg as CustomEvent<ITerminalInputDetail>).detail.data);\n });\n view.addEventListener('terminal-resize', (eventArg) => {\n // The view owns the grid; the PTY follows it, which is the whole resize path.\n tab.process?.resize?.((eventArg as CustomEvent<ITerminalResizeDetail>).detail);\n });\n this.tabs = [...this.tabs, tab];\n return tab;\n }\n\n /** `tab-created`, once the session is running — and only if it still exists. */\n private announceTab(tabArg: ITerminalTab): void {\n if (!this.tabs.includes(tabArg)) return;\n this.dispatchEvent(\n new CustomEvent('tab-created', { bubbles: true, composed: true, detail: { tabId: tabArg.id } }),\n );\n }\n\n private renameTab(tabArg: ITerminalTab, labelArg: string): void {\n tabArg.label = labelArg;\n tabArg.view.label = labelArg;\n this.tabs = [...this.tabs];\n }\n\n /** '!' is the badge of a session that ended without ever giving an exit code. */\n private exitBadge(tabArg: ITerminalTab): string {\n return tabArg.exitCode === null ? '!' : String(tabArg.exitCode);\n }\n\n /**\n * Shows a session, and puts the caret in it when the reader asked for it —\n * also when it is already the visible one, because selecting a session the\n * reader is looking at still means \"let me type here\".\n */\n private activateTab(tabIdArg: string, focusArg: boolean): void {\n const tab = this.tabOf(tabIdArg);\n if (!tab) return;\n const previousTabId = this.activeTabId;\n this.activeTabId = tabIdArg;\n if (focusArg) {\n // A hidden surface cannot take the caret, so the focus waits for the\n // render that reveals it — the update is the event, no timer is needed.\n // Lit rejects `updateComplete` when a render threw, and a panel that\n // cannot render is a defect the host has to hear about.\n void this.updateComplete\n .then(() => {\n if (this.activeTabId === tabIdArg && this.tabs.includes(tab)) tab.view.focus();\n })\n .catch(this.reportInternalError);\n }\n if (previousTabId === tabIdArg) return;\n this.dispatchEvent(\n new CustomEvent('tab-switched', {\n bubbles: true,\n composed: true,\n detail: { tabId: tabIdArg, previousTabId },\n }),\n );\n }\n\n // ========== Processes ==========\n\n /**\n * Runs a command in a tab: the environment is initialised if it is not ready,\n * the process is spawned at the grid the view reports, and its streams are\n * held on the tab until it ends, the tab closes or the element disconnects.\n */\n private async startProcess(tabArg: ITerminalTab, commandArg: ITerminalTabCommand): Promise<void> {\n tabArg.command = commandArg;\n // Running a session again drops the state of the run before it, badge included.\n if (tabArg.exited) {\n tabArg.exited = false;\n tabArg.exitCode = null;\n this.tabs = [...this.tabs];\n }\n const environment = this.executionEnvironment;\n if (!environment?.spawn) {\n this.failTab(tabArg, environment ? 'this environment runs no processes' : 'no execution environment');\n return;\n }\n try {\n // The view is mounted by the render this tab triggered, and its grid is\n // what the PTY is opened at, so the first frame a process draws fits.\n await this.updateComplete;\n if (!this.isLiveTab(tabArg)) return;\n await tabArg.view.ready;\n if (!this.isLiveTab(tabArg)) return;\n if (!environment.ready) {\n tabArg.view.write(statusLine(this.t('terminal.startingEnvironment'), 'muted'));\n await environment.init();\n if (!this.isLiveTab(tabArg)) return;\n }\n const process = await environment.spawn(commandArg.command, commandArg.args, {\n terminal: tabArg.view.currentSize,\n });\n if (!this.isLiveTab(tabArg)) {\n process.kill();\n return;\n }\n this.attachProcess(tabArg, process);\n } catch (error) {\n if (!this.isLiveTab(tabArg)) return;\n this.failTab(tabArg, errorText(error));\n }\n }\n\n /** Holds a running process on its tab; every promise it hands out is answered. */\n private attachProcess(tabArg: ITerminalTab, processArg: IProcessHandle): void {\n // A run before this one may still hold a pipe it never closed. It has\n // nothing left to deliver, and a tab pipes one process at a time.\n tabArg.outputPipe?.abort();\n const outputPipe = new AbortController();\n tabArg.process = processArg;\n tabArg.stdin = processArg.input.getWriter();\n tabArg.outputPipe = outputPipe;\n const drained = processArg.output\n .pipeTo(\n new WritableStream<string>({ write: (chunkArg) => { tabArg.view.write(chunkArg); } }),\n { signal: outputPipe.signal },\n )\n .catch((error) => {\n // Aborting the pipe is how a tab releases it. Anything else broke while\n // the process was still writing, and belongs on the reader's screen.\n if (!outputPipe.signal.aborted && tabArg.outputPipe === outputPipe) {\n this.failTab(tabArg, errorText(error));\n }\n })\n .finally(() => {\n // The process closed its output: there is nothing left to abort.\n if (tabArg.outputPipe === outputPipe) tabArg.outputPipe = null;\n });\n processArg.exit.then(\n (exitCodeArg) => {\n if (tabArg.process === processArg) this.endTab(tabArg, exitCodeArg, drained);\n },\n (error) => {\n if (tabArg.process === processArg) this.failTab(tabArg, errorText(error));\n },\n );\n }\n\n /**\n * One keystroke, or a setup command, on the process's stdin. A tab whose\n * process has ended has nowhere to put it: its view keeps showing what the\n * process left behind, and typing into it does nothing.\n */\n private sendInput(tabArg: ITerminalTab, dataArg: string): void {\n const writer = tabArg.stdin;\n if (!writer) return;\n writer.write(dataArg).catch((error) => {\n // A write that loses the race against the process's own end is expected:\n // by then the tab holds a different writer, or none at all.\n if (tabArg.stdin === writer) this.failTab(tabArg, errorText(error));\n });\n }\n\n /** A process that ended on its own. The tab and its output stay. */\n private endTab(tabArg: ITerminalTab, exitCodeArg: number, drainedArg: Promise<void>): void {\n this.markEnded(tabArg, exitCodeArg);\n this.dispatchEvent(\n new CustomEvent('process-complete', {\n bubbles: true,\n composed: true,\n detail: { tabId: tabArg.id, exitCode: exitCodeArg },\n }),\n );\n // The note belongs after the last thing the process printed, so it waits\n // for the output pipe instead of racing chunks still in flight. Releasing\n // the tab settles that pipe too, so the wait cannot outlive the session —\n // and a process that leaves its output open simply gets no note.\n void drainedArg.then(() => {\n if (tabArg.process !== null || !this.tabs.includes(tabArg)) return;\n tabArg.view.write(\n exitCodeArg === 0\n ? interruptingLine(this.t('terminal.processCompleted'), 'muted')\n : interruptingLine(this.t('terminal.processExited', { code: String(exitCodeArg) }), 'alert'),\n );\n });\n void this.offerEndedTab(tabArg).catch(this.reportInternalError);\n }\n\n /**\n * A session that could not run, or whose streams broke: the same ended state\n * with no exit code and the reason on screen. `process-complete` carries an\n * exit code, so it is not dispatched for an end that produced none.\n *\n * Unlike an exit, a failure can leave the process running — a transport error\n * on a remote PTY is exactly \"the streams broke, the process did not\" — and\n * `markEnded` drops the handle, after which neither closing the tab nor\n * disconnecting can reach it. So this is where it is killed, last in the\n * method as in `releaseTab`, so a kill that throws cannot cost the reader the\n * reason the session ended.\n */\n private failTab(tabArg: ITerminalTab, reasonArg: string): void {\n const process = tabArg.process;\n this.markEnded(tabArg, null);\n tabArg.view.write(interruptingLine(this.t('terminal.sessionFailed', { reason: reasonArg }), 'alert'));\n void this.offerEndedTab(tabArg).catch(this.reportInternalError);\n process?.kill();\n }\n\n /**\n * The tab's state once its process is over. Only stdin is released here: the\n * output pipe keeps draining so nothing the process printed is lost.\n */\n private markEnded(tabArg: ITerminalTab, exitCodeArg: number | null): void {\n tabArg.stdin?.releaseLock();\n tabArg.stdin = null;\n tabArg.process = null;\n tabArg.exited = true;\n tabArg.exitCode = exitCodeArg;\n this.tabs = [...this.tabs];\n }\n\n /**\n * The bar an ended session leaves behind. It has no timeout: the tab and its\n * scrollback stay until the reader closes the session or runs it again.\n */\n private async offerEndedTab(tabArg: ITerminalTab): Promise<void> {\n const actions: IActionBarAction[] = [];\n if (tabArg.command) actions.push({ id: 'restart', label: this.t('terminal.runAgain'), primary: true });\n if (tabArg.closeable) actions.push({ id: 'close', label: this.t('terminal.closeSession') });\n if (!actions.length) return;\n const result = await this.showActionbar({\n message: endedMessage(this.t, tabArg),\n type: tabArg.exitCode === 0 ? 'info' : 'warning',\n icon: tabArg.exitCode === 0 ? 'lucide:checkCircle' : 'lucide:alertTriangle',\n actions,\n dismissible: true,\n });\n if (!result || !this.tabs.includes(tabArg)) return;\n if (result.actionId === 'close') this.closeTab(tabArg.id);\n if (result.actionId === 'restart') await this.restartTab(tabArg);\n }\n\n /** Runs the tab's command again in the same tab, above what it printed last time. */\n private async restartTab(tabArg: ITerminalTab): Promise<void> {\n const command = tabArg.command;\n if (!command || tabArg.process) return;\n this.activateTab(tabArg.id, true);\n await this.startProcess(tabArg, command);\n }\n\n /**\n * The tab is going: every stream it holds is released, including the output\n * pipe that an ended process was still allowed to drain into, and only then\n * is what it still runs killed — a kill that throws cannot strand a stream.\n */\n private releaseTab(tabArg: ITerminalTab): void {\n tabArg.stdin?.releaseLock();\n tabArg.stdin = null;\n tabArg.outputPipe?.abort();\n tabArg.outputPipe = null;\n const process = tabArg.process;\n tabArg.process = null;\n process?.kill();\n }\n\n /** The connection is over: nothing this panel started outlives it. */\n private endAllSessions(): void {\n const tabs = this.tabs;\n this.tabs = [];\n this.activeTabId = null;\n for (const tab of tabs) this.releaseTab(tab);\n }\n\n /** Surfaces a failure the reader can only acknowledge. */\n private reportFailure(messageArg: string): void {\n void this.showActionbar({\n message: messageArg,\n type: 'error',\n icon: 'lucide:alertTriangle',\n actions: [{ id: 'dismiss', label: this.t('common.dismiss') }],\n dismissible: true,\n }).catch(this.reportInternalError);\n }\n\n /**\n * Where every promise this panel starts without awaiting ends. What rejects\n * there is the panel's own chrome — a render that threw, a bar that refused\n * to show — so `reportFailure` cannot carry it: putting it on screen needs\n * the very bar that just failed. It leaves through `terminal-error` instead,\n * the channel the views already raise a broken surface on, so a host watching\n * one terminal channel sees this too, and nothing is swallowed.\n */\n private readonly reportInternalError = (errorArg: unknown): void => {\n const detail: ITerminalErrorDetail = { error: errorArg };\n this.dispatchEvent(\n new CustomEvent('terminal-error', { detail, bubbles: true, composed: true }),\n );\n };\n\n // ========== Public API ==========\n\n /**\n * Opens a session running the environment's own interactive shell, switches\n * to it and puts the caret in it. Resolves with the new tab's id, or with\n * null when the host gave no execution environment, when the environment\n * offers no shell command, or when the element is not connected. It rejects\n * only when the environment itself fails to name its shell.\n */\n public async createShellTab(labelArg?: string): Promise<string | null> {\n return this.openShell(labelArg, true);\n }\n\n /**\n * Opens a session for one process. The tab exists as soon as this is called\n * and the promise resolves with its id once the process is running, or once\n * it failed to start — either way the tab stays with whatever it has to show.\n *\n * Resolves with null when the element is not connected, as `createShellTab`\n * does: a session belongs to a connection, so a tab opened outside one would\n * never be wired to a process, would outlive the `endAllSessions()` that\n * already ran, and would then make the next connection look occupied and open\n * no live session at all.\n */\n public async createProcessTab(optionsArg: ICreateTerminalTabOptions): Promise<string | null> {\n if (!this.isConnected) return null;\n const tab = this.createTab(optionsArg);\n if (optionsArg.switchToTab !== false) this.activateTab(tab.id, true);\n if (optionsArg.command) {\n await this.startProcess(tab, { command: optionsArg.command, args: optionsArg.args ?? [] });\n }\n this.announceTab(tab);\n return tab.id;\n }\n\n /**\n * Get the currently active tab\n */\n public getActiveTab(): ITerminalTab | null {\n if (!this.activeTabId) return null;\n return this.tabOf(this.activeTabId) ?? null;\n }\n\n /**\n * Get all tabs\n */\n public getTabs(): ITerminalTab[] {\n return [...this.tabs];\n }\n\n /**\n * Switch to a specific tab by ID\n */\n public selectTab(tabIdArg: string): boolean {\n if (!this.tabOf(tabIdArg)) return false;\n this.activateTab(tabIdArg, true);\n return true;\n }\n\n /**\n * Closes a session: its process is killed, its streams are released and its\n * surface goes with the tab. A session that cannot be closed stays.\n */\n public closeTab(tabIdArg: string): boolean {\n const tab = this.tabOf(tabIdArg);\n if (!tab?.closeable) return false;\n const index = this.tabs.indexOf(tab);\n const remaining = this.tabs.filter((candidate) => candidate !== tab);\n // The neighbour that takes its place, or the one before it if it was last.\n if (this.activeTabId === tab.id) {\n this.activeTabId = (remaining[index] ?? remaining[index - 1])?.id ?? null;\n }\n this.tabs = remaining;\n this.releaseTab(tab);\n this.dispatchEvent(\n new CustomEvent('tab-closed', { bubbles: true, composed: true, detail: { tabId: tabIdArg } }),\n );\n return true;\n }\n\n /**\n * Write data to a tab's terminal\n */\n public writeToTab(tabIdArg: string, dataArg: string): boolean {\n const tab = this.tabOf(tabIdArg);\n if (!tab) return false;\n tab.view.write(dataArg);\n return true;\n }\n\n /**\n * Send input to a tab's process (if one is running)\n */\n public sendInputToTab(tabIdArg: string, dataArg: string): boolean {\n const tab = this.tabOf(tabIdArg);\n if (!tab?.stdin) return false;\n this.sendInput(tab, dataArg);\n return true;\n }\n\n /**\n * Show an actionbar notification in the terminal panel context. Use it for\n * terminal-related decisions. Resolves with null while the panel has not\n * rendered its bar yet, so a caller never reads an action that was never\n * offered.\n */\n public async showActionbar(\n optionsArg: Parameters<DeesActionbar['show']>[0],\n ): Promise<IActionBarResult | null> {\n if (!this.terminalActionbar) {\n this.terminalActionbar = this.shadowRoot?.querySelector('dees-actionbar') ?? null;\n }\n if (!this.terminalActionbar) return null;\n return this.terminalActionbar.show(optionsArg);\n }\n\n public async setEnvironmentVariables(envArg: { [key: string]: string }): Promise<void> {\n if (!this.executionEnvironment) {\n throw new Error(this.t('terminal.noEnvironmentError'));\n }\n\n let envFile = '';\n for (const key in envArg) {\n envFile += `export ${key}=\"${envArg[key]}\"\\n`;\n }\n\n await this.executionEnvironment.writeFile('/source.env', envFile);\n }\n\n /**\n * Get the underlying execution environment.\n */\n public getExecutionEnvironment(): IExecutionEnvironment | null {\n return this.executionEnvironment;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iKAAAA,QAAA,0DAAAC,YAAA,kCAAAD,QAAAE,QAAA;AAKA,iCAAC,cAAc,qBAAqB;AACpC,IAAM,qBAAN,MAAM,4BAA0B,kBAC9B,aAAC,EAAM,IAKP,mBAAC,EAAM,IANuB,IAAY;AAAA,EAA5C;AAAA;AAEE,uBAAS,OAA+B,kBAAxC,gBAAwC;AAAA,MACtC,EAAE,KAAK,QAAQ,UAAU,eAAe,QAAQ,6BAAM,QAAQ,IAAI,cAAc,GAAhC,UAAkC;AAAA,IACpF,KAFA;AAKA,uBAAS,aAAqB,kBAA9B,iBAA8B,KAA9B;AAAA;AAAA,EAkBQ,SAAS;AACf,SAAK;AACL,UAAM,SAAS,YAAY,KAAK,UAAU;AAC1C,SAAK,OAAO;AAAA,MACV,GAAG,KAAK;AAAA,MACR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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyIF;AA7NK,kBAAAA,QAAA,GAAM;AAAN,IAAM,wBAAN;","names":["_init","_tabs_dec","_tabs","_autoHide_dec","_tabs_dec","_a","_init","_tabs","_autoHide","editorOrigin","i","editorOrigin","PreviewMessageType","r","i","auth","demoFunc","_a","_init","demoFunc","demoFunc","_a","_init","demoFunc","_tabs_dec","_a","_init","_tabs"]}
|