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 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
/**
 *
 * DIALOGS
 *
 * Modal dialog components for the chat application.
 *
 * All dialogs use ShadCN Dialog or AlertDialog components for consistent
 * styling, accessibility, and animation. They integrate with application
 * stores for state management and data access.
 *
 */

/**
 * **DialogMcpServerAddNew** - Add new MCP server dialog
 *
 * Modal dialog for adding a new MCP server with URL and optional headers.
 * Validates URL format and integrates with mcpStore and conversationsStore.
 */
export { default as DialogMcpServerAddNew } from './DialogMcpServerAddNew.svelte';

/**
 * **DialogMcpServerRecommendations** - Suggested MCP servers opt-in dialog
 *
 * Prompts the user to enable pre-defined recommended MCP servers on first launch.
 * Shows one switch per suggested server and persists the choice as a per-chat
 * override so the selected servers become available in conversations.
 */
export { default as DialogMcpServerRecommendations } from './DialogMcpServerRecommendations.svelte';

/**
 * **DialogExportSettings** - Settings export dialog with sensitive data warning
 *
 * Dialog for exporting settings with an option to include or exclude
 * sensitive data (API keys, MCP server custom headers). Defaults to excluding
 * sensitive data for security. User must explicitly opt-in to include them.
 *
 * **Architecture:**
 * - Uses ShadCN AlertDialog
 * - Checkbox to toggle sensitive data inclusion (defaults to false)
 * - Warning icon and message when sensitive data is included
 * - Destructive variant for the action button when exporting with sensitive data
 *
 * **Features:**
 * - Secure default: sensitive data excluded by default
 * - User must explicitly opt-in to include sensitive data
 * - Visual warning (ShieldOff icon) when sensitive data is included
 * - Different action text based on sensitive data state
 *
 * @example
 * ```svelte
 * <DialogExportSettings
 *   bind:open={showExportSettings}
 *   bind:includeSensitiveData
 *   onConfirm={handleSettingsExport}
 *   onCancel={() => showExportSettings = false}
 * />
 * ```
 */
export { default as DialogExportSettings } from './DialogExportSettings.svelte';

/**
 *
 * CONFIRMATION DIALOGS
 *
 * Dialogs for user action confirmations. Use AlertDialog for blocking
 * confirmations that require explicit user decision before proceeding.
 *
 */

/**
 * **DialogConfirmation** - Generic confirmation dialog
 *
 * Reusable confirmation dialog with customizable title, description,
 * and action buttons. Supports destructive action styling and custom icons.
 * Used for delete confirmations, irreversible actions, and important decisions.
 *
 * **Architecture:**
 * - Uses ShadCN AlertDialog
 * - Supports variant styling (default, destructive)
 * - Customizable button labels and callbacks
 *
 * **Features:**
 * - Customizable title and description text
 * - Destructive variant with red styling for dangerous actions
 * - Custom icon support in header
 * - Cancel and confirm button callbacks
 * - Keyboard accessible (Escape to cancel, Enter to confirm)
 *
 * @example
 * ```svelte
 * <DialogConfirmation
 *   bind:open={showDelete}
 *   title="Delete conversation?"
 *   description="This action cannot be undone."
 *   variant="destructive"
 *   onConfirm={handleDelete}
 *   onCancel={() => showDelete = false}
 * />
 * ```
 */
export { default as DialogConfirmation } from './DialogConfirmation.svelte';

/**
 * **DialogConversationTitleUpdate** - Conversation rename confirmation
 *
 * Confirmation dialog shown when editing the first user message in a conversation.
 * Asks user whether to update the conversation title to match the new message content.
 *
 * **Architecture:**
 * - Uses ShadCN AlertDialog
 * - Shows current vs proposed title comparison
 * - Triggered by ChatMessages when first message is edited
 *
 * **Features:**
 * - Side-by-side display of current and new title
 * - "Keep Current Title" and "Update Title" action buttons
 * - Styled title previews in muted background boxes
 *
 * @example
 * ```svelte
 * <DialogConversationTitleUpdate
 *   bind:open={showTitleUpdate}
 *   currentTitle={conversation.name}
 *   newTitle={truncatedMessageContent}
 *   onConfirm={updateTitle}
 *   onCancel={() => showTitleUpdate = false}
 * />
 * ```
 */
export { default as DialogConversationTitleUpdate } from './DialogConversationTitleUpdate.svelte';

/**
 *
 * CONTENT PREVIEW DIALOGS
 *
 * Dialogs for previewing and displaying content in full-screen or modal views.
 *
 */

/**
 * **DialogCodePreview** - Full-screen code/HTML preview
 *
 * Full-screen dialog for previewing HTML or code in an isolated iframe.
 * Used by MarkdownContent component for previewing rendered HTML blocks
 * from code blocks in chat messages.
 *
 * **Architecture:**
 * - Uses ShadCN Dialog with full viewport layout
 * - Sandboxed iframe execution (allow-scripts only)
 * - Clears content when closed for security
 *
 * **Features:**
 * - Full viewport iframe preview
 * - Sandboxed execution environment
 * - Close button with mix-blend-difference for visibility over any content
 * - Automatic content cleanup on close
 * - Supports HTML preview with proper isolation
 *
 * @example
 * ```svelte
 * <DialogCodePreview
 *   bind:open={showPreview}
 *   code={htmlContent}
 *   language="html"
 * />
 * ```
 */
export { default as DialogCodePreview } from './DialogCodePreview.svelte';

/**
 *
 * ATTACHMENT DIALOGS
 *
 * Dialogs for viewing and managing file attachments. Support both
 * uploaded files (pending) and stored attachments (in messages).
 *
 */

/**
 * **DialogChatAttachmentsPreview** - Unified attachment preview dialog
 *
 * Modal dialog for previewing file attachments. Automatically adapts to the
 * number of items: shows a single file preview without carousel for one item,
 * or a gallery with carousel navigation for multiple items.
 *
 * **Architecture:**
 * - Wraps ChatAttachmentsPreview component in ShadCN Dialog
 * - Accepts uploadedFiles and attachments arrays as data sources
 * - Filters out MCP prompts and MCP resources from display
 *
 * **Features:**
 * - Single item mode: direct preview without navigation controls
 * - Multi-item mode: gallery with left/right arrows and thumbnail strip
 * - File type aware preview (images, text, PDFs, audio)
 * - File name and size/count display in header
 *
 * @example
 * ```svelte
 * <!-- Gallery with focus on 2nd item -->
 * <DialogChatAttachmentsPreview
 *   bind:open={showPreview}
 *   uploadedFiles={pendingFiles}
 *   attachments={message.extra}
 *   activeModelId={currentModel}
 *   previewFocusIndex={1}
 * />
 * ```
 */
export { default as DialogChatAttachmentsPreview } from './DialogChatAttachmentsPreview.svelte';

/**
 *
 * ERROR & ALERT DIALOGS
 *
 * Dialogs for displaying errors, warnings, and alerts to users.
 * Provide context about what went wrong and recovery options.
 *
 */

/**
 * **DialogChatError** - Chat/generation error display
 *
 * Alert dialog for displaying chat and generation errors with context
 * information. Supports different error types with appropriate styling
 * and messaging.
 *
 * **Architecture:**
 * - Uses ShadCN AlertDialog for modal display
 * - Differentiates between timeout and server errors
 * - Shows context info when available (token counts)
 *
 * **Error Types:**
 * - **timeout**: TCP timeout with timer icon, red destructive styling
 * - **server**: Server error with warning icon, amber warning styling
 *
 * **Features:**
 * - Type-specific icons (TimerOff for timeout, AlertTriangle for server)
 * - Error message display in styled badge
 * - Context info showing prompt tokens and context size
 * - Close button to dismiss
 *
 * @example
 * ```svelte
 * <DialogChatError
 *   bind:open={showError}
 *   type="server"
 *   message={errorMessage}
 *   contextInfo={{ n_prompt_tokens: 1024, n_ctx: 4096 }}
 * />
 * ```
 */
export { default as DialogChatError } from './DialogChatError.svelte';

/**
 * **DialogEmptyFileAlert** - Empty file upload warning
 *
 * Alert dialog shown when user attempts to upload empty files. Lists the
 * empty files that were detected and removed from attachments, with
 * explanation of why empty files cannot be processed.
 *
 * **Architecture:**
 * - Uses ShadCN AlertDialog for modal display
 * - Receives list of empty file names from ChatScreen
 * - Triggered during file upload validation
 *
 * **Features:**
 * - FileX icon indicating file error
 * - List of empty file names in monospace font
 * - Explanation of what happened and why
 * - Single "Got it" dismiss button
 *
 * @example
 * ```svelte
 * <DialogEmptyFileAlert
 *   bind:open={showEmptyAlert}
 *   emptyFiles={['empty.txt', 'blank.md']}
 * />
 * ```
 */
export { default as DialogEmptyFileAlert } from './DialogEmptyFileAlert.svelte';

/**
 * **DialogFileUploadError** - File upload compatibility error
 *
 * Alert dialog shown when files cannot be uploaded due to type incompatibility
 * or model modality restrictions. Displays a categorized list of problematic
 * files with explanations and shows which file types the current model supports.
 *
 * **Architecture:**
 * - Uses ShadCN AlertDialog for modal display
 * - Receives structured file error data from ChatScreen
 * - Triggered during file upload validation in processFiles()
 *
 * **Features:**
 * - Categorized display: unsupported types vs modality restrictions
 * - File name in monospace with contextual error messages
 * - Summary of supported file types for the current model
 * - Scrollable content area for large error lists
 * - Single "Got it" dismiss button
 *
 * @example
 * ```svelte
 * <DialogFileUploadError
 *   bind:open={showFileError}
 *   fileErrorData={errorData}
 * />
 * ```
 */
export { default as DialogFileUploadError } from './DialogFileUploadError.svelte';

/**
 * **DialogModelNotAvailable** - Model unavailable error
 *
 * Alert dialog shown when the requested model (from URL params or selection)
 * is not available on the server. Displays the requested model name and
 * offers selection from available models.
 *
 * **Architecture:**
 * - Uses ShadCN AlertDialog for modal display
 * - Integrates with SvelteKit navigation for model switching
 * - Receives available models list from modelsStore
 *
 * **Features:**
 * - Warning icon with amber styling
 * - Requested model name display in styled badge
 * - Scrollable list of available models
 * - Click model to navigate with updated URL params
 * - Cancel button to dismiss without selection
 *
 * @example
 * ```svelte
 * <DialogModelNotAvailable
 *   bind:open={showModelError}
 *   modelName={requestedModel}
 *   availableModels={modelsList}
 * />
 * ```
 */
export { default as DialogModelNotAvailable } from './DialogModelNotAvailable.svelte';

/**
 *
 * DATA MANAGEMENT DIALOGS
 *
 * Dialogs for managing conversation data, including import/export
 * and selection operations.
 *
 */

/**
 * **DialogConversationSelection** - Conversation picker for import/export
 *
 * Dialog for selecting conversations during import or export operations.
 * Displays list of conversations with checkboxes for multi-selection.
 * Used by ChatSettingsImportExportTab for data management.
 *
 * **Architecture:**
 * - Wraps ConversationSelection component in ShadCN Dialog
 * - Supports export mode (select from local) and import mode (select from file)
 * - Resets selection state when dialog opens
 * - High z-index to appear above settings dialog
 *
 * **Features:**
 * - Multi-select with checkboxes
 * - Conversation title and message count display
 * - Select all / deselect all controls
 * - Mode-specific descriptions (export vs import)
 * - Cancel and confirm callbacks with selected conversations
 *
 * @example
 * ```svelte
 * <DialogConversationSelection
 *   bind:open={showExportSelection}
 *   conversations={allConversations}
 *   messageCountMap={messageCounts}
 *   mode="export"
 *   onConfirm={handleExport}
 *   onCancel={() => showExportSelection = false}
 * />
 * ```
 */
export { default as DialogConversationSelection } from './DialogConversationSelection.svelte';

/**
 *
 * MODEL INFORMATION DIALOGS
 *
 * Dialogs for displaying model and server information.
 *
 */

/**
 * **DialogModelInformation** - Model details display
 *
 * Dialog showing comprehensive information about the currently loaded model
 * and server configuration. Displays model metadata, capabilities, and
 * server settings in a structured table format.
 *
 * **Architecture:**
 * - Uses ShadCN Dialog with wide layout for table display
 * - Fetches data from serverStore (props) and modelsStore (metadata)
 * - Auto-fetches models when dialog opens if not loaded
 *
 * **Information Displayed:**
 * - **Model**: Name with copy button
 * - **File Path**: Full path to model file with copy button
 * - **Context Size**: Current context window size
 * - **Training Context**: Original training context (if available)
 * - **Model Size**: File size in human-readable format
 * - **Parameters**: Parameter count (e.g., "7B", "70B")
 * - **Embedding Size**: Embedding dimension
 * - **Vocabulary Size**: Token vocabulary size
 * - **Vocabulary Type**: Tokenizer type (BPE, etc.)
 * - **Parallel Slots**: Number of concurrent request slots
 * - **Modalities**: Supported input types (text, vision, audio)
 * - **Build Info**: Server build information
 * - **Chat Template**: Full Jinja template in scrollable code block
 *
 * **Features:**
 * - Copy buttons for model name and path
 * - Modality badges with icons
 * - Responsive table layout with container queries
 * - Loading state while fetching model info
 * - Scrollable chat template display
 *
 * @example
 * ```svelte
 * <DialogModelInformation bind:open={showModelInfo} />
 * ```
 */
export { default as DialogModelInformation } from './DialogModelInformation.svelte';

/**
 * **DialogMcpResourcesBrowser** - MCP resources browser dialog
 *
 * Dialog for browsing and attaching MCP resources to chat context.
 * Displays resources from connected MCP servers in a tree structure
 * with preview panel and multi-select support.
 *
 * **Architecture:**
 * - Uses ShadCN Dialog with two-panel layout
 * - Left panel: McpResourcesBrowser with tree navigation
 * - Right panel: McpResourcePreview for selected resource
 * - Integrates with mcpStore for resource fetching and attachment
 *
 * **Features:**
 * - Tree-based resource navigation by server and path
 * - Single and multi-select with shift+click
 * - Resource preview with content display
 * - Quick attach button per resource
 * - Batch attach for multiple selections
 *
 * @example
 * ```svelte
 * <DialogMcpResourcesBrowser
 *   bind:open={showResources}
 *   onAttach={handleResourceAttach}
 * />
 * ```
 */
export { default as DialogMcpResourcesBrowser } from './DialogMcpResourcesBrowser.svelte';

/**
 * **DialogMcpResourcePreview** - MCP resource content preview
 *
 * Dialog for previewing the content of a stored MCP resource attachment.
 * Displays the resource content with syntax highlighting for code,
 * image rendering for images, and plain text for other content.
 *
 * **Features:**
 * - Syntax highlighted code preview
 * - Image rendering for image resources
 * - Copy to clipboard and download actions
 * - Server name and favicon display
 * - MIME type badge
 *
 * @example
 * ```svelte
 * <DialogMcpResourcePreview
 *   bind:open={previewOpen}
 *   extra={mcpResourceExtra}
 * />
 * ```
 */
export { default as DialogMcpResourcePreview } from './DialogMcpResourcePreview.svelte';

/**
 * **DialogMermaidPreview** - Full-screen Mermaid diagram preview with zoom and pan
 *
 * Full-screen dialog for previewing Mermaid diagrams with interactive controls.
 * Supports mouse wheel zoom, drag-to-pan, and toolbar buttons for zoom in/out,
 * fit to view, and reset.
 *
 * **Architecture:**
 * - Uses UI dialog components (`Dialog.Root`, `Dialog.Overlay`, `Dialog.Content`)
 *   for consistent styling, animations, and accessibility
 * - CSS transform-based zoom and pan (no external dependencies)
 * - Pointer events for cross-device drag support (mouse + touch)
 * - Wheel events for zoom-to-cursor functionality
 *
 * **Features:**
 * - Scroll wheel zoom centered on cursor position
 * - Click and drag to pan the diagram
 * - Toolbar with zoom in, zoom out, fit to view, reset controls
 * - Zoom percentage indicator
 * - Keyboard accessible close button
 * - Dark/light theme support
 *
 * @example
 * ```svelte
 * <DialogMermaidPreview
 *   bind:open={showMermaidPreview}
 *   svgHtml={mermaidSvgContent}
 * />
 * ```
 */
export { default as DialogMermaidPreview } from './DialogMermaidPreview.svelte';