@copilotkit/vue 2.0.0-rc.20 → 2.0.0-rc.21
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/index.cjs +1 -1
- package/dist/index.mjs +13 -13
- package/dist/use-render-activity-message-BAhbpSDh.js +16200 -0
- package/dist/use-render-activity-message-BAhbpSDh.js.map +1 -0
- package/dist/use-render-activity-message-DJ6q1qHV.cjs +114 -0
- package/dist/use-render-activity-message-DJ6q1qHV.cjs.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +7 -21
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +0 -5
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -138
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +3 -15
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +6 -1
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +3 -2
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/index.d.ts +6 -6
- package/dist/v2/components/chat/tool-call-display-context.d.ts +3 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +1 -1
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent-context.d.ts +2 -3
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent.d.ts +4 -1
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts +7 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
- package/dist/v2/hooks/use-component.d.ts +1 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -1
- package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/hooks/use-interrupt.d.ts +0 -1
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +0 -8
- package/dist/v2/hooks/use-threads.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/lib/vue-core.d.ts +12 -11
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -124
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
- package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
- package/dist/v2/providers/markdown-renderer.d.ts +3 -1
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
- package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/v2/__tests__/exports.test.ts +10 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
- package/src/v2/__tests__/utils/test-helpers.ts +34 -4
- package/src/v2/components/A2UIMessageRenderer.ts +98 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
- package/src/v2/components/CopilotKitInspector.vue +104 -51
- package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
- package/src/v2/components/OpenGenerativeUIRenderer.ts +78 -80
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +9 -2
- package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +1 -6
- package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -93
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
- package/src/v2/components/a2ui/catalog.ts +2 -3
- package/src/v2/components/a2ui/utils.ts +13 -67
- package/src/v2/components/a2ui.ts +14 -21
- package/src/v2/components/chat/CopilotChat.vue +136 -324
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +22 -45
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
- package/src/v2/components/chat/CopilotChatInput.vue +69 -407
- package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
- package/src/v2/components/chat/CopilotChatMessageView.vue +52 -112
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +14 -45
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +6 -4
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +16 -19
- package/src/v2/components/chat/CopilotChatView.vue +28 -23
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +21 -97
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -25
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +37 -102
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +13 -26
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +56 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
- package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
- package/src/v2/components/chat/audioRecorder.ts +4 -7
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +22 -71
- package/src/v2/components/chat/tool-call-display-context.ts +6 -1
- package/src/v2/components/chat/tool-call-group-parts.ts +13 -33
- package/src/v2/components/chat/types.ts +1 -1
- package/src/v2/components/chat/use-lightbox.ts +15 -33
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
- package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
- package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +4 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +2 -1
- package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
- package/src/v2/hooks/use-agent-context.ts +4 -10
- package/src/v2/hooks/use-agent.ts +86 -290
- package/src/v2/hooks/use-attachments.ts +42 -166
- package/src/v2/hooks/use-capabilities.ts +2 -7
- package/src/v2/hooks/use-component.ts +7 -4
- package/src/v2/hooks/use-configure-suggestions.ts +28 -218
- package/src/v2/hooks/use-default-render-tool.ts +34 -94
- package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
- package/src/v2/hooks/use-interrupt.ts +29 -308
- package/src/v2/hooks/use-render-activity-message.ts +17 -20
- package/src/v2/hooks/use-render-custom-messages.ts +20 -63
- package/src/v2/hooks/use-suggestions.ts +9 -33
- package/src/v2/hooks/use-threads.ts +43 -273
- package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
- package/src/v2/lib/vue-core.ts +67 -72
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -127
- package/src/v2/providers/CopilotKitProvider.vue +188 -402
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +19 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +45 -2
- package/src/v2/providers/chat-configuration-store-key.ts +9 -0
- package/src/v2/providers/markdown-renderer.ts +7 -1
- package/src/v2/providers/use-inspector-thread-override.ts +22 -80
- package/vite.config.ts +5 -1
- package/vitest.config.ts +12 -7
- package/dist/use-render-activity-message-CsWYyd6r.cjs +0 -91
- package/dist/use-render-activity-message-CsWYyd6r.cjs.map +0 -1
- package/dist/use-render-activity-message-DntKKNdd.js +0 -17418
- package/dist/use-render-activity-message-DntKKNdd.js.map +0 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +0 -2
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
- package/src/v2/components/chat/normalize-auto-scroll.ts +0 -3
- package/src/v2/lib/is-mobile-viewport.ts +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-render-activity-message-CsWYyd6r.cjs","sources":["../../../node_modules/.pnpm/@ag-ui+core@1.0.2_zod@4.6.7/node_modules/@ag-ui/core/dist/version-CTNE2I0_.mjs","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/errors.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/parse.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/regexes.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/checks.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/doc.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/versions.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/schemas.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/memoizer.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/en.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/registries.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/api.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/errors.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/parse.js","../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/schemas.js","../../../node_modules/.pnpm/@ag-ui+core@1.0.2_zod@4.6.7/node_modules/@ag-ui/core/dist/schemas.mjs","../src/v2/components/CopilotKitInspector.vue","../src/v2/providers/keys.ts","../src/v2/providers/useCopilotKit.ts","../src/v2/components/MCPAppsActivityRenderer.ts","../src/v2/components/a2ui.ts","../src/v2/lib/vue-core.ts","../src/v2/components/a2ui/A2UIRecoveryStates.ts","../src/v2/components/A2UIMessageRenderer.ts","../src/v2/types/defineToolCallRenderer.ts","../src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts","../src/v2/components/a2ui/adapter.ts","../src/v2/components/a2ui/utils.ts","../src/v2/components/a2ui/catalog.ts","../src/v2/components/a2ui/A2UICatalogContext.ts","../src/v2/providers/SandboxFunctionsContext.ts","../src/v2/components/OpenGenerativeUIRenderer.ts","../src/v2/providers/markdown-renderer.ts","../src/v2/providers/license-context.ts","../src/v2/providers/useCopilotChatConfiguration.ts","../src/v2/components/chat/use-chat-labels.ts","../src/v2/components/LicenseWarningBanner.vue","../src/v2/providers/CopilotKitProvider.vue","../src/v2/lib/shallow-stable.ts","../src/v2/providers/CopilotChatConfigurationProvider.vue","../src/v2/providers/useLicenseContext.ts","../src/v2/components/a2ui/VueSurface.ts","../src/v2/components/A2UISurfaceActivityRenderer.vue","../../markdown/dist/index.mjs","../../markdown/dist/vue/index.mjs","../src/v2/components/chat/StreamingMarkdownDefault.vue","../src/v2/components/icons/index.ts","../src/v2/components/chat/copilotChatToolCallItemRender.ts","../src/v2/components/chat/tool-call-capture.ts","../src/v2/components/chat/CopilotChatToolCallItem.vue","../src/v2/components/ui/use-id.ts","../src/v2/components/chat/tool-call-display-context.ts","../src/v2/components/chat/tool-call-group-parts.ts","../src/v2/components/chat/CopilotChatToolCallGroup.vue","../src/v2/components/chat/CopilotChatToolCallsView.vue","../src/v2/components/chat/turn-work.ts","../src/v2/components/ui/floating.ts","../src/v2/components/ui/presence.ts","../src/v2/components/ui/CopilotTooltip.vue","../src/v2/components/chat/CopilotChatAssistantToolbarButton.vue","../src/v2/components/ui/CopilotPopover.vue","../src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue","../src/v2/components/ui/CopilotDropdownMenuContent.vue","../src/v2/components/chat/inspector-shortcuts.ts","../src/v2/components/chat/CopilotChatInspectorButton.vue","../src/v2/components/chat/message-feedback.ts","../src/v2/components/chat/use-copy-feedback.ts","../src/v2/components/chat/CopilotChatAssistantMessage.vue","../src/v2/components/chat/audioRecorder.ts","../src/v2/components/chat/CopilotChatAudioRecorder.vue","../src/v2/components/InlineFeatureWarning.vue","../src/v2/hooks/use-agent.ts","../src/v2/hooks/use-suggestions.ts","../src/v2/hooks/use-attachments.ts","../src/v2/hooks/use-keyboard-height.ts","../src/v2/components/chat/last-user-message-context.ts","../src/v2/hooks/use-pin-to-send.ts","../src/v2/components/chat/CopilotChatInput.vue","../src/v2/components/chat/CopilotChatLightbox.vue","../src/v2/components/chat/CopilotChatAttachmentQueue.vue","../src/v2/components/chat/CopilotChatReasoningMessage.vue","../src/v2/components/chat/use-lightbox.ts","../src/v2/components/chat/CopilotChatAttachmentRenderer.vue","../src/v2/components/chat/CopilotChatUserMessage.vue","../src/v2/components/chat/CopilotChatWorkSummary.vue","../src/v2/components/chat/CopilotChatMessageView.vue","../src/v2/components/chat/CopilotChatSuggestionPill.vue","../src/v2/components/chat/CopilotChatSuggestionView.vue","../src/v2/components/chat/CopilotChatView.vue","../src/v2/providers/use-inspector-thread-override.ts","../src/v2/styles/CopilotKitStyles.ts","../src/v2/components/chat/CopilotChat.vue","../src/v2/hooks/use-threads.ts","../src/v2/components/chat/CopilotThreadsDrawer.vue","../src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts","../src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts","../src/v2/components/chat/CopilotChatToggleButton.vue","../src/v2/components/chat/CopilotModalHeaderCloseButton.ts","../src/v2/components/chat/CopilotModalHeaderTitle.ts","../src/v2/components/chat/CopilotModalHeader.vue","../src/v2/components/chat/forwarded-slots.ts","../src/v2/components/chat/CopilotPopupViewInternal.vue","../src/v2/components/chat/CopilotPopupView.vue","../src/v2/components/chat/CopilotPopupWelcomeScreen.vue","../src/v2/components/chat/CopilotSidebarViewInternal.vue","../src/v2/components/chat/CopilotSidebarView.vue","../src/v2/components/chat/CopilotSidebarWelcomeScreen.vue","../src/v2/components/chat/CopilotPopup.vue","../src/v2/components/chat/CopilotSidebar.vue","../src/v2/components/chat/index.ts","../src/v2/hooks/use-agent-context.ts","../src/v2/hooks/use-frontend-tool.ts","../src/v2/hooks/use-component.ts","../src/v2/hooks/use-render-tool.ts","../src/v2/hooks/use-default-render-tool.ts","../src/v2/hooks/use-human-in-the-loop.ts","../src/v2/hooks/use-configure-suggestions.ts","../src/v2/hooks/use-interrupt.ts","../src/v2/hooks/use-capabilities.ts","../src/v2/hooks/use-render-custom-messages.ts","../src/v2/hooks/use-render-activity-message.ts"],"sourcesContent":["//#region src/generated/types.ts\n/**\n* The discriminator carried by every event.\n*/\nlet EventType = /* @__PURE__ */ function(EventType) {\n\tEventType[\"TEXT_MESSAGE_START\"] = \"TEXT_MESSAGE_START\";\n\tEventType[\"TEXT_MESSAGE_CONTENT\"] = \"TEXT_MESSAGE_CONTENT\";\n\tEventType[\"TEXT_MESSAGE_END\"] = \"TEXT_MESSAGE_END\";\n\tEventType[\"TEXT_MESSAGE_CHUNK\"] = \"TEXT_MESSAGE_CHUNK\";\n\tEventType[\"TOOL_CALL_START\"] = \"TOOL_CALL_START\";\n\tEventType[\"TOOL_CALL_ARGS\"] = \"TOOL_CALL_ARGS\";\n\tEventType[\"TOOL_CALL_END\"] = \"TOOL_CALL_END\";\n\tEventType[\"TOOL_CALL_CHUNK\"] = \"TOOL_CALL_CHUNK\";\n\tEventType[\"TOOL_CALL_RESULT\"] = \"TOOL_CALL_RESULT\";\n\tEventType[\"STATE_SNAPSHOT\"] = \"STATE_SNAPSHOT\";\n\tEventType[\"STATE_DELTA\"] = \"STATE_DELTA\";\n\tEventType[\"MESSAGES_SNAPSHOT\"] = \"MESSAGES_SNAPSHOT\";\n\tEventType[\"ACTIVITY_SNAPSHOT\"] = \"ACTIVITY_SNAPSHOT\";\n\tEventType[\"ACTIVITY_DELTA\"] = \"ACTIVITY_DELTA\";\n\tEventType[\"RAW\"] = \"RAW\";\n\tEventType[\"CUSTOM\"] = \"CUSTOM\";\n\tEventType[\"RUN_STARTED\"] = \"RUN_STARTED\";\n\tEventType[\"RUN_FINISHED\"] = \"RUN_FINISHED\";\n\tEventType[\"RUN_ERROR\"] = \"RUN_ERROR\";\n\tEventType[\"STEP_STARTED\"] = \"STEP_STARTED\";\n\tEventType[\"STEP_FINISHED\"] = \"STEP_FINISHED\";\n\tEventType[\"REASONING_START\"] = \"REASONING_START\";\n\tEventType[\"REASONING_MESSAGE_START\"] = \"REASONING_MESSAGE_START\";\n\tEventType[\"REASONING_MESSAGE_CONTENT\"] = \"REASONING_MESSAGE_CONTENT\";\n\tEventType[\"REASONING_MESSAGE_END\"] = \"REASONING_MESSAGE_END\";\n\tEventType[\"REASONING_MESSAGE_CHUNK\"] = \"REASONING_MESSAGE_CHUNK\";\n\tEventType[\"REASONING_END\"] = \"REASONING_END\";\n\tEventType[\"REASONING_ENCRYPTED_VALUE\"] = \"REASONING_ENCRYPTED_VALUE\";\n\tEventType[\"SUBAGENT_STARTED\"] = \"SUBAGENT_STARTED\";\n\tEventType[\"SUBAGENT_FINISHED\"] = \"SUBAGENT_FINISHED\";\n\tEventType[\"SUBAGENT_ERROR\"] = \"SUBAGENT_ERROR\";\n\treturn EventType;\n}({});\n\n//#endregion\n//#region src/generated/version.ts\n/**\n* The protocol version this code was generated from: the version segment of\n* the schema's $id (https://ag-ui.com/spec/1.0/schema.json). Never typed by a\n* human.\n*/\nconst PROTOCOL_VERSION = \"1.0\";\n\n//#endregion\nexport { EventType as n, PROTOCOL_VERSION as t };\n//# sourceMappingURL=version-CTNE2I0_.mjs.map","import { globalConfig } from \"./core.js\";\n// functions\nexport function assertEqual(val) {\n return val;\n}\nexport function assertNotEqual(val) {\n return val;\n}\nexport function toZod() {\n return (schema) => schema;\n}\nexport function assertIs(_arg) { }\nexport function assertNever(_x) {\n throw new Error(\"Unexpected value in exhaustive check\");\n}\nexport function assert(_) { }\nexport function getEnumValues(entries) {\n const numericValues = Object.values(entries).filter((v) => typeof v === \"number\");\n const values = Object.entries(entries)\n .filter(([k, _]) => numericValues.indexOf(+k) === -1)\n .map(([_, v]) => v);\n return values;\n}\nexport function joinValues(array, separator = \"|\") {\n return array.map((val) => stringifyPrimitive(val)).join(separator);\n}\nexport function jsonStringifyReplacer(_, value) {\n if (typeof value === \"bigint\")\n return value.toString();\n return value;\n}\n// the accessor lives on a shared prototype: an own accessor makes every box a dictionary-mode object (~360 B and a slow load per read against ~100 B and an inlined getter here)\nclass Cached {\n constructor(getter) {\n this._getter = getter;\n this._value = undefined;\n }\n get value() {\n const getter = this._getter;\n if (getter !== undefined) {\n this._value = getter();\n this._getter = undefined;\n }\n return this._value;\n }\n}\nexport function cached(getter) {\n return new Cached(getter);\n}\nexport function nullish(input) {\n return input === null || input === undefined;\n}\nexport function cleanRegex(source) {\n const start = source.startsWith(\"^\") ? 1 : 0;\n const end = source.endsWith(\"$\") ? source.length - 1 : source.length;\n return source.slice(start, end);\n}\nexport function floatSafeRemainder(val, step) {\n const ratio = val / step;\n const roundedRatio = Math.round(ratio);\n // `val` and `step` each round to a double before the division rounds again, so a true decimal multiple's quotient can sit up to 1.5 of these scaled epsilons from the integer. A 1x tolerance therefore rejected 2.03 as a multiple of 0.07; 4x covers the worst case with margin.\n const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);\n if (Math.abs(ratio - roundedRatio) < tolerance)\n return 0;\n return ratio - roundedRatio;\n}\nconst EVALUATING = /* @__PURE__*/ Symbol(\"evaluating\");\nexport function defineLazy(object, key, getter) {\n let value = undefined;\n Object.defineProperty(object, key, {\n get() {\n if (value === EVALUATING) {\n // Circular reference detected, return undefined to break the cycle\n return undefined;\n }\n if (value === undefined) {\n value = EVALUATING;\n value = getter();\n }\n return value;\n },\n set(v) {\n Object.defineProperty(object, key, {\n value: v,\n // configurable: true,\n });\n // object[key] = v;\n },\n configurable: true,\n });\n}\nexport function objectClone(obj) {\n return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));\n}\nexport function assignProp(target, prop, value) {\n Object.defineProperty(target, prop, {\n value,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n}\n/**\n * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.\n *\n * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.\n */\nexport function rawShape(def) {\n const desc = Object.getOwnPropertyDescriptor(def, \"shape\");\n return desc?.get ? desc.get.raw : desc?.value;\n}\n// where a builder reads its source's keys and descriptors, resolving only a shape a def answers for itself. A shape resolves by object spread, so only its enumerable keys are ever part of it.\nfunction sourceShape(schema) {\n return rawShape(schema._zod.def) ?? schema._zod.def.shape;\n}\n// a key whose value is not settled yet, self-caching so every read after the first gets the same one\nfunction deferProp(target, key, getter) {\n Object.defineProperty(target, key, {\n get() {\n const value = getter();\n assignProp(this, key, value);\n return value;\n },\n enumerable: true,\n configurable: true,\n });\n}\n// Writes a settled key. A plain assignment is much cheaper than `defineProperty` and produces the same descriptor, but it runs whatever setter already answers to the key — an accessor this shape deferred, or an inherited one, which `__proto__` has on every object and prototype pollution can add for any name.\nfunction putProp(target, key, value) {\n if (key in target)\n assignProp(target, key, value);\n else\n target[key] = value;\n}\n/**\n * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.\n *\n * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.\n */\nfunction mirrorShape(target, source, keys, wrap) {\n const raw = sourceShape(source);\n for (const key of keys) {\n const desc = Object.getOwnPropertyDescriptor(raw, key);\n if (!desc.enumerable)\n continue;\n if (desc.get) {\n deferProp(target, key, () => {\n const value = source._zod.def.shape[key];\n return wrap ? wrap(value, key) : value;\n });\n }\n else\n putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);\n }\n}\n// same, for a plain shape a caller passed rather than a schema's\nfunction mirrorProps(target, source) {\n for (const key of Reflect.ownKeys(source)) {\n const desc = Object.getOwnPropertyDescriptor(source, key);\n if (!desc.enumerable)\n continue;\n if (desc.get)\n deferProp(target, key, () => source[key]);\n else\n putProp(target, key, desc.value);\n }\n}\nexport function mergeDefs(...defs) {\n const mergedDescriptors = {};\n for (const def of defs) {\n const descriptors = Object.getOwnPropertyDescriptors(def);\n Object.assign(mergedDescriptors, descriptors);\n }\n return Object.defineProperties({}, mergedDescriptors);\n}\nexport function cloneDef(schema) {\n return mergeDefs(schema._zod.def);\n}\nexport function getElementAtPath(obj, path) {\n if (!path)\n return obj;\n return path.reduce((acc, key) => acc?.[key], obj);\n}\nexport function promiseAllObject(promisesObj) {\n const keys = Object.keys(promisesObj);\n const promises = keys.map((key) => promisesObj[key]);\n return Promise.all(promises).then((results) => {\n const resolvedObj = {};\n for (let i = 0; i < keys.length; i++) {\n resolvedObj[keys[i]] = results[i];\n }\n return resolvedObj;\n });\n}\nexport function randomString(length = 10) {\n const chars = \"abcdefghijklmnopqrstuvwxyz\";\n let str = \"\";\n for (let i = 0; i < length; i++) {\n str += chars[Math.floor(Math.random() * chars.length)];\n }\n return str;\n}\nexport function esc(str) {\n return JSON.stringify(str);\n}\nexport function slugify(input) {\n return input\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\nexport const captureStackTrace = (\"captureStackTrace\" in Error ? Error.captureStackTrace : (..._args) => { });\nexport function isObject(data) {\n return typeof data === \"object\" && data !== null && !Array.isArray(data);\n}\nexport const allowsEval = /* @__PURE__*/ cached(() => {\n // Skip the probe under `jitless`: strict CSPs report the caught `new Function` as a `securitypolicyviolation` even though the throw is swallowed.\n if (globalConfig.jitless) {\n return false;\n }\n // @ts-ignore\n if (typeof navigator !== \"undefined\" && navigator?.userAgent?.includes(\"Cloudflare\")) {\n return false;\n }\n try {\n const F = Function;\n new F(\"\");\n return true;\n }\n catch (_) {\n return false;\n }\n});\nexport function isPlainObject(o) {\n if (isObject(o) === false)\n return false;\n // modified constructor\n const ctor = o.constructor;\n if (ctor === undefined)\n return true;\n if (typeof ctor !== \"function\")\n return true;\n // modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false)\n return false;\n // ctor doesn't have static `isPrototypeOf`\n if (Object.prototype.hasOwnProperty.call(prot, \"isPrototypeOf\") === false) {\n return false;\n }\n return true;\n}\nexport function shallowClone(o) {\n if (isPlainObject(o))\n return { ...o };\n if (Array.isArray(o))\n return [...o];\n if (o instanceof Map)\n return new Map(o);\n if (o instanceof Set)\n return new Set(o);\n return o;\n}\nexport function numKeys(data) {\n let keyCount = 0;\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n keyCount++;\n }\n }\n return keyCount;\n}\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return \"undefined\";\n case \"string\":\n return \"string\";\n case \"number\":\n return Number.isNaN(data) ? \"nan\" : \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"function\":\n return \"function\";\n case \"bigint\":\n return \"bigint\";\n case \"symbol\":\n return \"symbol\";\n case \"object\":\n if (Array.isArray(data)) {\n return \"array\";\n }\n if (data === null) {\n return \"null\";\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return \"promise\";\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return \"map\";\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return \"set\";\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return \"date\";\n }\n // @ts-ignore\n if (typeof File !== \"undefined\" && data instanceof File) {\n return \"file\";\n }\n return \"object\";\n default:\n throw new Error(`Unknown data type: ${t}`);\n }\n};\nexport const propertyKeyTypes = /* @__PURE__*/ new Set([\"string\", \"number\", \"symbol\"]);\nexport const primitiveTypes = /* @__PURE__*/ new Set([\n \"string\",\n \"number\",\n \"bigint\",\n \"boolean\",\n \"symbol\",\n \"undefined\",\n]);\nexport function escapeRegex(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n// zod-specific utils\nexport function clone(inst, def, params) {\n const cl = new inst._zod.constr(def ?? inst._zod.def);\n if (!def || params?.parent)\n cl._zod.parent = inst;\n return cl;\n}\nexport function normalizeParams(_params) {\n const params = _params;\n if (!params)\n return {};\n if (typeof params === \"string\")\n return { error: () => params };\n if (params?.message !== undefined) {\n if (params?.error !== undefined)\n throw new Error(\"Cannot specify both `message` and `error` params\");\n params.error = params.message;\n }\n delete params.message;\n if (typeof params.error === \"string\")\n return { ...params, error: () => params.error };\n return params;\n}\nexport function createTransparentProxy(getter) {\n let target;\n return new Proxy({}, {\n get(_, prop, receiver) {\n target ?? (target = getter());\n return Reflect.get(target, prop, receiver);\n },\n set(_, prop, value, receiver) {\n target ?? (target = getter());\n return Reflect.set(target, prop, value, receiver);\n },\n has(_, prop) {\n target ?? (target = getter());\n return Reflect.has(target, prop);\n },\n deleteProperty(_, prop) {\n target ?? (target = getter());\n return Reflect.deleteProperty(target, prop);\n },\n ownKeys(_) {\n target ?? (target = getter());\n return Reflect.ownKeys(target);\n },\n getOwnPropertyDescriptor(_, prop) {\n target ?? (target = getter());\n return Reflect.getOwnPropertyDescriptor(target, prop);\n },\n defineProperty(_, prop, descriptor) {\n target ?? (target = getter());\n return Reflect.defineProperty(target, prop, descriptor);\n },\n });\n}\nexport function stringifyPrimitive(value) {\n if (typeof value === \"bigint\")\n return value.toString() + \"n\";\n if (typeof value === \"string\")\n return `\"${value}\"`;\n return `${value}`;\n}\nexport function optionalKeys(shape) {\n return Object.keys(shape).filter((k) => {\n return shape[k]._zod.optin !== undefined && shape[k]._zod.optout === \"optional\";\n });\n}\n// Wrapped in a `@__PURE__` IIFE: esbuild never tree-shakes a top-level initializer that contains a member access on `Number`, so the bare object literal survived into every bundle.\nexport const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({\n safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],\n int32: [-2147483648, 2147483647],\n uint32: [0, 4294967295],\n float32: [-3.4028234663852886e38, 3.4028234663852886e38],\n float64: [-Number.MAX_VALUE, Number.MAX_VALUE],\n}))();\nexport const BIGINT_FORMAT_RANGES = {\n int64: [/* @__PURE__*/ BigInt(\"-9223372036854775808\"), /* @__PURE__*/ BigInt(\"9223372036854775807\")],\n uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt(\"18446744073709551615\")],\n};\nexport function pick(schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".pick() cannot be used on object schemas containing refinements\");\n }\n const newShape = {};\n mirrorShape(newShape, schema, maskedKeys(schema, mask));\n return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));\n}\n// the mask keys that select something, checked against the source's shape without resolving it\nfunction maskedKeys(schema, mask) {\n const raw = sourceShape(schema);\n const keys = [];\n // `for...in` skips symbols, so a symbol in the mask would select nothing\n for (const key of Reflect.ownKeys(mask)) {\n if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {\n throw new Error(`Unrecognized key: \"${String(key)}\"`);\n }\n if (mask[key])\n keys.push(key);\n }\n return keys;\n}\nexport function omit(schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".omit() cannot be used on object schemas containing refinements\");\n }\n const omitted = new Set(maskedKeys(schema, mask));\n const newShape = {};\n mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));\n return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));\n}\nexport function extend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to extend: expected a plain object\");\n }\n const checks = schema._zod.def.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n // Only throw if new shape overlaps with existing shape. Use getOwnPropertyDescriptor to check key existence without accessing values\n const existingShape = sourceShape(schema);\n for (const key of Reflect.ownKeys(shape)) {\n if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {\n throw new Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\");\n }\n }\n }\n return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));\n}\n// the source's keys, then the caller's overlaid on top\nfunction extended(schema, shape) {\n const newShape = {};\n mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));\n mirrorProps(newShape, shape);\n return newShape;\n}\nexport function safeExtend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to safeExtend: expected a plain object\");\n }\n return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));\n}\nexport function merge(a, b) {\n if (!b?._zod?.def) {\n throw new Error(\"Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.\");\n }\n if (a._zod.def.checks?.length) {\n throw new Error(\".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.\");\n }\n const newShape = {};\n mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));\n mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));\n const def = mergeDefs(a._zod.def, {\n shape: newShape,\n get catchall() {\n return b._zod.def.catchall;\n },\n checks: b._zod.def.checks ?? [],\n });\n return clone(a, def);\n}\nexport function partial(Class, schema, mask, name = \"partial\") {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(`.${name}() cannot be used on object schemas containing refinements`);\n }\n const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;\n const newShape = {};\n mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class &&\n ((value, key) => (selected && !selected.has(key) ? value : new Class({ type: \"optional\", innerType: value }))));\n return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));\n}\nexport function required(Class, schema, mask) {\n const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;\n const newShape = {};\n mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => \n // overwrite with non-optional\n selected && !selected.has(key) ? value : new Class({ type: \"nonoptional\", innerType: value }));\n return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));\n}\n// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom\nexport function aborted(x, startIndex = 0) {\n if (x.aborted === true)\n return true;\n for (let i = startIndex; i < x.issues.length; i++) {\n if (x.issues[i]?.continue !== true) {\n return true;\n }\n }\n return false;\n}\n// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined). Used to respect `abort: true` in .refine() even for checks that have a `when` function.\nexport function explicitlyAborted(x, startIndex = 0) {\n if (x.aborted === true)\n return true;\n for (let i = startIndex; i < x.issues.length; i++) {\n if (x.issues[i]?.continue === false) {\n return true;\n }\n }\n return false;\n}\nexport function prefixIssues(path, issues) {\n return issues.map((iss) => {\n var _a;\n (_a = iss).path ?? (_a.path = []);\n iss.path.unshift(path);\n return iss;\n });\n}\nexport function unwrapMessage(message) {\n return typeof message === \"string\" ? message : message?.message;\n}\n/* A check holds no link back to the schema it is attached to — the same check instance is shared by every clone of that schema — so the owner is stamped onto the issues a check just raised, at the only point where both are in scope. Runs on the failure path only; `start` is the issue count from before the check ran. */\n/** The leading size checks of `defChecks` that set an upper bound, each paired with it. */\nexport function sizeCaps(defChecks) {\n const caps = [];\n for (const ch of defChecks ?? []) {\n const d = ch._zod.def;\n // a later check may rewrite the value\n if (!/_(length|size)$|_equals$/.test(d.check))\n break;\n const max = d.maximum ?? d.length ?? d.size;\n if (max >= 0)\n caps.push([max, ch]);\n }\n return caps;\n}\nexport function attachSchema(issues, start, inst) {\n var _a;\n for (let i = start; i < issues.length; i++) {\n (_a = issues[i]).schema ?? (_a.schema = inst);\n }\n}\nexport function finalizeIssue(iss, ctx, config) {\n var _a;\n // A schema that raised an issue itself owns it outright, and outranks any stamp an enclosing check left in `attachSchema`. String formats and z.custom() are schema and check at once, so when they act as a check they defer to that stamp instead.\n const traits = iss.inst?._zod?.traits;\n if (traits?.has(\"$ZodType\")) {\n if (traits.has(\"$ZodCheck\"))\n (_a = iss).schema ?? (_a.schema = iss.inst);\n else\n iss.schema = iss.inst;\n }\n // Decreasing specificity, first map to return a message wins. `inst` is whatever raised the issue, so a check's own map outranks the owning schema's.\n const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;\n const message = iss.message\n ? iss.message\n : (unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??\n unwrapMessage(schemaError?.(iss)) ??\n unwrapMessage(ctx?.error?.(iss)) ??\n unwrapMessage(config.customError?.(iss)) ??\n unwrapMessage(config.localeError?.(iss)) ??\n \"Invalid input\");\n // an explicit own-key copy beats object rest with excluded keys, which v8 routes through a generic runtime call; Object.keys rather than for-in so an issue pushed with a prototype does not leak inherited keys, and an own __proto__ key is dropped rather than assigned through the setter\n const full = {};\n for (const k of Object.keys(iss)) {\n if (k === \"inst\" || k === \"schema\" || k === \"continue\" || k === \"input\" || k === \"__proto__\")\n continue;\n full[k] = iss[k];\n }\n full.path ?? (full.path = []);\n full.message = message;\n if (ctx?.reportInput) {\n full.input = iss.input;\n }\n return full;\n}\nexport function getSizableOrigin(input) {\n if (input instanceof Set)\n return \"set\";\n if (input instanceof Map)\n return \"map\";\n // @ts-ignore\n if (input instanceof File)\n return \"file\";\n return \"unknown\";\n}\nconst highSurrogate = /[\\uD800-\\uDBFF]/;\n// Code points in `str`: a surrogate pair counts once, a lone surrogate as itself. Hand-rolled because the string iterator allocates and runs ~250x slower on this path; the regex probe exits ~50x quicker for a string with no astral characters.\nexport function codePointLength(str) {\n const units = str.length;\n if (!highSurrogate.test(str))\n return units;\n let count = units;\n for (let i = 0; i < units - 1; i++) {\n if ((str.charCodeAt(i) & 0xfc00) === 0xd800 && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n count--;\n i++;\n }\n }\n return count;\n}\nexport function getLengthableOrigin(input) {\n if (Array.isArray(input))\n return \"array\";\n if (typeof input === \"string\")\n return \"string\";\n return \"unknown\";\n}\nexport function parsedType(data) {\n const t = typeof data;\n switch (t) {\n case \"number\": {\n return Number.isNaN(data) ? \"nan\" : \"number\";\n }\n case \"object\": {\n if (data === null) {\n return \"null\";\n }\n if (Array.isArray(data)) {\n return \"array\";\n }\n const obj = data;\n if (obj && Object.getPrototypeOf(obj) !== Object.prototype && \"constructor\" in obj && obj.constructor) {\n return obj.constructor.name;\n }\n }\n }\n return t;\n}\nexport function issue(...args) {\n const [iss, input, inst] = args;\n if (typeof iss === \"string\") {\n return {\n message: iss,\n code: \"custom\",\n input,\n inst,\n };\n }\n return { ...iss };\n}\nexport function cleanEnum(obj) {\n return Object.entries(obj)\n .filter(([k, _]) => {\n // return true if NaN, meaning it's not a number, thus a string key\n return Number.isNaN(Number.parseInt(k, 10));\n })\n .map((el) => el[1]);\n}\n// Codec utility functions\nexport function base64ToUint8Array(base64) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes;\n}\nexport function uint8ArrayToBase64(bytes) {\n let binaryString = \"\";\n for (let i = 0; i < bytes.length; i++) {\n binaryString += String.fromCharCode(bytes[i]);\n }\n return btoa(binaryString);\n}\nexport function base64urlToUint8Array(base64url) {\n const base64 = base64url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padding = \"=\".repeat((4 - (base64.length % 4)) % 4);\n return base64ToUint8Array(base64 + padding);\n}\nexport function uint8ArrayToBase64url(bytes) {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\nexport function hexToUint8Array(hex) {\n const cleanHex = hex.replace(/^0x/, \"\");\n if (cleanHex.length % 2 !== 0) {\n throw new Error(\"Invalid hex string length\");\n }\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < cleanHex.length; i += 2) {\n bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);\n }\n return bytes;\n}\nexport function uint8ArrayToHex(bytes) {\n return Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n// instanceof\nexport class Class {\n constructor(..._args) { }\n}\n////////// PROTOTYPE INSTALLERS //////////\n//\n// Members live on the prototype and materialize per instance on first read, which keeps own-property count under the step where V8 stops using inline slots. Changing anything here means re-measuring runtime, memory and bundle size together — see \"The three axes\" in AGENTS.md.\n/**\n * Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.\n *\n * Call this from a `proto` initializer, which runs once per prototype — never per instance.\n */\nexport function members(proto, table) {\n for (const key in table) {\n const desc = Object.getOwnPropertyDescriptor(table, key);\n // a getter installs as written, so it stays live: `description` reads through to the registry on every access. not enumerable: an object literal's is, and a prototype member never was\n if (desc.get)\n Object.defineProperty(proto, key, { ...desc, enumerable: false });\n // a method materializes bound on first read, which is what keeps a detached member working: `const opt = schema.optional; opt()`\n else\n defineBound(proto, key, desc.value);\n }\n}\n/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */\nexport function own(inst, key, value, enumerable = true) {\n Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });\n return value;\n}\n/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */\nexport function hide(inst, key, value) {\n return own(inst, key, value, false);\n}\n/** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */\nexport /*@__NO_SIDE_EFFECTS__*/ function derived(computes, table) {\n for (const key in computes) {\n const compute = computes[key];\n // an object literal's accessor is configurable and enumerable, and `members` copies the descriptor as written\n Object.defineProperty(table, key, {\n configurable: true,\n enumerable: true,\n get() {\n return own(this, key, compute(this));\n },\n set(value) {\n own(this, key, value);\n },\n });\n }\n return table;\n}\nfunction defineBound(proto, key, fn) {\n Object.defineProperty(proto, key, {\n configurable: true,\n get() {\n // vitest's spyOn calls a prototype getter bare to find the function it wraps, so a nullish receiver answers the raw method\n return this == null ? fn : own(this, key, fn.bind(this));\n },\n set(value) {\n own(this, key, value);\n },\n });\n}\n/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */\nfunction claim(inst, sentinel) {\n const proto = Object.getPrototypeOf(inst);\n // Runs on every construction, so `in` rather than the costlier `hasOwnProperty.call`. Sentinels are keys the group itself defines.\n return sentinel in proto ? undefined : proto;\n}\n// The internals whose init chain is installing. A second call for the same one is a derived constructor overriding its base, so it must not construct another schema in between or the override is dropped.\nlet installing;\n// Set while a getter is running, so a value that resolved through a recursion break is not memoized. One shared descriptor shadows the key for the duration, which costs no per-key allocation.\nlet broke = false;\nconst breaker = {\n configurable: true,\n get() {\n broke = true;\n return undefined;\n },\n};\n/**\n * Installs a lazily-derived internal on the `_zod` prototype of `inst`'s\n * constructor, computed from the internals object itself and cached there on\n * first read. One accessor per constructor rather than one per instance.\n */\nexport function defineLazyInternal(inst, key, compute) {\n const proto = Object.getPrototypeOf(inst._zod);\n if (key in proto && installing !== inst._zod) {\n // A repeat construction: everything is installed already. Cleared here so the reference is not held past the first construction of every type.\n installing = undefined;\n return;\n }\n installing = inst._zod;\n Object.defineProperty(proto, key, {\n configurable: true,\n get() {\n // Shadowed before computing so a re-entrant read from a recursive schema resolves to undefined instead of running the getter again.\n Object.defineProperty(this, key, breaker);\n const outer = broke;\n broke = false;\n try {\n const value = compute(this);\n // A result that resolved through a recursion break is recomputed once the graph is complete; everything else memoizes, undefined included.\n if (broke)\n delete this[key];\n else\n Object.defineProperty(this, key, { configurable: true, writable: true, value });\n broke = broke || outer;\n return value;\n }\n catch (err) {\n // A compute that threw memoizes nothing, so a later read runs it again and fails the same way. The shadow goes with it, since leaving it installed would answer undefined for every later read.\n delete this[key];\n broke = broke || outer;\n throw err;\n }\n },\n set(value) {\n Object.defineProperty(this, key, { configurable: true, writable: true, value });\n },\n });\n}\n/**\n * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own\n * data property. One accessor per constructor rather than one per instance, because an own accessor\n * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.\n */\nexport function installLazyProp(inst, key, make, enumerable) {\n const proto = claim(inst, key);\n if (!proto)\n return;\n Object.defineProperty(proto, key, {\n configurable: true,\n get() {\n // Shadowed before computing, so a re-entrant read from a self-referential shape resolves to undefined instead of running the getter again. A data property rather than an accessor: an own accessor is the dictionary-mode transition this exists to avoid.\n const desc = { configurable: true, writable: true, enumerable, value: undefined };\n Object.defineProperty(this, key, desc);\n // a compute that throws leaves the shadow behind, so later reads answer undefined instead of re-throwing; `defineLazy` did the same, and `defineLazyInternal`'s delete-on-catch would cost bytes in every bundle for a case only a throwing user getter reaches\n desc.value = make(this);\n Object.defineProperty(this, key, desc);\n return desc.value;\n },\n set(value) {\n Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value });\n },\n });\n}\n/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */\nexport const CONSTANT_CATCH = \"~constantCatch\";\n/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */\nexport function constantCatch(value) {\n const fn = () => value;\n fn[CONSTANT_CATCH] = true;\n return fn;\n}\n","var _a;\nimport { members as installMembers } from \"./util.js\";\n/** A special constant with type `never` */\nexport const NEVER = /*@__PURE__*/ Object.freeze({\n status: \"aborted\",\n});\n/* Shared descriptor for installing `_zod`; defineProperty reads it\n * synchronously, so reusing one object avoids a per-instance allocation. */\nconst _zodDesc = { value: undefined, enumerable: false };\n// null where suppressing the capture would be unrecoverable: `parse()` puts the frames back with `captureStackTrace`, so without it the throw would lose its stack. also latched to null once `stackTraceLimit` proves unassignable, which a realm can do at any point by hardening Error\nlet _E = \"captureStackTrace\" in Error ? Error : null;\n// v8 captures a stack trace inside the Error constructor, which dominates a failed parse; costs only the frames, and parse() restores those. the constructor must RUN: Object.create is cheaper and passes instanceof, but Error.isError and util.types.isNativeError check an internal slot\nfunction newError(Definition) {\n const E = _E;\n if (E) {\n const saved = E.stackTraceLimit;\n if (typeof saved === \"number\") {\n try {\n E.stackTraceLimit = 0;\n }\n catch {\n _E = null;\n return new Definition();\n }\n try {\n return new Definition();\n }\n finally {\n E.stackTraceLimit = saved;\n }\n }\n }\n return new Definition();\n}\nexport /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer, \n/** This trait's members, installed once on every prototype that composes it. They cannot be declared in the initializer above: that runs per instance, and the prototype is shared. */\nproto, params) {\n // Prototype for this constructor's `_zod` internals. Lazily-derived fields (`values`, `pattern`, `optin`, …) install here once rather than as an accessor on every instance.\n const zodProto = {};\n // Assigning the fields in the constructor body is what gives instances in-object slots; building the object literally and reparenting it costs a second allocation and a generic property copy.\n function Internals(def) {\n this.def = def;\n this.constr = _;\n this.traits = new Set();\n }\n Internals.prototype = zodProto;\n const protoMembers = proto;\n // One trait's members land on every prototype whose chain composes it, so the answer is per prototype rather than per trait.\n const initialized = protoMembers && new WeakSet();\n function init(inst, def) {\n if (!inst._zod) {\n _zodDesc.value = new Internals(def);\n try {\n Object.defineProperty(inst, \"_zod\", _zodDesc);\n }\n finally {\n // Cleared even on throw, so the shared descriptor never leaks one instance's internals into the next.\n _zodDesc.value = undefined;\n }\n }\n else if (inst._zod.traits.has(name)) {\n return;\n }\n inst._zod.traits.add(name);\n initializer(inst, def);\n if (initialized) {\n // `super(def)` from a user subclass gives `this` a prototype the subclass owns, and installing there would overwrite whatever the subclass declared. `constr` built the instance, so its prototype is the one below the subclass's that should carry the members. A receiver whose chain never reaches that prototype installs on its own, which for a plain object handed straight to `init` means `Object.prototype` — unchanged from before.\n const own = Object.getPrototypeOf(inst);\n const ctorProto = inst._zod.constr.prototype;\n let up = own;\n while (up && up !== ctorProto)\n up = Object.getPrototypeOf(up);\n const target = up ?? own;\n if (!initialized.has(target)) {\n initialized.add(target);\n installMembers(target, protoMembers);\n }\n }\n // support prototype modifications; for-in avoids the array allocation of Object.keys on the (usually empty) prototype\n const proto = _.prototype;\n for (const k in proto) {\n if (!Object.prototype.hasOwnProperty.call(proto, k))\n continue;\n if (!(k in inst)) {\n inst[k] = proto[k].bind(inst);\n }\n }\n }\n // doesn't work if Parent has a constructor with arguments\n const Parent = params?.Parent ?? Object;\n class Definition extends Parent {\n }\n Object.defineProperty(Definition, \"name\", { value: name });\n function _(def) {\n const inst = params?.Parent ? newError(Definition) : this;\n init(inst, def);\n const deferred = inst._zod.deferred;\n if (deferred) {\n for (const fn of deferred) {\n fn();\n }\n // Released: initializers run once, and the list would otherwise be retained for the schema's lifetime.\n inst._zod.deferred = undefined;\n }\n // Global post-processor hook. Internal: installed by `import \"zod/compile\"` to enable AOT compilation for every constructed schema. Runs last, once the instance is fully built, because it hands the instance to compile(). The post-processor is expected to be reentrancy-guarded by its own implementation.\n const pp = globalThis.__zod_globalConfig?.postProcessor;\n if (pp)\n pp(inst);\n return inst;\n }\n Object.defineProperty(_, \"init\", { value: init });\n Object.defineProperty(_, Symbol.hasInstance, {\n value: (inst) => {\n if (params?.Parent && inst instanceof params.Parent)\n return true;\n return inst?._zod?.traits?.has(name);\n },\n });\n Object.defineProperty(_, \"name\", { value: name });\n return _;\n}\n////////////////////////////// UTILITIES ///////////////////////////////////////\nexport const $brand = /*@__PURE__*/ Symbol(\"zod_brand\");\nexport class $ZodAsyncError extends Error {\n constructor() {\n super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);\n }\n}\nexport class $ZodEncodeError extends Error {\n constructor(name) {\n super(`Encountered unidirectional transform during encode: ${name}`);\n this.name = \"ZodEncodeError\";\n }\n}\n(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});\nexport const globalConfig = globalThis.__zod_globalConfig;\nexport function config(newConfig) {\n if (newConfig)\n Object.assign(globalConfig, newConfig);\n return globalConfig;\n}\n","import { $constructor } from \"./core.js\";\nimport * as util from \"./util.js\";\n/* Computing the message eagerly is expensive (pretty-printed JSON of all\n * issues), so defer it until first read. The accessor functions and\n * descriptors are shared across instances to keep error construction\n * cheap; the computed message is cached on the internals object. The\n * setter preserves plain assignment semantics for consumers that\n * overwrite `message`. */\nfunction _getMessage() {\n const internals = this._zod;\n internals.message ?? (internals.message = JSON.stringify(internals.def, util.jsonStringifyReplacer, 2));\n return internals.message;\n}\nfunction _setMessage(value) {\n this._zod.message = value;\n}\nconst _messageDesc = {\n get: _getMessage,\n set: _setMessage,\n enumerable: true,\n configurable: true,\n};\nconst _issuesDesc = { value: undefined, enumerable: false };\n/* Prototypes that already carry the lazy `toString`. Seeded with the\n * intrinsics so that `init` on a foreign object — it accepts any object —\n * can never install an accessor onto a prototype we do not own. */\nconst _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);\nconst initializer = (inst, def) => {\n inst.name = \"$ZodError\";\n // `_zod` is already non-enumerable: $constructor's init defined it with this same descriptor\n _issuesDesc.value = def;\n Object.defineProperty(inst, \"issues\", _issuesDesc);\n // Clear the shared slot; a retained `value` pins the last error's issues.\n _issuesDesc.value = undefined;\n Object.defineProperty(inst, \"message\", _messageDesc);\n /* `toString` lives as a non-enumerable lazy getter on the shared\n * prototype; on first access it caches a per-instance closure so\n * detached usage still works. */\n const proto = Object.getPrototypeOf(inst);\n if (!_installedToString.has(proto)) {\n _installedToString.add(proto);\n Object.defineProperty(proto, \"toString\", {\n configurable: true,\n enumerable: false,\n get() {\n const value = () => this.message;\n Object.defineProperty(this, \"toString\", { value, configurable: true, writable: true });\n return value;\n },\n set(value) {\n Object.defineProperty(this, \"toString\", { value, configurable: true, writable: true });\n },\n });\n }\n};\nexport const $ZodError = $constructor(\"$ZodError\", initializer);\nexport const $ZodRealError = $constructor(\"$ZodError\", initializer, undefined, {\n Parent: Error,\n});\n/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member\n * (\"toString\", \"constructor\") would otherwise read through to the prototype, and assigning\n * \"__proto__\" would hit the setter instead of creating a key. */\nfunction node(obj, key, make) {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) {\n if (key === \"__proto__\") {\n Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });\n }\n else {\n obj[key] = make();\n }\n }\n return obj[key];\n}\nexport function flattenError(error, mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of error.issues) {\n if (sub.path.length > 0) {\n node(fieldErrors, sub.path[0], () => []).push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n}\nexport function formatError(error, mapper = (issue) => issue.message) {\n const fieldErrors = { _errors: [] };\n const processError = (error, path = []) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n // `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.\n if (el === \"_errors\") {\n if (terminal)\n curr._errors.push(mapper(issue));\n i++;\n continue;\n }\n // A path element may collide with an inherited property name such as\n // \"__proto__\" or \"constructor\". Truthiness checks read the prototype\n // (so no node is created, then ._errors.push throws), and bracket\n // assignment of \"__proto__\" hits the setter instead of creating an\n // own key. Guard the read with hasOwnProperty and create the node\n // with defineProperty so any path element becomes a real own key.\n if (!Object.prototype.hasOwnProperty.call(curr, el)) {\n Object.defineProperty(curr, el, {\n value: { _errors: [] },\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n const node = curr[el];\n if (terminal) {\n node._errors.push(mapper(issue));\n }\n curr = node;\n i++;\n }\n }\n }\n }\n };\n processError(error);\n return fieldErrors;\n}\nexport function treeifyError(error, mapper = (issue) => issue.message) {\n const result = { errors: [] };\n const processError = (error, path = []) => {\n var _a;\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n // regular union error\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n result.errors.push(mapper(issue));\n continue;\n }\n let curr = result;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (typeof el === \"string\") {\n curr.properties ?? (curr.properties = {});\n // el may collide with an inherited property name (\"__proto__\",\n // \"constructor\", ...); ??= reads the prototype so the node is never\n // created and curr.errors.push throws. Guard with hasOwnProperty and\n // create the node with defineProperty so \"__proto__\" becomes a real\n // own key rather than invoking the prototype setter.\n if (!Object.prototype.hasOwnProperty.call(curr.properties, el)) {\n Object.defineProperty(curr.properties, el, {\n value: { errors: [] },\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n curr = curr.properties[el];\n }\n else {\n curr.items ?? (curr.items = []);\n (_a = curr.items)[el] ?? (_a[el] = { errors: [] });\n curr = curr.items[el];\n }\n if (terminal) {\n curr.errors.push(mapper(issue));\n }\n i++;\n }\n }\n }\n };\n processError(error);\n return result;\n}\n/** Format a ZodError as a human-readable string in the following form.\n *\n * From\n *\n * ```ts\n * ZodError {\n * issues: [\n * {\n * expected: 'string',\n * code: 'invalid_type',\n * path: [ 'username' ],\n * message: 'Invalid input: expected string'\n * },\n * {\n * expected: 'number',\n * code: 'invalid_type',\n * path: [ 'favoriteNumbers', 1 ],\n * message: 'Invalid input: expected number'\n * }\n * ];\n * }\n * ```\n *\n * to\n *\n * ```\n * username\n * ✖ Expected number, received string at \"username\n * favoriteNumbers[0]\n * ✖ Invalid input: expected number\n * ```\n */\nexport function toDotPath(_path) {\n const segs = [];\n const path = _path.map((seg) => (typeof seg === \"object\" ? seg.key : seg));\n for (const seg of path) {\n if (typeof seg === \"number\")\n segs.push(`[${seg}]`);\n else if (typeof seg === \"symbol\")\n segs.push(`[${JSON.stringify(String(seg))}]`);\n else if (/[^\\w$]/.test(seg))\n segs.push(`[${JSON.stringify(seg)}]`);\n else {\n if (segs.length)\n segs.push(\".\");\n segs.push(seg);\n }\n }\n return segs.join(\"\");\n}\nexport function prettifyError(error) {\n const lines = [];\n // sort by path length\n const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);\n // Process each issue\n for (const issue of issues) {\n lines.push(`✖ ${issue.message}`);\n if (issue.path?.length)\n lines.push(` → at ${toDotPath(issue.path)}`);\n }\n // Convert Map to formatted string\n return lines.join(\"\\n\");\n}\n","import * as core from \"./core.js\";\nimport * as errors from \"./errors.js\";\nimport * as util from \"./util.js\";\n// Always both keys, so the `_params` read site in `_parse` sees one object shape rather than two.\nfunction finalizeParams(callee, params) {\n return { callee: params?.callee ?? callee, Err: params?.Err };\n}\nexport const _parse = (_Err) => {\n const fn = (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n if (result.issues.length) {\n const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, _params?.callee ?? fn);\n throw e;\n }\n return result.value;\n };\n return fn;\n};\nexport const parse = /* @__PURE__*/ _parse(errors.$ZodRealError);\nexport const _parseAsync = (_Err) => {\n const fn = async (schema, value, _ctx, params) => {\n const ctx = _ctx ? { ..._ctx, async: true } : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise)\n result = await result;\n if (result.issues.length) {\n const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, params?.callee ?? fn);\n throw e;\n }\n return result.value;\n };\n return fn;\n};\nexport const parseAsync = /* @__PURE__*/ _parseAsync(errors.$ZodRealError);\nexport const _safeParse = (_Err) => (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };\n};\nexport const safeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);\n// the error is built on the first read of `error`: finalizing the issues and constructing the instance is most of a failing parse, and a caller that only branches on `success` never pays it. a getter in the literal keeps this small; the alternative, one shared accessor descriptor plus a hidden state slot, reads ~15% faster but costs ~75 B gzipped in every bundle\nfunction failure(Err, issues, ctx) {\n let error;\n return {\n success: false,\n get error() {\n if (!error) {\n error = new Err(issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n // finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result\n issues = undefined;\n ctx = undefined;\n }\n return error;\n },\n set error(e) {\n error = e;\n // a replacement makes the getter's branch unreachable, so the captures have to go here too\n issues = undefined;\n ctx = undefined;\n },\n };\n}\nexport const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, async: true } : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise)\n result = await result;\n return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };\n};\nexport const safeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);\n// registry mirrors of the compiler's sentinels, so this module never imports the compiler\nconst COMPILE_INVALID = /* @__PURE__ */ Symbol.for(\"zod.compile.invalid\");\nconst COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for(\"zod.compile.fallback\");\n// Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.\nexport const validate = ((schema, value, _ctx) => {\n const validator = schema._zod.bag.validator;\n if (validator !== undefined) {\n if (validator(value) !== COMPILE_INVALID)\n return true;\n // a definite sentinel means the runtime would reject, so skip the re-parse; a ctx can still change the answer\n if (validator.definite === true && _ctx === undefined)\n return false;\n }\n return validateFallback(schema, value, _ctx);\n});\nfunction validateFallback(schema, value, _ctx) {\n const ctx = _ctx\n ? { ..._ctx, async: false, abortEarly: true }\n : { async: false, abortEarly: true };\n const fallbackRun = schema._zod.bag.fallbackRun;\n let result;\n if (fallbackRun) {\n // skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound\n ctx[COMPILE_FALLBACK] = true;\n result = fallbackRun({ value, issues: [] }, ctx);\n }\n else {\n result = schema._zod.run({ value, issues: [] }, ctx);\n }\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n return result.issues.length === 0;\n}\n// no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw\nexport const validateAsync = async (schema, value, _ctx) => {\n const ctx = _ctx\n ? { ..._ctx, async: true, abortEarly: true }\n : { async: true, abortEarly: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise)\n result = await result;\n return result.issues.length === 0;\n};\nexport const _encode = (_Err) => {\n const parse = _parse(_Err);\n const fn = (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return parse(schema, value, ctx, finalizeParams(fn, _params));\n };\n return fn;\n};\nexport const encode = /* @__PURE__*/ _encode(errors.$ZodRealError);\nexport const _decode = (_Err) => {\n const parse = _parse(_Err);\n const fn = (schema, value, _ctx, _params) => {\n return parse(schema, value, _ctx, finalizeParams(fn, _params));\n };\n return fn;\n};\nexport const decode = /* @__PURE__*/ _decode(errors.$ZodRealError);\nexport const _encodeAsync = (_Err) => {\n const parseAsync = _parseAsync(_Err);\n const fn = async (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return (await parseAsync(schema, value, ctx, finalizeParams(fn, _params)));\n };\n return fn;\n};\nexport const encodeAsync = /* @__PURE__*/ _encodeAsync(errors.$ZodRealError);\nexport const _decodeAsync = (_Err) => {\n const parseAsync = _parseAsync(_Err);\n const fn = async (schema, value, _ctx, _params) => {\n return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));\n };\n return fn;\n};\nexport const decodeAsync = /* @__PURE__*/ _decodeAsync(errors.$ZodRealError);\nexport const _safeEncode = (_Err) => (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return _safeParse(_Err)(schema, value, ctx);\n};\nexport const safeEncode = /* @__PURE__*/ _safeEncode(errors.$ZodRealError);\nexport const _safeDecode = (_Err) => (schema, value, _ctx) => {\n return _safeParse(_Err)(schema, value, _ctx);\n};\nexport const safeDecode = /* @__PURE__*/ _safeDecode(errors.$ZodRealError);\nexport const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return _safeParseAsync(_Err)(schema, value, ctx);\n};\nexport const safeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync(errors.$ZodRealError);\nexport const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {\n return _safeParseAsync(_Err)(schema, value, _ctx);\n};\nexport const safeDecodeAsync = /* @__PURE__*/ _safeDecodeAsync(errors.$ZodRealError);\n","import * as util from \"./util.js\";\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link cuid2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const cuid = /^[cC][0-9a-z]{6,}$/;\nexport const cuid2 = /^[0-9a-z]+$/;\nexport const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;\nexport const xid = /^[0-9a-vA-V]{20}$/;\nexport const ksuid = /^[A-Za-z0-9]{27}$/;\nexport const nanoid = /^[a-zA-Z0-9_-]{21}$/;\nexport function nanoidOfLength(length) {\n return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);\n}\n/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */\nexport const duration = /^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;\n/** Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components. */\nexport const extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */\nexport const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;\n/** Returns a regex for validating an RFC 9562/4122 UUID.\n *\n * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */\nexport const uuid = (version) => {\n if (!version)\n return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;\n return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);\n};\nexport const uuid4 = /*@__PURE__*/ uuid(4);\nexport const uuid6 = /*@__PURE__*/ uuid(6);\nexport const uuid7 = /*@__PURE__*/ uuid(7);\n/** Practical email validation */\nexport const email = /^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;\n/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */\nexport const html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n/** The classic emailregex.com regex for RFC 5322-compliant emails */\nexport const rfc5322Email = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n/** A loose regex that allows Unicode characters, enforces length limits, and that's about it. */\nexport const unicodeEmail = /^[^\\s@\"]{1,64}@[^\\s@]{1,255}$/u;\nexport const idnEmail = unicodeEmail;\nexport const browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\n// Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match. The leading lookahead then demands one anchor — a pictograph, a regional indicator, or the enclosing keycap — because `\\p{Emoji_Component}` on its own covers ASCII digits, `#`, `*`, ZWJ, variation selectors and skin tone modifiers, none of which is an emoji without a base.\nconst _emoji = `^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$`;\nexport function emoji() {\n return new RegExp(_emoji, \"u\");\n}\nexport const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nexport const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;\nexport const mac = (delimiter) => {\n const escapedDelim = util.escapeRegex(delimiter ?? \":\");\n return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);\n};\nexport const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/;\nexport const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nexport const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;\nexport const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;\n// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address\n// export const hostname: RegExp = /^([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+$/;\nexport const hostname = /^(?=.{1,253}\\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\\.?$/;\nexport const domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,63}$/;\nexport const httpProtocol = /^https?$/;\n// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces) E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15\nexport const e164 = /^\\+[1-9]\\d{6,14}$/;\n// Credit card shape: 12–19 digits, optionally separated by single spaces or single hyphens. ISO/IEC 7812 caps the PAN at 19 digits; 12 is the shortest issued length (Maestro).\nexport const creditCard = /^\\d(?:[ -]?\\d){11,18}$/;\n// ISO 4217 alpha codes from the SIX list, regenerated by scripts/update-iso-4217.ts\nexport const currencyCode = /^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/;\n// iban electronic format: 2-letter country, check digits 02-98 (the only values `98 - remainder` can produce), 11-30 bban characters\nexport const iban = /^[A-Z]{2}(?!00|01|99)\\d{2}[A-Z0-9]{11,30}$/;\nconst dateSource = `(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))`;\n/** Anchors a pattern source. The interpolation lives here rather than at the call site because\n * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it\n * will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */\nfunction anchor(source) {\n return new RegExp(`^${source}$`);\n}\nexport const date = /*@__PURE__*/ anchor(dateSource);\nfunction timeSource(args) {\n const hhmm = `(?:[01]\\\\d|2[0-3]):[0-5]\\\\d`;\n const regex = typeof args.precision === \"number\"\n ? args.precision === -1\n ? `${hhmm}`\n : args.precision === 0\n ? `${hhmm}:[0-5]\\\\d`\n : `${hhmm}:[0-5]\\\\d\\\\.\\\\d{${args.precision}}`\n : args.seconds\n ? `${hhmm}:[0-5]\\\\d(?:\\\\.\\\\d+)?`\n : `${hhmm}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`;\n return regex;\n}\nexport function time(args) {\n return new RegExp(`^${timeSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetime(args) {\n const opts = [\"Z\"];\n // if (args.offset) opts.push(`([+-]\\\\d{2}:\\\\d{2})`);\n if (args.offset)\n opts.push(`([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)`);\n // RFC 3339 mandates seconds wherever the time carries a `Z` or an offset, so only the unqualified form `local` adds may omit them\n const qualified = `${timeSource({ precision: args.precision, seconds: true })}(?:${opts.join(\"|\")})`;\n const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;\n return new RegExp(`^${dateSource}T(?:${timeRegex})$`);\n}\n// the unbounded form of `string()` as a literal, so every plain string shares one instance instead of building its own\nexport const anyString = /^[\\s\\S]{0,}$/;\nexport const string = (params) => {\n const regex = params ? `[\\\\s\\\\S]{${params?.minimum ?? 0},${params?.maximum ?? \"\"}}` : `[\\\\s\\\\S]*`;\n return new RegExp(`^${regex}$`);\n};\nexport const bigint = /^-?\\d+n?$/;\nexport const integer = /^-?\\d+$/;\nexport const number = /^-?\\d+(?:\\.\\d+)?$/;\nexport const boolean = /^(?:true|false)$/i;\nconst _null = /^null$/i;\nexport { _null as null };\nconst _undefined = /^undefined$/i;\nexport { _undefined as undefined };\n// regex for string with no uppercase letters\nexport const lowercase = /^[^A-Z]*$/;\n// regex for string with no lowercase letters\nexport const uppercase = /^[^a-z]*$/;\n// regex for hexadecimal strings (any length)\nexport const hex = /^[0-9a-fA-F]*$/;\n// Hash regexes for different algorithms and encodings\n// Helper function to create base64 regex with exact length and padding\nfunction fixedBase64(bodyLength, padding) {\n return new RegExp(`^[A-Za-z0-9+/]{${bodyLength}}${padding}$`);\n}\n// Helper function to create base64url regex with exact length (no padding)\nfunction fixedBase64url(length) {\n return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);\n}\n// MD5 (16 bytes): base64 = 24 chars total (22 + \"==\")\nexport const md5_hex = /^[0-9a-fA-F]{32}$/;\nexport const md5_base64 = /*@__PURE__*/ fixedBase64(22, \"==\");\nexport const md5_base64url = /*@__PURE__*/ fixedBase64url(22);\n// SHA1 (20 bytes): base64 = 28 chars total (27 + \"=\")\nexport const sha1_hex = /^[0-9a-fA-F]{40}$/;\nexport const sha1_base64 = /*@__PURE__*/ fixedBase64(27, \"=\");\nexport const sha1_base64url = /*@__PURE__*/ fixedBase64url(27);\n// SHA256 (32 bytes): base64 = 44 chars total (43 + \"=\")\nexport const sha256_hex = /^[0-9a-fA-F]{64}$/;\nexport const sha256_base64 = /*@__PURE__*/ fixedBase64(43, \"=\");\nexport const sha256_base64url = /*@__PURE__*/ fixedBase64url(43);\n// SHA384 (48 bytes): base64 = 64 chars total (no padding)\nexport const sha384_hex = /^[0-9a-fA-F]{96}$/;\nexport const sha384_base64 = /*@__PURE__*/ fixedBase64(64, \"\");\nexport const sha384_base64url = /*@__PURE__*/ fixedBase64url(64);\n// SHA512 (64 bytes): base64 = 88 chars total (86 + \"==\")\nexport const sha512_hex = /^[0-9a-fA-F]{128}$/;\nexport const sha512_base64 = /*@__PURE__*/ fixedBase64(86, \"==\");\nexport const sha512_base64url = /*@__PURE__*/ fixedBase64url(86);\n","// import { $ZodType } from \"./schemas.js\";\nimport * as core from \"./core.js\";\nimport * as regexes from \"./regexes.js\";\nimport * as util from \"./util.js\";\nexport const $ZodCheck = /*@__PURE__*/ core.$constructor(\"$ZodCheck\", (inst, def) => {\n var _a;\n inst._zod ?? (inst._zod = {});\n inst._zod.def = def;\n (_a = inst._zod).onattach ?? (_a.onattach = []);\n});\n/** Default `when` for size-based checks: run only on non-nullish values with a `size`. */\nconst _whenHasSize = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.size !== undefined;\n};\n/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */\nconst _whenHasLength = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.length !== undefined;\n};\nconst numericOriginMap = {\n number: \"number\",\n bigint: \"bigint\",\n object: \"date\",\n};\nexport const $ZodCheckLessThan = /*@__PURE__*/ core.$constructor(\"$ZodCheckLessThan\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value];\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {\n return;\n }\n payload.issues.push({\n origin: numericOriginMap[typeof payload.value] ?? origin,\n code: \"too_big\",\n maximum: typeof def.value === \"object\" ? def.value.getTime() : def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckGreaterThan = /*@__PURE__*/ core.$constructor(\"$ZodCheckGreaterThan\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value];\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {\n return;\n }\n payload.issues.push({\n origin: numericOriginMap[typeof payload.value] ?? origin,\n code: \"too_small\",\n minimum: typeof def.value === \"object\" ? def.value.getTime() : def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMultipleOf = \n/*@__PURE__*/ core.$constructor(\"$ZodCheckMultipleOf\", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.check = (payload) => {\n if (typeof payload.value !== typeof def.value)\n throw new Error(\"Cannot mix number and bigint in multiple_of check.\");\n const isMultiple = typeof payload.value === \"bigint\"\n ? // `value % 0n` throws, and nothing is a multiple of zero — the number branch already fails this way via NaN\n def.value !== BigInt(0) && payload.value % def.value === BigInt(0)\n : util.floatSafeRemainder(payload.value, def.value) === 0;\n if (isMultiple)\n return;\n payload.issues.push({\n origin: typeof payload.value,\n code: \"not_multiple_of\",\n divisor: def.value,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckNumberFormat = /*@__PURE__*/ core.$constructor(\"$ZodCheckNumberFormat\", (inst, def) => {\n $ZodCheck.init(inst, def); // no format checks\n def.format = def.format || \"float64\";\n const isInt = def.format?.includes(\"int\");\n const origin = isInt ? \"int\" : \"number\";\n const [minimum, maximum] = util.NUMBER_FORMAT_RANGES[def.format];\n inst._zod.check = (payload) => {\n const input = payload.value;\n if (isInt) {\n if (!Number.isInteger(input)) {\n // invalid_format issue\n // payload.issues.push({\n // expected: def.format,\n // format: def.format,\n // code: \"invalid_format\",\n // input,\n // inst,\n // });\n // invalid_type issue\n payload.issues.push({\n expected: origin,\n format: def.format,\n code: \"invalid_type\",\n continue: false,\n input,\n inst,\n });\n return;\n // not_multiple_of issue\n // payload.issues.push({\n // code: \"not_multiple_of\",\n // origin: \"number\",\n // input,\n // inst,\n // divisor: 1,\n // });\n }\n if (!Number.isSafeInteger(input)) {\n if (input > 0) {\n // too_big\n payload.issues.push({\n input,\n code: \"too_big\",\n maximum: Number.MAX_SAFE_INTEGER,\n note: \"Integers must be within the safe integer range.\",\n inst,\n origin,\n inclusive: true,\n continue: !def.abort,\n });\n }\n else {\n // too_small\n payload.issues.push({\n input,\n code: \"too_small\",\n minimum: Number.MIN_SAFE_INTEGER,\n note: \"Integers must be within the safe integer range.\",\n inst,\n origin,\n inclusive: true,\n continue: !def.abort,\n });\n }\n return;\n }\n }\n if (input < minimum) {\n payload.issues.push({\n origin: \"number\",\n input,\n code: \"too_small\",\n minimum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n if (input > maximum) {\n payload.issues.push({\n origin: \"number\",\n input,\n code: \"too_big\",\n maximum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodCheckBigIntFormat = /*@__PURE__*/ core.$constructor(\"$ZodCheckBigIntFormat\", (inst, def) => {\n $ZodCheck.init(inst, def); // no format checks\n const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];\n inst._zod.check = (payload) => {\n const input = payload.value;\n if (input < minimum) {\n payload.issues.push({\n origin: \"bigint\",\n input,\n code: \"too_small\",\n minimum: minimum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n if (input > maximum) {\n payload.issues.push({\n origin: \"bigint\",\n input,\n code: \"too_big\",\n maximum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodCheckMaxSize = /*@__PURE__*/ core.$constructor(\"$ZodCheckMaxSize\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = _whenHasSize);\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size <= def.maximum)\n return;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n code: \"too_big\",\n maximum: def.maximum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMinSize = /*@__PURE__*/ core.$constructor(\"$ZodCheckMinSize\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = _whenHasSize);\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size >= def.minimum)\n return;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n code: \"too_small\",\n minimum: def.minimum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckSizeEquals = /*@__PURE__*/ core.$constructor(\"$ZodCheckSizeEquals\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = _whenHasSize);\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size === def.size)\n return;\n const tooBig = size > def.size;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n ...(tooBig ? { code: \"too_big\", maximum: def.size } : { code: \"too_small\", minimum: def.size }),\n inclusive: true,\n exact: true,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMaxLength = /*@__PURE__*/ core.$constructor(\"$ZodCheckMaxLength\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);\n inst._zod.check = (payload) => {\n const input = payload.value;\n const units = input.length;\n // Strings are measured in Unicode code points, not UTF-16 units. A code point is at most two units, so a string that already fits in units fits in code points; only an overflow has to be counted.\n const length = typeof input === \"string\" && units > def.maximum ? util.codePointLength(input) : units;\n if (length <= def.maximum)\n return;\n const origin = util.getLengthableOrigin(input);\n payload.issues.push({\n origin,\n code: \"too_big\",\n maximum: def.maximum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMinLength = /*@__PURE__*/ core.$constructor(\"$ZodCheckMinLength\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);\n inst._zod.check = (payload) => {\n const input = payload.value;\n const units = input.length;\n // A code point is one or two UTF-16 units, so fewer units than the floor can never reach it and twice the floor always clears it. Only in between is the exact count in doubt.\n const length = typeof input === \"string\" && units >= def.minimum && units < def.minimum * 2\n ? util.codePointLength(input)\n : units;\n if (length >= def.minimum)\n return;\n const origin = util.getLengthableOrigin(input);\n payload.issues.push({\n origin,\n code: \"too_small\",\n minimum: def.minimum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckLengthEquals = /*@__PURE__*/ core.$constructor(\"$ZodCheckLengthEquals\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);\n inst._zod.check = (payload) => {\n const input = payload.value;\n const units = input.length;\n // A code point is one or two UTF-16 units, so outside `[length, length * 2]` units the target is missed either way — and missed in the same direction in both measures.\n const length = typeof input === \"string\" && units >= def.length && units <= def.length * 2\n ? util.codePointLength(input)\n : units;\n if (length === def.length)\n return;\n const origin = util.getLengthableOrigin(input);\n const tooBig = length > def.length;\n payload.issues.push({\n origin,\n ...(tooBig ? { code: \"too_big\", maximum: def.length } : { code: \"too_small\", minimum: def.length }),\n inclusive: true,\n exact: true,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodCheckStringFormat\", (inst, def) => {\n var _a, _b;\n $ZodCheck.init(inst, def);\n if (def.pattern)\n (_a = inst._zod).check ?? (_a.check = (payload) => {\n def.pattern.lastIndex = 0;\n if (def.pattern.test(payload.value))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: def.format,\n input: payload.value,\n ...(def.pattern ? { pattern: def.pattern.toString() } : {}),\n inst,\n continue: !def.abort,\n });\n });\n else\n (_b = inst._zod).check ?? (_b.check = () => { });\n});\nexport const $ZodCheckRegex = /*@__PURE__*/ core.$constructor(\"$ZodCheckRegex\", (inst, def) => {\n $ZodCheckStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n def.pattern.lastIndex = 0;\n if (def.pattern.test(payload.value))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"regex\",\n input: payload.value,\n pattern: def.pattern.toString(),\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckLowerCase = /*@__PURE__*/ core.$constructor(\"$ZodCheckLowerCase\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.lowercase);\n $ZodCheckStringFormat.init(inst, def);\n});\nexport const $ZodCheckUpperCase = /*@__PURE__*/ core.$constructor(\"$ZodCheckUpperCase\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.uppercase);\n $ZodCheckStringFormat.init(inst, def);\n});\nexport const $ZodCheckIncludes = /*@__PURE__*/ core.$constructor(\"$ZodCheckIncludes\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const escapedRegex = util.escapeRegex(def.includes);\n // `String.prototype.includes(sub, position)` matches `sub` at `position`\n // OR LATER, so the pattern must allow at least `position` leading chars\n // (`{N,}`), not exactly `position` chars (`{N}`).\n const pattern = new RegExp(typeof def.position === \"number\" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);\n def.pattern = pattern;\n inst._zod.check = (payload) => {\n if (payload.value.includes(def.includes, def.position))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"includes\",\n includes: def.includes,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckStartsWith = /*@__PURE__*/ core.$constructor(\"$ZodCheckStartsWith\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const pattern = new RegExp(`^${util.escapeRegex(def.prefix)}.*`);\n def.pattern ?? (def.pattern = pattern);\n inst._zod.check = (payload) => {\n if (payload.value.startsWith(def.prefix))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"starts_with\",\n prefix: def.prefix,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckEndsWith = /*@__PURE__*/ core.$constructor(\"$ZodCheckEndsWith\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const pattern = new RegExp(`.*${util.escapeRegex(def.suffix)}$`);\n def.pattern ?? (def.pattern = pattern);\n inst._zod.check = (payload) => {\n if (payload.value.endsWith(def.suffix))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"ends_with\",\n suffix: def.suffix,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n///////////////////////////////////\n///// $ZodCheckProperty /////\n///////////////////////////////////\nfunction handleCheckPropertyResult(result, payload, property) {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(property, result.issues));\n }\n}\nexport const $ZodCheckProperty = /*@__PURE__*/ core.$constructor(\"$ZodCheckProperty\", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.check = (payload) => {\n const result = def.schema._zod.run({\n value: payload.value[def.property],\n issues: [],\n }, {});\n if (result instanceof Promise) {\n return result.then((result) => handleCheckPropertyResult(result, payload, def.property));\n }\n handleCheckPropertyResult(result, payload, def.property);\n return;\n };\n});\nexport const $ZodCheckProperties = /*@__PURE__*/ core.$constructor(\"$ZodCheckProperties\", (inst, def) => {\n $ZodCheck.init(inst, def);\n util.hide(inst, Symbol.iterator, function* () {\n yield inst;\n });\n // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema\n let entries;\n inst._zod.check = (payload) => {\n // the base schema already typed the value, so only a nullish one is rejected here: the properties read on a primitive too, matching z.property() on a string's length\n if (payload.value == null) {\n payload.issues.push({ expected: \"object\", code: \"invalid_type\", input: payload.value, inst });\n return undefined;\n }\n entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));\n const input = payload.value;\n let proms;\n for (const [key, schema] of entries) {\n const result = schema._zod.run({ value: input[key], issues: [] }, {});\n if (result instanceof Promise) {\n proms ?? (proms = []);\n proms.push(result.then((result) => handleCheckPropertyResult(result, payload, key)));\n }\n else {\n handleCheckPropertyResult(result, payload, key);\n }\n }\n if (proms)\n return Promise.all(proms).then(() => undefined);\n return undefined;\n };\n});\nexport const $ZodCheckMimeType = /*@__PURE__*/ core.$constructor(\"$ZodCheckMimeType\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const mimeSet = new Set(def.mime);\n inst._zod.check = (payload) => {\n if (mimeSet.has(payload.value.type))\n return;\n payload.issues.push({\n code: \"invalid_value\",\n values: def.mime,\n input: payload.value.type,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckOverwrite = /*@__PURE__*/ core.$constructor(\"$ZodCheckOverwrite\", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.check = (payload) => {\n payload.value = def.tx(payload.value);\n };\n});\n","export class Doc {\n constructor(args = [], closed = {}) {\n this.content = [];\n this.indent = 0;\n this.args = args;\n this.closed = closed;\n }\n // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it\n indented(fn) {\n this.indent += 1;\n try {\n fn(this);\n }\n finally {\n this.indent -= 1;\n }\n }\n write(arg) {\n if (typeof arg === \"function\") {\n arg(this, { execution: \"sync\" });\n arg(this, { execution: \"async\" });\n return;\n }\n const content = arg;\n const lines = content.split(\"\\n\").filter((x) => x);\n const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));\n const dedented = lines.map((x) => x.slice(minIndent)).map((x) => \" \".repeat(this.indent * 2) + x);\n for (const line of dedented) {\n this.content.push(line);\n }\n }\n compile() {\n const F = Function;\n const content = this?.content ?? [``];\n const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(\", \")}) {\\n${content.join(\"\\n\")}\\n};`);\n return factory(...Object.values(this.closed));\n }\n}\n","export const version = {\n major: 4,\n minor: 6,\n patch: 7,\n};\n","import * as checks from \"./checks.js\";\nimport * as core from \"./core.js\";\nimport { Doc } from \"./doc.js\";\nimport { parse, parseAsync } from \"./parse.js\";\nimport * as regexes from \"./regexes.js\";\nimport * as util from \"./util.js\";\nimport { version } from \"./versions.js\";\nexport const $ZodType = /*@__PURE__*/ core.$constructor(\"$ZodType\", (inst, def) => {\n var _a;\n inst ?? (inst = {});\n inst._zod.def = def; // set _def property\n inst._zod.bag = inst._zod.bag || {}; // initialize _bag object\n inst._zod.version = version;\n const defChecks = inst._zod.def.checks;\n // if inst is itself a checks.$ZodCheck, run it as a check\n const checks = inst._zod.traits.has(\"$ZodCheck\")\n ? [inst, ...(defChecks ?? [])]\n : defChecks?.length\n ? [...defChecks]\n : [];\n for (const ch of checks) {\n for (const fn of ch._zod.onattach) {\n fn(inst);\n }\n }\n if (checks.length === 0) {\n // deferred initializer inst._zod.parse is not yet defined\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n inst._zod.deferred?.push(() => {\n inst._zod.run = inst._zod.parse;\n });\n }\n else {\n const runChecks = (payload, checks, ctx) => {\n if (payload.memo)\n return payload;\n let isAborted = util.aborted(payload);\n let asyncResult;\n for (const ch of checks) {\n if (ch._zod.def.when) {\n if (util.explicitlyAborted(payload))\n continue;\n const shouldRun = ch._zod.def.when(payload);\n if (!shouldRun)\n continue;\n }\n else if (isAborted) {\n continue;\n }\n const currLen = payload.issues.length;\n const _ = ch._zod.check(payload);\n if (_ instanceof Promise && ctx?.async === false) {\n throw new core.$ZodAsyncError();\n }\n if (asyncResult || _ instanceof Promise) {\n asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {\n await _;\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n return;\n util.attachSchema(payload.issues, currLen, inst);\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n });\n }\n else {\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n continue;\n util.attachSchema(payload.issues, currLen, inst);\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n }\n }\n if (asyncResult) {\n return asyncResult.then(() => {\n return payload;\n });\n }\n return payload;\n };\n const handleCanaryResult = (canary, payload, ctx) => {\n // abort if the canary is aborted\n if (util.aborted(canary)) {\n canary.aborted = true;\n return canary;\n }\n // run checks first, then\n const checkResult = runChecks(payload, checks, ctx);\n if (checkResult instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));\n }\n return inst._zod.parse(checkResult, ctx);\n };\n inst._zod.run = (payload, ctx) => {\n if (ctx.skipChecks) {\n return inst._zod.parse(payload, ctx);\n }\n if (ctx.direction === \"backward\") {\n // run canary initial pass (no checks)\n const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });\n if (canary instanceof Promise) {\n return canary.then((canary) => {\n return handleCanaryResult(canary, payload, ctx);\n });\n }\n return handleCanaryResult(canary, payload, ctx);\n }\n // forward\n const result = inst._zod.parse(payload, ctx);\n if (result instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return result.then((result) => runChecks(result, checks, ctx));\n }\n return runChecks(result, checks, ctx);\n };\n }\n}, {\n // Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.\n get \"~standard\"() {\n return util.hide(this, \"~standard\", standardProps(this));\n },\n set \"~standard\"(value) {\n util.own(this, \"~standard\", value);\n },\n});\n/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */\n// a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through\nconst toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };\nasync function validateAsync(inst, value) {\n const ctx = { async: true };\n return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);\n}\nexport function standardProps(inst) {\n return {\n validate: (value) => {\n const ctx = { async: false };\n try {\n const r = inst._zod.run({ value, issues: [] }, ctx);\n if (!(r instanceof Promise))\n return toStandardResult(r, ctx);\n }\n catch (_) { }\n // async function so a synchronously throwing check rejects instead of escaping validate\n return validateAsync(inst, value);\n },\n vendor: \"zod\",\n version: 1,\n };\n}\nexport { clone } from \"./util.js\";\nexport const $ZodString = /*@__PURE__*/ core.$constructor(\"$ZodString\", (inst, def) => {\n $ZodType.init(inst, def);\n // a format's own pattern, else unbounded; a template literal derives the check-aware form itself\n inst._zod.pattern = def.pattern ?? regexes.anyString;\n inst._zod.parse = (payload, _) => {\n if (def.coerce)\n try {\n payload.value = String(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"string\")\n return payload;\n payload.issues.push({\n expected: \"string\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodStringFormat\", (inst, def) => {\n // check initialization must come first\n checks.$ZodCheckStringFormat.init(inst, def);\n $ZodString.init(inst, def);\n});\nexport const $ZodGUID = /*@__PURE__*/ core.$constructor(\"$ZodGUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.guid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodUUID = /*@__PURE__*/ core.$constructor(\"$ZodUUID\", (inst, def) => {\n if (def.version) {\n const versionMap = {\n v1: 1,\n v2: 2,\n v3: 3,\n v4: 4,\n v5: 5,\n v6: 6,\n v7: 7,\n v8: 8,\n };\n const v = versionMap[def.version];\n if (v === undefined)\n throw new Error(`Invalid UUID version: \"${def.version}\"`);\n def.pattern ?? (def.pattern = regexes.uuid(v));\n }\n else\n def.pattern ?? (def.pattern = regexes.uuid());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodEmail = /*@__PURE__*/ core.$constructor(\"$ZodEmail\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.email);\n $ZodStringFormat.init(inst, def);\n});\n/** The `://` guard rejected the input before the URL constructor saw it. */\nexport const URL_BAD_FORMAT = 1;\n/** The URL parser rejected the input. */\nexport const URL_UNPARSEABLE = 2;\nexport function canParseURL(input) {\n try {\n if (typeof URL !== \"undefined\" && typeof URL.canParse === \"function\")\n return URL.canParse(input);\n new URL(input);\n return true;\n }\n catch {\n return false;\n }\n}\nexport function validateURL(trimmed, def) {\n if (!(\"normalize\" in def) && !(\"hostname\" in def) && !(\"protocol\" in def)) {\n return canParseURL(trimmed) || URL_UNPARSEABLE;\n }\n return parseURLObject(trimmed, def);\n}\n/** Parses a URL while preserving the non-normalizing HTTP guard. */\nexport function parseURLObject(trimmed, def) {\n // When normalize is off, require :// for http/https URLs. This prevents strings like \"http:example.com\" or \"https:/path\" from being silently accepted\n if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\\/\\//i.test(trimmed)) {\n return URL_BAD_FORMAT;\n }\n try {\n if (typeof URL !== \"undefined\") {\n const URLStatic = URL;\n if (typeof URLStatic.parse === \"function\")\n return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;\n }\n // @ts-ignore\n return new URL(trimmed);\n }\n catch {\n return URL_UNPARSEABLE;\n }\n}\nconst asciiTabOrNewline = /[\\t\\n\\r]/g;\n/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL(\"https://exa\\nmple.com\")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */\nexport function stripTabAndNewline(value) {\n return value.replace(asciiTabOrNewline, \"\");\n}\nexport function urlHostnameOk(url, hostname) {\n hostname.lastIndex = 0;\n return hostname.test(url.hostname);\n}\nexport function urlProtocolOk(url, protocol) {\n protocol.lastIndex = 0;\n return protocol.test(url.protocol.endsWith(\":\") ? url.protocol.slice(0, -1) : url.protocol);\n}\nexport const $ZodURL = /*@__PURE__*/ core.$constructor(\"$ZodURL\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n try {\n // Trim whitespace from input\n const trimmed = payload.value.trim();\n const url = validateURL(trimmed, def);\n if (url === URL_BAD_FORMAT) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid URL format\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n return;\n }\n if (url === URL_UNPARSEABLE) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n return;\n }\n if (url === true) {\n payload.value = stripTabAndNewline(trimmed);\n return;\n }\n if (def.hostname && !urlHostnameOk(url, def.hostname)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid hostname\",\n pattern: def.hostname.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n if (def.protocol && !urlProtocolOk(url, def.protocol)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid protocol\",\n pattern: def.protocol.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n // Set the output value based on normalize flag\n payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);\n return;\n }\n catch (_) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodEmoji = /*@__PURE__*/ core.$constructor(\"$ZodEmoji\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.emoji());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodNanoID = /*@__PURE__*/ core.$constructor(\"$ZodNanoID\", (inst, def) => {\n if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))\n throw new Error(`Invalid nanoid length: ${def.length}`);\n def.pattern ?? (def.pattern = def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length));\n $ZodStringFormat.init(inst, def);\n});\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const $ZodCUID = /*@__PURE__*/ core.$constructor(\"$ZodCUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCUID2 = /*@__PURE__*/ core.$constructor(\"$ZodCUID2\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid2);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodULID = /*@__PURE__*/ core.$constructor(\"$ZodULID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ulid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodXID = /*@__PURE__*/ core.$constructor(\"$ZodXID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.xid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodKSUID = /*@__PURE__*/ core.$constructor(\"$ZodKSUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ksuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODateTime = /*@__PURE__*/ core.$constructor(\"$ZodISODateTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.datetime(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODate = /*@__PURE__*/ core.$constructor(\"$ZodISODate\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.date);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISOTime = /*@__PURE__*/ core.$constructor(\"$ZodISOTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.time(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODuration = /*@__PURE__*/ core.$constructor(\"$ZodISODuration\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.duration);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodIPv4 = /*@__PURE__*/ core.$constructor(\"$ZodIPv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv4);\n $ZodStringFormat.init(inst, def);\n});\n/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL(\"http://[...]\")` parses an authority, not an address, so `@` and `\\` re-delimit it and `\"::@1\\\\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `\"::1\\n\"` validated as `::1`. */\nconst ipv6Alphabet = /^[0-9a-fA-F:.]+$/;\nexport function isValidIPv6(value) {\n if (!ipv6Alphabet.test(value))\n return false;\n return canParseURL(`http://[${value}]`);\n}\nexport const $ZodIPv6 = /*@__PURE__*/ core.$constructor(\"$ZodIPv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv6);\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (!isValidIPv6(payload.value)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"ipv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodMAC = /*@__PURE__*/ core.$constructor(\"$ZodMAC\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.mac(def.delimiter));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv4);\n $ZodStringFormat.init(inst, def);\n});\nexport function isValidCIDRv6(value) {\n const parts = value.split(\"/\");\n if (parts.length !== 2)\n return false;\n const [address, prefix] = parts;\n if (!prefix)\n return false;\n const prefixNum = Number(prefix);\n if (`${prefixNum}` !== prefix)\n return false;\n if (prefixNum < 0 || prefixNum > 128)\n return false;\n return isValidIPv6(address);\n}\nexport const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (!isValidCIDRv6(payload.value)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"cidrv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\n////////////////////////////// ZodBase64 //////////////////////////////\nexport function isValidBase64(data) {\n if (data === \"\")\n return true;\n // atob ignores whitespace, so reject it up front.\n if (/\\s/.test(data))\n return false;\n if (data.length % 4 !== 0)\n return false;\n try {\n // @ts-ignore\n atob(data);\n return true;\n }\n catch {\n return false;\n }\n}\n// lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding\nexport const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;\nexport const $ZodBase64 = /*@__PURE__*/ core.$constructor(\"$ZodBase64\", (inst, def) => {\n def.pattern ?? (def.pattern = base64Charset);\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidBase64(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n////////////////////////////// ZodBase64URL //////////////////////////////\n// lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string\nexport const base64urlCharset = /^[A-Za-z0-9_-]*$/;\nexport function isValidBase64URL(data) {\n if (!base64urlCharset.test(data))\n return false;\n const base64 = data.replace(/[-_]/g, (c) => (c === \"-\" ? \"+\" : \"/\"));\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, \"=\");\n return isValidBase64(padded);\n}\nexport const $ZodBase64URL = /*@__PURE__*/ core.$constructor(\"$ZodBase64URL\", (inst, def) => {\n def.pattern ?? (def.pattern = base64urlCharset);\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidBase64URL(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodE164 = /*@__PURE__*/ core.$constructor(\"$ZodE164\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.e164);\n $ZodStringFormat.init(inst, def);\n});\n////////////////////////////// ZodCreditCard //////////////////////////////\nconst CC_SANITIZE = /[- ]/g;\n/** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */\nfunction isLuhnAlgo(digits) {\n let length = digits.length;\n let bit = 1;\n let sum = 0;\n while (length) {\n const value = digits.charCodeAt(--length) - 48;\n bit ^= 1;\n sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;\n }\n return sum % 10 === 0;\n}\nexport function isValidCreditCard(input) {\n if (!regexes.creditCard.test(input))\n return false;\n return isLuhnAlgo(input.replace(CC_SANITIZE, \"\"));\n}\nexport const $ZodCreditCard = /*@__PURE__*/ core.$constructor(\"$ZodCreditCard\", (inst, def) => {\n // Shape only — the Luhn check below is not expressible as a pattern, so consumers of `pattern` (JSON Schema, template literals) get the length and separator rules alone.\n def.pattern ?? (def.pattern = regexes.creditCard);\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidCreditCard(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"credit_card\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n////////////////////////////// ZodIBAN //////////////////////////////\n// iso 7064 mod 97-10 checksum without BigInt\nfunction isIso7064Mod97(iban) {\n let remainder = 0;\n const len = iban.length;\n for (let i = 4; i < len; i++) {\n const code = iban.charCodeAt(i);\n remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;\n }\n for (let i = 0; i < 4; i++) {\n const code = iban.charCodeAt(i);\n remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;\n }\n return remainder === 1;\n}\nexport function isValidIBAN(input) {\n if (!regexes.iban.test(input))\n return false;\n return isIso7064Mod97(input);\n}\nexport const $ZodIBAN = /*@__PURE__*/ core.$constructor(\"$ZodIBAN\", (inst, def) => {\n // shape only — checksum is not expressible as a pattern\n def.pattern ?? (def.pattern = regexes.iban);\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidIBAN(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"iban\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n////////////////////////////// ZodJWT //////////////////////////////\nexport function isValidJWT(token, algorithm = null) {\n try {\n const tokensParts = token.split(\".\");\n if (tokensParts.length !== 3)\n return false;\n const [header] = tokensParts;\n if (!header)\n return false;\n // @ts-ignore\n const parsedHeader = JSON.parse(atob(header));\n if (\"typ\" in parsedHeader && parsedHeader?.typ !== \"JWT\")\n return false;\n if (!parsedHeader.alg)\n return false;\n if (algorithm && (!(\"alg\" in parsedHeader) || parsedHeader.alg !== algorithm))\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nexport const $ZodJWT = /*@__PURE__*/ core.$constructor(\"$ZodJWT\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidJWT(payload.value, def.alg))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"jwt\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodCustomStringFormat\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (def.fn(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: def.format,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodNumber = /*@__PURE__*/ core.$constructor(\"$ZodNumber\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.number;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Number(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"number\" && !Number.isNaN(input) && Number.isFinite(input)) {\n return payload;\n }\n const received = typeof input === \"number\"\n ? Number.isNaN(input)\n ? \"NaN\"\n : !Number.isFinite(input)\n ? String(input)\n : undefined\n : undefined;\n payload.issues.push({\n expected: \"number\",\n code: \"invalid_type\",\n input,\n inst,\n ...(received ? { received } : {}),\n });\n return payload;\n };\n});\nexport const $ZodNumberFormat = /*@__PURE__*/ core.$constructor(\"$ZodNumberFormat\", (inst, def) => {\n checks.$ZodCheckNumberFormat.init(inst, def);\n $ZodNumber.init(inst, def); // no format checks\n});\nexport const $ZodBoolean = /*@__PURE__*/ core.$constructor(\"$ZodBoolean\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.boolean;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Boolean(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"boolean\")\n return payload;\n payload.issues.push({\n expected: \"boolean\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigInt = /*@__PURE__*/ core.$constructor(\"$ZodBigInt\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.bigint;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = BigInt(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"bigint\")\n return payload;\n payload.issues.push({\n expected: \"bigint\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor(\"$ZodBigIntFormat\", (inst, def) => {\n checks.$ZodCheckBigIntFormat.init(inst, def);\n $ZodBigInt.init(inst, def); // no format checks\n});\nexport const $ZodSymbol = /*@__PURE__*/ core.$constructor(\"$ZodSymbol\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"symbol\")\n return payload;\n payload.issues.push({\n expected: \"symbol\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodUndefined = /*@__PURE__*/ core.$constructor(\"$ZodUndefined\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.undefined;\n inst._zod.values = new Set([undefined]);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"undefined\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodNull = /*@__PURE__*/ core.$constructor(\"$ZodNull\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.null;\n inst._zod.values = new Set([null]);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (input === null)\n return payload;\n payload.issues.push({\n expected: \"null\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodAny = /*@__PURE__*/ core.$constructor(\"$ZodAny\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodUnknown = /*@__PURE__*/ core.$constructor(\"$ZodUnknown\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodNever = /*@__PURE__*/ core.$constructor(\"$ZodNever\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n payload.issues.push({\n expected: \"never\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodVoid = /*@__PURE__*/ core.$constructor(\"$ZodVoid\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"void\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodDate = /*@__PURE__*/ core.$constructor(\"$ZodDate\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce) {\n try {\n payload.value = new Date(payload.value);\n }\n catch (_err) { }\n }\n const input = payload.value;\n const isDate = input instanceof Date;\n const isValidDate = isDate && !Number.isNaN(input.getTime());\n if (isValidDate)\n return payload;\n payload.issues.push({\n expected: \"date\",\n code: \"invalid_type\",\n input,\n ...(isDate ? { received: \"Invalid Date\" } : {}),\n inst,\n });\n return payload;\n };\n});\n// an oversized container fails its leading size checks before any element is parsed\nfunction capSize(inst, size) {\n const caps = util.sizeCaps(inst._zod.def.checks);\n if (!caps.length)\n return;\n const cap = Math.min(...caps.map((c) => c[0]));\n const parse = inst._zod.parse;\n inst._zod.parse = (payload, ctx) => {\n const n = size(payload.value);\n if (n > cap && !ctx?.skipChecks && ctx?.direction !== \"backward\") {\n for (const [max, ch] of util.sizeCaps(inst._zod.def.checks)) {\n if (n > max && ch._zod.def.when(payload)) {\n const start = payload.issues.length;\n ch._zod.check(payload);\n // the value is still the raw input, so no later check may read it\n payload.issues[start].continue = false;\n util.attachSchema(payload.issues, start, inst);\n return payload;\n }\n }\n }\n return parse(payload, ctx);\n };\n}\nconst arraySize = (input) => (Array.isArray(input) ? input.length : -1);\nconst mapSize = (input) => (input instanceof Map ? input.size : -1);\nconst setSize = (input) => (input instanceof Set ? input.size : -1);\nfunction handleArrayResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nexport const $ZodArray = /*@__PURE__*/ core.$constructor(\"$ZodArray\", (inst, def) => {\n $ZodType.init(inst, def);\n const memo = core.globalConfig.memoizer;\n memo?.attach(inst);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n expected: \"array\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);\n const proms = [];\n const abortEarly = ctx?.abortEarly;\n for (let i = 0; i < input.length; i++) {\n const item = input[i];\n const result = def.element._zod.run({\n value: item,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleArrayResult(result, payload, i)));\n }\n else {\n handleArrayResult(result, payload, i);\n // the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional\n if (abortEarly && result.issues.length !== 0 && util.aborted(result))\n break;\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload; //handleArrayResultsAsync(parseResults, final);\n };\n capSize(inst, arraySize);\n});\nfunction handlePropertyResult(result, final, key, input, optin, optout) {\n const isPresent = key in input;\n const isOptionalOut = optout === \"optional\";\n // The middle rung means \"absence permitted, nothing supplied in its place\", so an absent key contributes nothing — whatever the schema made of `undefined` is invented, not substituted. Only `optional` reaches this with a value: `defaulted` substitutes, and a schema that isn't optional-out has to keep the key.\n if (!isPresent && isOptionalOut && optin === \"optional\") {\n return;\n }\n if (result.issues.length) {\n // For optional-in/out schemas, ignore errors on absent keys.\n if (optin !== undefined && isOptionalOut && !isPresent) {\n return;\n }\n final.issues.push(...util.prefixIssues(key, result.issues));\n }\n if (!isPresent && optin === undefined) {\n if (!result.issues.length) {\n final.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [key],\n });\n }\n return;\n }\n if (result.value === undefined) {\n if (isPresent || (optin === \"defaulted\" && !isOptionalOut)) {\n final.value[key] = undefined;\n }\n }\n else {\n final.value[key] = result.value;\n }\n}\n// one shared instance; a fresh [] per schema cost 56 bytes retained\nconst NO_SYMBOL_KEYS = [];\nfunction normalizeDef(def) {\n const keys = Object.keys(def.shape);\n const ownSymbols = Object.getOwnPropertySymbols(def.shape);\n const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;\n // aliases `keys` when there are no symbols, so a string-only shape keeps one array\n const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;\n for (const k of allKeys) {\n if (!def.shape?.[k]?._zod?.traits?.has(\"$ZodType\")) {\n throw new Error(`Invalid element at key \"${String(k)}\": expected a Zod schema`);\n }\n }\n const okeys = util.optionalKeys(def.shape);\n return {\n ...def,\n allKeys,\n symbolKeys,\n // string-only: handleCatchall matches it against `for...in`, which never yields a symbol\n keySet: new Set(keys),\n numKeys: keys.length,\n optionalKeys: new Set(okeys),\n };\n}\nfunction handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {\n const unrecognized = [];\n const keySet = def.keySet;\n const _catchall = def.catchall._zod;\n const t = _catchall.def.type;\n const optin = _catchall.optin;\n const optout = _catchall.optout;\n // starts at 0, not the current length: the shape phase already ran and may have aborted\n let seen = 0;\n for (const key in input) {\n if (abortEarly && payload.issues.length !== seen) {\n if (util.aborted(payload, seen))\n break;\n seen = payload.issues.length;\n }\n // Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.\n if (keySet.has(key))\n continue;\n // Don't copy an undeclared __proto__ into the result; assignment to a plain {} would replace the result prototype. But in strict mode it is still an unknown key, so report it before skipping.\n if (key === \"__proto__\") {\n if (t === \"never\")\n unrecognized.push(key);\n continue;\n }\n if (t === \"never\") {\n unrecognized.push(key);\n continue;\n }\n const r = _catchall.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));\n }\n else {\n handlePropertyResult(r, payload, key, input, optin, optout);\n }\n }\n if (unrecognized.length) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n keys: unrecognized,\n input,\n inst,\n // Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.\n continue: true,\n });\n }\n if (!proms.length)\n return payload;\n return Promise.all(proms).then(() => {\n return payload;\n });\n}\nexport const $ZodObject = /*@__PURE__*/ core.$constructor(\"$ZodObject\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodType.init(inst, def);\n const desc = Object.getOwnPropertyDescriptor(def, \"shape\");\n // a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it\n const sh = desc?.get ? desc.get.raw : (def.shape ?? {});\n if (sh) {\n // Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.\n const get = () => {\n const newSh = { ...sh };\n Object.defineProperty(def, \"shape\", { value: newSh });\n get.raw = newSh;\n return newSh;\n };\n get.raw = sh;\n Object.defineProperty(def, \"shape\", { get });\n }\n const _normalized = util.cached(() => normalizeDef(def));\n util.defineLazyInternal(inst, \"propValues\", (zod) => {\n const shape = zod.def.shape;\n const propValues = {};\n for (const key in shape) {\n const field = shape[key]._zod;\n if (field.values) {\n if (!Object.prototype.hasOwnProperty.call(propValues, key)) {\n util.assignProp(propValues, key, new Set());\n }\n for (const v of field.values)\n propValues[key].add(v);\n // An omittable slot reads back as undefined at a discriminator lookup, so it has to claim undefined: two options that can both omit the key are not discriminable on it.\n if (field.optin !== undefined)\n propValues[key].add(undefined);\n }\n }\n return propValues;\n });\n const isObject = util.isObject;\n const catchall = def.catchall;\n let value;\n const memo = core.globalConfig.memoizer;\n memo?.attach(inst);\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};\n const proms = [];\n const shape = value.shape;\n const abortEarly = ctx?.abortEarly;\n let seen = payload.issues.length;\n for (const key of value.allKeys) {\n if (abortEarly && payload.issues.length !== seen) {\n if (util.aborted(payload, seen))\n break;\n seen = payload.issues.length;\n }\n if (key === \"__proto__\")\n continue;\n const el = shape[key];\n const optin = el._zod.optin;\n const optout = el._zod.optout;\n const r = el._zod.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));\n }\n else {\n handlePropertyResult(r, payload, key, input, optin, optout);\n }\n }\n if (!catchall) {\n return proms.length ? Promise.all(proms).then(() => payload) : payload;\n }\n return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);\n };\n});\nexport const $ZodObjectJIT = /*@__PURE__*/ core.$constructor(\"$ZodObjectJIT\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodObject.init(inst, def);\n const superParse = inst._zod.parse;\n const _normalized = util.cached(() => normalizeDef(def));\n const memo = core.globalConfig.memoizer;\n const generateFastpass = (shape) => {\n const normalized = _normalized.value;\n const syms = normalized.symbolKeys;\n // a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope\n const doc = new Doc([\"payload\", \"ctx\"], { shape, inst, memo, syms });\n const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;\n // prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input\n const prefixStr = (id, k) => `\n let ${id}_ab = false;\n for (let i = 0; i < ${id}.issues.length; i++) {\n const iss = ${id}.issues[i];\n iss.path = iss.path ? [${k}, ...iss.path] : [${k}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${id}_ab = true;\n }\n if (${id}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;\n doc.write(`const input = payload.value;`);\n const ids = Object.create(null);\n let counter = 0;\n for (const key of normalized.allKeys) {\n ids[key] = `key_${counter++}`;\n }\n // A: preserve key order {\n doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);\n for (const key of normalized.allKeys) {\n if (key === \"__proto__\")\n continue;\n const id = ids[key];\n const k = typeof key === \"symbol\" ? `syms[${syms.indexOf(key)}]` : util.esc(key);\n const isPresent = `${k} in input`;\n const schema = shape[key];\n const optin = schema?._zod?.optin;\n const isOptionalIn = optin !== undefined;\n const isOptionalOut = schema?._zod?.optout === \"optional\";\n doc.write(`const ${id} = ${parseStr(k)};`);\n if (isOptionalIn && isOptionalOut) {\n // For optional-in/out schemas, ignore errors on absent keys — and, like the interpreted path, drop the value produced alongside them. The middle rung goes further: it permits absence without supplying anything in its place, so an absent key contributes nothing at all.\n const assign = optin === \"optional\" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;\n doc.write(`\n const ${id}_present = ${isPresent};\n if (!${id}.issues.length || ${id}_present) {\n if (${id}.issues.length) {${prefixStr(id, k)}\n }\n\n if (${assign}) {\n newResult[${k}] = ${id}.value;\n }\n }\n\n `);\n }\n else if (!isOptionalIn) {\n doc.write(`\n const ${id}_present = ${isPresent};\n if (${id}.issues.length) {${prefixStr(id, k)}\n }\n if (!${id}_present && !${id}.issues.length) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [${k}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${id}_present) {\n newResult[${k}] = ${id}.value;\n }\n\n `);\n }\n else {\n doc.write(`\n if (${id}.issues.length) {${prefixStr(id, k)}\n }\n `);\n if (optin === \"defaulted\") {\n doc.write(`newResult[${k}] = ${id}.value;`);\n }\n else {\n doc.write(`\n if (${id}.value !== undefined || ${isPresent}) {\n newResult[${k}] = ${id}.value;\n }\n `);\n }\n }\n }\n doc.write(`payload.value = newResult;`);\n doc.write(`return payload;`);\n // closing `shape` in is what pays: turbofan specializes the parser against that one shape object, so every `shape[k]._zod.run` folds to a known callee. as a parameter it stays a generic load and measures 13% slower even with the forwarding frame gone\n return doc.compile();\n };\n let fastpass;\n const isObject = util.isObject;\n const jit = !core.globalConfig.jitless;\n const allowsEval = util.allowsEval;\n const fastEnabled = jit && allowsEval.value; // && !def.catchall;\n const catchall = def.catchall;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {\n // always synchronous\n if (!fastpass)\n fastpass = generateFastpass(def.shape);\n payload = fastpass(payload, ctx);\n if (!catchall)\n return payload;\n return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);\n }\n return superParse(payload, ctx);\n };\n});\nfunction handleUnionResults(results, final, inst, ctx) {\n for (const result of results) {\n if (result.issues.length === 0) {\n final.value = result.value;\n return final;\n }\n }\n const nonaborted = results.filter((r) => !util.aborted(r));\n if (nonaborted.length === 1) {\n final.value = nonaborted[0].value;\n return nonaborted[0];\n }\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n return final;\n}\nexport const $ZodUnion = /*@__PURE__*/ core.$constructor(\"$ZodUnion\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.def.options.some((o) => o._zod.optin === \"defaulted\")\n ? \"defaulted\"\n : zod.def.options.some((o) => o._zod.optin !== undefined)\n ? \"optional\"\n : undefined);\n util.defineLazyInternal(inst, \"optout\", (zod) => zod.def.options.some((o) => o._zod.optout === \"optional\") ? \"optional\" : undefined);\n util.defineLazyInternal(inst, \"values\", (zod) => {\n if (zod.def.options.every((o) => o._zod.values)) {\n return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));\n }\n return undefined;\n });\n util.defineLazyInternal(inst, \"pattern\", (zod) => {\n if (zod.def.options.every((o) => o._zod.pattern)) {\n const patterns = zod.def.options.map((o) => o._zod.pattern);\n return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join(\"|\")})$`);\n }\n return undefined;\n });\n const first = def.options.length === 1 ? def.options[0]._zod.run : null;\n inst._zod.parse = (payload, ctx) => {\n if (first) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n if (result.issues.length === 0)\n return result;\n results.push(result);\n }\n }\n if (!async)\n return handleUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleUnionResults(results, payload, inst, ctx);\n });\n };\n});\nfunction handleExclusiveUnionResults(results, final, inst, ctx) {\n const matches = [];\n for (let i = 0; i < results.length; i++) {\n if (results[i].issues.length === 0)\n matches.push(i);\n }\n if (matches.length === 1) {\n final.value = results[matches[0]].value;\n return final;\n }\n if (matches.length === 0) {\n // No matches - same as regular union\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n }\n else {\n // Multiple matches - exclusive union failure\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: [],\n inclusive: false,\n matches,\n });\n }\n return final;\n}\nexport const $ZodXor = /*@__PURE__*/ core.$constructor(\"$ZodXor\", (inst, def) => {\n $ZodUnion.init(inst, def);\n def.inclusive = false;\n const first = def.options.length === 1 ? def.options[0]._zod.run : null;\n inst._zod.parse = (payload, ctx) => {\n if (first) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n results.push(result);\n }\n }\n if (!async)\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n });\n };\n});\n/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */\nexport function getDiscriminatedOption(union, value) {\n const internals = union._zod;\n let map = internals.bag.optionsMap;\n if (!map) {\n map = discriminatorMap(internals.def);\n internals.bag.optionsMap = map;\n }\n const option = map.get(value);\n if (option === null)\n throw new Error(`Ambiguous discriminator value \"${String(value)}\"`);\n return option;\n}\nfunction discriminatorMap(def) {\n const map = new Map();\n for (const option of def.options) {\n const values = option._zod.propValues?.[def.discriminator];\n if (!values || values.size === 0)\n throw new Error(`Invalid discriminated union option at index \"${def.options.indexOf(option)}\"`);\n for (const value of values) {\n if (map.has(value)) {\n if (value !== undefined)\n throw new Error(`Duplicate discriminator value \"${String(value)}\"`);\n // keep the collision marked so a later member cannot reclaim it\n map.set(value, null);\n }\n else {\n map.set(value, option);\n }\n }\n }\n return map;\n}\nexport const $ZodDiscriminatedUnion = \n/*@__PURE__*/\ncore.$constructor(\"$ZodDiscriminatedUnion\", (inst, def) => {\n def.inclusive = false;\n $ZodUnion.init(inst, def);\n const _super = inst._zod.parse;\n util.defineLazyInternal(inst, \"propValues\", (zod) => {\n const propValues = {};\n let undefinedCount = 0;\n for (const option of zod.def.options) {\n const pv = option._zod.propValues;\n if (!pv || Object.keys(pv).length === 0)\n throw new Error(`Invalid discriminated union option at index \"${zod.def.options.indexOf(option)}\"`);\n if (pv[zod.def.discriminator]?.has(undefined))\n undefinedCount++;\n for (const [k, v] of Object.entries(pv)) {\n if (!Object.prototype.hasOwnProperty.call(propValues, k)) {\n util.assignProp(propValues, k, new Set());\n }\n for (const val of v) {\n propValues[k].add(val);\n }\n }\n }\n if (!zod.def.unionFallback && undefinedCount > 1)\n propValues[zod.def.discriminator]?.delete(undefined);\n return propValues;\n });\n // Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.\n def.options.forEach((option, i) => {\n const propShape = util.rawShape(option._zod.def);\n if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {\n throw new Error(`Invalid discriminated union option at index \"${i}\"`);\n }\n });\n const disc = util.cached(() => discriminatorMap(def));\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isObject(input)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"object\",\n input,\n inst,\n });\n return payload;\n }\n const value = input?.[def.discriminator];\n const opt = disc.value.get(value);\n // forward metadata cannot choose an encoder for an absent tag\n if (opt && (value !== undefined || ctx.direction !== \"backward\")) {\n return opt._zod.run(payload, ctx);\n }\n // Fall back to union matching when the fast discriminator path fails:\n // - explicitly enabled via unionFallback, or\n // - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions\n if (def.unionFallback || ctx.direction === \"backward\") {\n return _super(payload, ctx);\n }\n // no matching discriminator\n payload.issues.push({\n code: \"invalid_union\",\n errors: [],\n note: \"No matching discriminator\",\n discriminator: def.discriminator,\n options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),\n input,\n path: [def.discriminator],\n inst,\n });\n return payload;\n };\n});\nexport const $ZodIntersection = /*@__PURE__*/ core.$constructor(\"$ZodIntersection\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n const left = def.left._zod.run({ value: input, issues: [] }, ctx);\n const right = def.right._zod.run({ value: input, issues: [] }, ctx);\n const async = left instanceof Promise || right instanceof Promise;\n if (async) {\n return Promise.all([left, right]).then(([left, right]) => {\n return handleIntersectionResults(payload, left, right);\n });\n }\n return handleIntersectionResults(payload, left, right);\n };\n});\nexport function mergeValues(a, b) {\n // const aType = parse.t(a);\n // const bType = parse.t(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n if (a instanceof Date && b instanceof Date && +a === +b) {\n return { valid: true, data: a };\n }\n if (util.isPlainObject(a) && util.isPlainObject(b)) {\n const bKeys = Object.keys(b);\n const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n if (Object.prototype.hasOwnProperty.call(newObj, \"__proto__\"))\n delete newObj.__proto__;\n for (const key of sharedKeys) {\n if (key === \"__proto__\")\n continue;\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [key, ...sharedValue.mergeErrorPath],\n };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return { valid: false, mergeErrorPath: [] };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [index, ...sharedValue.mergeErrorPath],\n };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n return { valid: false, mergeErrorPath: [] };\n}\nfunction handleIntersectionResults(result, left, right) {\n // Track which side(s) reject each key. A key rejection is reported only when BOTH sides reject it, so a key owned by one branch survives the other's key schema. strictObject reports these as unrecognized_keys; a record with an open key schema reports one invalid_key per key.\n const unrecKeys = new Map();\n let unrecIssue;\n const keyIssues = new Map();\n const collect = (iss, side) => {\n let keys;\n if (iss.code === \"unrecognized_keys\" && !iss.path?.length) {\n unrecIssue ?? (unrecIssue = iss);\n keys = iss.keys;\n }\n else if (iss.code === \"invalid_key\" && iss.origin === \"record\" && iss.path?.length === 1) {\n const k = String(iss.path[0]);\n if (!keyIssues.has(k))\n keyIssues.set(k, iss);\n keys = [k];\n }\n else {\n return false;\n }\n for (const k of keys) {\n if (!unrecKeys.has(k))\n unrecKeys.set(k, {});\n unrecKeys.get(k)[side] = true;\n }\n return true;\n };\n for (const iss of left.issues) {\n if (!collect(iss, \"l\"))\n result.issues.push(iss);\n }\n for (const iss of right.issues) {\n if (!collect(iss, \"r\"))\n result.issues.push(iss);\n }\n // Report only keys rejected by BOTH sides\n const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);\n if (bothKeys.length) {\n const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];\n if (aggregated.length)\n result.issues.push({ ...unrecIssue, keys: aggregated });\n for (const k of bothKeys) {\n if (!aggregated.includes(k) && keyIssues.has(k))\n result.issues.push(keyIssues.get(k));\n }\n }\n const merged = mergeValues(left.value, right.value);\n if (!merged.valid) {\n if (util.aborted(result))\n return result;\n throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);\n }\n result.value = merged.data;\n return result;\n}\nexport const $ZodTuple = /*@__PURE__*/ core.$constructor(\"$ZodTuple\", (inst, def) => {\n $ZodType.init(inst, def);\n const items = def.items;\n const memo = core.globalConfig.memoizer;\n memo?.attach(inst);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n input,\n inst,\n expected: \"tuple\",\n code: \"invalid_type\",\n });\n return payload;\n }\n payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];\n const proms = [];\n const optinStart = getTupleOptStart(items, \"optin\");\n const optoutStart = getTupleOptStart(items, \"optout\");\n if (!def.rest) {\n if (input.length < optinStart) {\n payload.issues.push({\n code: \"too_small\",\n minimum: optinStart,\n inclusive: true,\n input,\n inst,\n origin: \"array\",\n });\n return payload;\n }\n if (input.length > items.length) {\n payload.issues.push({\n code: \"too_big\",\n maximum: items.length,\n inclusive: true,\n input,\n inst,\n origin: \"array\",\n });\n }\n }\n // Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.\n const itemResults = new Array(items.length);\n // only tracked when there is a rest loop to skip\n const abortEarly = def.rest ? ctx?.abortEarly : undefined;\n let itemAborted = false;\n for (let i = 0; i < items.length; i++) {\n const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((rr) => {\n itemResults[i] = rr;\n }));\n }\n else {\n itemResults[i] = r;\n if (abortEarly && !itemAborted && r.issues.length)\n itemAborted = util.aborted(r);\n }\n }\n // sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues\n if (def.rest && !itemAborted) {\n let i = items.length - 1;\n const rest = input.slice(items.length);\n let seen = payload.issues.length;\n for (const el of rest) {\n if (abortEarly && payload.issues.length !== seen) {\n if (util.aborted(payload, seen))\n break;\n seen = payload.issues.length;\n }\n i++;\n const result = def.rest._zod.run({ value: el, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((r) => handleTupleResult(r, payload, i)));\n }\n else {\n handleTupleResult(result, payload, i);\n }\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));\n }\n return handleTupleResults(itemResults, payload, items, input, optoutStart);\n };\n});\nfunction getTupleOptStart(items, key) {\n for (let i = items.length - 1; i >= 0; i--) {\n // optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.\n const omittable = key === \"optin\" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === \"optional\";\n if (!omittable)\n return i + 1;\n }\n return 0;\n}\nfunction handleTupleResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nfunction handleTupleResults(itemResults, final, items, input, optoutStart) {\n // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional rule, but only after `optoutStart`: the first index where the output tuple tail can be absent.\n for (let i = 0; i < items.length; i++) {\n const r = itemResults[i];\n const isPresent = i < input.length;\n // The array analog of `handlePropertyResult`'s absent-key early return: the middle rung permits absence without supplying anything in its place, so the tail truncates here instead of materializing whatever the item made of `undefined`.\n if (!isPresent && i >= optoutStart && items[i]._zod.optin === \"optional\") {\n final.value.length = i;\n break;\n }\n if (r.issues.length) {\n if (!isPresent && i >= optoutStart) {\n final.value.length = i;\n break;\n }\n final.issues.push(...util.prefixIssues(i, r.issues));\n }\n final.value[i] = r.value;\n }\n // Drop trailing slots that produced `undefined` for absent input\n // (the array analog of an absent optional key on an object). The\n // `i >= input.length` floor is critical: an explicit `undefined`\n // *inside* the input must be preserved even when the schema is\n // optional-out (e.g. `z.string().or(z.undefined())` accepting an\n // explicit undefined value).\n for (let i = final.value.length - 1; i >= input.length; i--) {\n if (items[i]._zod.optout === \"optional\" && final.value[i] === undefined) {\n final.value.length = i;\n }\n else {\n break;\n }\n }\n return final;\n}\nexport const $ZodRecord = /*@__PURE__*/ core.$constructor(\"$ZodRecord\", (inst, def) => {\n $ZodType.init(inst, def);\n const memo = core.globalConfig.memoizer;\n memo?.attach(inst);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isPlainObject(input)) {\n payload.issues.push({\n expected: \"record\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n // no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing\n const proms = [];\n const values = def.keyType._zod.values;\n if (values && !def.partial) {\n payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};\n const recordKeys = new Set();\n for (const key of values) {\n if (typeof key === \"string\" || typeof key === \"number\" || typeof key === \"symbol\") {\n recordKeys.add(typeof key === \"number\" ? key.toString() : key);\n // A declared __proto__ is stripped but is not an unrecognized key.\n if (key === \"__proto__\")\n continue;\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n if (keyResult.issues.length) {\n payload.issues.push({\n code: \"invalid_key\",\n origin: \"record\",\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n input: key,\n path: [key],\n inst,\n });\n continue;\n }\n const outKey = keyResult.value;\n if (outKey === \"__proto__\")\n continue;\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }\n }\n }\n let unrecognized;\n for (const key in input) {\n if (!recordKeys.has(key)) {\n if (def.mode === \"loose\") {\n // skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into\n if (key === \"__proto__\")\n continue;\n payload.value[key] = input[key];\n }\n else {\n unrecognized = unrecognized ?? [];\n unrecognized.push(key);\n }\n }\n }\n if (unrecognized && unrecognized.length > 0) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n input,\n inst,\n keys: unrecognized,\n continue: true,\n });\n }\n }\n else {\n payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};\n // An enumerable key schema declares which keys the record owns, so a key outside the set is unrecognized. A non-enumerable one (regex, refine) is a constraint every key must satisfy, so a failing key is invalid. Only the former is reconcilable against the other side of an intersection.\n let unrecognized;\n // Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()\n for (const key of Reflect.ownKeys(input)) {\n if (key === \"__proto__\")\n continue;\n if (!Object.prototype.propertyIsEnumerable.call(input, key))\n continue;\n let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n // Numeric string fallback: if key is a numeric string and failed, retry with Number(key). This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals\n const checkNumericKey = typeof key === \"string\" && regexes.number.test(key) && keyResult.issues.length;\n if (checkNumericKey) {\n const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);\n if (retryResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n if (retryResult.issues.length === 0) {\n keyResult = retryResult;\n }\n }\n if (keyResult.issues.length) {\n if (def.mode === \"loose\") {\n // Pass through unchanged\n payload.value[key] = input[key];\n }\n else if (values) {\n unrecognized = unrecognized ?? [];\n unrecognized.push(key);\n }\n else {\n // Default \"strict\" behavior: error on invalid key\n payload.issues.push({\n code: \"invalid_key\",\n origin: \"record\",\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n input: key,\n path: [key],\n inst,\n });\n }\n continue;\n }\n // the guard above tests the raw input key, but the key schema can normalize an ordinary key into __proto__; re-check the key we actually write under\n const outKey = keyResult.value;\n if (outKey === \"__proto__\")\n continue;\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }\n }\n if (unrecognized && unrecognized.length > 0) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n input,\n inst,\n keys: unrecognized,\n continue: true,\n });\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload;\n };\n});\nexport const $ZodMap = /*@__PURE__*/ core.$constructor(\"$ZodMap\", (inst, def) => {\n $ZodType.init(inst, def);\n const memo = core.globalConfig.memoizer;\n memo?.attach(inst);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Map)) {\n payload.issues.push({\n expected: \"map\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n const proms = [];\n payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();\n const abortEarly = ctx?.abortEarly;\n let seen = payload.issues.length;\n for (const [key, value] of input) {\n if (abortEarly && payload.issues.length !== seen) {\n if (util.aborted(payload, seen))\n break;\n seen = payload.issues.length;\n }\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);\n if (keyResult instanceof Promise || valueResult instanceof Promise) {\n proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }));\n }\n else {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n capSize(inst, mapSize);\n});\nfunction handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {\n if (keyResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, keyResult.issues));\n }\n else {\n final.issues.push({\n code: \"invalid_key\",\n origin: \"map\",\n input,\n inst,\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n if (valueResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, valueResult.issues));\n }\n else {\n final.issues.push({\n origin: \"map\",\n code: \"invalid_element\",\n input,\n inst,\n key: key,\n issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n final.value.set(keyResult.value, valueResult.value);\n}\nexport const $ZodSet = /*@__PURE__*/ core.$constructor(\"$ZodSet\", (inst, def) => {\n $ZodType.init(inst, def);\n const memo = core.globalConfig.memoizer;\n memo?.attach(inst);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Set)) {\n payload.issues.push({\n input,\n inst,\n expected: \"set\",\n code: \"invalid_type\",\n });\n return payload;\n }\n const proms = [];\n payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();\n const abortEarly = ctx?.abortEarly;\n let seen = payload.issues.length;\n for (const item of input) {\n if (abortEarly && payload.issues.length !== seen) {\n if (util.aborted(payload, seen))\n break;\n seen = payload.issues.length;\n }\n const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleSetResult(result, payload)));\n }\n else\n handleSetResult(result, payload);\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n capSize(inst, setSize);\n});\nfunction handleSetResult(result, final) {\n if (result.issues.length) {\n final.issues.push(...result.issues);\n }\n final.value.add(result.value);\n}\nexport const $ZodEnum = /*@__PURE__*/ core.$constructor(\"$ZodEnum\", (inst, def) => {\n $ZodType.init(inst, def);\n const values = util.getEnumValues(def.entries);\n const valuesSet = new Set(values);\n inst._zod.values = valuesSet;\n util.defineLazyInternal(inst, \"pattern\", (zod) => {\n const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));\n // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches \"\"\n return new RegExp(patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join(\"|\")})$` : \"^[^\\\\s\\\\S]$\");\n });\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (valuesSet.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodLiteral = /*@__PURE__*/ core.$constructor(\"$ZodLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n const values = new Set(def.values);\n inst._zod.values = values;\n util.defineLazyInternal(inst, \"pattern\", (zod) => {\n const vals = zod.def.values;\n // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches \"\"\n return new RegExp(vals.length\n ? `^(${vals\n .map((o) => typeof o === \"string\" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))\n .join(\"|\")})$`\n : \"^[^\\\\s\\\\S]$\");\n });\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (values.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values: def.values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodFile = /*@__PURE__*/ core.$constructor(\"$ZodFile\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n // @ts-ignore\n if (input instanceof File)\n return payload;\n payload.issues.push({\n expected: \"file\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodTransform = /*@__PURE__*/ core.$constructor(\"$ZodTransform\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n core.globalConfig.memoizer?.guard(inst);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(inst.constructor.name);\n }\n const _out = def.transform(payload.value, payload);\n if (ctx.async) {\n const output = _out instanceof Promise ? _out : Promise.resolve(_out);\n return output.then((output) => {\n payload.value = output;\n return payload;\n });\n }\n if (_out instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n payload.value = _out;\n return payload;\n };\n});\nfunction handleOptionalResult(payload, result) {\n // A substituting schema that still failed has no usable answer; yield undefined. Its issues are simply dropped: it ran on a payload of its own, so there is no shared array to truncate and nothing of the caller's to lose with it.\n payload.value = result.issues.length ? undefined : result.value;\n return payload;\n}\nexport const $ZodOptional = /*@__PURE__*/ core.$constructor(\"$ZodOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n // .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.def.innerType._zod.optin === \"defaulted\" ? \"defaulted\" : \"optional\");\n inst._zod.optout = \"optional\";\n util.defineLazyInternal(inst, \"values\", (zod) => {\n const values = zod.def.innerType._zod.values;\n return values ? new Set([...values, undefined]) : undefined;\n });\n util.defineLazyInternal(inst, \"pattern\", (zod) => {\n const pattern = zod.def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n if (payload.value === undefined) {\n // Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.\n if (def.innerType._zod.optin !== \"defaulted\")\n return payload;\n // Its own payload, for the same reason $ZodCatch gets one: a pipe forwards an unrecognized key through the caller's issues array, and this must not read that as the substituting schema failing and drop it.\n const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);\n if (result instanceof Promise)\n return result.then((result) => handleOptionalResult(payload, result));\n return handleOptionalResult(payload, result);\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodExactOptional = /*@__PURE__*/ core.$constructor(\"$ZodExactOptional\", (inst, def) => {\n // Call parent init - inherits optin/optout = \"optional\"\n $ZodOptional.init(inst, def);\n // Override values/pattern to NOT add undefined\n util.defineLazyInternal(inst, \"values\", (zod) => zod.def.innerType._zod.values);\n util.defineLazyInternal(inst, \"pattern\", (zod) => zod.def.innerType._zod.pattern);\n // Override parse to just delegate (no undefined handling)\n inst._zod.parse = (payload, ctx) => {\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNullable = /*@__PURE__*/ core.$constructor(\"$ZodNullable\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.def.innerType._zod.optin);\n util.defineLazyInternal(inst, \"optout\", (zod) => zod.def.innerType._zod.optout);\n util.defineLazyInternal(inst, \"pattern\", (zod) => {\n const pattern = zod.def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;\n });\n util.defineLazyInternal(inst, \"values\", (zod) => {\n return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n // Forward direction (decode): allow null to pass through\n if (payload.value === null)\n return payload;\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodDefault = /*@__PURE__*/ core.$constructor(\"$ZodDefault\", (inst, def) => {\n $ZodType.init(inst, def);\n // inst._zod.qin = \"true\";\n inst._zod.optin = \"defaulted\";\n util.defineLazyInternal(inst, \"values\", (zod) => zod.def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply defaults for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n /**\n * $ZodDefault returns the default value immediately in forward direction.\n * It doesn't pass the default value into the validator (\"prefault\"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a \"prefault\" for the pipe. */\n return payload;\n }\n // Forward direction: continue with default handling\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleDefaultResult(result, def));\n }\n return handleDefaultResult(result, def);\n };\n});\nfunction handleDefaultResult(payload, def) {\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return payload;\n}\nexport const $ZodPrefault = /*@__PURE__*/ core.$constructor(\"$ZodPrefault\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"defaulted\";\n util.defineLazyInternal(inst, \"values\", (zod) => zod.def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply prefault for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNonOptional = /*@__PURE__*/ core.$constructor(\"$ZodNonOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazyInternal(inst, \"values\", (zod) => {\n const v = zod.def.innerType._zod.values;\n return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleNonOptionalResult(result, inst));\n }\n return handleNonOptionalResult(result, inst);\n };\n});\nfunction handleNonOptionalResult(payload, inst) {\n if (!payload.issues.length && payload.value === undefined) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: payload.value,\n inst,\n });\n }\n return payload;\n}\nexport const $ZodSuccess = /*@__PURE__*/ core.$constructor(\"$ZodSuccess\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(\"ZodSuccess\");\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => {\n payload.value = result.issues.length === 0;\n return payload;\n });\n }\n payload.value = result.issues.length === 0;\n return payload;\n };\n});\nfunction handleCatchResult(payload, result, def, ctx) {\n if (!result.issues.length) {\n payload.value = result.value;\n // The value carries up, so the flag describing it has to carry with it: a back-edge into a node still being parsed must not be frozen by an enclosing readonly, and its checks belong to the node itself. Guarded so the ordinary case adds no own property.\n if (result.memo)\n payload.memo = true;\n return payload;\n }\n // Spread the inner's own payload, not ours: `value` has to stay the input the catch was handed, and the inner ran on a payload of its own so its issues are already private to this call.\n payload.value = def.catchValue({\n ...result,\n value: payload.value,\n error: {\n issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n },\n input: payload.value,\n });\n return payload;\n}\nexport const $ZodCatch = /*@__PURE__*/ core.$constructor(\"$ZodCatch\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.def.innerType._zod.optin === \"defaulted\" ? \"defaulted\" : \"optional\");\n util.defineLazyInternal(inst, \"optout\", (zod) => zod.def.innerType._zod.optout);\n util.defineLazyInternal(inst, \"values\", (zod) => zod.def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply catch logic\n const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleCatchResult(payload, result, def, ctx));\n }\n return handleCatchResult(payload, result, def, ctx);\n };\n});\nexport const $ZodNaN = /*@__PURE__*/ core.$constructor(\"$ZodNaN\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"number\" || !Number.isNaN(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"nan\",\n code: \"invalid_type\",\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodPipe = /*@__PURE__*/ core.$constructor(\"$ZodPipe\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazyInternal(inst, \"values\", (zod) => zod.def.in._zod.values);\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.def.in._zod.optin);\n util.defineLazyInternal(inst, \"optout\", (zod) => zod.def.out._zod.optout);\n util.defineLazyInternal(inst, \"propValues\", (zod) => zod.def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handlePipeResult(right, def.in, ctx));\n }\n return handlePipeResult(right, def.in, ctx);\n }\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handlePipeResult(left, def.out, ctx));\n }\n return handlePipeResult(left, def.out, ctx);\n };\n});\nfunction handlePipeResult(left, next, ctx) {\n // Any issue stops the pipe, so a failing refinement never feeds its transform. An unrecognized key is the exception: it describes the input's extra properties, not the value being piped, and an enclosing intersection may yet reconcile it.\n if (left.issues.some((iss) => iss.code !== \"unrecognized_keys\")) {\n // prevent further checks\n left.aborted = true;\n return left;\n }\n return next._zod.run({ value: left.value, issues: left.issues }, ctx);\n}\nexport const $ZodCodec = /*@__PURE__*/ core.$constructor(\"$ZodCodec\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazyInternal(inst, \"values\", (zod) => zod.def.in._zod.values);\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.def.in._zod.optin);\n util.defineLazyInternal(inst, \"optout\", (zod) => zod.def.out._zod.optout);\n util.defineLazyInternal(inst, \"propValues\", (zod) => zod.def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handleCodecAResult(left, def, ctx));\n }\n return handleCodecAResult(left, def, ctx);\n }\n else {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handleCodecAResult(right, def, ctx));\n }\n return handleCodecAResult(right, def, ctx);\n }\n };\n});\nfunction handleCodecAResult(result, def, ctx) {\n if (result.issues.length) {\n // prevent further checks\n result.aborted = true;\n return result;\n }\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const transformed = def.transform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));\n }\n return handleCodecTxResult(result, transformed, def.out, ctx);\n }\n else {\n const transformed = def.reverseTransform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));\n }\n return handleCodecTxResult(result, transformed, def.in, ctx);\n }\n}\nfunction handleCodecTxResult(left, value, nextSchema, ctx) {\n // Check if transform added any issues\n if (left.issues.length) {\n left.aborted = true;\n return left;\n }\n return nextSchema._zod.run({ value, issues: left.issues }, ctx);\n}\nexport const $ZodPreprocess = /*@__PURE__*/ core.$constructor(\"$ZodPreprocess\", (inst, def) => {\n $ZodPipe.init(inst, def);\n});\nexport const $ZodReadonly = /*@__PURE__*/ core.$constructor(\"$ZodReadonly\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazyInternal(inst, \"propValues\", (zod) => zod.def.innerType._zod.propValues);\n util.defineLazyInternal(inst, \"values\", (zod) => zod.def.innerType._zod.values);\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.def.innerType?._zod?.optin);\n util.defineLazyInternal(inst, \"optout\", (zod) => zod.def.innerType?._zod?.optout);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then(handleReadonlyResult);\n }\n return handleReadonlyResult(result);\n };\n});\nfunction handleReadonlyResult(payload) {\n // A repeat visit hands back a node that is still being built; freezing it here would make the rest of its keys fail to assign.\n if (!payload.memo)\n payload.value = Object.freeze(payload.value);\n return payload;\n}\n// a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it\nfunction leafPattern(schema) {\n const def = schema._zod.def;\n let pattern = def.pattern;\n let isInt = !!def.format?.includes(\"int\");\n let minimum;\n let maximum;\n for (const ch of def.checks ?? []) {\n const d = ch._zod.def;\n if (d.pattern)\n pattern = d.pattern;\n isInt || (isInt = !!d.format?.includes(\"int\"));\n const lo = d.minimum ?? d.length;\n const hi = d.maximum ?? d.length;\n if (lo !== undefined && (minimum === undefined || lo > minimum))\n minimum = lo;\n if (hi !== undefined && (maximum === undefined || hi < maximum))\n maximum = hi;\n }\n if (pattern)\n return pattern.source;\n // an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier\n if (minimum !== undefined && maximum !== undefined && minimum > maximum)\n return \"(?!)\";\n if (minimum !== undefined || maximum !== undefined)\n return regexes.string({ minimum, maximum }).source;\n const own = schema._zod.pattern;\n return (isInt && own === regexes.number ? regexes.integer : own)?.source;\n}\n// a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern\nfunction partPattern(schema) {\n const def = schema._zod.def;\n const own = schema._zod.pattern?.source;\n // lazy resolves its inner on the internals, not the def\n const inner = def.innerType ?? schema._zod.innerType;\n if (inner) {\n const before = inner._zod.pattern?.source;\n const after = partPattern(inner);\n if (own && before && after && after !== before) {\n return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));\n }\n return own;\n }\n if (def.options) {\n const sources = def.options.map(partPattern);\n if (sources.every(Boolean))\n return `^(${sources.map((s) => util.cleanRegex(s)).join(\"|\")})$`;\n }\n return leafPattern(schema);\n}\nexport const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor(\"$ZodTemplateLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n const regexParts = [];\n for (const part of def.parts) {\n if (typeof part === \"object\" && part !== null) {\n // is Zod schema\n const source = partPattern(part);\n if (!source) {\n throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);\n }\n regexParts.push(util.cleanRegex(source));\n }\n else if (part === null || util.primitiveTypes.has(typeof part)) {\n regexParts.push(util.escapeRegex(`${part}`));\n }\n else {\n throw new Error(`Invalid template literal part: ${part}`);\n }\n }\n inst._zod.pattern = new RegExp(`^${regexParts.join(\"\")}$`);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"string\") {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"string\",\n code: \"invalid_type\",\n });\n return payload;\n }\n inst._zod.pattern.lastIndex = 0;\n if (!inst._zod.pattern.test(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n code: \"invalid_format\",\n format: def.format ?? \"template_literal\",\n pattern: inst._zod.pattern.source,\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodFunction = /*@__PURE__*/ core.$constructor(\"$ZodFunction\", (inst, def) => {\n $ZodType.init(inst, def);\n // Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.\n Object.defineProperty(inst, \"_def\", { value: def });\n inst._zod.def = def;\n inst.implement = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implement() must be called with a function\");\n }\n // Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.\n return Object.defineProperty(function (...args) {\n const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;\n const result = Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return parse(inst._def.output, result);\n }\n return result;\n }, \"_zod\", { value: inst._zod, enumerable: false });\n };\n inst.implementAsync = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implementAsync() must be called with a function\");\n }\n return Object.defineProperty(async function (...args) {\n const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;\n const result = await Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return await parseAsync(inst._def.output, result);\n }\n return result;\n }, \"_zod\", { value: inst._zod, enumerable: false });\n };\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"function\") {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"function\",\n input: payload.value,\n inst,\n });\n return payload;\n }\n // Check if output is a promise type to determine if we should use async implementation\n const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === \"promise\";\n if (hasPromiseOutput) {\n payload.value = inst.implementAsync(payload.value);\n }\n else {\n payload.value = inst.implement(payload.value);\n }\n return payload;\n };\n inst.input = (...args) => {\n const F = inst.constructor;\n if (Array.isArray(args[0])) {\n return new F({\n type: \"function\",\n input: new $ZodTuple({\n type: \"tuple\",\n items: args[0],\n rest: args[1],\n }),\n output: inst._def.output,\n });\n }\n return new F({\n type: \"function\",\n input: args[0],\n output: inst._def.output,\n });\n };\n inst.output = (output) => {\n const F = inst.constructor;\n return new F({\n type: \"function\",\n input: inst._def.input,\n output,\n });\n };\n return inst;\n});\nexport const $ZodPromise = /*@__PURE__*/ core.$constructor(\"$ZodPromise\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));\n };\n});\nexport const $ZodLazy = /*@__PURE__*/ core.$constructor(\"$ZodLazy\", (inst, def) => {\n $ZodType.init(inst, def);\n // Cache the resolved inner type on the shared `def` so all clones of this lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance, preserving identity for cycle detection on recursive schemas.\n util.defineLazy(inst._zod, \"innerType\", () => {\n const d = def;\n if (!d._cachedInner)\n d._cachedInner = def.getter();\n return d._cachedInner;\n });\n util.defineLazyInternal(inst, \"pattern\", (zod) => zod.innerType?._zod?.pattern);\n util.defineLazyInternal(inst, \"propValues\", (zod) => zod.innerType?._zod?.propValues);\n util.defineLazyInternal(inst, \"optin\", (zod) => zod.innerType?._zod?.optin ?? undefined);\n util.defineLazyInternal(inst, \"optout\", (zod) => zod.innerType?._zod?.optout ?? undefined);\n inst._zod.parse = (payload, ctx) => {\n const inner = inst._zod.innerType;\n return inner._zod.run(payload, ctx);\n };\n});\nexport const $ZodCustom = /*@__PURE__*/ core.$constructor(\"$ZodCustom\", (inst, def) => {\n checks.$ZodCheck.init(inst, def);\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _) => {\n return payload;\n };\n inst._zod.check = (payload) => {\n const input = payload.value;\n const r = def.fn(input);\n if (r instanceof Promise) {\n return r.then((r) => handleRefineResult(r, payload, input, inst));\n }\n handleRefineResult(r, payload, input, inst);\n return;\n };\n});\nfunction handleRefineResult(result, payload, input, inst) {\n if (!result) {\n const _iss = {\n code: \"custom\",\n input,\n inst, // incorporates params.error into issue reporting\n path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting\n continue: !inst._zod.def.abort,\n // params: inst._zod.def.params,\n };\n if (inst._zod.def.params)\n _iss.params = inst._zod.def.params;\n payload.issues.push(util.issue(_iss));\n }\n}\n","import * as util from \"./util.js\";\nexport class $ZodCyclicError extends Error {\n constructor() {\n super(`Cannot parse a reference cycle that closes through a transform`);\n this.name = \"ZodCyclicError\";\n }\n}\n/** Keyed off the context object every schema in one parse call already shares. */\nconst STATE = \"~memo\";\nconst NO_ISSUES = [];\n// a value a cycle can close through\nfunction isRef(value) {\n return value !== null && typeof value === \"object\";\n}\n// Receivers prefix paths in place, so the cache and every hand-out need their own copies.\nfunction cloneIssues(issues) {\n return issues.map((iss) => (iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }));\n}\nconst recursive = /*@__PURE__*/ new WeakMap();\n/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */\nconst NONE = 0;\nconst ASSUMED = 1;\nconst PROVEN = 2;\n/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */\nfunction isRecursive(inst, stack, resolve) {\n const cached = recursive.get(inst);\n if (cached !== undefined)\n return cached ? PROVEN : NONE;\n // Relative to the walk in progress, so not cached.\n if (stack.has(inst))\n return PROVEN;\n stack.add(inst);\n let result = NONE;\n const check = (child) => {\n if (result !== PROVEN && child?._zod) {\n const answer = isRecursive(child, stack, resolve);\n if (answer > result)\n result = answer;\n }\n };\n // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen\n const shape = (sh, spread) => {\n let answer = NONE;\n for (const key of Reflect.ownKeys(sh)) {\n const desc = Object.getOwnPropertyDescriptor(sh, key);\n // an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all\n if (spread && !desc.enumerable)\n continue;\n // resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle\n const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;\n if (child > answer)\n answer = child;\n }\n return answer;\n };\n const merge = (answer) => {\n if (answer > result)\n result = answer;\n };\n const def = inst._zod.def;\n const kind = def.type;\n switch (kind) {\n case \"object\": {\n const raw = util.rawShape(def);\n // a def with no raw shape answers `shape` from an accessor of its own, and running that can mint a whole fresh subtree\n merge(raw ? shape(raw, true) : ASSUMED);\n check(def.catchall);\n break;\n }\n case \"array\":\n check(def.element);\n break;\n case \"tuple\":\n for (const el of def.items)\n check(el);\n check(def.rest);\n break;\n case \"record\":\n case \"map\":\n check(def.keyType);\n check(def.valueType);\n break;\n case \"set\":\n check(def.valueType);\n break;\n case \"union\":\n for (const el of def.options)\n check(el);\n break;\n case \"intersection\":\n check(def.left);\n check(def.right);\n break;\n case \"optional\":\n case \"nullable\":\n case \"default\":\n case \"prefault\":\n case \"catch\":\n case \"readonly\":\n case \"nonoptional\":\n case \"promise\":\n case \"success\":\n check(def.innerType);\n break;\n case \"pipe\":\n check(def.in);\n check(def.out);\n break;\n case \"function\":\n check(def.input);\n check(def.output);\n break;\n // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly\n case \"lazy\": {\n const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : undefined);\n // walked with resolution off: one hop sees past the deferral, and a lazy that yields only another unresolved lazy is generative, so it stops there\n merge(inner ? isRecursive(inner, stack, false) : ASSUMED);\n break;\n }\n // a leaf by choice: `parts` are regex fragments, not data positions\n case \"template_literal\":\n // leaves\n case \"string\":\n case \"number\":\n case \"int\":\n case \"boolean\":\n case \"bigint\":\n case \"symbol\":\n case \"undefined\":\n case \"null\":\n case \"void\":\n case \"never\":\n case \"any\":\n case \"unknown\":\n case \"date\":\n case \"nan\":\n case \"enum\":\n case \"literal\":\n case \"file\":\n case \"transform\":\n case \"custom\":\n break;\n default: {\n // a new built-in kind becomes a compile error here\n kind;\n // a user-defined kind can still hold children, and only its author knows where, so fall back to scanning the def — skipping accessors, since reading one can run user code\n for (const key in def) {\n const desc = Object.getOwnPropertyDescriptor(def, key);\n if (!desc || desc.get)\n continue;\n const value = desc.value;\n if (!value || typeof value !== \"object\")\n continue;\n if (value._zod)\n check(value);\n else if (Array.isArray(value))\n for (const el of value)\n check(el);\n }\n }\n }\n stack.delete(inst);\n return settle(inst, result);\n}\n/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */\nfunction settle(inst, answer) {\n if (answer !== ASSUMED)\n recursive.set(inst, answer === PROVEN);\n return answer;\n}\n/**\n * Whether one parse can re-enter this schema, i.e. its subtree contains a cycle.\n * Exported for `z.compile`, which refuses to compile such a schema: cycle\n * breaking is driven from here off state keyed on the parse context, and a\n * generated fast path has no context to key on.\n */\nexport function isRecursiveSchema(inst) {\n // z.compile never parses, so nothing would ever resolve a lazy for it; it runs once and already treats a throw here as recursive\n return isRecursive(inst, new Set(), true) !== NONE;\n}\nfunction bucketFor(state, inst) {\n let bucket = state.buckets.get(inst);\n if (!bucket) {\n bucket = new WeakMap();\n state.buckets.set(inst, bucket);\n }\n return bucket;\n}\n// Set immediately before delegating to core and cleared immediately after, so `alloc` registers only for a visit this module is driving.\nlet handoff;\n// Allocated but unfinished entries. `alloc` and the matching pop both happen in the synchronous part of a parse, so they nest even when children are async, and one stack serves every schema.\nconst open = [];\nconst memo = {\n alloc(_inst, payload, empty) {\n const bucket = handoff;\n if (!bucket)\n return empty;\n handoff = undefined;\n const entry = { value: empty, issues: null };\n bucket.set(payload.value, entry);\n open.push(entry);\n return empty;\n },\n guard(inst) {\n var _a;\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n inst._zod.deferred.push(() => {\n const base = inst._zod.parse;\n const wrapped = (payload, ctx) => {\n // The value is a placeholder a back-edge is still waiting on, so the cycle closes through this transform. Its output can't exist in time to bind.\n if (ctx.direction !== \"backward\" && isBackEdge(ctx, payload.value))\n throw new $ZodCyclicError();\n return base(payload, ctx);\n };\n inst._zod.parse = wrapped;\n if (inst._zod.run === base)\n inst._zod.run = wrapped;\n });\n },\n attach(inst) {\n var _a;\n let isRecursiveInst;\n let rechecked = false;\n // a recursive schema is re-entered many times per parse and its bucket never changes\n let lastCtx;\n let lastBucket;\n // Wraps `parse` in a deferred so it sees the container's final parse. Core's own deferred copies `parse` into `run` when there are no checks, and it ran first, so `run` is patched to match; with checks, `run` reads `parse` dynamically.\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n inst._zod.deferred.push(() => {\n const base = inst._zod.parse;\n const wrapped = (payload, ctx) => {\n if (isRecursiveInst === undefined) {\n const walked = isRecursive(inst, new Set(), false);\n if (walked === NONE) {\n // Nothing here can ever fire, so take it back out.\n inst._zod.parse = base;\n if (inst._zod.run === wrapped)\n inst._zod.run = base;\n return base(payload, ctx);\n }\n // this parse resolves the deferred edges on its own path, so ask once more before latching\n if (walked === PROVEN || rechecked)\n isRecursiveInst = true;\n else\n rechecked = true;\n }\n const input = payload.value;\n if (!isRef(input))\n return base(payload, ctx);\n let state = ctx[STATE];\n if (!state) {\n state = { buckets: new WeakMap(), backEdges: undefined };\n ctx[STATE] = state;\n }\n let bucket;\n if (lastCtx === ctx) {\n bucket = lastBucket;\n }\n else {\n bucket = bucketFor(state, inst);\n lastCtx = ctx;\n lastBucket = bucket;\n }\n const hit = bucket.get(input);\n if (hit) {\n payload.value = hit.value;\n if (hit.issues) {\n if (hit.issues.length)\n payload.issues.push(...cloneIssues(hit.issues));\n }\n else {\n // Still being parsed: its own checks cover it, so skip them here.\n payload.memo = true;\n state.backEdges ?? (state.backEdges = new WeakSet());\n state.backEdges.add(hit.value);\n }\n return payload;\n }\n handoff = bucket;\n const depth = open.length;\n const result = base(payload, ctx);\n handoff = undefined;\n // A container that rejected its input outright allocated nothing.\n const entry = open.length > depth ? open.pop() : undefined;\n // Both paths written out so the sync one allocates no closure. It runs once per node, and capturing here cost more than everything else combined.\n if (result instanceof Promise) {\n return result.then((r) => {\n if (entry)\n entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;\n return r;\n });\n }\n if (entry)\n entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;\n return result;\n };\n inst._zod.parse = wrapped;\n if (inst._zod.run === base)\n inst._zod.run = wrapped;\n });\n },\n};\n/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */\nexport function memoizer() {\n return memo;\n}\n/** Whether this value is a node a back-edge resolved to before it finished. */\nexport function isBackEdge(ctx, value) {\n const backEdges = ctx[STATE]?.backEdges;\n return backEdges !== undefined && isRef(value) && backEdges.has(value);\n}\n","import * as util from \"../core/util.js\";\nconst error = () => {\n const Sizable = {\n string: { unit: \"characters\", verb: \"to have\" },\n file: { unit: \"bytes\", verb: \"to have\" },\n array: { unit: \"items\", verb: \"to have\" },\n set: { unit: \"items\", verb: \"to have\" },\n map: { unit: \"entries\", verb: \"to have\" },\n };\n function getSizing(origin) {\n return Sizable[origin] ?? null;\n }\n const FormatDictionary = {\n regex: \"input\",\n email: \"email address\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datetime\",\n date: \"ISO date\",\n time: \"ISO time\",\n duration: \"ISO duration\",\n ipv4: \"IPv4 address\",\n ipv6: \"IPv6 address\",\n mac: \"MAC address\",\n cidrv4: \"IPv4 range\",\n cidrv6: \"IPv6 range\",\n base64: \"base64-encoded string\",\n base64url: \"base64url-encoded string\",\n json_string: \"JSON string\",\n e164: \"E.164 number\",\n currency_code: \"currency code\",\n credit_card: \"credit card number\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };\n // type names: missing keys = do not translate (use raw value via ?? fallback)\n const TypeDictionary = {\n // Compatibility: \"nan\" -> \"NaN\" for display\n nan: \"NaN\",\n // All other type names omitted - they fall back to raw values via ?? operator\n };\n function getTypeName(type, input) {\n if (type === \"number\" && typeof input === \"number\" && !Number.isFinite(input)) {\n return String(input);\n }\n return TypeDictionary[type] ?? type;\n }\n return (issue) => {\n switch (issue.code) {\n case \"invalid_type\": {\n const expected = getTypeName(issue.expected);\n const receivedType = util.parsedType(issue.input);\n const received = getTypeName(receivedType, issue.input);\n return `Invalid input: expected ${expected}, received ${received}`;\n }\n case \"invalid_value\":\n if (issue.values.length === 1)\n return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`;\n return `Invalid option: expected one of ${util.joinValues(issue.values, \"|\")}`;\n case \"too_big\": {\n const adj = issue.exact ? \"exactly \" : issue.inclusive ? \"<=\" : \"<\";\n const sizing = getSizing(issue.origin);\n if (sizing)\n return `Too big: expected ${issue.origin ?? \"value\"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? \"elements\"}`;\n return `Too big: expected ${issue.origin ?? \"value\"} to be ${adj}${issue.maximum.toString()}`;\n }\n case \"too_small\": {\n const adj = issue.exact ? \"exactly \" : issue.inclusive ? \">=\" : \">\";\n const sizing = getSizing(issue.origin);\n if (sizing) {\n return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;\n }\n return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;\n }\n case \"invalid_format\": {\n const _issue = issue;\n if (_issue.format === \"starts_with\") {\n return `Invalid string: must start with \"${_issue.prefix}\"`;\n }\n if (_issue.format === \"ends_with\")\n return `Invalid string: must end with \"${_issue.suffix}\"`;\n if (_issue.format === \"includes\")\n return `Invalid string: must include \"${_issue.includes}\"`;\n if (_issue.format === \"regex\")\n return `Invalid string: must match pattern ${_issue.pattern}`;\n return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;\n }\n case \"not_multiple_of\":\n return `Invalid number: must be a multiple of ${issue.divisor}`;\n case \"unrecognized_keys\":\n return `Unrecognized key${issue.keys.length > 1 ? \"s\" : \"\"}: ${util.joinValues(issue.keys, \", \")}`;\n case \"invalid_key\":\n return `Invalid key in ${issue.origin}`;\n case \"invalid_union\":\n if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {\n const opts = issue.options.map((o) => `'${o}'`).join(\" | \");\n return `Invalid discriminator value. Expected ${opts}`;\n }\n if (issue.inclusive === false) {\n return \"Invalid input: more than one option matched\";\n }\n return \"Invalid input\";\n case \"invalid_element\":\n return `Invalid value in ${issue.origin}`;\n default:\n return `Invalid input`;\n }\n };\n};\nexport default function () {\n return {\n localeError: error(),\n };\n}\n","var _a;\nexport const $output = /*@__PURE__*/ Symbol(\"ZodOutput\");\nexport const $input = /*@__PURE__*/ Symbol(\"ZodInput\");\nexport class $ZodRegistry {\n constructor() {\n this._map = new WeakMap();\n this._idmap = new Map();\n }\n add(schema, ..._meta) {\n const meta = _meta[0];\n this._map.set(schema, meta);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.set(meta.id, schema);\n }\n return this;\n }\n clear() {\n this._map = new WeakMap();\n this._idmap = new Map();\n return this;\n }\n remove(schema) {\n const meta = this._map.get(schema);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.delete(meta.id);\n }\n this._map.delete(schema);\n return this;\n }\n get(schema) {\n // return this._map.get(schema) as any;\n // inherit metadata\n const p = schema._zod.parent;\n if (p) {\n const pm = { ...(this.get(p) ?? {}) };\n delete pm.id; // do not inherit id\n const f = { ...pm, ...this._map.get(schema) };\n return Object.keys(f).length ? f : undefined;\n }\n return this._map.get(schema);\n }\n has(schema) {\n return this._map.has(schema);\n }\n}\n// registries\nexport function registry() {\n return new $ZodRegistry();\n}\n(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());\nexport const globalRegistry = globalThis.__zod_globalRegistry;\n","import * as checks from \"./checks.js\";\nimport * as registries from \"./registries.js\";\nimport * as schemas from \"./schemas.js\";\nimport * as util from \"./util.js\";\nfunction snapshotChecks(def) {\n if (def.checks)\n def.checks = [...def.checks];\n return def;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _string(Class, params) {\n return new Class(snapshotChecks({ type: \"string\", ...util.normalizeParams(params) }));\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedString(Class, params) {\n return new Class(snapshotChecks({ type: \"string\", coerce: true, ...util.normalizeParams(params) }));\n}\n// @__NO_SIDE_EFFECTS__\nexport function _email(Class, params) {\n return new Class({\n type: \"string\",\n format: \"email\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _guid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"guid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v4\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v6\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv7(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v7\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _emoji(Class, params) {\n return new Class({\n type: \"string\",\n format: \"emoji\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nanoid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"nanoid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link _cuid2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\n// @__NO_SIDE_EFFECTS__\nexport function _cuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cuid2(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid2\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ulid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ulid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _xid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"xid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ksuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ksuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ipv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ipv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _mac(Class, params) {\n return new Class({\n type: \"string\",\n format: \"mac\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cidrv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cidrv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _base64(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _base64url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _e164(Class, params) {\n return new Class({\n type: \"string\",\n format: \"e164\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _creditCard(Class, params) {\n return new Class({\n type: \"string\",\n format: \"credit_card\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _iban(Class, params) {\n return new Class({\n type: \"string\",\n format: \"iban\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _jwt(Class, params) {\n return new Class({\n type: \"string\",\n format: \"jwt\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport const TimePrecision = {\n Any: null,\n Minute: -1,\n Second: 0,\n Millisecond: 3,\n Microsecond: 6,\n};\n// @__NO_SIDE_EFFECTS__\nexport function _isoDateTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"datetime\",\n check: \"string_format\",\n offset: false,\n local: false,\n precision: null,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoDate(Class, params) {\n return new Class({\n type: \"string\",\n format: \"date\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"time\",\n check: \"string_format\",\n precision: null,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoDuration(Class, params) {\n return new Class({\n type: \"string\",\n format: \"duration\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _number(Class, params) {\n return new Class(snapshotChecks({ type: \"number\", checks: [], ...util.normalizeParams(params) }));\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedNumber(Class, params) {\n return new Class(snapshotChecks({ type: \"number\", coerce: true, checks: [], ...util.normalizeParams(params) }));\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"safeint\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _float32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _float64(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"int32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uint32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"uint32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _boolean(Class, params) {\n return new Class({\n type: \"boolean\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedBoolean(Class, params) {\n return new Class({\n type: \"boolean\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _bigint(Class, params) {\n return new Class({\n type: \"bigint\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedBigint(Class, params) {\n return new Class({\n type: \"bigint\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"int64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uint64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"uint64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _symbol(Class, params) {\n return new Class({\n type: \"symbol\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _undefined(Class, params) {\n return new Class({\n type: \"undefined\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _null(Class, params) {\n return new Class({\n type: \"null\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _any(Class) {\n return new Class({\n type: \"any\",\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _unknown(Class) {\n return new Class({\n type: \"unknown\",\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _never(Class, params) {\n return new Class({\n type: \"never\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _void(Class, params) {\n return new Class({\n type: \"void\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _date(Class, params) {\n return new Class({\n type: \"date\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedDate(Class, params) {\n return new Class({\n type: \"date\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nan(Class, params) {\n return new Class({\n type: \"nan\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lt(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lte(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.lte()` instead. */\n_lte as _max, };\n// @__NO_SIDE_EFFECTS__\nexport function _gt(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _gte(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.gte()` instead. */\n_gte as _min, };\n// @__NO_SIDE_EFFECTS__\nexport function _positive(params) {\n return _gt(0, params);\n}\n// negative\n// @__NO_SIDE_EFFECTS__\nexport function _negative(params) {\n return _lt(0, params);\n}\n// nonpositive\n// @__NO_SIDE_EFFECTS__\nexport function _nonpositive(params) {\n return _lte(0, params);\n}\n// nonnegative\n// @__NO_SIDE_EFFECTS__\nexport function _nonnegative(params) {\n return _gte(0, params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function _multipleOf(value, params) {\n return new checks.$ZodCheckMultipleOf({\n check: \"multiple_of\",\n ...util.normalizeParams(params),\n value,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _maxSize(maximum, params) {\n return new checks.$ZodCheckMaxSize({\n check: \"max_size\",\n ...util.normalizeParams(params),\n maximum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _minSize(minimum, params) {\n return new checks.$ZodCheckMinSize({\n check: \"min_size\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _size(size, params) {\n return new checks.$ZodCheckSizeEquals({\n check: \"size_equals\",\n ...util.normalizeParams(params),\n size,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _maxLength(maximum, params) {\n const ch = new checks.$ZodCheckMaxLength({\n check: \"max_length\",\n ...util.normalizeParams(params),\n maximum,\n });\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _minLength(minimum, params) {\n return new checks.$ZodCheckMinLength({\n check: \"min_length\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _length(length, params) {\n return new checks.$ZodCheckLengthEquals({\n check: \"length_equals\",\n ...util.normalizeParams(params),\n length,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _regex(pattern, params) {\n return new checks.$ZodCheckRegex({\n check: \"string_format\",\n format: \"regex\",\n ...util.normalizeParams(params),\n pattern,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lowercase(params) {\n return new checks.$ZodCheckLowerCase({\n check: \"string_format\",\n format: \"lowercase\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uppercase(params) {\n return new checks.$ZodCheckUpperCase({\n check: \"string_format\",\n format: \"uppercase\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _includes(includes, params) {\n return new checks.$ZodCheckIncludes({\n check: \"string_format\",\n format: \"includes\",\n ...util.normalizeParams(params),\n includes,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _startsWith(prefix, params) {\n return new checks.$ZodCheckStartsWith({\n check: \"string_format\",\n format: \"starts_with\",\n ...util.normalizeParams(params),\n prefix,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _endsWith(suffix, params) {\n return new checks.$ZodCheckEndsWith({\n check: \"string_format\",\n format: \"ends_with\",\n ...util.normalizeParams(params),\n suffix,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _property(property, schema, params) {\n return new checks.$ZodCheckProperty({\n check: \"property\",\n property,\n schema,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _properties(shape, params) {\n return new checks.$ZodCheckProperties({\n check: \"properties\",\n shape,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _mime(types, params) {\n return new checks.$ZodCheckMimeType({\n check: \"mime_type\",\n mime: types,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _overwrite(tx) {\n return new checks.$ZodCheckOverwrite({\n check: \"overwrite\",\n tx,\n });\n}\n// normalize\n// @__NO_SIDE_EFFECTS__\nexport function _normalize(form) {\n return _overwrite((input) => input.normalize(form));\n}\n// trim\n// @__NO_SIDE_EFFECTS__\nexport function _trim() {\n return _overwrite((input) => input.trim());\n}\n// toLowerCase\n// @__NO_SIDE_EFFECTS__\nexport function _toLowerCase() {\n return _overwrite((input) => input.toLowerCase());\n}\n// toUpperCase\n// @__NO_SIDE_EFFECTS__\nexport function _toUpperCase() {\n return _overwrite((input) => input.toUpperCase());\n}\n// slugify\n// @__NO_SIDE_EFFECTS__\nexport function _slugify() {\n return _overwrite((input) => util.slugify(input));\n}\n// @__NO_SIDE_EFFECTS__\nexport function _array(Class, element, params) {\n return new Class({\n type: \"array\",\n element,\n // get element() {\n // return element;\n // },\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _union(Class, options, params) {\n return new Class({\n type: \"union\",\n options,\n ...util.normalizeParams(params),\n });\n}\nexport function _xor(Class, options, params) {\n return new Class({\n type: \"union\",\n options,\n inclusive: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _discriminatedUnion(Class, discriminator, options, params) {\n return new Class({\n type: \"union\",\n options: options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _intersection(Class, left, right) {\n return new Class({\n type: \"intersection\",\n left,\n right,\n });\n}\n// export function _tuple(\n// Class: util.SchemaClass<schemas.$ZodTuple>,\n// items: [],\n// params?: string | $ZodTupleParams\n// ): schemas.$ZodTuple<[], null>;\n// @__NO_SIDE_EFFECTS__\nexport function _tuple(Class, items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof schemas.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new Class({\n type: \"tuple\",\n items,\n rest,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _record(Class, keyType, valueType, params) {\n return new Class({\n type: \"record\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _map(Class, keyType, valueType, params) {\n return new Class({\n type: \"map\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _set(Class, valueType, params) {\n return new Class({\n type: \"set\",\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _enum(Class, values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n // if (Array.isArray(values)) {\n // for (const value of values) {\n // entries[value] = value;\n // }\n // } else {\n // Object.assign(entries, values);\n // }\n // const entries: util.EnumLike = {};\n // for (const val of values) {\n // entries[val] = val;\n // }\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function _nativeEnum(Class, entries, params) {\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _literal(Class, value, params) {\n return new Class({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _file(Class, params) {\n return new Class({\n type: \"file\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _transform(Class, fn) {\n return new Class({\n type: \"transform\",\n transform: fn,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _optional(Class, innerType) {\n return new Class({\n type: \"optional\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nullable(Class, innerType) {\n return new Class({\n type: \"nullable\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _default(Class, innerType, defaultValue) {\n return new Class({\n type: \"default\",\n innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nonoptional(Class, innerType, params) {\n return new Class({\n type: \"nonoptional\",\n innerType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _success(Class, innerType) {\n return new Class({\n type: \"success\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _catch(Class, innerType, catchValue) {\n return new Class({\n type: \"catch\",\n innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : util.constantCatch(catchValue)),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _pipe(Class, in_, out) {\n return new Class({\n type: \"pipe\",\n in: in_,\n out,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _readonly(Class, innerType) {\n return new Class({\n type: \"readonly\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _templateLiteral(Class, parts, params) {\n return new Class({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lazy(Class, getter) {\n return new Class({\n type: \"lazy\",\n getter,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _promise(Class, innerType) {\n return new Class({\n type: \"promise\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _custom(Class, fn, _params) {\n const norm = util.normalizeParams(_params);\n norm.abort ?? (norm.abort = true); // default to abort:false\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...norm,\n });\n return schema;\n}\n// same as _custom but defaults to abort:false\n// @__NO_SIDE_EFFECTS__\nexport function _refine(Class, fn, _params) {\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...util.normalizeParams(_params),\n });\n return schema;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _superRefine(fn, params) {\n const ch = _check((payload) => {\n payload.addIssue = (issue) => {\n if (typeof issue === \"string\") {\n payload.issues.push(util.issue(issue, payload.value, ch._zod.def));\n }\n else {\n // for Zod 3 backwards compatibility\n const _issue = issue;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = \"custom\");\n if (!(\"input\" in _issue))\n _issue.input = payload.value;\n _issue.inst ?? (_issue.inst = ch);\n _issue.continue ?? (_issue.continue = !ch._zod.def.abort); // abort is always undefined, so this is always true...\n payload.issues.push(util.issue(_issue));\n }\n };\n return fn(payload.value, payload);\n }, params);\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _check(fn, params) {\n const ch = new checks.$ZodCheck({\n check: \"custom\",\n ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function describe(description) {\n const ch = new checks.$ZodCheck({ check: \"describe\" });\n ch._zod.onattach = [\n (inst) => {\n const existing = registries.globalRegistry.get(inst) ?? {};\n registries.globalRegistry.add(inst, { ...existing, description });\n },\n ];\n ch._zod.check = () => { }; // no-op check\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function meta(metadata) {\n const ch = new checks.$ZodCheck({ check: \"meta\" });\n ch._zod.onattach = [\n (inst) => {\n const existing = registries.globalRegistry.get(inst) ?? {};\n registries.globalRegistry.add(inst, { ...existing, ...metadata });\n },\n ];\n ch._zod.check = () => { }; // no-op check\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _stringbool(Classes, _params) {\n const params = util.normalizeParams(_params);\n let truthyArray = params.truthy ?? [\"true\", \"1\", \"yes\", \"on\", \"y\", \"enabled\"];\n let falsyArray = params.falsy ?? [\"false\", \"0\", \"no\", \"off\", \"n\", \"disabled\"];\n if (params.case !== \"sensitive\") {\n truthyArray = truthyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n falsyArray = falsyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n }\n const truthySet = new Set(truthyArray);\n const falsySet = new Set(falsyArray);\n const _Codec = Classes.Codec ?? schemas.$ZodCodec;\n const _Boolean = Classes.Boolean ?? schemas.$ZodBoolean;\n const _String = Classes.String ?? schemas.$ZodString;\n const stringSchema = new _String({ type: \"string\", error: params.error });\n const booleanSchema = new _Boolean({ type: \"boolean\", error: params.error });\n const codec = new _Codec({\n type: \"pipe\",\n in: stringSchema,\n out: booleanSchema,\n transform: ((input, payload) => {\n let data = input;\n if (params.case !== \"sensitive\")\n data = data.toLowerCase();\n if (truthySet.has(data)) {\n return true;\n }\n else if (falsySet.has(data)) {\n return false;\n }\n else {\n payload.issues.push({\n code: \"invalid_value\",\n expected: \"stringbool\",\n values: [...truthySet, ...falsySet],\n input: payload.value,\n inst: codec,\n continue: false,\n });\n return {};\n }\n }),\n reverseTransform: ((input, _payload) => {\n if (input === true) {\n return truthyArray[0] || \"true\";\n }\n else {\n return falsyArray[0] || \"false\";\n }\n }),\n error: params.error,\n });\n codec._zod.bag.truthy = truthyArray;\n codec._zod.bag.falsy = falsyArray;\n codec._zod.bag.case = params.case ?? \"insensitive\";\n return codec;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _stringFormat(Class, format, fnOrRegex, _params = {}) {\n const params = util.normalizeParams(_params);\n const def = {\n check: \"string_format\",\n type: \"string\",\n format,\n fn: typeof fnOrRegex === \"function\" ? fnOrRegex : (val) => fnOrRegex.test(val),\n ...params,\n };\n if (fnOrRegex instanceof RegExp) {\n def.pattern = fnOrRegex;\n }\n const inst = new Class(def);\n return inst;\n}\n","import { globalRegistry } from \"./registries.js\";\nimport { assignProp } from \"./util.js\";\nfunction assignProps(target, ...sources) {\n for (const source of sources) {\n for (const key of Reflect.ownKeys(source)) {\n if (Object.prototype.propertyIsEnumerable.call(source, key)) {\n assignProp(target, key, source[key]);\n }\n }\n }\n return target;\n}\n// function initializeContext<T extends schemas.$ZodType>(inputs: JSONSchemaGeneratorParams<T>): ToJSONSchemaContext<T> {\n// return {\n// processor: inputs.processor,\n// metadataRegistry: inputs.metadata ?? globalRegistry,\n// target: inputs.target ?? \"draft-2020-12\",\n// unrepresentable: inputs.unrepresentable ?? \"throw\",\n// };\n// }\nexport function initializeContext(params) {\n // Normalize target: convert old non-hyphenated versions to hyphenated versions\n let target = params?.target ?? \"draft-2020-12\";\n if (target === \"draft-4\")\n target = \"draft-04\";\n if (target === \"draft-7\")\n target = \"draft-07\";\n return {\n processors: params.processors ?? {},\n metadataRegistry: params?.metadata ?? globalRegistry,\n target,\n unrepresentable: params?.unrepresentable ?? \"throw\",\n override: params?.override ?? (() => { }),\n io: params?.io ?? \"output\",\n counter: 0,\n seen: new Map(),\n sharedDefsExtractedFor: undefined,\n sharedEmitDoneFor: undefined,\n cycles: params?.cycles ?? \"ref\",\n reused: params?.reused ?? \"inline\",\n intersections: [],\n deferred: [],\n external: params?.external ?? undefined,\n };\n}\n/**\n * Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws\n * `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a\n * custom JSON Schema was written into `json`, in which case the caller must not write its own.\n */\nexport function handleUnrepresentable(schema, ctx, json, params, message) {\n const result = typeof ctx.unrepresentable === \"function\"\n ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message })\n : ctx.unrepresentable;\n if (result === \"any\")\n return false;\n if (result === undefined || result === \"throw\")\n throw new Error(message);\n Object.assign(json, result);\n return true;\n}\n// never rename this back to `process`: bundler polyfills inject a top-level `const process` that a lexical declaration of the same name collides with (#6397)\nexport function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {\n var _a;\n const def = schema._zod.def;\n // check for schema in seens\n const seen = ctx.seen.get(schema);\n if (seen) {\n seen.count++;\n // check if cycle\n const isCycle = _params.schemaPath.includes(schema);\n if (isCycle) {\n seen.cycle = _params.path;\n }\n return seen.schema;\n }\n // initialize\n const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };\n ctx.seen.set(schema, result);\n ctx.sharedDefsExtractedFor = undefined;\n ctx.sharedEmitDoneFor = undefined;\n // custom method overrides default behavior\n const overrideSchema = schema._zod.toJSONSchema?.();\n if (overrideSchema) {\n result.schema = overrideSchema;\n }\n else {\n const params = {\n ..._params,\n schemaPath: [..._params.schemaPath, schema],\n path: _params.path,\n };\n if (schema._zod.processJSONSchema) {\n schema._zod.processJSONSchema(ctx, result.schema, params);\n }\n else {\n const _json = result.schema;\n const processor = ctx.processors[def.type];\n if (!processor) {\n throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);\n }\n processor(schema, ctx, _json, params);\n }\n const parent = schema._zod.parent;\n if (parent) {\n // Also set ref if processor didn't (for inheritance)\n if (!result.ref)\n result.ref = parent;\n processSchema(parent, ctx, params);\n ctx.seen.get(parent).isParent = true;\n }\n }\n // metadata\n const meta = ctx.metadataRegistry.get(schema);\n if (meta)\n assignProps(result.schema, meta);\n if (ctx.io === \"input\" && isTransforming(schema)) {\n // examples/defaults only apply to output type of pipe\n delete result.schema.examples;\n delete result.schema.default;\n }\n // set prefault as default\n if (ctx.io === \"input\" && \"_prefault\" in result.schema)\n (_a = result.schema).default ?? (_a.default = result.schema._prefault);\n delete result.schema._prefault;\n // pulling fresh from ctx.seen in case it was overwritten\n const _result = ctx.seen.get(schema);\n return _result.schema;\n}\n/** @deprecated Renamed to `processSchema`. An export alias declares no binding, so it is safe to keep. */\nexport { processSchema as process };\n// Escape a reference token for use in a JSON Pointer fragment (RFC 6901): `~` becomes `~0` and `/` becomes `~1`. The `~` replacement must run first.\nfunction encodeJSONPointerSegment(segment) {\n return segment.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nexport function extractDefs(ctx, schema\n// params: EmitParams\n) {\n // iterate over seen map;\n const root = ctx.seen.get(schema);\n if (!root)\n throw new Error(\"Unprocessed schema. This is a bug in Zod.\");\n // With `external` set, every registered schema resolves through the external branch of `makeURI`, so the root branch below produces the same ref the external branch would — this pass is identical whichever schema it is called with, and only needs to run once.\n if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)\n return;\n // Track ids to detect duplicates across different schemas\n const idToSchema = new Map();\n for (const entry of ctx.seen.entries()) {\n const id = ctx.metadataRegistry.get(entry[0])?.id;\n if (id) {\n const existing = idToSchema.get(id);\n if (existing && existing !== entry[0]) {\n throw new Error(`Duplicate schema id \"${id}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);\n }\n idToSchema.set(id, entry[0]);\n }\n }\n // returns a ref to the schema defId will be empty if the ref points to an external schema (or #)\n const makeURI = (entry) => {\n // comparing the seen objects because sometimes multiple schemas map to the same seen object. e.g. lazy\n // external is configured\n const defsSegment = ctx.target === \"draft-2020-12\" ? \"$defs\" : \"definitions\";\n if (ctx.external) {\n const externalId = ctx.external.registry.get(entry[0])?.id; // ?? \"__shared\";// `__schema${ctx.counter++}`;\n // check if schema is in the external registry\n const uriGenerator = ctx.external.uri ?? ((id) => id);\n if (externalId) {\n return { ref: uriGenerator(externalId) };\n }\n // otherwise, add to __shared\n const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;\n entry[1].defId = id; // set defId so it will be reused if needed\n return { defId: id, ref: `${uriGenerator(\"__shared\")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` };\n }\n const uriPrefix = `#`;\n const defUriPrefix = `${uriPrefix}/${defsSegment}/`;\n // an id-less root has nowhere to be extracted to, so it stays inline and self-references as `#`\n if (entry[1] === root && !entry[1].schema.id) {\n return { ref: uriPrefix };\n }\n // self-contained schema\n const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;\n return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) };\n };\n // stored cached version in `def` property remove all properties, set $ref\n const extractToDef = (entry) => {\n // if the schema is already a reference, do not extract it\n if (entry[1].schema.$ref) {\n return;\n }\n const seen = entry[1];\n const { ref, defId } = makeURI(entry);\n seen.def = { ...seen.schema };\n // defId won't be set if the schema is a reference to an external schema or if the schema is the root schema\n if (defId)\n seen.defId = defId;\n // wipe away all properties except $ref\n const schema = seen.schema;\n for (const key in schema) {\n delete schema[key];\n }\n schema.$ref = ref;\n };\n // throw on cycles\n // break cycles\n if (ctx.cycles === \"throw\") {\n for (const entry of ctx.seen.entries()) {\n const seen = entry[1];\n if (seen.cycle) {\n throw new Error(\"Cycle detected: \" +\n `#/${seen.cycle?.join(\"/\")}/<root>` +\n '\\n\\nSet the `cycles` parameter to `\"ref\"` to resolve cyclical schemas with defs.');\n }\n }\n }\n // extract schemas into $defs\n for (const entry of ctx.seen.entries()) {\n const seen = entry[1];\n // convert root schema to # $ref\n if (schema === entry[0]) {\n extractToDef(entry); // this has special handling for the root schema\n continue;\n }\n // extract schemas that are in the external registry\n if (ctx.external) {\n const ext = ctx.external.registry.get(entry[0])?.id;\n if (schema !== entry[0] && ext) {\n extractToDef(entry);\n continue;\n }\n }\n // extract schemas with `id` meta\n const id = ctx.metadataRegistry.get(entry[0])?.id;\n if (id) {\n extractToDef(entry);\n continue;\n }\n // break cycles\n if (seen.cycle) {\n // any\n extractToDef(entry);\n continue;\n }\n // extract reused schemas\n if (seen.count > 1) {\n if (ctx.reused === \"ref\") {\n extractToDef(entry);\n }\n }\n }\n if (ctx.external)\n ctx.sharedDefsExtractedFor = ctx.external;\n}\n/** Rewrites `anyOf: [{type: \"a\"}, {type: \"b\"}]` to `type: [\"a\", \"b\"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so \"exactly one\" and \"at least one\" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */\nfunction compactTypeUnion(schema) {\n const options = schema.anyOf;\n if (!Array.isArray(options) || options.length === 0 || schema.type !== undefined)\n return;\n const types = [];\n for (const option of options) {\n if (!option || typeof option !== \"object\")\n return;\n // A branch that is itself a compactible union folds into this one — nested `anyOf` and a flat `type` array say the same thing. Compacting it first also makes the result independent of the order this pass walks the seen map in.\n compactTypeUnion(option);\n const keys = Object.keys(option);\n if (keys.length !== 1 || keys[0] !== \"type\")\n return;\n const type = option.type;\n for (const member of Array.isArray(type) ? type : [type]) {\n if (typeof member !== \"string\")\n return;\n if (!types.includes(member))\n types.push(member);\n }\n }\n delete schema.anyOf;\n // A `type` array must be non-empty and unique (metaschema); a single member is spelled as a bare string.\n schema.type = types.length === 1 ? types[0] : types;\n}\n/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,\n * an annotation like `description` — makes a member unfoldable, so a constraint this does not\n * understand leaves the `allOf` alone instead of being silently dropped or misattributed. */\nconst FOLDABLE_KEYS = new Set([\"type\", \"properties\", \"required\", \"additionalProperties\"]);\nconst UNION_KEYS = [\"oneOf\", \"anyOf\"];\n/** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */\nfunction undeclaredConstraint(member) {\n const extra = member.additionalProperties;\n if (extra === undefined || extra === false || typeof extra !== \"object\" || extra === null)\n return null;\n return Object.keys(extra).length ? extra : null;\n}\n/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */\nfunction foldObjects(members) {\n const objects = [];\n for (const member of members) {\n // A boolean subschema is legal JSON Schema and carries no keywords to fold.\n if (typeof member !== \"object\" || member.type !== \"object\")\n return null;\n for (const key in member) {\n if (!FOLDABLE_KEYS.has(key))\n return null;\n }\n objects.push(member);\n }\n const properties = {};\n const required = new Set();\n for (const object of objects) {\n for (const key in object.properties) {\n // `in` would report a `__proto__` key as already present via the prototype chain and skip it.\n if (Object.prototype.hasOwnProperty.call(properties, key))\n continue;\n // Every member constrains this key: the ones that declare it say how, and a `catchall` member constrains it too even though it does not name it. The key has to satisfy all of them, which is the same intersection one level down.\n const parts = [];\n for (const other of objects) {\n const part = other.properties?.[key] ?? undeclaredConstraint(other);\n if (part === null || part === undefined)\n continue;\n if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part)))\n parts.push(part);\n }\n const merged = parts.length === 1\n ? parts[0]\n : (foldObjects(parts) ?? { allOf: parts });\n assignProp(properties, key, merged);\n }\n for (const key of object.required ?? [])\n required.add(key);\n }\n const folded = { type: \"object\", properties };\n if (required.size)\n folded.required = [...required];\n // A key no member declares is rejected only when every member rejects it, so the fold is closed only when every member is. Otherwise it carries whatever the `catchall` members demand of such a key.\n if (objects.every((object) => object.additionalProperties === false)) {\n folded.additionalProperties = false;\n }\n else {\n const constraints = [];\n for (const object of objects) {\n const constraint = undeclaredConstraint(object);\n if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))\n constraints.push(constraint);\n }\n if (constraints.length === 1)\n folded.additionalProperties = constraints[0];\n else if (constraints.length > 1)\n folded.additionalProperties = { allOf: constraints };\n }\n return folded;\n}\n/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two\n * closed object members reject each other's keys and the schema validates nothing. Zod's parser\n * pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when\n * *every* side rejects it — so the emitted schema has to pool them too, and folding the members\n * into one object is the encoding that says so on every target.\n *\n * This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`\n * machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it\n * keeps its reference and its own closedness rather than being inlined as a stale copy. */\nfunction foldIntersection(json) {\n const allOf = json.allOf;\n if (!Array.isArray(allOf) || allOf.length < 2)\n return;\n // An `override` runs before this pass and may have written object keywords onto the intersection itself. Those are deliberate, so decline rather than overwrite them.\n for (const key of FOLDABLE_KEYS)\n if (key in json)\n return;\n // An intersection distributes over a union: `A & (X | Y)` is `(A & X) | (A & Y)`. Only the first union is distributed over; a second one stays among the members every branch folds against, where it fails the object check and declines the whole intersection rather than multiplying out.\n const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));\n let folded = null;\n if (!unions.length) {\n folded = foldObjects(allOf);\n }\n else {\n const union = unions[0];\n const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));\n if (Object.keys(union).length !== 1)\n return;\n const rest = allOf.filter((m) => m !== union);\n const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));\n if (branches.some((b) => !b))\n return;\n folded = { [keyword]: branches };\n }\n if (!folded)\n return;\n delete json.allOf;\n assignProps(json, folded);\n}\nexport function finalize(ctx, schema) {\n const root = ctx.seen.get(schema);\n if (!root)\n throw new Error(\"Unprocessed schema. This is a bug in Zod.\");\n // flatten refs - inherit properties from parent schemas\n const flattenRef = (zodSchema) => {\n const seen = ctx.seen.get(zodSchema);\n // already processed\n if (seen.ref === null)\n return;\n const schema = seen.def ?? seen.schema;\n const _cached = { ...schema };\n const ref = seen.ref;\n seen.ref = null; // prevent infinite recursion\n if (ref) {\n flattenRef(ref);\n const refSeen = ctx.seen.get(ref);\n const refSchema = refSeen.schema;\n // merge referenced schema into current\n if (refSchema.$ref && (ctx.target === \"draft-07\" || ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\")) {\n // older drafts can't combine $ref with other properties\n schema.allOf = schema.allOf ?? [];\n schema.allOf.push(refSchema);\n }\n else {\n assignProps(schema, refSchema);\n }\n // restore child's own properties (child wins)\n assignProps(schema, _cached);\n const isParentRef = zodSchema._zod.parent === ref;\n // For parent chain, child is a refinement - remove parent-only properties\n if (isParentRef) {\n for (const key in schema) {\n if (key === \"$ref\" || key === \"allOf\")\n continue;\n if (!(key in _cached)) {\n delete schema[key];\n }\n }\n }\n // When ref was extracted to $defs, remove properties that match the definition\n if (refSchema.$ref && refSeen.def) {\n for (const key in schema) {\n if (key === \"$ref\" || key === \"allOf\")\n continue;\n if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {\n delete schema[key];\n }\n }\n }\n }\n // If parent was extracted (has $ref), propagate $ref to this schema. This handles cases like: readonly().meta({id}).describe() where processor sets ref to innerType but parent should be referenced\n const parent = zodSchema._zod.parent;\n if (parent && parent !== ref) {\n // Ensure parent is processed first so its def has inherited properties\n flattenRef(parent);\n const parentSeen = ctx.seen.get(parent);\n if (parentSeen?.schema.$ref) {\n schema.$ref = parentSeen.schema.$ref;\n // De-duplicate with parent's definition\n if (parentSeen.def) {\n for (const key in schema) {\n if (key === \"$ref\" || key === \"allOf\")\n continue;\n if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {\n delete schema[key];\n }\n }\n }\n }\n }\n // execute overrides\n ctx.override({\n zodSchema: zodSchema,\n jsonSchema: schema,\n path: seen.path ?? [],\n });\n };\n // Flattening walks the whole map and clears each `ref` as it goes, so a second call over the same map is a no-op scan. Skip it outright once it has run for a registry conversion.\n if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {\n for (const entry of [...ctx.seen.entries()].reverse()) {\n flattenRef(entry[0]);\n }\n if (ctx.target !== \"openapi-3.0\") {\n for (const entry of ctx.seen.entries()) {\n compactTypeUnion(entry[1].def ?? entry[1].schema);\n }\n }\n for (const rewrite of ctx.deferred)\n rewrite();\n // After flattening, every member that was extracted is a `$ref`, so the fold sees the final shape. A schema that inherits an intersection — through `z.lazy`, or any `ref` chain — holds the same `allOf` array, so fold by array identity to catch every copy.\n if (ctx.intersections.length) {\n const carriers = new Map();\n for (const seen of ctx.seen.values()) {\n for (const json of [seen.schema, seen.def]) {\n const allOf = json?.allOf;\n if (!Array.isArray(allOf))\n continue;\n const existing = carriers.get(allOf);\n if (existing)\n existing.push(json);\n else\n carriers.set(allOf, [json]);\n }\n }\n for (const allOf of ctx.intersections) {\n for (const json of carriers.get(allOf) ?? [])\n foldIntersection(json);\n }\n }\n }\n const result = {};\n if (ctx.target === \"draft-2020-12\") {\n result.$schema = \"https://json-schema.org/draft/2020-12/schema\";\n }\n else if (ctx.target === \"draft-07\") {\n result.$schema = \"http://json-schema.org/draft-07/schema#\";\n }\n else if (ctx.target === \"draft-04\") {\n result.$schema = \"http://json-schema.org/draft-04/schema#\";\n }\n else if (ctx.target === \"openapi-3.0\") {\n // OpenAPI 3.0 schema objects should not include a $schema property\n }\n else {\n // Arbitrary string values are allowed but won't have a $schema property set\n }\n if (ctx.external?.uri) {\n const id = ctx.external.registry.get(schema)?.id;\n if (!id)\n throw new Error(\"Schema is missing an `id` property\");\n result.$id = ctx.external.uri(id);\n }\n // when the root was extracted into $defs, `root.schema` is the `$ref` wrapper and `root.def` is the body that now lives under $defs\n assignProps(result, root.defId ? root.schema : (root.def ?? root.schema));\n // The `id` in `.meta()` is a Zod-specific registration tag used to extract schemas into $defs — it is not user-facing JSON Schema metadata. Strip it from the output body where it would otherwise leak. The id is preserved implicitly via the $defs key (and via $ref paths).\n const rootMetaId = ctx.metadataRegistry.get(schema)?.id;\n if (rootMetaId !== undefined && result.id === rootMetaId)\n delete result.id;\n // build defs object. With `external`, `defs` is the shared object every schema writes into, so the same entries are reassigned on every call. Without it, `defs` is fresh per call and must be rebuilt.\n const defs = ctx.external?.defs ?? {};\n if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {\n for (const entry of ctx.seen.entries()) {\n const seen = entry[1];\n if (seen.def && seen.defId) {\n if (seen.def.id === seen.defId)\n delete seen.def.id;\n assignProp(defs, seen.defId, seen.def);\n }\n }\n }\n if (ctx.external)\n ctx.sharedEmitDoneFor = ctx.external;\n // set definitions in result\n if (ctx.external) {\n }\n else {\n if (Object.keys(defs).length > 0) {\n if (ctx.target === \"draft-2020-12\") {\n result.$defs = defs;\n }\n else {\n result.definitions = defs;\n }\n }\n }\n try {\n // this \"finalizes\" this schema and ensures all cycles are removed each call to finalize() is functionally independent though the seen map is shared\n const finalized = JSON.parse(JSON.stringify(result));\n Object.defineProperty(finalized, \"~standard\", {\n value: {\n ...schema[\"~standard\"],\n jsonSchema: {\n input: createStandardJSONSchemaMethod(schema, \"input\", ctx.processors),\n output: createStandardJSONSchemaMethod(schema, \"output\", ctx.processors),\n },\n },\n enumerable: false,\n writable: false,\n });\n return finalized;\n }\n catch (_err) {\n throw new Error(\"Error converting schema to JSON.\");\n }\n}\nfunction isTransforming(_schema, _ctx) {\n const ctx = _ctx ?? { seen: new Set() };\n if (ctx.seen.has(_schema))\n return false;\n ctx.seen.add(_schema);\n const def = _schema._zod.def;\n if (def.type === \"transform\")\n return true;\n if (def.type === \"array\")\n return isTransforming(def.element, ctx);\n if (def.type === \"set\")\n return isTransforming(def.valueType, ctx);\n if (def.type === \"lazy\")\n return isTransforming(def.getter(), ctx);\n if (def.type === \"promise\" ||\n def.type === \"optional\" ||\n def.type === \"nonoptional\" ||\n def.type === \"nullable\" ||\n def.type === \"readonly\" ||\n def.type === \"default\" ||\n def.type === \"prefault\" ||\n def.type === \"catch\") {\n return isTransforming(def.innerType, ctx);\n }\n if (def.type === \"intersection\") {\n return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);\n }\n if (def.type === \"record\" || def.type === \"map\") {\n return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);\n }\n if (def.type === \"pipe\") {\n if (_schema._zod.traits.has(\"$ZodCodec\"))\n return true;\n return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);\n }\n if (def.type === \"object\") {\n for (const key in def.shape) {\n if (isTransforming(def.shape[key], ctx))\n return true;\n }\n return false;\n }\n if (def.type === \"union\") {\n for (const option of def.options) {\n if (isTransforming(option, ctx))\n return true;\n }\n return false;\n }\n if (def.type === \"tuple\") {\n for (const item of def.items) {\n if (isTransforming(item, ctx))\n return true;\n }\n if (def.rest && isTransforming(def.rest, ctx))\n return true;\n return false;\n }\n return false;\n}\n/**\n * Creates a toJSONSchema method for a schema instance.\n * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.\n */\nexport const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {\n const ctx = initializeContext({ ...params, processors });\n processSchema(schema, ctx);\n extractDefs(ctx, schema);\n return finalize(ctx, schema);\n};\nexport const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {\n const { libraryOptions, target } = params ?? {};\n const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });\n processSchema(schema, ctx);\n extractDefs(ctx, schema);\n return finalize(ctx, schema);\n};\n","import * as regexes from \"./regexes.js\";\nimport { base64Charset, base64urlCharset } from \"./schemas.js\";\nimport { extractDefs, finalize, handleUnrepresentable, initializeContext, processSchema, } from \"./to-json-schema.js\";\nimport { BIGINT_FORMAT_RANGES, NUMBER_FORMAT_RANGES, assignProp, getEnumValues } from \"./util.js\";\nconst narrowMin = (agg, key, value) => {\n if (agg[key] === undefined || value > agg[key])\n agg[key] = value;\n};\nconst narrowMax = (agg, key, value) => {\n if (agg[key] === undefined || value < agg[key])\n agg[key] = value;\n};\nconst narrowBoth = (agg, value) => {\n narrowMin(agg, \"minimum\", value);\n narrowMax(agg, \"maximum\", value);\n};\nconst addDivisor = (agg, value) => {\n agg.multipleOf ?? (agg.multipleOf = []);\n if (!agg.multipleOf.includes(value))\n agg.multipleOf.push(value);\n};\nconst addPattern = (agg, pattern) => {\n agg.patterns ?? (agg.patterns = new Set());\n agg.patterns.add(pattern);\n};\nconst intersectMime = (agg, mime) => {\n agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];\n};\n// last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one\nconst setFormat = (agg, format) => {\n agg.format = format;\n if (format.includes(\"int\"))\n agg.isInt = true;\n};\nconst minContributor = (agg, def) => narrowMin(agg, \"minimum\", def.minimum);\nconst maxContributor = (agg, def) => narrowMax(agg, \"maximum\", def.maximum);\nconst formatContributor = (ranges) => (agg, def) => {\n setFormat(agg, def.format);\n const [minimum, maximum] = ranges[def.format];\n narrowMin(agg, \"minimum\", minimum);\n narrowMax(agg, \"maximum\", maximum);\n};\nconst contributors = {\n greater_than: (agg, def) => narrowMin(agg, def.inclusive ? \"minimum\" : \"exclusiveMinimum\", def.value),\n less_than: (agg, def) => narrowMax(agg, def.inclusive ? \"maximum\" : \"exclusiveMaximum\", def.value),\n multiple_of: (agg, def) => addDivisor(agg, def.value),\n number_format: formatContributor(NUMBER_FORMAT_RANGES),\n bigint_format: formatContributor(BIGINT_FORMAT_RANGES),\n min_length: minContributor,\n max_length: maxContributor,\n length_equals: (agg, def) => narrowBoth(agg, def.length),\n min_size: minContributor,\n max_size: maxContributor,\n size_equals: (agg, def) => narrowBoth(agg, def.size),\n string_format: (agg, def) => {\n setFormat(agg, def.format);\n if (def.pattern)\n addPattern(agg, def.pattern);\n if (def.format === \"base64\" || def.format === \"base64url\")\n agg.contentEncoding = def.format;\n if (def.local || def.precision === -1)\n agg.laxFormat = true;\n },\n mime_type: (agg, def) => intersectMime(agg, def.mime),\n};\nexport function aggregateChecks(schema) {\n const agg = {};\n const def = schema._zod.def;\n // a format schema is its own first check, same rule as $ZodType init\n const list = schema._zod.traits.has(\"$ZodCheck\")\n ? [schema, ...(def.checks ?? [])]\n : (def.checks ?? []);\n for (const ch of list)\n contributors[ch._zod.def.check]?.(agg, ch._zod.def);\n // reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other\n const bag = schema._zod.bag;\n if (bag.minimum !== undefined)\n narrowMin(agg, \"minimum\", bag.minimum);\n if (bag.exclusiveMinimum !== undefined)\n narrowMin(agg, \"exclusiveMinimum\", bag.exclusiveMinimum);\n if (bag.maximum !== undefined)\n narrowMax(agg, \"maximum\", bag.maximum);\n if (bag.exclusiveMaximum !== undefined)\n narrowMax(agg, \"exclusiveMaximum\", bag.exclusiveMaximum);\n if (bag.multipleOf !== undefined)\n addDivisor(agg, bag.multipleOf);\n if (bag.format !== undefined) {\n agg.format ?? (agg.format = bag.format);\n if (bag.format.includes(\"int\"))\n agg.isInt = true;\n }\n if (bag.mime)\n intersectMime(agg, bag.mime);\n for (const pattern of bag.patterns ?? [])\n addPattern(agg, pattern);\n return agg;\n}\nconst formatMap = {\n guid: \"uuid\",\n url: \"uri\",\n datetime: \"date-time\",\n json_string: \"json-string\",\n regex: \"\", // do not set\n};\n// ==================== SIMPLE TYPE PROCESSORS ====================\n// the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes\nconst exactPatterns = new Map([\n [base64Charset, regexes.base64],\n [base64urlCharset, regexes.base64url],\n]);\nconst exactPattern = (p) => exactPatterns.get(p) ?? p;\nexport const stringProcessor = (schema, ctx, _json, _params) => {\n const json = _json;\n json.type = \"string\";\n const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);\n if (typeof minimum === \"number\")\n json.minLength = minimum;\n if (typeof maximum === \"number\")\n json.maxLength = maximum;\n // custom pattern overrides format\n if (format) {\n json.format = formatMap[format] ?? format;\n if (json.format === \"\")\n delete json.format; // empty format is not valid\n // `z.iso.time()` is never full-time, and `laxFormat` carries the datetime shapes that also accept what their keyword forbids\n if (format === \"time\" || laxFormat) {\n delete json.format;\n }\n }\n if (contentEncoding)\n json.contentEncoding = contentEncoding;\n if (patterns && patterns.size > 0) {\n const patternList = [...patterns].map(exactPattern);\n if (patternList.length === 1)\n json.pattern = patternList[0].source;\n else if (patternList.length > 1) {\n json.allOf = [\n ...patternList.map((regex) => ({\n ...(ctx.target === \"draft-07\" || ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\"\n ? { type: \"string\" }\n : {}),\n pattern: regex.source,\n })),\n ];\n }\n }\n};\nexport const numberProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);\n json.type = isInt ? \"integer\" : \"number\";\n // when both minimum and exclusiveMinimum exist, pick the more restrictive one\n const exMin = typeof exclusiveMinimum === \"number\" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);\n const exMax = typeof exclusiveMaximum === \"number\" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);\n const legacy = ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\";\n if (exMin) {\n if (legacy) {\n json.minimum = exclusiveMinimum;\n json.exclusiveMinimum = true;\n }\n else {\n json.exclusiveMinimum = exclusiveMinimum;\n }\n }\n else if (typeof minimum === \"number\") {\n json.minimum = minimum;\n }\n if (exMax) {\n if (legacy) {\n json.maximum = exclusiveMaximum;\n json.exclusiveMaximum = true;\n }\n else {\n json.exclusiveMaximum = exclusiveMaximum;\n }\n }\n else if (typeof maximum === \"number\") {\n json.maximum = maximum;\n }\n if (multipleOf) {\n // JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.\n const divisors = new Set();\n for (const divisor of multipleOf) {\n if (Number.isFinite(divisor) && divisor !== 0)\n divisors.add(Math.abs(divisor));\n else\n handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);\n }\n // chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns\n const [first, ...rest] = divisors;\n if (first !== undefined)\n json.multipleOf = first;\n if (rest.length)\n json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];\n }\n};\nexport const booleanProcessor = (_schema, _ctx, json, _params) => {\n json.type = \"boolean\";\n};\nexport const bigintProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"BigInt cannot be represented in JSON Schema\");\n};\nexport const symbolProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Symbols cannot be represented in JSON Schema\");\n};\nexport const nullProcessor = (_schema, ctx, json, _params) => {\n if (ctx.target === \"openapi-3.0\") {\n json.type = \"string\";\n json.nullable = true;\n json.enum = [null];\n }\n else {\n json.type = \"null\";\n }\n};\nexport const undefinedProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Undefined cannot be represented in JSON Schema\");\n};\nexport const voidProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Void cannot be represented in JSON Schema\");\n};\nexport const neverProcessor = (_schema, _ctx, json, _params) => {\n json.not = {};\n};\nexport const anyProcessor = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};\nexport const unknownProcessor = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};\nexport const dateProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Date cannot be represented in JSON Schema\");\n};\nexport const enumProcessor = (schema, _ctx, json, _params) => {\n const def = schema._zod.def;\n const values = getEnumValues(def.entries);\n // an empty enum accepts nothing, same as z.never()\n if (values.length === 0) {\n json.not = {};\n return;\n }\n // Number enums can have both string and number values\n if (values.every((v) => typeof v === \"number\"))\n json.type = \"number\";\n if (values.every((v) => typeof v === \"string\"))\n json.type = \"string\";\n json.enum = values;\n};\nexport const literalProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n // a literal with no values accepts nothing, same as z.never()\n if (def.values.length === 0) {\n json.not = {};\n return;\n }\n const vals = [];\n for (const val of def.values) {\n if (val === undefined) {\n // a custom schema replaces the whole literal, so there is nothing left to accumulate\n if (handleUnrepresentable(schema, ctx, json, params, \"Literal `undefined` cannot be represented in JSON Schema\"))\n return;\n // otherwise do not add to vals\n }\n else if (typeof val === \"bigint\") {\n if (handleUnrepresentable(schema, ctx, json, params, \"BigInt literals cannot be represented in JSON Schema\"))\n return;\n vals.push(Number(val));\n }\n else {\n vals.push(val);\n }\n }\n if (vals.length === 0) {\n // do nothing (an undefined literal was stripped)\n }\n else if (vals.length === 1) {\n const val = vals[0];\n json.type = val === null ? \"null\" : typeof val;\n if (ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\") {\n json.enum = [val];\n }\n else {\n json.const = val;\n }\n }\n else {\n if (vals.every((v) => typeof v === \"number\"))\n json.type = \"number\";\n if (vals.every((v) => typeof v === \"string\"))\n json.type = \"string\";\n if (vals.every((v) => typeof v === \"boolean\"))\n json.type = \"boolean\";\n if (vals.every((v) => v === null))\n json.type = \"null\";\n json.enum = vals;\n }\n};\nexport const nanProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"NaN cannot be represented in JSON Schema\");\n};\nexport const templateLiteralProcessor = (schema, _ctx, json, _params) => {\n const _json = json;\n const pattern = schema._zod.pattern;\n if (!pattern)\n throw new Error(\"Pattern not found in template literal\");\n _json.type = \"string\";\n _json.pattern = pattern.source;\n};\nexport const fileProcessor = (schema, _ctx, json, _params) => {\n const _json = json;\n _json.type = \"string\";\n _json.format = \"binary\";\n _json.contentEncoding = \"binary\";\n const { minimum, maximum, mime } = aggregateChecks(schema);\n if (minimum !== undefined)\n _json.minLength = minimum;\n if (maximum !== undefined)\n _json.maxLength = maximum;\n if (!mime)\n return;\n // an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`\n if (mime.length === 0)\n _json.not = {};\n else if (mime.length === 1)\n _json.contentMediaType = mime[0];\n // only contentMediaType differs, so the shared props stay at the root\n else\n _json.anyOf = mime.map((m) => ({ contentMediaType: m }));\n};\nexport const successProcessor = (_schema, _ctx, json, _params) => {\n json.type = \"boolean\";\n};\nexport const customProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Custom types cannot be represented in JSON Schema\");\n};\nexport const functionProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Function types cannot be represented in JSON Schema\");\n};\nexport const transformProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Transforms cannot be represented in JSON Schema\");\n};\nexport const mapProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Map cannot be represented in JSON Schema\");\n};\nexport const setProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Set cannot be represented in JSON Schema\");\n};\n// ==================== COMPOSITE TYPE PROCESSORS ====================\nexport const arrayProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n const { minimum, maximum } = aggregateChecks(schema);\n if (typeof minimum === \"number\")\n json.minItems = minimum;\n if (typeof maximum === \"number\")\n json.maxItems = maximum;\n json.type = \"array\";\n json.items = processSchema(def.element, ctx, {\n ...params,\n path: [...params.path, \"items\"],\n });\n};\n// Transform and catch set `optin = \"optional\"` at runtime so the parser lets them observe an\n// absent key, but their declared input type stays required. An input JSON Schema describes the\n// declared type, so resolve past them to the schema that actually carries the optionality.\n// Used by both `objectProcessor` (for `required`) and `tupleProcessor` (for `minItems`); see\n// wiki/optionality.md, \"The JSON Schema emitter reads the *static* value\".\nfunction inputOptin(schema) {\n const def = schema._zod.def;\n if (def.type === \"pipe\" && def.in._zod.traits.has(\"$ZodTransform\")) {\n return inputOptin(def.out);\n }\n if (def.type === \"catch\") {\n return inputOptin(def.innerType);\n }\n return schema._zod.optin;\n}\nexport const objectProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n const shape = def.shape;\n // dropping it while still emitting `additionalProperties: false` would emit a schema that rejects data this one requires\n const symbolKeys = Object.getOwnPropertySymbols(shape);\n if (symbolKeys.length &&\n handleUnrepresentable(schema, ctx, json, params, \"Symbol keys cannot be represented in JSON Schema\")) {\n return;\n }\n json.type = \"object\";\n json.properties = {};\n for (const key in shape) {\n // assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into\n assignProp(json.properties, key, processSchema(shape[key], ctx, {\n ...params,\n path: [...params.path, \"properties\", key],\n }));\n }\n // required keys\n const requiredKeys = [];\n for (const key of Object.keys(shape)) {\n const field = def.shape[key];\n if (ctx.io === \"input\" ? inputOptin(field) === undefined : field._zod.optout === undefined) {\n requiredKeys.push(key);\n }\n }\n if (requiredKeys.length > 0) {\n json.required = requiredKeys;\n }\n // catchall\n if (def.catchall?._zod.def.type === \"never\") {\n // strict\n json.additionalProperties = false;\n }\n else if (!def.catchall) {\n // regular\n if (ctx.io === \"output\")\n json.additionalProperties = false;\n }\n else if (def.catchall) {\n json.additionalProperties = processSchema(def.catchall, ctx, {\n ...params,\n path: [...params.path, \"additionalProperties\"],\n });\n }\n};\nexport const unionProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions\n const isExclusive = def.inclusive === false;\n const options = def.options.map((x, i) => processSchema(x, ctx, {\n ...params,\n path: [...params.path, isExclusive ? \"oneOf\" : \"anyOf\", i],\n }));\n if (isExclusive) {\n json.oneOf = options;\n }\n else {\n json.anyOf = options;\n }\n};\nexport const intersectionProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n const a = processSchema(def.left, ctx, {\n ...params,\n path: [...params.path, \"allOf\", 0],\n });\n const b = processSchema(def.right, ctx, {\n ...params,\n path: [...params.path, \"allOf\", 1],\n });\n const isSimpleIntersection = (val) => \"allOf\" in val && Object.keys(val).length === 1;\n const allOf = [\n ...(isSimpleIntersection(a) ? a.allOf : [a]),\n ...(isSimpleIntersection(b) ? b.allOf : [b]),\n ];\n json.allOf = allOf;\n // Recorded innermost first, so a nested intersection has already folded by the time this one is considered. The array is the handle rather than the schema, because a wrapper that inherits this schema shares the same array; `finalize` folds every object holding it. See `foldIntersection`.\n ctx.intersections.push(allOf);\n};\nexport const tupleProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n json.type = \"array\";\n const prefixPath = ctx.target === \"draft-2020-12\" ? \"prefixItems\" : \"items\";\n const restPath = ctx.target === \"draft-2020-12\" ? \"items\" : ctx.target === \"openapi-3.0\" ? \"items\" : \"additionalItems\";\n const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {\n ...params,\n path: [...params.path, prefixPath, i],\n }));\n const rest = def.rest\n ? processSchema(def.rest, ctx, {\n ...params,\n path: [...params.path, restPath, ...(ctx.target === \"openapi-3.0\" ? [def.items.length] : [])],\n })\n : null;\n let minItems = def.items.length;\n while (minItems > 0) {\n const item = def.items[minItems - 1];\n const optional = ctx.io === \"input\" ? inputOptin(item) !== undefined : item._zod.optout === \"optional\";\n if (!optional)\n break;\n minItems--;\n }\n const maxItems = def.items.length;\n const isClosed = !def.rest;\n if (ctx.target === \"draft-2020-12\") {\n json.prefixItems = prefixItems;\n if (isClosed) {\n json.items = false;\n }\n else if (rest) {\n json.items = rest;\n }\n if (minItems > 0)\n json.minItems = minItems;\n if (isClosed)\n json.maxItems = maxItems;\n }\n else if (ctx.target === \"openapi-3.0\") {\n json.items = {\n anyOf: prefixItems,\n };\n if (rest) {\n json.items.anyOf.push(rest);\n }\n if (minItems > 0)\n json.minItems = minItems;\n if (isClosed)\n json.maxItems = maxItems;\n }\n else {\n json.items = prefixItems;\n if (isClosed) {\n json.additionalItems = false;\n }\n else if (rest) {\n json.additionalItems = rest;\n }\n if (minItems > 0)\n json.minItems = minItems;\n if (isClosed)\n json.maxItems = maxItems;\n }\n // explicit user-defined length checks take precedence\n const { minimum, maximum } = aggregateChecks(schema);\n if (typeof minimum === \"number\")\n json.minItems = minimum;\n if (typeof maximum === \"number\")\n json.maxItems = maximum;\n};\n/** JSON object keys are always strings, so a numeric record key schema is re-expressed over the\n * numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key\n * behind a wrapper only carries its own `type` before then, and a union key only has its branches.\n *\n * A numeric bound cannot apply to a property name, so `minimum` and its siblings are dropped rather\n * than carried over: keeping them beside `type: \"string\"` reproduces the match-nothing schema this\n * exists to fix. A key that carries one therefore emits wider than the record parses — `z.record(z.number().min(5), V)`\n * accepts `\"3\"` — which is the deliberate trade, since throwing on it would reject an ordinary schema\n * outright. */\nfunction stringifyKeyNames(bySchema, json, visited) {\n // an extracted key that rewrites cannot go on sharing its definition — the string form a key position needs is not the number form every other reference wants — so it inlines. One that does not rewrite keeps the `$ref`.\n if (json.$ref) {\n // a recursive key holds its own reference inside its definition, so a node already on the path is left alone rather than resolved again\n if (visited.has(json))\n return json;\n visited.add(json);\n const def = bySchema.get(json)?.def;\n if (!def)\n return json;\n const inlined = stringifyKeyNames(bySchema, def, visited);\n return inlined === def ? json : inlined;\n }\n for (const keyword of [\"anyOf\", \"oneOf\"]) {\n const branches = json[keyword];\n if (!Array.isArray(branches))\n continue;\n const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));\n // rebuilding regardless would detach a key that had nothing to re-express, dropping its `$ref` and leaking the internal `id`\n if (mapped.some((branch, i) => branch !== branches[i]))\n json = { ...json, [keyword]: mapped };\n }\n // a member that already admits a string leaves the key unconstrained, so the node's own type re-expresses only when every member is numeric\n const types = Array.isArray(json.type) ? json.type : [json.type];\n const numericType = !types.includes(\"string\") && types.some((t) => t === \"number\" || t === \"integer\");\n // a heterogeneous key carries no type at all, so its numeric members are caught here instead\n const values = json.enum ?? (json.const !== undefined ? [json.const] : undefined);\n if (!numericType && !values?.some((v) => typeof v === \"number\"))\n return json;\n const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;\n if (rest.enum)\n rest.enum = rest.enum.map((v) => (typeof v === \"number\" ? String(v) : v));\n else if (typeof rest.const === \"number\")\n rest.const = String(rest.const);\n // a heterogeneous key keeps its absent type: the stringified members already say what a key may be\n if (!numericType)\n return rest;\n rest.type = \"string\";\n if (!values)\n rest.pattern = (types.includes(\"number\") ? regexes.number : regexes.integer).source;\n return rest;\n}\n/** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */\nconst pendingRecords = new WeakMap();\nfunction rewriteKeyNames(ctx) {\n // an extracted key is resolved by the object `extractToDef` left in its place, so the map is built once rather than searched per reference. `_zod.toJSONSchema` can hand the same object to two schemas, so the first entry carrying a body wins, as a search would have found it.\n const bySchema = new Map();\n for (const entry of ctx.seen.values()) {\n if (entry.def && !bySchema.has(entry.schema))\n bySchema.set(entry.schema, entry);\n }\n const rewrites = new Map();\n for (const record of pendingRecords.get(ctx) ?? []) {\n const seen = ctx.seen.get(record);\n const names = (seen?.def ?? seen?.schema)?.propertyNames;\n if (!names || names === true || rewrites.has(names))\n continue;\n const rewritten = stringifyKeyNames(bySchema, names, new Set());\n if (rewritten !== names)\n rewrites.set(names, rewritten);\n }\n if (!rewrites.size)\n return;\n // the flatten has already copied each record's own properties onto every wrapper by reference, and an extracted body is another such copy, so every carrier holding a rewritten key is updated together\n for (const entry of ctx.seen.values()) {\n for (const carrier of [entry.schema, entry.def]) {\n const rewritten = carrier && rewrites.get(carrier.propertyNames);\n if (rewritten)\n carrier.propertyNames = rewritten;\n }\n }\n}\nexport const recordProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n json.type = \"object\";\n // For looseRecord with regex patterns, use patternProperties. This correctly represents \"only validate keys matching the pattern\" semantics and composes well with allOf (intersections)\n const keyType = def.keyType;\n const patterns = aggregateChecks(keyType).patterns;\n if (def.mode === \"loose\" && patterns && patterns.size > 0) {\n // Use patternProperties for looseRecord with regex patterns\n const valueSchema = processSchema(def.valueType, ctx, {\n ...params,\n path: [...params.path, \"patternProperties\", \"*\"],\n });\n json.patternProperties = {};\n for (const pattern of patterns) {\n assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);\n }\n }\n else {\n // Default behavior: use propertyNames + additionalProperties\n if (ctx.target === \"draft-07\" || ctx.target === \"draft-2020-12\") {\n json.propertyNames = processSchema(def.keyType, ctx, {\n ...params,\n path: [...params.path, \"propertyNames\"],\n });\n let pending = pendingRecords.get(ctx);\n if (!pending) {\n pending = [];\n pendingRecords.set(ctx, pending);\n ctx.deferred.push(() => rewriteKeyNames(ctx));\n }\n pending.push(schema);\n }\n json.additionalProperties = processSchema(def.valueType, ctx, {\n ...params,\n path: [...params.path, \"additionalProperties\"],\n });\n }\n // Add required for keys with discrete values (enum, literal, etc.)\n const keyValues = keyType._zod.values;\n // Every key shares one value schema, so an optional-in value makes the whole key set omittable on input. Output keeps them: the exhaustive branch assigns every key, even one whose value came back undefined.\n const omittableOnInput = ctx.io === \"input\" && inputOptin(def.valueType) !== undefined;\n if (keyValues && !def.partial && !omittableOnInput) {\n const validKeyValues = [...keyValues].filter((v) => typeof v === \"string\" || typeof v === \"number\");\n if (validKeyValues.length > 0) {\n json.required = validKeyValues.map(String);\n }\n }\n};\nexport const nullableProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n const inner = processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n if (ctx.target === \"openapi-3.0\") {\n seen.ref = def.innerType;\n json.nullable = true;\n }\n else {\n json.anyOf = [inner, { type: \"null\" }];\n }\n};\nexport const nonoptionalProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\n/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.\n * A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other\n * unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */\nconst UNREPRESENTABLE_DEFAULT = Symbol();\nfunction serializeDefaultValue(value, schema, ctx, json, params) {\n let unrepresentable = false;\n const serialized = JSON.stringify(value, (_, val) => {\n if (typeof val !== \"bigint\")\n return val;\n unrepresentable = true;\n return null;\n });\n if (!unrepresentable)\n return JSON.parse(serialized);\n handleUnrepresentable(schema, ctx, json, params, \"BigInt defaults cannot be represented in JSON Schema\");\n return UNREPRESENTABLE_DEFAULT;\n}\nexport const defaultProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);\n if (value !== UNREPRESENTABLE_DEFAULT)\n json.default = value;\n};\nexport const prefaultProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n if (ctx.io !== \"input\")\n return;\n const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);\n if (value !== UNREPRESENTABLE_DEFAULT)\n json._prefault = value;\n};\nexport const catchProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n let catchValue;\n try {\n catchValue = def.catchValue(undefined);\n }\n catch {\n handleUnrepresentable(schema, ctx, json, params, \"Dynamic catch values are not supported in JSON Schema\");\n return;\n }\n json.default = catchValue;\n};\nexport const pipeProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n const inIsTransform = def.in._zod.traits.has(\"$ZodTransform\");\n const innerType = ctx.io === \"input\" ? (inIsTransform ? def.out : def.in) : def.out;\n processSchema(innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = innerType;\n};\nexport const readonlyProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n json.readOnly = true;\n};\nexport const promiseProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\nexport const optionalProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\nexport const lazyProcessor = (schema, ctx, _json, params) => {\n const innerType = schema._zod.innerType;\n processSchema(innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = innerType;\n};\n// ==================== ALL PROCESSORS ====================\nexport const allProcessors = {\n string: stringProcessor,\n number: numberProcessor,\n boolean: booleanProcessor,\n bigint: bigintProcessor,\n symbol: symbolProcessor,\n null: nullProcessor,\n undefined: undefinedProcessor,\n void: voidProcessor,\n never: neverProcessor,\n any: anyProcessor,\n unknown: unknownProcessor,\n date: dateProcessor,\n enum: enumProcessor,\n literal: literalProcessor,\n nan: nanProcessor,\n template_literal: templateLiteralProcessor,\n file: fileProcessor,\n success: successProcessor,\n custom: customProcessor,\n function: functionProcessor,\n transform: transformProcessor,\n map: mapProcessor,\n set: setProcessor,\n array: arrayProcessor,\n object: objectProcessor,\n union: unionProcessor,\n intersection: intersectionProcessor,\n tuple: tupleProcessor,\n record: recordProcessor,\n nullable: nullableProcessor,\n nonoptional: nonoptionalProcessor,\n default: defaultProcessor,\n prefault: prefaultProcessor,\n catch: catchProcessor,\n pipe: pipeProcessor,\n readonly: readonlyProcessor,\n promise: promiseProcessor,\n optional: optionalProcessor,\n lazy: lazyProcessor,\n};\nexport function toJSONSchema(input, params) {\n if (\"_idmap\" in input) {\n // Registry case\n const registry = input;\n const ctx = initializeContext({ ...params, processors: allProcessors });\n const defs = {};\n // First pass: process all schemas to build the seen map\n for (const entry of registry._idmap.entries()) {\n const [_, schema] = entry;\n processSchema(schema, ctx);\n }\n const schemas = {};\n const external = {\n registry,\n uri: params?.uri,\n defs,\n };\n // Update the context with external configuration\n ctx.external = external;\n // Second pass: emit each schema\n for (const entry of registry._idmap.entries()) {\n const [key, schema] = entry;\n extractDefs(ctx, schema);\n assignProp(schemas, key, finalize(ctx, schema));\n }\n if (Object.keys(defs).length > 0) {\n const defsSegment = ctx.target === \"draft-2020-12\" ? \"$defs\" : \"definitions\";\n schemas.__shared = {\n [defsSegment]: defs,\n };\n }\n return { schemas };\n }\n // Single schema case\n const ctx = initializeContext({ ...params, processors: allProcessors });\n processSchema(input, ctx);\n extractDefs(ctx, input);\n return finalize(ctx, input);\n}\n","import * as core from \"../core/index.js\";\nimport { $ZodError } from \"../core/index.js\";\nimport * as util from \"../core/util.js\";\n/* Prototypes that already carry the lazy helper methods. Seeded with the\n * intrinsics so that `init` on a foreign object — it accepts any object —\n * can never install an accessor onto a prototype we do not own. */\nconst _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);\n/* Helper methods live as non-enumerable lazy getters on the shared\n * prototype instead of own properties on every instance. On first\n * access the getter allocates the per-instance closure and caches it\n * as a non-enumerable own property, so detached usage still works and\n * the allocation only happens for methods actually touched. */\nfunction _lazyMethod(proto, key, make) {\n Object.defineProperty(proto, key, {\n configurable: true,\n enumerable: false,\n get() {\n const value = make(this);\n Object.defineProperty(this, key, { value, configurable: true, writable: true });\n return value;\n },\n set(value) {\n Object.defineProperty(this, key, { value, configurable: true, writable: true });\n },\n });\n}\nconst initializer = (inst, issues) => {\n $ZodError.init(inst, issues);\n inst.name = \"ZodError\";\n const proto = Object.getPrototypeOf(inst);\n if (_installedErrorProtos.has(proto))\n return;\n _installedErrorProtos.add(proto);\n _lazyMethod(proto, \"format\", (self) => (mapper) => core.formatError(self, mapper));\n _lazyMethod(proto, \"flatten\", (self) => (mapper) => core.flattenError(self, mapper));\n _lazyMethod(proto, \"addIssue\", (self) => (issue) => {\n self.issues.push(issue);\n self.message = JSON.stringify(self.issues, util.jsonStringifyReplacer, 2);\n });\n _lazyMethod(proto, \"addIssues\", (self) => (issues) => {\n self.issues.push(...issues);\n self.message = JSON.stringify(self.issues, util.jsonStringifyReplacer, 2);\n });\n Object.defineProperty(proto, \"isEmpty\", {\n configurable: true,\n enumerable: false,\n get() {\n return this.issues.length === 0;\n },\n });\n};\nexport const ZodError = /*@__PURE__*/ core.$constructor(\"ZodError\", initializer);\nexport const ZodRealError = /*@__PURE__*/ core.$constructor(\"ZodError\", initializer, undefined, {\n Parent: Error,\n});\n// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */\n// export type ErrorMapCtx = core.$ZodErrorMapCtx;\n","import * as core from \"../core/index.js\";\nimport { ZodRealError } from \"./errors.js\";\nexport const parse = /* @__PURE__ */ core._parse(ZodRealError);\nexport const parseAsync = /* @__PURE__ */ core._parseAsync(ZodRealError);\nexport const safeParse = /* @__PURE__ */ core._safeParse(ZodRealError);\nexport const safeParseAsync = /* @__PURE__ */ core._safeParseAsync(ZodRealError);\nexport { validate, validateAsync } from \"../core/index.js\";\n// Codec functions\nexport const encode = /* @__PURE__ */ core._encode(ZodRealError);\nexport const decode = /* @__PURE__ */ core._decode(ZodRealError);\nexport const encodeAsync = /* @__PURE__ */ core._encodeAsync(ZodRealError);\nexport const decodeAsync = /* @__PURE__ */ core._decodeAsync(ZodRealError);\nexport const safeEncode = /* @__PURE__ */ core._safeEncode(ZodRealError);\nexport const safeDecode = /* @__PURE__ */ core._safeDecode(ZodRealError);\nexport const safeEncodeAsync = /* @__PURE__ */ core._safeEncodeAsync(ZodRealError);\nexport const safeDecodeAsync = /* @__PURE__ */ core._safeDecodeAsync(ZodRealError);\n","import * as core from \"../core/index.js\";\nimport { util } from \"../core/index.js\";\nimport * as processors from \"../core/json-schema-processors.js\";\nimport * as regexes from \"../core/regexes.js\";\nimport { createStandardJSONSchemaMethod, createToJSONSchemaMethod } from \"../core/to-json-schema.js\";\nimport en from \"../locales/en.js\";\nimport * as checks from \"./checks.js\";\nimport * as parse from \"./parse.js\";\n// Register English as the default locale on first ZodType construction. Hooked into the `ZodType` `$constructor` (rather than a top-level `config(en())` in `external.ts`) so bundlers honoring `sideEffects: false` can't tree-shake it out — see #5953, #5725. An explicit `z.config(z.locales.xx())` call wins regardless of order, since this only sets the default when none is present.\nfunction _ensureDefaultLocale() {\n if (!core.globalConfig.localeError)\n core.config(en());\n}\n// the default memoizer is read by the core container init, which runs before `ZodType.init`, so each container calls this first\nfunction _ensureDefaultMemoizer() {\n if (!core.globalConfig.memoizer)\n core.config({ memoizer: core.memoizer() });\n}\nexport const ZodType = /*@__PURE__*/ core.$constructor(\"ZodType\", (inst, def) => {\n _ensureDefaultLocale();\n core.$ZodType.init(inst, def);\n inst.def = def;\n inst.type = def.type;\n return inst;\n}, {\n check(...chks) {\n const def = this.def;\n return this.clone(util.mergeDefs(def, {\n checks: [\n ...(def.checks ?? []),\n ...chks.map((ch) => typeof ch === \"function\" ? { _zod: { check: ch, def: { check: \"custom\" }, onattach: [] } } : ch),\n ],\n }), { parent: true });\n },\n with(...chks) {\n return this.check(...chks);\n },\n clone(def, params) {\n return core.clone(this, def, params);\n },\n brand() {\n return this;\n },\n register(reg, meta) {\n reg.add(this, meta);\n return this;\n },\n refine(check, params) {\n return this.check(refine(check, params));\n },\n superRefine(refinement, params) {\n return this.check(superRefine(refinement, params));\n },\n overwrite(fn) {\n return this.check(checks.overwrite(fn));\n },\n optional() {\n return optional(this);\n },\n exactOptional() {\n return exactOptional(this);\n },\n nullable() {\n return nullable(this);\n },\n nullish() {\n return optional(nullable(this));\n },\n nonoptional(params) {\n return nonoptional(this, params);\n },\n array() {\n return array(this);\n },\n or(arg) {\n return union([this, arg]);\n },\n and(arg) {\n return intersection(this, arg);\n },\n transform(tx) {\n return pipe(this, transform(tx));\n },\n default(d) {\n return _default(this, d);\n },\n prefault(d) {\n return prefault(this, d);\n },\n catch(params) {\n return _catch(this, params);\n },\n pipe(target) {\n return pipe(this, target);\n },\n readonly() {\n return readonly(this);\n },\n describe(description) {\n const cl = this.clone();\n core.globalRegistry.add(cl, { description });\n return cl;\n },\n meta(...args) {\n // overloaded: meta() returns the registered metadata, meta(data) returns a clone with `data` registered. The mapped type picks up the second overload, so we accept variadic any-args and return `any` to satisfy both at runtime.\n if (args.length === 0)\n return core.globalRegistry.get(this);\n const cl = this.clone();\n core.globalRegistry.add(cl, args[0]);\n return cl;\n },\n isOptional() {\n return this.safeParse(undefined).success;\n },\n isNullable() {\n return this.safeParse(null).success;\n },\n apply(fn, ...args) {\n return args.length === 0 ? fn(this) : fn(this, ...args);\n },\n // Overrides core's `~standard` to add `jsonSchema`. Must stay a prototype entry: redefining it per instance demotes instances to dictionary mode.\n get \"~standard\"() {\n return util.hide(this, \"~standard\", {\n ...core.standardProps(this),\n jsonSchema: {\n input: createStandardJSONSchemaMethod(this, \"input\"),\n output: createStandardJSONSchemaMethod(this, \"output\"),\n },\n });\n },\n set \"~standard\"(value) {\n util.own(this, \"~standard\", value);\n },\n parse: function _parse(data, params) {\n return parse.parse(this, data, params, { callee: _parse });\n },\n parseAsync: async function _parseAsync(data, params) {\n return await parse.parseAsync(this, data, params, { callee: _parseAsync });\n },\n safeParse(data, params) {\n return parse.safeParse(this, data, params);\n },\n async safeParseAsync(data, params) {\n return parse.safeParseAsync(this, data, params);\n },\n // `spa` is an alias: same function object as `safeParseAsync`, as before.\n get spa() {\n return this?.safeParseAsync;\n },\n set spa(value) {\n util.own(this, \"spa\", value);\n },\n validate(data, params) {\n return parse.validate(this, data, params);\n },\n validateAsync(data, params) {\n return parse.validateAsync(this, data, params);\n },\n encode: function _encode(data, params) {\n return parse.encode(this, data, params, { callee: _encode });\n },\n decode: function _decode(data, params) {\n return parse.decode(this, data, params, { callee: _decode });\n },\n encodeAsync: async function _encodeAsync(data, params) {\n return await parse.encodeAsync(this, data, params, { callee: _encodeAsync });\n },\n decodeAsync: async function _decodeAsync(data, params) {\n return await parse.decodeAsync(this, data, params, { callee: _decodeAsync });\n },\n safeEncode(data, params) {\n return parse.safeEncode(this, data, params);\n },\n safeDecode(data, params) {\n return parse.safeDecode(this, data, params);\n },\n async safeEncodeAsync(data, params) {\n return parse.safeEncodeAsync(this, data, params);\n },\n async safeDecodeAsync(data, params) {\n return parse.safeDecodeAsync(this, data, params);\n },\n toJSONSchema(params) {\n return createToJSONSchemaMethod(this, {})(params);\n },\n // Reads through to the registry on every access, so it must not cache.\n get description() {\n return core.globalRegistry.get(this)?.description;\n },\n // No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property.\n get _def() {\n return this._zod.def;\n },\n});\n/** @internal */\nexport const _ZodString = /*@__PURE__*/ core.$constructor(\"_ZodString\", (inst, def) => {\n core.$ZodString.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.stringProcessor(inst, ctx, json, params);\n}, \n/*@__PURE__*/ util.derived({\n format: (inst) => processors.aggregateChecks(inst).format ?? null,\n minLength: (inst) => processors.aggregateChecks(inst).minimum ?? null,\n maxLength: (inst) => processors.aggregateChecks(inst).maximum ?? null,\n}, {\n regex(...args) {\n return this.check(checks.regex(...args));\n },\n includes(...args) {\n return this.check(checks.includes(...args));\n },\n startsWith(...args) {\n return this.check(checks.startsWith(...args));\n },\n endsWith(...args) {\n return this.check(checks.endsWith(...args));\n },\n min(...args) {\n return this.check(checks.minLength(...args));\n },\n max(...args) {\n return this.check(checks.maxLength(...args));\n },\n length(...args) {\n return this.check(checks.length(...args));\n },\n nonempty(...args) {\n return this.check(checks.minLength(1, ...args));\n },\n lowercase(params) {\n return this.check(checks.lowercase(params));\n },\n uppercase(params) {\n return this.check(checks.uppercase(params));\n },\n trim() {\n return this.check(checks.trim());\n },\n normalize(...args) {\n return this.check(checks.normalize(...args));\n },\n toLowerCase() {\n return this.check(checks.toLowerCase());\n },\n toUpperCase() {\n return this.check(checks.toUpperCase());\n },\n slugify() {\n return this.check(checks.slugify());\n },\n}));\nexport const ZodString = /*@__PURE__*/ core.$constructor(\"ZodString\", (inst, def) => {\n core.$ZodString.init(inst, def);\n _ZodString.init(inst, def);\n}, {\n email(params) {\n return this.check(core._email(ZodEmail, params));\n },\n url(params) {\n return this.check(core._url(ZodURL, params));\n },\n jwt(params) {\n return this.check(core._jwt(ZodJWT, params));\n },\n emoji(params) {\n return this.check(core._emoji(ZodEmoji, params));\n },\n guid(params) {\n return this.check(core._guid(ZodGUID, params));\n },\n uuid(params) {\n return this.check(core._uuid(ZodUUID, params));\n },\n uuidv4(params) {\n return this.check(core._uuidv4(ZodUUID, params));\n },\n uuidv6(params) {\n return this.check(core._uuidv6(ZodUUID, params));\n },\n uuidv7(params) {\n return this.check(core._uuidv7(ZodUUID, params));\n },\n nanoid(params) {\n return this.check(core._nanoid(ZodNanoID, params));\n },\n cuid(params) {\n return this.check(core._cuid(ZodCUID, params));\n },\n cuid2(params) {\n return this.check(core._cuid2(ZodCUID2, params));\n },\n ulid(params) {\n return this.check(core._ulid(ZodULID, params));\n },\n base64(params) {\n return this.check(core._base64(ZodBase64, params));\n },\n base64url(params) {\n return this.check(core._base64url(ZodBase64URL, params));\n },\n xid(params) {\n return this.check(core._xid(ZodXID, params));\n },\n ksuid(params) {\n return this.check(core._ksuid(ZodKSUID, params));\n },\n ipv4(params) {\n return this.check(core._ipv4(ZodIPv4, params));\n },\n ipv6(params) {\n return this.check(core._ipv6(ZodIPv6, params));\n },\n cidrv4(params) {\n return this.check(core._cidrv4(ZodCIDRv4, params));\n },\n cidrv6(params) {\n return this.check(core._cidrv6(ZodCIDRv6, params));\n },\n e164(params) {\n return this.check(core._e164(ZodE164, params));\n },\n datetime(params) {\n return this.check(core._isoDateTime(ZodISODateTime, params));\n },\n date(params) {\n return this.check(core._isoDate(ZodISODate, params));\n },\n time(params) {\n return this.check(core._isoTime(ZodISOTime, params));\n },\n duration(params) {\n return this.check(core._isoDuration(ZodISODuration, params));\n },\n});\nexport function string(params) {\n return core._string(ZodString, params);\n}\nexport const ZodStringFormat = /*@__PURE__*/ core.$constructor(\"ZodStringFormat\", (inst, def) => {\n core.$ZodStringFormat.init(inst, def);\n _ZodString.init(inst, def);\n});\nexport const ZodISODateTime = /*@__PURE__*/ core.$constructor(\"ZodISODateTime\", (inst, def) => {\n core.$ZodISODateTime.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport const ZodISODate = /*@__PURE__*/ core.$constructor(\"ZodISODate\", (inst, def) => {\n core.$ZodISODate.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport const ZodISOTime = /*@__PURE__*/ core.$constructor(\"ZodISOTime\", (inst, def) => {\n core.$ZodISOTime.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport const ZodISODuration = /*@__PURE__*/ core.$constructor(\"ZodISODuration\", (inst, def) => {\n core.$ZodISODuration.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport const ZodEmail = /*@__PURE__*/ core.$constructor(\"ZodEmail\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodEmail.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function email(params) {\n return core._email(ZodEmail, params);\n}\nexport const ZodGUID = /*@__PURE__*/ core.$constructor(\"ZodGUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodGUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function guid(params) {\n return core._guid(ZodGUID, params);\n}\nexport const ZodUUID = /*@__PURE__*/ core.$constructor(\"ZodUUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodUUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function uuid(params) {\n return core._uuid(ZodUUID, params);\n}\nexport function uuidv4(params) {\n return core._uuidv4(ZodUUID, params);\n}\n// ZodUUIDv6\nexport function uuidv6(params) {\n return core._uuidv6(ZodUUID, params);\n}\n// ZodUUIDv7\nexport function uuidv7(params) {\n return core._uuidv7(ZodUUID, params);\n}\nexport const ZodURL = /*@__PURE__*/ core.$constructor(\"ZodURL\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodURL.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function url(params) {\n return core._url(ZodURL, params);\n}\nexport function httpUrl(params) {\n return core._url(ZodURL, {\n protocol: regexes.httpProtocol,\n hostname: regexes.domain,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodEmoji = /*@__PURE__*/ core.$constructor(\"ZodEmoji\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodEmoji.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function emoji(params) {\n return core._emoji(ZodEmoji, params);\n}\nexport const ZodNanoID = /*@__PURE__*/ core.$constructor(\"ZodNanoID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodNanoID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function nanoid(params) {\n return core._nanoid(ZodNanoID, params);\n}\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link ZodCUID2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const ZodCUID = /*@__PURE__*/ core.$constructor(\"ZodCUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodCUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\n/**\n * Validates a CUID v1 string.\n *\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport function cuid(params) {\n return core._cuid(ZodCUID, params);\n}\nexport const ZodCUID2 = /*@__PURE__*/ core.$constructor(\"ZodCUID2\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodCUID2.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function cuid2(params) {\n return core._cuid2(ZodCUID2, params);\n}\nexport const ZodULID = /*@__PURE__*/ core.$constructor(\"ZodULID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodULID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ulid(params) {\n return core._ulid(ZodULID, params);\n}\nexport const ZodXID = /*@__PURE__*/ core.$constructor(\"ZodXID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodXID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function xid(params) {\n return core._xid(ZodXID, params);\n}\nexport const ZodKSUID = /*@__PURE__*/ core.$constructor(\"ZodKSUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodKSUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ksuid(params) {\n return core._ksuid(ZodKSUID, params);\n}\nexport const ZodIPv4 = /*@__PURE__*/ core.$constructor(\"ZodIPv4\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodIPv4.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ipv4(params) {\n return core._ipv4(ZodIPv4, params);\n}\nexport const ZodMAC = /*@__PURE__*/ core.$constructor(\"ZodMAC\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodMAC.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function mac(params) {\n return core._mac(ZodMAC, params);\n}\nexport const ZodIPv6 = /*@__PURE__*/ core.$constructor(\"ZodIPv6\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodIPv6.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ipv6(params) {\n return core._ipv6(ZodIPv6, params);\n}\nexport const ZodCIDRv4 = /*@__PURE__*/ core.$constructor(\"ZodCIDRv4\", (inst, def) => {\n core.$ZodCIDRv4.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function cidrv4(params) {\n return core._cidrv4(ZodCIDRv4, params);\n}\nexport const ZodCIDRv6 = /*@__PURE__*/ core.$constructor(\"ZodCIDRv6\", (inst, def) => {\n core.$ZodCIDRv6.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function cidrv6(params) {\n return core._cidrv6(ZodCIDRv6, params);\n}\nexport const ZodBase64 = /*@__PURE__*/ core.$constructor(\"ZodBase64\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodBase64.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function base64(params) {\n return core._base64(ZodBase64, params);\n}\nexport const ZodBase64URL = /*@__PURE__*/ core.$constructor(\"ZodBase64URL\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodBase64URL.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function base64url(params) {\n return core._base64url(ZodBase64URL, params);\n}\nexport const ZodE164 = /*@__PURE__*/ core.$constructor(\"ZodE164\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodE164.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function e164(params) {\n return core._e164(ZodE164, params);\n}\nexport const ZodCreditCard = /*@__PURE__*/ core.$constructor(\"ZodCreditCard\", (inst, def) => {\n core.$ZodCreditCard.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function creditCard(params) {\n return core._creditCard(ZodCreditCard, params);\n}\nexport const ZodIBAN = /*@__PURE__*/ core.$constructor(\"ZodIBAN\", (inst, def) => {\n core.$ZodIBAN.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function iban(params) {\n return core._iban(ZodIBAN, params);\n}\nexport const ZodJWT = /*@__PURE__*/ core.$constructor(\"ZodJWT\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodJWT.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function jwt(params) {\n return core._jwt(ZodJWT, params);\n}\nexport const ZodCustomStringFormat = /*@__PURE__*/ core.$constructor(\"ZodCustomStringFormat\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodCustomStringFormat.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function stringFormat(format, fnOrRegex, _params = {}) {\n return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);\n}\nexport function hostname(_params) {\n return core._stringFormat(ZodCustomStringFormat, \"hostname\", regexes.hostname, _params);\n}\nexport function hex(_params) {\n return core._stringFormat(ZodCustomStringFormat, \"hex\", regexes.hex, _params);\n}\nexport function currencyCode(_params) {\n return core._stringFormat(ZodCustomStringFormat, \"currency_code\", regexes.currencyCode, _params);\n}\nexport function hash(alg, params) {\n const enc = params?.enc ?? \"hex\";\n const format = `${alg}_${enc}`;\n const regex = core.regexes[format];\n if (!regex)\n throw new Error(`Unrecognized hash format: ${format}`);\n return core._stringFormat(ZodCustomStringFormat, format, regex, params);\n}\nexport const ZodNumber = /*@__PURE__*/ core.$constructor(\"ZodNumber\", (inst, def) => {\n core.$ZodNumber.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);\n inst.isFinite = true;\n}, \n/*@__PURE__*/ util.derived({\n minValue: (inst) => {\n const { minimum, exclusiveMinimum } = processors.aggregateChecks(inst);\n return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);\n },\n maxValue: (inst) => {\n const { maximum, exclusiveMaximum } = processors.aggregateChecks(inst);\n return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);\n },\n isInt: (inst) => {\n const { isInt, multipleOf } = processors.aggregateChecks(inst);\n return !!isInt || !!multipleOf?.some(Number.isSafeInteger);\n },\n format: (inst) => processors.aggregateChecks(inst).format ?? null,\n}, {\n gt(value, params) {\n return this.check(checks.gt(value, params));\n },\n gte(value, params) {\n return this.check(checks.gte(value, params));\n },\n min(value, params) {\n return this.check(checks.gte(value, params));\n },\n lt(value, params) {\n return this.check(checks.lt(value, params));\n },\n lte(value, params) {\n return this.check(checks.lte(value, params));\n },\n max(value, params) {\n return this.check(checks.lte(value, params));\n },\n int(params) {\n return this.check(int(params));\n },\n safe(params) {\n return this.check(int(params));\n },\n positive(params) {\n return this.check(checks.gt(0, params));\n },\n nonnegative(params) {\n return this.check(checks.gte(0, params));\n },\n negative(params) {\n return this.check(checks.lt(0, params));\n },\n nonpositive(params) {\n return this.check(checks.lte(0, params));\n },\n multipleOf(value, params) {\n return this.check(checks.multipleOf(value, params));\n },\n step(value, params) {\n return this.check(checks.multipleOf(value, params));\n },\n finite() {\n return this;\n },\n}));\nexport function number(params) {\n return core._number(ZodNumber, params);\n}\nexport const ZodNumberFormat = /*@__PURE__*/ core.$constructor(\"ZodNumberFormat\", (inst, def) => {\n core.$ZodNumberFormat.init(inst, def);\n ZodNumber.init(inst, def);\n});\nexport function int(params) {\n return core._int(ZodNumberFormat, params);\n}\nexport function float32(params) {\n return core._float32(ZodNumberFormat, params);\n}\nexport function float64(params) {\n return core._float64(ZodNumberFormat, params);\n}\nexport function int32(params) {\n return core._int32(ZodNumberFormat, params);\n}\nexport function uint32(params) {\n return core._uint32(ZodNumberFormat, params);\n}\nexport const ZodBoolean = /*@__PURE__*/ core.$constructor(\"ZodBoolean\", (inst, def) => {\n core.$ZodBoolean.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.booleanProcessor(inst, ctx, json, params);\n});\nexport function boolean(params) {\n return core._boolean(ZodBoolean, params);\n}\nexport const ZodBigInt = /*@__PURE__*/ core.$constructor(\"ZodBigInt\", (inst, def) => {\n core.$ZodBigInt.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);\n}, \n/*@__PURE__*/ util.derived({\n minValue: (inst) => processors.aggregateChecks(inst).minimum ?? null,\n maxValue: (inst) => processors.aggregateChecks(inst).maximum ?? null,\n format: (inst) => processors.aggregateChecks(inst).format ?? null,\n}, {\n gte(value, params) {\n return this.check(checks.gte(value, params));\n },\n min(value, params) {\n return this.check(checks.gte(value, params));\n },\n gt(value, params) {\n return this.check(checks.gt(value, params));\n },\n lt(value, params) {\n return this.check(checks.lt(value, params));\n },\n lte(value, params) {\n return this.check(checks.lte(value, params));\n },\n max(value, params) {\n return this.check(checks.lte(value, params));\n },\n positive(params) {\n return this.check(checks.gt(BigInt(0), params));\n },\n negative(params) {\n return this.check(checks.lt(BigInt(0), params));\n },\n nonpositive(params) {\n return this.check(checks.lte(BigInt(0), params));\n },\n nonnegative(params) {\n return this.check(checks.gte(BigInt(0), params));\n },\n multipleOf(value, params) {\n return this.check(checks.multipleOf(value, params));\n },\n}));\nexport function bigint(params) {\n return core._bigint(ZodBigInt, params);\n}\nexport const ZodBigIntFormat = /*@__PURE__*/ core.$constructor(\"ZodBigIntFormat\", (inst, def) => {\n core.$ZodBigIntFormat.init(inst, def);\n ZodBigInt.init(inst, def);\n});\nexport function int64(params) {\n return core._int64(ZodBigIntFormat, params);\n}\nexport function uint64(params) {\n return core._uint64(ZodBigIntFormat, params);\n}\nexport const ZodSymbol = /*@__PURE__*/ core.$constructor(\"ZodSymbol\", (inst, def) => {\n core.$ZodSymbol.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.symbolProcessor(inst, ctx, json, params);\n});\nexport function symbol(params) {\n return core._symbol(ZodSymbol, params);\n}\nexport const ZodUndefined = /*@__PURE__*/ core.$constructor(\"ZodUndefined\", (inst, def) => {\n core.$ZodUndefined.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.undefinedProcessor(inst, ctx, json, params);\n});\nfunction _undefined(params) {\n return core._undefined(ZodUndefined, params);\n}\nexport { _undefined as undefined };\nexport const ZodNull = /*@__PURE__*/ core.$constructor(\"ZodNull\", (inst, def) => {\n core.$ZodNull.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nullProcessor(inst, ctx, json, params);\n});\nfunction _null(params) {\n return core._null(ZodNull, params);\n}\nexport { _null as null };\nexport const ZodAny = /*@__PURE__*/ core.$constructor(\"ZodAny\", (inst, def) => {\n core.$ZodAny.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.anyProcessor(inst, ctx, json, params);\n});\nexport function any() {\n return core._any(ZodAny);\n}\nexport const ZodUnknown = /*@__PURE__*/ core.$constructor(\"ZodUnknown\", (inst, def) => {\n core.$ZodUnknown.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.unknownProcessor(inst, ctx, json, params);\n});\nexport function unknown() {\n return core._unknown(ZodUnknown);\n}\nexport const ZodNever = /*@__PURE__*/ core.$constructor(\"ZodNever\", (inst, def) => {\n core.$ZodNever.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.neverProcessor(inst, ctx, json, params);\n});\nexport function never(params) {\n return core._never(ZodNever, params);\n}\nexport const ZodVoid = /*@__PURE__*/ core.$constructor(\"ZodVoid\", (inst, def) => {\n core.$ZodVoid.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.voidProcessor(inst, ctx, json, params);\n});\nfunction _void(params) {\n return core._void(ZodVoid, params);\n}\nexport { _void as void };\nexport const ZodDate = /*@__PURE__*/ core.$constructor(\"ZodDate\", (inst, def) => {\n core.$ZodDate.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);\n inst.min = (value, params) => inst.check(checks.gte(value, params));\n inst.max = (value, params) => inst.check(checks.lte(value, params));\n}, \n/*@__PURE__*/ util.derived({\n minDate: (inst) => {\n const { minimum } = processors.aggregateChecks(inst);\n return minimum ? new Date(minimum) : null;\n },\n maxDate: (inst) => {\n const { maximum } = processors.aggregateChecks(inst);\n return maximum ? new Date(maximum) : null;\n },\n}, {}));\nexport function date(params) {\n return core._date(ZodDate, params);\n}\nexport const ZodArray = /*@__PURE__*/ core.$constructor(\"ZodArray\", (inst, def) => {\n _ensureDefaultMemoizer();\n core.$ZodArray.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);\n inst.element = def.element;\n}, {\n min(n, params) {\n return this.check(checks.minLength(n, params));\n },\n nonempty(params) {\n return this.check(checks.minLength(1, params));\n },\n max(n, params) {\n return this.check(checks.maxLength(n, params));\n },\n length(n, params) {\n return this.check(checks.length(n, params));\n },\n unwrap() {\n return this.element;\n },\n});\nexport function array(element, params) {\n return core._array(ZodArray, element, params);\n}\n// .keyof\nexport function keyof(schema) {\n const shape = schema._zod.def.shape;\n return _enum(Object.keys(shape));\n}\nexport const ZodObject = /*@__PURE__*/ core.$constructor(\"ZodObject\", (inst, def) => {\n _ensureDefaultMemoizer();\n core.$ZodObjectJIT.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.objectProcessor(inst, ctx, json, params);\n util.installLazyProp(inst, \"shape\", (self) => self._zod.def.shape, false);\n}, {\n keyof() {\n return _enum(Object.keys(this._zod.def.shape));\n },\n catchall(catchall) {\n // `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree\n return this.clone(util.mergeDefs(this._zod.def, { catchall: catchall }));\n },\n passthrough() {\n return this.clone(util.mergeDefs(this._zod.def, { catchall: unknown() }));\n },\n loose() {\n return this.clone(util.mergeDefs(this._zod.def, { catchall: unknown() }));\n },\n strict() {\n return this.clone(util.mergeDefs(this._zod.def, { catchall: never() }));\n },\n strip() {\n return this.clone(util.mergeDefs(this._zod.def, { catchall: undefined }));\n },\n extend(incoming) {\n return util.extend(this, incoming);\n },\n safeExtend(incoming) {\n return util.safeExtend(this, incoming);\n },\n merge(other) {\n return util.merge(this, other);\n },\n pick(mask) {\n return util.pick(this, mask);\n },\n omit(mask) {\n return util.omit(this, mask);\n },\n partial(...args) {\n return util.partial(ZodOptional, this, args[0]);\n },\n exactPartial(...args) {\n return util.partial(ZodExactOptional, this, args[0], \"exactPartial\");\n },\n required(...args) {\n return util.required(ZodNonOptional, this, args[0]);\n },\n});\nexport function object(shape, params) {\n const def = {\n type: \"object\",\n shape: shape ?? {},\n ...util.normalizeParams(params),\n };\n return new ZodObject(def);\n}\n// strictObject\nexport function strictObject(shape, params) {\n return new ZodObject({\n type: \"object\",\n shape,\n catchall: never(),\n ...util.normalizeParams(params),\n });\n}\n// looseObject\nexport function looseObject(shape, params) {\n return new ZodObject({\n type: \"object\",\n shape,\n catchall: unknown(),\n ...util.normalizeParams(params),\n });\n}\nexport const ZodUnion = /*@__PURE__*/ core.$constructor(\"ZodUnion\", (inst, def) => {\n core.$ZodUnion.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);\n inst.options = def.options;\n});\nexport function union(options, params) {\n return new ZodUnion({\n type: \"union\",\n options: options,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodXor = /*@__PURE__*/ core.$constructor(\"ZodXor\", (inst, def) => {\n ZodUnion.init(inst, def);\n core.$ZodXor.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);\n inst.options = def.options;\n});\n/** Creates an exclusive union (XOR) where exactly one option must match.\n * Unlike regular unions that succeed when any option matches, xor fails if\n * zero or more than one option matches the input. */\nexport function xor(options, params) {\n return new ZodXor({\n type: \"union\",\n options: options,\n inclusive: false,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodDiscriminatedUnion = /*@__PURE__*/ core.$constructor(\"ZodDiscriminatedUnion\", (inst, def) => {\n ZodUnion.init(inst, def);\n core.$ZodDiscriminatedUnion.init(inst, def);\n});\nexport function discriminatedUnion(discriminator, options, params) {\n // const [options, params] = args;\n return new ZodDiscriminatedUnion({\n type: \"union\",\n options: options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodIntersection = /*@__PURE__*/ core.$constructor(\"ZodIntersection\", (inst, def) => {\n core.$ZodIntersection.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.intersectionProcessor(inst, ctx, json, params);\n});\nexport function intersection(left, right) {\n return new ZodIntersection({\n type: \"intersection\",\n left: left,\n right: right,\n });\n}\nexport const ZodTuple = /*@__PURE__*/ core.$constructor(\"ZodTuple\", (inst, def) => {\n _ensureDefaultMemoizer();\n core.$ZodTuple.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.tupleProcessor(inst, ctx, json, params);\n}, {\n rest(rest) {\n return this.clone({\n ...this._zod.def,\n rest: rest,\n });\n },\n partial() {\n const def = this._zod.def;\n // a refinement was authored against the full arity; partialing would run it on a shorter array\n if (def.checks?.length)\n throw new Error(\".partial() cannot be used on tuple schemas containing refinements\");\n return this.clone({\n ...def,\n items: def.items.map((item) => new ZodOptional({ type: \"optional\", innerType: item })),\n });\n },\n});\nexport function tuple(items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof core.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new ZodTuple({\n type: \"tuple\",\n items: items,\n rest,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodRecord = /*@__PURE__*/ core.$constructor(\"ZodRecord\", (inst, def) => {\n _ensureDefaultMemoizer();\n core.$ZodRecord.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.recordProcessor(inst, ctx, json, params);\n inst.keyType = def.keyType;\n inst.valueType = def.valueType;\n});\nexport function record(keyType, valueType, params) {\n // v3-compat: z.record(valueType, params?) — defaults keyType to z.string()\n if (!valueType || !valueType._zod) {\n return new ZodRecord({\n type: \"record\",\n keyType: string(),\n valueType: keyType,\n ...util.normalizeParams(valueType),\n });\n }\n return new ZodRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\n// type alksjf = core.output<core.$ZodRecordKey>;\nexport function partialRecord(keyType, valueType, params) {\n return new ZodRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n partial: true,\n });\n}\nexport function looseRecord(keyType, valueType, params) {\n return new ZodRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n mode: \"loose\",\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMap = /*@__PURE__*/ core.$constructor(\"ZodMap\", (inst, def) => {\n _ensureDefaultMemoizer();\n core.$ZodMap.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.mapProcessor(inst, ctx, json, params);\n inst.keyType = def.keyType;\n inst.valueType = def.valueType;\n inst.min = (...args) => inst.check(core._minSize(...args));\n inst.nonempty = (params) => inst.check(core._minSize(1, params));\n inst.max = (...args) => inst.check(core._maxSize(...args));\n inst.size = (...args) => inst.check(core._size(...args));\n});\nexport function map(keyType, valueType, params) {\n return new ZodMap({\n type: \"map\",\n keyType: keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodSet = /*@__PURE__*/ core.$constructor(\"ZodSet\", (inst, def) => {\n _ensureDefaultMemoizer();\n core.$ZodSet.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);\n inst.min = (...args) => inst.check(core._minSize(...args));\n inst.nonempty = (params) => inst.check(core._minSize(1, params));\n inst.max = (...args) => inst.check(core._maxSize(...args));\n inst.size = (...args) => inst.check(core._size(...args));\n});\nexport function set(valueType, params) {\n return new ZodSet({\n type: \"set\",\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodEnum = /*@__PURE__*/ core.$constructor(\"ZodEnum\", (inst, def) => {\n core.$ZodEnum.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.enumProcessor(inst, ctx, json, params);\n inst.enum = def.entries;\n // reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out\n inst.options = [...inst._zod.values];\n const keys = new Set(Object.keys(def.entries));\n inst.extract = (values, params) => {\n const newEntries = {};\n for (const value of values) {\n if (keys.has(value)) {\n newEntries[value] = def.entries[value];\n }\n else\n throw new Error(`Key ${value} not found in enum`);\n }\n return new ZodEnum({\n ...def,\n checks: [],\n ...util.normalizeParams(params),\n entries: newEntries,\n });\n };\n inst.exclude = (values, params) => {\n const newEntries = { ...def.entries };\n for (const value of values) {\n if (keys.has(value)) {\n delete newEntries[value];\n }\n else\n throw new Error(`Key ${value} not found in enum`);\n }\n return new ZodEnum({\n ...def,\n checks: [],\n ...util.normalizeParams(params),\n entries: newEntries,\n });\n };\n});\nfunction _enum(values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n return new ZodEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport { _enum as enum };\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function nativeEnum(entries, params) {\n return new ZodEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodLiteral = /*@__PURE__*/ core.$constructor(\"ZodLiteral\", (inst, def) => {\n core.$ZodLiteral.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.literalProcessor(inst, ctx, json, params);\n inst.values = new Set(def.values);\n Object.defineProperty(inst, \"value\", {\n get() {\n if (def.values.length > 1) {\n throw new Error(\"This schema contains multiple valid literal values. Use `.values` instead.\");\n }\n return def.values[0];\n },\n });\n});\nexport function literal(value, params) {\n return new ZodLiteral({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\nexport const ZodFile = /*@__PURE__*/ core.$constructor(\"ZodFile\", (inst, def) => {\n core.$ZodFile.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.fileProcessor(inst, ctx, json, params);\n inst.min = (size, params) => inst.check(core._minSize(size, params));\n inst.max = (size, params) => inst.check(core._maxSize(size, params));\n inst.mime = (types, params) => inst.check(core._mime(Array.isArray(types) ? types : [types], params));\n});\nexport function file(params) {\n return core._file(ZodFile, params);\n}\nexport const ZodTransform = /*@__PURE__*/ core.$constructor(\"ZodTransform\", (inst, def) => {\n _ensureDefaultMemoizer();\n core.$ZodTransform.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.transformProcessor(inst, ctx, json, params);\n inst._zod.parse = (payload, _ctx) => {\n if (_ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(inst.constructor.name);\n }\n payload.addIssue = (issue) => {\n if (typeof issue === \"string\") {\n payload.issues.push(util.issue(issue, payload.value, def));\n }\n else {\n // for Zod 3 backwards compatibility\n const _issue = issue;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = \"custom\");\n if (!(\"input\" in _issue))\n _issue.input = payload.value;\n _issue.inst ?? (_issue.inst = inst);\n // _issue.continue ??= true;\n payload.issues.push(util.issue(_issue));\n }\n };\n const output = def.transform(payload.value, payload);\n if (output instanceof Promise) {\n return output.then((output) => {\n payload.value = output;\n return payload;\n });\n }\n payload.value = output;\n return payload;\n };\n});\nexport function transform(fn) {\n return new ZodTransform({\n type: \"transform\",\n transform: fn,\n });\n}\nexport const ZodOptional = /*@__PURE__*/ core.$constructor(\"ZodOptional\", (inst, def) => {\n core.$ZodOptional.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function optional(innerType) {\n return new ZodOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodExactOptional = /*@__PURE__*/ core.$constructor(\"ZodExactOptional\", (inst, def) => {\n core.$ZodExactOptional.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function exactOptional(innerType) {\n return new ZodExactOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodNullable = /*@__PURE__*/ core.$constructor(\"ZodNullable\", (inst, def) => {\n core.$ZodNullable.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nullableProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function nullable(innerType) {\n return new ZodNullable({\n type: \"nullable\",\n innerType: innerType,\n });\n}\n// nullish\nexport function nullish(innerType) {\n return optional(nullable(innerType));\n}\nexport const ZodDefault = /*@__PURE__*/ core.$constructor(\"ZodDefault\", (inst, def) => {\n core.$ZodDefault.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.defaultProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n inst.removeDefault = inst.unwrap;\n});\nexport function _default(innerType, defaultValue) {\n return new ZodDefault({\n type: \"default\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodPrefault = /*@__PURE__*/ core.$constructor(\"ZodPrefault\", (inst, def) => {\n core.$ZodPrefault.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.prefaultProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function prefault(innerType, defaultValue) {\n return new ZodPrefault({\n type: \"prefault\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodNonOptional = /*@__PURE__*/ core.$constructor(\"ZodNonOptional\", (inst, def) => {\n core.$ZodNonOptional.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nonoptionalProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function nonoptional(innerType, params) {\n return new ZodNonOptional({\n type: \"nonoptional\",\n innerType: innerType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodSuccess = /*@__PURE__*/ core.$constructor(\"ZodSuccess\", (inst, def) => {\n core.$ZodSuccess.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.successProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function success(innerType) {\n return new ZodSuccess({\n type: \"success\",\n innerType: innerType,\n });\n}\nexport const ZodCatch = /*@__PURE__*/ core.$constructor(\"ZodCatch\", (inst, def) => {\n core.$ZodCatch.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.catchProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n inst.removeCatch = inst.unwrap;\n});\nfunction _catch(innerType, catchValue) {\n return new ZodCatch({\n type: \"catch\",\n innerType: innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : core.util.constantCatch(catchValue)),\n });\n}\nexport { _catch as catch };\nexport const ZodNaN = /*@__PURE__*/ core.$constructor(\"ZodNaN\", (inst, def) => {\n core.$ZodNaN.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nanProcessor(inst, ctx, json, params);\n});\nexport function nan(params) {\n return core._nan(ZodNaN, params);\n}\nexport const ZodPipe = /*@__PURE__*/ core.$constructor(\"ZodPipe\", (inst, def) => {\n core.$ZodPipe.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.pipeProcessor(inst, ctx, json, params);\n inst.in = def.in;\n inst.out = def.out;\n});\nexport function pipe(in_, out) {\n return new ZodPipe({\n type: \"pipe\",\n in: in_,\n out: out,\n // ...util.normalizeParams(params),\n });\n}\nexport const ZodCodec = /*@__PURE__*/ core.$constructor(\"ZodCodec\", (inst, def) => {\n ZodPipe.init(inst, def);\n core.$ZodCodec.init(inst, def);\n});\nexport function codec(in_, out, params) {\n return new ZodCodec({\n type: \"pipe\",\n in: in_,\n out: out,\n transform: params.decode,\n reverseTransform: params.encode,\n });\n}\nexport function invertCodec(codec) {\n const def = codec._zod.def;\n return new ZodCodec({\n type: \"pipe\",\n in: def.out,\n out: def.in,\n transform: def.reverseTransform,\n reverseTransform: def.transform,\n });\n}\nexport const ZodPreprocess = /*@__PURE__*/ core.$constructor(\"ZodPreprocess\", (inst, def) => {\n ZodPipe.init(inst, def);\n core.$ZodPreprocess.init(inst, def);\n});\nexport const ZodReadonly = /*@__PURE__*/ core.$constructor(\"ZodReadonly\", (inst, def) => {\n core.$ZodReadonly.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.readonlyProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function readonly(innerType) {\n return new ZodReadonly({\n type: \"readonly\",\n innerType: innerType,\n });\n}\nexport const ZodTemplateLiteral = /*@__PURE__*/ core.$constructor(\"ZodTemplateLiteral\", (inst, def) => {\n core.$ZodTemplateLiteral.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.templateLiteralProcessor(inst, ctx, json, params);\n});\nexport function templateLiteral(parts, params) {\n return new ZodTemplateLiteral({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodLazy = /*@__PURE__*/ core.$constructor(\"ZodLazy\", (inst, def) => {\n core.$ZodLazy.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.lazyProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.getter();\n});\nexport function lazy(getter) {\n return new ZodLazy({\n type: \"lazy\",\n getter: getter,\n });\n}\nexport const ZodPromise = /*@__PURE__*/ core.$constructor(\"ZodPromise\", (inst, def) => {\n core.$ZodPromise.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.promiseProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function promise(innerType) {\n return new ZodPromise({\n type: \"promise\",\n innerType: innerType,\n });\n}\nexport const ZodFunction = /*@__PURE__*/ core.$constructor(\"ZodFunction\", (inst, def) => {\n core.$ZodFunction.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.functionProcessor(inst, ctx, json, params);\n});\nexport function _function(params) {\n return new ZodFunction({\n type: \"function\",\n input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),\n output: params?.output ?? unknown(),\n });\n}\nexport { _function as function };\nexport const ZodCustom = /*@__PURE__*/ core.$constructor(\"ZodCustom\", (inst, def) => {\n core.$ZodCustom.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.customProcessor(inst, ctx, json, params);\n});\n// custom checks\nexport function check(fn) {\n const ch = new core.$ZodCheck({\n check: \"custom\",\n // ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\nexport function custom(fn, _params) {\n return core._custom(ZodCustom, fn ?? (() => true), _params);\n}\nexport function refine(fn, _params = {}) {\n return core._refine(ZodCustom, fn, _params);\n}\n// superRefine\nexport function superRefine(fn, params) {\n return core._superRefine(fn, params);\n}\n// Re-export describe and meta from core\nexport const describe = core.describe;\nexport const meta = core.meta;\nexport const ZodInstanceOf = /*@__PURE__*/ core.$constructor(\"ZodInstanceOf\", (inst, def) => {\n ZodCustom.init(inst, def);\n}, {\n properties(shape, params) {\n // asserts in place, so the narrowed output type is truthful without a wrapper\n return this.check(core._properties(shape, params));\n },\n});\nfunction _instanceof(cls, params = {}) {\n const inst = new ZodInstanceOf({\n type: \"custom\",\n check: \"custom\",\n fn: (data) => data instanceof cls,\n abort: true,\n ...util.normalizeParams(params),\n });\n inst._zod.bag.Class = cls;\n // Override check to emit invalid_type instead of custom\n inst._zod.check = (payload) => {\n if (!(payload.value instanceof cls)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: cls.name,\n input: payload.value,\n inst,\n path: [...(inst._zod.def.path ?? [])],\n });\n }\n };\n return inst;\n}\nexport { _instanceof as instanceof };\n// stringbool\nexport const stringbool = (...args) => core._stringbool({\n Codec: ZodCodec,\n Boolean: ZodBoolean,\n String: ZodString,\n}, ...args);\nexport function json(params) {\n const jsonSchema = lazy(() => {\n return union([string(params), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);\n });\n return jsonSchema;\n}\n// preprocess\nexport function preprocess(fn, schema) {\n return new ZodPreprocess({\n type: \"pipe\",\n in: transform(fn),\n out: schema,\n });\n}\n","import { n as EventType, t as PROTOCOL_VERSION } from \"./version-CTNE2I0_.mjs\";\nimport { z } from \"zod/v4\";\n\n//#region src/generated/schemas.ts\n/**\n* The discriminator carried by every event.\n*/\nconst EventTypeSchema = z.enum(EventType);\n/**\n* Extra information attached to an event, a message, a tool call, a tool, an\n* interrupt or a resume entry. Open by key: any JSON value is allowed under a\n* key, including null, because a null there is meaningful data. The object\n* itself may be absent but is never null when present. The key ag-ui is\n* reserved for the protocol's own use; reservation is by convention, since\n* validating the shape of a key's value would contradict being open by key.\n*/\nconst MetadataSchema = z.custom((value) => typeof value === \"object\" && value !== null && !Array.isArray(value));\n/**\n* An opaque handle for one subagent invocation, not a reusable name for a\n* subagent definition: two invocations of the same subagent carry two\n* different values. Named to mirror runId one level down, the way the\n* subagent's name mirrors agentId.\n*/\nconst SubagentRunIdSchema = z.string();\n/**\n* The roles a streamed text message may take. Excludes tool, which is carried\n* by TOOL_CALL_RESULT rather than streamed as text.\n*/\nconst TextMessageRoleSchema = z.enum([\n\t\"developer\",\n\t\"system\",\n\t\"assistant\",\n\t\"user\"\n]);\n/**\n* Opens a streamed text message. The content arrives as TEXT_MESSAGE_CONTENT\n* events and the message closes with TEXT_MESSAGE_END.\n*/\nconst TextMessageStartEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TEXT_MESSAGE_START),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string(),\n\trole: TextMessageRoleSchema.optional(),\n\tname: z.string().optional()\n});\n/**\n* Appends a fragment to a streamed text message.\n*/\nconst TextMessageContentEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TEXT_MESSAGE_CONTENT),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string(),\n\tdelta: z.string()\n});\n/**\n* Closes a streamed text message.\n*/\nconst TextMessageEndEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TEXT_MESSAGE_END),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string()\n});\n/**\n* A shorthand that stands in for a start, content and end sequence, for\n* producers that cannot know in advance where a message begins. Every field is\n* optional because a continuation chunk omits what has not changed; which\n* message a field-less chunk continues is a sequence question the prose\n* specification answers.\n*/\nconst TextMessageChunkEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TEXT_MESSAGE_CHUNK),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string().optional(),\n\trole: TextMessageRoleSchema.optional(),\n\tdelta: z.string().optional(),\n\tname: z.string().optional()\n});\n/**\n* Opens a tool call. The arguments arrive as TOOL_CALL_ARGS events and the\n* call closes with TOOL_CALL_END.\n*/\nconst ToolCallStartEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TOOL_CALL_START),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\ttoolCallId: z.string(),\n\ttoolCallName: z.string(),\n\tparentMessageId: z.string().optional()\n});\n/**\n* Appends a fragment of a tool call's arguments.\n*/\nconst ToolCallArgsEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TOOL_CALL_ARGS),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\ttoolCallId: z.string(),\n\tdelta: z.string()\n});\n/**\n* Closes a tool call, meaning its arguments are complete.\n*/\nconst ToolCallEndEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TOOL_CALL_END),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\ttoolCallId: z.string()\n});\n/**\n* A shorthand that stands in for a tool call's start, args and end sequence.\n* Every field is optional for the same reason as TEXT_MESSAGE_CHUNK.\n*/\nconst ToolCallChunkEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TOOL_CALL_CHUNK),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\ttoolCallId: z.string().optional(),\n\ttoolCallName: z.string().optional(),\n\tparentMessageId: z.string().optional(),\n\tdelta: z.string().optional()\n});\n/**\n* A text part.\n*/\nconst TextPartSchema = z.looseObject({\n\ttype: z.literal(\"text\"),\n\tid: z.string().optional(),\n\ttext: z.string(),\n\tmetadata: z.any().refine((value) => value !== null).optional()\n});\n/**\n* Bytes carried inline.\n*/\nconst DataSourceSchema = z.looseObject({\n\ttype: z.literal(\"data\"),\n\tvalue: z.string(),\n\tmimeType: z.string()\n});\n/**\n* Bytes referenced by URL, fetched by whoever needs them.\n*/\nconst UrlSourceSchema = z.looseObject({\n\ttype: z.literal(\"url\"),\n\tvalue: z.string(),\n\tmimeType: z.string().optional()\n});\n/**\n* Bytes already at the provider, named by a handle the provider issued: an\n* OpenAI or Anthropic file id, a Gemini file URI, a storage URL only that\n* provider can read. No bytes travel and nothing is fetched. Only the provider\n* that minted the handle can resolve it; a peer that cannot drops the part as\n* it drops any part it cannot use.\n*/\nconst FileSourceSchema = z.looseObject({\n\ttype: z.literal(\"file\"),\n\tvalue: z.string(),\n\tprovider: z.string().optional(),\n\tmimeType: z.string().optional()\n});\n/**\n* Where a media part's bytes come from: carried inline, referenced by URL, or\n* already at the provider under a handle it issued.\n*/\nconst PartSourceSchema = z.discriminatedUnion(\"type\", [\n\tDataSourceSchema,\n\tUrlSourceSchema,\n\tFileSourceSchema\n]);\n/**\n* An image part.\n*/\nconst ImagePartSchema = z.looseObject({\n\ttype: z.literal(\"image\"),\n\tid: z.string().optional(),\n\tsource: PartSourceSchema,\n\tmetadata: z.any().refine((value) => value !== null).optional()\n});\n/**\n* An audio part.\n*/\nconst AudioPartSchema = z.looseObject({\n\ttype: z.literal(\"audio\"),\n\tid: z.string().optional(),\n\tsource: PartSourceSchema,\n\tmetadata: z.any().refine((value) => value !== null).optional()\n});\n/**\n* A video part.\n*/\nconst VideoPartSchema = z.looseObject({\n\ttype: z.literal(\"video\"),\n\tid: z.string().optional(),\n\tsource: PartSourceSchema,\n\tmetadata: z.any().refine((value) => value !== null).optional()\n});\n/**\n* A document part.\n*/\nconst DocumentPartSchema = z.looseObject({\n\ttype: z.literal(\"document\"),\n\tid: z.string().optional(),\n\tsource: PartSourceSchema,\n\tmetadata: z.any().refine((value) => value !== null).optional()\n});\n/**\n* One part of a message body: what a person sends in a user message, or what a\n* tool returns in a tool message. Discriminated by type. Named by what the\n* part is rather than by direction, because the same part travels into the\n* model inside a user message and back out of the stream inside a tool result.\n*/\nconst ContentPartSchema = z.discriminatedUnion(\"type\", [\n\tTextPartSchema,\n\tImagePartSchema,\n\tAudioPartSchema,\n\tVideoPartSchema,\n\tDocumentPartSchema\n]);\n/**\n* Carries what a tool returned. Mints a tool message rather than appending to\n* an existing one, which is why it has its own messageId.\n*/\nconst ToolCallResultEventSchema = z.looseObject({\n\ttype: z.literal(EventType.TOOL_CALL_RESULT),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string(),\n\ttoolCallId: z.string(),\n\tcontent: z.union([z.string(), z.array(ContentPartSchema)]),\n\trole: z.literal(\"tool\").optional()\n});\n/**\n* Agent state. Any JSON value: the protocol carries state without interpreting\n* it, so an object, an array, a string and a number are all valid.\n*/\nconst StateSchema = z.any();\n/**\n* Replaces the agent state wholesale. Sent when a delta cannot express the\n* change, or to resynchronise a consumer.\n*/\nconst StateSnapshotEventSchema = z.looseObject({\n\ttype: z.literal(EventType.STATE_SNAPSHOT),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tsnapshot: StateSchema.refine((value) => value !== void 0)\n});\n/**\n* A JSON Pointer as defined by RFC 6901. Either the empty string, meaning the\n* whole document, or a sequence of slash-prefixed reference tokens in which a\n* tilde is escaped as ~0 and a slash as ~1. A value with no leading slash, or\n* a tilde followed by anything other than 0 or 1, is not a JSON Pointer.\n*/\nconst JsonPointerSchema = z.string().regex(/* @__PURE__ */ new RegExp(\"^(/([^/~]|~[01])*)*$\"));\n/**\n* Inserts value at path. RFC 6902 section 4.1.\n*/\nconst AddOperationSchema = z.looseObject({\n\top: z.literal(\"add\"),\n\tpath: JsonPointerSchema,\n\tvalue: z.any().refine((value) => value !== void 0)\n}).meta({ specOpen: true });\n/**\n* Removes the value at path. RFC 6902 section 4.2.\n*/\nconst RemoveOperationSchema = z.looseObject({\n\top: z.literal(\"remove\"),\n\tpath: JsonPointerSchema\n}).meta({ specOpen: true });\n/**\n* Replaces the value at path. RFC 6902 section 4.3.\n*/\nconst ReplaceOperationSchema = z.looseObject({\n\top: z.literal(\"replace\"),\n\tpath: JsonPointerSchema,\n\tvalue: z.any().refine((value) => value !== void 0)\n}).meta({ specOpen: true });\n/**\n* Moves the value at from to path. RFC 6902 section 4.4.\n*/\nconst MoveOperationSchema = z.looseObject({\n\top: z.literal(\"move\"),\n\tfrom: JsonPointerSchema,\n\tpath: JsonPointerSchema\n}).meta({ specOpen: true });\n/**\n* Copies the value at from to path. RFC 6902 section 4.5.\n*/\nconst CopyOperationSchema = z.looseObject({\n\top: z.literal(\"copy\"),\n\tfrom: JsonPointerSchema,\n\tpath: JsonPointerSchema\n}).meta({ specOpen: true });\n/**\n* Asserts that the value at path equals value. RFC 6902 section 4.6.\n*/\nconst TestOperationSchema = z.looseObject({\n\top: z.literal(\"test\"),\n\tpath: JsonPointerSchema,\n\tvalue: z.any().refine((value) => value !== void 0)\n}).meta({ specOpen: true });\n/**\n* A single RFC 6902 operation. Exactly one of the operation shapes must match,\n* discriminated by op. Unlike the protocol's own objects, the operations are\n* open: RFC 6902 section 4 requires members an operation does not define to be\n* ignored rather than rejected, so a remove carrying a leftover value is a\n* valid patch. Two of the RFC's rules are relations between values rather than\n* shapes, so no static schema can express them and neither is checked here: a\n* move whose from is a proper prefix of its path (section 4.4), and any\n* operation whose pointer does not resolve in the target document. Both are\n* the applier's to reject.\n*/\nconst JsonPatchOperationSchema = z.discriminatedUnion(\"op\", [\n\tAddOperationSchema,\n\tRemoveOperationSchema,\n\tReplaceOperationSchema,\n\tMoveOperationSchema,\n\tCopyOperationSchema,\n\tTestOperationSchema\n]);\n/**\n* A JSON Patch document as defined by RFC 6902, referenced by\n* STATE_DELTA.delta and ACTIVITY_DELTA.patch: an ordered sequence of\n* operations applied to a target document. An empty array is a valid no-op\n* patch. Whether the operations actually apply to the document they target is\n* a runtime question RFC 6902 leaves to the applier; structural validity here\n* says nothing about it.\n*/\nconst JsonPatchSchema = z.array(JsonPatchOperationSchema);\n/**\n* Changes the agent state incrementally.\n*/\nconst StateDeltaEventSchema = z.looseObject({\n\ttype: z.literal(EventType.STATE_DELTA),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tdelta: JsonPatchSchema\n});\n/**\n* Instructions from the application developer.\n*/\nconst DeveloperMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.literal(\"developer\"),\n\tname: z.string().optional(),\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional(),\n\tcontent: z.string()\n});\n/**\n* Instructions from the system.\n*/\nconst SystemMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.literal(\"system\"),\n\tname: z.string().optional(),\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional(),\n\tcontent: z.string()\n});\n/**\n* The name and arguments of a tool call.\n*/\nconst FunctionCallSchema = z.looseObject({\n\tname: z.string(),\n\targuments: z.string()\n});\n/**\n* A call an assistant message made. Carries no subagent attribution of its own\n* and inherits its containing message's, since several calls can share one\n* parent.\n*/\nconst ToolCallSchema = z.looseObject({\n\tid: z.string(),\n\ttype: z.literal(\"function\"),\n\tfunction: FunctionCallSchema,\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* A message from the agent. Content is optional because a turn may consist\n* only of tool calls.\n*/\nconst AssistantMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.literal(\"assistant\"),\n\tname: z.string().optional(),\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional(),\n\tcontent: z.string().optional(),\n\ttoolCalls: z.array(ToolCallSchema).optional()\n});\n/**\n* A message from the person using the application.\n*/\nconst UserMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.literal(\"user\"),\n\tname: z.string().optional(),\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional(),\n\tcontent: z.union([z.string(), z.array(ContentPartSchema)])\n});\n/**\n* What a tool returned, as a message in the conversation. Stands alone rather\n* than composing BaseMessage, because it carries no name.\n*/\nconst ToolMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.literal(\"tool\"),\n\tcontent: z.union([z.string(), z.array(ContentPartSchema)]),\n\ttoolCallId: z.string(),\n\terror: z.string().optional(),\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* Structured progress that is not conversation content, materialised as a\n* message so it keeps its place in the sequence. Stands alone rather than\n* composing BaseMessage, because its content is an object rather than a\n* string.\n*/\nconst ActivityMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.literal(\"activity\"),\n\tactivityType: z.string(),\n\tcontent: z.custom((value) => typeof value === \"object\" && value !== null && !Array.isArray(value)),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* A span of the agent's reasoning, materialised as a message. Stands alone\n* rather than composing BaseMessage, because it carries no name.\n*/\nconst ReasoningMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.literal(\"reasoning\"),\n\tcontent: z.string(),\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* Any message in a conversation. Discriminated by role.\n*/\nconst MessageSchema = z.discriminatedUnion(\"role\", [\n\tDeveloperMessageSchema,\n\tSystemMessageSchema,\n\tAssistantMessageSchema,\n\tUserMessageSchema,\n\tToolMessageSchema,\n\tActivityMessageSchema,\n\tReasoningMessageSchema\n]);\n/**\n* The complete set of messages the producer owns, in order. Conversation-wide\n* rather than a plain overwrite: a consumer may keep messages of its own that\n* no producer tracks, so exactly how a snapshot reconciles with those is\n* behavioural and belongs in the prose. Being conversation-wide it cannot\n* belong to a single subagent, so it carries no attribution; it does establish\n* which subagent owns each message it contains, through the messages\n* themselves.\n*/\nconst MessagesSnapshotEventSchema = z.looseObject({\n\ttype: z.literal(EventType.MESSAGES_SNAPSHOT),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tmessages: z.array(MessageSchema)\n});\n/**\n* Reports structured progress that is not conversation content, such as a step\n* a UI renders as its own widget.\n*/\nconst ActivitySnapshotEventSchema = z.looseObject({\n\ttype: z.literal(EventType.ACTIVITY_SNAPSHOT),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string(),\n\tactivityType: z.string(),\n\tcontent: z.custom((value) => typeof value === \"object\" && value !== null && !Array.isArray(value)),\n\treplace: z.boolean().optional()\n});\n/**\n* Changes an activity message's content incrementally.\n*/\nconst ActivityDeltaEventSchema = z.looseObject({\n\ttype: z.literal(EventType.ACTIVITY_DELTA),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string(),\n\tactivityType: z.string(),\n\tpatch: JsonPatchSchema\n});\n/**\n* Passes a provider-native event through untranslated, for consumers that need\n* detail the protocol does not model.\n*/\nconst RawEventSchema = z.looseObject({\n\ttype: z.literal(EventType.RAW),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tevent: z.any().refine((value) => value !== void 0),\n\tsource: z.string().optional()\n});\n/**\n* The protocol's extension point for an application's own events. Anything a\n* consumer does with one is outside the protocol.\n*/\nconst CustomEventSchema = z.looseObject({\n\ttype: z.literal(EventType.CUSTOM),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tname: z.string(),\n\tvalue: z.any().refine((value) => value !== void 0)\n});\n/**\n* A tool the agent may call.\n*/\nconst ToolSchema = z.looseObject({\n\tname: z.string(),\n\tdescription: z.string(),\n\tparameters: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* A named piece of ambient information given to the agent for the run,\n* distinct from the conversation.\n*/\nconst ContextSchema = z.looseObject({\n\tdescription: z.string(),\n\tvalue: z.string()\n});\n/**\n* An answer to one interrupt, sent on the run that continues from it.\n*/\nconst ResumeEntrySchema = z.looseObject({\n\tinterruptId: z.string(),\n\tstatus: z.enum([\"resolved\", \"cancelled\"]),\n\tpayload: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* A request to run an agent. Also echoed back as RUN_STARTED.input. Only\n* threadId, runId and messages are required: those are the three the SDKs\n* already agree on, and for tools and context an absent key and an empty array\n* mean the same thing, so requiring them would catch nothing a producer could\n* get wrong.\n*/\nconst RunAgentInputSchema = z.looseObject({\n\tthreadId: z.string(),\n\trunId: z.string(),\n\tprotocolVersion: z.string().optional(),\n\tparentRunId: z.string().optional(),\n\tstate: StateSchema.refine((value) => value !== null).nullable().transform((value) => value ?? void 0).optional(),\n\tmessages: z.array(MessageSchema),\n\ttools: z.array(ToolSchema).default(() => []),\n\tcontext: z.array(ContextSchema).default(() => []),\n\tforwardedProps: z.any().refine((value) => value !== null).optional(),\n\tresume: z.array(ResumeEntrySchema).optional()\n});\n/**\n* Opens a run. Run-scoped, so it carries no subagent attribution.\n*/\nconst RunStartedEventSchema = z.looseObject({\n\ttype: z.literal(EventType.RUN_STARTED),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tthreadId: z.string(),\n\trunId: z.string(),\n\tprotocolVersion: z.string().optional(),\n\tparentRunId: z.string().optional(),\n\tinput: RunAgentInputSchema.optional()\n});\n/**\n* The run completed. Equivalent to an absent outcome. Closed like every other\n* object, which is also what keeps it from carrying the suspended sibling's\n* interrupts — a success with an interrupt still pending would be a\n* contradiction, not an extension. A completed run may still have left\n* frontend tool calls for the application to answer; pendingToolCallIds names\n* them.\n*/\nconst RunFinishedSuccessOutcomeSchema = z.looseObject({\n\ttype: z.literal(\"success\"),\n\tpendingToolCallIds: z.array(z.string()).optional()\n});\n/**\n* Something a run needs from outside before it can continue, such as an\n* approval or a missing value.\n*/\nconst InterruptSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\treason: z.string(),\n\tmessage: z.string().optional(),\n\ttoolCallId: z.string().optional(),\n\tresponseSchema: z.custom((value) => typeof value === \"object\" && value !== null && !Array.isArray(value)).optional(),\n\texpiresAt: z.string().optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* The run is paused, waiting for something outside it. Resuming means starting\n* a new run whose resume entries answer these interrupts.\n*/\nconst RunFinishedInterruptOutcomeSchema = z.looseObject({\n\ttype: z.literal(\"interrupt\"),\n\tinterrupts: z.array(InterruptSchema).min(1)\n});\n/**\n* The run was stopped before it completed, by whoever was running it, and did\n* not fail. Neither success nor interrupt: nothing was produced as a result,\n* and nothing is waited for, so the next run on the thread is an ordinary new\n* run rather than a resume. Closed like its siblings: a cancelled run has no\n* interrupts to carry. Named in the schema before 1.0 because an outcome a\n* consumer does not recognise is stripped and read as success — a cancellation\n* added later would reach every 1.0 consumer as a completed run.\n*/\nconst RunFinishedCancelledOutcomeSchema = z.looseObject({ type: z.literal(\"cancelled\") });\n/**\n* Why a run ended.\n*/\nconst RunFinishedOutcomeSchema = z.discriminatedUnion(\"type\", [\n\tRunFinishedSuccessOutcomeSchema,\n\tRunFinishedInterruptOutcomeSchema,\n\tRunFinishedCancelledOutcomeSchema\n]);\n/**\n* Token counts for one provider and model, in the protocol's own accounting:\n* every count is either a total or a named part of one, so entries from\n* different providers add up without double-counting. inputTokens and\n* outputTokens are the totals; reasoningTokens, cachedInputTokens and\n* cacheWriteInputTokens are parts of them, never additions to them;\n* totalTokens is the two totals summed. Every field is a label or a number —\n* nothing content-bearing or identifying, no prompts, completions, messages,\n* or thread, run and user identifiers.\n*/\nconst TokenUsageSchema = z.looseObject({\n\tprovider: z.string().optional(),\n\tmodel: z.string().optional(),\n\tinputTokens: z.int().min(0).max(9007199254740991).optional(),\n\toutputTokens: z.int().min(0).max(9007199254740991).optional(),\n\ttotalTokens: z.int().min(0).max(9007199254740991).optional(),\n\treasoningTokens: z.int().min(0).max(9007199254740991).optional(),\n\tcachedInputTokens: z.int().min(0).max(9007199254740991).optional(),\n\tcacheWriteInputTokens: z.int().min(0).max(9007199254740991).optional()\n});\n/**\n* Closes a run that did not fail. Run-scoped, so it carries no subagent\n* attribution.\n*/\nconst RunFinishedEventSchema = z.looseObject({\n\ttype: z.literal(EventType.RUN_FINISHED),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tthreadId: z.string(),\n\trunId: z.string(),\n\tresult: z.any().refine((value) => value !== null).optional(),\n\toutcome: RunFinishedOutcomeSchema.optional(),\n\tusage: z.array(TokenUsageSchema).optional()\n});\n/**\n* Ends a run that failed. Run-scoped, so it carries no subagent attribution; a\n* subagent that fails without ending the run reports SUBAGENT_ERROR instead.\n*/\nconst RunErrorEventSchema = z.looseObject({\n\ttype: z.literal(EventType.RUN_ERROR),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tmessage: z.string(),\n\tcode: z.string().optional(),\n\tusage: z.array(TokenUsageSchema).optional()\n});\n/**\n* Opens a named step within a run, for producers whose frameworks have a step\n* concept worth surfacing.\n*/\nconst StepStartedEventSchema = z.looseObject({\n\ttype: z.literal(EventType.STEP_STARTED),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tstepName: z.string()\n});\n/**\n* Closes a named step.\n*/\nconst StepFinishedEventSchema = z.looseObject({\n\ttype: z.literal(EventType.STEP_FINISHED),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tstepName: z.string()\n});\n/**\n* Opens a span of reasoning. A span may contain several reasoning messages.\n*/\nconst ReasoningStartEventSchema = z.looseObject({\n\ttype: z.literal(EventType.REASONING_START),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string()\n});\n/**\n* Opens a streamed reasoning message.\n*/\nconst ReasoningMessageStartEventSchema = z.looseObject({\n\ttype: z.literal(EventType.REASONING_MESSAGE_START),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string(),\n\trole: z.literal(\"reasoning\")\n});\n/**\n* Appends a fragment to a streamed reasoning message.\n*/\nconst ReasoningMessageContentEventSchema = z.looseObject({\n\ttype: z.literal(EventType.REASONING_MESSAGE_CONTENT),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string(),\n\tdelta: z.string()\n});\n/**\n* Closes a streamed reasoning message.\n*/\nconst ReasoningMessageEndEventSchema = z.looseObject({\n\ttype: z.literal(EventType.REASONING_MESSAGE_END),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string()\n});\n/**\n* A shorthand that stands in for a reasoning message's start, content and end\n* sequence.\n*/\nconst ReasoningMessageChunkEventSchema = z.looseObject({\n\ttype: z.literal(EventType.REASONING_MESSAGE_CHUNK),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string().optional(),\n\tdelta: z.string().optional()\n});\n/**\n* Closes a span of reasoning.\n*/\nconst ReasoningEndEventSchema = z.looseObject({\n\ttype: z.literal(EventType.REASONING_END),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tmessageId: z.string()\n});\n/**\n* Whether a REASONING_ENCRYPTED_VALUE belongs to a message or to a tool call.\n*/\nconst ReasoningEncryptedValueSubtypeSchema = z.enum([\"tool-call\", \"message\"]);\n/**\n* Carries a provider's opaque, encrypted reasoning artefact, which a consumer\n* stores and returns on a later turn without being able to read it.\n*/\nconst ReasoningEncryptedValueEventSchema = z.looseObject({\n\ttype: z.literal(EventType.REASONING_ENCRYPTED_VALUE),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tsubtype: ReasoningEncryptedValueSubtypeSchema,\n\tentityId: z.string(),\n\tencryptedValue: z.string()\n});\n/**\n* Announces that a subagent invocation has begun. Everything the subagent\n* produces afterwards is attributed by carrying its subagentRunId, so a\n* consumer can group the work without replaying the stream. Composed from\n* BaseEvent alone rather than Attributable, because here subagentRunId\n* identifies the subagent rather than attributing the event to one;\n* attribution to an enclosing subagent is parentSubagentRunId.\n*/\nconst SubagentStartedEventSchema = z.looseObject({\n\ttype: z.literal(EventType.SUBAGENT_STARTED),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema,\n\tname: z.string(),\n\tdescription: z.string().optional(),\n\tparentSubagentRunId: SubagentRunIdSchema.optional(),\n\tparentToolCallId: z.string().optional(),\n\tparentMessageId: z.string().optional()\n});\n/**\n* The subagent completed its work. Equivalent to an absent outcome.\n*/\nconst SubagentFinishedSuccessOutcomeSchema = z.looseObject({ type: z.literal(\"success\") });\n/**\n* The subagent is paused awaiting outside input. Terminal for this stream, not\n* for the subagent: a later run may continue the same invocation once the\n* interrupts are answered.\n*/\nconst SubagentFinishedSuspendedOutcomeSchema = z.looseObject({\n\ttype: z.literal(\"suspended\"),\n\tinterruptIds: z.array(z.string()).optional()\n});\n/**\n* Why a subagent's segment of a run ended. Mirrors RunFinishedOutcome one\n* level down.\n*/\nconst SubagentFinishedOutcomeSchema = z.discriminatedUnion(\"type\", [SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema]);\n/**\n* Ends a subagent invocation's segment of this run, either because the work\n* completed or because it is suspended awaiting outside input.\n*/\nconst SubagentFinishedEventSchema = z.looseObject({\n\ttype: z.literal(EventType.SUBAGENT_FINISHED),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema,\n\tresult: z.any().refine((value) => value !== null).optional(),\n\toutcome: SubagentFinishedOutcomeSchema.optional()\n});\n/**\n* Reports that a subagent invocation failed. The run may continue: a parent\n* agent is free to handle a failed subagent, which is why this is not\n* RUN_ERROR.\n*/\nconst SubagentErrorEventSchema = z.looseObject({\n\ttype: z.literal(EventType.SUBAGENT_ERROR),\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional(),\n\tsubagentRunId: SubagentRunIdSchema,\n\tmessage: z.string(),\n\tcode: z.string().optional()\n});\n/**\n* Any AG-UI event. Every member is normative: there is no optional tier and no\n* event a consumer may decline to implement. Discriminated by the type\n* property.\n*/\nconst EventSchema = z.discriminatedUnion(\"type\", [\n\tTextMessageStartEventSchema,\n\tTextMessageContentEventSchema,\n\tTextMessageEndEventSchema,\n\tTextMessageChunkEventSchema,\n\tToolCallStartEventSchema,\n\tToolCallArgsEventSchema,\n\tToolCallEndEventSchema,\n\tToolCallChunkEventSchema,\n\tToolCallResultEventSchema,\n\tStateSnapshotEventSchema,\n\tStateDeltaEventSchema,\n\tMessagesSnapshotEventSchema,\n\tActivitySnapshotEventSchema,\n\tActivityDeltaEventSchema,\n\tRawEventSchema,\n\tCustomEventSchema,\n\tRunStartedEventSchema,\n\tRunFinishedEventSchema,\n\tRunErrorEventSchema,\n\tStepStartedEventSchema,\n\tStepFinishedEventSchema,\n\tReasoningStartEventSchema,\n\tReasoningMessageStartEventSchema,\n\tReasoningMessageContentEventSchema,\n\tReasoningMessageEndEventSchema,\n\tReasoningMessageChunkEventSchema,\n\tReasoningEndEventSchema,\n\tReasoningEncryptedValueEventSchema,\n\tSubagentStartedEventSchema,\n\tSubagentFinishedEventSchema,\n\tSubagentErrorEventSchema\n]);\n/**\n* Every role a materialised message may have.\n*/\nconst RoleSchema = z.enum([\n\t\"developer\",\n\t\"system\",\n\t\"assistant\",\n\t\"user\",\n\t\"tool\",\n\t\"activity\",\n\t\"reasoning\"\n]);\n/**\n* Describes a subagent that can be invoked by a parent agent.\n*/\nconst SubagentInfoSchema = z.looseObject({\n\tname: z.string(),\n\tdescription: z.string().optional()\n});\n/**\n* Basic metadata about the agent. Useful for discovery UIs, agent\n* marketplaces, and debugging. Set these when you want clients to display\n* agent information or when multiple agents are available and users need to\n* pick one.\n*/\nconst IdentityCapabilitiesSchema = z.looseObject({\n\tname: z.string().optional(),\n\ttype: z.string().optional(),\n\tdescription: z.string().optional(),\n\tversion: z.string().optional(),\n\tprovider: z.string().optional(),\n\tdocumentationUrl: z.string().optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* Declares which transport mechanisms the agent supports. Clients use this to\n* pick the best connection strategy. Only set flags to true for transports\n* your agent actually handles — omit or set false for unsupported ones.\n*/\nconst TransportCapabilitiesSchema = z.looseObject({\n\tstreaming: z.boolean().optional(),\n\twebsocket: z.boolean().optional(),\n\thttpBinary: z.boolean().optional(),\n\tpushNotifications: z.boolean().optional(),\n\tresumable: z.boolean().optional()\n});\n/**\n* Tool calling capabilities. Distinguishes between tools the agent itself\n* provides (listed in items) and tools the client passes at runtime via\n* RunAgentInput.tools. Enable this when your agent can call functions, search\n* the web, execute code, etc.\n*/\nconst ToolsCapabilitiesSchema = z.looseObject({\n\tsupported: z.boolean().optional(),\n\titems: z.array(ToolSchema).optional(),\n\tparallelCalls: z.boolean().optional(),\n\tclientProvided: z.boolean().optional()\n});\n/**\n* Output format support. Enable structuredOutput when your agent can return\n* responses conforming to a JSON schema, which is useful for programmatic\n* consumption.\n*/\nconst OutputCapabilitiesSchema = z.looseObject({\n\tstructuredOutput: z.boolean().optional(),\n\tsupportedMimeTypes: z.array(z.string()).optional()\n});\n/**\n* State and memory management capabilities. These tell the client how the\n* agent handles shared state and whether conversation context persists across\n* runs.\n*/\nconst StateCapabilitiesSchema = z.looseObject({\n\tsnapshots: z.boolean().optional(),\n\tdeltas: z.boolean().optional(),\n\tmemory: z.boolean().optional(),\n\tpersistentState: z.boolean().optional()\n});\n/**\n* Multi-agent coordination capabilities. Enable these when your agent can\n* orchestrate or hand off work to other agents.\n*/\nconst MultiAgentCapabilitiesSchema = z.looseObject({\n\tsupported: z.boolean().optional(),\n\tdelegation: z.boolean().optional(),\n\thandoffs: z.boolean().optional(),\n\tsubagents: z.array(SubagentInfoSchema).optional()\n});\n/**\n* Reasoning and thinking capabilities. Enable these when your agent exposes\n* its internal thought process (e.g., chain-of-thought, extended thinking).\n*/\nconst ReasoningCapabilitiesSchema = z.looseObject({\n\tsupported: z.boolean().optional(),\n\tstreaming: z.boolean().optional(),\n\tencrypted: z.boolean().optional()\n});\n/**\n* Modalities the agent can accept as input. Clients use this to show or hide\n* file upload buttons, audio recorders, image pickers, etc.\n*/\nconst MultimodalInputCapabilitiesSchema = z.looseObject({\n\timage: z.boolean().optional(),\n\taudio: z.boolean().optional(),\n\tvideo: z.boolean().optional(),\n\tpdf: z.boolean().optional(),\n\tfile: z.boolean().optional()\n});\n/**\n* Modalities the agent can produce as output. Clients use this to anticipate\n* rich content in the agent's response.\n*/\nconst MultimodalOutputCapabilitiesSchema = z.looseObject({\n\timage: z.boolean().optional(),\n\taudio: z.boolean().optional()\n});\n/**\n* Multimodal input and output support. Organized into input and output\n* sub-objects so clients can independently query what the agent accepts versus\n* what it produces.\n*/\nconst MultimodalCapabilitiesSchema = z.looseObject({\n\tinput: MultimodalInputCapabilitiesSchema.optional(),\n\toutput: MultimodalOutputCapabilitiesSchema.optional()\n});\n/**\n* Execution control and limits. Declare these so clients can set expectations\n* about how long or how many steps an agent run might take.\n*/\nconst ExecutionCapabilitiesSchema = z.looseObject({\n\tcodeExecution: z.boolean().optional(),\n\tsandboxed: z.boolean().optional(),\n\tmaxIterations: z.int().min(0).max(9007199254740991).optional(),\n\tmaxExecutionTime: z.int().min(0).max(9007199254740991).optional()\n});\n/**\n* Human-in-the-loop interaction support. Enable these when your agent can\n* pause execution to request human input, approval, or feedback before\n* continuing.\n*/\nconst HumanInTheLoopCapabilitiesSchema = z.looseObject({\n\tsupported: z.boolean().optional(),\n\tapprovals: z.boolean().optional(),\n\tinterventions: z.boolean().optional(),\n\tfeedback: z.boolean().optional(),\n\tinterrupts: z.boolean().optional(),\n\tapproveWithEdits: z.boolean().optional()\n});\n/**\n* A typed, categorized snapshot of an agent's current capabilities. All fields\n* are optional — agents only declare what they support. An omitted field means\n* the capability is not declared (unknown), not that it is unsupported. The\n* custom field is an escape hatch for integration-specific capabilities that\n* do not fit into the standard categories.\n*/\nconst AgentCapabilitiesSchema = z.looseObject({\n\tidentity: IdentityCapabilitiesSchema.optional(),\n\ttransport: TransportCapabilitiesSchema.optional(),\n\ttools: ToolsCapabilitiesSchema.optional(),\n\toutput: OutputCapabilitiesSchema.optional(),\n\tstate: StateCapabilitiesSchema.optional(),\n\tmultiAgent: MultiAgentCapabilitiesSchema.optional(),\n\treasoning: ReasoningCapabilitiesSchema.optional(),\n\tmultimodal: MultimodalCapabilitiesSchema.optional(),\n\texecution: ExecutionCapabilitiesSchema.optional(),\n\thumanInTheLoop: HumanInTheLoopCapabilitiesSchema.optional(),\n\tcustom: z.custom((value) => typeof value === \"object\" && value !== null && !Array.isArray(value)).optional()\n});\n/**\n* Composed into everything that can belong to a subagent's work: the events\n* that describe content or progress, the message types, and each interrupt.\n* Run-scoped events omit it — RUN_STARTED, RUN_FINISHED and RUN_ERROR describe\n* the run itself and MESSAGES_SNAPSHOT is conversation-wide, so none of them\n* can belong to one subagent. A tool call omits it too and inherits its\n* containing message's attribution.\n*/\nconst AttributableSchema = z.looseObject({ subagentRunId: SubagentRunIdSchema.optional() });\n/**\n* The fields every event carries, whatever its type. Composed into each event\n* definition rather than repeated, so a change here reaches every event at\n* once.\n*/\nconst BaseEventSchema = z.looseObject({\n\ttype: EventTypeSchema,\n\ttimestamp: z.int().min(-9007199254740991).max(9007199254740991).optional(),\n\trawEvent: z.any().refine((value) => value !== null).optional(),\n\tmetadata: MetadataSchema.optional()\n});\n/**\n* The fields shared by the developer, system, assistant and user messages.\n* Deliberately excludes content, because a user message's content may be an\n* array while the others are strings, and composition here intersects rather\n* than overrides: a base that constrained content to a string would make an\n* array content invalid. The tool, activity and reasoning messages do not\n* compose this, because they carry no name.\n*/\nconst BaseMessageSchema = z.looseObject({\n\tsubagentRunId: SubagentRunIdSchema.optional(),\n\tid: z.string(),\n\trole: z.string(),\n\tname: z.string().optional(),\n\tencryptedValue: z.string().optional(),\n\tmetadata: MetadataSchema.optional()\n});\n\n//#endregion\n//#region src/schemas.ts\n/**\n* How metadata is declared on events and messages.\n*\n* The object itself is absent or an object, never `null` — and parsing enforces\n* that invariant rather than coercing a `null` to absent. The schema pinning it\n* now lives in the generated source (MetadataSchema in\n* src/generated/schemas.ts); this comment survives as the recorded reasoning.\n*\n* Historically tolerated whole optional nulls are translated to absence in\n* the client's compatibility boundary before validation. That includes the\n* legacy `parentMessageId` and `outcome` cases and optional JSON fields such as\n* `rawEvent`, `result`, and media content-part `metadata`; see the repo-root\n* DEPRECATIONS.md for the exact list. Event and message metadata already\n* rejected a whole `null`, so their restriction remains. Compatibility for\n* media content-part metadata does not broaden this shared metadata schema.\n*\n* A `null` *value under a key* is meaningful data and is preserved. Only a\n* `null` in place of the whole object is a contract violation.\n*/\nconst OptionalMetadataSchema = MetadataSchema.optional();\n\n//#endregion\nexport { ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AddOperationSchema, AgentCapabilitiesSchema, AssistantMessageSchema, AttributableSchema, AudioPartSchema as AudioInputContentSchema, AudioPartSchema as AudioInputPartSchema, AudioPartSchema, BaseEventSchema, BaseMessageSchema, ContentPartSchema, ContentPartSchema as InputContentSchema, ContextSchema, CopyOperationSchema, CustomEventSchema, DataSourceSchema, DataSourceSchema as InputContentDataSourceSchema, DeveloperMessageSchema, DocumentPartSchema as DocumentInputContentSchema, DocumentPartSchema as DocumentInputPartSchema, DocumentPartSchema, EventSchema, EventSchema as EventSchemas, EventTypeSchema, ExecutionCapabilitiesSchema, FileSourceSchema, FunctionCallSchema, HumanInTheLoopCapabilitiesSchema, IdentityCapabilitiesSchema, ImagePartSchema as ImageInputContentSchema, ImagePartSchema as ImageInputPartSchema, ImagePartSchema, PartSourceSchema as InputContentSourceSchema, PartSourceSchema, UrlSourceSchema as InputContentUrlSourceSchema, UrlSourceSchema, InterruptSchema, JsonPatchOperationSchema, JsonPatchSchema, JsonPointerSchema, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, MoveOperationSchema, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OptionalMetadataSchema, OutputCapabilitiesSchema, PROTOCOL_VERSION, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, RemoveOperationSchema, ReplaceOperationSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedCancelledOutcomeSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunStartedEventSchema, StateCapabilitiesSchema, StateDeltaEventSchema, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentInfoSchema, SubagentRunIdSchema, SubagentStartedEventSchema, SystemMessageSchema, TestOperationSchema, TextPartSchema as TextInputContentSchema, TextPartSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageRoleSchema, TextMessageStartEventSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TransportCapabilitiesSchema, UserMessageSchema, VideoPartSchema as VideoInputContentSchema, VideoPartSchema as VideoInputPartSchema, VideoPartSchema };\n//# sourceMappingURL=schemas.mjs.map","<script setup lang=\"ts\">\nimport { version as sdkVersion } from \"../../../package.json\";\ndefineOptions({\n inheritAttrs: false,\n});\n\nimport { onMounted, onUnmounted, shallowRef, useAttrs, watch } from \"vue\";\nimport type { ObjectDirective } from \"vue\";\nimport type { WebInspectorElement } from \"@copilotkit/web-inspector\";\nimport type { CopilotKitCoreVue } from \"../lib/vue-core\";\nimport type { VueInspectorOpenRequest } from \"../providers/keys\";\n\nconst props = defineProps<{\n core?: CopilotKitCoreVue | null;\n openRequest?: VueInspectorOpenRequest | null;\n}>();\n\nconst attrs = useAttrs();\nconst inspectorTag = shallowRef<string | null>(null);\nconst inspector = shallowRef<WebInspectorElement | null>(null);\n\nlet isMounted = true;\nlet configureInspector:\n | ((\n element: WebInspectorElement,\n core: CopilotKitCoreVue | null,\n ) => WebInspectorElement)\n | null = null;\n\nconst vConfigureInspector: ObjectDirective<WebInspectorElement, undefined> = {\n created(element) {\n configureInspector?.(element, props.core ?? null);\n inspector.value = element;\n if (props.openRequest) {\n element.openInspector?.(\"message_toolbar\", props.openRequest);\n }\n },\n};\n\nonMounted(() => {\n void import(\"@copilotkit/web-inspector\")\n .then((mod) => {\n if (!isMounted) return;\n\n mod.defineWebInspector?.();\n configureInspector = (element, core) =>\n mod.configureWebInspectorElement(element, core, {\n development: process.env.NODE_ENV === \"development\",\n framework: \"vue\",\n sdkVersion,\n });\n inspectorTag.value = mod.WEB_INSPECTOR_TAG;\n })\n .catch((error: unknown) => {\n console.error(\"Failed to load CopilotKit inspector:\", error);\n });\n});\n\nonUnmounted(() => {\n isMounted = false;\n inspector.value = null;\n});\n\nwatch(\n () => props.core,\n (core) => {\n if (inspector.value) inspector.value.core = core ?? null;\n },\n);\n\nwatch(\n () => props.openRequest,\n (request) => {\n if (request) inspector.value?.openInspector?.(\"message_toolbar\", request);\n },\n);\n</script>\n\n<template>\n <component\n :is=\"inspectorTag\"\n v-if=\"inspectorTag\"\n v-bind=\"attrs\"\n v-configure-inspector\n />\n</template>\n","import type { ComputedRef, InjectionKey, Ref, ShallowRef } from \"vue\";\nimport type { CopilotKitCoreVue } from \"../lib/vue-core\";\nimport type { CopilotChatConfigurationValue } from \"./types\";\nimport type { A2UITheme } from \"../types\";\nimport type { SandboxFunction } from \"../types\";\n\nexport interface CopilotKitContextValue {\n copilotkit: ShallowRef<CopilotKitCoreVue>;\n executingToolCallIds: Ref<ReadonlySet<string>>;\n a2uiTheme: ComputedRef<A2UITheme | undefined>;\n a2uiCatalog: ComputedRef<unknown>;\n a2uiLoadingComponent: ComputedRef<unknown>;\n a2uiIncludeSchema: ComputedRef<boolean>;\n}\n\nexport const CopilotKitKey: InjectionKey<CopilotKitContextValue> =\n Symbol(\"CopilotKit\");\n\nexport const CopilotChatConfigurationKey: InjectionKey<\n ComputedRef<CopilotChatConfigurationValue>\n> = Symbol(\"CopilotChatConfiguration\");\n\nexport const SandboxFunctionsKey: InjectionKey<\n Ref<readonly SandboxFunction[]>\n> = Symbol(\"SandboxFunctions\");\n\nexport type VueInspectorOpenRequest = {\n messageId: string;\n threadId?: string;\n agentId?: string;\n};\n\nexport type VueInspectorContextValue = {\n isInspectorEnabled: ComputedRef<boolean>;\n openInspector: (request: VueInspectorOpenRequest) => void;\n};\n\nexport const InspectorKey: InjectionKey<VueInspectorContextValue> = Symbol(\n \"CopilotKitInspector\",\n);\n\nexport interface CopilotStyleOptions {\n /** CSP nonce for the `<style>` tag. */\n nonce?: string;\n /** `false` when the app loads `@copilotkit/core/styles.css` itself. */\n inject: boolean;\n}\n\n/** Passes the provider's style options to `<CopilotKitStyles>`. */\nexport const CopilotStyleOptionsKey: InjectionKey<\n ComputedRef<CopilotStyleOptions>\n> = Symbol(\"CopilotStyleOptions\");\n","import { inject } from \"vue\";\nimport { CopilotKitKey } from \"./keys\";\n\nexport function useCopilotKit() {\n const context = inject(CopilotKitKey);\n if (!context) {\n throw new Error(\"useCopilotKit must be used within CopilotKitProvider\");\n }\n\n return context;\n}\n","import { computed, defineComponent, h, ref, shallowRef, watch } from \"vue\";\nimport type { PropType } from \"vue\";\nimport type { AbstractAgent } from \"@ag-ui/client\";\nimport type { VueActivityMessageRendererProps } from \"../types\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\n\n// The app<->host protocol (ext-apps AppBridge, sandbox proxy, request queue,\n// ui/message + open-link handlers, tool input/result) lives in the shared,\n// framework-agnostic package. This file is now a THIN Vue adapter over it: it\n// owns the iframe (create/mount/size/remove) and wires the session's reactive\n// hooks to Vue refs; all protocol logic is `bindMcpApp`.\n//\n// The lightweight activity surface (type + content schema + follow-up runner)\n// is re-exported from the package's bridge-free `/activity` entry, so importing\n// it (for the activity registry) does NOT pull the ext-apps bundle. The bridge\n// itself is loaded lazily via a dynamic `import(\"@copilotkit/mcp-apps-renderer\")`\n// inside the watcher, so a `<CopilotKitProvider>` app only pays for it when it\n// actually renders an MCP App.\nexport {\n MCPAppsActivityType,\n MCPAppsActivityContentSchema,\n ɵrunMcpFollowUp,\n} from \"@copilotkit/mcp-apps-renderer/activity\";\nexport type {\n MCPAppsActivityContent,\n ɵMcpFollowUpHost,\n} from \"@copilotkit/mcp-apps-renderer/activity\";\n\nimport type { MCPAppsActivityContent } from \"@copilotkit/mcp-apps-renderer/activity\";\n// Type-only imports: erased at build, so they never pull the ext-apps bridge\n// into the bundle. Only the dynamic import() below does, and only lazily.\nimport type {\n McpAppSession,\n FetchedResource,\n} from \"@copilotkit/mcp-apps-renderer\";\n\n/**\n * MCP Apps Extension Activity Renderer\n *\n * Renders MCP Apps UI in a sandboxed iframe with full protocol support.\n * Fetches resource content on-demand via proxied MCP requests. The Vue shell\n * owns the iframe; `bindMcpApp` owns the protocol.\n */\nexport const MCPAppsActivityRenderer = defineComponent({\n name: \"MCPAppsActivityRenderer\",\n props: {\n activityType: {\n type: String,\n required: true,\n },\n content: {\n type: Object as PropType<MCPAppsActivityContent>,\n required: true,\n },\n message: {\n type: Object as PropType<\n VueActivityMessageRendererProps<MCPAppsActivityContent>[\"message\"]\n >,\n required: true,\n },\n agent: {\n type: Object as PropType<AbstractAgent | undefined>,\n required: false,\n default: undefined,\n },\n /**\n * Restore `allow-same-origin` on the sandbox. Unsafe: the widget runs with\n * the host page's origin. Set via `mcpApps.allowSameOriginFallback` on\n * `CopilotKitProvider`.\n */\n allowSameOriginFallback: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const { copilotkit } = useCopilotKit();\n const containerRef = ref<HTMLDivElement | null>(null);\n // UI-only state: plain refs are fine (no agent-bound payload crosses here).\n const error = ref<Error | null>(null);\n // Recoverable: an activity update the content schema rejected, from the\n // store or from props. Cleared as soon as valid content resumes, unlike\n // `error`, which is a fatal setup failure.\n const contentError = ref<Error | null>(null);\n const isLoading = ref(true);\n const iframeSize = ref<{ width?: number; height?: number }>({});\n // shallowRef for externally-owned objects: the session, the iframe element\n // and the fetched resource must never be wrapped in a reactive proxy (the\n // resource crosses into the widget, and proxies are not clone-safe).\n const iframeRef = shallowRef<HTMLIFrameElement | null>(null);\n const sessionRef = shallowRef<McpAppSession | null>(null);\n const fetchedResource = shallowRef<FetchedResource | null>(null);\n\n // The activity message id. Passed to the session so it self-subscribes to\n // the agent's activity stream and pushes tool input/result itself (this\n // adapter does not forward store-backed activities).\n const messageId = computed(() => props.message?.id);\n\n // Create the sandbox iframe and bind the MCP session. Re-binds only when the\n // widget identity (resourceUri/serverHash/serverId) or the agent/host/message\n // changes - NOT when tool input/result stream in (those are pushed without\n // recreating the iframe). `flush: \"post\"` so the container element is mounted\n // when the callback runs.\n watch(\n [\n // The container element is a watch source, not just a read: `immediate`\n // runs the callback synchronously at setup, before the template ref is\n // populated. Watching it re-runs the bind once the element mounts.\n containerRef,\n () => props.agent,\n () => copilotkit.value,\n messageId,\n () => props.content.resourceUri,\n () => props.content.serverHash,\n () => props.content.serverId,\n () => props.allowSameOriginFallback,\n ],\n ([container, agent], _old, onCleanup) => {\n if (!agent) {\n error.value = new Error(\"No agent available to fetch resource\");\n isLoading.value = false;\n return;\n }\n if (!container) {\n return;\n }\n\n let mounted = true;\n isLoading.value = true;\n error.value = null;\n contentError.value = null;\n iframeSize.value = {};\n fetchedResource.value = null;\n\n // The host owns the iframe: create + mount it here (bindMcpApp only\n // configures the sandbox contract + talks to it through the bridge).\n const iframe = document.createElement(\"iframe\");\n iframe.style.width = \"100%\";\n iframe.style.height = \"100px\";\n iframe.style.border = \"none\";\n iframe.style.backgroundColor = \"transparent\";\n iframe.style.display = \"block\";\n container.appendChild(iframe);\n iframeRef.value = iframe;\n\n // Register cleanup BEFORE the async import: if this watcher is\n // invalidated (props change / unmount) while the import is in flight,\n // `mounted` is already false when it resolves, so we never bind.\n onCleanup(() => {\n mounted = false;\n sessionRef.value?.teardown();\n sessionRef.value = null;\n iframe.remove();\n if (iframeRef.value === iframe) {\n iframeRef.value = null;\n }\n });\n\n const setup = async () => {\n try {\n // Load the bridge package lazily. The bridge is heavy (it pulls the\n // MCP SDK Protocol + zod schemas, ~40-50 kB gzipped); keeping it\n // behind a dynamic import() means a non-MCP app never pays for it.\n const mod = await import(\"@copilotkit/mcp-apps-renderer\").catch(\n (importErr) => {\n throw new Error(\n \"MCP Apps require '@copilotkit/mcp-apps-renderer' and its \" +\n \"'@modelcontextprotocol/ext-apps' dependency. Reinstall your \" +\n \"dependencies if this package is missing.\",\n { cause: importErr },\n );\n },\n );\n if (!mounted) return;\n\n const session = mod.bindMcpApp({\n iframe,\n getContent: () => props.content,\n getAgent: () => props.agent,\n host: copilotkit.value,\n // Self-driving: the session subscribes to the agent's activity\n // stream (filtered by messageId) and pushes tool input/result to\n // the widget itself, so this adapter does not forward STORE-backed\n // activities. It still calls syncContent for activities rendered\n // from an external messages list (see the seed below).\n messageId: messageId.value,\n options: {\n allowSameOriginFallback: props.allowSameOriginFallback,\n },\n hooks: {\n onResource: (resource) => {\n if (!mounted) return;\n fetchedResource.value = resource;\n isLoading.value = false;\n },\n onSizeChanged: (size) => {\n if (mounted) iframeSize.value = size;\n },\n onContentError: (err) => {\n if (mounted) contentError.value = err;\n },\n onError: (err) => {\n if (!mounted) return;\n error.value = err;\n isLoading.value = false;\n },\n },\n });\n sessionRef.value = session;\n // Seed the initial content now: the content watcher below does not\n // re-run for unchanged props, so an activity rendered from an\n // EXTERNAL messages list (absent from agent.messages) would never\n // receive its initial tool input/result. Deduped + store precedence\n // make this a no-op for agent-backed activities.\n session.syncContent(props.content);\n } catch (err) {\n console.error(\"[MCPAppsRenderer] Setup error:\", err);\n if (mounted) {\n error.value = err instanceof Error ? err : new Error(String(err));\n isLoading.value = false;\n }\n }\n };\n\n void setup();\n },\n { immediate: true, flush: \"post\" },\n );\n\n // Size the iframe when the widget reports a new content size.\n watch(\n iframeSize,\n (size) => {\n const iframe = iframeRef.value;\n if (!iframe) return;\n if (size.width !== undefined) {\n // Use minWidth with min() to allow expansion but cap at 100%\n iframe.style.minWidth = `min(${size.width}px, 100%)`;\n iframe.style.width = \"100%\";\n }\n if (size.height !== undefined) {\n iframe.style.height = `${size.height}px`;\n }\n },\n { deep: true },\n );\n\n // Forward tool input/result from the content prop. The session is\n // self-driving for activities that live in the agent's message store, but a\n // host can render an activity from an EXTERNAL messages list that is absent\n // from `agent.messages`; this keeps such widgets fed. `syncContent` is\n // deduped and shares the subscription's dedup, so the agent-driven path\n // never double-sends.\n watch(\n [() => props.content.toolInput, () => props.content.result],\n () => {\n sessionRef.value?.syncContent(props.content);\n },\n { deep: true },\n );\n\n // Determine border styling based on prefersBorder metadata from fetched\n // resource: true = show border/background, false = none, undefined = host\n // decides (we default to none).\n const borderStyle = computed(() => {\n const prefersBorder = fetchedResource.value?._meta?.ui?.prefersBorder;\n if (prefersBorder !== true) return {};\n return {\n borderRadius: \"8px\",\n backgroundColor: \"#f9f9f9\",\n border: \"1px solid #e0e0e0\",\n };\n });\n\n return () =>\n h(\n \"div\",\n {\n ref: containerRef,\n style: {\n width: \"100%\",\n height:\n iframeSize.value.height !== undefined\n ? `${iframeSize.value.height}px`\n : \"auto\",\n minHeight: \"100px\",\n overflow: \"hidden\",\n position: \"relative\",\n ...borderStyle.value,\n },\n },\n [\n isLoading.value\n ? h(\n \"div\",\n { style: { padding: \"1rem\", color: \"#666\" } },\n \"Loading...\",\n )\n : null,\n error.value || contentError.value\n ? h(\n \"div\",\n { style: { color: \"red\", padding: \"1rem\" } },\n `Error: ${(error.value ?? contentError.value)!.message}`,\n )\n : null,\n ],\n );\n },\n});\n\nexport default MCPAppsActivityRenderer;\n","import * as z from \"zod\";\n\nexport type A2UIOperation = Record<string, unknown>;\n\nexport const A2UISurfaceActivityType = \"a2ui-surface\";\n\nexport const A2UIActivityContentSchema = z.object({\n operations: z.array(z.record(z.string(), z.unknown())),\n});\n\nexport function getOperationSurfaceId(operation: A2UIOperation): string {\n const surfaceId =\n (operation.surfaceId as string | undefined) ??\n ((operation.beginRendering as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.surfaceUpdate as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.dataModelUpdate as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.deleteSurface as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.createSurface as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.updateComponents as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.updateDataModel as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined);\n\n return surfaceId ?? \"default\";\n}\n","import { nextTick } from \"vue\";\nimport type {\n VueActivityMessageRenderer,\n VueToolCallRenderer,\n VueCustomMessageRenderer,\n} from \"../types\";\nimport type { InterruptRenderProps } from \"../types/interrupt\";\nimport { CopilotKitCore } from \"@copilotkit/core\";\nimport type {\n CopilotKitCoreConfig,\n CopilotKitCoreSubscriber,\n CopilotKitCoreSubscription,\n} from \"@copilotkit/core\";\n\nexport interface CopilotKitCoreVueConfig extends CopilotKitCoreConfig {\n renderToolCalls?: VueToolCallRenderer<unknown>[];\n renderActivityMessages?: VueActivityMessageRenderer<unknown>[];\n renderCustomMessages?: VueCustomMessageRenderer[];\n}\n\nexport interface CopilotKitCoreVueSubscriber extends CopilotKitCoreSubscriber {\n onRenderToolCallsChanged?: (event: {\n copilotkit: CopilotKitCoreVue;\n renderToolCalls: VueToolCallRenderer<unknown>[];\n }) => void | Promise<void>;\n onRenderCustomMessagesChanged?: (event: {\n copilotkit: CopilotKitCoreVue;\n renderCustomMessages: VueCustomMessageRenderer[];\n }) => void | Promise<void>;\n onInterruptStateChanged?: (event: {\n copilotkit: CopilotKitCoreVue;\n interruptState: InterruptRenderProps<unknown, unknown> | null;\n }) => void | Promise<void>;\n}\n\nexport class CopilotKitCoreVue extends CopilotKitCore {\n private _renderToolCalls: VueToolCallRenderer<unknown>[] = [];\n private _hookRenderToolCalls: Map<string, VueToolCallRenderer<unknown>> =\n new Map();\n private _cachedMergedRenderToolCalls: VueToolCallRenderer<unknown>[] | null =\n null;\n private _renderCustomMessages: VueCustomMessageRenderer[] = [];\n private _renderActivityMessages: VueActivityMessageRenderer<unknown>[] = [];\n private _interruptState: InterruptRenderProps<unknown, unknown> | null = null;\n\n constructor(config: CopilotKitCoreVueConfig) {\n // Tool handlers can change reactive state. `nextTick` lets Vue flush those\n // updates before core starts the follow-up run.\n super({ ...config, ɵwaitForFrameworkUpdates: () => nextTick() });\n this._renderToolCalls = config.renderToolCalls ?? [];\n this._renderCustomMessages = config.renderCustomMessages ?? [];\n this._renderActivityMessages = config.renderActivityMessages ?? [];\n }\n\n get renderCustomMessages(): Readonly<VueCustomMessageRenderer[]> {\n return this._renderCustomMessages;\n }\n\n get renderActivityMessages(): Readonly<\n VueActivityMessageRenderer<unknown>[]\n > {\n return this._renderActivityMessages;\n }\n\n setRenderActivityMessages(\n renderers: VueActivityMessageRenderer<unknown>[],\n ): void {\n this._renderActivityMessages = [...renderers];\n }\n\n setRenderCustomMessages(renderers: VueCustomMessageRenderer[]): void {\n this._renderCustomMessages = [...renderers];\n void this.notifySubscribers((subscriber) => {\n const vueSubscriber = subscriber as CopilotKitCoreVueSubscriber;\n return vueSubscriber.onRenderCustomMessagesChanged?.({\n copilotkit: this,\n renderCustomMessages: [...this.renderCustomMessages],\n });\n }, \"Subscriber onRenderCustomMessagesChanged error:\");\n }\n\n get propRenderToolCalls(): Readonly<VueToolCallRenderer<unknown>[]> {\n return this._renderToolCalls;\n }\n\n get renderToolCalls(): Readonly<VueToolCallRenderer<unknown>[]> {\n if (this._hookRenderToolCalls.size === 0) {\n return this._renderToolCalls;\n }\n if (this._cachedMergedRenderToolCalls) {\n return this._cachedMergedRenderToolCalls;\n }\n const merged = new Map<string, VueToolCallRenderer<unknown>>();\n for (const rc of this._renderToolCalls) {\n merged.set(`${rc.agentId ?? \"\"}:${rc.name}`, rc);\n }\n for (const [key, rc] of this._hookRenderToolCalls) {\n merged.set(key, rc);\n }\n this._cachedMergedRenderToolCalls = Array.from(merged.values());\n return this._cachedMergedRenderToolCalls;\n }\n\n get interruptState(): InterruptRenderProps<unknown, unknown> | null {\n return this._interruptState;\n }\n\n setRenderToolCalls(renderToolCalls: VueToolCallRenderer<unknown>[]): void {\n this._renderToolCalls = [...renderToolCalls];\n this._cachedMergedRenderToolCalls = null;\n this._notifyRenderToolCallsChanged();\n }\n\n addHookRenderToolCall(entry: VueToolCallRenderer<unknown>): void {\n const key = `${entry.agentId ?? \"\"}:${entry.name}`;\n this._hookRenderToolCalls.set(key, entry);\n this._cachedMergedRenderToolCalls = null;\n this._notifyRenderToolCallsChanged();\n }\n\n removeHookRenderToolCall(name: string, agentId?: string): void {\n const key = `${agentId ?? \"\"}:${name}`;\n if (this._hookRenderToolCalls.delete(key)) {\n this._cachedMergedRenderToolCalls = null;\n this._notifyRenderToolCallsChanged();\n }\n }\n\n private _notifyRenderToolCallsChanged(): void {\n void this.notifySubscribers((subscriber) => {\n const vueSubscriber = subscriber as CopilotKitCoreVueSubscriber;\n return vueSubscriber.onRenderToolCallsChanged?.({\n copilotkit: this,\n renderToolCalls: [...this.renderToolCalls],\n });\n }, \"Subscriber onRenderToolCallsChanged error:\");\n }\n\n setInterruptState(\n interruptState: InterruptRenderProps<unknown, unknown> | null,\n ): void {\n this._interruptState = interruptState;\n void this.notifySubscribers((subscriber) => {\n const vueSubscriber = subscriber as CopilotKitCoreVueSubscriber;\n return vueSubscriber.onInterruptStateChanged?.({\n copilotkit: this,\n interruptState: this._interruptState,\n });\n }, \"Subscriber onInterruptStateChanged error:\");\n }\n\n subscribe(\n subscriber: CopilotKitCoreVueSubscriber,\n ): CopilotKitCoreSubscription {\n return super.subscribe(subscriber);\n }\n}\n","import { defineComponent, h, onBeforeUnmount, ref, watch } from \"vue\";\nimport type { PropType, VNodeChild } from \"vue\";\nimport * as z from \"zod\";\n\n/**\n * Shared pre-paint lifecycle states for the A2UI surface renderer, ported from\n * React's `A2UIRecoveryStates`.\n *\n * The A2UI middleware drives the WHOLE generative-UI lifecycle on a single\n * `a2ui-surface` activity (one stable messageId, `replace: true`), so the states\n * below swap IN PLACE and the painted surface ultimately replaces them:\n *\n * building → animated skeleton + \"Building interface\" (+ optional ~N tokens)\n * retrying → same skeleton; once perceptible, the sub-label becomes\n * \"Retrying generation… (N/M attempts)\" (threshold-gated so a fast\n * transient retry never flashes), with debug detail per debugExposure\n * failed → a clean hard-failure card (replacing the skeleton), developer\n * detail tucked into an expander gated by debugExposure\n * painted → the surface renderer owns the UI (these states render nothing)\n *\n * Timing (`showAfterMs` / `showAfterAttempts`) and how much debug detail to\n * surface (`debugExposure`) are client concerns; the server can override\n * `debugExposure` by stamping it onto the activity content (it wins over the\n * client option).\n */\nexport type A2UIRecoveryRendererOptions = {\n /** Delay (ms) before the \"Retrying…\" sub-label becomes visible. Default 2000. */\n showAfterMs?: number;\n /** Show the \"Retrying…\" sub-label immediately once `attempt` reaches this. Default 2. */\n showAfterAttempts?: number;\n /** How much retry/debug detail to surface. Default \"collapsed\". */\n debugExposure?: \"hidden\" | \"collapsed\" | \"verbose\";\n};\n\nexport type DebugExposure = \"hidden\" | \"collapsed\" | \"verbose\";\n\n/**\n * The pre-paint lifecycle fields the middleware stamps onto the `a2ui-surface`\n * activity content (alongside `a2ui_operations` on paint).\n */\nexport const A2UILifecycleFields = {\n status: z.enum([\"building\", \"retrying\", \"failed\"]).optional(),\n attempt: z.number().optional(),\n maxAttempts: z.number().optional(),\n progressTokens: z.number().optional(),\n error: z.string().optional(),\n errors: z.array(z.any()).optional(),\n attempts: z.array(z.any()).optional(),\n // Server-side knob (stamped by the A2UI middleware).\n debugExposure: z.enum([\"hidden\", \"collapsed\", \"verbose\"]).optional(),\n};\n\n/** Server-stamped debugExposure wins; else the client option. */\nexport function resolveDebugExposure(\n content: any,\n optionDebugExposure: DebugExposure,\n): DebugExposure {\n return content?.debugExposure ?? optionDebugExposure;\n}\n\nconst tokensOf = (content: any): number | undefined =>\n typeof content?.progressTokens === \"number\"\n ? content.progressTokens\n : undefined;\n\n// --- Skeleton + primitives ---------------------------------------------------\n\nconst dot = () =>\n h(\"div\", {\n style: {\n width: \"7px\",\n height: \"7px\",\n borderRadius: \"50%\",\n backgroundColor: \"#d4d4d8\",\n flexShrink: 0,\n },\n });\n\nconst spacer = () => h(\"div\", { style: { width: \"12px\" } });\n\nconst bar = (\n w: number,\n ht: number,\n bg: string,\n anim?: number,\n opacity?: number,\n transition?: string,\n) =>\n h(\"div\", {\n style: {\n width: `${w}px`,\n height: `${ht}px`,\n borderRadius: \"9999px\",\n backgroundColor: bg,\n ...(anim !== undefined\n ? {\n animation: `cpk-a2ui-fade 2.4s ease-in-out ${anim}s infinite`,\n }\n : {}),\n ...(opacity !== undefined ? { opacity } : {}),\n ...(transition ? { transition } : {}),\n },\n });\n\nconst row = (show: boolean, delay: number, children: VNodeChild[]) =>\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"6px\",\n opacity: show ? 1 : 0,\n transition: `opacity 0.4s ${delay}s`,\n },\n },\n children,\n );\n\n/**\n * Animated wireframe skeleton with a label, an optional live token count, and\n * optional debug detail below it. The `tokens` count drives a progressive\n * reveal of skeleton rows.\n */\nexport function renderA2UIGeneratingSkeleton(\n label: string,\n tokens?: number,\n children?: VNodeChild[],\n): VNodeChild {\n // No count yet → show the fuller skeleton rather than an empty box.\n const phase =\n tokens == null\n ? 3\n : tokens < 50\n ? 0\n : tokens < 200\n ? 1\n : tokens < 400\n ? 2\n : 3;\n\n return h(\"div\", { style: { margin: \"12px 0\", maxWidth: \"320px\" } }, [\n h(\n \"div\",\n {\n style: {\n position: \"relative\",\n overflow: \"hidden\",\n borderRadius: \"12px\",\n border: \"1px solid rgba(228,228,231,0.8)\",\n backgroundColor: \"#fff\",\n boxShadow: \"0 1px 2px rgba(0,0,0,0.04)\",\n padding: \"16px 18px 14px\",\n },\n },\n [\n // Top bar\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n marginBottom: \"12px\",\n },\n },\n [\n h(\"div\", { style: { display: \"flex\", gap: \"4px\" } }, [\n dot(),\n dot(),\n dot(),\n ]),\n bar(\n 64,\n 6,\n \"#e4e4e7\",\n undefined,\n phase >= 1 ? 1 : 0.4,\n \"opacity 0.5s\",\n ),\n ],\n ),\n // Skeleton lines\n h(\"div\", { style: { display: \"grid\", gap: \"7px\" } }, [\n row(phase >= 0, 0, [\n bar(36, 7, \"rgba(147,197,253,0.7)\", 0),\n bar(80, 7, \"rgba(219,234,254,0.8)\", 0.2),\n ]),\n row(phase >= 0, 0.1, [\n spacer(),\n dot(),\n bar(100, 7, \"rgba(24,24,27,0.2)\", 0.3),\n ]),\n row(phase >= 1, 0.15, [\n spacer(),\n bar(48, 7, \"rgba(24,24,27,0.15)\", 0.1),\n bar(40, 7, \"rgba(153,246,228,0.6)\", 0.5),\n bar(56, 7, \"rgba(147,197,253,0.6)\", 0.3),\n ]),\n row(phase >= 1, 0.2, [\n spacer(),\n dot(),\n bar(60, 7, \"rgba(24,24,27,0.15)\", 0.4),\n ]),\n row(phase >= 2, 0.25, [\n bar(40, 7, \"rgba(153,246,228,0.5)\", 0.2),\n dot(),\n bar(48, 7, \"rgba(24,24,27,0.15)\", 0.6),\n bar(64, 7, \"rgba(147,197,253,0.5)\", 0.1),\n ]),\n row(phase >= 2, 0.3, [\n bar(36, 7, \"rgba(147,197,253,0.6)\", 0.5),\n bar(36, 7, \"rgba(24,24,27,0.12)\", 0.7),\n ]),\n row(phase >= 3, 0.35, [\n dot(),\n bar(44, 7, \"rgba(24,24,27,0.18)\", 0.3),\n dot(),\n bar(56, 7, \"rgba(153,246,228,0.5)\", 0.8),\n bar(48, 7, \"rgba(147,197,253,0.5)\", 0.4),\n ]),\n ]),\n // Shimmer\n h(\"div\", {\n style: {\n pointerEvents: \"none\",\n position: \"absolute\",\n inset: \"0\",\n background:\n \"linear-gradient(105deg, transparent 0%, transparent 40%, rgba(255,255,255,0.6) 50%, transparent 60%, transparent 100%)\",\n backgroundSize: \"250% 100%\",\n animation: \"cpk-a2ui-sweep 3s ease-in-out infinite\",\n },\n }),\n ],\n ),\n // Label\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"8px\",\n marginTop: \"8px\",\n },\n },\n [\n h(\n \"span\",\n {\n style: {\n fontSize: \"12px\",\n color: \"#a1a1aa\",\n letterSpacing: \"0.025em\",\n },\n },\n label,\n ),\n ...(typeof tokens === \"number\" && tokens > 0\n ? [\n h(\n \"span\",\n {\n style: {\n fontSize: \"11px\",\n color: \"#d4d4d8\",\n fontVariantNumeric: \"tabular-nums\",\n },\n },\n `~${tokens.toLocaleString()} tokens`,\n ),\n ]\n : []),\n ],\n ),\n ...(children ?? []),\n // Keyframe styles\n h(\n \"style\",\n `\n @keyframes cpk-a2ui-fade {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n @keyframes cpk-a2ui-sweep {\n 0% { background-position: 250% 0; }\n 100% { background-position: -250% 0; }\n }\n `,\n ),\n ]);\n}\n\nfunction renderDebugDetails(\n label: string,\n open: boolean,\n payload: unknown,\n): VNodeChild {\n return h(\"details\", { open, class: \"cpk-a2ui-debug-details\" }, [\n h(\"summary\", { class: \"cpk-a2ui-debug-details-summary\" }, label),\n h(\n \"pre\",\n { class: \"cpk-a2ui-debug-details-payload\", style: { fontSize: \"11px\" } },\n JSON.stringify(payload, null, 2),\n ),\n ]);\n}\n\n// --- Lifecycle states ---------------------------------------------------------\n\n/** building: the generic skeleton + optional live token count. */\nexport const A2UIBuildingState = defineComponent({\n name: \"A2UIBuildingState\",\n props: {\n content: { type: null as unknown as PropType<any>, default: undefined },\n },\n setup(props) {\n return () =>\n renderA2UIGeneratingSkeleton(\n \"Building interface\",\n tokensOf(props.content),\n );\n },\n});\n\n/**\n * retrying: stays the generic skeleton through fast/transient retries; only\n * once the retry is perceptible (after `showAfterMs`, or once `attempt`\n * crosses `showAfterAttempts`) does the sub-label reveal\n * \"Retrying generation… (N/M)\".\n */\nexport const A2UIRetryingState = defineComponent({\n name: \"A2UIRetryingState\",\n props: {\n content: { type: null as unknown as PropType<any>, default: undefined },\n showAfterMs: { type: Number, required: true },\n showAfterAttempts: { type: Number, required: true },\n debugExposure: {\n type: String as PropType<DebugExposure>,\n required: true,\n },\n },\n setup(props) {\n const attempt = () =>\n typeof props.content?.attempt === \"number\"\n ? (props.content.attempt as number)\n : undefined;\n const immediate = () => {\n const current = attempt();\n return current !== undefined && current >= props.showAfterAttempts;\n };\n const revealed = ref(immediate());\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n watch(\n [immediate, () => props.showAfterMs],\n ([isImmediate, showAfterMs]) => {\n clearTimeout(timer);\n if (isImmediate) {\n revealed.value = true;\n return;\n }\n timer = setTimeout(() => {\n revealed.value = true;\n }, showAfterMs);\n },\n { immediate: true },\n );\n onBeforeUnmount(() => clearTimeout(timer));\n\n return () => {\n const tokens = tokensOf(props.content);\n // Not yet perceptible → indistinguishable from normal building.\n if (!revealed.value) {\n return renderA2UIGeneratingSkeleton(\"Building interface\", tokens);\n }\n const current = attempt();\n const maxAttempts =\n typeof props.content?.maxAttempts === \"number\"\n ? props.content.maxAttempts\n : undefined;\n const label =\n current !== undefined && maxAttempts !== undefined\n ? `Retrying generation… (${current}/${maxAttempts} attempts)`\n : \"Retrying generation…\";\n const errors = Array.isArray(props.content?.errors)\n ? props.content.errors\n : [];\n return renderA2UIGeneratingSkeleton(\n label,\n tokens,\n props.debugExposure !== \"hidden\" && errors.length > 0\n ? [\n renderDebugDetails(\n \"validation issues\",\n props.debugExposure === \"verbose\",\n { attempt: props.content?.attempt, errors },\n ),\n ]\n : [],\n );\n };\n },\n});\n\n/** failed: a clean hard-failure card that replaces the skeleton in place. */\nexport const A2UIRecoveryFailure = defineComponent({\n name: \"A2UIRecoveryFailure\",\n props: {\n content: { type: null as unknown as PropType<any>, default: undefined },\n debugExposure: {\n type: String as PropType<DebugExposure>,\n required: true,\n },\n },\n setup(props) {\n return () =>\n h(\"div\", { class: \"cpk-a2ui-recovery-failure\" }, [\n h(\n \"div\",\n { class: \"cpk-a2ui-recovery-failure-title\" },\n \"Couldn't generate the UI\",\n ),\n h(\n \"div\",\n { class: \"cpk-a2ui-recovery-failure-description\" },\n \"Something went wrong rendering this. You can keep chatting and try again.\",\n ),\n props.debugExposure !== \"hidden\"\n ? renderDebugDetails(\n \"developer details\",\n props.debugExposure === \"verbose\",\n {\n error: props.content?.error,\n attempts: props.content?.attempts,\n },\n )\n : null,\n ]);\n },\n});\n","import { computed, defineComponent, h } from \"vue\";\nimport type { PropType } from \"vue\";\nimport * as z from \"zod\";\nimport type { VueActivityMessageRenderer } from \"../types\";\nimport type { A2UITheme } from \"../types\";\nimport A2UISurfaceActivityRenderer from \"./A2UISurfaceActivityRenderer.vue\";\nimport {\n A2UIBuildingState,\n A2UILifecycleFields,\n A2UIRecoveryFailure,\n A2UIRetryingState,\n resolveDebugExposure,\n} from \"./a2ui/A2UIRecoveryStates\";\nimport type { A2UIRecoveryRendererOptions } from \"./a2ui/A2UIRecoveryStates\";\n\nconst A2UI_OPERATIONS_KEY = \"a2ui_operations\";\n\nexport type A2UIMessageRendererOptions = {\n theme: A2UITheme;\n catalog?: any;\n /** Optional custom loading component shown while the A2UI surface is building. */\n loadingComponent?: unknown;\n /**\n * Pre-paint recovery/loading UX options: timing before the \"Retrying…\"\n * sub-label appears, and how much retry/debug detail to surface.\n */\n recovery?: A2UIRecoveryRendererOptions;\n};\n\n/**\n * The `a2ui-surface` activity carries the WHOLE generative-UI lifecycle on one\n * stable messageId: pre-paint `status` (\"building\" | \"retrying\" | \"failed\")\n * with recovery detail, then `a2ui_operations` on paint. The states swap in\n * place, so the painted surface replaces the skeleton. `.loose()` keeps\n * the operations and any future fields.\n */\nconst A2UISurfaceContentSchema = z\n .object({\n a2ui_operations: z.array(z.any()).optional(),\n ...A2UILifecycleFields,\n })\n .loose();\n\nexport function createA2UIMessageRenderer(\n options: A2UIMessageRendererOptions,\n): VueActivityMessageRenderer<any> {\n const showAfterMs = options.recovery?.showAfterMs ?? 2000;\n const showAfterAttempts = options.recovery?.showAfterAttempts ?? 2;\n const optionDebugExposure = options.recovery?.debugExposure ?? \"collapsed\";\n\n // Renders the pre-paint lifecycle state for a content snapshot.\n const renderLifecycle = (content: any) => {\n const debugExposure = resolveDebugExposure(content, optionDebugExposure);\n if (content?.status === \"failed\") {\n return h(A2UIRecoveryFailure, { content, debugExposure });\n }\n if (content?.status === \"retrying\") {\n return h(A2UIRetryingState, {\n content,\n showAfterMs,\n showAfterAttempts,\n debugExposure,\n });\n }\n // \"building\" / default: a host-supplied loader wins; else the skeleton.\n if (options.loadingComponent) {\n return h(options.loadingComponent as any);\n }\n return h(A2UIBuildingState, { content });\n };\n\n return {\n activityType: \"a2ui-surface\",\n content: A2UISurfaceContentSchema,\n render: defineComponent({\n name: \"A2UIMessageRendererHost\",\n props: {\n activityType: { type: String, required: true },\n content: { type: Object as PropType<any>, required: true },\n message: { type: Object as PropType<any>, required: true },\n agent: {\n type: Object as PropType<any>,\n required: false,\n default: undefined,\n },\n },\n setup(props) {\n const operations = computed(() =>\n Array.isArray(props.content?.[A2UI_OPERATIONS_KEY])\n ? props.content[A2UI_OPERATIONS_KEY]\n : [],\n );\n\n return () => {\n // No painted surface yet → the pre-paint lifecycle state. It shares\n // this activity's messageId, so the painted surface below replaces\n // it in place once operations arrive.\n if (operations.value.length === 0) {\n return renderLifecycle(props.content);\n }\n\n return h(A2UISurfaceActivityRenderer, {\n activityType: \"a2ui-surface\",\n content: { operations: operations.value },\n message: props.message,\n agent: props.agent,\n theme: options.theme,\n catalog: options.catalog,\n });\n };\n },\n }),\n };\n}\n","import { ɵanySchema } from \"@copilotkit/shared\";\nimport type { StandardSchemaV1, InferSchemaOutput } from \"@copilotkit/shared\";\nimport type { VueToolCallRenderer } from \"./vue-tool-call-renderer\";\nimport type { VueToolCallRendererRenderFn } from \"./vue-tool-call-renderer\";\n\nexport function defineToolCallRenderer(def: {\n name: \"*\";\n render: VueToolCallRendererRenderFn<unknown>;\n agentId?: string;\n group?: boolean;\n}): VueToolCallRenderer<unknown>;\n\nexport function defineToolCallRenderer<S extends StandardSchemaV1>(def: {\n name: string;\n args: S;\n render: VueToolCallRendererRenderFn<InferSchemaOutput<S>>;\n agentId?: string;\n group?: boolean;\n}): VueToolCallRenderer<InferSchemaOutput<S>>;\n\nexport function defineToolCallRenderer<S extends StandardSchemaV1>(def: {\n name: string;\n args?: S;\n render: VueToolCallRendererRenderFn<unknown>;\n agentId?: string;\n group?: boolean;\n}): VueToolCallRenderer<unknown> {\n // Only a \"*\" renderer may leave out `args`; it accepts any arguments.\n const args = def.args ?? ɵanySchema;\n return {\n name: def.name,\n args,\n render: def.render,\n ...(def.agentId ? { agentId: def.agentId } : {}),\n ...(def.group ? { group: true } : {}),\n };\n}\n","import { watch } from \"vue\";\nimport type { ShallowRef } from \"vue\";\nimport * as z from \"zod\";\nimport type { CopilotKitCoreVue } from \"../../lib/vue-core\";\nimport { defineToolCallRenderer } from \"../../types/defineToolCallRenderer\";\n\n/**\n * Tool name used by the dynamic A2UI generation secondary LLM.\n * This renderer is auto-registered when A2UI is enabled.\n */\nexport const RENDER_A2UI_TOOL_NAME = \"render_a2ui\";\n\n/**\n * Registers a no-op renderer for the `render_a2ui` tool call so its raw\n * streamed args are never surfaced in the transcript, as React does.\n *\n * The generation skeleton / retry / failure UX is not owned here: the A2UI\n * middleware drives the whole lifecycle on the `a2ui-surface` activity (one\n * stable messageId, building → retrying → failed → painted), rendered in place\n * by `createA2UIMessageRenderer`. A skeleton per tool call would duplicate on\n * retries and multi-call generations and linger after the surface painted.\n *\n * The renderer is registered via the props-based `setRenderToolCalls`\n * mechanism (not `useRenderTool`).\n *\n * This ensures user-registered `useRenderTool({ name: \"render_a2ui\", ... })`\n * hooks automatically override the built-in, since the merge logic in\n * vue-core.ts gives hook-based entries priority over prop-based entries.\n *\n * Call from the provider's setup function and pass a cleanup callback.\n */\nexport function registerA2UIBuiltInToolCallRenderer(\n copilotkit: ShallowRef<CopilotKitCoreVue>,\n enabled: () => boolean,\n): void {\n watch(\n [() => copilotkit.value, enabled],\n ([core, isEnabled], _prev, onCleanup) => {\n if (!isEnabled) return;\n\n const renderer = defineToolCallRenderer({\n name: RENDER_A2UI_TOOL_NAME,\n args: z.any(),\n // Render nothing: the a2ui-surface activity owns all generation UX.\n render: () => null,\n });\n\n // Register via props-based mechanism so useRenderTool hooks take priority\n const existing = core.propRenderToolCalls;\n core.setRenderToolCalls([\n ...existing.filter((rc) => rc.name !== RENDER_A2UI_TOOL_NAME),\n renderer,\n ]);\n\n onCleanup(() => {\n const current = core.propRenderToolCalls;\n core.setRenderToolCalls(\n current.filter((rc) => rc.name !== RENDER_A2UI_TOOL_NAME),\n );\n });\n },\n { immediate: true },\n );\n}\n","/**\n * Vue adapter for @a2ui/web_core v0.9 component rendering.\n *\n * Provides createVueComponent — the Vue equivalent of createReactComponent\n * from the React renderer. Uses GenericBinder for reactive data binding\n * and Vue's render functions for component output.\n */\n\nimport {\n defineComponent,\n ref,\n onUnmounted,\n watch,\n type VNode,\n type PropType,\n} from \"vue\";\nimport {\n ComponentContext,\n GenericBinder,\n type ComponentApi,\n type InferredComponentApiSchemaType,\n type ResolveA2uiProps,\n} from \"@a2ui/web_core/v0_9\";\n\n/** Props passed to a Vue A2UI component's render function. */\nexport interface VueA2uiComponentProps<T, S = void> {\n props: T;\n buildChild: (id: string, basePath?: string) => VNode;\n context: ComponentContext;\n state: S;\n}\n\n/**\n * A Vue component implementation registered with the A2UI Catalog.\n * Mirrors ReactComponentImplementation but uses Vue's component system.\n */\nexport interface VueComponentImplementation extends ComponentApi {\n /** The Vue component that handles rendering. */\n render: ReturnType<typeof defineComponent>;\n}\n\n/**\n * Creates a Vue component implementation using the GenericBinder.\n * This is the Vue equivalent of createReactComponent from the React adapter.\n */\nexport function createVueComponent<Api extends ComponentApi, S = void>(\n api: Api,\n renderFn: (\n componentProps: VueA2uiComponentProps<\n ResolveA2uiProps<InferredComponentApiSchemaType<Api>>,\n S\n >,\n ) => VNode | VNode[] | null,\n setupState?: () => S,\n): VueComponentImplementation {\n type Props = ResolveA2uiProps<InferredComponentApiSchemaType<Api>>;\n\n const VueWrapper = defineComponent({\n name: `A2UI_${api.name}`,\n props: {\n context: {\n type: Object as PropType<ComponentContext>,\n required: true,\n },\n buildChild: {\n type: Function as PropType<(id: string, basePath?: string) => VNode>,\n required: true,\n },\n },\n setup(wrapperProps) {\n const resolvedProps = ref<Props>({} as Props);\n let binder: GenericBinder<Props> | null = null;\n const state = setupState ? setupState() : (undefined as S);\n\n function initBinder(context: ComponentContext) {\n if (binder) {\n binder.dispose();\n }\n binder = new GenericBinder<Props>(context, api.schema);\n resolvedProps.value = binder.snapshot;\n binder.subscribe((newProps: Props) => {\n resolvedProps.value = newProps;\n });\n }\n\n initBinder(wrapperProps.context);\n\n watch(\n () => wrapperProps.context,\n (newContext) => {\n initBinder(newContext);\n },\n );\n\n onUnmounted(() => {\n if (binder) {\n binder.dispose();\n binder = null;\n }\n });\n\n return () =>\n renderFn({\n props: resolvedProps.value,\n buildChild: wrapperProps.buildChild,\n context: wrapperProps.context,\n state,\n });\n },\n });\n\n return {\n name: api.name,\n schema: api.schema,\n render: VueWrapper,\n };\n}\n\n/**\n * Creates a Vue component implementation without the generic binder\n * (for components that manage their own context bindings).\n */\nexport function createBinderlessVueComponent(\n api: ComponentApi,\n renderFn: (componentProps: {\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => VNode;\n }) => VNode | VNode[] | null,\n): VueComponentImplementation {\n const VueWrapper = defineComponent({\n name: `A2UI_${api.name}`,\n props: {\n context: {\n type: Object as PropType<ComponentContext>,\n required: true,\n },\n buildChild: {\n type: Function as PropType<(id: string, basePath?: string) => VNode>,\n required: true,\n },\n },\n setup(wrapperProps) {\n return () =>\n renderFn({\n context: wrapperProps.context,\n buildChild: wrapperProps.buildChild,\n });\n },\n });\n\n return {\n name: api.name,\n schema: api.schema,\n render: VueWrapper,\n };\n}\n","/**\n * Style utilities for Vue A2UI basic catalog components.\n * Mirrors the React renderer's catalog/basic/utils.ts.\n */\n\nimport type { CSSProperties } from \"vue\";\n\n/** Standard leaf margin from the implementation guide. */\nexport const LEAF_MARGIN = \"8px\";\n\n/** Standard internal padding for visually bounded containers. */\nexport const CONTAINER_PADDING = \"16px\";\n\n/** Standard border for cards and inputs. */\nexport const STANDARD_BORDER = \"1px solid var(--a2ui-color-border, #ccc)\";\n\n/** Standard border radius. */\nexport const STANDARD_RADIUS = \"8px\";\n\nexport const mapJustify = (j?: string): string => {\n switch (j) {\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"spaceAround\":\n return \"space-around\";\n case \"spaceBetween\":\n return \"space-between\";\n case \"spaceEvenly\":\n return \"space-evenly\";\n case \"start\":\n return \"flex-start\";\n case \"stretch\":\n return \"stretch\";\n case undefined:\n default:\n return \"flex-start\";\n }\n};\n\nexport const mapAlign = (a?: string): string => {\n switch (a) {\n case \"start\":\n return \"flex-start\";\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"stretch\":\n return \"stretch\";\n case undefined:\n default:\n return \"stretch\";\n }\n};\n\nexport const getBaseLeafStyle = (): CSSProperties => ({\n margin: LEAF_MARGIN,\n boxSizing: \"border-box\",\n});\n\nexport const getBaseContainerStyle = (): CSSProperties => ({\n margin: LEAF_MARGIN,\n padding: CONTAINER_PADDING,\n border: STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n boxSizing: \"border-box\",\n});\n","/**\n * Vue basic catalog for A2UI v0.9.\n *\n * Provides Vue component implementations for all 18 basic catalog components,\n * mirroring the React renderer's catalog/basic/.\n */\n\nimport { h, ref } from \"vue\";\nimport type { CSSProperties, VNode } from \"vue\";\nimport { Catalog } from \"@a2ui/web_core/v0_9\";\nimport {\n TextApi,\n ImageApi,\n IconApi,\n VideoApi,\n AudioPlayerApi,\n RowApi,\n ColumnApi,\n ListApi,\n CardApi,\n TabsApi,\n DividerApi,\n ModalApi,\n ButtonApi,\n TextFieldApi,\n CheckBoxApi,\n ChoicePickerApi,\n SliderApi,\n DateTimeInputApi,\n BASIC_FUNCTIONS,\n} from \"@a2ui/web_core/v0_9/basic_catalog\";\n\nimport { createVueComponent } from \"./adapter\";\nimport type { VueComponentImplementation } from \"./adapter\";\nimport {\n LEAF_MARGIN,\n STANDARD_BORDER,\n STANDARD_RADIUS,\n getBaseLeafStyle,\n getBaseContainerStyle,\n mapJustify,\n mapAlign,\n} from \"./utils\";\n\n// -- Helper: render a child list (arrays of { id, basePath } or string IDs) --\nfunction renderChildList(\n childList: unknown,\n buildChild: (id: string, basePath?: string) => VNode,\n): VNode[] {\n if (!Array.isArray(childList)) return [];\n return childList\n .map((item: unknown) => {\n if (item && typeof item === \"object\" && \"id\" in item) {\n const node = item as { id: string; basePath?: string };\n return buildChild(node.id, node.basePath);\n }\n if (typeof item === \"string\") {\n return buildChild(item);\n }\n return null;\n })\n .filter((v): v is VNode => v !== null);\n}\n\n// -- Unique ID counter for form elements --\nlet a2uiIdCounter = 0;\nfunction useA2UIUniqueId(): string {\n return `a2ui-vue-${++a2uiIdCounter}`;\n}\n\n// ============================================================\n// Component Implementations\n// ============================================================\n\nconst Text = createVueComponent(TextApi, ({ props }) => {\n const text = props.text ?? \"\";\n const style = { ...getBaseLeafStyle(), display: \"inline-block\" };\n\n switch (props.variant) {\n case \"h1\":\n return h(\"h1\", { style }, text);\n case \"h2\":\n return h(\"h2\", { style }, text);\n case \"h3\":\n return h(\"h3\", { style }, text);\n case \"h4\":\n return h(\"h4\", { style }, text);\n case \"h5\":\n return h(\"h5\", { style }, text);\n case \"caption\":\n return h(\n \"small\",\n {\n style: {\n ...style,\n color: \"var(--a2ui-color-muted, #666)\",\n textAlign: \"left\",\n },\n },\n text,\n );\n case \"body\":\n case undefined:\n default:\n return h(\"span\", { style }, text);\n }\n});\n\nconst Image = createVueComponent(ImageApi, ({ props }) => {\n const mapFit = (fit?: string): string => {\n if (fit === \"scaleDown\") return \"scale-down\";\n return fit || \"fill\";\n };\n\n const style: CSSProperties = {\n ...getBaseLeafStyle(),\n objectFit: mapFit(props.fit) as CSSProperties[\"objectFit\"],\n width: \"100%\",\n height: \"auto\",\n display: \"block\",\n };\n\n if (props.variant === \"icon\") {\n style.width = \"24px\";\n style.height = \"24px\";\n } else if (props.variant === \"avatar\") {\n style.width = \"40px\";\n style.height = \"40px\";\n style.borderRadius = \"50%\";\n } else if (props.variant === \"smallFeature\") {\n style.maxWidth = \"100px\";\n } else if (props.variant === \"largeFeature\") {\n style.maxHeight = \"400px\";\n } else if (props.variant === \"header\") {\n style.height = \"200px\";\n style.objectFit = \"cover\";\n }\n\n return h(\"img\", { src: props.url, alt: props.description || \"\", style });\n});\n\nconst Icon = createVueComponent(IconApi, ({ props }) => {\n const iconName =\n typeof props.name === \"string\"\n ? props.name\n : (props.name as { path?: string })?.path;\n const style = {\n ...getBaseLeafStyle(),\n fontSize: \"24px\",\n width: \"24px\",\n height: \"24px\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n return h(\"span\", { class: \"material-symbols-outlined\", style }, iconName);\n});\n\nconst Video = createVueComponent(VideoApi, ({ props }) => {\n const style = {\n ...getBaseLeafStyle(),\n width: \"100%\",\n aspectRatio: \"16/9\",\n };\n\n return h(\"video\", { src: props.url, controls: true, style });\n});\n\nconst AudioPlayer = createVueComponent(AudioPlayerApi, ({ props }) => {\n const style = { ...getBaseLeafStyle(), width: \"100%\" };\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n },\n },\n [\n props.description\n ? h(\n \"span\",\n {\n style: {\n fontSize: \"12px\",\n color: \"var(--a2ui-color-muted, #666)\",\n },\n },\n props.description,\n )\n : null,\n h(\"audio\", { src: props.url, controls: true, style }),\n ],\n );\n});\n\nconst Row = createVueComponent(RowApi, ({ props, buildChild }) => {\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: mapJustify(props.justify),\n alignItems: mapAlign(props.align),\n width: \"100%\",\n margin: \"0\",\n padding: \"0\",\n },\n },\n renderChildList(props.children, buildChild),\n );\n});\n\nconst Column = createVueComponent(ColumnApi, ({ props, buildChild }) => {\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: mapJustify(props.justify),\n alignItems: mapAlign(props.align),\n width: \"100%\",\n margin: \"0\",\n padding: \"0\",\n },\n },\n renderChildList(props.children, buildChild),\n );\n});\n\nconst List = createVueComponent(ListApi, ({ props, buildChild }) => {\n const isHorizontal = props.direction === \"horizontal\";\n const style = {\n display: \"flex\",\n flexDirection: isHorizontal ? (\"row\" as const) : (\"column\" as const),\n alignItems: mapAlign(props.align),\n overflowX: isHorizontal ? (\"auto\" as const) : (\"hidden\" as const),\n overflowY: isHorizontal ? (\"hidden\" as const) : (\"auto\" as const),\n width: \"100%\",\n margin: \"0\",\n padding: \"0\",\n };\n\n return h(\"div\", { style }, renderChildList(props.children, buildChild));\n});\n\nconst Card = createVueComponent(CardApi, ({ props, buildChild }) => {\n const style = {\n ...getBaseContainerStyle(),\n backgroundColor: \"var(--a2ui-color-surface, #fff)\",\n boxShadow: \"0 2px 4px rgba(0,0,0,0.1)\",\n width: \"100%\",\n };\n\n return h(\"div\", { style }, [props.child ? buildChild(props.child) : null]);\n});\n\nconst Tabs = createVueComponent(\n TabsApi,\n ({ props, buildChild, state }) => {\n const tabs = props.tabs || [];\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n width: \"100%\",\n margin: LEAF_MARGIN,\n },\n },\n [\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n borderBottom: STANDARD_BORDER,\n marginBottom: \"8px\",\n },\n },\n tabs.map((tab, i: number) => {\n const title =\n typeof tab.title === \"string\"\n ? tab.title\n : String(tab.title ?? \"\");\n return h(\n \"button\",\n {\n key: i,\n onClick: () => {\n state.selectedIndex.value = i;\n },\n style: {\n padding: \"8px 16px\",\n border: \"none\",\n background: \"none\",\n borderBottom:\n state.selectedIndex.value === i\n ? \"2px solid var(--a2ui-primary-color, #007bff)\"\n : \"none\",\n fontWeight:\n state.selectedIndex.value === i ? \"bold\" : \"normal\",\n cursor: \"pointer\",\n color:\n state.selectedIndex.value === i\n ? \"var(--a2ui-primary-color, #007bff)\"\n : \"inherit\",\n },\n },\n title,\n );\n }),\n ),\n h(\"div\", { style: { flex: \"1\" } }, [\n tabs[state.selectedIndex.value]?.child\n ? buildChild(tabs[state.selectedIndex.value]!.child)\n : null,\n ]),\n ],\n );\n },\n () => ({ selectedIndex: ref(0) }),\n);\n\nconst Divider = createVueComponent(DividerApi, ({ props }) => {\n const isVertical = props.axis === \"vertical\";\n const style: Record<string, string> = {\n margin: LEAF_MARGIN,\n border: \"none\",\n backgroundColor: \"var(--a2ui-color-border, #ccc)\",\n };\n\n if (isVertical) {\n style.width = \"1px\";\n style.height = \"100%\";\n } else {\n style.width = \"100%\";\n style.height = \"1px\";\n }\n\n return h(\"div\", { style });\n});\n\nconst Modal = createVueComponent(\n ModalApi,\n ({ props, buildChild, state }) => {\n return h(\"div\", {}, [\n h(\n \"div\",\n {\n onClick: () => {\n state.isOpen.value = true;\n },\n style: { display: \"inline-block\" },\n },\n [props.trigger ? buildChild(props.trigger) : null],\n ),\n state.isOpen.value\n ? h(\n \"div\",\n {\n style: {\n position: \"fixed\",\n top: \"0\",\n left: \"0\",\n right: \"0\",\n bottom: \"0\",\n backgroundColor: \"rgba(0,0,0,0.5)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n zIndex: \"1000\",\n },\n onClick: () => {\n state.isOpen.value = false;\n },\n },\n [\n h(\n \"div\",\n {\n style: {\n backgroundColor: \"var(--a2ui-color-surface, #fff)\",\n padding: \"24px\",\n borderRadius: \"8px\",\n maxWidth: \"90%\",\n maxHeight: \"90%\",\n overflow: \"auto\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n onClick: (e: Event) => e.stopPropagation(),\n },\n [\n h(\n \"div\",\n { style: { display: \"flex\", justifyContent: \"flex-end\" } },\n [\n h(\n \"button\",\n {\n onClick: () => {\n state.isOpen.value = false;\n },\n style: {\n border: \"none\",\n background: \"none\",\n fontSize: \"20px\",\n cursor: \"pointer\",\n padding: \"4px\",\n },\n },\n \"\\u00D7\",\n ),\n ],\n ),\n h(\"div\", { style: { flex: \"1\" } }, [\n props.content ? buildChild(props.content) : null,\n ]),\n ],\n ),\n ],\n )\n : null,\n ]);\n },\n () => ({ isOpen: ref(false) }),\n);\n\nconst Button = createVueComponent(ButtonApi, ({ props, buildChild }) => {\n const style = {\n margin: LEAF_MARGIN,\n padding: \"8px 16px\",\n cursor: \"pointer\",\n border: props.variant === \"borderless\" ? \"none\" : STANDARD_BORDER,\n backgroundColor:\n props.variant === \"primary\"\n ? \"var(--a2ui-primary-color, #007bff)\"\n : props.variant === \"borderless\"\n ? \"transparent\"\n : \"var(--a2ui-color-surface, #fff)\",\n color: props.variant === \"primary\" ? \"#fff\" : \"inherit\",\n borderRadius: \"4px\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n boxSizing: \"border-box\",\n };\n\n return h(\n \"button\",\n {\n style,\n onClick: props.action,\n disabled: props.isValid === false,\n },\n [props.child ? buildChild(props.child) : null],\n );\n});\n\nconst TextField = createVueComponent(\n TextFieldApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n const isLong = props.variant === \"longText\";\n const type =\n props.variant === \"number\"\n ? \"number\"\n : props.variant === \"obscured\"\n ? \"password\"\n : \"text\";\n\n const inputStyle = {\n padding: \"8px\",\n width: \"100%\",\n border:\n props.validationErrors && props.validationErrors.length > 0\n ? \"1px solid var(--a2ui-color-error, red)\"\n : STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n boxSizing: \"border-box\",\n };\n\n const hasError =\n props.validationErrors && props.validationErrors.length > 0;\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n margin: LEAF_MARGIN,\n },\n },\n [\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: { fontSize: \"14px\", fontWeight: \"bold\" },\n },\n props.label,\n )\n : null,\n isLong\n ? h(\"textarea\", {\n id: uniqueId,\n style: inputStyle,\n value: props.value || \"\",\n onInput: (e: Event) =>\n props.setValue((e.target as HTMLTextAreaElement).value),\n })\n : h(\"input\", {\n id: uniqueId,\n type,\n style: inputStyle,\n value: props.value || \"\",\n onInput: (e: Event) =>\n props.setValue((e.target as HTMLInputElement).value),\n }),\n hasError\n ? h(\n \"span\",\n {\n style: {\n fontSize: \"12px\",\n color: \"var(--a2ui-color-error, red)\",\n },\n },\n props.validationErrors![0],\n )\n : null,\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\nconst CheckBox = createVueComponent(\n CheckBoxApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n const hasError =\n props.validationErrors && props.validationErrors.length > 0;\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n margin: LEAF_MARGIN,\n },\n },\n [\n h(\n \"div\",\n { style: { display: \"flex\", alignItems: \"center\", gap: \"8px\" } },\n [\n h(\"input\", {\n id: uniqueId,\n type: \"checkbox\",\n checked: !!props.value,\n onChange: (e: Event) =>\n props.setValue((e.target as HTMLInputElement).checked),\n style: {\n cursor: \"pointer\",\n outline: hasError\n ? \"1px solid var(--a2ui-color-error, red)\"\n : \"none\",\n },\n }),\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: {\n cursor: \"pointer\",\n color: hasError\n ? \"var(--a2ui-color-error, red)\"\n : \"inherit\",\n },\n },\n props.label,\n )\n : null,\n ],\n ),\n hasError\n ? h(\n \"span\",\n {\n style: {\n fontSize: \"12px\",\n color: \"var(--a2ui-color-error, red)\",\n marginTop: \"4px\",\n },\n },\n props.validationErrors?.[0],\n )\n : null,\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\nconst ChoicePicker = createVueComponent(\n ChoicePickerApi,\n ({ props, context, state }) => {\n const values = Array.isArray(props.value) ? props.value : [];\n const isMutuallyExclusive = props.variant === \"mutuallyExclusive\";\n\n const onToggle = (val: string) => {\n if (isMutuallyExclusive) {\n props.setValue([val]);\n } else {\n const newValues = values.includes(val)\n ? values.filter((v: string) => v !== val)\n : [...values, val];\n props.setValue(newValues);\n }\n };\n\n type ChoiceOption = {\n label?: string | Record<string, unknown>;\n value: string;\n };\n const options = (props.options || []).filter(\n (opt: ChoiceOption) =>\n !props.filterable ||\n state.filter.value === \"\" ||\n String(typeof opt.label === \"string\" ? opt.label : \"\")\n .toLowerCase()\n .includes(state.filter.value.toLowerCase()),\n );\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"8px\",\n margin: LEAF_MARGIN,\n width: \"100%\",\n },\n },\n [\n props.label\n ? h(\"strong\", { style: { fontSize: \"14px\" } }, props.label)\n : null,\n props.filterable\n ? h(\"input\", {\n type: \"text\",\n placeholder: \"Filter options...\",\n value: state.filter.value,\n onInput: (e: Event) => {\n state.filter.value = (e.target as HTMLInputElement).value;\n },\n style: {\n padding: \"4px 8px\",\n border: STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n },\n })\n : null,\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: props.displayStyle === \"chips\" ? \"row\" : \"column\",\n flexWrap: props.displayStyle === \"chips\" ? \"wrap\" : \"nowrap\",\n gap: \"8px\",\n },\n },\n options.map((opt: ChoiceOption, i: number) => {\n const isSelected = values.includes(opt.value);\n const label =\n typeof opt.label === \"string\"\n ? opt.label\n : String(opt.label ?? opt.value);\n if (props.displayStyle === \"chips\") {\n return h(\n \"button\",\n {\n key: i,\n onClick: () => onToggle(opt.value),\n style: {\n padding: \"4px 12px\",\n borderRadius: \"16px\",\n border: isSelected\n ? \"1px solid var(--a2ui-primary-color, #007bff)\"\n : STANDARD_BORDER,\n backgroundColor: isSelected\n ? \"var(--a2ui-primary-color, #007bff)\"\n : \"var(--a2ui-color-surface, #fff)\",\n color: isSelected ? \"#fff\" : \"inherit\",\n cursor: \"pointer\",\n fontSize: \"12px\",\n },\n },\n label,\n );\n }\n return h(\n \"label\",\n {\n key: i,\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n cursor: \"pointer\",\n },\n },\n [\n h(\"input\", {\n type: isMutuallyExclusive ? \"radio\" : \"checkbox\",\n checked: isSelected,\n onChange: () => onToggle(opt.value),\n name: isMutuallyExclusive\n ? `choice-${context.componentModel.id}`\n : undefined,\n }),\n h(\"span\", { style: { fontSize: \"14px\" } }, label),\n ],\n );\n }),\n ),\n ],\n );\n },\n () => ({ filter: ref(\"\") }),\n);\n\nconst Slider = createVueComponent(\n SliderApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n margin: LEAF_MARGIN,\n width: \"100%\",\n },\n },\n [\n h(\n \"div\",\n { style: { display: \"flex\", justifyContent: \"space-between\" } },\n [\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: { fontSize: \"14px\", fontWeight: \"bold\" },\n },\n props.label,\n )\n : null,\n h(\n \"span\",\n {\n style: {\n fontSize: \"12px\",\n color: \"var(--a2ui-color-muted, #666)\",\n },\n },\n String(props.value),\n ),\n ],\n ),\n h(\"input\", {\n id: uniqueId,\n type: \"range\",\n min: props.min ?? 0,\n max: props.max,\n value: props.value ?? 0,\n onInput: (e: Event) =>\n props.setValue(Number((e.target as HTMLInputElement).value)),\n style: { width: \"100%\", cursor: \"pointer\" },\n }),\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\nconst DateTimeInput = createVueComponent(\n DateTimeInputApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n\n let type = \"datetime-local\";\n if (props.enableDate && !props.enableTime) type = \"date\";\n if (!props.enableDate && props.enableTime) type = \"time\";\n\n const style = {\n padding: \"8px\",\n width: \"100%\",\n border: STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n boxSizing: \"border-box\",\n };\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n margin: LEAF_MARGIN,\n },\n },\n [\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: { fontSize: \"14px\", fontWeight: \"bold\" },\n },\n props.label,\n )\n : null,\n h(\"input\", {\n id: uniqueId,\n type,\n style,\n value: props.value || \"\",\n onInput: (e: Event) =>\n props.setValue((e.target as HTMLInputElement).value),\n min: typeof props.min === \"string\" ? props.min : undefined,\n max: typeof props.max === \"string\" ? props.max : undefined,\n }),\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\n// ============================================================\n// Catalog Assembly\n// ============================================================\n\nconst vueBasicComponents: VueComponentImplementation[] = [\n Text,\n Image,\n Icon,\n Video,\n AudioPlayer,\n Row,\n Column,\n List,\n Card,\n Tabs,\n Divider,\n Modal,\n Button,\n TextField,\n CheckBox,\n ChoicePicker,\n Slider,\n DateTimeInput,\n];\n\nexport const vueBasicCatalog = new Catalog<VueComponentImplementation>(\n \"https://a2ui.org/specification/v0_9/basic_catalog.json\",\n vueBasicComponents,\n BASIC_FUNCTIONS,\n);\n\nexport {\n Text,\n Image,\n Icon,\n Video,\n AudioPlayer,\n Row,\n Column,\n List,\n Card,\n Tabs,\n Divider,\n Modal,\n Button,\n TextField,\n CheckBox,\n ChoicePicker,\n Slider,\n DateTimeInput,\n};\n","import { computed, watch } from \"vue\";\nimport type { ShallowRef } from \"vue\";\nimport type { Catalog, ComponentApi } from \"@a2ui/web_core/v0_9\";\nimport {\n A2UI_SCHEMA_CONTEXT_DESCRIPTION,\n buildCatalogContextValue as buildContextValue,\n extractCatalogComponentSchemas,\n} from \"@copilotkit/a2ui-renderer/catalog-schema\";\nimport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"@copilotkit/shared\";\nimport type { CopilotKitCoreVue } from \"../../lib/vue-core\";\nimport { vueBasicCatalog } from \"./catalog\";\n\n/**\n * Build a context string describing the available A2UI catalog.\n * Defaults to the Vue basic catalog.\n *\n * When `options.includeSchema` is `false`, custom components are listed by name\n * only and their JSON schemas are omitted.\n */\nexport function buildCatalogContextValue(\n catalog?: Catalog<ComponentApi>,\n options?: { includeSchema?: boolean },\n): string {\n return buildContextValue(catalog ?? vueBasicCatalog, options);\n}\n\n/**\n * Registers agent context describing the available A2UI catalog, component\n * schemas, and generation/design guidelines.\n *\n * Vue-native equivalent of React's `<A2UICatalogContext>` component.\n * Call from the provider's setup function.\n */\nexport function registerA2UICatalogContext(\n copilotkit: ShallowRef<CopilotKitCoreVue>,\n options: {\n enabled: () => boolean;\n catalog: () => Catalog<ComponentApi> | undefined;\n includeSchema: () => boolean;\n },\n): void {\n const contextValue = computed(() =>\n buildCatalogContextValue(options.catalog(), {\n includeSchema: options.includeSchema(),\n }),\n );\n\n // Register catalog capabilities context\n watch(\n [() => copilotkit.value, options.enabled, contextValue],\n ([core, isEnabled, value], _prev, onCleanup) => {\n if (!isEnabled) return;\n // Scope to the agents the runtime applies A2UI to (#5369), so other\n // agents on the endpoint don't receive the catalog payload.\n const agentIds = core.a2uiAgents;\n const id = core.addContext({\n description:\n \"A2UI catalog capabilities: available catalog IDs and \" +\n \"custom component definitions the client can render.\",\n value,\n ...(agentIds ? { agentIds } : {}),\n });\n onCleanup(() => core.removeContext(id));\n },\n { immediate: true },\n );\n\n // Register schema + generation/design guidelines\n const schemaValue = computed(() => {\n if (!options.includeSchema()) return null;\n return JSON.stringify(\n extractCatalogComponentSchemas(options.catalog() ?? vueBasicCatalog),\n );\n });\n\n watch(\n [() => copilotkit.value, options.enabled, schemaValue],\n ([core, isEnabled, schema], _prev, onCleanup) => {\n if (!isEnabled || !schema) return;\n const agentIds = core.a2uiAgents;\n const scope = agentIds ? { agentIds } : {};\n const ids: string[] = [];\n ids.push(\n core.addContext({\n description: A2UI_SCHEMA_CONTEXT_DESCRIPTION,\n value: schema,\n ...scope,\n }),\n );\n ids.push(\n core.addContext({\n description:\n \"A2UI generation guidelines — protocol rules, tool arguments, \" +\n \"path rules, data model format, and \" +\n \"form/two-way-binding instructions.\",\n value: A2UI_DEFAULT_GENERATION_GUIDELINES,\n ...scope,\n }),\n );\n ids.push(\n core.addContext({\n description:\n \"A2UI design guidelines — visual design rules, component \" +\n \"hierarchy tips, and action handler patterns.\",\n value: A2UI_DEFAULT_DESIGN_GUIDELINES,\n ...scope,\n }),\n );\n onCleanup(() => {\n for (const id of ids) core.removeContext(id);\n });\n },\n { immediate: true },\n );\n}\n","import { computed, inject, type ComputedRef, type Ref } from \"vue\";\nimport type { SandboxFunction } from \"../types\";\nimport { SandboxFunctionsKey } from \"./keys\";\n\nexport function useSandboxFunctions(): ComputedRef<readonly SandboxFunction[]> {\n const functionsRef = inject<Ref<readonly SandboxFunction[]>>(\n SandboxFunctionsKey,\n computed(() => []),\n );\n return computed(() => functionsRef.value);\n}\n","import {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n shallowRef,\n watch,\n} from \"vue\";\nimport type { PropType } from \"vue\";\nimport * as z from \"zod\";\nimport {\n OPEN_GENERATIVE_UI_ACTIVITY_TYPE,\n ToolCallStatus,\n ɵOpenGenerativeUIController,\n} from \"@copilotkit/core\";\nimport type {\n GenerateSandboxedUiArgs,\n OpenGenerativeUIContent,\n} from \"@copilotkit/core\";\nimport { useSandboxFunctions } from \"../providers/SandboxFunctionsContext\";\n\nexport type { GenerateSandboxedUiArgs, OpenGenerativeUIContent };\n\nexport const OpenGenerativeUIActivityType = OPEN_GENERATIVE_UI_ACTIVITY_TYPE;\n\nexport const OpenGenerativeUIContentSchema = z.object({\n initialHeight: z.number().optional(),\n generating: z.boolean().optional(),\n css: z.string().optional(),\n cssComplete: z.boolean().optional(),\n html: z.array(z.string()).optional(),\n htmlComplete: z.boolean().optional(),\n jsFunctions: z.string().optional(),\n jsFunctionsComplete: z.boolean().optional(),\n jsExpressions: z.array(z.string()).optional(),\n jsExpressionsComplete: z.boolean().optional(),\n}) satisfies z.ZodType<OpenGenerativeUIContent>;\n\nexport const GenerateSandboxedUiArgsSchema = z.object({\n initialHeight: z.number().optional(),\n placeholderMessages: z.array(z.string()).optional(),\n css: z.string().optional(),\n html: z.string().optional(),\n jsFunctions: z.string().optional(),\n jsExpressions: z.array(z.string()).optional(),\n}) satisfies z.ZodType<GenerateSandboxedUiArgs>;\n\n/**\n * Renders Open Generative UI content. The core controller throttles the\n * content and runs the websandbox iframes inside the container div.\n */\nexport const OpenGenerativeUIRenderer = defineComponent({\n name: \"OpenGenerativeUIRenderer\",\n props: {\n content: {\n type: Object as PropType<OpenGenerativeUIContent>,\n required: true,\n },\n },\n setup(props) {\n const sandboxFunctions = useSandboxFunctions();\n const containerRef = ref<HTMLElement | null>(null);\n const controller = new ɵOpenGenerativeUIController();\n controller.setContent(props.content);\n const state = shallowRef(controller.getState());\n const unsubscribe = controller.subscribe(() => {\n state.value = controller.getState();\n });\n\n watch(\n () => props.content,\n (content) => controller.setContent(content),\n );\n watch(\n sandboxFunctions,\n (functions) => controller.setSandboxFunctions(functions),\n { immediate: true },\n );\n onMounted(() => controller.setHost(containerRef.value));\n onBeforeUnmount(() => {\n unsubscribe();\n controller.destroy();\n });\n\n return () => {\n const { phase, generating, height } = state.value;\n const hasVisibleSandbox = phase !== \"placeholder\";\n return h(\n \"div\",\n {\n ref: containerRef,\n \"data-testid\": \"open-generative-ui-renderer\",\n style: {\n position: \"relative\",\n width: \"100%\",\n height: `${height}px`,\n borderRadius: \"8px\",\n backgroundColor: hasVisibleSandbox ? \"transparent\" : \"#f5f5f5\",\n border: hasVisibleSandbox ? \"none\" : \"1px solid #e0e0e0\",\n overflow: \"hidden\",\n display: hasVisibleSandbox ? \"block\" : \"flex\",\n alignItems: hasVisibleSandbox ? undefined : \"center\",\n justifyContent: hasVisibleSandbox ? undefined : \"center\",\n },\n },\n [\n !hasVisibleSandbox\n ? h(\"div\", { \"data-testid\": \"open-generative-ui-placeholder\" }, [\n h(\n \"svg\",\n {\n width: \"48\",\n height: \"48\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n style: { animation: \"ck-spin 1s linear infinite\" },\n },\n [\n h(\"circle\", {\n cx: \"12\",\n cy: \"12\",\n r: \"10\",\n stroke: \"#e0e0e0\",\n \"stroke-width\": \"3\",\n }),\n h(\"path\", {\n d: \"M12 2a10 10 0 0 1 10 10\",\n stroke: \"#999\",\n \"stroke-width\": \"3\",\n \"stroke-linecap\": \"round\",\n }),\n ],\n ),\n h(\n \"style\",\n \"@keyframes ck-spin { to { transform: rotate(360deg) } }\",\n ),\n ])\n : null,\n generating\n ? h(\"div\", {\n \"data-testid\": \"open-generative-ui-progress-overlay\",\n style: {\n position: \"absolute\",\n inset: 0,\n backgroundColor: \"rgba(255,255,255,0.45)\",\n },\n })\n : null,\n ],\n );\n };\n },\n});\n\nexport const OpenGenerativeUIActivityRenderer = defineComponent({\n name: \"OpenGenerativeUIActivityRenderer\",\n props: {\n activityType: { type: String, required: true },\n content: {\n type: Object as PropType<OpenGenerativeUIContent>,\n required: true,\n },\n message: { type: Object as PropType<unknown>, required: true },\n agent: {\n type: Object as PropType<unknown>,\n required: false,\n default: undefined,\n },\n },\n setup(props) {\n return () => h(OpenGenerativeUIRenderer, { content: props.content });\n },\n});\n\nexport const OpenGenerativeUIToolRenderer = defineComponent({\n name: \"OpenGenerativeUIToolRenderer\",\n props: {\n name: { type: String, required: true },\n args: {\n type: Object as PropType<Partial<GenerateSandboxedUiArgs>>,\n required: true,\n },\n status: { type: String as PropType<ToolCallStatus>, required: true },\n result: { type: String as PropType<string | undefined>, required: false },\n },\n setup(props) {\n const visibleMessageIndex = ref(0);\n\n watch(\n () => props.args.placeholderMessages,\n (messages, _, onCleanup) => {\n if (!messages?.length || props.status === ToolCallStatus.Complete)\n return;\n visibleMessageIndex.value = Math.max(messages.length - 1, 0);\n const timer = window.setInterval(() => {\n visibleMessageIndex.value =\n (visibleMessageIndex.value + 1) % Math.max(messages.length, 1);\n }, 5000);\n onCleanup(() => window.clearInterval(timer));\n },\n { immediate: true },\n );\n\n return () => {\n if (props.status === ToolCallStatus.Complete) return null;\n const messages = props.args.placeholderMessages;\n if (!messages?.length) return null;\n const currentMessage = messages[visibleMessageIndex.value] ?? messages[0];\n return h(\n \"div\",\n {\n style: { padding: \"8px 12px\", color: \"#999\", fontSize: \"14px\" },\n \"data-testid\": \"open-generative-ui-tool-placeholder\",\n },\n currentMessage,\n );\n };\n },\n});\n","import { inject } from \"vue\";\nimport type { Component, InjectionKey } from \"vue\";\nimport type { VueStreamingMarkdownNodeRenderers } from \"@copilotkit/markdown/vue\";\nimport type { StreamingMarkdownParserOptions } from \"@copilotkit/markdown\";\n\n/** Config for the built-in Vue default renderer (pass instead of a component). */\nexport interface DefaultMarkdownRendererProps {\n nodeRenderers?: VueStreamingMarkdownNodeRenderers;\n caret?: boolean;\n options?: Partial<StreamingMarkdownParserOptions>;\n class?: string;\n}\n\nexport type MarkdownRendererValue = Component | DefaultMarkdownRendererProps;\n\n/** Injection key for a global markdown renderer component (or `undefined`). */\nexport const MARKDOWN_RENDERER_KEY: InjectionKey<\n MarkdownRendererValue | undefined\n> = Symbol(\"copilotkit-markdown-renderer\");\n\n/**\n * The markdown renderer provided at the provider level, or `undefined`.\n * Message components fall back to the built-in `StreamingMarkdownDefault` when undefined.\n * The value is either a Vue component (accepting `{ content: string; isStreaming?: boolean }`)\n * or a `DefaultMarkdownRendererProps` config object for the built-in renderer.\n */\nexport function useMarkdownRenderer(): MarkdownRendererValue | undefined {\n return inject(MARKDOWN_RENDERER_KEY, undefined);\n}\n\n/** A Vue component is a function or an object carrying setup/render/__vccOpts/__name. */\nexport function isVueComponentRenderer(value: unknown): value is Component {\n if (typeof value === \"function\") return true;\n if (value && typeof value === \"object\") {\n const o = value as Record<string, unknown>;\n return \"setup\" in o || \"render\" in o || \"__vccOpts\" in o || \"__name\" in o;\n }\n return false;\n}\n","import type { InjectionKey, Ref } from \"vue\";\nimport { ref } from \"vue\";\nimport {\n createLicenseContextValue,\n type LicenseContextValue,\n} from \"@copilotkit/shared\";\n\nexport type { LicenseContextValue };\nexport { createLicenseContextValue };\n\nexport const LicenseContextKey: InjectionKey<Ref<LicenseContextValue>> =\n Symbol(\"LicenseContext\");\n\nexport function createDefaultLicenseRef(): Ref<LicenseContextValue> {\n return ref(createLicenseContextValue(null));\n}\n","import { computed, inject } from \"vue\";\nimport type { ComputedRef } from \"vue\";\nimport { CopilotChatConfigurationKey } from \"./keys\";\nimport type { CopilotChatConfigurationValue } from \"./types\";\n\nexport function useCopilotChatConfiguration(): ComputedRef<CopilotChatConfigurationValue | null> {\n const injected = inject<\n ComputedRef<CopilotChatConfigurationValue> | undefined\n >(CopilotChatConfigurationKey, undefined);\n return computed(() => injected?.value ?? null);\n}\n","import { computed } from \"vue\";\nimport { CopilotChatDefaultLabels } from \"@copilotkit/core\";\nimport type { CopilotChatLabels } from \"@copilotkit/core\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\n\n/**\n * The chat labels in effect: the surrounding chat configuration's, or the\n * default English labels outside a chat.\n * @internal\n */\nexport function useChatLabels() {\n const config = useCopilotChatConfiguration();\n return computed<Readonly<CopilotChatLabels>>(\n () => config.value?.labels ?? CopilotChatDefaultLabels,\n );\n}\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted } from \"vue\";\nimport {\n ɵLICENSE_BANNER_STYLE,\n ɵgetLicenseBannerSpec,\n ɵreserveLicenseBannerOffset,\n} from \"@copilotkit/core\";\nimport type { ɵLicenseBannerType } from \"@copilotkit/core\";\nimport { useChatLabels } from \"./chat/use-chat-labels\";\n\nconst props = withDefaults(\n defineProps<{\n type: ɵLicenseBannerType;\n featureName?: string;\n expiryDate?: string;\n graceRemaining?: number;\n onDismiss?: () => void;\n }>(),\n {\n featureName: undefined,\n expiryDate: undefined,\n graceRemaining: undefined,\n onDismiss: undefined,\n },\n);\n\nconst labels = useChatLabels();\n\n// Core picks the text, link, and severity; this component renders them.\nconst spec = computed(() =>\n ɵgetLicenseBannerSpec(props.type, labels.value, {\n featureName: props.featureName,\n expiryDate: props.expiryDate,\n graceRemaining: props.graceRemaining,\n }),\n);\n\nconst containerStyle = computed(() => ({\n ...ɵLICENSE_BANNER_STYLE.base,\n ...ɵLICENSE_BANNER_STYLE.severity[spec.value.severity],\n}));\n\n// Publish the banner's reserved bottom offset so the chat input can lift\n// itself above it via padding-bottom: var(--copilotkit-license-banner-offset).\nlet releaseOffset: (() => void) | undefined;\nonMounted(() => {\n releaseOffset = ɵreserveLicenseBannerOffset();\n});\nonBeforeUnmount(() => {\n releaseOffset?.();\n releaseOffset = undefined;\n});\n</script>\n\n<template>\n <div :style=\"containerStyle\" data-testid=\"copilot-license-banner\">\n <span>{{ spec.message }}</span>\n <div :style=\"ɵLICENSE_BANNER_STYLE.actions\">\n <a\n :href=\"spec.actionUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :style=\"ɵLICENSE_BANNER_STYLE.link\"\n >\n {{ spec.actionLabel }}\n </a>\n <button\n v-if=\"props.onDismiss\"\n :style=\"ɵLICENSE_BANNER_STYLE.dismiss\"\n @click=\"props.onDismiss\"\n >\n ×\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n GENERATE_SANDBOXED_UI_DESCRIPTION,\n randomUUID,\n ɵanySchema,\n} from \"@copilotkit/shared\";\nimport {\n computed,\n h,\n onMounted,\n onUnmounted,\n provide,\n ref,\n shallowRef,\n toRaw,\n triggerRef,\n watch,\n} from \"vue\";\nimport type { Component, FunctionalComponent } from \"vue\";\nimport type { AbstractAgent } from \"@ag-ui/client\";\nimport { ToolCallStatus } from \"@copilotkit/core\";\nimport type {\n CopilotKitCoreErrorCode,\n CopilotKitCoreSubscriber,\n CopilotKitHeadersSource,\n FrontendTool,\n} from \"@copilotkit/core\";\nimport {\n DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL,\n GENERATE_SANDBOXED_UI_TOOL_NAME,\n ɵresolveLicenseState,\n ɵwithHeaderDefaults,\n} from \"@copilotkit/core\";\nimport { schemaToJsonSchema, shouldEnableInspector } from \"@copilotkit/shared\";\nimport type {\n RuntimeEntitlementResponse,\n RuntimeLicenseStatus,\n} from \"@copilotkit/shared\";\nimport { CopilotKitCoreVue } from \"../lib/vue-core\";\nimport { createA2UIMessageRenderer } from \"../components/A2UIMessageRenderer\";\nimport { registerA2UIBuiltInToolCallRenderer } from \"../components/a2ui/A2UIBuiltInToolCallRenderer\";\nimport { registerA2UICatalogContext } from \"../components/a2ui/A2UICatalogContext\";\nimport {\n GenerateSandboxedUiArgsSchema,\n OpenGenerativeUIActivityRenderer,\n OpenGenerativeUIActivityType,\n OpenGenerativeUIContentSchema,\n OpenGenerativeUIToolRenderer,\n} from \"../components/OpenGenerativeUIRenderer\";\nimport {\n MCPAppsActivityContentSchema,\n MCPAppsActivityRenderer,\n MCPAppsActivityType,\n} from \"../components/MCPAppsActivityRenderer\";\nimport {\n CopilotKitKey,\n CopilotStyleOptionsKey,\n InspectorKey,\n SandboxFunctionsKey,\n} from \"./keys\";\nimport type { VueInspectorOpenRequest } from \"./keys\";\nimport { MARKDOWN_RENDERER_KEY } from \"./markdown-renderer\";\nimport { LicenseContextKey } from \"./license-context\";\nimport CopilotKitInspector from \"../components/CopilotKitInspector.vue\";\nimport LicenseWarningBanner from \"../components/LicenseWarningBanner.vue\";\nimport type {\n CopilotKitLearningOptions,\n CopilotKitProviderProps,\n} from \"./CopilotKitProvider.types\";\nimport type {\n SandboxFunction,\n VueActivityMessageRenderer,\n VueFrontendTool,\n VueToolCallRenderer,\n VueToolCallRendererRenderProps,\n} from \"../types\";\n\nconst HEADER_NAME = \"X-CopilotCloud-Public-Api-Key\";\nconst COPILOT_CLOUD_CHAT_URL = \"https://api.cloud.copilotkit.ai/copilotkit/v1\";\n// Canonical A2UI viewer theme default (matches @copilotkit/a2ui-renderer).\n// Defined locally to avoid pulling React dependencies from a2ui-renderer.\nconst viewerTheme: Record<string, unknown> = {};\n\nconst FRONTEND_TOOLS_STABLE_WARNING =\n \"frontendTools must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.\";\nconst HUMAN_IN_THE_LOOP_STABLE_WARNING =\n \"humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead.\";\nconst RENDER_CUSTOM_MESSAGES_STABLE_WARNING =\n \"renderCustomMessages must be a stable array.\";\nconst RENDER_ACTIVITY_MESSAGES_STABLE_WARNING =\n \"renderActivityMessages must be a stable array.\";\nconst SANDBOX_FUNCTIONS_STABLE_WARNING =\n \"openGenerativeUI.sandboxFunctions must be a stable array.\";\n// Matches the message React's `useHumanInTheLoop` rejects with, so an aborted\n// interrupt reads the same across frameworks (see #5554).\nconst HUMAN_IN_THE_LOOP_ABORTED_MESSAGE =\n \"Human-in-the-loop interaction aborted\";\n\n/** The MCP Apps renderer with `mcpApps.allowSameOriginFallback` applied. */\nconst SameOriginMCPAppsActivityRenderer: FunctionalComponent = (_, { attrs }) =>\n h(MCPAppsActivityRenderer as Component, {\n ...attrs,\n allowSameOriginFallback: true,\n });\n\nconst props = withDefaults(defineProps<CopilotKitProviderProps>(), {\n headers: () => ({}),\n properties: () => ({}),\n agents__unsafe_dev_only: () => ({}),\n selfManagedAgents: () => ({}),\n frontendTools: () => [],\n humanInTheLoop: () => [],\n renderCustomMessages: () => [],\n renderActivityMessages: () => [],\n openGenerativeUI: undefined,\n useSingleEndpoint: undefined,\n a2ui: undefined,\n mcpApps: undefined,\n enableInspector: undefined,\n nonce: undefined,\n injectStyles: true,\n // A missing boolean prop would otherwise read as `false`.\n learning: undefined,\n});\n\nprovide(\n CopilotStyleOptionsKey,\n computed(() => ({ nonce: props.nonce, inject: props.injectStyles })),\n);\n\nconst shouldRenderInspector = ref(false);\n\nfunction updateInspectorVisibility(): void {\n shouldRenderInspector.value = shouldEnableInspector({\n enableInspector: props.enableInspector,\n isBrowser: true,\n isDevelopment: process.env.NODE_ENV === \"development\",\n });\n}\n\nonMounted(updateInspectorVisibility);\nwatch(() => props.enableInspector, updateInspectorVisibility);\n\nconst inspectorOpenRequest = ref<VueInspectorOpenRequest | null>(null);\nconst isInspectorEnabled = computed(() => shouldRenderInspector.value);\n\nfunction openInspector(request: VueInspectorOpenRequest) {\n inspectorOpenRequest.value = { ...request };\n}\n\nprovide(InspectorKey, {\n isInspectorEnabled,\n openInspector,\n});\n\nconst initialFrontendTools = props.frontendTools;\nconst initialHumanInTheLoop = props.humanInTheLoop;\nconst initialRenderCustomMessages = props.renderCustomMessages;\nconst initialRenderActivityMessages = props.renderActivityMessages;\nconst initialSandboxFunctions = props.openGenerativeUI?.sandboxFunctions;\n\n// Props that come from reactive state arrive as deep proxies. Zod 4 schemas\n// break behind a Vue proxy (their `_zod` property is read-only and\n// non-configurable), so read tools and renderers through their raw objects.\nconst rawEntries = <T>(entries: readonly T[] | undefined): T[] =>\n [...toRaw(entries ?? [])].map((entry) => toRaw(entry));\n\nwatch(\n () => props.frontendTools,\n (next) => {\n if (next !== initialFrontendTools) {\n console.error(FRONTEND_TOOLS_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.humanInTheLoop,\n (next) => {\n if (next !== initialHumanInTheLoop) {\n console.error(HUMAN_IN_THE_LOOP_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.renderCustomMessages,\n (next) => {\n if (next !== initialRenderCustomMessages) {\n console.error(RENDER_CUSTOM_MESSAGES_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.renderActivityMessages,\n (next) => {\n if (next !== initialRenderActivityMessages) {\n console.error(RENDER_ACTIVITY_MESSAGES_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.openGenerativeUI?.sandboxFunctions,\n (next) => {\n if (next !== initialSandboxFunctions) {\n console.error(SANDBOX_FUNCTIONS_STABLE_WARNING);\n }\n },\n);\n\nconst resolvedPublicKey = computed(\n () => props.publicApiKey ?? props.publicLicenseKey,\n);\nconst mergedAgents = computed(() => ({\n ...props.agents__unsafe_dev_only,\n ...props.selfManagedAgents,\n}));\nconst hasLocalAgents = computed(\n () => Object.keys(mergedAgents.value).length > 0,\n);\n\n// Whether `headers` is a builder, as its own computed so that a re-render\n// merely passing a NEW function of the same kind (e.g. a fresh inline arrow)\n// doesn't propagate: this computed's VALUE doesn't change, so Vue never marks\n// `headersSource` below dirty on that account. Reading `props.headers`\n// directly inside `headersSource` would defeat this — its exact identity\n// would then be tracked there instead.\nconst isHeadersBuilder = computed(() => typeof props.headers === \"function\");\n\n// Stable for the component's lifetime: reads `props.headers` fresh on every\n// call, so it is always current at send time (#1937), never during render.\n// The read below can return a sync record or an async promise depending on\n// what `props.headers` happens to be at call time, which\n// `CopilotKitHeadersSource`'s shape can't express in one function signature\n// (sync-only OR async-only) — same rationale as the cast inside\n// `ɵwithHeaderDefaults`.\nconst latestHeaders = (() =>\n typeof props.headers === \"function\"\n ? props.headers()\n : props.headers) as () => Record<string, string>;\n\n// The source handed to core. A record keeps today's identity semantics (its\n// own reference changes propagate); a builder is represented by the stable\n// `latestHeaders` above, so only `isHeadersBuilder` and `resolvedPublicKey`\n// actually drive recomputation.\nconst headersSource = computed<CopilotKitHeadersSource>(() =>\n ɵwithHeaderDefaults(\n isHeadersBuilder.value ? latestHeaders : props.headers,\n resolvedPublicKey.value ? { [HEADER_NAME]: resolvedPublicKey.value } : {},\n ),\n);\n\nconst chatApiEndpoint = computed(\n () =>\n props.runtimeUrl ??\n (resolvedPublicKey.value ? COPILOT_CLOUD_CHAT_URL : undefined),\n);\n\nwatch(\n [chatApiEndpoint, resolvedPublicKey, hasLocalAgents],\n ([endpoint, publicKey, localAgents]) => {\n if (endpoint || publicKey || localAgents) return;\n const msg =\n \"Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'\";\n if (process.env.NODE_ENV === \"production\") {\n throw new Error(msg);\n }\n console.warn(msg);\n },\n { immediate: true },\n);\n\n/**\n * A human-in-the-loop tool call from the `humanInTheLoop` prop that is waiting\n * on the user. Keyed by tool call id so parallel interrupts on the same tool\n * stay independent.\n */\ntype PendingHumanInTheLoop = {\n resolve: (result: unknown) => void;\n detachAbort?: () => void;\n};\n\nconst pendingHumanInTheLoop = new Map<string, PendingHumanInTheLoop>();\n\n/** Removes a pending interaction and detaches its abort listener. */\nconst takePendingHumanInTheLoop = (key: string) => {\n const pending = pendingHumanInTheLoop.get(key);\n if (!pending) return undefined;\n pending.detachAbort?.();\n pendingHumanInTheLoop.delete(key);\n return pending;\n};\n\nconst processedHumanInTheLoop = computed(() => {\n const tools: FrontendTool[] = [];\n const renderToolCalls: VueToolCallRenderer<unknown>[] = [];\n\n for (const tool of rawEntries(props.humanInTheLoop)) {\n tools.push({\n type: \"human-in-the-loop\",\n name: tool.name,\n description: tool.description,\n parameters: tool.parameters,\n followUp: tool.followUp,\n ...(tool.agentId && { agentId: tool.agentId }),\n // Keep the tool call pending until the render calls `respond`, matching\n // the `useHumanInTheLoop` composable. Resolving immediately made the HITL\n // UI flash and disappear without ever waiting for the user.\n handler: async (_args, context) => {\n const signal = context?.signal;\n const key = context?.toolCall?.id ?? tool.name;\n\n return new Promise((resolve, reject) => {\n // Already aborted before the handler ran — reject so core records an\n // explicit error tool result rather than silently resolving empty.\n if (signal?.aborted) {\n reject(new Error(HUMAN_IN_THE_LOOP_ABORTED_MESSAGE));\n return;\n }\n\n const pending: PendingHumanInTheLoop = { resolve };\n pendingHumanInTheLoop.set(key, pending);\n\n if (signal) {\n const onAbort = () => {\n pendingHumanInTheLoop.delete(key);\n reject(new Error(HUMAN_IN_THE_LOOP_ABORTED_MESSAGE));\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n pending.detachAbort = () => {\n signal.removeEventListener(\"abort\", onAbort);\n };\n }\n });\n },\n });\n if (tool.render) {\n const ToolComponent = tool.render;\n const render: VueToolCallRenderer<unknown>[\"render\"] = (\n renderProps: VueToolCallRendererRenderProps<unknown>,\n ) => {\n const key = renderProps.toolCallId ?? tool.name;\n return h(ToolComponent as Parameters<typeof h>[0], {\n ...renderProps,\n // `renderProps.name` is the tool that was actually invoked. It equals\n // `tool.name` for a named registration; for a wildcard (`\"*\"`) it is\n // the only place the real name exists.\n name: tool.name === \"*\" ? renderProps.name : tool.name,\n description: tool.description || \"\",\n agentId: tool.agentId,\n // `respond` is live only while the tool is executing — the one phase\n // with a promise waiting on the user.\n respond:\n renderProps.status === ToolCallStatus.Executing\n ? async (result: unknown) => {\n takePendingHumanInTheLoop(key)?.resolve(result);\n }\n : undefined,\n });\n };\n\n renderToolCalls.push({\n name: tool.name,\n args: tool.parameters ?? ɵanySchema,\n render,\n ...(tool.agentId && { agentId: tool.agentId }),\n } as VueToolCallRenderer<unknown>);\n }\n }\n return { tools, renderToolCalls };\n});\n\nconst allTools = computed(() => {\n const tools: FrontendTool[] = [];\n for (const t of rawEntries(props.frontendTools)) {\n tools.push(t as FrontendTool);\n }\n for (const t of builtInFrontendTools.value) {\n tools.push(t as FrontendTool);\n }\n tools.push(...processedHumanInTheLoop.value.tools);\n return tools;\n});\n\nconst allRenderToolCalls = computed(() => {\n const combined: VueToolCallRenderer<unknown>[] = [\n ...rawEntries(props.renderToolCalls),\n ];\n for (const tool of [\n ...rawEntries(props.frontendTools),\n ...builtInFrontendTools.value,\n ]) {\n if (tool.render) {\n const args =\n tool.parameters ?? (tool.name === \"*\" ? ɵanySchema : undefined);\n if (args) {\n combined.push({\n name: tool.name,\n args,\n render: tool.render,\n } as VueToolCallRenderer<unknown>);\n }\n }\n }\n combined.push(...processedHumanInTheLoop.value.renderToolCalls);\n return combined;\n});\n\nconst allRenderCustomMessages = computed(\n () => props.renderCustomMessages ?? [],\n);\nconst runtimeA2UIEnabled = ref(false);\nconst runtimeOpenGenerativeUIEnabled = ref(false);\nconst runtimeLicenseStatus = ref<RuntimeLicenseStatus | undefined>(undefined);\nconst runtimeEntitlements = ref<RuntimeEntitlementResponse | undefined>(\n undefined,\n);\nconst runtimeEntitlementRetryPending = ref(false);\nconst openGenerativeUIActive = computed(\n () => runtimeOpenGenerativeUIEnabled.value || !!props.openGenerativeUI,\n);\n// A catalog passed to the provider is enough to turn A2UI on: render the\n// surfaces locally and forward the catalog signal so the runtime injects the\n// render tool — no runtime-side `a2ui` config required.\nconst a2uiCatalogProvided = computed(() => !!props.a2ui?.catalog);\nconst a2uiActive = computed(\n () => runtimeA2UIEnabled.value || a2uiCatalogProvided.value,\n);\n// Forward a per-run signal when the provider has an A2UI catalog so the\n// runtime can turn A2UI on (and inject the render tool) without a separate\n// `a2ui.injectA2UITool` flag on the runtime.\nconst resolvedProperties = computed(() =>\n a2uiCatalogProvided.value\n ? { ...props.properties, a2uiCatalogAvailable: true }\n : props.properties,\n);\nconst sandboxFunctions = computed<readonly SandboxFunction[]>(() =>\n rawEntries(props.openGenerativeUI?.sandboxFunctions),\n);\nconst builtInFrontendTools = computed<VueFrontendTool[]>(() => {\n if (!openGenerativeUIActive.value) return [];\n return [\n {\n name: GENERATE_SANDBOXED_UI_TOOL_NAME,\n description: GENERATE_SANDBOXED_UI_DESCRIPTION,\n parameters: GenerateSandboxedUiArgsSchema,\n handler: async () => \"UI generated\",\n // This acknowledgement has no side effects and is safe to reconstruct.\n reconnectBehavior: \"resume-pending\",\n followUp: true,\n render:\n OpenGenerativeUIToolRenderer as unknown as VueFrontendTool[\"render\"],\n } as VueFrontendTool,\n ];\n});\n\nconst builtInActivityRenderers = computed<\n VueActivityMessageRenderer<unknown>[]\n>(() => {\n const renderers: VueActivityMessageRenderer<unknown>[] = [\n {\n activityType: MCPAppsActivityType,\n content: MCPAppsActivityContentSchema,\n render: (props.mcpApps?.allowSameOriginFallback\n ? SameOriginMCPAppsActivityRenderer\n : MCPAppsActivityRenderer) as unknown as VueActivityMessageRenderer<unknown>[\"render\"],\n },\n ];\n\n if (openGenerativeUIActive.value) {\n renderers.push({\n activityType: OpenGenerativeUIActivityType,\n content: OpenGenerativeUIContentSchema,\n render:\n OpenGenerativeUIActivityRenderer as unknown as VueActivityMessageRenderer<unknown>[\"render\"],\n });\n }\n\n if (a2uiActive.value) {\n renderers.unshift(\n createA2UIMessageRenderer({\n theme: props.a2ui?.theme ?? viewerTheme,\n catalog: props.a2ui?.catalog,\n loadingComponent: props.a2ui?.loadingComponent,\n recovery: props.a2ui?.recovery,\n }),\n );\n }\n\n return renderers;\n});\n\nconst allRenderActivityMessages = computed(() => [\n ...rawEntries(props.renderActivityMessages),\n ...builtInActivityRenderers.value,\n]);\n\nconst applyDefaultThrottleMs = (core: CopilotKitCoreVue) => {\n if (\n props.defaultThrottleMs !== undefined &&\n (!Number.isFinite(props.defaultThrottleMs) || props.defaultThrottleMs < 0)\n ) {\n console.error(\n `CopilotKitProvider: defaultThrottleMs must be a non-negative finite number, got ${props.defaultThrottleMs}. useAgent hooks without an explicit throttleMs will fall back to unthrottled.`,\n );\n }\n core.setDefaultThrottleMs(props.defaultThrottleMs);\n};\n\nfunction toLearningConfig(\n learning: boolean | CopilotKitLearningOptions | undefined,\n): CopilotKitLearningOptions | undefined {\n // `true` uses the default authenticated capture options.\n if (learning === true) return {};\n if (learning === false || learning === undefined) return undefined;\n // `autoStart` only controls the provider; Core never receives it.\n const { autoStart: _autoStart, ...config } = learning;\n return config;\n}\n\nconst learningConfig = computed(() => toLearningConfig(props.learning));\n\nconst createCopilotKit = () => {\n const core = new CopilotKitCoreVue({\n runtimeUrl: chatApiEndpoint.value,\n runtimeTransport:\n props.useSingleEndpoint === true\n ? \"single\"\n : props.useSingleEndpoint === false\n ? \"rest\"\n : \"auto\",\n headers: headersSource.value,\n credentials: props.credentials,\n messageFilter: props.messageFilter,\n properties: resolvedProperties.value,\n agents__unsafe_dev_only: mergedAgents.value,\n tools: allTools.value,\n renderToolCalls: allRenderToolCalls.value,\n renderActivityMessages: allRenderActivityMessages.value,\n renderCustomMessages: allRenderCustomMessages.value,\n debug: props.debug,\n learning: learningConfig.value,\n });\n // Initialize synchronously so child hooks can read the value on first render.\n applyDefaultThrottleMs(core);\n return core;\n};\n\nconst copilotkit = shallowRef<CopilotKitCoreVue>(createCopilotKit());\nconst didMountRef = ref(false);\n\nconst executingToolCallIds = ref<ReadonlySet<string>>(new Set());\n\nwatch(\n copilotkit,\n (core, _, onCleanup) => {\n const sub1 = core.subscribe({\n onToolExecutionStart: ({\n toolCallId,\n }: Parameters<\n NonNullable<CopilotKitCoreSubscriber[\"onToolExecutionStart\"]>\n >[0]) => {\n executingToolCallIds.value = new Set(executingToolCallIds.value).add(\n toolCallId,\n );\n },\n onToolExecutionEnd: ({\n toolCallId,\n }: Parameters<\n NonNullable<CopilotKitCoreSubscriber[\"onToolExecutionEnd\"]>\n >[0]) => {\n setTimeout(() => {\n const next = new Set(executingToolCallIds.value);\n next.delete(toolCallId);\n executingToolCallIds.value = next;\n triggerRef(copilotkit);\n }, 0);\n },\n });\n const sub2 = core.subscribe({\n onRenderToolCallsChanged: () => {\n triggerRef(copilotkit);\n },\n });\n const sub3 = core.subscribe({\n onRenderCustomMessagesChanged: () => {\n triggerRef(copilotkit);\n },\n });\n const sub4 = core.subscribe({\n onRuntimeConnectionStatusChanged: () => {\n runtimeA2UIEnabled.value = core.a2uiEnabled;\n runtimeOpenGenerativeUIEnabled.value = core.openGenerativeUIEnabled;\n runtimeLicenseStatus.value = core.licenseStatus;\n runtimeEntitlements.value = core.runtimeEntitlements;\n runtimeEntitlementRetryPending.value =\n core.runtimeEntitlementRetryPending;\n triggerRef(copilotkit);\n },\n });\n const sub5 = core.subscribe({\n onError: (event) => {\n void props.onError?.({\n error: event.error,\n code: event.code,\n context: event.context,\n });\n },\n });\n // `onHeadersChanged` fires only from a real `setHeaders()` call (a new\n // source), never from a builder resolving a new token — same generation\n // core bumps. Without this, nothing pokes Vue's reactivity when a source\n // change lands: `ɵheadersGeneration` is a plain property read, not a\n // ref/reactive value, so `headersKey` (use-threads.ts) and the\n // HttpAgent watcher (use-agent.ts) only re-read it when SOME OTHER\n // trigger happens to fire around the same time (#1937).\n const sub6 = core.subscribe({\n onHeadersChanged: () => {\n triggerRef(copilotkit);\n },\n });\n onCleanup(() => {\n sub1.unsubscribe();\n sub2.unsubscribe();\n sub3.unsubscribe();\n sub4.unsubscribe();\n sub5.unsubscribe();\n sub6.unsubscribe();\n });\n },\n { immediate: true },\n);\n\nwatch([allTools], ([tools]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setTools(tools);\n});\n\nwatch([allRenderToolCalls], ([renderToolCalls]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setRenderToolCalls(renderToolCalls);\n});\n\nwatch([allRenderCustomMessages], ([renderCustomMessages]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setRenderCustomMessages(renderCustomMessages);\n triggerRef(copilotkit);\n});\n\nwatch([allRenderActivityMessages], ([renderActivityMessages]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setRenderActivityMessages(renderActivityMessages);\n triggerRef(copilotkit);\n});\n\n// The last `headersSource` reference actually handed to `core.setHeaders`.\n// `syncRuntimeConfig` runs once (unconditionally) from `onMounted` in\n// addition to the constructor already having applied this same value.\n// `HeaderSourceResolver.setSource` itself is a no-op both for an identical\n// function reference and for a record whose normalized values equal the\n// currently applied record's (see #1937), so this reference\n// check is now a cheap pre-filter rather than the only thing preventing a\n// spurious `onHeadersChanged`. It still avoids the `setHeaders` call (and\n// its normalize + shallow-equal work) entirely on the common path where\n// nothing changed.\nlet lastAppliedHeadersSource: CopilotKitHeadersSource = headersSource.value;\n\nfunction syncRuntimeConfig() {\n copilotkit.value.setRuntimeUrl(chatApiEndpoint.value);\n copilotkit.value.setRuntimeTransport(\n props.useSingleEndpoint === true\n ? \"single\"\n : props.useSingleEndpoint === false\n ? \"rest\"\n : \"auto\",\n );\n if (headersSource.value !== lastAppliedHeadersSource) {\n lastAppliedHeadersSource = headersSource.value;\n copilotkit.value.setHeaders(headersSource.value);\n }\n copilotkit.value.setCredentials(props.credentials);\n copilotkit.value.setMessageFilter(props.messageFilter);\n copilotkit.value.setProperties(resolvedProperties.value);\n copilotkit.value.setAgents__unsafe_dev_only(mergedAgents.value);\n copilotkit.value.setDebug(props.debug);\n applyDefaultThrottleMs(copilotkit.value);\n}\n\nwatch(\n [\n () => chatApiEndpoint.value,\n () => headersSource.value,\n () => props.credentials,\n () => props.messageFilter,\n () => resolvedProperties.value,\n () => mergedAgents.value,\n () => props.useSingleEndpoint,\n () => props.debug,\n ],\n () => {\n if (!didMountRef.value) return;\n syncRuntimeConfig();\n },\n);\n\nwatch(\n () => props.defaultThrottleMs,\n () => {\n if (!didMountRef.value) return;\n applyDefaultThrottleMs(copilotkit.value);\n triggerRef(copilotkit);\n },\n);\n\nonMounted(() => {\n syncRuntimeConfig();\n runtimeA2UIEnabled.value = copilotkit.value.a2uiEnabled;\n runtimeOpenGenerativeUIEnabled.value =\n copilotkit.value.openGenerativeUIEnabled;\n runtimeLicenseStatus.value = copilotkit.value.licenseStatus;\n runtimeEntitlements.value = copilotkit.value.runtimeEntitlements;\n runtimeEntitlementRetryPending.value =\n copilotkit.value.runtimeEntitlementRetryPending;\n didMountRef.value = true;\n // After the runtime URL is set, so CopilotKit's own runtime traffic is never\n // captured. Created here, the watchers stop (and stop capture) on unmount.\n watchLearning();\n});\n\nconst learningEnabled = computed(() => learningConfig.value !== undefined);\n// `true` is the options-free form, so only an object can opt out.\nconst learningAutoStart = computed(\n () =>\n learningEnabled.value &&\n (typeof props.learning !== \"object\" || props.learning.autoStart !== false),\n);\nconst suppliedTrajectoryId = computed(() =>\n learningAutoStart.value ? learningConfig.value?.trajectoryId : undefined,\n);\nconst generatesTrajectoryId = computed(\n () => learningAutoStart.value && suppliedTrajectoryId.value === undefined,\n);\n\nfunction watchLearning() {\n let learningContainerIds = learningConfig.value?.learningContainerIds;\n\n watch(\n [learningConfig, learningAutoStart],\n ([config, autoStart]) => {\n copilotkit.value.setLearningConfig(config);\n learningContainerIds = config?.learningContainerIds;\n // Automatic starts report unsupported options in Core. With manual\n // starts, the provider's container option is not part of\n // startTrajectory() options.\n if (\n config?.sink === undefined &&\n !autoStart &&\n config?.learningContainerIds !== undefined\n ) {\n console.warn(\n \"[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture ignores it; assign Learning Spaces on the server with getTrajectoryLearningContainerIds on CopilotKitIntelligence, and remove learningContainerIds from the capture options.\",\n );\n }\n },\n { immediate: true },\n );\n\n // Watched as a boolean so a new inline `learning` object warns once.\n watch(\n () =>\n !learningAutoStart.value &&\n learningConfig.value?.trajectoryId !== undefined,\n (ignoresTrajectoryId) => {\n if (!ignoresTrajectoryId) return;\n console.warn(\n \"[CopilotKit] learning.trajectoryId is ignored when autoStart is false; pass the ID to startTrajectory() instead.\",\n );\n },\n { immediate: true },\n );\n\n // Runs only when these change, so option changes that keep generating keep\n // the generated Trajectory; generating again starts one with a new ID.\n watch(\n [learningEnabled, generatesTrajectoryId, suppliedTrajectoryId],\n ([enabled, generates, supplied], _previous, onCleanup) => {\n if (!enabled) return;\n let disposed = false;\n const core = copilotkit.value;\n const trajectoryId = generates ? randomUUID() : supplied;\n if (trajectoryId !== undefined) {\n void core\n .startTrajectory({ trajectoryId, learningContainerIds })\n .catch(() => {\n // Expected authentication/connection failures resolve with an\n // error result; Core reports them to LearningConfig.onError or\n // warns once. Consume unexpected rejections without logging\n // credentials or errors from a previous start after a new\n // Trajectory has already started.\n if (!disposed) {\n console.warn(\"[CopilotKit] Failed to start interaction capture.\");\n }\n });\n }\n onCleanup(() => {\n disposed = true;\n core.stopTrajectory();\n });\n },\n { immediate: true },\n );\n}\n\nconst a2uiTheme = computed(() => props.a2ui?.theme);\nconst a2uiCatalog = computed(() => props.a2ui?.catalog);\nconst a2uiLoadingComponent = computed(() => props.a2ui?.loadingComponent);\nconst a2uiIncludeSchema = computed(() => props.a2ui?.includeSchema ?? true);\n\n// A2UI tool call renderer (progress indicator) — auto-registered when A2UI enabled\nregisterA2UIBuiltInToolCallRenderer(copilotkit, () => a2uiActive.value);\n\n// A2UI catalog context, schema, and generation/design guidelines\nregisterA2UICatalogContext(copilotkit, {\n enabled: () => a2uiActive.value,\n catalog: () => props.a2ui?.catalog,\n includeSchema: () => props.a2ui?.includeSchema ?? true,\n});\n\nconst providerContextIds = ref<string[]>([]);\nwatch(\n [\n openGenerativeUIActive,\n sandboxFunctions,\n () => props.openGenerativeUI?.designSkill,\n ],\n ([active, functions, designSkill], _previous, onCleanup) => {\n if (!active) return;\n\n const ids: string[] = [];\n ids.push(\n copilotkit.value.addContext({\n description:\n \"Design guidelines for the generateSandboxedUi tool. Follow these when building UI.\",\n value: designSkill ?? DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL,\n }),\n );\n\n if (functions.length > 0) {\n const descriptors = JSON.stringify(\n functions.map((fn) => ({\n name: fn.name,\n description: fn.description,\n parameters: schemaToJsonSchema(fn.parameters),\n })),\n );\n ids.push(\n copilotkit.value.addContext({\n description:\n \"Sandbox functions available in generated sandboxed UI code. Call via Websandbox.connection.remote.<functionName>(args).\",\n value: descriptors,\n }),\n );\n }\n\n providerContextIds.value = ids;\n onCleanup(() => {\n for (const id of ids) {\n copilotkit.value.removeContext(id);\n }\n });\n },\n { immediate: true },\n);\n\nprovide(CopilotKitKey, {\n copilotkit,\n executingToolCallIds,\n a2uiTheme,\n a2uiCatalog,\n a2uiLoadingComponent,\n a2uiIncludeSchema,\n});\nprovide(SandboxFunctionsKey, sandboxFunctions);\nprovide(MARKDOWN_RENDERER_KEY, props.markdownRenderer);\n\n// License context and banner, from the runtime license status and the\n// structured entitlement response.\nconst licenseState = computed(() =>\n ɵresolveLicenseState({\n status: runtimeLicenseStatus.value,\n entitlements: runtimeEntitlements.value,\n retryPending: runtimeEntitlementRetryPending.value,\n publicKey: resolvedPublicKey.value,\n }),\n);\nconst licenseContextValue = computed(() => licenseState.value.context);\nprovide(LicenseContextKey, licenseContextValue);\nconst licenseBannerType = computed(() => licenseState.value.bannerType);\n\n// The provider created this core, so it stops the core's runs, timers and\n// subscriptions. `onUnmounted` runs after the children unmount, so their\n// cleanup still reaches a live core.\nonUnmounted(() => {\n copilotkit.value.dispose();\n});\n</script>\n\n<template>\n <slot />\n <CopilotKitInspector\n v-if=\"shouldRenderInspector\"\n :core=\"copilotkit\"\n :open-request=\"inspectorOpenRequest\"\n />\n <!-- License warnings — driven by server-reported status -->\n <LicenseWarningBanner v-if=\"licenseBannerType\" :type=\"licenseBannerType\" />\n</template>\n","import { ɵshallowEqualRecord } from \"@copilotkit/core\";\nimport { shallowRef, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter, ShallowRef } from \"vue\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n Object.prototype.toString.call(value) === \"[object Object]\"\n );\n}\n\n/**\n * Keeps reference identity stable for shallow-equal plain-object inputs.\n * Non-plain objects keep strict reference equality semantics.\n */\nexport function useShallowStableRef<T>(\n value: MaybeRefOrGetter<T>,\n): Readonly<ShallowRef<T>> {\n const stable = shallowRef(toValue(value)) as ShallowRef<T>;\n\n watch(\n () => toValue(value),\n (next) => {\n const previous = stable.value;\n if (previous === next) return;\n\n if (isPlainObject(previous) && isPlainObject(next)) {\n if (ɵshallowEqualRecord(previous, next)) {\n return;\n }\n }\n\n stable.value = next;\n },\n { immediate: true },\n );\n\n return stable;\n}\n","<script setup lang=\"ts\">\nimport { computed, inject, onMounted, provide, ref, watch } from \"vue\";\nimport type { ComputedRef } from \"vue\";\nimport { DEFAULT_AGENT_ID, randomUUID } from \"@copilotkit/shared\";\nimport type { OpenThreadRegistration } from \"@copilotkit/core\";\nimport { CopilotChatConfigurationKey, CopilotKitKey } from \"./keys\";\nimport { CopilotChatDefaultLabels } from \"./types\";\nimport type { CopilotChatConfigurationValue, CopilotChatLabels } from \"./types\";\nimport type { CopilotChatConfigurationProviderProps } from \"./CopilotChatConfigurationProvider.types\";\nimport { useShallowStableRef } from \"../lib/shallow-stable\";\nimport { isMobileViewport } from \"../lib/is-mobile-viewport\";\n\n// Vue normalizes optional Boolean props to `false` when not supplied; declare\n// `undefined` defaults so we can faithfully distinguish \"caller passed false\"\n// from \"caller did not pass the prop\", matching React's prop semantics.\nconst props = withDefaults(\n defineProps<CopilotChatConfigurationProviderProps>(),\n {\n hasExplicitThreadId: undefined,\n isModalDefaultOpen: undefined,\n },\n);\n\nconst parentConfig = inject<ComputedRef<CopilotChatConfigurationValue> | null>(\n CopilotChatConfigurationKey,\n null,\n);\nconst parentConfigValue = computed(() => parentConfig?.value ?? null);\n\n// Caller-authoritative when a threadId prop is supplied AND not explicitly\n// flagged non-explicit. A <CopilotKit>-seeded non-explicit id\n// (threadId + hasExplicitThreadId=false) stays overridable — the round-2 fix.\nconst propIsAuthoritative = computed(\n () => props.threadId !== undefined && props.hasExplicitThreadId !== false,\n);\n\n// Imperative active-thread override (a picked row or a fresh startNewThread).\nconst activeThreadOverride = ref<{\n threadId: string;\n explicit: boolean;\n} | null>(null);\n\nconst stableLabels = useShallowStableRef(computed(() => props.labels));\n\nconst mergedLabels = computed<CopilotChatLabels>(() => ({\n ...CopilotChatDefaultLabels,\n ...parentConfigValue.value?.labels,\n ...stableLabels.value,\n}));\n\nconst resolvedAgentId = computed(\n () => props.agentId ?? parentConfigValue.value?.agentId ?? DEFAULT_AGENT_ID,\n);\n\nconst fallbackThreadId = randomUUID();\nconst resolvedThreadId = computed(() => {\n if (propIsAuthoritative.value) return props.threadId as string;\n if (activeThreadOverride.value) return activeThreadOverride.value.threadId;\n if (props.threadId) return props.threadId;\n if (parentConfigValue.value?.threadId)\n return parentConfigValue.value.threadId;\n return fallbackThreadId;\n});\n\n// Tell Core which Thread this view shows, so captured interactions can link\n// to it. This provider also works without a CopilotKitProvider, and then there\n// is nothing to register with. Registration starts on mount, so a server\n// render never registers a Thread that it can't unregister.\nconst copilotKitContext = inject(CopilotKitKey, null);\nlet openThread: OpenThreadRegistration | null = null;\nonMounted(() => {\n watch(\n () => [copilotKitContext?.copilotkit.value, resolvedAgentId.value] as const,\n ([core, agentId], _previous, onCleanup) => {\n if (!core) return;\n const registration = core.registerOpenThread({\n agentId,\n threadId: resolvedThreadId.value,\n });\n openThread = registration;\n onCleanup(() => {\n registration.unregister();\n openThread = null;\n });\n },\n { immediate: true },\n );\n watch(resolvedThreadId, (threadId) => openThread?.update(threadId));\n});\n\nconst resolvedHasExplicitThreadId = computed(() => {\n if (propIsAuthoritative.value) return true;\n const own = activeThreadOverride.value\n ? activeThreadOverride.value.explicit\n : props.hasExplicitThreadId !== undefined\n ? props.hasExplicitThreadId\n : !!props.threadId;\n return own || !!parentConfigValue.value?.hasExplicitThreadId;\n});\n\nconst shouldCreateModalState = computed(\n () => props.isModalDefaultOpen !== undefined,\n);\nconst resolvedDefaultOpen = computed(() => props.isModalDefaultOpen ?? true);\n\nconst internalModalOpen = ref<boolean>(\n parentConfigValue.value?.isModalOpen ?? resolvedDefaultOpen.value,\n);\n\nfunction setInternalModalOpen(open: boolean) {\n internalModalOpen.value = open;\n}\n\nconst resolvedIsModalOpen = computed(() =>\n shouldCreateModalState.value\n ? internalModalOpen.value\n : parentConfigValue.value?.isModalOpen,\n);\nconst resolvedSetModalOpen = computed(() =>\n shouldCreateModalState.value\n ? setInternalModalOpen\n : parentConfigValue.value?.setModalOpen,\n);\n\nfunction setActiveThreadId(threadId: string, options?: { explicit?: boolean }) {\n if (propIsAuthoritative.value) {\n console.warn(\n \"[CopilotKit] Ignoring setActiveThreadId(): threadId is controlled \" +\n \"via the `threadId` prop on CopilotChatConfigurationProvider.\",\n );\n return;\n }\n activeThreadOverride.value = {\n threadId,\n explicit: options?.explicit ?? true,\n };\n}\n\nfunction startNewThread() {\n if (propIsAuthoritative.value) {\n console.warn(\n \"[CopilotKit] Ignoring startNewThread(): threadId is controlled via \" +\n \"the `threadId` prop on CopilotChatConfigurationProvider.\",\n );\n return;\n }\n activeThreadOverride.value = { threadId: randomUUID(), explicit: false };\n}\n\n// Drawer presence + open state. The top-most provider owns the state; a nested\n// provider proxies its parent so the whole chain shares one drawer.\nconst ownDrawerOpen = ref(false);\nconst ownDrawerCount = ref(0);\n\nfunction ownSetDrawerOpen(open: boolean) {\n ownDrawerOpen.value = open;\n // Mobile mutual-exclusion: opening the drawer closes the chat modal.\n if (open && isMobileViewport()) {\n resolvedSetModalOpen.value?.(false);\n }\n}\n\nfunction ownRegisterDrawer(): () => void {\n ownDrawerCount.value += 1;\n return () => {\n ownDrawerCount.value = Math.max(0, ownDrawerCount.value - 1);\n };\n}\n\nconst resolvedDrawerOpen = computed(() =>\n parentConfigValue.value\n ? parentConfigValue.value.drawerOpen\n : ownDrawerOpen.value,\n);\nconst resolvedSetDrawerOpen = computed(() =>\n parentConfigValue.value\n ? parentConfigValue.value.setDrawerOpen\n : ownSetDrawerOpen,\n);\nconst resolvedDrawerRegistered = computed(() =>\n parentConfigValue.value\n ? parentConfigValue.value.drawerRegistered\n : ownDrawerCount.value > 0,\n);\nconst resolvedRegisterDrawer = computed(() =>\n parentConfigValue.value\n ? parentConfigValue.value.registerDrawer\n : ownRegisterDrawer,\n);\n\n// Public modal setter (mobile mutual-exclusion, other direction: opening the\n// chat modal closes the drawer). Preserve the contract that it is `undefined`\n// when this provider owns no modal state AND no parent provides one —\n// CopilotChatToggleButton relies on that absence to fall back to its own\n// local open-state. When a real modal setter exists (own `isModalDefaultOpen`\n// state or an inherited parent setter), wrap it so opening the modal on\n// mobile also closes the drawer.\n//\n// Note: this diverges from the React reference (CopilotChatConfigurationProvider.tsx),\n// which keeps `setModalOpen` always-defined and always backed by internal state. We\n// intentionally take the minimal Vue-local fix here — preserving the `undefined`\n// contract CopilotChatToggleButton depends on — rather than also reworking\n// `resolvedIsModalOpen`'s backing, to avoid changing bare-provider modal-open\n// semantics.\nconst publicSetModalOpen = computed(() => {\n const base = resolvedSetModalOpen.value; // undefined when no modal state + no parent\n if (!base) return undefined;\n return (open: boolean) => {\n if (open && isMobileViewport()) {\n resolvedSetDrawerOpen.value?.(false);\n }\n base(open);\n };\n});\n\nconst configurationValue = computed<CopilotChatConfigurationValue>(() => ({\n labels: mergedLabels.value,\n agentId: resolvedAgentId.value,\n threadId: resolvedThreadId.value,\n hasExplicitThreadId: resolvedHasExplicitThreadId.value,\n isModalOpen: resolvedIsModalOpen.value,\n setModalOpen: publicSetModalOpen.value,\n drawerOpen: resolvedDrawerOpen.value,\n setDrawerOpen: resolvedSetDrawerOpen.value,\n drawerRegistered: resolvedDrawerRegistered.value,\n registerDrawer: resolvedRegisterDrawer.value,\n setActiveThreadId,\n startNewThread,\n}));\n\nprovide(CopilotChatConfigurationKey, configurationValue);\n</script>\n\n<template>\n <slot />\n</template>\n","import { computed, inject, type ComputedRef } from \"vue\";\nimport {\n LicenseContextKey,\n createDefaultLicenseRef,\n type LicenseContextValue,\n} from \"./license-context\";\n\n/**\n * Vue counterpart of React's `useLicenseContext()` hook.\n *\n * Returns a `ComputedRef<LicenseContextValue>` whose `checkFeature(...)` /\n * `getLimit(...)` callbacks track the value installed by\n * `CopilotKitProvider`. Falls back to a permissive default\n * (`createLicenseContextValue(null)`) when no provider has registered the\n * context — matching React's `createContext(createLicenseContextValue(null))`\n * default and keeping component trees mountable in isolation.\n */\nexport function useLicenseContext(): ComputedRef<LicenseContextValue> {\n const source = inject(LicenseContextKey, createDefaultLicenseRef(), true);\n return computed(() => source.value);\n}\n","/**\n * Vue-native A2UI Surface renderer.\n *\n * Replaces the React island pattern with Vue components that use\n * @a2ui/web_core's framework-agnostic primitives directly.\n */\n\nimport {\n defineComponent,\n h,\n ref,\n onUnmounted,\n type PropType,\n type VNode,\n} from \"vue\";\nimport {\n ComponentContext,\n type SurfaceModel,\n type ComponentModel,\n} from \"@a2ui/web_core/v0_9\";\nimport type { VueComponentImplementation } from \"./adapter\";\n\n/**\n * DeferredChild — Vue equivalent of the React DeferredChild.\n * Subscribes to component create/delete events and renders the\n * appropriate catalog component via the GenericBinder adapter.\n */\nconst DeferredChild = defineComponent({\n name: \"A2UIDeferredChild\",\n props: {\n surface: {\n type: Object as PropType<SurfaceModel<VueComponentImplementation>>,\n required: true,\n },\n id: { type: String, required: true },\n basePath: { type: String, required: true },\n },\n setup(props) {\n // Reactive trigger — incremented when the component is created/deleted\n const version = ref(0);\n\n const sub1 = props.surface.componentsModel.onCreated.subscribe(\n (comp: ComponentModel) => {\n if (comp.id === props.id) {\n version.value++;\n }\n },\n );\n const sub2 = props.surface.componentsModel.onDeleted.subscribe(\n (delId: string) => {\n if (delId === props.id) {\n version.value++;\n }\n },\n );\n\n onUnmounted(() => {\n sub1.unsubscribe();\n sub2.unsubscribe();\n });\n\n function buildChild(childId: string, specificPath?: string): VNode {\n const path = specificPath || props.basePath;\n return h(DeferredChild, {\n key: `${childId}-${path}`,\n surface: props.surface,\n id: childId,\n basePath: path,\n });\n }\n\n return () => {\n // Touch version to ensure reactivity\n void version.value;\n\n const componentModel = props.surface.componentsModel.get(props.id);\n\n if (!componentModel) {\n // Shimmer placeholder while component isn't yet available\n return h(\"div\", {\n style: {\n padding: \"12px 16px\",\n borderRadius: \"8px\",\n background:\n \"linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)\",\n backgroundSize: \"200% 100%\",\n animation: \"a2ui-shimmer 1.5s ease-in-out infinite\",\n minHeight: \"2rem\",\n },\n innerHTML: `<style>@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }</style>`,\n });\n }\n\n const compImpl = props.surface.catalog.components.get(\n componentModel.type,\n );\n\n if (!compImpl) {\n return h(\n \"div\",\n { style: { color: \"red\" } },\n `Unknown component: ${componentModel.type}`,\n );\n }\n\n // Create context for this component\n const context = new ComponentContext(\n props.surface,\n props.id,\n props.basePath,\n );\n\n // Render the catalog component's Vue wrapper (created by createVueComponent)\n return h(compImpl.render, {\n context,\n buildChild,\n });\n };\n },\n});\n\n/**\n * A2uiSurface — renders the root of a single A2UI surface.\n * The root component always has ID 'root' and base path '/'.\n */\nexport const A2uiSurface = defineComponent({\n name: \"A2uiSurface\",\n props: {\n surface: {\n type: Object as PropType<SurfaceModel<VueComponentImplementation>>,\n required: true,\n },\n },\n setup(props) {\n return () =>\n h(DeferredChild, {\n surface: props.surface,\n id: \"root\",\n basePath: \"/\",\n });\n },\n});\n\nexport { DeferredChild };\n","<script setup lang=\"ts\">\nimport { computed, h, onBeforeUnmount, shallowRef, ref, watch } from \"vue\";\nimport type { VNode } from \"vue\";\nimport type { ActivityMessage } from \"@ag-ui/core\";\nimport type { A2UITheme } from \"../types\";\nimport type { A2UIOperation } from \"./a2ui\";\nimport { getOperationSurfaceId } from \"./a2ui\";\nimport { useCopilotKit } from \"../providers\";\nimport { MessageProcessor } from \"@a2ui/web_core/v0_9\";\nimport type { SurfaceModel } from \"@a2ui/web_core/v0_9\";\nimport { vueBasicCatalog, A2uiSurface } from \"./a2ui/index\";\nimport type { VueComponentImplementation } from \"./a2ui/index\";\n\nconst DEFAULT_SURFACE_ID = \"default\";\n\nconst props = defineProps<{\n activityType: string;\n content: { operations: A2UIOperation[] };\n message: ActivityMessage;\n agent?: object;\n theme?: A2UITheme;\n catalog?: any;\n}>();\n\nconst { copilotkit } = useCopilotKit();\n\n// MessageProcessor from @a2ui/web_core — framework-agnostic\n// Use shallowRef to avoid Vue's deep UnwrapRef which strips private class members\nconst processorRef =\n shallowRef<MessageProcessor<VueComponentImplementation> | null>(null);\n// Version counter to trigger Vue reactivity on processor state changes\nconst version = ref(0);\n// Error state\nconst error = ref<string | null>(null);\n// Track last processed operations hash to avoid re-processing\nlet lastOpsHash = \"\";\n\nfunction getOrCreateProcessor(): MessageProcessor<VueComponentImplementation> {\n if (!processorRef.value) {\n const catalog = props.catalog ?? vueBasicCatalog;\n processorRef.value = new MessageProcessor<VueComponentImplementation>(\n [catalog],\n (action: unknown) => {\n handleAction(action);\n },\n );\n }\n return processorRef.value;\n}\n\nasync function handleAction(message: unknown) {\n if (!props.agent) return;\n try {\n copilotkit.value.setProperties({\n ...copilotkit.value.properties,\n a2uiAction: message,\n });\n await copilotkit.value.runAgent({ agent: props.agent as any });\n } finally {\n const { a2uiAction, ...rest } = copilotkit.value.properties ?? {};\n copilotkit.value.setProperties(rest);\n }\n}\n\nfunction processOperations(operations: A2UIOperation[]) {\n if (!operations?.length) return;\n\n const hash = JSON.stringify(operations);\n if (hash === lastOpsHash) return;\n lastOpsHash = hash;\n\n const processor = getOrCreateProcessor();\n try {\n // Group operations by surface ID\n const grouped = new Map<string, A2UIOperation[]>();\n for (const op of operations) {\n const surfaceId = getOperationSurfaceId(op) ?? DEFAULT_SURFACE_ID;\n if (!grouped.has(surfaceId)) grouped.set(surfaceId, []);\n grouped.get(surfaceId)!.push(op);\n }\n\n // For each surface, skip createSurface if the surface already exists\n for (const [surfaceId, ops] of grouped) {\n const existing = processor.model.getSurface(surfaceId);\n const filtered = existing\n ? ops.filter((op) => !(op as any)?.createSurface)\n : ops;\n processor.processMessages(filtered as any);\n }\n error.value = null;\n } catch (err) {\n console.warn(\"[A2UI Vue] processMessages error:\", err);\n error.value = err instanceof Error ? err.message : String(err);\n }\n version.value++;\n}\n\n// Process operations on mount and when they change\nwatch(\n () => [props.content.operations, props.theme, props.catalog, props.agent],\n () => {\n processOperations(props.content.operations);\n },\n { deep: true, immediate: true },\n);\n\nonBeforeUnmount(() => {\n processorRef.value = null;\n lastOpsHash = \"\";\n});\n\nconst hasOperations = computed(\n () => (props.content.operations ?? []).length > 0,\n);\n\n// Compute the list of surfaces to render\nconst surfaceEntries = computed(() => {\n // Touch version to ensure reactivity\n void version.value;\n\n if (!processorRef.value) return [];\n\n const entries: Array<{\n surfaceId: string;\n surface: SurfaceModel<VueComponentImplementation>;\n }> = [];\n\n // Group operations by surface to know which surfaces we expect\n const grouped = new Map<string, A2UIOperation[]>();\n for (const op of props.content.operations ?? []) {\n const surfaceId = getOperationSurfaceId(op) ?? DEFAULT_SURFACE_ID;\n if (!grouped.has(surfaceId)) grouped.set(surfaceId, []);\n grouped.get(surfaceId)!.push(op);\n }\n\n for (const [surfaceId] of grouped) {\n const surface = processorRef.value.model.getSurface(surfaceId);\n if (surface) {\n entries.push({ surfaceId, surface });\n }\n }\n\n return entries;\n});\n</script>\n\n<template>\n <div\n v-if=\"hasOperations\"\n data-copilotkit\n :data-activity-type=\"activityType\"\n :data-message-id=\"message.id\"\n >\n <div v-if=\"error\" class=\"cpk-a2ui-message-error\">\n A2UI render error: {{ error }}\n </div>\n <div\n v-else\n class=\"cpk-a2ui-message-surfaces\"\n data-testid=\"a2ui-activity-renderer\"\n >\n <div\n v-for=\"entry in surfaceEntries\"\n :key=\"entry.surfaceId\"\n class=\"cpk-a2ui-message-surface-host\"\n :data-surface-id=\"entry.surfaceId\"\n >\n <div class=\"a2ui-surface cpk-a2ui-message-surface\">\n <A2uiSurface :surface=\"entry.surface\" />\n </div>\n </div>\n </div>\n </div>\n</template>\n","//#region src/parser/helpers.ts\n/**\n* Default parser options for streaming markdown.\n*/\nconst DEFAULT_OPTIONS = {\n\tsegmenter: true,\n\tenableTables: true,\n\tenableAutolinks: true\n};\n/**\n* Merges user-provided parser options with defaults.\n*\n* @param options - Optional partial parser options.\n* @returns Fully populated parser options.\n*/\nfunction normalizeOptions(options) {\n\treturn {\n\t\tsegmenter: options?.segmenter ?? DEFAULT_OPTIONS.segmenter,\n\t\tenableTables: options?.enableTables ?? DEFAULT_OPTIONS.enableTables,\n\t\tenableAutolinks: options?.enableAutolinks ?? DEFAULT_OPTIONS.enableAutolinks\n\t};\n}\n/**\n* Normalizes streaming input chunks by handling trailing carriage-return boundaries.\n*\n* @param chunk - Incoming raw chunk.\n* @param hadPendingCR - Whether the previous chunk ended with `\\\\r`.\n* @returns Normalized text and whether this chunk now ends with a pending `\\\\r`.\n*/\nfunction normalizeChunk(chunk, hadPendingCR) {\n\tconst input = (hadPendingCR ? \"\\r\" : \"\") + chunk;\n\tconst pendingCarriageReturn = input.endsWith(\"\\r\");\n\treturn {\n\t\ttext: (pendingCarriageReturn ? input.slice(0, -1) : input).replace(/\\r\\n?/g, \"\\n\"),\n\t\tpendingCarriageReturn\n\t};\n}\n/**\n* Splits normalized source text into lines with source offsets.\n*\n* @param source - Normalized source text.\n* @returns Line descriptors preserving absolute ranges.\n*/\nfunction splitLines(source) {\n\tconst lines = [];\n\tlet start = 0;\n\tfor (let i = 0; i < source.length; i += 1) {\n\t\tif (source[i] !== \"\\n\") continue;\n\t\tlines.push({\n\t\t\ttext: source.slice(start, i),\n\t\t\tstart,\n\t\t\tend: i + 1,\n\t\t\thasNewline: true\n\t\t});\n\t\tstart = i + 1;\n\t}\n\tif (start < source.length || source.length === 0) lines.push({\n\t\ttext: source.slice(start),\n\t\tstart,\n\t\tend: source.length,\n\t\thasNewline: false\n\t});\n\treturn lines;\n}\n/**\n* Returns the trailing unterminated line text.\n*\n* @param source - Full source text.\n* @returns Last line content after the final newline.\n*/\nfunction getLineBuffer(source) {\n\tconst newline = source.lastIndexOf(\"\\n\");\n\treturn newline < 0 ? source : source.slice(newline + 1);\n}\n/**\n* Converts an absolute source index to 1-based line/column.\n*\n* @param source - Source text.\n* @param index - Absolute index.\n* @returns 1-based line and column coordinates.\n*/\nfunction toLineColumn(source, index) {\n\tlet line = 1;\n\tlet column = 1;\n\tfor (let i = 0; i < index; i += 1) if (source[i] === \"\\n\") {\n\t\tline += 1;\n\t\tcolumn = 1;\n\t} else column += 1;\n\treturn {\n\t\tline,\n\t\tcolumn\n\t};\n}\n/**\n* Returns true for blank lines.\n*/\nfunction isBlank(value) {\n\treturn /^\\s*$/.test(value);\n}\n/**\n* Returns true when a line is a citation definition.\n*/\nfunction isCitationDefinitionLine(value) {\n\treturn /^\\s{0,3}\\[\\^([^\\]\\s]+)\\]:\\s*(.*)$/.test(value);\n}\n/**\n* Returns true when a line is an unfinished citation-definition prefix candidate.\n*\n* This enables optimistic streaming behavior for definition lines that begin with\n* `[^` but are not yet complete enough to classify as either:\n* 1) a valid citation definition, or\n* 2) plain paragraph text.\n*\n* @param value - Raw line text.\n* @param hasNewline - Whether the source line is newline-terminated.\n* @param isComplete - Whether the parser has been finalized.\n*/\nfunction isCitationDefinitionPrefixCandidate(value, hasNewline, isComplete) {\n\tif (hasNewline || isComplete || isCitationDefinitionLine(value)) return false;\n\treturn /^\\s{0,3}\\[\\^[^\\]\\s]*$/.test(value) || /^\\s{0,3}\\[\\^[^\\]\\s]+\\]$/.test(value);\n}\n/**\n* Matches an opening fenced code block marker.\n*/\nfunction matchFenceOpen(value) {\n\tconst trimmed = value.trimStart();\n\tconst backtick = /^(`{3,})(.*)$/.exec(trimmed);\n\tif (backtick) return {\n\t\tmarker: \"```\",\n\t\tlength: backtick[1].length,\n\t\tinfo: backtick[2].trim()\n\t};\n\tconst tilde = /^(~{3,})(.*)$/.exec(trimmed);\n\tif (tilde) return {\n\t\tmarker: \"~~~\",\n\t\tlength: tilde[1].length,\n\t\tinfo: tilde[2].trim()\n\t};\n\treturn null;\n}\n/**\n* Matches a valid fenced code block closing line.\n*/\nfunction matchFenceClose(value, marker, length) {\n\tif (!(marker === \"```\" ? /^\\s*`{3,}\\s*$/ : /^\\s*~{3,}\\s*$/).test(value)) return false;\n\treturn value.trim().length >= length;\n}\n/**\n* Matches ATX heading syntax and extracts heading metadata.\n*/\nfunction matchAtxHeading(value) {\n\tconst match = /^\\s{0,3}(#{1,6})[ \\t]+(.+?)\\s*#*\\s*$/.exec(value);\n\tif (!match) return null;\n\treturn {\n\t\tlevel: match[1].length,\n\t\ttext: match[2],\n\t\tcontentOffset: value.indexOf(match[2])\n\t};\n}\n/**\n* Returns true for setext heading underline lines.\n*/\nfunction isSetextUnderline(value) {\n\treturn /^\\s{0,3}(=+|-+)\\s*$/.test(value);\n}\n/**\n* Returns true for thematic break syntax.\n*/\nfunction isThematicBreak(value) {\n\treturn /^\\s{0,3}((\\*\\s*){3,}|(-\\s*){3,}|(_\\s*){3,})$/.test(value);\n}\n/**\n* Matches ordered and unordered list-item markers.\n*/\nfunction matchListItem(value) {\n\tconst unordered = /^(\\s{0,3})([-+*])(\\s+)(.*)$/.exec(value);\n\tif (unordered) {\n\t\tconst indent = unordered[1].length;\n\t\tconst contentIndent = indent + unordered[2].length + unordered[3].length;\n\t\treturn {\n\t\t\tordered: false,\n\t\t\tstart: 1,\n\t\t\tcontent: unordered[4],\n\t\t\tindent,\n\t\t\tcontentIndent\n\t\t};\n\t}\n\tconst ordered = /^(\\s{0,3})(\\d{1,9})([.)])(\\s+)(.*)$/.exec(value);\n\tif (ordered) {\n\t\tconst indent = ordered[1].length;\n\t\tconst contentIndent = indent + (ordered[2].length + ordered[3].length) + ordered[4].length;\n\t\treturn {\n\t\t\tordered: true,\n\t\t\tstart: Number(ordered[2]),\n\t\t\tcontent: ordered[5],\n\t\t\tindent,\n\t\t\tcontentIndent\n\t\t};\n\t}\n\treturn null;\n}\n/**\n* Returns true for blockquote marker lines.\n*/\nfunction isBlockquoteLine(value) {\n\treturn /^\\s{0,3}>\\s?/.test(value);\n}\n/**\n* Returns true when two lines form a GFM table header + divider pair.\n*/\nfunction isPipeTableHeader(first, second) {\n\treturn looksLikeTableRow(first.text) && isTableDividerRow(second.text);\n}\n/**\n* Returns true when a line appears to be a table row.\n*/\nfunction looksLikeTableRow(value) {\n\treturn value.includes(\"|\") && /\\S/.test(value.replace(/\\|/g, \"\"));\n}\n/**\n* Returns true for GFM table divider rows.\n*/\nfunction isTableDividerRow(value) {\n\tconst cells = splitTableCells(value);\n\tif (cells.length === 0) return false;\n\treturn cells.every((cell) => /^:?-{3,}:?$/.test(cell.trim()));\n}\n/**\n* Splits a pipe-table row into trimmed cell values.\n*/\nfunction splitTableCells(value) {\n\tconst trimmed = value.trim();\n\tconst body = trimmed.startsWith(\"|\") ? trimmed.slice(1) : trimmed;\n\treturn (body.endsWith(\"|\") ? body.slice(0, -1) : body).split(\"|\").map((cell) => cell.trim());\n}\n/**\n* Converts table divider cells into alignment metadata.\n*/\nfunction parseTableAlignment(cells) {\n\treturn cells.map((cell) => {\n\t\tconst trimmed = cell.trim();\n\t\tconst left = trimmed.startsWith(\":\");\n\t\tconst right = trimmed.endsWith(\":\");\n\t\tif (left && right) return \"center\";\n\t\tif (left) return \"left\";\n\t\tif (right) return \"right\";\n\t\treturn \"none\";\n\t});\n}\n/**\n* Determines whether a line starts a new block construct.\n*/\nfunction startsNewBlock(lines, index, enableTables) {\n\tconst line = lines[index].text;\n\treturn !!matchFenceOpen(line) || !!matchAtxHeading(line) || isThematicBreak(line) || !!matchListItem(line) || isBlockquoteLine(line) || enableTables && index + 1 < lines.length && isPipeTableHeader(lines[index], lines[index + 1]);\n}\n/**\n* Returns true when a character is escapable in CommonMark inline syntax.\n*/\nfunction isEscapable(ch) {\n\treturn /[!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_`{|}~]/.test(ch);\n}\n/**\n* Finds the matching closing delimiter for a nested delimiter pair.\n*/\nfunction findClosing(input, openAt, openChar, closeChar) {\n\tlet depth = 0;\n\tfor (let i = openAt; i < input.length; i += 1) {\n\t\tconst ch = input[i];\n\t\tif (ch === \"\\\\\") {\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === openChar) {\n\t\t\tdepth += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === closeChar) {\n\t\t\tdepth -= 1;\n\t\t\tif (depth === 0) return i;\n\t\t}\n\t}\n\treturn -1;\n}\n/**\n* Parses a markdown link destination and optional title.\n*/\nfunction parseLinkDestination(input) {\n\tconst trimmed = input.trim();\n\tif (trimmed.startsWith(\"<\")) {\n\t\tconst close = trimmed.indexOf(\">\");\n\t\tif (close > 0) {\n\t\t\tconst url = trimmed.slice(1, close);\n\t\t\tconst title = parseLinkTitle(trimmed.slice(close + 1).trim());\n\t\t\treturn title ? {\n\t\t\t\turl,\n\t\t\t\ttitle\n\t\t\t} : { url };\n\t\t}\n\t}\n\tconst firstSpace = trimmed.search(/\\s/);\n\tif (firstSpace < 0) return { url: trimmed };\n\tconst url = trimmed.slice(0, firstSpace);\n\tconst title = parseLinkTitle(trimmed.slice(firstSpace).trim());\n\treturn title ? {\n\t\turl,\n\t\ttitle\n\t} : { url };\n}\n/**\n* Parses CommonMark-style link titles (`\\\"...\\\"`, `'...'`, `( ... )`).\n*/\nfunction parseLinkTitle(input) {\n\tif (!input) return;\n\tif (input.startsWith(\"\\\"\") && input.endsWith(\"\\\"\") || input.startsWith(\"'\") && input.endsWith(\"'\")) return input.slice(1, -1);\n\tif (input.startsWith(\"(\") && input.endsWith(\")\")) return input.slice(1, -1);\n}\n/**\n* Returns true for URL-shaped text supported by autolink detection.\n*/\nfunction isUrl(value) {\n\treturn /^(https?:\\/\\/|www\\.)\\S+$/.test(value);\n}\n/**\n* Returns true for email-shaped text supported by autolink detection.\n*/\nfunction isEmail(value) {\n\treturn /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/.test(value);\n}\n/**\n* Trims punctuation suffixes from autolink candidates.\n*/\nfunction trimAutolinkTrailingPunctuation(value) {\n\tlet end = value.length;\n\twhile (end > 0 && /[.,;:!?]/.test(value[end - 1])) end -= 1;\n\tlet candidate = value.slice(0, end);\n\tif (candidate.endsWith(\")\")) {\n\t\tconst open = (candidate.match(/\\(/g) ?? []).length;\n\t\tif ((candidate.match(/\\)/g) ?? []).length > open) candidate = candidate.slice(0, -1);\n\t}\n\treturn candidate;\n}\n\n//#endregion\n//#region src/parser/citations.ts\n/**\n* Extracts citation definitions from source text.\n*\n* @param source - Full normalized markdown source.\n* @param warnings - Mutable warning collection for parse diagnostics.\n* @returns Citation state with collected definitions and empty reference order.\n*/\nfunction parseCitationDefinitions(source) {\n\tconst definitions = {};\n\tconst warnings = [];\n\tconst lines = source.split(\"\\n\");\n\tlet offset = 0;\n\tfor (const line of lines) {\n\t\tconst match = /^\\s{0,3}\\[\\^([^\\]\\s]+)\\]:\\s*(.*)$/.exec(line);\n\t\tif (!match) {\n\t\t\toffset += line.length + 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst id = match[1];\n\t\tif (definitions[id]) {\n\t\t\twarnings.push({\n\t\t\t\tcode: \"invalid_citation_definition\",\n\t\t\t\tat: offset\n\t\t\t});\n\t\t\toffset += line.length + 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst extracted = extractTrailingUrl(match[2].trim());\n\t\tdefinitions[id] = {\n\t\t\tid,\n\t\t\ttext: extracted.text,\n\t\t\t...extracted.url ? { url: extracted.url } : {}\n\t\t};\n\t\toffset += line.length + 1;\n\t}\n\treturn {\n\t\tcitations: {\n\t\t\torder: [],\n\t\t\tnumbers: {},\n\t\t\tdefinitions\n\t\t},\n\t\twarnings\n\t};\n}\n/**\n* Assigns or returns a stable citation number by first-seen inline reference order.\n*\n* @param citations - Citation state that tracks numbering.\n* @param idRef - Citation identifier (without `[^` and `]` markers).\n* @returns Stable numeric citation number.\n*/\nfunction assignCitationNumber(citations, idRef) {\n\tconst existing = citations.numbers[idRef];\n\tif (typeof existing === \"number\") return {\n\t\tcitations,\n\t\tnumber: existing\n\t};\n\tconst next = citations.order.length + 1;\n\treturn {\n\t\tcitations: {\n\t\t\t...citations,\n\t\t\torder: [...citations.order, idRef],\n\t\t\tnumbers: {\n\t\t\t\t...citations.numbers,\n\t\t\t\t[idRef]: next\n\t\t\t}\n\t\t},\n\t\tnumber: next\n\t};\n}\nfunction extractTrailingUrl(input) {\n\tif (!input) return { text: \"\" };\n\tconst match = /(?:\\s|^)(https?:\\/\\/\\S+|www\\.\\S+)$/.exec(input);\n\tif (!match) return { text: input };\n\treturn {\n\t\ttext: input.slice(0, match.index).trimEnd(),\n\t\turl: match[1]\n\t};\n}\n\n//#endregion\n//#region src/parser/segments.ts\n/**\n* Computes parse-time text segments for animation and incremental rendering.\n*\n* @param text - Raw text content for a single text node.\n* @param absoluteStart - Absolute source index where `text` begins.\n* @param context - Parse context containing segmenter options and warning state.\n* @returns Segment list or empty list when segmentation is disabled/unavailable.\n*/\nfunction createSegments(text, absoluteStart, options) {\n\tif (options.segmenter === false) return {\n\t\tsegments: [],\n\t\thasWarnedSegmenterUnavailable: options.hasWarnedSegmenterUnavailable\n\t};\n\tconst segmenterCtor = typeof Intl === \"undefined\" ? void 0 : Intl.Segmenter;\n\tif (!segmenterCtor) {\n\t\tif (!options.hasWarnedSegmenterUnavailable) return {\n\t\t\tsegments: [],\n\t\t\twarning: {\n\t\t\t\tcode: \"segmenter_unavailable\",\n\t\t\t\tat: absoluteStart\n\t\t\t},\n\t\t\thasWarnedSegmenterUnavailable: true\n\t\t};\n\t\treturn {\n\t\t\tsegments: [],\n\t\t\thasWarnedSegmenterUnavailable: true\n\t\t};\n\t}\n\tconst granularity = options.segmenter === true ? \"word\" : options.segmenter.granularity ?? \"word\";\n\tconst segmenter = new segmenterCtor(options.segmenter === true ? void 0 : options.segmenter.locale, { granularity });\n\tconst segments = [];\n\tfor (const segment of segmenter.segment(text)) {\n\t\tconst segmentText = segment.segment;\n\t\tconst start = absoluteStart + segment.index;\n\t\tsegments.push({\n\t\t\ttext: segmentText,\n\t\t\tstart,\n\t\t\tend: start + segmentText.length,\n\t\t\tkind: granularity,\n\t\t\tisWhitespace: /^\\s+$/.test(segmentText)\n\t\t});\n\t}\n\treturn {\n\t\tsegments: clusterPunctuationSegments(segments),\n\t\thasWarnedSegmenterUnavailable: options.hasWarnedSegmenterUnavailable\n\t};\n}\nfunction clusterPunctuationSegments(segments) {\n\tconst withClosingAttached = segments.reduce((acc, segment) => {\n\t\tconst previous = acc[acc.length - 1];\n\t\tif (previous && !previous.isWhitespace && isClosingPunctuationOnly(segment.text)) {\n\t\t\tacc[acc.length - 1] = {\n\t\t\t\t...previous,\n\t\t\t\ttext: `${previous.text}${segment.text}`,\n\t\t\t\tend: segment.end\n\t\t\t};\n\t\t\treturn acc;\n\t\t}\n\t\treturn [...acc, segment];\n\t}, []);\n\tconst clustered = [];\n\tlet i = 0;\n\twhile (i < withClosingAttached.length) {\n\t\tconst current = withClosingAttached[i];\n\t\tconst next = i + 1 < withClosingAttached.length ? withClosingAttached[i + 1] : null;\n\t\tif (next && !next.isWhitespace && isOpeningPunctuationOnly(current.text)) {\n\t\t\tclustered.push({\n\t\t\t\t...next,\n\t\t\t\ttext: `${current.text}${next.text}`,\n\t\t\t\tstart: current.start\n\t\t\t});\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tclustered.push(current);\n\t\ti += 1;\n\t}\n\treturn clustered;\n}\nfunction isClosingPunctuationOnly(value) {\n\treturn isOnlyFromSet(value, CLOSING_PUNCTUATION$1);\n}\nfunction isOpeningPunctuationOnly(value) {\n\treturn isOnlyFromSet(value, OPENING_PUNCTUATION);\n}\nfunction isOnlyFromSet(value, charset) {\n\treturn value.length > 0 && [...value].every((character) => charset.has(character));\n}\nconst CLOSING_PUNCTUATION$1 = new Set([\n\t\"]\",\n\t\",\",\n\t\".\",\n\t\"!\",\n\t\"?\",\n\t\";\",\n\t\":\",\n\t\"%\",\n\t\")\",\n\t\"}\",\n\t\">\",\n\t\"\\\"\",\n\t\"'\",\n\t\"、\",\n\t\"。\",\n\t\",\",\n\t\".\",\n\t\"!\",\n\t\"?\",\n\t\":\",\n\t\";\",\n\t\"%\",\n\t\")\",\n\t\"]\",\n\t\"}\",\n\t\"〉\",\n\t\"》\",\n\t\"」\",\n\t\"』\",\n\t\"】\",\n\t\"〕\",\n\t\"〗\"\n]);\nconst OPENING_PUNCTUATION = new Set([\n\t\"(\",\n\t\"{\",\n\t\"[\",\n\t\"\\\"\",\n\t\"'\",\n\t\"〈\",\n\t\"《\",\n\t\"「\",\n\t\"『\",\n\t\"【\",\n\t\"〔\",\n\t\"〖\",\n\t\"(\",\n\t\"[\",\n\t\"{\"\n]);\n\n//#endregion\n//#region src/parser/inline-parser.ts\n/**\n* Parses inline markdown content into inline draft nodes.\n*\n* @param text - Inline source text.\n* @param absoluteStart - Absolute source offset for the first character in `text`.\n* @param path - Stable path prefix for emitted nodes.\n* @param context - Immutable parse context shared across block/inline parsing.\n* @returns Inline draft nodes and updated immutable parser context.\n*/\nfunction parseInline(text, absoluteStart, path, context) {\n\tconst nodes = [];\n\tlet i = 0;\n\tlet textBuffer = \"\";\n\tlet textBufferStart = -1;\n\tlet citations = context.citations;\n\tlet warnings = context.warnings;\n\tlet hasWarnedSegmenterUnavailable = context.hasWarnedSegmenterUnavailable;\n\tconst flushTextBuffer = () => {\n\t\tif (textBuffer.length === 0 || textBufferStart < 0) return;\n\t\tconst appendResult = appendText(nodes, textBuffer, textBufferStart, path, context.options.segmenter, hasWarnedSegmenterUnavailable);\n\t\twarnings = appendResult.warnings.length > 0 ? [...warnings, ...appendResult.warnings] : warnings;\n\t\thasWarnedSegmenterUnavailable = appendResult.hasWarnedSegmenterUnavailable;\n\t\ttextBuffer = \"\";\n\t\ttextBufferStart = -1;\n\t};\n\tconst appendBufferedText = (value, start) => {\n\t\tif (value.length === 0) return;\n\t\tif (textBuffer.length === 0) textBufferStart = start;\n\t\ttextBuffer += value;\n\t};\n\twhile (i < text.length) {\n\t\tconst current = text[i];\n\t\tif (current === \"\\n\") {\n\t\t\tconst hardByBackslash = countTrailing(text, i - 1, \"\\\\\") % 2 === 1;\n\t\t\tconst hardBySpaces = i > 1 && text.slice(i - 2, i) === \" \";\n\t\t\tconst hard = hardByBackslash || hardBySpaces;\n\t\t\tif (hardByBackslash && textBuffer.endsWith(\"\\\\\")) textBuffer = textBuffer.slice(0, -1);\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push({\n\t\t\t\tpath: `${path}.${nodes.length}`,\n\t\t\t\ttype: hard ? \"hard-break\" : \"soft-break\",\n\t\t\t\trange: {\n\t\t\t\t\tstart: absoluteStart + i,\n\t\t\t\t\tend: absoluteStart + i + 1\n\t\t\t\t},\n\t\t\t\tclosed: true,\n\t\t\t\tprops: {},\n\t\t\t\tchildren: []\n\t\t\t});\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (current === \"\\\\\" && i + 1 < text.length && isEscapable(text[i + 1])) {\n\t\t\tappendBufferedText(text[i + 1], absoluteStart + i);\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tconst citation = parseCitationInline(text, i, absoluteStart, path, citations, nodes.length, context.isComplete);\n\t\tif (citation) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(citation.node);\n\t\t\ti = citation.next;\n\t\t\tcitations = citation.citations;\n\t\t\tcontinue;\n\t\t}\n\t\tconst image = parseImageInline(text, i, absoluteStart, path, nodes.length);\n\t\tif (image) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(image.node);\n\t\t\ti = image.next;\n\t\t\tcontinue;\n\t\t}\n\t\tconst link = parseLinkInline(text, i, absoluteStart, path, nodes.length, context, citations, warnings, hasWarnedSegmenterUnavailable);\n\t\tif (link) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(link.node);\n\t\t\ti = link.next;\n\t\t\tcitations = link.citations;\n\t\t\twarnings = link.warnings;\n\t\t\thasWarnedSegmenterUnavailable = link.hasWarnedSegmenterUnavailable;\n\t\t\tcontinue;\n\t\t}\n\t\tconst auto = parseAutolinkInline(text, i, absoluteStart, path, context.options.enableAutolinks, nodes.length);\n\t\tif (auto) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(auto.node);\n\t\t\ti = auto.next;\n\t\t\tcontinue;\n\t\t}\n\t\tconst code = parseInlineCode(text, i, absoluteStart, path, nodes.length);\n\t\tif (code) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(code.node);\n\t\t\ti = code.next;\n\t\t\tcontinue;\n\t\t}\n\t\tconst strong = parseDelimitedInline(text, i, \"**\", \"strong\", absoluteStart, path, nodes.length, context, citations, warnings, hasWarnedSegmenterUnavailable) ?? parseDelimitedInline(text, i, \"__\", \"strong\", absoluteStart, path, nodes.length, context, citations, warnings, hasWarnedSegmenterUnavailable);\n\t\tif (strong) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(strong.node);\n\t\t\ti = strong.next;\n\t\t\tcitations = strong.citations;\n\t\t\twarnings = strong.warnings;\n\t\t\thasWarnedSegmenterUnavailable = strong.hasWarnedSegmenterUnavailable;\n\t\t\tcontinue;\n\t\t}\n\t\tconst strike = parseDelimitedInline(text, i, \"~~\", \"strikethrough\", absoluteStart, path, nodes.length, context, citations, warnings, hasWarnedSegmenterUnavailable);\n\t\tif (strike) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(strike.node);\n\t\t\ti = strike.next;\n\t\t\tcitations = strike.citations;\n\t\t\twarnings = strike.warnings;\n\t\t\thasWarnedSegmenterUnavailable = strike.hasWarnedSegmenterUnavailable;\n\t\t\tcontinue;\n\t\t}\n\t\tconst em = parseDelimitedInline(text, i, \"*\", \"em\", absoluteStart, path, nodes.length, context, citations, warnings, hasWarnedSegmenterUnavailable) ?? parseDelimitedInline(text, i, \"_\", \"em\", absoluteStart, path, nodes.length, context, citations, warnings, hasWarnedSegmenterUnavailable);\n\t\tif (em) {\n\t\t\tflushTextBuffer();\n\t\t\tnodes.push(em.node);\n\t\t\ti = em.next;\n\t\t\tcitations = em.citations;\n\t\t\twarnings = em.warnings;\n\t\t\thasWarnedSegmenterUnavailable = em.hasWarnedSegmenterUnavailable;\n\t\t\tcontinue;\n\t\t}\n\t\tappendBufferedText(text[i], absoluteStart + i);\n\t\ti += 1;\n\t}\n\tflushTextBuffer();\n\treturn {\n\t\tvalue: annotateNoBreakBeforeSegments(nodes),\n\t\tcitations,\n\t\twarnings,\n\t\thasWarnedSegmenterUnavailable\n\t};\n}\nfunction countTrailing(text, index, value) {\n\tlet run = 0;\n\tlet i = index;\n\twhile (i >= 0 && text[i] === value) {\n\t\trun += 1;\n\t\ti -= 1;\n\t}\n\treturn run;\n}\nfunction annotateNoBreakBeforeSegments(nodes) {\n\tlet changed = false;\n\tconst next = nodes.map((node, index) => {\n\t\tif (node.type !== \"text\") return node;\n\t\tconst segments = node.props[\"segments\"];\n\t\tif (!Array.isArray(segments) || segments.length === 0) return node;\n\t\tconst typedSegments = segments;\n\t\tconst firstSegment = typedSegments[0];\n\t\tif (!firstSegment) return node;\n\t\tconst previous = index > 0 ? nodes[index - 1] : null;\n\t\tconst shouldMark = startsWithClosingPunctuation(firstSegment.text) && shouldPreventBreakBeforeNode(previous);\n\t\tif (shouldMark === (firstSegment.noBreakBefore === true)) return node;\n\t\tconst nextSegments = [shouldMark ? {\n\t\t\t...firstSegment,\n\t\t\tnoBreakBefore: true\n\t\t} : {\n\t\t\t...firstSegment,\n\t\t\tnoBreakBefore: void 0\n\t\t}, ...typedSegments.slice(1)];\n\t\tchanged = true;\n\t\treturn {\n\t\t\t...node,\n\t\t\tprops: {\n\t\t\t\t...node.props,\n\t\t\t\tsegments: nextSegments\n\t\t\t}\n\t\t};\n\t});\n\treturn changed ? next : nodes;\n}\nfunction shouldPreventBreakBeforeNode(node) {\n\tif (!node) return false;\n\tif (node.type === \"soft-break\" || node.type === \"hard-break\") return false;\n\tif (node.type === \"text\") {\n\t\tconst text = String(node.props[\"text\"] ?? \"\");\n\t\tif (!text || /\\s$/u.test(text)) return false;\n\t}\n\treturn true;\n}\nfunction startsWithClosingPunctuation(value) {\n\tif (!value) return false;\n\tconst [first] = [...value];\n\treturn first != null && CLOSING_PUNCTUATION.has(first);\n}\nconst CLOSING_PUNCTUATION = new Set([\n\t\"]\",\n\t\",\",\n\t\".\",\n\t\"!\",\n\t\"?\",\n\t\";\",\n\t\":\",\n\t\"%\",\n\t\")\",\n\t\"}\",\n\t\">\",\n\t\"\\\"\",\n\t\"'\",\n\t\"、\",\n\t\"。\",\n\t\",\",\n\t\".\",\n\t\"!\",\n\t\"?\",\n\t\":\",\n\t\";\",\n\t\"%\",\n\t\")\",\n\t\"]\",\n\t\"}\",\n\t\"〉\",\n\t\"》\",\n\t\"」\",\n\t\"』\",\n\t\"】\",\n\t\"〕\",\n\t\"〗\"\n]);\nfunction appendText(nodes, text, start, path, segmenter, hasWarnedSegmenterUnavailable) {\n\tif (!text) return {\n\t\twarnings: [],\n\t\thasWarnedSegmenterUnavailable\n\t};\n\tconst segmentation = createSegments(text, start, {\n\t\tsegmenter,\n\t\thasWarnedSegmenterUnavailable\n\t});\n\tnodes.push({\n\t\tpath: `${path}.${nodes.length}`,\n\t\ttype: \"text\",\n\t\trange: {\n\t\t\tstart,\n\t\t\tend: start + text.length\n\t\t},\n\t\tclosed: true,\n\t\tprops: {\n\t\t\ttext,\n\t\t\tsegments: segmentation.segments\n\t\t},\n\t\tchildren: []\n\t});\n\treturn {\n\t\twarnings: segmentation.warning ? [segmentation.warning] : [],\n\t\thasWarnedSegmenterUnavailable: segmentation.hasWarnedSegmenterUnavailable\n\t};\n}\nfunction parseCitationInline(text, at, start, path, citations, index, isComplete) {\n\tif (!text.startsWith(\"[^\", at)) return null;\n\tconst close = text.indexOf(\"]\", at + 2);\n\tif (close >= 0) {\n\t\tconst idRef = text.slice(at + 2, close).trim();\n\t\tif (!idRef) return null;\n\t\tconst numbered = assignCitationNumber(citations, idRef);\n\t\treturn {\n\t\t\tnode: {\n\t\t\t\tpath: `${path}.${index}`,\n\t\t\t\ttype: \"citation\",\n\t\t\t\trange: {\n\t\t\t\t\tstart: start + at,\n\t\t\t\t\tend: start + close + 1\n\t\t\t\t},\n\t\t\t\tclosed: true,\n\t\t\t\tprops: {\n\t\t\t\t\tidRef,\n\t\t\t\t\tnumber: numbered.number\n\t\t\t\t},\n\t\t\t\tchildren: []\n\t\t\t},\n\t\t\tnext: close + 1,\n\t\t\tcitations: numbered.citations\n\t\t};\n\t}\n\tif (isComplete) return null;\n\tconst partial = text.slice(at);\n\tif (!/^\\[\\^[^\\]\\s]+$/u.test(partial)) return null;\n\tconst partialIdRef = partial.slice(2);\n\treturn {\n\t\tnode: {\n\t\t\tpath: `${path}.${index}`,\n\t\t\ttype: \"citation\",\n\t\t\trange: {\n\t\t\t\tstart: start + at,\n\t\t\t\tend: start + text.length\n\t\t\t},\n\t\t\tclosed: false,\n\t\t\tprops: { idRef: partialIdRef },\n\t\t\tchildren: []\n\t\t},\n\t\tnext: text.length,\n\t\tcitations\n\t};\n}\nfunction parseImageInline(text, at, start, path, index) {\n\tif (!text.startsWith(\"![\", at)) return null;\n\tconst labelEnd = findClosing(text, at + 1, \"[\", \"]\");\n\tif (labelEnd < 0 || text[labelEnd + 1] !== \"(\") return null;\n\tconst destEnd = findClosing(text, labelEnd + 1, \"(\", \")\");\n\tif (destEnd < 0) return null;\n\tconst alt = text.slice(at + 2, labelEnd);\n\tconst parsed = parseLinkDestination(text.slice(labelEnd + 2, destEnd));\n\treturn {\n\t\tnode: {\n\t\t\tpath: `${path}.${index}`,\n\t\t\ttype: \"image\",\n\t\t\trange: {\n\t\t\t\tstart: start + at,\n\t\t\t\tend: start + destEnd + 1\n\t\t\t},\n\t\t\tclosed: true,\n\t\t\tprops: {\n\t\t\t\turl: parsed.url,\n\t\t\t\talt,\n\t\t\t\t...parsed.title ? { title: parsed.title } : {}\n\t\t\t},\n\t\t\tchildren: []\n\t\t},\n\t\tnext: destEnd + 1\n\t};\n}\nfunction parseLinkInline(text, at, start, path, index, context, citations, warnings, hasWarnedSegmenterUnavailable) {\n\tif (text[at] !== \"[\" || text.startsWith(\"[^\", at)) return null;\n\tconst labelEnd = findClosing(text, at, \"[\", \"]\");\n\tif (labelEnd < 0 || text[labelEnd + 1] !== \"(\") return null;\n\tconst destEnd = findClosing(text, labelEnd + 1, \"(\", \")\");\n\tif (destEnd < 0) return null;\n\tconst label = text.slice(at + 1, labelEnd);\n\tconst parsed = parseLinkDestination(text.slice(labelEnd + 2, destEnd));\n\tconst childResult = parseInline(label, start + at + 1, `${path}.${index}`, {\n\t\t...context,\n\t\tcitations,\n\t\twarnings,\n\t\thasWarnedSegmenterUnavailable\n\t});\n\treturn {\n\t\tnode: {\n\t\t\tpath: `${path}.${index}`,\n\t\t\ttype: \"link\",\n\t\t\trange: {\n\t\t\t\tstart: start + at,\n\t\t\t\tend: start + destEnd + 1\n\t\t\t},\n\t\t\tclosed: true,\n\t\t\tprops: {\n\t\t\t\turl: parsed.url,\n\t\t\t\t...parsed.title ? { title: parsed.title } : {}\n\t\t\t},\n\t\t\tchildren: childResult.value\n\t\t},\n\t\tnext: destEnd + 1,\n\t\tcitations: childResult.citations,\n\t\twarnings: childResult.warnings,\n\t\thasWarnedSegmenterUnavailable: childResult.hasWarnedSegmenterUnavailable\n\t};\n}\nfunction parseAutolinkInline(text, at, start, path, enabled, index) {\n\tif (!enabled) return null;\n\tif (text[at] === \"<\") {\n\t\tconst close = text.indexOf(\">\", at + 1);\n\t\tif (close > at + 1) {\n\t\t\tconst value = text.slice(at + 1, close).trim();\n\t\t\tif (isUrl(value) || isEmail(value)) {\n\t\t\t\tconst url = isEmail(value) ? `mailto:${value}` : value;\n\t\t\t\treturn {\n\t\t\t\t\tnode: {\n\t\t\t\t\t\tpath: `${path}.${index}`,\n\t\t\t\t\t\ttype: \"autolink\",\n\t\t\t\t\t\trange: {\n\t\t\t\t\t\t\tstart: start + at,\n\t\t\t\t\t\t\tend: start + close + 1\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclosed: true,\n\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\ttext: value\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: []\n\t\t\t\t\t},\n\t\t\t\t\tnext: close + 1\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\tif (!(at === 0 || /\\s|[([{\"'`]/.test(text[at - 1]))) return null;\n\tconst match = /^(https?:\\/\\/\\S+|www\\.\\S+|[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})/.exec(text.slice(at));\n\tif (!match) return null;\n\tconst raw = trimAutolinkTrailingPunctuation(match[1]);\n\tif (!raw) return null;\n\tconst url = isEmail(raw) ? `mailto:${raw}` : raw.startsWith(\"www.\") ? `https://${raw}` : raw;\n\treturn {\n\t\tnode: {\n\t\t\tpath: `${path}.${index}`,\n\t\t\ttype: \"autolink\",\n\t\t\trange: {\n\t\t\t\tstart: start + at,\n\t\t\t\tend: start + at + raw.length\n\t\t\t},\n\t\t\tclosed: true,\n\t\t\tprops: {\n\t\t\t\turl,\n\t\t\t\ttext: raw\n\t\t\t},\n\t\t\tchildren: []\n\t\t},\n\t\tnext: at + raw.length\n\t};\n}\nfunction parseInlineCode(text, at, start, path, index) {\n\tif (text[at] !== \"`\") return null;\n\tlet len = 1;\n\twhile (text[at + len] === \"`\") len += 1;\n\tconst delimiter = \"`\".repeat(len);\n\tconst close = text.indexOf(delimiter, at + len);\n\tif (close < 0) return {\n\t\tnode: {\n\t\t\tpath: `${path}.${index}`,\n\t\t\ttype: \"inline-code\",\n\t\t\trange: {\n\t\t\t\tstart: start + at,\n\t\t\t\tend: start + text.length\n\t\t\t},\n\t\t\tclosed: false,\n\t\t\tprops: { text: text.slice(at + len) },\n\t\t\tchildren: []\n\t\t},\n\t\tnext: text.length\n\t};\n\treturn {\n\t\tnode: {\n\t\t\tpath: `${path}.${index}`,\n\t\t\ttype: \"inline-code\",\n\t\t\trange: {\n\t\t\t\tstart: start + at,\n\t\t\t\tend: start + close + len\n\t\t\t},\n\t\t\tclosed: true,\n\t\t\tprops: { text: text.slice(at + len, close) },\n\t\t\tchildren: []\n\t\t},\n\t\tnext: close + len\n\t};\n}\nfunction parseDelimitedInline(text, at, delimiter, type, start, path, index, context, citations, warnings, hasWarnedSegmenterUnavailable) {\n\tif (!text.startsWith(delimiter, at)) return null;\n\tconst close = text.indexOf(delimiter, at + delimiter.length);\n\tif (close < 0) {\n\t\tconst children = parseInline(text.slice(at + delimiter.length), start + at + delimiter.length, `${path}.${index}`, {\n\t\t\t...context,\n\t\t\tcitations,\n\t\t\twarnings,\n\t\t\thasWarnedSegmenterUnavailable\n\t\t});\n\t\treturn {\n\t\t\tnode: {\n\t\t\t\tpath: `${path}.${index}`,\n\t\t\t\ttype,\n\t\t\t\trange: {\n\t\t\t\t\tstart: start + at,\n\t\t\t\t\tend: start + text.length\n\t\t\t\t},\n\t\t\t\tclosed: false,\n\t\t\t\tprops: {},\n\t\t\t\tchildren: children.value\n\t\t\t},\n\t\t\tnext: text.length,\n\t\t\tcitations: children.citations,\n\t\t\twarnings: children.warnings,\n\t\t\thasWarnedSegmenterUnavailable: children.hasWarnedSegmenterUnavailable\n\t\t};\n\t}\n\tconst children = parseInline(text.slice(at + delimiter.length, close), start + at + delimiter.length, `${path}.${index}`, {\n\t\t...context,\n\t\tcitations,\n\t\twarnings,\n\t\thasWarnedSegmenterUnavailable\n\t});\n\treturn {\n\t\tnode: {\n\t\t\tpath: `${path}.${index}`,\n\t\t\ttype,\n\t\t\trange: {\n\t\t\t\tstart: start + at,\n\t\t\t\tend: start + close + delimiter.length\n\t\t\t},\n\t\t\tclosed: true,\n\t\t\tprops: {},\n\t\t\tchildren: children.value\n\t\t},\n\t\tnext: close + delimiter.length,\n\t\tcitations: children.citations,\n\t\twarnings: children.warnings,\n\t\thasWarnedSegmenterUnavailable: children.hasWarnedSegmenterUnavailable\n\t};\n}\n\n//#endregion\n//#region src/parser/block-parser.ts\n/**\n* Parses a contiguous range of source lines into block-level draft nodes.\n*\n* @param lines - Line-split source with offsets.\n* @param from - Inclusive start line index.\n* @param to - Exclusive end line index.\n* @param path - Stable path prefix for emitted nodes.\n* @param context - Shared parse context carrying options, warnings, and citations.\n* @param isRoot - Whether this parse call is for the document root.\n* @returns Root draft node plus updated immutable parse context.\n*/\nfunction parseBlocks(lines, from, to, path, context, isRoot) {\n\tlet root = {\n\t\tpath,\n\t\ttype: \"document\",\n\t\trange: {\n\t\t\tstart: from < to ? lines[from].start : 0,\n\t\t\tend: from < to ? lines[to - 1].end : 0\n\t\t},\n\t\tclosed: false,\n\t\tprops: {},\n\t\tchildren: []\n\t};\n\tlet i = from;\n\tlet citations = context.citations;\n\tlet warnings = context.warnings;\n\tlet hasWarnedSegmenterUnavailable = context.hasWarnedSegmenterUnavailable;\n\twhile (i < to) {\n\t\tconst line = lines[i];\n\t\tconst isCitationDefinition = isCitationDefinitionLine(line.text);\n\t\tconst isCitationDefinitionPrefix = isCitationDefinitionPrefixCandidate(line.text, line.hasNewline, context.isComplete);\n\t\tif (isBlank(line.text) || isCitationDefinition || isCitationDefinitionPrefix) {\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst fenced = matchFenceOpen(line.text);\n\t\tif (fenced) {\n\t\t\tconst nodePath = `${path}.${root.children.length}`;\n\t\t\tconst parsed = parseCodeFence(lines, i, to, nodePath, context, fenced);\n\t\t\troot.children = [...root.children, parsed.node];\n\t\t\ti = parsed.next;\n\t\t\tcontinue;\n\t\t}\n\t\tif (isBlockquoteLine(line.text)) {\n\t\t\tconst nodePath = `${path}.${root.children.length}`;\n\t\t\tconst parsed = parseBlockquote(lines, i, to, nodePath, {\n\t\t\t\t...context,\n\t\t\t\tcitations,\n\t\t\t\twarnings,\n\t\t\t\thasWarnedSegmenterUnavailable\n\t\t\t});\n\t\t\troot.children = [...root.children, parsed.value];\n\t\t\ti = parsed.next;\n\t\t\tcitations = parsed.citations;\n\t\t\twarnings = parsed.warnings;\n\t\t\thasWarnedSegmenterUnavailable = parsed.hasWarnedSegmenterUnavailable;\n\t\t\tcontinue;\n\t\t}\n\t\tconst listMarker = matchListItem(line.text);\n\t\tif (listMarker) {\n\t\t\tconst nodePath = `${path}.${root.children.length}`;\n\t\t\tconst parsed = parseList(lines, i, to, nodePath, {\n\t\t\t\t...context,\n\t\t\t\tcitations,\n\t\t\t\twarnings,\n\t\t\t\thasWarnedSegmenterUnavailable\n\t\t\t}, listMarker.ordered);\n\t\t\troot.children = [...root.children, parsed.value];\n\t\t\ti = parsed.next;\n\t\t\tcitations = parsed.citations;\n\t\t\twarnings = parsed.warnings;\n\t\t\thasWarnedSegmenterUnavailable = parsed.hasWarnedSegmenterUnavailable;\n\t\t\tcontinue;\n\t\t}\n\t\tconst heading = matchAtxHeading(line.text);\n\t\tif (heading) {\n\t\t\tconst nodePath = `${path}.${root.children.length}`;\n\t\t\tconst children = parseInline(heading.text, line.start + heading.contentOffset, nodePath, {\n\t\t\t\t...context,\n\t\t\t\tcitations,\n\t\t\t\twarnings,\n\t\t\t\thasWarnedSegmenterUnavailable\n\t\t\t});\n\t\t\troot.children = [...root.children, {\n\t\t\t\tpath: nodePath,\n\t\t\t\ttype: \"heading\",\n\t\t\t\trange: {\n\t\t\t\t\tstart: line.start,\n\t\t\t\t\tend: line.end\n\t\t\t\t},\n\t\t\t\tclosed: context.isComplete || line.hasNewline,\n\t\t\t\tprops: { level: heading.level },\n\t\t\t\tchildren: children.value\n\t\t\t}];\n\t\t\tcitations = children.citations;\n\t\t\twarnings = children.warnings;\n\t\t\thasWarnedSegmenterUnavailable = children.hasWarnedSegmenterUnavailable;\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (i + 1 < to && isSetextUnderline(lines[i + 1].text) && !isBlank(line.text)) {\n\t\t\tconst nodePath = `${path}.${root.children.length}`;\n\t\t\tconst level = lines[i + 1].text.trim().startsWith(\"=\") ? 1 : 2;\n\t\t\tconst children = parseInline(line.text, line.start, nodePath, {\n\t\t\t\t...context,\n\t\t\t\tcitations,\n\t\t\t\twarnings,\n\t\t\t\thasWarnedSegmenterUnavailable\n\t\t\t});\n\t\t\troot.children = [...root.children, {\n\t\t\t\tpath: nodePath,\n\t\t\t\ttype: \"heading\",\n\t\t\t\trange: {\n\t\t\t\t\tstart: line.start,\n\t\t\t\t\tend: lines[i + 1].end\n\t\t\t\t},\n\t\t\t\tclosed: context.isComplete || lines[i + 1].hasNewline,\n\t\t\t\tprops: { level },\n\t\t\t\tchildren: children.value\n\t\t\t}];\n\t\t\tcitations = children.citations;\n\t\t\twarnings = children.warnings;\n\t\t\thasWarnedSegmenterUnavailable = children.hasWarnedSegmenterUnavailable;\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (isThematicBreak(line.text)) {\n\t\t\troot.children = [...root.children, {\n\t\t\t\tpath: `${path}.${root.children.length}`,\n\t\t\t\ttype: \"thematic-break\",\n\t\t\t\trange: {\n\t\t\t\t\tstart: line.start,\n\t\t\t\t\tend: line.end\n\t\t\t\t},\n\t\t\t\tclosed: true,\n\t\t\t\tprops: {},\n\t\t\t\tchildren: []\n\t\t\t}];\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (context.options.enableTables && i + 1 < to && isPipeTableHeader(lines[i], lines[i + 1])) {\n\t\t\tconst nodePath = `${path}.${root.children.length}`;\n\t\t\tconst parsed = parsePipeTable(lines, i, to, nodePath, {\n\t\t\t\t...context,\n\t\t\t\tcitations,\n\t\t\t\twarnings,\n\t\t\t\thasWarnedSegmenterUnavailable\n\t\t\t});\n\t\t\troot.children = [...root.children, parsed.value];\n\t\t\ti = parsed.next;\n\t\t\tcitations = parsed.citations;\n\t\t\twarnings = parsed.warnings;\n\t\t\thasWarnedSegmenterUnavailable = parsed.hasWarnedSegmenterUnavailable;\n\t\t\tcontinue;\n\t\t}\n\t\tconst nodePath = `${path}.${root.children.length}`;\n\t\tconst parsed = parseParagraph(lines, i, to, nodePath, {\n\t\t\t...context,\n\t\t\tcitations,\n\t\t\twarnings,\n\t\t\thasWarnedSegmenterUnavailable\n\t\t});\n\t\troot.children = [...root.children, parsed.value];\n\t\ti = parsed.next;\n\t\tcitations = parsed.citations;\n\t\twarnings = parsed.warnings;\n\t\thasWarnedSegmenterUnavailable = parsed.hasWarnedSegmenterUnavailable;\n\t}\n\troot = {\n\t\t...root,\n\t\tclosed: !isRoot || context.isComplete || to > from && lines[to - 1].hasNewline && root.children.every((child) => child.closed)\n\t};\n\treturn {\n\t\tvalue: root,\n\t\tcitations,\n\t\twarnings,\n\t\thasWarnedSegmenterUnavailable\n\t};\n}\nfunction parseCodeFence(lines, from, to, path, context, fenceOpen) {\n\tlet i = from + 1;\n\tlet closeLine = -1;\n\twhile (i < to) {\n\t\tif (matchFenceClose(lines[i].text, fenceOpen.marker, fenceOpen.length)) {\n\t\t\tcloseLine = i;\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t}\n\tconst endLine = closeLine >= 0 ? closeLine : to - 1;\n\tconst text = lines.slice(from + 1, closeLine >= 0 ? closeLine : to).map((line) => line.text).join(\"\\n\");\n\tconst closed = closeLine >= 0 || context.isComplete;\n\treturn {\n\t\tnode: {\n\t\t\tpath,\n\t\t\ttype: \"code-block\",\n\t\t\trange: {\n\t\t\t\tstart: lines[from].start,\n\t\t\t\tend: lines[endLine].end\n\t\t\t},\n\t\t\tclosed,\n\t\t\tprops: {\n\t\t\t\tfence: fenceOpen.marker,\n\t\t\t\t...fenceOpen.info ? { info: fenceOpen.info.split(/\\s+/)[0] } : {},\n\t\t\t\t...fenceOpen.info.includes(\" \") ? { meta: fenceOpen.info.slice(fenceOpen.info.indexOf(\" \") + 1) } : {},\n\t\t\t\ttext\n\t\t\t},\n\t\t\tchildren: []\n\t\t},\n\t\tnext: closeLine >= 0 ? closeLine + 1 : to\n\t};\n}\nfunction parseBlockquote(lines, from, to, path, context) {\n\tconst picked = [];\n\tlet i = from;\n\twhile (i < to) {\n\t\tconst line = lines[i];\n\t\tif (isBlank(line.text) && picked.length > 0) {\n\t\t\tpicked.push(line);\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (isBlockquoteLine(line.text) || !isBlank(line.text) && picked.length > 0 && !startsNewBlock(lines, i, context.options.enableTables)) {\n\t\t\tpicked.push(line);\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tconst stripped = picked.map((line) => {\n\t\tconst marker = /^(\\s{0,3}>\\s?)/.exec(line.text);\n\t\tconst markerWidth = marker?.[1].length ?? 0;\n\t\tconst text = marker ? line.text.slice(markerWidth) : line.text;\n\t\tconst start = line.start + markerWidth;\n\t\treturn {\n\t\t\ttext,\n\t\t\tstart,\n\t\t\tend: start + text.length,\n\t\t\thasNewline: line.hasNewline\n\t\t};\n\t});\n\tconst children = parseBlocks(stripped, 0, stripped.length, path, context, false);\n\treturn {\n\t\tvalue: {\n\t\t\tpath,\n\t\t\ttype: \"blockquote\",\n\t\t\trange: {\n\t\t\t\tstart: picked[0].start,\n\t\t\t\tend: picked[picked.length - 1].end\n\t\t\t},\n\t\t\tclosed: context.isComplete || picked[picked.length - 1].hasNewline,\n\t\t\tprops: {},\n\t\t\tchildren: children.value.children\n\t\t},\n\t\tnext: i,\n\t\tcitations: children.citations,\n\t\twarnings: children.warnings,\n\t\thasWarnedSegmenterUnavailable: children.hasWarnedSegmenterUnavailable\n\t};\n}\nfunction parseList(lines, from, to, path, context, ordered) {\n\tconst items = [];\n\tlet i = from;\n\tlet sawBlankBetweenItems = false;\n\tlet listStartNumber = null;\n\tlet citations = context.citations;\n\tlet warnings = context.warnings;\n\tlet hasWarnedSegmenterUnavailable = context.hasWarnedSegmenterUnavailable;\n\twhile (i < to) {\n\t\tconst marker = matchListItem(lines[i].text);\n\t\tif (!marker || marker.ordered !== ordered) break;\n\t\tif (ordered && listStartNumber === null) listStartNumber = marker.start;\n\t\tconst contentLines = [{\n\t\t\t...lines[i],\n\t\t\ttext: marker.content\n\t\t}];\n\t\tconst contentIndent = marker.contentIndent;\n\t\ti += 1;\n\t\tlet hadBlank = false;\n\t\twhile (i < to) {\n\t\t\tconst next = lines[i];\n\t\t\tif (matchListItem(next.text)) break;\n\t\t\tif (isBlank(next.text)) {\n\t\t\t\thadBlank = true;\n\t\t\t\tcontentLines.push(next);\n\t\t\t\ti += 1;\n\t\t\t\tif (i < to) {\n\t\t\t\t\tif (matchListItem(lines[i].text)) {\n\t\t\t\t\t\tsawBlankBetweenItems = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ((/^\\s*/.exec(next.text)?.[0].length ?? 0) < contentIndent) break;\n\t\t\tconst continuation = next.text.slice(contentIndent);\n\t\t\tcontentLines.push({\n\t\t\t\t...next,\n\t\t\t\ttext: continuation\n\t\t\t});\n\t\t\ti += 1;\n\t\t}\n\t\tconst paragraphText = contentLines.map((line) => line.text).join(\"\\n\").trimEnd();\n\t\tconst itemPath = `${path}.${items.length}`;\n\t\tconst parsedInline = parseInline(paragraphText, contentLines[0].start, `${itemPath}.0`, {\n\t\t\t...context,\n\t\t\tcitations,\n\t\t\twarnings,\n\t\t\thasWarnedSegmenterUnavailable\n\t\t});\n\t\tconst paragraph = {\n\t\t\tpath: `${itemPath}.0`,\n\t\t\ttype: \"paragraph\",\n\t\t\trange: {\n\t\t\t\tstart: contentLines[0].start,\n\t\t\t\tend: contentLines[contentLines.length - 1].end\n\t\t\t},\n\t\t\tclosed: context.isComplete || contentLines[contentLines.length - 1].hasNewline,\n\t\t\tprops: {},\n\t\t\tchildren: parsedInline.value\n\t\t};\n\t\titems.push({\n\t\t\tpath: itemPath,\n\t\t\ttype: \"list-item\",\n\t\t\trange: {\n\t\t\t\tstart: contentLines[0].start,\n\t\t\t\tend: contentLines[contentLines.length - 1].end\n\t\t\t},\n\t\t\tclosed: context.isComplete || contentLines[contentLines.length - 1].hasNewline,\n\t\t\tprops: {},\n\t\t\tchildren: [paragraph]\n\t\t});\n\t\tcitations = parsedInline.citations;\n\t\twarnings = parsedInline.warnings;\n\t\thasWarnedSegmenterUnavailable = parsedInline.hasWarnedSegmenterUnavailable;\n\t\tif (hadBlank) sawBlankBetweenItems = true;\n\t}\n\treturn {\n\t\tvalue: {\n\t\t\tpath,\n\t\t\ttype: \"list\",\n\t\t\trange: {\n\t\t\t\tstart: lines[from].start,\n\t\t\t\tend: lines[Math.max(from, i - 1)].end\n\t\t\t},\n\t\t\tclosed: context.isComplete || lines[Math.max(from, i - 1)].hasNewline,\n\t\t\tprops: {\n\t\t\t\tordered,\n\t\t\t\tstart: ordered ? listStartNumber ?? 1 : null,\n\t\t\t\ttight: !sawBlankBetweenItems\n\t\t\t},\n\t\t\tchildren: items\n\t\t},\n\t\tnext: i,\n\t\tcitations,\n\t\twarnings,\n\t\thasWarnedSegmenterUnavailable\n\t};\n}\nfunction parsePipeTable(lines, from, to, path, context) {\n\tconst header = splitTableCells(lines[from].text);\n\tconst align = parseTableAlignment(splitTableCells(lines[from + 1].text));\n\tconst rows = [];\n\tlet i = from + 2;\n\twhile (i < to && looksLikeTableRow(lines[i].text)) {\n\t\trows.push(splitTableCells(lines[i].text));\n\t\ti += 1;\n\t}\n\tlet citations = context.citations;\n\tlet warnings = context.warnings;\n\tlet hasWarnedSegmenterUnavailable = context.hasWarnedSegmenterUnavailable;\n\tconst headerChildren = [];\n\tfor (let cellIndex = 0; cellIndex < header.length; cellIndex += 1) {\n\t\tconst parsed = parseInline(header[cellIndex], lines[from].start, `${path}.0.${cellIndex}`, {\n\t\t\t...context,\n\t\t\tcitations,\n\t\t\twarnings,\n\t\t\thasWarnedSegmenterUnavailable\n\t\t});\n\t\theaderChildren.push({\n\t\t\tpath: `${path}.0.${cellIndex}`,\n\t\t\ttype: \"table-cell\",\n\t\t\trange: {\n\t\t\t\tstart: lines[from].start,\n\t\t\t\tend: lines[from].end\n\t\t\t},\n\t\t\tclosed: true,\n\t\t\tprops: {},\n\t\t\tchildren: parsed.value\n\t\t});\n\t\tcitations = parsed.citations;\n\t\twarnings = parsed.warnings;\n\t\thasWarnedSegmenterUnavailable = parsed.hasWarnedSegmenterUnavailable;\n\t}\n\tconst headerRow = {\n\t\tpath: `${path}.0`,\n\t\ttype: \"table-row\",\n\t\trange: {\n\t\t\tstart: lines[from].start,\n\t\t\tend: lines[from].end\n\t\t},\n\t\tclosed: true,\n\t\tprops: { isHeader: true },\n\t\tchildren: headerChildren\n\t};\n\tconst bodyRows = [];\n\tfor (let rowIndex = 0; rowIndex < rows.length; rowIndex += 1) {\n\t\tconst row = rows[rowIndex];\n\t\tconst cellNodes = [];\n\t\tfor (let cellIndex = 0; cellIndex < row.length; cellIndex += 1) {\n\t\t\tconst parsed = parseInline(row[cellIndex], lines[from + 2 + rowIndex].start, `${path}.${rowIndex + 1}.${cellIndex}`, {\n\t\t\t\t...context,\n\t\t\t\tcitations,\n\t\t\t\twarnings,\n\t\t\t\thasWarnedSegmenterUnavailable\n\t\t\t});\n\t\t\tcellNodes.push({\n\t\t\t\tpath: `${path}.${rowIndex + 1}.${cellIndex}`,\n\t\t\t\ttype: \"table-cell\",\n\t\t\t\trange: {\n\t\t\t\t\tstart: lines[from + 2 + rowIndex].start,\n\t\t\t\t\tend: lines[from + 2 + rowIndex].end\n\t\t\t\t},\n\t\t\t\tclosed: true,\n\t\t\t\tprops: {},\n\t\t\t\tchildren: parsed.value\n\t\t\t});\n\t\t\tcitations = parsed.citations;\n\t\t\twarnings = parsed.warnings;\n\t\t\thasWarnedSegmenterUnavailable = parsed.hasWarnedSegmenterUnavailable;\n\t\t}\n\t\tbodyRows.push({\n\t\t\tpath: `${path}.${rowIndex + 1}`,\n\t\t\ttype: \"table-row\",\n\t\t\trange: {\n\t\t\t\tstart: lines[from + 2 + rowIndex].start,\n\t\t\t\tend: lines[from + 2 + rowIndex].end\n\t\t\t},\n\t\t\tclosed: true,\n\t\t\tprops: { isHeader: false },\n\t\t\tchildren: cellNodes\n\t\t});\n\t}\n\treturn {\n\t\tvalue: {\n\t\t\tpath,\n\t\t\ttype: \"table\",\n\t\t\trange: {\n\t\t\t\tstart: lines[from].start,\n\t\t\t\tend: lines[i - 1].end\n\t\t\t},\n\t\t\tclosed: context.isComplete || lines[i - 1].hasNewline,\n\t\t\tprops: { align },\n\t\t\tchildren: [headerRow, ...bodyRows]\n\t\t},\n\t\tnext: i,\n\t\tcitations,\n\t\twarnings,\n\t\thasWarnedSegmenterUnavailable\n\t};\n}\nfunction parseParagraph(lines, from, to, path, context) {\n\tconst picked = [];\n\tlet i = from;\n\twhile (i < to) {\n\t\tif (isBlank(lines[i].text)) break;\n\t\tif (picked.length > 0 && startsNewBlock(lines, i, context.options.enableTables)) break;\n\t\tif (isCitationDefinitionLine(lines[i].text) || isCitationDefinitionPrefixCandidate(lines[i].text, lines[i].hasNewline, context.isComplete)) break;\n\t\tpicked.push(lines[i]);\n\t\ti += 1;\n\t}\n\tconst children = parseInline(picked.map((line) => line.text).join(\"\\n\"), picked[0].start, path, context);\n\treturn {\n\t\tvalue: {\n\t\t\tpath,\n\t\t\ttype: \"paragraph\",\n\t\t\trange: {\n\t\t\t\tstart: picked[0].start,\n\t\t\t\tend: picked[picked.length - 1].end\n\t\t\t},\n\t\t\tclosed: context.isComplete || picked[picked.length - 1].hasNewline,\n\t\t\tprops: {},\n\t\t\tchildren: children.value\n\t\t},\n\t\tnext: i,\n\t\tcitations: children.citations,\n\t\twarnings: children.warnings,\n\t\thasWarnedSegmenterUnavailable: children.hasWarnedSegmenterUnavailable\n\t};\n}\n\n//#endregion\n//#region src/parser/ops.ts\n/**\n* Flattens a draft tree into reducer operations.\n*\n* @param root - Draft AST root.\n* @returns Ordered operations for reducer application.\n*/\nfunction createAstOpsFromDraft(root) {\n\tconst ops = [];\n\tfunction visit(node, parentPath) {\n\t\tconst childPaths = node.children.map((child, index) => `${node.path}.${index}`);\n\t\tops.push({\n\t\t\tkind: \"upsert-node\",\n\t\t\tpath: node.path,\n\t\t\tparentPath,\n\t\t\ttype: node.type,\n\t\t\trange: node.range,\n\t\t\tclosed: node.closed,\n\t\t\tprops: node.props,\n\t\t\tchildPaths\n\t\t});\n\t\tfor (let index = 0; index < node.children.length; index += 1) {\n\t\t\tconst child = node.children[index];\n\t\t\tvisit({\n\t\t\t\t...child,\n\t\t\t\tpath: `${node.path}.${index}`\n\t\t\t}, node.path);\n\t\t}\n\t}\n\tvisit(root, null);\n\treturn ops;\n}\n/**\n* Applies AST ops with identity reuse for unchanged nodes.\n*\n* @param input - Previous parser state fragments and ops to apply.\n* @returns Next materialized state fragments.\n*/\nfunction applyAstOps(input) {\n\tconst previousNodeById = new Map(input.previousNodes.map((node) => [node.id, node]));\n\tconst nodeOps = input.ops.filter((op) => op.kind === \"upsert-node\");\n\tconst pathToId = {};\n\tlet nextId = input.nextId;\n\tfor (const op of nodeOps) {\n\t\tconst id = input.previousPathToId[op.path] ?? nextId++;\n\t\tpathToId[op.path] = id;\n\t}\n\tconst nodesById = /* @__PURE__ */ new Map();\n\tfor (const op of nodeOps) {\n\t\tconst id = pathToId[op.path];\n\t\tconst materialized = opToAstNode(op, id, op.parentPath ? pathToId[op.parentPath] : null, op.childPaths.map((childPath) => pathToId[childPath]));\n\t\tconst previous = previousNodeById.get(id);\n\t\tconst reconciled = previous?.type === \"text\" && materialized.type === \"text\" ? reconcileTextNode(previous, materialized) : materialized;\n\t\tnodesById.set(id, previous && astNodeEquals(previous, reconciled) ? previous : reconciled);\n\t}\n\tconst rootPath = nodeOps[0]?.path;\n\tif (!rootPath) throw new Error(\"StreamingMarkdown op stream did not include a root node\");\n\tconst warnings = input.ops.find((op) => op.kind === \"set-warnings\")?.warnings ?? [];\n\tconst citations = input.ops.find((op) => op.kind === \"set-citations\")?.citations ?? {\n\t\torder: [],\n\t\tnumbers: {},\n\t\tdefinitions: {}\n\t};\n\tconst hasWarnedSegmenterUnavailable = input.ops.find((op) => op.kind === \"set-segmenter-warning-state\")?.hasWarnedSegmenterUnavailable ?? false;\n\treturn {\n\t\tnodes: Array.from(nodesById.values()).sort((a, b) => a.id - b.id),\n\t\trootId: pathToId[rootPath],\n\t\tnextId,\n\t\tpathToId,\n\t\twarnings,\n\t\tcitations,\n\t\thasWarnedSegmenterUnavailable\n\t};\n}\nfunction opToAstNode(op, id, parentId, children) {\n\tconst base = {\n\t\tid,\n\t\ttype: op.type,\n\t\tparentId,\n\t\tclosed: op.closed,\n\t\trange: op.range\n\t};\n\tswitch (op.type) {\n\t\tcase \"document\": return {\n\t\t\t...base,\n\t\t\ttype: \"document\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"paragraph\": return {\n\t\t\t...base,\n\t\t\ttype: \"paragraph\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"heading\": return {\n\t\t\t...base,\n\t\t\ttype: \"heading\",\n\t\t\tlevel: op.props[\"level\"],\n\t\t\tchildren\n\t\t};\n\t\tcase \"blockquote\": return {\n\t\t\t...base,\n\t\t\ttype: \"blockquote\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"list\": return {\n\t\t\t...base,\n\t\t\ttype: \"list\",\n\t\t\tordered: op.props[\"ordered\"],\n\t\t\tstart: op.props[\"start\"],\n\t\t\ttight: op.props[\"tight\"],\n\t\t\tchildren\n\t\t};\n\t\tcase \"list-item\": return {\n\t\t\t...base,\n\t\t\ttype: \"list-item\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"code-block\": return {\n\t\t\t...base,\n\t\t\ttype: \"code-block\",\n\t\t\tfence: op.props[\"fence\"],\n\t\t\tinfo: op.props[\"info\"],\n\t\t\tmeta: op.props[\"meta\"],\n\t\t\ttext: op.props[\"text\"]\n\t\t};\n\t\tcase \"table\": return {\n\t\t\t...base,\n\t\t\ttype: \"table\",\n\t\t\talign: op.props[\"align\"],\n\t\t\tchildren\n\t\t};\n\t\tcase \"table-row\": return {\n\t\t\t...base,\n\t\t\ttype: \"table-row\",\n\t\t\tisHeader: op.props[\"isHeader\"],\n\t\t\tchildren\n\t\t};\n\t\tcase \"table-cell\": return {\n\t\t\t...base,\n\t\t\ttype: \"table-cell\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"thematic-break\": return {\n\t\t\t...base,\n\t\t\ttype: \"thematic-break\"\n\t\t};\n\t\tcase \"text\": return {\n\t\t\t...base,\n\t\t\ttype: \"text\",\n\t\t\ttext: op.props[\"text\"],\n\t\t\tsegments: op.props[\"segments\"]\n\t\t};\n\t\tcase \"em\": return {\n\t\t\t...base,\n\t\t\ttype: \"em\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"strong\": return {\n\t\t\t...base,\n\t\t\ttype: \"strong\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"strikethrough\": return {\n\t\t\t...base,\n\t\t\ttype: \"strikethrough\",\n\t\t\tchildren\n\t\t};\n\t\tcase \"inline-code\": return {\n\t\t\t...base,\n\t\t\ttype: \"inline-code\",\n\t\t\ttext: op.props[\"text\"]\n\t\t};\n\t\tcase \"soft-break\": return {\n\t\t\t...base,\n\t\t\ttype: \"soft-break\"\n\t\t};\n\t\tcase \"hard-break\": return {\n\t\t\t...base,\n\t\t\ttype: \"hard-break\"\n\t\t};\n\t\tcase \"link\": return {\n\t\t\t...base,\n\t\t\ttype: \"link\",\n\t\t\turl: op.props[\"url\"],\n\t\t\ttitle: op.props[\"title\"],\n\t\t\tchildren\n\t\t};\n\t\tcase \"image\": return {\n\t\t\t...base,\n\t\t\ttype: \"image\",\n\t\t\turl: op.props[\"url\"],\n\t\t\ttitle: op.props[\"title\"],\n\t\t\talt: op.props[\"alt\"]\n\t\t};\n\t\tcase \"autolink\": return {\n\t\t\t...base,\n\t\t\ttype: \"autolink\",\n\t\t\turl: op.props[\"url\"],\n\t\t\ttext: op.props[\"text\"]\n\t\t};\n\t\tcase \"citation\": return {\n\t\t\t...base,\n\t\t\ttype: \"citation\",\n\t\t\tidRef: op.props[\"idRef\"],\n\t\t\tnumber: op.props[\"number\"]\n\t\t};\n\t}\n}\nfunction astNodeEquals(a, b) {\n\treturn JSON.stringify(a) === JSON.stringify(b);\n}\nfunction reconcileTextNode(previous, next) {\n\tif (next.segments.length === 0 || previous.segments.length === 0) return next;\n\tconst previousBySignature = groupSegmentsBySignature(previous.segments);\n\tlet reusedAnySegment = false;\n\tconst segments = next.segments.map((segment) => {\n\t\tconst signature = getSegmentSignature(segment);\n\t\tconst bucket = previousBySignature.get(signature);\n\t\tif (!bucket?.length) return segment;\n\t\tconst [reused, ...rest] = bucket;\n\t\tif (rest.length) previousBySignature.set(signature, rest);\n\t\telse previousBySignature.delete(signature);\n\t\treusedAnySegment = true;\n\t\treturn reused;\n\t});\n\tif (areSegmentArraysIdentical(previous.segments, segments)) return {\n\t\t...next,\n\t\tsegments: previous.segments\n\t};\n\tif (!reusedAnySegment) return next;\n\treturn {\n\t\t...next,\n\t\tsegments\n\t};\n}\n/**\n* Returns true when both arrays contain the same segment object references in order.\n*/\nfunction areSegmentArraysIdentical(a, b) {\n\tif (a.length !== b.length) return false;\n\treturn a.every((segment, index) => segment === b[index]);\n}\n/**\n* Produces a stable signature for matching segments across immutable parse iterations.\n*/\nfunction getSegmentSignature(segment) {\n\treturn `${segment.start}:${segment.end}:${segment.text}:${segment.kind}:${String(segment.isWhitespace)}:${String(segment.noBreakBefore === true)}`;\n}\n/**\n* Groups previous segments by signature to support one-to-one identity reuse.\n*/\nfunction groupSegmentsBySignature(segments) {\n\tconst bySignature = /* @__PURE__ */ new Map();\n\tfor (const segment of segments) {\n\t\tconst signature = getSegmentSignature(segment);\n\t\tconst existing = bySignature.get(signature) ?? [];\n\t\tbySignature.set(signature, [...existing, segment]);\n\t}\n\treturn bySignature;\n}\n\n//#endregion\n//#region src/parser/state.ts\n/**\n* Creates a new streaming markdown parser state.\n*\n* @param options - Optional parser option overrides.\n* @returns New immutable parser state.\n* @public\n*/\nfunction createStreamingMarkdownParserState(options) {\n\treturn {\n\t\tnextId: 2,\n\t\tnodes: [{\n\t\t\tid: 1,\n\t\t\ttype: \"document\",\n\t\t\tparentId: null,\n\t\t\tclosed: false,\n\t\t\trange: {\n\t\t\t\tstart: 0,\n\t\t\t\tend: 0\n\t\t\t},\n\t\t\tchildren: []\n\t\t}],\n\t\trootId: 1,\n\t\tstack: [1],\n\t\tmode: \"block\",\n\t\twarnings: [],\n\t\tcitations: {\n\t\t\torder: [],\n\t\t\tnumbers: {},\n\t\t\tdefinitions: {}\n\t\t},\n\t\tlineBuffer: \"\",\n\t\tisComplete: false,\n\t\tindex: 0,\n\t\tline: 1,\n\t\tcolumn: 1,\n\t\toptions: normalizeOptions(options),\n\t\tsource: \"\",\n\t\tpathToId: { \"0\": 1 },\n\t\tpendingCarriageReturn: false,\n\t\thasWarnedSegmenterUnavailable: false\n\t};\n}\n/**\n* Parses a streaming chunk and returns the next immutable parser state.\n*\n* @param state - Current parser state.\n* @param chunk - Incoming text chunk.\n* @returns Updated parser state.\n* @public\n*/\nfunction parseStreamingMarkdownChunk(state, chunk) {\n\tconst normalized = normalizeChunk(chunk, state.pendingCarriageReturn);\n\treturn rebuildState(state, {\n\t\tsource: state.source + normalized.text,\n\t\tisComplete: false,\n\t\tpendingCarriageReturn: normalized.pendingCarriageReturn\n\t});\n}\n/**\n* Finalizes parsing by closing any provisional nodes and flushing trailing CR.\n*\n* @param state - Current parser state.\n* @returns Final parser state.\n* @public\n*/\nfunction finalizeStreamingMarkdown(state) {\n\tif (state.isComplete) return state;\n\treturn rebuildState(state, {\n\t\tsource: state.source + (state.pendingCarriageReturn ? \"\\n\" : \"\"),\n\t\tisComplete: true,\n\t\tpendingCarriageReturn: false\n\t});\n}\nfunction rebuildState(prev, input) {\n\tconst definitions = parseCitationDefinitions(input.source);\n\tconst parseContext = {\n\t\toptions: prev.options,\n\t\twarnings: definitions.warnings,\n\t\tcitations: definitions.citations,\n\t\tisComplete: input.isComplete,\n\t\thasWarnedSegmenterUnavailable: prev.hasWarnedSegmenterUnavailable\n\t};\n\tconst lines = splitLines(input.source);\n\tconst parsedBlocks = parseBlocks(lines, 0, lines.length, \"0\", parseContext, true);\n\tconst ops = [\n\t\t{\n\t\t\tkind: \"set-warnings\",\n\t\t\twarnings: parsedBlocks.warnings\n\t\t},\n\t\t{\n\t\t\tkind: \"set-citations\",\n\t\t\tcitations: parsedBlocks.citations\n\t\t},\n\t\t{\n\t\t\tkind: \"set-segmenter-warning-state\",\n\t\t\thasWarnedSegmenterUnavailable: parsedBlocks.hasWarnedSegmenterUnavailable\n\t\t},\n\t\t...createAstOpsFromDraft(parsedBlocks.value)\n\t];\n\tconst reduced = applyAstOps({\n\t\tpreviousNodes: prev.nodes,\n\t\tpreviousPathToId: prev.pathToId,\n\t\tnextId: prev.nextId,\n\t\tops\n\t});\n\tconst lineBuffer = getLineBuffer(input.source);\n\tconst { line, column } = toLineColumn(input.source, input.source.length);\n\treturn {\n\t\t...prev,\n\t\tnextId: reduced.nextId,\n\t\tnodes: reduced.nodes,\n\t\trootId: reduced.rootId,\n\t\tstack: computeOpenStack(reduced.nodes, reduced.rootId),\n\t\tmode: inferMode(reduced.nodes, reduced.rootId),\n\t\twarnings: reduced.warnings,\n\t\tcitations: reduced.citations,\n\t\tlineBuffer,\n\t\tisComplete: input.isComplete,\n\t\tindex: input.source.length,\n\t\tline,\n\t\tcolumn,\n\t\tsource: input.source,\n\t\tpathToId: reduced.pathToId,\n\t\tpendingCarriageReturn: input.pendingCarriageReturn,\n\t\thasWarnedSegmenterUnavailable: reduced.hasWarnedSegmenterUnavailable\n\t};\n}\nfunction computeOpenStack(nodes, rootId) {\n\tconst nodeById = new Map(nodes.map((node) => [node.id, node]));\n\tconst stack = [];\n\tlet cursor = rootId;\n\twhile (cursor != null) {\n\t\tconst node = nodeById.get(cursor);\n\t\tif (!node || node.closed) break;\n\t\tstack.push(cursor);\n\t\tif (!(\"children\" in node) || node.children.length === 0) break;\n\t\tconst lastChild = node.children[node.children.length - 1];\n\t\tcursor = typeof lastChild === \"number\" ? lastChild : null;\n\t}\n\treturn stack;\n}\nfunction inferMode(nodes, rootId) {\n\tif (rootId == null) return \"block\";\n\tconst root = nodes.find((node) => node.id === rootId);\n\tif (!root || !(\"children\" in root) || root.children.length === 0) return \"block\";\n\tconst lastChild = nodes.find((node) => node.id === root.children[root.children.length - 1]);\n\tif (!lastChild || lastChild.closed) return \"block\";\n\tif (lastChild.type === \"paragraph\") return \"paragraph\";\n\tif (lastChild.type === \"heading\") return \"heading\";\n\tif (lastChild.type === \"blockquote\") return \"blockquote\";\n\tif (lastChild.type === \"list-item\") return \"list-item\";\n\tif (lastChild.type === \"code-block\") return \"code-fence\";\n\tif (lastChild.type === \"table\") return \"table\";\n\treturn \"block\";\n}\n\n//#endregion\n//#region src/dev-warning.ts\nlet warned = false;\nconst MIGRATION_GUIDE_URL = \"https://docs.copilotkit.ai/migrate/markdown-renderer#migrate-with-your-ai-assistant\";\nconst HIGHLIGHTABLE_CODE = /(^|\\n)[ \\t]*(```|~~~)[ \\t]*[A-Za-z][\\w+#-]*/;\nconst BLOCK_MATH = /\\$\\$[\\s\\S]+?\\$\\$/;\nconst BRACKET_MATH = /\\\\\\[[\\s\\S]+?\\\\\\]/;\nfunction isProduction() {\n\treturn typeof process !== \"undefined\" && process.env != null && process.env.NODE_ENV === \"production\";\n}\n/**\n* Dev-only, once-per-session warning emitted when CopilotKit's built-in default\n* markdown renderer encounters markdown it won't render richly — math\n* (`$$…$$` / `\\[…\\]`) or a language-tagged fenced code block (rendered as plain,\n* un-highlighted code). Helps people upgrading from the bundled Streamdown\n* default notice the behavioral change and points them at the migration guide.\n*\n* No-op in production and after the first warning. Only the built-in default\n* renderers call this — a custom `markdownRenderer` never triggers it.\n*\n* @internal\n*/\nfunction warnUnsupportedRichSyntaxOnce(content) {\n\tif (warned || !content || isProduction()) return;\n\tconst hasMath = BLOCK_MATH.test(content) || BRACKET_MATH.test(content);\n\tconst hasHighlightableCode = HIGHLIGHTABLE_CODE.test(content);\n\tif (!hasMath && !hasHighlightableCode) return;\n\twarned = true;\n\tconst [feature, missing] = hasMath ? [\"math\", \"math typesetting\"] : [\"a syntax-highlighted code block\", \"syntax highlighting\"];\n\tconsole.warn(`[CopilotKit] The built-in markdown renderer rendered ${feature} without ${missing}. It supports GFM, tables, autolinks, and citations, but not math, syntax highlighting, or diagrams. To restore those, plug in a custom markdownRenderer (e.g. react-markdown or streamdown) — or paste the migration prompt into your AI assistant: ${MIGRATION_GUIDE_URL}`);\n}\n\n//#endregion\nexport { createStreamingMarkdownParserState, finalizeStreamingMarkdown, parseStreamingMarkdownChunk, warnUnsupportedRichSyntaxOnce };\n//# sourceMappingURL=index.mjs.map","import { computed, defineComponent, h } from \"vue\";\nimport { createStreamingMarkdownParserState, finalizeStreamingMarkdown, parseStreamingMarkdownChunk } from \"@copilotkit/markdown\";\n\n//#region src/vue/streaming-markdown-renderer.ts\nconst SAFE_HREF = /^(https?:|mailto:|tel:|#|\\/|\\.\\/|\\.\\.\\/)/i;\nconst SAFE_IMG_SRC = /^(https?:|data:image\\/(?!svg)|\\/|\\.\\/|\\.\\.\\/)/i;\nfunction sanitizeHref(href) {\n\tif (!href) return void 0;\n\treturn SAFE_HREF.test(href.trim()) ? href : void 0;\n}\nfunction sanitizeImgSrc(src) {\n\tif (!src) return void 0;\n\treturn SAFE_IMG_SRC.test(src.trim()) ? src : void 0;\n}\nconst DEFAULT_OPTIONS = {\n\tsegmenter: true,\n\tenableTables: true,\n\tenableAutolinks: true\n};\nfunction normalizeOptions(options) {\n\treturn {\n\t\tsegmenter: options?.segmenter ?? DEFAULT_OPTIONS.segmenter,\n\t\tenableTables: options?.enableTables ?? DEFAULT_OPTIONS.enableTables,\n\t\tenableAutolinks: options?.enableAutolinks ?? DEFAULT_OPTIONS.enableAutolinks\n\t};\n}\nfunction buildParserState(content, options, isComplete) {\n\tconst state = createStreamingMarkdownParserState(options);\n\tconst parsed = content.length > 0 ? parseStreamingMarkdownChunk(state, content) : state;\n\treturn isComplete ? finalizeStreamingMarkdown(parsed) : parsed;\n}\nfunction renderTextSegments(node) {\n\tif (node.text.length === 0) return [];\n\tif (node.segments.length === 0) return [h(\"span\", { class: \"cpk-streaming-markdown-segment\" }, node.text)];\n\treturn node.segments.map((segment) => h(\"span\", {\n\t\tclass: \"cpk-streaming-markdown-segment\",\n\t\t\"data-streaming-markdown-segment-kind\": segment.kind,\n\t\t\"data-streaming-markdown-whitespace\": String(segment.isWhitespace)\n\t}, segment.noBreakBefore ? `${segment.text}` : segment.text));\n}\nfunction renderChildren(childIds, nodeById, nodeRenderers) {\n\treturn childIds.map((id) => {\n\t\tconst child = nodeById.get(id);\n\t\treturn child ? renderNode(child, nodeById, nodeRenderers) : null;\n\t});\n}\nfunction renderNode(node, nodeById, nodeRenderers) {\n\tfunction withOverride(key, defaultVNode) {\n\t\tconst override = nodeRenderers?.[key];\n\t\treturn override ? override(node, defaultVNode) : defaultVNode;\n\t}\n\tswitch (node.type) {\n\t\tcase \"document\": return h(\"span\", { style: \"display:contents\" }, renderChildren(node.children, nodeById, nodeRenderers));\n\t\tcase \"paragraph\": return withOverride(\"paragraph\", h(\"p\", {\n\t\t\t\"data-streaming-markdown-node\": \"paragraph\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"heading\": return withOverride(\"heading\", h(`h${node.level}`, {\n\t\t\t\"data-streaming-markdown-node\": \"heading\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"blockquote\": return withOverride(\"blockquote\", h(\"blockquote\", {\n\t\t\t\"data-streaming-markdown-node\": \"blockquote\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"list\": {\n\t\t\tconst tag = node.ordered ? \"ol\" : \"ul\";\n\t\t\tconst attrs = {\n\t\t\t\t\"data-streaming-markdown-node\": \"list\",\n\t\t\t\t\"data-node-open\": String(!node.closed),\n\t\t\t\t\"data-list-tight\": String(node.tight)\n\t\t\t};\n\t\t\tif (node.ordered && node.start != null) attrs.start = node.start;\n\t\t\treturn withOverride(\"list\", h(tag, attrs, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\t}\n\t\tcase \"list-item\": return withOverride(\"listItem\", h(\"li\", {\n\t\t\t\"data-streaming-markdown-node\": \"list-item\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"code-block\": return withOverride(\"codeBlock\", h(\"pre\", {\n\t\t\t\"data-streaming-markdown-node\": \"code-block\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, [h(\"code\", { \"data-code-info\": node.info ?? void 0 }, node.text)]));\n\t\tcase \"table\": return withOverride(\"table\", h(\"table\", {\n\t\t\t\"data-streaming-markdown-node\": \"table\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, [h(\"tbody\", renderChildren(node.children, nodeById, nodeRenderers))]));\n\t\tcase \"table-row\": return withOverride(\"tableRow\", h(\"tr\", {\n\t\t\t\"data-streaming-markdown-node\": \"table-row\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"table-cell\": {\n\t\t\tconst parent = node.parentId != null ? nodeById.get(node.parentId) : void 0;\n\t\t\treturn withOverride(\"tableCell\", h(parent?.type === \"table-row\" && parent.isHeader ? \"th\" : \"td\", {\n\t\t\t\t\"data-streaming-markdown-node\": \"table-cell\",\n\t\t\t\t\"data-node-open\": String(!node.closed)\n\t\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\t}\n\t\tcase \"thematic-break\": return withOverride(\"thematicBreak\", h(\"hr\", {\n\t\t\t\"data-streaming-markdown-node\": \"thematic-break\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}));\n\t\tcase \"text\": return h(\"span\", { style: \"display:contents\" }, renderTextSegments(node));\n\t\tcase \"em\": return withOverride(\"em\", h(\"em\", {\n\t\t\t\"data-streaming-markdown-node\": \"em\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"strong\": return withOverride(\"strong\", h(\"strong\", {\n\t\t\t\"data-streaming-markdown-node\": \"strong\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"strikethrough\": return withOverride(\"strikethrough\", h(\"del\", {\n\t\t\t\"data-streaming-markdown-node\": \"strikethrough\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\tcase \"inline-code\": return withOverride(\"inlineCode\", h(\"code\", {\n\t\t\t\"data-streaming-markdown-node\": \"inline-code\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}, node.text));\n\t\tcase \"soft-break\": return \"\\n\";\n\t\tcase \"hard-break\": return withOverride(\"hardBreak\", h(\"br\", {\n\t\t\t\"data-streaming-markdown-node\": \"hard-break\",\n\t\t\t\"data-node-open\": String(!node.closed)\n\t\t}));\n\t\tcase \"link\": {\n\t\t\tconst safeHref = sanitizeHref(node.url);\n\t\t\tconst attrs = {\n\t\t\t\t\"data-streaming-markdown-node\": \"link\",\n\t\t\t\t\"data-node-open\": String(!node.closed),\n\t\t\t\ttarget: \"_blank\",\n\t\t\t\trel: \"noopener noreferrer\"\n\t\t\t};\n\t\t\tif (safeHref != null) attrs.href = safeHref;\n\t\t\tif (node.title) attrs.title = node.title;\n\t\t\treturn withOverride(\"link\", h(\"a\", attrs, renderChildren(node.children, nodeById, nodeRenderers)));\n\t\t}\n\t\tcase \"image\": {\n\t\t\tconst safeSrc = sanitizeImgSrc(node.url);\n\t\t\tconst attrs = {\n\t\t\t\t\"data-streaming-markdown-node\": \"image\",\n\t\t\t\t\"data-node-open\": String(!node.closed),\n\t\t\t\talt: node.alt\n\t\t\t};\n\t\t\tif (safeSrc != null) attrs.src = safeSrc;\n\t\t\tif (node.title) attrs.title = node.title;\n\t\t\treturn withOverride(\"image\", h(\"img\", attrs));\n\t\t}\n\t\tcase \"autolink\": {\n\t\t\tconst safeHref = sanitizeHref(node.url);\n\t\t\tconst attrs = {\n\t\t\t\t\"data-streaming-markdown-node\": \"autolink\",\n\t\t\t\t\"data-node-open\": String(!node.closed),\n\t\t\t\ttarget: \"_blank\",\n\t\t\t\trel: \"noopener noreferrer\"\n\t\t\t};\n\t\t\tif (safeHref != null) attrs.href = safeHref;\n\t\t\treturn withOverride(\"autolink\", h(\"a\", attrs, node.text));\n\t\t}\n\t\tcase \"citation\": return withOverride(\"citation\", h(\"sup\", {\n\t\t\t\"data-streaming-markdown-node\": \"citation\",\n\t\t\t\"data-node-open\": String(!node.closed),\n\t\t\tclass: \"cpk-streaming-markdown-citation\"\n\t\t}, [h(\"span\", {\n\t\t\trole: \"doc-noteref\",\n\t\t\tclass: \"cpk-streaming-markdown-citation-label\"\n\t\t}, String(node.number ?? node.idRef))]));\n\t\tdefault: return null;\n\t}\n}\n/**\n* Vue 3 streaming markdown renderer.\n*\n* Drives the `@copilotkit/markdown` zero-dep parser and walks the\n* resulting AST into VNodes via `h()`.\n*\n* @public\n*/\nconst StreamingMarkdownRenderer = defineComponent({\n\tname: \"StreamingMarkdownRenderer\",\n\tprops: {\n\t\tcontent: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t},\n\t\tisComplete: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\toptions: {\n\t\t\ttype: Object,\n\t\t\tdefault: void 0\n\t\t},\n\t\tclass: {\n\t\t\ttype: String,\n\t\t\tdefault: void 0\n\t\t},\n\t\tcaret: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\tnodeRenderers: {\n\t\t\ttype: Object,\n\t\t\tdefault: void 0\n\t\t}\n\t},\n\tsetup(props) {\n\t\tconst parserState = computed(() => {\n\t\t\tconst opts = normalizeOptions(props.options);\n\t\t\treturn buildParserState(props.content ?? \"\", opts, props.isComplete);\n\t\t});\n\t\tconst nodeById = computed(() => {\n\t\t\tconst map = /* @__PURE__ */ new Map();\n\t\t\tfor (const node of parserState.value.nodes) map.set(node.id, node);\n\t\t\treturn map;\n\t\t});\n\t\treturn () => {\n\t\t\tconst state = parserState.value;\n\t\t\tconst byId = nodeById.value;\n\t\t\tconst rootNode = state.rootId != null ? byId.get(state.rootId) : void 0;\n\t\t\tconst renderers = props.nodeRenderers;\n\t\t\tconst rootClass = props.class ? `cpk-streaming-markdown-root ${props.class}` : \"cpk-streaming-markdown-root\";\n\t\t\tif (!rootNode) return h(\"div\", {\n\t\t\t\tclass: rootClass,\n\t\t\t\t\"data-streaming-markdown-root\": true\n\t\t\t});\n\t\t\tconst children = rootNode.type === \"document\" ? rootNode.children.map((id) => {\n\t\t\t\tconst child = byId.get(id);\n\t\t\t\treturn child ? renderNode(child, byId, renderers) : null;\n\t\t\t}) : [renderNode(rootNode, byId, renderers)];\n\t\t\tif (props.caret && !state.isComplete) children.push(h(\"span\", {\n\t\t\t\t\"aria-hidden\": true,\n\t\t\t\tclass: \"cpk-streaming-markdown-caret\",\n\t\t\t\t\"data-streaming-markdown-caret\": true,\n\t\t\t\tstyle: {\n\t\t\t\t\tdisplay: \"inline-block\",\n\t\t\t\t\twidth: \"0.48em\",\n\t\t\t\t\theight: \"0.48em\",\n\t\t\t\t\tmarginInlineStart: \"0.08em\",\n\t\t\t\t\tverticalAlign: \"-0.08em\",\n\t\t\t\t\tborderRadius: \"999px\",\n\t\t\t\t\tbackgroundColor: \"currentColor\",\n\t\t\t\t\topacity: \"0.55\"\n\t\t\t\t}\n\t\t\t}));\n\t\t\treturn h(\"div\", {\n\t\t\t\tclass: rootClass,\n\t\t\t\t\"data-streaming-markdown-root\": true\n\t\t\t}, children);\n\t\t};\n\t}\n});\n\n//#endregion\nexport { StreamingMarkdownRenderer };\n//# sourceMappingURL=index.mjs.map","<script setup lang=\"ts\">\nimport { computed, h, watchEffect } from \"vue\";\nimport { StreamingMarkdownRenderer } from \"@copilotkit/markdown/vue\";\nimport type { VueStreamingMarkdownNodeRenderer } from \"@copilotkit/markdown/vue\";\nimport { warnUnsupportedRichSyntaxOnce } from \"@copilotkit/markdown\";\nimport type { StreamingMarkdownParserOptions } from \"@copilotkit/markdown\";\nimport type { DefaultMarkdownRendererProps } from \"../../providers/markdown-renderer\";\n\nconst props = withDefaults(\n defineProps<\n { content: string; isStreaming?: boolean } & DefaultMarkdownRendererProps\n >(),\n { isStreaming: false },\n);\n\nconst resolvedOptions = computed(\n () => props.options as StreamingMarkdownParserOptions | undefined,\n);\n\nconst defaultCodeBlockRenderer: VueStreamingMarkdownNodeRenderer = (\n node,\n defaultVNode,\n) => {\n if (node.type !== \"code-block\") return defaultVNode;\n return h(\n \"pre\",\n {\n \"data-streaming-markdown-node\": \"code-block\",\n \"data-node-open\": String(!node.closed),\n class: \"cpk-markdown-code-block\",\n },\n [h(\"code\", { \"data-code-info\": node.info ?? undefined }, node.text)],\n );\n};\n\nconst mergedNodeRenderers = computed(() => ({\n codeBlock: defaultCodeBlockRenderer,\n ...props.nodeRenderers,\n}));\n\n// Dev-only: nudge upgraders from the bundled Streamdown default when their\n// content needs math/syntax highlighting the built-in renderer doesn't do.\nwatchEffect(() => warnUnsupportedRichSyntaxOnce(props.content));\n</script>\n\n<template>\n <StreamingMarkdownRenderer\n :content=\"props.content\"\n :is-complete=\"!props.isStreaming\"\n :node-renderers=\"mergedNodeRenderers\"\n :caret=\"props.caret ?? props.isStreaming\"\n :options=\"resolvedOptions\"\n :class=\"props.class\"\n />\n</template>\n","import { defineComponent, h } from \"vue\";\nimport type { PropType } from \"vue\";\nimport { ɵcopilotIcons, ɵcopilotIconSvgAttributes } from \"@copilotkit/core\";\nimport type { CopilotIconName } from \"@copilotkit/core\";\n\n/** True when the attributes give the icon an accessible name or role. */\nfunction hasAccessibleAttribute(attributes: object) {\n return Object.keys(attributes).some(\n (key) => key.startsWith(\"aria-\") || key === \"role\" || key === \"title\",\n );\n}\n\n/** Props that change how an icon is drawn. Other attributes go on the `<svg>`. */\nconst iconDrawProps = {\n /** Width and height of the icon. Defaults to `24`. */\n size: { type: [Number, String], default: 24 },\n /** Line color. Defaults to `currentColor`. */\n color: { type: String, default: \"currentColor\" },\n /** Line width. Defaults to `2`. */\n strokeWidth: { type: [Number, String], default: 2 },\n};\n\n/**\n * Draws one of the chat icons as an inline `<svg>`.\n *\n * The `<svg>` has the classes `lucide lucide-<icon name>`, so CSS that selects\n * them (for example `svg.lucide-arrow-up`) keeps working. The icon is hidden\n * from screen readers unless you give it an `aria-*` attribute, a `role` or a\n * `title`. Other attributes, such as `class` or `fill`, go on the `<svg>`.\n *\n * Props:\n * - `name`: the chat icon, for example `\"ArrowUp\"` or `\"X\"`.\n * - `size`: width and height. Defaults to `24`.\n * - `stroke-width`: line width. Defaults to `2`.\n * - `color`: line color. Defaults to `currentColor`.\n *\n * @example\n * ```vue\n * <CopilotIcon name=\"ArrowUp\" class=\"cpk-chat-input-send-icon\" />\n * <CopilotIcon name=\"X\" aria-label=\"Close\" />\n * ```\n */\nexport const CopilotIcon = defineComponent({\n name: \"CopilotIcon\",\n props: {\n /** The chat icon to draw, for example `\"ArrowUp\"`. */\n name: { type: String as PropType<CopilotIconName>, required: true },\n ...iconDrawProps,\n },\n setup(props, { attrs, slots }) {\n return () => {\n const icon = ɵcopilotIcons[props.name];\n const content = slots.default?.() ?? [];\n const isDecorative =\n content.length === 0 && !hasAccessibleAttribute(attrs);\n return h(\n \"svg\",\n {\n ...ɵcopilotIconSvgAttributes,\n width: props.size,\n height: props.size,\n stroke: props.color,\n \"stroke-width\": props.strokeWidth,\n class: [\"lucide\", `lucide-${icon.name}`],\n \"aria-hidden\": isDecorative ? \"true\" : undefined,\n },\n [...icon.nodes.map((node) => h(node.tag, node.attributes)), ...content],\n );\n };\n },\n});\n\n/**\n * Internal. Makes a component that draws one chat icon, such as `IconArrowUp`.\n * It takes the same `size`, `color` and `stroke-width` props as `CopilotIcon`.\n */\nfunction defineIcon(name: CopilotIconName) {\n return defineComponent({\n name: `Icon${name}`,\n props: iconDrawProps,\n setup(props, { slots }) {\n return () => h(CopilotIcon, { name, ...props }, slots);\n },\n });\n}\n\nexport const IconArrowUp = defineIcon(\"ArrowUp\");\nexport const IconCheck = defineIcon(\"Check\");\nexport const IconChevronDown = defineIcon(\"ChevronDown\");\nexport const IconChevronLeft = defineIcon(\"ChevronLeft\");\nexport const IconChevronRight = defineIcon(\"ChevronRight\");\nexport const IconCircle = defineIcon(\"Circle\");\nexport const IconCopy = defineIcon(\"Copy\");\nexport const IconEdit = defineIcon(\"Edit\");\nexport const IconEyeOff = defineIcon(\"EyeOff\");\nexport const IconLoader2 = defineIcon(\"Loader2\");\nexport const IconMessageCircle = defineIcon(\"MessageCircle\");\nexport const IconMic = defineIcon(\"Mic\");\nexport const IconPanelLeftOpen = defineIcon(\"PanelLeftOpen\");\nexport const IconPlay = defineIcon(\"Play\");\nexport const IconPlus = defineIcon(\"Plus\");\nexport const IconRefreshCw = defineIcon(\"RefreshCw\");\nexport const IconSquare = defineIcon(\"Square\");\nexport const IconThumbsDown = defineIcon(\"ThumbsDown\");\nexport const IconThumbsUp = defineIcon(\"ThumbsUp\");\nexport const IconUpload = defineIcon(\"Upload\");\nexport const IconVolume2 = defineIcon(\"Volume2\");\nexport const IconWrench = defineIcon(\"Wrench\");\nexport const IconX = defineIcon(\"X\");\n","import type { Message, ToolCall, ToolMessage } from \"@ag-ui/core\";\nimport { contentToText } from \"@ag-ui/core\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { ToolCallStatus, ɵresolveToolCallRenderer } from \"@copilotkit/core\";\nimport { partialJSONParse } from \"@copilotkit/shared\";\nimport type { CopilotChatToolCallRenderSlotProps } from \"./types\";\nimport type {\n VueToolCallRenderer,\n VueToolCallRendererRenderProps,\n} from \"../../types\";\n\nexport function findToolMessage(\n messages: Message[],\n toolCallId: string,\n): ToolMessage | undefined {\n return messages.find(\n (message) =>\n message.role === \"tool\" &&\n (message as ToolMessage).toolCallId === toolCallId,\n ) as ToolMessage | undefined;\n}\n\nexport function getToolCallSlotName(toolName: string): `tool-call-${string}` {\n return `tool-call-${toolName}`;\n}\n\nexport function getToolCallRenderProps(\n toolCall: ToolCall,\n messages: Message[],\n executingToolCallIds: ReadonlySet<string>,\n): CopilotChatToolCallRenderSlotProps {\n const toolMessage = findToolMessage(messages, toolCall.id);\n const parsedArgs = partialJSONParse(toolCall.function.arguments);\n\n if (toolMessage) {\n return {\n name: toolCall.function.name,\n args: parsedArgs,\n status: ToolCallStatus.Complete,\n result: contentToText(toolMessage.content),\n toolCall,\n toolMessage,\n };\n }\n\n const isExecuting = executingToolCallIds.has(toolCall.id);\n return {\n name: toolCall.function.name,\n args: parsedArgs,\n status: isExecuting ? ToolCallStatus.Executing : ToolCallStatus.InProgress,\n result: undefined,\n toolCall,\n toolMessage: undefined,\n };\n}\n\nexport function getCoreRenderProps(\n toolCall: ToolCall,\n messages: Message[],\n executingToolCallIds: ReadonlySet<string>,\n): VueToolCallRendererRenderProps<unknown> {\n const toolMessage = findToolMessage(messages, toolCall.id);\n const parsedArgs = partialJSONParse(toolCall.function.arguments);\n\n if (toolMessage) {\n return {\n name: toolCall.function.name,\n toolCallId: toolCall.id,\n args: parsedArgs,\n status: ToolCallStatus.Complete,\n result: contentToText(toolMessage.content),\n };\n }\n\n const isExecuting = executingToolCallIds.has(toolCall.id);\n if (isExecuting) {\n return {\n name: toolCall.function.name,\n toolCallId: toolCall.id,\n args: parsedArgs,\n status: ToolCallStatus.Executing,\n result: undefined,\n };\n }\n\n return {\n name: toolCall.function.name,\n toolCallId: toolCall.id,\n args: parsedArgs && typeof parsedArgs === \"object\" ? parsedArgs : {},\n status: ToolCallStatus.InProgress,\n result: undefined,\n };\n}\n\nexport function getToolCallMemoDeps(\n toolCall: ToolCall,\n messages: Message[],\n executingToolCallIds: ReadonlySet<string>,\n renderToolCalls: readonly VueToolCallRenderer<unknown>[],\n agentId: string = DEFAULT_AGENT_ID,\n): unknown[] {\n return [\n toolCall.id,\n toolCall.function.name,\n toolCall.function.arguments,\n findToolMessage(messages, toolCall.id)?.content,\n executingToolCallIds.has(toolCall.id),\n ɵresolveToolCallRenderer(renderToolCalls, toolCall.function.name, agentId)\n ?.render,\n ];\n}\n","import { defineComponent, h, ref, watch } from \"vue\";\nimport type { PropType, Ref } from \"vue\";\nimport type { CopilotKitCore } from \"@copilotkit/core\";\n\n/**\n * Whether interaction capture is configured on the core. Driven by the\n * learning config, not by the Trajectory, so a wrapper keyed on it does not\n * remount the tool UI on every reconnect.\n * @internal\n */\nexport function useLearningConfigured(\n copilotkit: Ref<CopilotKitCore>,\n): Readonly<Ref<boolean>> {\n const configured = ref(false);\n watch(\n copilotkit,\n (core, _previous, onCleanup) => {\n configured.value = core.ɵlearningConfigured;\n onCleanup(\n core.ɵsubscribeToLearningConfigured(() => {\n configured.value = core.ɵlearningConfigured;\n }),\n );\n },\n { immediate: true },\n );\n return configured;\n}\n\n/**\n * Wraps a tool call's UI in `data-tool-call-id` while learning is configured,\n * so interaction capture can attribute clicks to the tool call. The wrapper\n * uses `display: contents`, so it does not change the layout.\n * @internal\n */\nexport const ToolCallCaptureScope = defineComponent({\n name: \"ToolCallCaptureScope\",\n props: {\n toolCallId: { type: String, required: true },\n enabled: { type: Boolean as PropType<boolean>, required: true },\n },\n setup(props, { slots }) {\n return () =>\n props.enabled\n ? h(\n \"div\",\n {\n \"data-tool-call-id\": props.toolCallId,\n style: { display: \"contents\" },\n },\n slots.default?.(),\n )\n : slots.default?.();\n },\n});\n","<script setup lang=\"ts\">\nimport type { Message, ToolCall } from \"@ag-ui/core\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { ɵresolveToolCallRenderer } from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport type { CopilotChatToolCallRenderSlotProps } from \"./types\";\nimport {\n getCoreRenderProps,\n getToolCallMemoDeps,\n getToolCallRenderProps,\n getToolCallSlotName,\n} from \"./copilotChatToolCallItemRender\";\nimport {\n ToolCallCaptureScope,\n useLearningConfigured,\n} from \"./tool-call-capture\";\n\nconst props = withDefaults(\n defineProps<{\n toolCall: ToolCall;\n messages?: Message[];\n }>(),\n {\n messages: () => [],\n },\n);\n\ndefineSlots<{\n \"tool-call\"?: (props: CopilotChatToolCallRenderSlotProps) => unknown;\n [key: `tool-call-${string}`]: (\n props: CopilotChatToolCallRenderSlotProps,\n ) => unknown;\n}>();\n\nconst { copilotkit, executingToolCallIds } = useCopilotKit();\nconst config = useCopilotChatConfiguration();\nconst learningConfigured = useLearningConfigured(copilotkit);\n\nfunction getRenderProps(): CopilotChatToolCallRenderSlotProps {\n return getToolCallRenderProps(\n props.toolCall,\n props.messages,\n executingToolCallIds.value,\n );\n}\n\nfunction getCoreProps() {\n return getCoreRenderProps(\n props.toolCall,\n props.messages,\n executingToolCallIds.value,\n );\n}\n\nfunction getRenderConfig() {\n const agentId = config.value?.agentId ?? DEFAULT_AGENT_ID;\n return ɵresolveToolCallRenderer(\n copilotkit.value.renderToolCalls,\n props.toolCall.function.name,\n agentId,\n );\n}\n\nfunction getMemoDeps() {\n const agentId = config.value?.agentId ?? DEFAULT_AGENT_ID;\n return getToolCallMemoDeps(\n props.toolCall,\n props.messages,\n executingToolCallIds.value,\n copilotkit.value.renderToolCalls,\n agentId,\n );\n}\n</script>\n\n<template>\n <ToolCallCaptureScope\n :tool-call-id=\"toolCall.id\"\n :enabled=\"learningConfigured\"\n >\n <slot\n :name=\"getToolCallSlotName(toolCall.function.name)\"\n v-bind=\"getRenderProps()\"\n >\n <slot name=\"tool-call\" v-bind=\"getRenderProps()\">\n <component\n :is=\"getRenderConfig()?.render\"\n v-if=\"getRenderConfig()\"\n v-memo=\"getMemoDeps()\"\n v-bind=\"getCoreProps()\"\n />\n </slot>\n </slot>\n </ToolCallCaptureScope>\n</template>\n","import * as vue from \"vue\";\n\nlet counter = 0;\n\n/**\n * A unique id for ARIA references. Uses Vue's SSR-safe `useId()` on Vue 3.5+;\n * the peer range starts at 3.3, which has none, so older Vue gets a counter.\n * Read through the namespace, so a Vue without the export does not fail to\n * import this module.\n * @internal\n */\nexport function useCopilotId(prefix = \"cpk\"): string {\n const vueUseId = (vue as { useId?: () => string }).useId;\n const id = vueUseId?.();\n return id ? `${prefix}-${id}` : `${prefix}-${++counter}`;\n}\n","import type { ComputedRef, InjectionKey } from \"vue\";\nimport type { ɵToolCallDisplayContextValue } from \"@copilotkit/core\";\n\n/**\n * Provided by the message view so each message's tool calls follow the view's\n * `toolCallDisplay` without every layer passing it along.\n * @internal\n */\nexport const ToolCallDisplayContextKey: InjectionKey<\n ComputedRef<ɵToolCallDisplayContextValue>\n> = Symbol(\"CopilotChatToolCallDisplay\");\n\n/**\n * Provided by a group around the calls it shows, so CopilotKit's built-in tool\n * card draws itself as a compact row that fits the group instead of a card.\n * @internal\n */\nexport interface ToolCallGroupContextValue {\n appearance: \"card\" | \"line\" | \"stack\";\n failedIds: ReadonlySet<string>;\n /** The agent may still finish the group's calls; see `isActive`. */\n active: boolean;\n}\n\n/** @internal */\nexport const ToolCallGroupContextKey: InjectionKey<\n ComputedRef<ToolCallGroupContextValue | null>\n> = Symbol(\"CopilotChatToolCallGroup\");\n","import { defineComponent, h, onMounted, ref, watch } from \"vue\";\nimport type { PropType } from \"vue\";\nimport {\n ɵcountFailedToolCalls,\n ɵformatLabel,\n ɵgetArgumentPreview,\n ɵstringifyToolCallPayload,\n} from \"@copilotkit/core\";\nimport type {\n CopilotChatLabels,\n ToolCallEntry,\n ɵToolCallRowStatus,\n} from \"@copilotkit/core\";\nimport {\n IconCheck,\n IconChevronRight,\n IconCircle,\n IconLoader2,\n IconX,\n} from \"../icons\";\nimport { useCopilotId } from \"../ui/use-id\";\nimport { useChatLabels } from \"./use-chat-labels\";\n\n/**\n * The label for a tool call's status (\"Running\", \"Done\", ...).\n * @internal\n */\nexport function toolCallStatusLabel(\n labels: Readonly<CopilotChatLabels>,\n status: ɵToolCallRowStatus,\n) {\n switch (status) {\n case \"running\":\n return labels.toolCallStatusRunningLabel;\n case \"done\":\n return labels.toolCallStatusDoneLabel;\n case \"failed\":\n return labels.toolCallStatusFailedLabel;\n case \"stopped\":\n return labels.toolCallStatusStoppedLabel;\n }\n}\n\n/**\n * Height transition between closed and its content's height. Closed content\n * stays mounted (so its state survives) but is inert.\n * @internal\n */\nexport const CopilotChatCollapsible = defineComponent({\n name: \"CopilotChatCollapsible\",\n props: {\n open: { type: Boolean, required: true },\n id: { type: String, default: undefined },\n },\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null);\n // Set as an attribute, so closed content leaves the tab order everywhere.\n const syncInert = () => root.value?.toggleAttribute(\"inert\", !props.open);\n onMounted(syncInert);\n watch(() => props.open, syncInert, { flush: \"post\" });\n return () =>\n h(\n \"div\",\n {\n ref: root,\n id: props.id,\n class: \"cpk-collapsible\",\n style: { gridTemplateRows: props.open ? \"1fr\" : \"0fr\" },\n },\n [h(\"div\", { class: \"cpk-collapsible-content\" }, slots.default?.())],\n );\n },\n});\n\n/** @internal */\nexport const ToolCallStatusIcon = defineComponent({\n name: \"ToolCallStatusIcon\",\n props: {\n status: {\n type: String as PropType<ɵToolCallRowStatus>,\n required: true,\n },\n },\n setup(props) {\n return () =>\n h(\n {\n running: IconLoader2,\n done: IconCheck,\n failed: IconX,\n stopped: IconCircle,\n }[props.status],\n {\n \"aria-hidden\": \"true\",\n class: [\n \"cpk-tool-call-status-icon\",\n props.status === \"running\" && \"cpk-tool-call-status-icon-running\",\n props.status === \"failed\" && \"cpk-tool-call-status-icon-failed\",\n ],\n },\n );\n },\n});\n\n/** @internal */\nexport const ToolCallChevron = defineComponent({\n name: \"ToolCallChevron\",\n props: { open: { type: Boolean, required: true } },\n setup(props) {\n return () =>\n h(IconChevronRight, {\n \"aria-hidden\": \"true\",\n class: [\n \"cpk-tool-call-chevron\",\n props.open && \"cpk-tool-call-chevron-open\",\n ],\n });\n },\n});\n\n/** \"2 failed\", or nothing. @internal */\nexport const ToolCallFailedCount = defineComponent({\n name: \"ToolCallFailedCount\",\n props: {\n calls: { type: Array as PropType<ToolCallEntry[]>, required: true },\n },\n setup(props) {\n const labels = useChatLabels();\n return () => {\n const failed = ɵcountFailedToolCalls(props.calls);\n if (!failed) return null;\n return h(\n \"span\",\n { class: \"cpk-tool-call-failed-count\" },\n ɵformatLabel(labels.value.toolCallFailedCountLabel, { count: failed }),\n );\n };\n },\n});\n\nfunction payload(label: string, value: unknown) {\n return h(\"div\", [\n h(\"div\", { class: \"cpk-tool-call-payload-label\" }, label),\n h(\n \"pre\",\n { class: \"cpk-tool-call-payload-code\" },\n ɵstringifyToolCallPayload(value),\n ),\n ]);\n}\n\n/**\n * The built-in tool card drawn as a row inside a group: status, name and main\n * argument, opening to the payloads.\n * @internal\n */\nexport const ToolCallRow = defineComponent({\n name: \"ToolCallRow\",\n props: {\n name: { type: String, required: true },\n parameters: { type: null, default: undefined },\n result: { type: null, default: undefined },\n status: {\n type: String as PropType<ɵToolCallRowStatus>,\n required: true,\n },\n appearance: {\n type: String as PropType<\"card\" | \"line\" | \"stack\">,\n required: true,\n },\n },\n setup(props) {\n const open = ref(false);\n const detailsId = useCopilotId(\"cpk-tool-call-row\");\n const labels = useChatLabels();\n return () => {\n const preview = ɵgetArgumentPreview(props.parameters);\n // Rows draw their own divider: a wrapper with `display: contents`\n // around each call would escape a parent's divide-y.\n return h(\n \"div\",\n {\n \"data-copilotkit\": \"\",\n class: [\"cpk-tool-call-row\", `cpk-tool-call-row-${props.appearance}`],\n },\n [\n h(\n \"button\",\n {\n type: \"button\",\n \"aria-expanded\": open.value ? \"true\" : \"false\",\n \"aria-controls\": detailsId,\n onClick: () => {\n open.value = !open.value;\n },\n class: \"cpk-tool-call-row-button\",\n },\n [\n h(ToolCallStatusIcon, { status: props.status }),\n h(\n \"span\",\n {\n \"data-testid\": \"copilot-tool-render-name\",\n class: [\n \"cpk-tool-call-row-name\",\n props.status === \"running\" && \"cpk-shimmer\",\n ],\n },\n props.name,\n ),\n preview\n ? h(\"span\", { class: \"cpk-tool-call-row-preview\" }, preview)\n : null,\n h(\n \"span\",\n {\n \"data-testid\": \"copilot-tool-render-status\",\n class: \"cpk-tool-call-row-status\",\n },\n toolCallStatusLabel(labels.value, props.status),\n ),\n h(IconChevronRight, {\n \"aria-hidden\": \"true\",\n class: [\n \"cpk-tool-call-chevron\",\n open.value && \"cpk-tool-call-chevron-open\",\n \"cpk-tool-call-row-chevron\",\n ],\n }),\n ],\n ),\n h(CopilotChatCollapsible, { open: open.value, id: detailsId }, () => [\n h(\n \"div\",\n { class: \"cpk-tool-call-payloads cpk-tool-call-row-payloads\" },\n [\n payload(\n labels.value.toolCallArgumentsLabel,\n props.parameters ?? {},\n ),\n props.result !== undefined\n ? payload(labels.value.toolCallResultLabel, props.result)\n : null,\n ],\n ),\n ]),\n ],\n );\n };\n },\n});\n","<script setup lang=\"ts\">\n/**\n * Tool calls made in a row, collapsed into one summary. While a call runs the\n * summary names it (\"Running read_file src/app.ts\"); once they're all done it\n * reads \"Used 3 tools\" and opens to the calls.\n *\n * Each call is drawn by the `call` slot, which the tool calls view fills with\n * the registered renderers. CopilotKit's built-in card (`useDefaultRenderTool`)\n * draws a compact row inside the card and line appearances and an open stack;\n * a custom wildcard renderer draws whatever it draws.\n */\nimport { computed, provide, ref } from \"vue\";\nimport {\n ɵformatLabel,\n ɵformatToolNames,\n ɵgetToolCallPreview,\n ɵgetToolCallRowStatus,\n ɵformatCountLabel,\n} from \"@copilotkit/core\";\nimport type { ToolCallEntry, ɵToolCallRowStatus } from \"@copilotkit/core\";\nimport { useCopilotId } from \"../ui/use-id\";\nimport { ToolCallGroupContextKey } from \"./tool-call-display-context\";\nimport type { ToolCallGroupContextValue } from \"./tool-call-display-context\";\nimport {\n CopilotChatCollapsible,\n ToolCallChevron,\n ToolCallFailedCount,\n ToolCallStatusIcon,\n toolCallStatusLabel,\n} from \"./tool-call-group-parts\";\nimport { useChatLabels } from \"./use-chat-labels\";\nimport type { CopilotChatToolCallGroupAppearance } from \"./types\";\n\nconst props = withDefaults(\n defineProps<{\n /** The calls in the group, in order. */\n calls: ToolCallEntry[];\n /**\n * - `\"card\"` (default): one card with a summary header and a row per call.\n * - `\"line\"`: a quiet line of text that opens to a list of rows.\n * - `\"stack\"`: the latest call on a stack of the earlier ones.\n */\n appearance?: CopilotChatToolCallGroupAppearance;\n /** The agent is running and nothing follows the group, so more calls may join it. */\n isActive?: boolean;\n }>(),\n { appearance: \"card\", isActive: false },\n);\n\ndefineSlots<{\n /** Draws one call. */\n call(props: { call: ToolCallEntry }): unknown;\n}>();\n\nconst labels = useChatLabels();\nconst open = ref(false);\nconst bodyId = useCopilotId(\"cpk-tool-call-group\");\nconst toggle = () => {\n open.value = !open.value;\n};\n\nconst latest = computed(() => props.calls[props.calls.length - 1]);\n// Only an active group has a call in progress. Between calls nothing is\n// running, so the latest call stays the subject (or the label flickers).\nconst current = computed(() =>\n props.isActive\n ? (props.calls.find((call) => !call.toolMessage) ?? latest.value)\n : undefined,\n);\nconst preview = computed(() =>\n current.value ? ɵgetToolCallPreview(current.value) : undefined,\n);\nconst done = computed(\n () => props.calls.filter((call) => call.toolMessage).length,\n);\nconst statuses = computed(() =>\n props.calls.map((call) => ɵgetToolCallRowStatus(call, props.isActive)),\n);\nconst failedIds = computed(\n () =>\n new Set(\n props.calls\n .filter((_, index) => statuses.value[index] === \"failed\")\n .map((call) => call.toolCall.id),\n ),\n);\nconst status = computed<ɵToolCallRowStatus>(() =>\n current.value\n ? \"running\"\n : failedIds.value.size > 0\n ? \"failed\"\n : statuses.value.includes(\"stopped\")\n ? \"stopped\"\n : \"done\",\n);\nconst single = computed(\n () =>\n props.appearance === \"line\" && props.calls.length === 1 && !current.value,\n);\n\nprovide(\n ToolCallGroupContextKey,\n computed<ToolCallGroupContextValue>(() => ({\n appearance: props.appearance,\n failedIds: failedIds.value,\n active: props.isActive,\n })),\n);\n\n// Stack: a lone call is the top card of a stack with nothing behind it yet.\nconst behind = computed(() =>\n open.value ? 0 : Math.min(props.calls.length - 1, 2),\n);\nconst latestStatus = computed(() =>\n latest.value ? ɵgetToolCallRowStatus(latest.value, props.isActive) : \"done\",\n);\nconst latestPreview = computed(() =>\n latest.value ? ɵgetToolCallPreview(latest.value) : undefined,\n);\nconst runningLabel = computed(() =>\n current.value\n ? ɵformatLabel(labels.value.toolCallRunningLabel, {\n name: current.value.toolCall.function.name,\n })\n : \"\",\n);\nconst usedToolsLabel = computed(() =>\n ɵformatCountLabel(props.calls.length, {\n one: labels.value.toolCallUsedToolsOne,\n other: labels.value.toolCallUsedToolsOther,\n }),\n);\nconst toolNames = computed(() => ɵformatToolNames(props.calls));\nconst latestStatusLabel = computed(() =>\n toolCallStatusLabel(labels.value, latestStatus.value),\n);\nconst layer = \"cpk-tool-call-group-stack-layer\";\n</script>\n\n<template>\n <div\n v-if=\"latest && single\"\n data-copilotkit\n data-testid=\"copilot-tool-call-group\"\n :data-appearance=\"appearance\"\n :data-state=\"status\"\n class=\"cpk-tool-call-group cpk-tool-call-group-line cpk-tool-call-group-single\"\n >\n <slot name=\"call\" :call=\"latest\" />\n </div>\n\n <div\n v-else-if=\"latest && appearance === 'line'\"\n data-copilotkit\n data-testid=\"copilot-tool-call-group\"\n :data-appearance=\"appearance\"\n :data-state=\"status\"\n class=\"cpk-tool-call-group cpk-tool-call-group-line\"\n >\n <button\n type=\"button\"\n :aria-expanded=\"open ? 'true' : 'false'\"\n :aria-controls=\"bodyId\"\n class=\"cpk-tool-call-group-line-toggle\"\n @click=\"toggle\"\n >\n <template v-if=\"current\">\n <span class=\"cpk-tool-call-group-running cpk-shimmer\">{{\n runningLabel\n }}</span>\n <span v-if=\"preview\" class=\"cpk-tool-call-group-preview\">{{\n preview\n }}</span>\n </template>\n <template v-else>\n <span class=\"cpk-tool-call-group-line-summary\">{{\n usedToolsLabel\n }}</span>\n <span class=\"cpk-tool-call-group-line-names\">{{ toolNames }}</span>\n <ToolCallFailedCount :calls=\"calls\" />\n </template>\n <ToolCallChevron :open=\"open\" />\n </button>\n <CopilotChatCollapsible :id=\"bodyId\" :open=\"open\">\n <div class=\"cpk-tool-call-group-line-body\">\n <template v-for=\"call in calls\" :key=\"call.toolCall.id\">\n <slot name=\"call\" :call=\"call\" />\n </template>\n </div>\n </CopilotChatCollapsible>\n </div>\n\n <div\n v-else-if=\"latest && appearance === 'stack'\"\n data-copilotkit\n data-testid=\"copilot-tool-call-group\"\n :data-appearance=\"appearance\"\n :data-state=\"status\"\n class=\"cpk-tool-call-group cpk-tool-call-group-stack\"\n :style=\"{ paddingBottom: `${behind * 6}px` }\"\n >\n <div class=\"cpk-tool-call-group-stack-pile\">\n <div\n v-for=\"index in behind\"\n :key=\"index\"\n aria-hidden=\"true\"\n :class=\"[layer, 'cpk-tool-call-group-stack-behind']\"\n :style=\"{\n transform: `translateY(${index * 6}px) scaleX(${1 - index * 0.045})`,\n zIndex: -index,\n opacity: 1 - index * 0.28,\n }\"\n />\n <!-- One toggle in both states, so it keeps keyboard focus when pressed. -->\n <button\n type=\"button\"\n :aria-expanded=\"open ? 'true' : 'false'\"\n :aria-controls=\"open ? bodyId : undefined\"\n :class=\"[\n 'cpk-tool-call-group-stack-toggle',\n open\n ? 'cpk-tool-call-group-stack-toggle-open'\n : [layer, 'cpk-tool-call-group-stack-toggle-closed'],\n ]\"\n @click=\"toggle\"\n >\n <template v-if=\"open\">\n {{\n ɵformatCountLabel(calls.length, {\n one: labels.toolCallToolCallCountOne,\n other: labels.toolCallToolCallCountOther,\n })\n }}\n <ToolCallFailedCount :calls=\"calls\" />\n <span class=\"cpk-tool-call-group-stack-collapse\">\n {{ labels.toolCallCollapseLabel }}\n <ToolCallChevron\n :open=\"true\"\n class=\"cpk-tool-call-group-stack-collapse-icon\"\n />\n </span>\n </template>\n <template v-else>\n <span\n :key=\"latest.toolCall.id\"\n class=\"cpk-tool-call-group-stack-latest\"\n >\n <ToolCallStatusIcon :status=\"latestStatus\" />\n <span\n :class=\"[\n 'cpk-tool-call-group-stack-name',\n latestStatus === 'running' && 'cpk-shimmer',\n ]\"\n >{{ latest.toolCall.function.name }}</span\n >\n <span\n v-if=\"latestPreview\"\n class=\"cpk-tool-call-group-stack-preview\"\n >{{ latestPreview }}</span\n >\n <!-- The status icon is decorative, so say the status. -->\n <span class=\"cpk-tool-call-group-stack-status\">{{\n latestStatusLabel\n }}</span>\n </span>\n <span class=\"cpk-tool-call-group-stack-meta\">\n <ToolCallFailedCount :calls=\"calls\" />\n <span class=\"cpk-tool-call-group-stack-count\">{{\n ɵformatCountLabel(calls.length, {\n one: labels.toolCallCallCountOne,\n other: labels.toolCallCallCountOther,\n })\n }}</span>\n <ToolCallChevron\n :open=\"false\"\n class=\"cpk-tool-call-group-stack-expand-icon\"\n />\n </span>\n </template>\n </button>\n <!-- Always mounted, so screen readers hear the closed stack's latest\n call change (\"read_file: Running\", then \"read_file: Done\"); the\n button only names it. -->\n <span aria-live=\"polite\" class=\"cpk-tool-call-group-stack-live\">{{\n open ? \"\" : `${latest.toolCall.function.name}: ${latestStatusLabel}`\n }}</span>\n </div>\n <!-- Each call gets the collapsed stack's card, easing out of the stack. -->\n <div v-if=\"open\" :id=\"bodyId\" class=\"cpk-tool-call-group-stack-items\">\n <div\n v-for=\"(call, index) in calls\"\n :key=\"call.toolCall.id\"\n :class=\"[layer, 'cpk-tool-call-group-stack-item']\"\n :style=\"{ animationDelay: `${index * 30}ms` }\"\n >\n <slot name=\"call\" :call=\"call\" />\n </div>\n </div>\n </div>\n\n <!-- card: one call gets the same card as several, so the card a run\n starts with doesn't change style when the next call joins it. -->\n <div\n v-else-if=\"latest\"\n data-copilotkit\n data-testid=\"copilot-tool-call-group\"\n :data-appearance=\"appearance\"\n :data-state=\"status\"\n class=\"cpk-tool-call-group cpk-tool-call-group-card\"\n >\n <button\n type=\"button\"\n :aria-expanded=\"open ? 'true' : 'false'\"\n :aria-controls=\"bodyId\"\n class=\"cpk-tool-call-group-card-toggle\"\n @click=\"toggle\"\n >\n <ToolCallStatusIcon :status=\"status\" />\n <template v-if=\"current\">\n <span class=\"cpk-tool-call-group-running cpk-shimmer\">{{\n runningLabel\n }}</span>\n <span v-if=\"preview\" class=\"cpk-tool-call-group-preview\">{{\n preview\n }}</span>\n </template>\n <template v-else>\n <span class=\"cpk-tool-call-group-card-summary\">{{\n usedToolsLabel\n }}</span>\n <span class=\"cpk-tool-call-group-card-names\">{{ toolNames }}</span>\n </template>\n <span class=\"cpk-tool-call-group-card-meta\">\n <ToolCallFailedCount v-if=\"status === 'failed'\" :calls=\"calls\" />\n <span v-else class=\"cpk-tool-call-group-card-status\">{{\n status !== \"running\"\n ? toolCallStatusLabel(labels, status)\n : done > 0\n ? ɵformatLabel(labels.toolCallDoneCountLabel, { count: done })\n : \"\"\n }}</span>\n <ToolCallChevron :open=\"open\" />\n </span>\n </button>\n <CopilotChatCollapsible :id=\"bodyId\" :open=\"open\">\n <div>\n <template v-for=\"call in calls\" :key=\"call.toolCall.id\">\n <slot name=\"call\" :call=\"call\" />\n </template>\n </div>\n </CopilotChatCollapsible>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, defineComponent, h, inject, provide, useSlots } from \"vue\";\nimport type { PropType } from \"vue\";\nimport type { Slots, VNode } from \"vue\";\nimport type { AssistantMessage, Message } from \"@ag-ui/core\";\nimport {\n ɵgetToolCallLayouts,\n ɵgetToolCallRendererNames,\n} from \"@copilotkit/core\";\nimport type {\n CopilotChatToolCallDisplay,\n ToolCallEntry,\n} from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../../providers/useCopilotKit\";\nimport type {\n CopilotChatToolCallGroupAppearance,\n CopilotChatToolCallRenderSlotProps,\n CopilotChatToolCallsGroupSlotProps,\n} from \"./types\";\nimport CopilotChatToolCallItem from \"./CopilotChatToolCallItem.vue\";\nimport CopilotChatToolCallGroup from \"./CopilotChatToolCallGroup.vue\";\nimport { CopilotChatCollapsible } from \"./tool-call-group-parts\";\nimport {\n ToolCallDisplayContextKey,\n ToolCallGroupContextKey,\n} from \"./tool-call-display-context\";\nimport type { ToolCallGroupContextValue } from \"./tool-call-display-context\";\n\nconst props = withDefaults(\n defineProps<{\n message: AssistantMessage;\n messages?: Message[];\n /**\n * How to show the calls (see `CopilotChatToolCallDisplay`). Inside a\n * message view it follows the view's `toolCallDisplay`; on its own it\n * defaults to `\"grouped\"`.\n */\n display?: CopilotChatToolCallDisplay;\n }>(),\n {\n messages: () => [],\n display: undefined,\n },\n);\n\ndefineSlots<{\n \"tool-call\"?: (props: CopilotChatToolCallRenderSlotProps) => unknown;\n /** Replaces a group of calls made in a row. */\n \"tool-calls-group\"?: (props: CopilotChatToolCallsGroupSlotProps) => unknown;\n [key: `tool-call-${string}`]: (\n props: CopilotChatToolCallRenderSlotProps,\n ) => unknown;\n}>();\n\ntype ToolCallSlotName = \"tool-call\" | `tool-call-${string}`;\n\nconst appearances: Partial<\n Record<CopilotChatToolCallDisplay, CopilotChatToolCallGroupAppearance>\n> = {\n grouped: \"card\",\n line: \"line\",\n stacked: \"stack\",\n};\n\nconst componentSlots = useSlots() as Slots;\nconst { copilotkit } = useCopilotKit();\nconst context = inject(ToolCallDisplayContextKey, null);\n\n/** The slots that draw tool calls, which each call's item renders. */\nfunction getToolCallSlotNames(): ToolCallSlotName[] {\n return Object.keys(componentSlots).filter(\n (name): name is ToolCallSlotName =>\n name === \"tool-call\" || name.startsWith(\"tool-call-\"),\n );\n}\n\nconst display = computed(\n () => props.display ?? context?.value.display ?? \"grouped\",\n);\n\n// Inside a message view, groups can span messages, so the view lays them out\n// for the whole list; on its own, this message's calls are grouped.\nconst layout = computed(() => {\n if (display.value === \"separate\") return undefined;\n const viewLayout = context?.value.layouts.get(props.message.id);\n if (viewLayout) return viewLayout;\n const rendererNames = ɵgetToolCallRendererNames(\n copilotkit.value.renderToolCalls,\n { slotNames: getToolCallSlotNames() },\n );\n return ɵgetToolCallLayouts(\n [props.message],\n props.messages,\n rendererNames,\n ).get(props.message.id);\n});\n\n// Whether the agent may still finish a trailing group's calls. Without a\n// message view there's no run state, so a call with no result is assumed to\n// be running, as the built-in card has always shown it.\nconst groupActive = (trailing: boolean) =>\n trailing && (context ? context.value.isRunning : true);\n\nconst appearance = computed(() => appearances[display.value] ?? \"card\");\n\nconst workOpen = computed(() => context?.value.workOpen.get(props.message.id));\n\n/**\n * `\"turn\"` display: draws the built-in card's calls as compact rows, the way\n * an open line group does, without a group around them.\n */\nconst TurnRows = defineComponent({\n props: {\n calls: { type: Array as PropType<ToolCallEntry[]>, required: true },\n active: { type: Boolean, required: true },\n },\n setup(rowProps, { slots }) {\n provide(\n ToolCallGroupContextKey,\n computed<ToolCallGroupContextValue>(() => ({\n appearance: \"line\",\n failedIds: new Set(\n rowProps.calls\n .filter((call) => call.toolMessage?.error)\n .map((call) => call.toolCall.id),\n ),\n active: rowProps.active,\n })),\n );\n return () => slots.default?.();\n },\n});\n\n/** Draws one call through the registered renderers and tool-call slots. */\nfunction renderCall(call: ToolCallEntry): VNode {\n const slots: Record<string, Slots[string]> = {};\n for (const name of getToolCallSlotNames()) slots[name] = componentSlots[name];\n return h(\n CopilotChatToolCallItem,\n {\n key: call.toolCall.id,\n toolCall: call.toolCall,\n messages: props.messages,\n },\n slots,\n );\n}\n</script>\n\n<template>\n <template v-if=\"!layout\">\n <CopilotChatToolCallItem\n v-for=\"toolCall in message.toolCalls ?? []\"\n :key=\"toolCall.id\"\n :tool-call=\"toolCall\"\n :messages=\"messages\"\n >\n <template\n v-for=\"slotName in getToolCallSlotNames()\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps ?? {}\" />\n </template>\n </CopilotChatToolCallItem>\n </template>\n <template v-else>\n <template v-for=\"segment in layout.segments\" :key=\"segment.id\">\n <CopilotChatToolCallItem\n v-if=\"segment.kind === 'call'\"\n :tool-call=\"segment.call.toolCall\"\n :messages=\"messages\"\n >\n <template\n v-for=\"slotName in getToolCallSlotNames()\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps ?? {}\" />\n </template>\n </CopilotChatToolCallItem>\n <!-- A row per call, in the open while the agent works; the message view\n folds them away with the rest of the work once it's done. -->\n <CopilotChatCollapsible\n v-else-if=\"display === 'turn'\"\n :open=\"workOpen ?? true\"\n class=\"cpk-tool-calls-view-turn\"\n >\n <div class=\"cpk-tool-calls-view-turn-rows\">\n <TurnRows\n :calls=\"segment.calls\"\n :active=\"groupActive(segment.trailing)\"\n >\n <component\n :is=\"renderCall(call)\"\n v-for=\"call in segment.calls\"\n :key=\"call.toolCall.id\"\n />\n </TurnRows>\n </div>\n </CopilotChatCollapsible>\n <slot\n v-else\n name=\"tool-calls-group\"\n :calls=\"segment.calls\"\n :appearance=\"appearance\"\n :is-active=\"groupActive(segment.trailing)\"\n :render-call=\"renderCall\"\n >\n <CopilotChatToolCallGroup\n :calls=\"segment.calls\"\n :appearance=\"appearance\"\n :is-active=\"groupActive(segment.trailing)\"\n >\n <template #call=\"{ call }\">\n <component :is=\"renderCall(call)\" />\n </template>\n </CopilotChatToolCallGroup>\n </slot>\n </template>\n </template>\n</template>\n","import { defineComponent, h, inject } from \"vue\";\nimport type { FunctionalComponent } from \"vue\";\nimport { CopilotChatCollapsible } from \"./tool-call-group-parts\";\nimport { ToolCallDisplayContextKey } from \"./tool-call-display-context\";\n\n/**\n * Folds its content away with a reply's work in the `\"turn\"` display. Without\n * `open` (any other display) it renders the content as is.\n * @internal\n */\nexport const TurnWorkFold: FunctionalComponent<{ open?: boolean }> = (\n props,\n { slots },\n) =>\n props.open === undefined\n ? slots.default?.()\n : h(CopilotChatCollapsible, { open: props.open }, slots);\nTurnWorkFold.props = [\"open\"];\n\n/**\n * In the `\"turn\"` tool-call display, text in a reply's working phase was\n * narration: it fades to muted once a call follows it, and folds away with the\n * rest of the work when the reply is done. The wrapper is there for every\n * message in that display, so text that turns into narration keeps its node\n * (and its place) rather than remounting.\n * @internal\n */\nexport const CopilotChatWorkText = defineComponent({\n name: \"CopilotChatWorkText\",\n props: { messageId: { type: String, required: true } },\n setup(props, { slots }) {\n const context = inject(ToolCallDisplayContextKey, null);\n return () => {\n if (context?.value.display !== \"turn\") return slots.default?.();\n const open = context.value.workTextOpen.get(props.messageId);\n return h(\n CopilotChatCollapsible,\n { open: open ?? true, class: \"cpk-assistant-message-work-text\" },\n () => [\n h(\n \"div\",\n {\n class: \"cpk-assistant-message-work-text-content\",\n \"data-work-text\": open === undefined ? \"reply\" : \"narration\",\n },\n slots.default?.(),\n ),\n ],\n );\n };\n },\n});\n","import { onBeforeUnmount, ref, watch } from \"vue\";\nimport type { CSSProperties, Ref } from \"vue\";\n\n/**\n * Positions floating UI (tooltips, popovers, menus) next to an element, the\n * way React's Radix primitives do: fixed to the viewport, flipped to the other\n * side when it does not fit, and shifted along its side to stay on screen.\n * Floating content sits in a wrapper that carries the position, so the\n * content's own enter and exit animations can use `transform`.\n * @internal\n */\n\nexport type FloatingSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type FloatingAlign = \"start\" | \"center\" | \"end\";\n\nexport interface FloatingOptions {\n side?: FloatingSide;\n align?: FloatingAlign;\n /** Distance from the reference element, in px. */\n sideOffset?: number;\n /** Shift along the side, in px, for `start` and `end`. */\n alignOffset?: number;\n /** Space kept between the content and the viewport edge, in px. */\n collisionPadding?: number;\n /** Size of an arrow drawn on the content, in px (added to the offset). */\n arrowSize?: number;\n}\n\nexport interface FloatingPlacement {\n x: number;\n y: number;\n side: FloatingSide;\n align: FloatingAlign;\n /** Room left between the reference element and the viewport edge. */\n availableWidth: number;\n availableHeight: number;\n /** The reference element's center on the content, for its arrow. */\n arrowX?: number;\n arrowY?: number;\n transformOrigin: string;\n}\n\nconst OPPOSITE: Record<FloatingSide, FloatingSide> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n};\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(Math.max(value, min), Math.max(min, max));\n\n/** Where content of `size` goes next to `reference` in a `viewport`. */\nexport function computeFloatingPlacement(\n reference: Pick<\n DOMRect,\n \"top\" | \"left\" | \"right\" | \"bottom\" | \"width\" | \"height\"\n >,\n size: { width: number; height: number },\n viewport: { width: number; height: number },\n options: FloatingOptions = {},\n): FloatingPlacement {\n const {\n side: preferredSide = \"bottom\",\n align = \"center\",\n sideOffset = 0,\n alignOffset = 0,\n collisionPadding = 0,\n arrowSize = 0,\n } = options;\n const offset = sideOffset + arrowSize;\n\n const space = (side: FloatingSide) =>\n ({\n top: reference.top,\n bottom: viewport.height - reference.bottom,\n left: reference.left,\n right: viewport.width - reference.right,\n })[side] -\n offset -\n collisionPadding;\n const needed = (side: FloatingSide) =>\n side === \"top\" || side === \"bottom\" ? size.height : size.width;\n\n let side = preferredSide;\n const opposite = OPPOSITE[preferredSide];\n if (\n space(side) < needed(side) &&\n space(opposite) >= needed(opposite) &&\n space(opposite) > space(side)\n ) {\n side = opposite;\n }\n\n const vertical = side === \"top\" || side === \"bottom\";\n let x: number;\n let y: number;\n if (vertical) {\n y =\n side === \"top\"\n ? reference.top - size.height - offset\n : reference.bottom + offset;\n x =\n align === \"start\"\n ? reference.left + alignOffset\n : align === \"end\"\n ? reference.right - size.width - alignOffset\n : reference.left + reference.width / 2 - size.width / 2;\n x = clamp(\n x,\n collisionPadding,\n viewport.width - size.width - collisionPadding,\n );\n } else {\n x =\n side === \"left\"\n ? reference.left - size.width - offset\n : reference.right + offset;\n y =\n align === \"start\"\n ? reference.top + alignOffset\n : align === \"end\"\n ? reference.bottom - size.height - alignOffset\n : reference.top + reference.height / 2 - size.height / 2;\n y = clamp(\n y,\n collisionPadding,\n viewport.height - size.height - collisionPadding,\n );\n }\n\n const arrowX = vertical\n ? clamp(reference.left + reference.width / 2 - x, 0, size.width)\n : undefined;\n const arrowY = vertical\n ? undefined\n : clamp(reference.top + reference.height / 2 - y, 0, size.height);\n const transformOrigin = vertical\n ? `${arrowX}px ${side === \"top\" ? `${size.height + arrowSize}px` : `${-arrowSize}px`}`\n : `${side === \"left\" ? `${size.width + arrowSize}px` : `${-arrowSize}px`} ${arrowY}px`;\n\n return {\n x,\n y,\n side,\n align,\n availableWidth: vertical\n ? viewport.width - 2 * collisionPadding\n : Math.max(0, space(side)),\n availableHeight: vertical\n ? Math.max(0, space(side))\n : viewport.height - 2 * collisionPadding,\n arrowX,\n arrowY,\n transformOrigin,\n };\n}\n\n/** Whether `element` is scrolled or clipped fully out of view. */\nexport function isElementClippedAway(element: Element): boolean {\n const rect = element.getBoundingClientRect();\n const view = element.ownerDocument.defaultView;\n if (!view) return false;\n let top = 0;\n let left = 0;\n let bottom = view.innerHeight;\n let right = view.innerWidth;\n for (\n let parent = element.parentElement;\n parent;\n parent = parent.parentElement\n ) {\n const { overflowX, overflowY } = view.getComputedStyle(parent);\n if (overflowX === \"visible\" && overflowY === \"visible\") continue;\n const clip = parent.getBoundingClientRect();\n top = Math.max(top, clip.top);\n left = Math.max(left, clip.left);\n bottom = Math.min(bottom, clip.bottom);\n right = Math.min(right, clip.right);\n }\n // Strict, so an element that only touches the edge still counts as shown.\n return (\n rect.bottom < top ||\n rect.top > bottom ||\n rect.right < left ||\n rect.left > right\n );\n}\n\n/**\n * Keeps `floating` placed next to `reference` while `open`: on scroll,\n * resize, and size changes of either element.\n */\nexport function useFloating(\n reference: Ref<HTMLElement | null | undefined>,\n floating: Ref<HTMLElement | null | undefined>,\n open: Ref<boolean>,\n options: () => FloatingOptions & { hideWhenDetached?: boolean },\n) {\n const placement = ref<FloatingPlacement | null>(null);\n const referenceHidden = ref(false);\n let cleanup: (() => void) | undefined;\n\n const update = () => {\n const referenceElement = reference.value;\n const floatingElement = floating.value;\n if (!referenceElement || !floatingElement) return;\n const view = floatingElement.ownerDocument.defaultView;\n if (!view) return;\n const opts = options();\n placement.value = computeFloatingPlacement(\n referenceElement.getBoundingClientRect(),\n {\n width: floatingElement.offsetWidth,\n height: floatingElement.offsetHeight,\n },\n { width: view.innerWidth, height: view.innerHeight },\n opts,\n );\n referenceHidden.value =\n !!opts.hideWhenDetached &&\n (!referenceElement.isConnected || isElementClippedAway(referenceElement));\n };\n\n const stop = () => {\n cleanup?.();\n cleanup = undefined;\n };\n\n watch(\n [open, reference, floating],\n ([isOpen, referenceElement, floatingElement]) => {\n stop();\n if (!isOpen || !referenceElement || !floatingElement) {\n if (!isOpen) placement.value = null;\n return;\n }\n update();\n const view = floatingElement.ownerDocument.defaultView;\n if (!view) return;\n let frame = 0;\n const schedule = () => {\n if (frame) return;\n frame = view.requestAnimationFrame(() => {\n frame = 0;\n update();\n });\n };\n view.addEventListener(\"scroll\", schedule, {\n capture: true,\n passive: true,\n });\n view.addEventListener(\"resize\", schedule);\n const observer =\n typeof ResizeObserver === \"undefined\"\n ? undefined\n : new ResizeObserver(schedule);\n observer?.observe(referenceElement);\n observer?.observe(floatingElement);\n cleanup = () => {\n if (frame) view.cancelAnimationFrame(frame);\n view.removeEventListener(\"scroll\", schedule, { capture: true });\n view.removeEventListener(\"resize\", schedule);\n observer?.disconnect();\n };\n },\n { flush: \"post\", immediate: true },\n );\n\n onBeforeUnmount(stop);\n\n /** Style for the wrapper around the floating content. */\n const wrapperStyle = (zIndex?: string | number): CSSProperties => {\n const current = placement.value;\n return {\n position: \"fixed\",\n left: \"0px\",\n top: \"0px\",\n minWidth: \"max-content\",\n zIndex: zIndex ?? 50,\n // Off screen until measured, as Radix does.\n transform: current\n ? `translate(${Math.round(current.x)}px, ${Math.round(current.y)}px)`\n : \"translate(0, -200%)\",\n visibility: referenceHidden.value ? \"hidden\" : undefined,\n pointerEvents: referenceHidden.value ? \"none\" : undefined,\n };\n };\n\n return { placement, referenceHidden, update, wrapperStyle };\n}\n\n/**\n * Style for an arrow wrapper on floating content, as Radix places it: on the\n * edge facing the reference element, centered on it.\n */\nexport function arrowWrapperStyle(\n placement: FloatingPlacement | null,\n): CSSProperties {\n if (!placement) return { position: \"absolute\", visibility: \"hidden\" };\n const { side, arrowX, arrowY } = placement;\n return {\n position: \"absolute\",\n left: arrowX !== undefined ? `${arrowX}px` : undefined,\n top: arrowY !== undefined ? `${arrowY}px` : undefined,\n [OPPOSITE[side]]: \"0px\",\n transformOrigin: {\n top: \"\",\n right: \"0 0\",\n bottom: \"center 0\",\n left: \"100% 0\",\n }[side],\n transform: {\n top: \"translateY(100%)\",\n right: \"translateY(50%) rotate(90deg) translateX(-50%)\",\n bottom: \"rotate(180deg)\",\n left: \"translateY(50%) rotate(-90deg) translateX(50%)\",\n }[side],\n marginLeft: arrowX !== undefined ? \"-5px\" : undefined,\n };\n}\n","import { nextTick, onBeforeUnmount, ref, watch } from \"vue\";\nimport type { Ref } from \"vue\";\n\n/**\n * Keeps closing content mounted until its exit animation ends, like Radix's\n * Presence: the content gets `data-state=\"closed\"`, and its CSS animation\n * (for example `cpk-tooltip-exit`) plays before it unmounts.\n * @internal\n */\nexport function usePresence(\n open: Ref<boolean>,\n element: Ref<HTMLElement | null | undefined>,\n) {\n const present = ref(open.value);\n let finish: (() => void) | undefined;\n\n const stopWaiting = () => {\n finish?.();\n finish = undefined;\n };\n\n watch(open, async (isOpen) => {\n stopWaiting();\n if (isOpen) {\n present.value = true;\n return;\n }\n // Let `data-state=\"closed\"` reach the DOM, so its animation starts.\n await nextTick();\n if (open.value) return;\n const node = element.value;\n const view = node?.ownerDocument.defaultView;\n const animationName = node && view?.getComputedStyle(node).animationName;\n if (!node || !view || !animationName || animationName === \"none\") {\n present.value = false;\n return;\n }\n const done = () => {\n stopWaiting();\n if (!open.value) present.value = false;\n };\n // A fallback, in case the animation is cancelled without an end event.\n const timer = view.setTimeout(done, 400);\n node.addEventListener(\"animationend\", done, { once: true });\n finish = () => {\n view.clearTimeout(timer);\n node.removeEventListener(\"animationend\", done);\n };\n });\n\n onBeforeUnmount(stopWaiting);\n\n return present;\n}\n","<script setup lang=\"ts\">\n/**\n * React's `<Tooltip>` (Radix) for Vue: a label that shows next to its trigger\n * on hover and on keyboard focus, and hides on pointer leave, blur, a click,\n * Escape, or a scroll that moves the trigger. The default slot renders the\n * trigger and must bind `triggerProps` on a focusable element.\n *\n * @internal\n */\nimport { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport type { FloatingAlign, FloatingSide } from \"./floating\";\nimport { arrowWrapperStyle, useFloating } from \"./floating\";\nimport { usePresence } from \"./presence\";\nimport { useCopilotId } from \"./use-id\";\n\nconst props = withDefaults(\n defineProps<{\n /** Text of the tooltip; the `content` slot replaces it. */\n content?: string;\n side?: FloatingSide;\n align?: FloatingAlign;\n sideOffset?: number;\n /** Hover time before it opens, in ms. Focus opens it at once. */\n delayDuration?: number;\n /** Keeps it closed, for example while the trigger's own popup shows. */\n suppressed?: boolean;\n contentClass?: string;\n }>(),\n {\n content: undefined,\n side: \"top\",\n align: \"center\",\n sideOffset: 0,\n delayDuration: 0,\n suppressed: false,\n contentClass: undefined,\n },\n);\n\ndefineSlots<{\n default(props: {\n triggerProps: Record<string, unknown>;\n open: boolean;\n }): unknown;\n content?(): unknown;\n}>();\n\n// Matches `.cpk-tooltip-arrow` (0.625rem); Radix adds it to the offset.\nconst ARROW_SIZE = 10;\n// Time the pointer has to cross from the trigger onto the tooltip.\nconst HOVER_GRACE_MS = 100;\n\nconst id = useCopilotId(\"cpk-tooltip\");\nconst wantsOpen = ref(false);\nconst open = computed(() => wantsOpen.value && !props.suppressed);\nconst trigger = ref<HTMLElement | null>(null);\nconst wrapper = ref<HTMLElement | null>(null);\nconst contentElement = ref<HTMLElement | null>(null);\nconst present = usePresence(open, contentElement);\n\nconst { placement, wrapperStyle } = useFloating(trigger, wrapper, open, () => ({\n side: props.side,\n align: props.align,\n sideOffset: props.sideOffset,\n arrowSize: ARROW_SIZE,\n}));\n\nlet openTimer: ReturnType<typeof setTimeout> | undefined;\nlet closeTimer: ReturnType<typeof setTimeout> | undefined;\nlet pointerDown = false;\n// Set once the pointer has opened it, until the pointer leaves: after a click\n// closes it, moving over the trigger again does not reopen it.\nlet pointerMoveOpened = false;\n\nconst clearTimers = () => {\n clearTimeout(openTimer);\n clearTimeout(closeTimer);\n openTimer = undefined;\n closeTimer = undefined;\n};\n\nconst show = () => {\n clearTimers();\n if (!props.suppressed) wantsOpen.value = true;\n};\n\nconst hide = () => {\n clearTimers();\n wantsOpen.value = false;\n};\n\n// A request to open while suppressed is dropped, so the tooltip does not\n// reappear when the suppression ends under a pointer that already left.\nwatch(\n () => props.suppressed,\n (suppressed) => {\n if (suppressed) hide();\n },\n);\n\nconst onPointerMove = (event: PointerEvent) => {\n if (event.pointerType === \"touch\") return;\n trigger.value = event.currentTarget as HTMLElement;\n clearTimeout(closeTimer);\n closeTimer = undefined;\n if (pointerMoveOpened || pointerDown) return;\n pointerMoveOpened = true;\n if (props.delayDuration > 0) {\n openTimer = setTimeout(show, props.delayDuration);\n } else {\n show();\n }\n};\n\nconst scheduleClose = () => {\n clearTimeout(openTimer);\n openTimer = undefined;\n clearTimeout(closeTimer);\n closeTimer = setTimeout(hide, HOVER_GRACE_MS);\n};\n\nconst onPointerLeave = (event: PointerEvent) => {\n if (event.pointerType === \"touch\") return;\n pointerMoveOpened = false;\n const next = event.relatedTarget;\n if (next instanceof Node && contentElement.value?.contains(next)) return;\n scheduleClose();\n};\n\nconst onPointerUp = () => {\n pointerDown = false;\n};\n\nconst onPointerDown = () => {\n pointerDown = true;\n document.addEventListener(\"pointerup\", onPointerUp, { once: true });\n hide();\n};\n\nconst onFocus = (event: FocusEvent) => {\n trigger.value = event.currentTarget as HTMLElement;\n if (!pointerDown) show();\n};\n\nconst triggerProps = computed(() => ({\n \"data-state\": open.value ? \"delayed-open\" : \"closed\",\n \"aria-describedby\": open.value ? id : undefined,\n onPointermove: onPointerMove,\n onPointerleave: onPointerLeave,\n onPointerdown: onPointerDown,\n onFocus,\n onBlur: hide,\n onClick: hide,\n}));\n\nconst onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") hide();\n};\n\nconst onScroll = (event: Event) => {\n const target = event.target;\n if (target instanceof Node && target.contains(trigger.value)) hide();\n};\n\nwatch(\n open,\n (isOpen) => {\n if (typeof document === \"undefined\") return;\n if (isOpen) {\n document.addEventListener(\"keydown\", onKeyDown);\n window.addEventListener(\"scroll\", onScroll, { capture: true });\n } else {\n document.removeEventListener(\"keydown\", onKeyDown);\n window.removeEventListener(\"scroll\", onScroll, { capture: true });\n }\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n clearTimers();\n if (typeof document === \"undefined\") return;\n document.removeEventListener(\"keydown\", onKeyDown);\n document.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"scroll\", onScroll, { capture: true });\n});\n\nconst contentStyle = computed(() => ({\n \"--radix-tooltip-content-transform-origin\":\n placement.value?.transformOrigin ?? \"center\",\n}));\n</script>\n\n<template>\n <slot :trigger-props=\"triggerProps\" :open=\"open\" />\n <Teleport to=\"body\">\n <div\n v-if=\"present\"\n ref=\"wrapper\"\n data-radix-popper-content-wrapper\n :style=\"wrapperStyle()\"\n >\n <div\n :id=\"id\"\n ref=\"contentElement\"\n data-copilotkit\n data-slot=\"tooltip-content\"\n role=\"tooltip\"\n class=\"cpk-tooltip\"\n :class=\"contentClass\"\n :data-state=\"open ? 'delayed-open' : 'closed'\"\n :data-side=\"placement?.side ?? side\"\n :data-align=\"placement?.align ?? align\"\n :style=\"contentStyle\"\n @pointerenter=\"clearTimers\"\n @pointerleave=\"scheduleClose\"\n >\n <slot name=\"content\">\n <p>{{ content }}</p>\n </slot>\n <span :style=\"arrowWrapperStyle(placement)\">\n <svg\n class=\"cpk-tooltip-arrow\"\n width=\"10\"\n height=\"5\"\n viewBox=\"0 0 30 10\"\n preserveAspectRatio=\"none\"\n aria-hidden=\"true\"\n style=\"display: block\"\n >\n <polygon points=\"0,0 30,0 15,10\" />\n </svg>\n </span>\n </div>\n </div>\n </Teleport>\n</template>\n","<script setup lang=\"ts\">\n/**\n * React's `CopilotChatAssistantMessage.ToolbarButton`: an icon button named by\n * `label`, with the label as its tooltip. While the button's own popup is\n * open (`aria-expanded=\"true\"`), the popup replaces the tooltip: an open\n * tooltip closes, and it does not reappear when the popup closes under a\n * pointer that left.\n *\n * @internal\n */\nimport { computed, mergeProps, useAttrs } from \"vue\";\nimport CopilotTooltip from \"../ui/CopilotTooltip.vue\";\n\ndefineOptions({ inheritAttrs: false });\n\ndefineProps<{ label: string }>();\n\ndefineSlots<{ default(): unknown; tooltip?(): unknown }>();\n\nconst attrs = useAttrs();\nconst popupOpen = computed(\n () => attrs[\"aria-expanded\"] === true || attrs[\"aria-expanded\"] === \"true\",\n);\n\n// Styles live in @copilotkit/core (ui/button.css, assistant-message.css).\nconst buttonClass =\n \"cpk-button cpk-button-assistant-message-toolbar cpk-button-size-default\";\n</script>\n\n<template>\n <CopilotTooltip :content=\"label\" side=\"bottom\" :suppressed=\"popupOpen\">\n <template #default=\"{ triggerProps }\">\n <button\n type=\"button\"\n :class=\"buttonClass\"\n :aria-label=\"label\"\n v-bind=\"mergeProps(triggerProps, $attrs)\"\n >\n <slot />\n </button>\n </template>\n <template v-if=\"$slots.tooltip\" #content>\n <slot name=\"tooltip\" />\n </template>\n </CopilotTooltip>\n</template>\n","<script setup lang=\"ts\">\n/**\n * React's `<PopoverContent>` (Radix, non-modal) for Vue: content in a portal\n * next to an anchor element, so it floats over the page instead of taking\n * room in the layout. Escape, a pointer down outside, and focus moving\n * outside dismiss it, unless the handler of `escape-key-down` or\n * `interact-outside` calls `preventDefault()`. It does not move focus by\n * itself; the parent decides where focus goes.\n *\n * @internal\n */\nimport { computed, onBeforeUnmount, ref, toRef, watch } from \"vue\";\nimport type { FloatingAlign, FloatingSide } from \"./floating\";\nimport { useFloating } from \"./floating\";\nimport { usePresence } from \"./presence\";\nimport { useCopilotId } from \"./use-id\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(\n defineProps<{\n open: boolean;\n /** The element the content points at. */\n anchor: HTMLElement | null;\n side?: FloatingSide;\n align?: FloatingAlign;\n sideOffset?: number;\n collisionPadding?: number;\n /** Hides the content while its anchor is scrolled out of view. */\n hideWhenDetached?: boolean;\n }>(),\n {\n side: \"bottom\",\n align: \"start\",\n sideOffset: 6,\n collisionPadding: 0,\n hideWhenDetached: false,\n },\n);\n\nconst emit = defineEmits<{\n /** Escape was pressed while it was open. */\n \"escape-key-down\": [event: KeyboardEvent];\n /** A pointer down or focus outside it. */\n \"interact-outside\": [event: Event];\n /** It should close: the events above were not prevented. */\n dismiss: [];\n}>();\n\ndefineSlots<{ default(): unknown }>();\n\nconst id = useCopilotId(\"cpk-popover\");\nconst wrapper = ref<HTMLElement | null>(null);\nconst content = ref<HTMLElement | null>(null);\nconst open = toRef(props, \"open\");\nconst anchor = toRef(props, \"anchor\");\nconst present = usePresence(open, content);\n\nconst { placement, wrapperStyle } = useFloating(anchor, wrapper, open, () => ({\n side: props.side,\n align: props.align,\n sideOffset: props.sideOffset,\n collisionPadding: props.collisionPadding,\n hideWhenDetached: props.hideWhenDetached,\n}));\n\nconst isInside = (target: EventTarget | null) =>\n target instanceof Node && !!content.value?.contains(target);\n\nconst onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return;\n emit(\"escape-key-down\", event);\n if (!event.defaultPrevented) emit(\"dismiss\");\n};\n\nconst onOutside = (event: Event) => {\n if (isInside(event.target)) return;\n emit(\"interact-outside\", event);\n if (!event.defaultPrevented) emit(\"dismiss\");\n};\n\nconst listen = (on: boolean) => {\n if (typeof document === \"undefined\") return;\n // Capture, as Radix does, so a handler can stop Escape from also reaching\n // a chat popup's own Escape listener.\n if (on) {\n document.addEventListener(\"keydown\", onKeyDown, { capture: true });\n document.addEventListener(\"pointerdown\", onOutside, { capture: true });\n document.addEventListener(\"focusin\", onOutside, { capture: true });\n } else {\n document.removeEventListener(\"keydown\", onKeyDown, { capture: true });\n document.removeEventListener(\"pointerdown\", onOutside, { capture: true });\n document.removeEventListener(\"focusin\", onOutside, { capture: true });\n }\n};\n\nwatch(open, (isOpen) => listen(isOpen), { immediate: true });\nonBeforeUnmount(() => listen(false));\n\nconst contentStyle = computed(() => ({\n \"--radix-popover-content-transform-origin\":\n placement.value?.transformOrigin ?? \"center\",\n \"--radix-popover-content-available-height\": placement.value\n ? `${placement.value.availableHeight}px`\n : undefined,\n}));\n\ndefineExpose({ content });\n</script>\n\n<template>\n <Teleport to=\"body\">\n <div\n v-if=\"present\"\n ref=\"wrapper\"\n data-radix-popper-content-wrapper\n :style=\"wrapperStyle()\"\n >\n <div\n :id=\"id\"\n ref=\"content\"\n role=\"dialog\"\n tabindex=\"-1\"\n data-copilotkit\n data-copilotkit-popover\n data-slot=\"popover-content\"\n class=\"cpk-popover\"\n :data-state=\"open ? 'open' : 'closed'\"\n :data-side=\"placement?.side ?? side\"\n :data-align=\"placement?.align ?? align\"\n :style=\"contentStyle\"\n v-bind=\"$attrs\"\n >\n <slot />\n </div>\n </div>\n </Teleport>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The comment popover of a rated message, pointing at the chosen thumb, as in\n * React's `FeedbackCommentPopover`.\n *\n * The popover lives in a portal, so it keeps keyboard order by hand: Shift+Tab\n * from its start returns to the thumb, Tab from its end moves on to the\n * control after the thumb, and Enter or Escape inside it returns to the thumb.\n *\n * @internal\n */\nimport { computed, nextTick, ref, watch } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { ɵMESSAGE_FEEDBACK_MAX_COMMENT_LENGTH as MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH } from \"@copilotkit/core\";\nimport type { ɵMessageFeedbackRating as MessageFeedbackRating } from \"@copilotkit/core\";\nimport CopilotPopover from \"../ui/CopilotPopover.vue\";\nimport { IconArrowUp } from \"../icons\";\nimport type { FeedbackComment } from \"./message-feedback\";\nimport type { CopilotChatAssistantMessageFeedbackCommentSlotProps } from \"./types\";\n\nconst props = defineProps<{\n comment: FeedbackComment;\n savedComment: string;\n rating: MessageFeedbackRating;\n anchor: HTMLElement | null;\n messageId: string;\n}>();\n\ndefineSlots<{\n \"feedback-comment\"?: (\n props: CopilotChatAssistantMessageFeedbackCommentSlotProps,\n ) => unknown;\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst popover = ref<{ content: HTMLElement | null } | null>(null);\nconst contentElement = () => popover.value?.content ?? null;\n\n// Elements Tab stops at.\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]\",\n]\n .map((selector) => `${selector}:not([tabindex=\"-1\"])`)\n .join(\", \");\n\n/** Approximately the element Tab reaches after `element`, outside `skip`. */\nfunction nextFocusable(\n element: Element,\n skip: Element | null,\n): HTMLElement | null {\n const all = Array.from(\n element.ownerDocument.querySelectorAll<HTMLElement>(FOCUSABLE),\n ).filter(\n (candidate) =>\n candidate === element ||\n (!skip?.contains(candidate) && !candidate.closest(\"[hidden], [inert]\")),\n );\n const index = all.indexOf(element as HTMLElement);\n return index === -1 ? null : (all[index + 1] ?? null);\n}\n\nconst focusInside = () =>\n contentElement()?.contains(document.activeElement) ?? false;\n\n/** Whether `target` is a thumb of this message, whose click decides itself. */\nconst isOwnThumb = (target: EventTarget | null) => {\n const thumb =\n target instanceof Element\n ? target.closest(\"[data-copilotkit-rating]\")\n : null;\n return (\n thumb?.closest(\"[data-message-id]\")?.getAttribute(\"data-message-id\") ===\n props.messageId\n );\n};\n\n// A keyboard rating moves focus into the field, as the popover opens or, when\n// it was open already, as the field for the new rating renders.\nconst focusField = () => {\n const input = props.comment.input.value;\n if (input && props.comment.takeFocusRequest()) input.focus();\n};\nwatch(\n () => [props.comment.focusRequest.value, props.comment.open.value],\n async () => {\n await nextTick();\n focusField();\n },\n // Immediate: the popover mounts as it opens, after the request was made.\n { flush: \"post\", immediate: true },\n);\n\nconst setInput = (element: unknown) => {\n props.comment.input.value =\n element instanceof HTMLInputElement ? element : null;\n};\n\nconst changed = computed(\n () => props.comment.draft.value.trim() !== props.savedComment,\n);\n\nfunction onEscape(event: KeyboardEvent) {\n const returnFocus = focusInside();\n // Escape in the comment closes only the comment, not a chat popup around\n // it; with focus elsewhere it also reaches that control.\n if (returnFocus) event.stopPropagation();\n event.preventDefault();\n props.comment.close({ save: false });\n if (returnFocus) props.comment.returnFocus(props.anchor);\n}\n\nfunction onInteractOutside(event: Event) {\n // A click on a thumb removes or switches the rating, so closing must not\n // first save the draft as the answer to the rating it replaces.\n if (isOwnThumb(event.target)) event.preventDefault();\n}\n\nfunction onKeyDown(event: KeyboardEvent) {\n if (event.key !== \"Tab\") return;\n const focusables = Array.from(\n contentElement()?.querySelectorAll<HTMLElement>(FOCUSABLE) ?? [],\n );\n const leaving = event.shiftKey\n ? document.activeElement === focusables[0]\n : document.activeElement === focusables[focusables.length - 1];\n const anchor = props.anchor;\n if (!leaving || !anchor?.isConnected) return;\n event.preventDefault();\n const target = event.shiftKey\n ? anchor\n : (nextFocusable(anchor, contentElement()) ?? anchor);\n props.comment.close();\n if (target === anchor) props.comment.returnFocus(target);\n else target.focus();\n}\n\nfunction onSubmit() {\n props.comment.close();\n props.comment.returnFocus(props.anchor);\n}\n\nfunction onEditingChange(editing: boolean) {\n props.comment.setEditing(editing);\n}\n\nfunction onLeave(next: Element | null) {\n // Focus moving within the popover or to a thumb, which the pointer is\n // still on, does not close it.\n if (next && (contentElement()?.contains(next) || isOwnThumb(next))) return;\n props.comment.leave();\n}\n\nfunction onFormFocusOut(event: FocusEvent) {\n const form = event.currentTarget as HTMLElement;\n const next =\n event.relatedTarget instanceof Element ? event.relatedTarget : null;\n if (form.contains(next)) return;\n // Switching to another window is not leaving the comment.\n if (typeof document !== \"undefined\" && !document.hasFocus()) return;\n onEditingChange(false);\n onLeave(next);\n}\n\nconst slotProps = computed<CopilotChatAssistantMessageFeedbackCommentSlotProps>(\n () => ({\n value: props.comment.draft.value,\n savedComment: props.savedComment,\n inputRef: setInput,\n onChange: (value: string) => {\n props.comment.draft.value = value;\n },\n onSubmit,\n onEditingChange,\n onLeave,\n }),\n);\n</script>\n\n<template>\n <CopilotPopover\n ref=\"popover\"\n :open=\"comment.open.value\"\n :anchor=\"anchor\"\n side=\"bottom\"\n :collision-padding=\"8\"\n hide-when-detached\n :aria-label=\"labels.assistantMessageFeedbackCommentPlaceholder\"\n data-copilotkit-ignore\n class=\"cpk-assistant-message-feedback-popover\"\n @dismiss=\"comment.close()\"\n @escape-key-down=\"onEscape\"\n @interact-outside=\"onInteractOutside\"\n @keydown=\"onKeyDown\"\n @pointerenter=\"comment.enter('pointer')\"\n @pointerleave=\"comment.leave('pointer')\"\n >\n <!-- Keyed on the rating, so a new rating starts with a fresh field. -->\n <template v-for=\"key in [rating]\" :key=\"key\">\n <slot name=\"feedback-comment\" v-bind=\"slotProps\">\n <form\n data-testid=\"copilot-feedback-comment\"\n class=\"cpk-assistant-message-feedback-comment\"\n @submit.prevent=\"onSubmit\"\n @focusin=\"onEditingChange(true)\"\n @focusout=\"onFormFocusOut\"\n >\n <input\n :ref=\"setInput\"\n :value=\"comment.draft.value\"\n :maxlength=\"MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH\"\n :placeholder=\"labels.assistantMessageFeedbackCommentPlaceholder\"\n :aria-label=\"labels.assistantMessageFeedbackCommentPlaceholder\"\n class=\"cpk-assistant-message-feedback-comment-input\"\n @input=\"\n comment.draft.value = ($event.target as HTMLInputElement).value\n \"\n />\n <button\n v-if=\"changed\"\n type=\"submit\"\n class=\"cpk-button cpk-button-assistant-message-toolbar cpk-button-size-default\"\n :aria-label=\"labels.assistantMessageFeedbackCommentSubmitLabel\"\n :title=\"labels.assistantMessageFeedbackCommentSubmitLabel\"\n >\n <IconArrowUp\n class=\"cpk-assistant-message-feedback-comment-submit-icon\"\n />\n </button>\n </form>\n </slot>\n </template>\n </CopilotPopover>\n</template>\n","<script setup lang=\"ts\">\n/**\n * React's `<DropdownMenuContent>` and `<DropdownMenuSubContent>` (Radix) for\n * Vue, drawn from a list of entries: items, separators, and submenus. It is\n * teleported to `document.body` and positioned next to `anchor`.\n *\n * Keyboard: ArrowUp/ArrowDown move between items, Home/End jump, typing\n * jumps to the next item that starts with the typed text, Enter/Space\n * activate, ArrowRight/Enter/Space open a submenu and ArrowLeft closes it,\n * Escape and Tab close the whole menu. Hovering an item focuses it; hovering\n * a submenu trigger opens its submenu.\n *\n * @internal\n */\nimport { computed, nextTick, onBeforeUnmount, ref, toRef, watch } from \"vue\";\nimport type { ComponentPublicInstance } from \"vue\";\nimport { IconChevronRight } from \"../icons\";\nimport type { FloatingAlign, FloatingSide } from \"./floating\";\nimport { useFloating } from \"./floating\";\nimport { usePresence } from \"./presence\";\nimport { useCopilotId } from \"./use-id\";\nimport type {\n CopilotDropdownMenuDismissReason,\n CopilotDropdownMenuEntry,\n CopilotDropdownMenuItem,\n} from \"./dropdown-menu\";\n\ndefineOptions({ name: \"CopilotDropdownMenuContent\", inheritAttrs: false });\n\nconst props = withDefaults(\n defineProps<{\n open: boolean;\n anchor: HTMLElement | null;\n items: CopilotDropdownMenuEntry[];\n /** Shared by a menu and its submenus, to tell inside from outside. */\n menuId: string;\n id?: string;\n labelledBy?: string;\n side?: FloatingSide;\n align?: FloatingAlign;\n sideOffset?: number;\n /** Where focus goes when it opens. */\n initialFocus?: \"first\" | \"last\" | \"content\" | \"none\";\n /** A submenu, drawn with `.cpk-dropdown-menu-sub-content`. */\n sub?: boolean;\n }>(),\n {\n id: undefined,\n labelledBy: undefined,\n side: \"bottom\",\n align: \"start\",\n sideOffset: 4,\n initialFocus: \"content\",\n sub: false,\n },\n);\n\nconst emit = defineEmits<{\n /** An item was chosen; the menu should close and run it. */\n select: [item: CopilotDropdownMenuItem];\n /** The whole menu should close. */\n dismiss: [reason: CopilotDropdownMenuDismissReason];\n /** ArrowLeft in a submenu: close it and focus its trigger. */\n \"close-sub\": [];\n /** The pointer reached this content. */\n \"pointer-enter\": [];\n /** The pointer left this content. */\n \"pointer-leave\": [];\n}>();\n\ndefineSlots<{\n /** Content before the items, such as a label. */\n header?: () => unknown;\n /** The content of an item; defaults to its label. */\n item?: (props: { item: CopilotDropdownMenuItem }) => unknown;\n}>();\n\n// Radix waits this long on a submenu trigger before opening it on hover.\nconst SUB_OPEN_DELAY_MS = 100;\n// Time the pointer has to cross from a submenu trigger onto its submenu.\nconst SUB_GRACE_MS = 300;\n// Type-ahead text resets after this long without typing.\nconst TYPEAHEAD_RESET_MS = 1000;\n\nconst generatedId = useCopilotId(\"cpk-menu\");\nconst contentId = computed(() => props.id ?? generatedId);\nconst wrapper = ref<HTMLElement | null>(null);\nconst content = ref<HTMLElement | null>(null);\nconst itemElements = ref<(HTMLElement | null)[]>([]);\nconst open = toRef(props, \"open\");\nconst anchor = toRef(props, \"anchor\");\nconst present = usePresence(open, content);\nconst openSub = ref<number | null>(null);\nconst subInitialFocus = ref<\"first\" | \"none\">(\"none\");\nconst highlighted = ref<number | null>(null);\n\nconst { placement, wrapperStyle } = useFloating(anchor, wrapper, open, () => ({\n side: props.side,\n align: props.align,\n sideOffset: props.sideOffset,\n}));\n\nconst isGroup = (\n entry: CopilotDropdownMenuEntry,\n): entry is CopilotDropdownMenuItem & {\n items: CopilotDropdownMenuEntry[];\n} => entry !== \"-\" && Array.isArray(entry.items) && entry.items.length > 0;\n\nconst setItemElement = (\n index: number,\n element: Element | ComponentPublicInstance | null,\n) => {\n itemElements.value[index] = element instanceof HTMLElement ? element : null;\n};\n\nconst focusableIndexes = () =>\n props.items.flatMap((entry, index) =>\n entry !== \"-\" && itemElements.value[index] ? [index] : [],\n );\n\nconst focusItem = (index: number | undefined) => {\n if (index === undefined) return;\n itemElements.value[index]?.focus();\n};\n\nconst focusedIndex = () => {\n const active = document.activeElement;\n const index = itemElements.value.findIndex((element) => element === active);\n return index === -1 ? null : index;\n};\n\nwatch(\n [open, content],\n async ([isOpen, element]) => {\n if (!isOpen || !element) {\n if (!isOpen) openSub.value = null;\n return;\n }\n await nextTick();\n const indexes = focusableIndexes();\n if (props.initialFocus === \"first\") focusItem(indexes[0]);\n else if (props.initialFocus === \"last\") focusItem(indexes.at(-1));\n else if (props.initialFocus === \"content\") element.focus();\n },\n { flush: \"post\" },\n);\n\nlet subOpenTimer: ReturnType<typeof setTimeout> | undefined;\nlet graceUntil = 0;\n\nconst clearSubTimer = () => {\n clearTimeout(subOpenTimer);\n subOpenTimer = undefined;\n};\n\nconst openSubmenu = (index: number, focus: \"first\" | \"none\") => {\n clearSubTimer();\n subInitialFocus.value = focus;\n openSub.value = index;\n};\n\nconst closeSubmenu = () => {\n clearSubTimer();\n openSub.value = null;\n};\n\nconst onSubClosedByKey = (index: number) => {\n closeSubmenu();\n focusItem(index);\n};\n\nlet typeahead = \"\";\nlet typeaheadTimer: ReturnType<typeof setTimeout> | undefined;\n\nconst labelOf = (index: number) => {\n const entry = props.items[index];\n return entry && entry !== \"-\" ? entry.label.trim().toLowerCase() : \"\";\n};\n\nconst runTypeahead = (key: string) => {\n clearTimeout(typeaheadTimer);\n typeahead += key.toLowerCase();\n typeaheadTimer = setTimeout(() => {\n typeahead = \"\";\n }, TYPEAHEAD_RESET_MS);\n const indexes = focusableIndexes();\n const current = focusedIndex();\n const position = current === null ? -1 : indexes.indexOf(current);\n // Repeating one letter cycles through the items that start with it; a\n // longer search may still match the focused item.\n const repeated = typeahead.split(\"\").every((c) => c === typeahead[0]);\n const search = repeated ? typeahead[0]! : typeahead;\n const start = Math.max(0, position + (repeated ? 1 : 0));\n const ordered = [...indexes.slice(start), ...indexes.slice(0, start)];\n focusItem(ordered.find((index) => labelOf(index).startsWith(search)));\n};\n\nconst activate = (index: number, focus: \"first\" | \"none\") => {\n const entry = props.items[index];\n if (!entry || entry === \"-\") return;\n if (isGroup(entry)) {\n openSubmenu(index, focus);\n return;\n }\n emit(\"select\", entry);\n};\n\nconst onKeyDown = (event: KeyboardEvent) => {\n const indexes = focusableIndexes();\n const current = focusedIndex();\n const position = current === null ? -1 : indexes.indexOf(current);\n const currentEntry = current === null ? undefined : props.items[current];\n\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n focusItem(indexes[Math.min(position + 1, indexes.length - 1)]);\n return;\n case \"ArrowUp\":\n event.preventDefault();\n focusItem(\n position === -1 ? indexes.at(-1) : indexes[Math.max(position - 1, 0)],\n );\n return;\n case \"Home\":\n case \"PageUp\":\n event.preventDefault();\n focusItem(indexes[0]);\n return;\n case \"End\":\n case \"PageDown\":\n event.preventDefault();\n focusItem(indexes.at(-1));\n return;\n case \"Enter\":\n case \" \":\n if (current === null) return;\n if (event.key === \" \" && typeahead) {\n event.preventDefault();\n runTypeahead(\" \");\n return;\n }\n event.preventDefault();\n activate(current, \"first\");\n return;\n case \"ArrowRight\":\n if (current !== null && currentEntry && isGroup(currentEntry)) {\n event.preventDefault();\n openSubmenu(current, \"first\");\n }\n return;\n case \"ArrowLeft\":\n if (props.sub) {\n event.preventDefault();\n emit(\"close-sub\");\n }\n return;\n case \"Escape\":\n event.preventDefault();\n // Escape closes only the menu, not a chat popup around it.\n event.stopPropagation();\n emit(\"dismiss\", \"escape\");\n return;\n case \"Tab\":\n event.preventDefault();\n emit(\"dismiss\", \"tab\");\n return;\n }\n\n if (\n event.key.length === 1 &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey\n ) {\n runTypeahead(event.key);\n }\n};\n\nconst onItemPointerMove = (index: number, event: PointerEvent) => {\n if (event.pointerType !== \"mouse\" && event.pointerType !== \"pen\") return;\n if (Date.now() < graceUntil && openSub.value !== index) return;\n graceUntil = 0;\n const element = itemElements.value[index];\n if (element && document.activeElement !== element) element.focus();\n const entry = props.items[index];\n if (entry && isGroup(entry)) {\n if (openSub.value !== index && subOpenTimer === undefined) {\n subOpenTimer = setTimeout(\n () => openSubmenu(index, \"none\"),\n SUB_OPEN_DELAY_MS,\n );\n }\n } else if (openSub.value !== null) {\n closeSubmenu();\n }\n};\n\nconst onItemPointerLeave = (index: number, event: PointerEvent) => {\n if (event.pointerType !== \"mouse\" && event.pointerType !== \"pen\") return;\n const entry = props.items[index];\n if (entry && isGroup(entry)) {\n clearSubTimer();\n if (openSub.value === index) {\n graceUntil = Date.now() + SUB_GRACE_MS;\n return;\n }\n }\n if (Date.now() < graceUntil) return;\n // As Radix does, focus leaves the item for the menu itself.\n if (document.activeElement === itemElements.value[index]) {\n content.value?.focus();\n }\n};\n\nconst onItemClick = (index: number) => {\n activate(index, \"none\");\n};\n\nconst onSubPointerEnter = () => {\n graceUntil = 0;\n};\n\n// The root closes on a pointer down or focus outside the menu, its\n// submenus, and its trigger, which toggles the menu itself.\nconst isInsideMenu = (target: EventTarget | null) =>\n target instanceof Element &&\n (target.closest(`[data-cpk-menu=\"${props.menuId}\"]`) !== null ||\n (props.anchor?.contains(target) ?? false));\n\nconst onOutside = (event: Event) => {\n if (!isInsideMenu(event.target)) emit(\"dismiss\", \"outside\");\n};\n\nconst listen = (on: boolean) => {\n if (props.sub || typeof document === \"undefined\") return;\n const method = on ? \"addEventListener\" : \"removeEventListener\";\n document[method](\"pointerdown\", onOutside, { capture: true });\n document[method](\"focusin\", onOutside, { capture: true });\n};\n\nwatch(open, (isOpen) => listen(isOpen), { immediate: true });\n\nonBeforeUnmount(() => {\n listen(false);\n clearSubTimer();\n clearTimeout(typeaheadTimer);\n});\n\nconst contentStyle = computed(() => ({\n outline: \"none\",\n \"--radix-dropdown-menu-content-transform-origin\":\n placement.value?.transformOrigin ?? \"center\",\n \"--radix-dropdown-menu-content-available-height\": placement.value\n ? `${placement.value.availableHeight}px`\n : undefined,\n}));\n\nconst subId = (index: number) => `${contentId.value}-sub-${index}`;\n</script>\n\n<template>\n <Teleport to=\"body\">\n <div\n v-if=\"present\"\n ref=\"wrapper\"\n data-radix-popper-content-wrapper\n :style=\"wrapperStyle()\"\n >\n <div\n :id=\"contentId\"\n ref=\"content\"\n data-copilotkit\n :data-cpk-menu=\"menuId\"\n :data-slot=\"sub ? 'dropdown-menu-sub-content' : 'dropdown-menu-content'\"\n :class=\"\n sub ? 'cpk-dropdown-menu-sub-content' : 'cpk-dropdown-menu-content'\n \"\n role=\"menu\"\n aria-orientation=\"vertical\"\n :aria-labelledby=\"labelledBy\"\n tabindex=\"-1\"\n :data-state=\"open ? 'open' : 'closed'\"\n :data-side=\"placement?.side ?? side\"\n :data-align=\"placement?.align ?? align\"\n :style=\"contentStyle\"\n v-bind=\"$attrs\"\n @keydown=\"onKeyDown\"\n @pointerenter=\"emit('pointer-enter')\"\n @pointerleave=\"emit('pointer-leave')\"\n >\n <slot name=\"header\" />\n <template v-for=\"(entry, index) in items\" :key=\"index\">\n <div\n v-if=\"entry === '-'\"\n role=\"separator\"\n aria-orientation=\"horizontal\"\n data-slot=\"dropdown-menu-separator\"\n class=\"cpk-dropdown-menu-separator\"\n />\n <template v-else-if=\"isGroup(entry)\">\n <div\n :id=\"`${subId(index)}-trigger`\"\n :ref=\"(element) => setItemElement(index, element)\"\n role=\"menuitem\"\n tabindex=\"-1\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"openSub === index\"\n :aria-controls=\"openSub === index ? subId(index) : undefined\"\n data-slot=\"dropdown-menu-sub-trigger\"\n class=\"cpk-dropdown-menu-sub-trigger\"\n :data-state=\"openSub === index ? 'open' : 'closed'\"\n :data-highlighted=\"highlighted === index ? '' : undefined\"\n @focus=\"highlighted = index\"\n @blur=\"highlighted = null\"\n @pointermove=\"onItemPointerMove(index, $event)\"\n @pointerleave=\"onItemPointerLeave(index, $event)\"\n @click=\"onItemClick(index)\"\n >\n {{ entry.label }}\n <IconChevronRight\n class=\"cpk-dropdown-menu-sub-trigger-icon\"\n aria-hidden=\"true\"\n />\n </div>\n <CopilotDropdownMenuContent\n :id=\"subId(index)\"\n :open=\"open && openSub === index\"\n :anchor=\"itemElements[index] ?? null\"\n :items=\"entry.items\"\n :menu-id=\"menuId\"\n :labelled-by=\"`${subId(index)}-trigger`\"\n side=\"right\"\n align=\"start\"\n :side-offset=\"0\"\n :initial-focus=\"subInitialFocus\"\n sub\n @select=\"emit('select', $event)\"\n @dismiss=\"emit('dismiss', $event)\"\n @close-sub=\"onSubClosedByKey(index)\"\n @pointer-enter=\"onSubPointerEnter\"\n />\n </template>\n <div\n v-else\n :ref=\"(element) => setItemElement(index, element)\"\n role=\"menuitem\"\n tabindex=\"-1\"\n data-slot=\"dropdown-menu-item\"\n data-variant=\"default\"\n :class=\"['cpk-dropdown-menu-item', entry.class]\"\n :data-highlighted=\"highlighted === index ? '' : undefined\"\n @focus=\"highlighted = index\"\n @blur=\"highlighted = null\"\n @pointermove=\"onItemPointerMove(index, $event)\"\n @pointerleave=\"onItemPointerLeave(index, $event)\"\n @click=\"onItemClick(index)\"\n >\n <slot name=\"item\" :item=\"entry\">{{ entry.label }}</slot>\n </div>\n </template>\n </div>\n </div>\n </Teleport>\n</template>\n","import { ɵinspectorShortcuts } from \"@copilotkit/core\";\nimport { onBeforeUnmount, readonly, ref } from \"vue\";\nimport type { Ref } from \"vue\";\n\n/**\n * Whether the user hid the Inspector buttons in the message toolbars (\"Hide\n * this icon\"), until the page reloads. Core's `ɵinspectorShortcuts` holds\n * the page-lifetime preference.\n * @internal\n */\nexport function useInspectorShortcutsHidden(): Readonly<Ref<boolean>> {\n const hidden = ref(ɵinspectorShortcuts.hidden);\n const unsubscribe = ɵinspectorShortcuts.subscribe(() => {\n hidden.value = ɵinspectorShortcuts.hidden;\n });\n onBeforeUnmount(unsubscribe);\n return readonly(hidden);\n}\n\n/** Hides the Inspector buttons of every message until the page reloads. */\nexport function hideInspectorShortcuts(): void {\n ɵinspectorShortcuts.hide();\n}\n\n/** @internal Shows the buttons again, so each test starts fresh. */\nexport function ɵresetInspectorShortcuts(): void {\n ɵinspectorShortcuts.reset();\n}\n","<script setup lang=\"ts\">\n/**\n * React's `CopilotChatInspectorButton`: the Inspector shortcut in the\n * assistant message toolbar. A click (or Enter or Space) opens the message in\n * the Inspector. Hovering the button, or ArrowDown, shows a menu that\n * explains it and can hide the shortcut until the page reloads.\n *\n * @internal\n */\nimport { computed, onBeforeUnmount, ref, shallowRef } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { IconEyeOff, IconWrench } from \"../icons\";\nimport CopilotDropdownMenuContent from \"../ui/CopilotDropdownMenuContent.vue\";\nimport type {\n CopilotDropdownMenuDismissReason,\n CopilotDropdownMenuEntry,\n CopilotDropdownMenuItem,\n} from \"../ui/dropdown-menu\";\nimport CopilotTooltip from \"../ui/CopilotTooltip.vue\";\nimport { useCopilotId } from \"../ui/use-id\";\nimport { hideInspectorShortcuts } from \"./inspector-shortcuts\";\nimport {\n ɵHoverMenuController,\n ɵinspectorKiteFill,\n ɵinspectorKiteIcon,\n} from \"@copilotkit/core\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = defineProps<{\n /** Name of the menu item that inspects; defaults to the label. */\n title?: string;\n disabled?: boolean;\n}>();\n\nconst emit = defineEmits<{ click: [] }>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst menuId = useCopilotId(\"cpk-inspector-menu\");\nconst triggerId = useCopilotId(\"cpk-inspector-button\");\nconst kiteId = useCopilotId(\"cpk-inspector-kite\");\nconst trigger = shallowRef<HTMLButtonElement | null>(null);\nconst initialFocus = ref<\"first\" | \"none\">(\"none\");\nconst menu = new ɵHoverMenuController();\nconst menuState = shallowRef(menu.getSnapshot());\nconst unsubscribeMenu = menu.subscribe(() => {\n menuState.value = menu.getSnapshot();\n});\nonBeforeUnmount(() => {\n unsubscribeMenu();\n menu.dispose();\n});\nconst open = computed(() => menuState.value.open);\nconst dark = computed(() => menuState.value.dark);\nconst { cancelClose, scheduleClose, keyboardUsed } = menu;\nconst changeOpen = (next: boolean) => menu.setOpen(next, trigger.value);\n\nconst items = computed<CopilotDropdownMenuEntry[]>(() => [\n {\n label: props.title || labels.value.assistantMessageToolbarInspectorLabel,\n action: () => emit(\"click\"),\n class: \"cpk-inspector-button-menu-item cpk-inspector-button-inspect-item\",\n },\n {\n label: labels.value.assistantMessageToolbarInspectorHideLabel,\n action: hideInspectorShortcuts,\n class: \"cpk-inspector-button-menu-item cpk-inspector-button-hide-item\",\n },\n]);\n\nconst isInspectItem = (item: CopilotDropdownMenuItem) =>\n item === items.value[0];\n\nfunction onPointerEnter(event: PointerEvent) {\n if (props.disabled || event.pointerType === \"touch\") return;\n initialFocus.value = \"none\";\n menu.pointerEnter({ pointerType: event.pointerType, trigger: trigger.value });\n}\n\nfunction onClick() {\n changeOpen(false);\n emit(\"click\");\n}\n\nfunction onKeyDown(event: KeyboardEvent) {\n keyboardUsed();\n if (event.key === \"Enter\" || event.key === \" \") {\n // Enter and Space inspect, as a click does, instead of opening the menu.\n event.preventDefault();\n onClick();\n } else if (event.key === \"ArrowDown\") {\n event.preventDefault();\n initialFocus.value = \"first\";\n if (open.value) {\n // Open already from hover: move into it.\n changeOpen(false);\n queueMicrotask(() => changeOpen(true));\n } else {\n changeOpen(true);\n }\n }\n}\n\nfunction onSelect(item: CopilotDropdownMenuItem) {\n const returnFocus = !menu.openedByHover;\n changeOpen(false);\n item.action?.();\n if (returnFocus && !isInspectItem(item)) trigger.value?.focus();\n}\n\nfunction onDismiss(reason: CopilotDropdownMenuDismissReason) {\n const returnFocus = !menu.openedByHover && reason !== \"outside\";\n changeOpen(false);\n if (returnFocus) trigger.value?.focus();\n}\n\nconst ariaLabel = computed(\n () =>\n `${labels.value.assistantMessageToolbarInspectorTitle} (${labels.value.assistantMessageToolbarInspectorLocalOnlyLabel.toLowerCase()})`,\n);\n\nconst descriptionFor = (item: CopilotDropdownMenuItem) =>\n isInspectItem(item)\n ? labels.value.assistantMessageToolbarInspectorDescription\n : labels.value.assistantMessageToolbarInspectorHideDescription;\n</script>\n\n<template>\n <button\n :id=\"triggerId\"\n ref=\"trigger\"\n v-bind=\"$attrs\"\n type=\"button\"\n :disabled=\"disabled\"\n data-testid=\"copilot-inspector-button\"\n class=\"cpk-button cpk-button-assistant-message-toolbar cpk-button-size-icon cpk-inspector-button\"\n :aria-label=\"ariaLabel\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"open ? menuId : undefined\"\n :data-state=\"open ? 'open' : 'closed'\"\n @pointerenter=\"onPointerEnter\"\n @pointerleave=\"scheduleClose\"\n @pointerdown.prevent\n @click=\"onClick\"\n @keydown=\"onKeyDown\"\n >\n <IconWrench\n aria-hidden=\"true\"\n class=\"cpk-inspector-button-icon\"\n data-testid=\"copilot-inspector-icon\"\n />\n </button>\n <CopilotDropdownMenuContent\n :id=\"menuId\"\n :open=\"open\"\n :anchor=\"trigger\"\n :items=\"items\"\n :menu-id=\"menuId\"\n :labelled-by=\"triggerId\"\n side=\"top\"\n align=\"start\"\n :side-offset=\"6\"\n :initial-focus=\"initialFocus\"\n class=\"cpk-inspector-button-menu\"\n :class=\"{ dark }\"\n @select=\"onSelect\"\n @dismiss=\"onDismiss\"\n @pointer-enter=\"cancelClose\"\n @pointer-leave=\"scheduleClose\"\n @keydown=\"keyboardUsed\"\n >\n <template #header>\n <div\n data-slot=\"dropdown-menu-label\"\n class=\"cpk-dropdown-menu-label cpk-inspector-button-menu-header\"\n >\n <span class=\"cpk-inspector-button-menu-title\">\n {{ labels.assistantMessageToolbarInspectorTitle }}\n </span>\n <CopilotTooltip\n :content=\"labels.assistantMessageToolbarInspectorLocalOnlyDescription\"\n side=\"top\"\n :side-offset=\"6\"\n :delay-duration=\"1000\"\n :content-class=\"\n dark\n ? 'cpk-inspector-button-local-tooltip dark'\n : 'cpk-inspector-button-local-tooltip'\n \"\n >\n <template #default=\"{ triggerProps }\">\n <span\n tabindex=\"0\"\n class=\"cpk-inspector-button-local-badge\"\n v-bind=\"triggerProps\"\n >\n {{ labels.assistantMessageToolbarInspectorLocalOnlyLabel }}\n </span>\n </template>\n <template #content>\n {{ labels.assistantMessageToolbarInspectorLocalOnlyDescription }}\n </template>\n </CopilotTooltip>\n </div>\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n data-slot=\"dropdown-menu-separator\"\n class=\"cpk-dropdown-menu-separator\"\n />\n </template>\n <template #item=\"{ item }\">\n <!-- Matches the Inspector launcher artwork in web-inspector/src/assets/inspector-logo-kite.svg. -->\n <svg\n v-if=\"isInspectItem(item)\"\n aria-hidden=\"true\"\n class=\"cpk-inspector-button-kite-icon cpk-inspector-button-menu-item-icon\"\n :viewBox=\"ɵinspectorKiteIcon.viewBox\"\n fill=\"none\"\n >\n <path\n v-for=\"path in ɵinspectorKiteIcon.paths\"\n :key=\"path.d\"\n :d=\"path.d\"\n :fill=\"ɵinspectorKiteFill(kiteId, path)\"\n :stroke=\"path.stroke\"\n :stroke-width=\"path.strokeWidth\"\n :stroke-linecap=\"path.strokeLinecap\"\n />\n <defs>\n <linearGradient\n v-for=\"gradient in ɵinspectorKiteIcon.gradients\"\n :id=\"`${kiteId}-${gradient.id}`\"\n :key=\"gradient.id\"\n :x1=\"gradient.x1\"\n :y1=\"gradient.y1\"\n :x2=\"gradient.x2\"\n :y2=\"gradient.y2\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop\n v-for=\"stop in gradient.stops\"\n :key=\"`${stop.offset ?? '0'}-${stop.color}`\"\n :offset=\"stop.offset\"\n :stop-color=\"stop.color\"\n />\n </linearGradient>\n </defs>\n </svg>\n <IconEyeOff\n v-else\n aria-hidden=\"true\"\n class=\"cpk-inspector-button-menu-item-icon\"\n />\n <span>\n <span class=\"cpk-inspector-button-menu-item-label\">{{\n item.label\n }}</span>\n <span class=\"cpk-inspector-button-menu-item-description\">{{\n descriptionFor(item)\n }}</span>\n </span>\n </template>\n </CopilotDropdownMenuContent>\n</template>\n","import type { AssistantMessage } from \"@ag-ui/core\";\nimport type { CopilotKitCore } from \"@copilotkit/core\";\nimport {\n ɵFeedbackCommentController,\n ɵgetMessageFeedbackControls,\n ɵisLearningFeedbackEnabled,\n ɵsubscribeToLearningFeedbackEnabled,\n ɵsubscribeToMessageFeedback,\n} from \"@copilotkit/core\";\nimport type {\n ɵMessageFeedbackControls,\n ɵMessageFeedbackScope,\n} from \"@copilotkit/core\";\nimport { computed, inject, onBeforeUnmount, ref, shallowRef, watch } from \"vue\";\nimport type {\n ComputedRef,\n InjectionKey,\n Ref,\n ShallowRef,\n WritableComputedRef,\n} from \"vue\";\n\n/** The chat whose assistant messages collect feedback for Learning. */\nexport type MessageFeedbackScope = ɵMessageFeedbackScope;\n\n/** Current feedback for one assistant message, and how to change it. */\nexport type MessageFeedbackControls = ɵMessageFeedbackControls;\n\n/**\n * Provided by the message view while Learning is on for this chat. Assistant\n * messages without it show thumbs only when the app passes its own handlers\n * or thumb slots.\n * @internal\n */\nexport const MessageFeedbackScopeKey: InjectionKey<\n Ref<MessageFeedbackScope | null>\n> = Symbol(\"CopilotMessageFeedbackScope\");\n\n/**\n * Whether the thumbs record feedback for Learning. See core's\n * `ɵisLearningFeedbackEnabled` for the rules.\n * @internal\n */\nexport function useLearningFeedbackEnabled(\n copilotkit: Ref<CopilotKitCore>,\n): ComputedRef<boolean> {\n const enabled = ref(false);\n watch(\n copilotkit,\n (core, _previous, onCleanup) => {\n const read = () => {\n enabled.value = ɵisLearningFeedbackEnabled(core);\n };\n read();\n onCleanup(ɵsubscribeToLearningFeedbackEnabled(core, read));\n },\n { immediate: true },\n );\n return computed(() => enabled.value);\n}\n\n/** Feedback controls for `message`, or `null` when this chat collects none. */\nexport function useMessageFeedback(\n message: Ref<AssistantMessage>,\n): ComputedRef<MessageFeedbackControls | null> {\n const scope = inject(MessageFeedbackScopeKey, ref(null));\n // Bumped by the store whenever a rating in this Thread changes.\n const version = ref(0);\n\n watch(\n scope,\n (current, _previous, onCleanup) => {\n if (!current) return;\n onCleanup(\n ɵsubscribeToMessageFeedback(current.agentId, current.threadId, () => {\n version.value++;\n }),\n );\n },\n { immediate: true },\n );\n\n return computed(() => {\n const current = scope.value;\n if (!current) return null;\n void version.value;\n return ɵgetMessageFeedbackControls(current, message.value);\n });\n}\n\n/** The comment popover of one rated message: when it shows and what it holds. */\nexport interface FeedbackComment {\n readonly open: ComputedRef<boolean>;\n /** The comment being edited. */\n readonly draft: WritableComputedRef<string>;\n /** Grows each time the field should take focus: after a keyboard rating. */\n readonly focusRequest: ComputedRef<number>;\n /** Whether a focus request waits; reading it answers the request. */\n readonly takeFocusRequest: () => boolean;\n /** The comment field, for moving focus into it. */\n readonly input: ShallowRef<HTMLInputElement | null>;\n /** Opens with `comment` in the field. */\n readonly show: ɵFeedbackCommentController[\"show\"];\n /** The pointer or focus reached the rating or the popover. */\n readonly enter: ɵFeedbackCommentController[\"enter\"];\n /**\n * It left them: close soon, unless the user is editing the comment or, when\n * focus left, the pointer is still on the rating or the popover.\n */\n readonly leave: ɵFeedbackCommentController[\"leave\"];\n /** Tracks whether focus is in the comment form. */\n readonly setEditing: (editing: boolean) => void;\n /** Closes, saving a changed comment unless `save` is false. */\n readonly close: ɵFeedbackCommentController[\"close\"];\n /** Moves focus back to the thumb without opening the comment again. */\n readonly returnFocus: (target: HTMLElement | null) => void;\n}\n\n/**\n * Drives the comment popover of a rated message with core's\n * `ɵFeedbackCommentController`, which holds the open and close rules.\n * @internal\n */\nexport function useFeedbackComment(\n controls: Ref<MessageFeedbackControls | null>,\n): FeedbackComment {\n const controller = new ɵFeedbackCommentController({\n getControls: () => controls.value,\n });\n const state = shallowRef(controller.getSnapshot());\n const unsubscribe = controller.subscribe(() => {\n state.value = controller.getSnapshot();\n });\n // A message that unmounts (scrolled out of a virtual list) keeps its edit.\n onBeforeUnmount(() => {\n controller.dispose();\n unsubscribe();\n });\n\n return {\n open: computed(() => state.value.open),\n draft: computed({\n get: () => state.value.draft,\n set: controller.setDraft,\n }),\n focusRequest: computed(() => state.value.focusRequest),\n takeFocusRequest: controller.takeFocusRequest,\n input: shallowRef<HTMLInputElement | null>(null),\n show: controller.show,\n enter: controller.enter,\n leave: controller.leave,\n setEditing: controller.setEditing,\n close: controller.close,\n returnFocus: controller.returnFocus,\n };\n}\n","import { onBeforeUnmount, readonly, ref } from \"vue\";\nimport { ɵCopyFeedback } from \"@copilotkit/core\";\n\n/**\n * The \"copied\" check mark of a copy button, from core's `ɵCopyFeedback`:\n * `copy(text)` writes to the clipboard and shows the check mark for two\n * seconds; a second copy restarts the wait.\n * @internal\n */\nexport function useCopyFeedback() {\n const feedback = new ɵCopyFeedback();\n const copied = ref(feedback.getSnapshot());\n const unsubscribe = feedback.subscribe(() => {\n copied.value = feedback.getSnapshot();\n });\n onBeforeUnmount(() => {\n unsubscribe();\n feedback.dispose();\n });\n return { copied: readonly(copied), copy: feedback.copy };\n}\n","<script setup lang=\"ts\">\nimport {\n computed,\n inject,\n onUpdated,\n ref,\n shallowRef,\n toRef,\n watch,\n} from \"vue\";\nimport type { Component } from \"vue\";\nimport type { AssistantMessage, Message } from \"@ag-ui/core\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport {\n IconCheck,\n IconCopy,\n IconRefreshCw,\n IconThumbsDown,\n IconThumbsUp,\n IconVolume2,\n} from \"../icons\";\nimport StreamingMarkdownDefault from \"./StreamingMarkdownDefault.vue\";\nimport {\n useMarkdownRenderer,\n isVueComponentRenderer,\n} from \"../../providers/markdown-renderer\";\nimport CopilotChatToolCallsView from \"./CopilotChatToolCallsView.vue\";\nimport { CopilotChatWorkText } from \"./turn-work\";\nimport CopilotChatAssistantToolbarButton from \"./CopilotChatAssistantToolbarButton.vue\";\nimport CopilotChatFeedbackCommentPopover from \"./CopilotChatFeedbackCommentPopover.vue\";\nimport CopilotChatInspectorButton from \"./CopilotChatInspectorButton.vue\";\nimport { useInspectorShortcutsHidden } from \"./inspector-shortcuts\";\nimport { InspectorKey } from \"../../providers/keys\";\nimport { useFeedbackComment, useMessageFeedback } from \"./message-feedback\";\nimport {\n ɵhasAssistantMessageText,\n ɵshouldShowAssistantToolbar,\n} from \"@copilotkit/core\";\nimport type { ɵMessageFeedbackRating as MessageFeedbackRating } from \"@copilotkit/core\";\nimport { useCopyFeedback } from \"./use-copy-feedback\";\nimport type {\n CopilotChatAssistantMessageCopyButtonSlotProps,\n CopilotChatAssistantMessageFeedbackCommentSlotProps,\n CopilotChatAssistantMessageInspectorButtonSlotProps,\n CopilotChatAssistantMessageLayoutSlotProps,\n CopilotChatAssistantMessageMessageRendererSlotProps,\n CopilotChatAssistantMessageReadAloudButtonSlotProps,\n CopilotChatAssistantMessageRegenerateButtonSlotProps,\n CopilotChatAssistantMessageThumbsDownButtonSlotProps,\n CopilotChatAssistantMessageThumbsUpButtonSlotProps,\n CopilotChatAssistantMessageToolCallsViewSlotProps,\n CopilotChatAssistantMessageToolbarSlotProps,\n} from \"./types\";\nconst props = withDefaults(\n defineProps<{\n message: AssistantMessage;\n messages?: Message[];\n isRunning?: boolean;\n toolbarVisible?: boolean;\n onThumbsUp?: (message: AssistantMessage) => void;\n onThumbsDown?: (message: AssistantMessage) => void;\n onReadAloud?: (message: AssistantMessage) => void;\n onRegenerate?: (message: AssistantMessage) => void;\n }>(),\n {\n messages: () => [],\n isRunning: false,\n toolbarVisible: true,\n },\n);\n\ndefineSlots<{\n layout?: (props: CopilotChatAssistantMessageLayoutSlotProps) => unknown;\n \"message-renderer\"?: (\n props: CopilotChatAssistantMessageMessageRendererSlotProps,\n ) => unknown;\n toolbar?: (props: CopilotChatAssistantMessageToolbarSlotProps) => unknown;\n \"copy-button\"?: (\n props: CopilotChatAssistantMessageCopyButtonSlotProps,\n ) => unknown;\n \"thumbs-up-button\"?: (\n props: CopilotChatAssistantMessageThumbsUpButtonSlotProps,\n ) => unknown;\n \"thumbs-down-button\"?: (\n props: CopilotChatAssistantMessageThumbsDownButtonSlotProps,\n ) => unknown;\n \"read-aloud-button\"?: (\n props: CopilotChatAssistantMessageReadAloudButtonSlotProps,\n ) => unknown;\n \"regenerate-button\"?: (\n props: CopilotChatAssistantMessageRegenerateButtonSlotProps,\n ) => unknown;\n \"tool-calls-view\"?: (\n props: CopilotChatAssistantMessageToolCallsViewSlotProps,\n ) => unknown;\n \"inspector-button\"?: (\n props: CopilotChatAssistantMessageInspectorButtonSlotProps,\n ) => unknown;\n \"feedback-comment\"?: (\n props: CopilotChatAssistantMessageFeedbackCommentSlotProps,\n ) => unknown;\n \"toolbar-items\"?: () => unknown;\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"thumbs-up\": [message: AssistantMessage];\n \"thumbs-down\": [message: AssistantMessage];\n \"read-aloud\": [message: AssistantMessage];\n regenerate: [message: AssistantMessage];\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst { copied, copy } = useCopyFeedback();\n\nfunction normalizeContent(content: unknown): string {\n if (!content) {\n return \"\";\n }\n\n if (typeof content === \"string\") {\n return content;\n }\n\n if (Array.isArray(content)) {\n const parts = content as Array<{ type?: unknown; text?: unknown }>;\n return parts\n .map((part) => {\n if (\n part &&\n typeof part === \"object\" &&\n \"type\" in part &&\n part.type === \"text\" &&\n typeof part.text === \"string\"\n ) {\n return part.text;\n }\n return \"\";\n })\n .filter((text) => text.length > 0)\n .join(\"\\n\");\n }\n\n return \"\";\n}\n\nconst normalizedContent = computed(() =>\n normalizeContent(props.message.content),\n);\nconst hasContent = computed(() =>\n ɵhasAssistantMessageText(normalizedContent.value),\n);\n\nconst providerMarkdownRenderer = useMarkdownRenderer();\nconst providerIsComponent = computed(() =>\n isVueComponentRenderer(providerMarkdownRenderer),\n);\nconst ActiveMarkdownRenderer = computed(() =>\n providerIsComponent.value\n ? (providerMarkdownRenderer as Component)\n : StreamingMarkdownDefault,\n);\nconst activeMarkdownConfig = computed(() =>\n providerIsComponent.value || !providerMarkdownRenderer\n ? {}\n : (providerMarkdownRenderer as Record<string, unknown>),\n);\n\nconst inspector = inject(InspectorKey, null);\nconst shortcutsHidden = useInspectorShortcutsHidden();\nconst showInspectorShortcut = computed(\n () => !!inspector?.isInspectorEnabled.value && !shortcutsHidden.value,\n);\n\n// Set while this chat collects ratings for Learning: the thumbs record them.\nconst feedback = useMessageFeedback(toRef(props, \"message\"));\nconst comment = useFeedbackComment(feedback);\nconst rating = computed(() => feedback.value?.feedback?.rating);\nconst root = ref<HTMLElement | null>(null);\n// The chosen thumb the comment popover points at, and the rating the open\n// comment answers.\nconst commentAnchor = shallowRef<HTMLElement | null>(null);\nlet commentRating = rating.value;\n\nconst hasThumbsUp = computed(\n () => typeof props.onThumbsUp === \"function\" || !!feedback.value,\n);\nconst hasThumbsDown = computed(\n () => typeof props.onThumbsDown === \"function\" || !!feedback.value,\n);\nconst hasReadAloud = computed(() => typeof props.onReadAloud === \"function\");\nconst hasRegenerate = computed(() => typeof props.onRegenerate === \"function\");\nconst isLatestAssistantMessage = computed(\n () => props.messages[props.messages.length - 1]?.id === props.message.id,\n);\nconst shouldShowToolbar = computed(() =>\n ɵshouldShowAssistantToolbar({\n toolbarVisible: props.toolbarVisible,\n hasContent: hasContent.value,\n showInspectorShortcut: showInspectorShortcut.value,\n isRunning: props.isRunning,\n isLatest: isLatestAssistantMessage.value,\n }),\n);\n\n// A custom thumb that calls its handler without an event gives no element:\n// point at the chosen thumb once it renders, before the popover reads it.\nfunction findCommentAnchor() {\n if (\n comment.open.value &&\n !commentAnchor.value?.isConnected &&\n rating.value &&\n root.value\n ) {\n commentAnchor.value =\n root.value.querySelector<HTMLElement>(\n `[data-copilotkit-rating=\"${rating.value}\"]`,\n ) ??\n // A custom thumb that binds only `aria-pressed`.\n root.value.querySelector<HTMLElement>('button[aria-pressed=\"true\"]') ??\n null;\n }\n}\nonUpdated(findCommentAnchor);\nwatch(() => comment.open.value, findCommentAnchor, { flush: \"post\" });\n\n/** Whether focus came from the keyboard; a pointer click also focuses buttons. */\nfunction isFocusVisible(element: Element): boolean {\n try {\n return element.matches(\":focus-visible\");\n } catch {\n return false;\n }\n}\n\n// Checks `visibility: hidden` too, which a detached popover uses.\nconst HIDDEN_TOO = { checkVisibilityCSS: true, visibilityProperty: true };\n\n/**\n * Thumbs are toggles: a new rating is saved and opens its comment, and\n * clicking the chosen thumb again removes the rating. A keyboard click\n * (`detail` 0) moves focus into the comment, as there is no pointer. Custom\n * thumb slots may call the handler without an event.\n *\n * @returns Whether the app's handler should run: true for a new rating and\n * whenever this chat does not record ratings, false when one is removed.\n */\nfunction rate(value: MessageFeedbackRating, event?: MouseEvent): boolean {\n const controls = feedback.value;\n if (!controls) return true;\n if (rating.value === value) {\n comment.close({ save: false });\n controls.clear();\n return false;\n }\n controls.rate(value);\n commentRating = value;\n commentAnchor.value =\n event?.currentTarget instanceof HTMLElement ? event.currentTarget : null;\n comment.show({ comment: \"\", focus: event?.detail === 0 });\n return true;\n}\n\n/** Attributes that let the chosen thumb open and point at its comment. */\nfunction thumbFeedbackProps(\n value: MessageFeedbackRating,\n): Record<string, unknown> {\n if (!feedback.value) return {};\n const thumb = { \"data-copilotkit-rating\": value };\n if (rating.value !== value) return { ...thumb, \"aria-pressed\": false };\n const enter = (target: HTMLElement, via: \"pointer\" | \"focus\") => {\n if (!comment.open.value) commentRating = value;\n commentAnchor.value = target;\n comment.enter(via);\n };\n return {\n ...thumb,\n \"aria-pressed\": true,\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": comment.open.value,\n onPointerenter: (event: PointerEvent) => {\n if (event.pointerType !== \"touch\")\n enter(event.currentTarget as HTMLElement, \"pointer\");\n },\n onPointerleave: (event: PointerEvent) => {\n if (event.pointerType !== \"touch\") comment.leave(\"pointer\");\n },\n // Keyboard focus opens the comment; Tab moves on into its field.\n onFocus: (event: FocusEvent) => {\n const target = event.currentTarget as HTMLElement;\n if (isFocusVisible(target)) enter(target, \"focus\");\n },\n onBlur: () => comment.leave(),\n onKeydown: (event: KeyboardEvent) => {\n const input = comment.input.value;\n // Not while the popover hides because its thumb scrolled away.\n if (\n event.key === \"Tab\" &&\n !event.shiftKey &&\n comment.open.value &&\n input &&\n input.checkVisibility?.(HIDDEN_TOO) !== false\n ) {\n event.preventDefault();\n input.focus();\n }\n },\n };\n}\n\nconst thumbsUpProps = computed(() => thumbFeedbackProps(\"up\"));\nconst thumbsDownProps = computed(() => thumbFeedbackProps(\"down\"));\n\n// The popover shows only with the toolbar and a rating. Hiding the toolbar\n// keeps the edit; a rating removed elsewhere or Learning turned off ends it.\nwatch(\n [() => comment.open.value, shouldShowToolbar, rating],\n ([open, showToolbar, currentRating]) => {\n if (!open) return;\n // Changed or removed elsewhere: the draft answered the old rating.\n if (currentRating !== commentRating) comment.close({ save: false });\n else if (!showToolbar) comment.close();\n },\n);\n\nfunction handleInspect() {\n inspector?.openInspector({\n messageId: props.message.id,\n threadId: config.value?.threadId,\n agentId: config.value?.agentId,\n });\n}\n\nasync function handleCopyMessage() {\n await copy(normalizedContent.value);\n}\n\nfunction handleThumbsUp(event?: MouseEvent) {\n // The app hears about a rating given, not about one removed.\n if (rate(\"up\", event)) emit(\"thumbs-up\", props.message);\n}\n\nfunction handleThumbsDown(event?: MouseEvent) {\n if (rate(\"down\", event)) emit(\"thumbs-down\", props.message);\n}\n\nfunction handleReadAloud() {\n emit(\"read-aloud\", props.message);\n}\n\nfunction handleRegenerate() {\n emit(\"regenerate\", props.message);\n}\n</script>\n\n<template>\n <slot\n name=\"layout\"\n :message=\"message\"\n :content=\"normalizedContent\"\n :is-running=\"isRunning\"\n :toolbar-visible=\"toolbarVisible\"\n :should-show-toolbar=\"shouldShowToolbar\"\n :message-renderer=\"$slots['message-renderer'] ?? (() => null)\"\n :toolbar=\"$slots['toolbar'] ?? (() => null)\"\n :copy-button=\"$slots['copy-button'] ?? (() => null)\"\n :thumbs-up-button=\"$slots['thumbs-up-button'] ?? (() => null)\"\n :thumbs-down-button=\"$slots['thumbs-down-button'] ?? (() => null)\"\n :read-aloud-button=\"$slots['read-aloud-button'] ?? (() => null)\"\n :regenerate-button=\"$slots['regenerate-button'] ?? (() => null)\"\n :tool-calls-view=\"$slots['tool-calls-view'] ?? (() => null)\"\n :on-copy=\"handleCopyMessage\"\n :on-thumbs-up=\"handleThumbsUp\"\n :on-thumbs-down=\"handleThumbsDown\"\n :on-read-aloud=\"handleReadAloud\"\n :on-regenerate=\"handleRegenerate\"\n >\n <div\n ref=\"root\"\n data-copilotkit\n data-testid=\"copilot-assistant-message\"\n class=\"copilotKitMessage copilotKitAssistantMessage\"\n :data-message-id=\"message.id\"\n v-bind=\"$attrs\"\n >\n <CopilotChatWorkText :message-id=\"message.id\">\n <div class=\"cpk-markdown cpk-assistant-message-markdown\">\n <slot\n name=\"message-renderer\"\n :message=\"message\"\n :content=\"normalizedContent\"\n >\n <component\n :is=\"ActiveMarkdownRenderer\"\n v-if=\"hasContent\"\n v-bind=\"activeMarkdownConfig\"\n :content=\"normalizedContent\"\n :is-streaming=\"isRunning && isLatestAssistantMessage\"\n />\n </slot>\n </div>\n </CopilotChatWorkText>\n\n <slot name=\"tool-calls-view\" :message=\"message\" :messages=\"messages\">\n <CopilotChatToolCallsView :message=\"message\" :messages=\"messages\">\n <template\n v-for=\"(_, slotName) in $slots\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatToolCallsView>\n </slot>\n\n <slot\n v-if=\"shouldShowToolbar\"\n name=\"toolbar\"\n :message=\"message\"\n :should-show-toolbar=\"shouldShowToolbar\"\n >\n <div\n data-testid=\"copilot-assistant-toolbar\"\n class=\"cpk-assistant-message-toolbar\"\n >\n <div class=\"cpk-assistant-message-toolbar-items\">\n <slot\n name=\"copy-button\"\n :on-copy=\"handleCopyMessage\"\n :copied=\"copied\"\n :label=\"labels.assistantMessageToolbarCopyMessageLabel\"\n >\n <CopilotChatAssistantToolbarButton\n data-testid=\"copilot-copy-button\"\n :label=\"labels.assistantMessageToolbarCopyMessageLabel\"\n @click=\"handleCopyMessage\"\n >\n <IconCheck\n v-if=\"copied\"\n class=\"cpk-assistant-message-toolbar-icon\"\n />\n <IconCopy v-else class=\"cpk-assistant-message-toolbar-icon\" />\n </CopilotChatAssistantToolbarButton>\n </slot>\n\n <slot\n v-if=\"hasThumbsUp || $slots['thumbs-up-button']\"\n name=\"thumbs-up-button\"\n :on-thumbs-up=\"handleThumbsUp\"\n :label=\"labels.assistantMessageToolbarThumbsUpLabel\"\n :pressed=\"rating === 'up'\"\n :thumb-props=\"thumbsUpProps\"\n >\n <CopilotChatAssistantToolbarButton\n data-testid=\"copilot-thumbs-up-button\"\n :label=\"labels.assistantMessageToolbarThumbsUpLabel\"\n v-bind=\"thumbsUpProps\"\n @click=\"handleThumbsUp\"\n >\n <IconThumbsUp\n class=\"cpk-assistant-message-toolbar-icon\"\n :fill=\"rating === 'up' ? 'currentColor' : 'none'\"\n />\n </CopilotChatAssistantToolbarButton>\n </slot>\n\n <slot\n v-if=\"hasThumbsDown || $slots['thumbs-down-button']\"\n name=\"thumbs-down-button\"\n :on-thumbs-down=\"handleThumbsDown\"\n :label=\"labels.assistantMessageToolbarThumbsDownLabel\"\n :pressed=\"rating === 'down'\"\n :thumb-props=\"thumbsDownProps\"\n >\n <CopilotChatAssistantToolbarButton\n data-testid=\"copilot-thumbs-down-button\"\n :label=\"labels.assistantMessageToolbarThumbsDownLabel\"\n v-bind=\"thumbsDownProps\"\n @click=\"handleThumbsDown\"\n >\n <IconThumbsDown\n class=\"cpk-assistant-message-toolbar-icon\"\n :fill=\"rating === 'down' ? 'currentColor' : 'none'\"\n />\n </CopilotChatAssistantToolbarButton>\n </slot>\n\n <slot\n v-if=\"hasReadAloud || $slots['read-aloud-button']\"\n name=\"read-aloud-button\"\n :on-read-aloud=\"handleReadAloud\"\n :label=\"labels.assistantMessageToolbarReadAloudLabel\"\n >\n <CopilotChatAssistantToolbarButton\n data-testid=\"copilot-read-aloud-button\"\n :label=\"labels.assistantMessageToolbarReadAloudLabel\"\n @click=\"handleReadAloud\"\n >\n <IconVolume2 class=\"cpk-assistant-message-read-aloud-icon\" />\n </CopilotChatAssistantToolbarButton>\n </slot>\n\n <slot\n v-if=\"hasRegenerate || $slots['regenerate-button']\"\n name=\"regenerate-button\"\n :on-regenerate=\"handleRegenerate\"\n :label=\"labels.assistantMessageToolbarRegenerateLabel\"\n >\n <CopilotChatAssistantToolbarButton\n data-testid=\"copilot-regenerate-button\"\n :label=\"labels.assistantMessageToolbarRegenerateLabel\"\n @click=\"handleRegenerate\"\n >\n <IconRefreshCw class=\"cpk-assistant-message-toolbar-icon\" />\n </CopilotChatAssistantToolbarButton>\n </slot>\n\n <slot name=\"toolbar-items\" />\n\n <slot\n v-if=\"showInspectorShortcut\"\n name=\"inspector-button\"\n :on-inspect=\"handleInspect\"\n :label=\"labels.assistantMessageToolbarInspectorLabel\"\n >\n <CopilotChatInspectorButton @click=\"handleInspect\" />\n </slot>\n </div>\n </div>\n </slot>\n </div>\n </slot>\n\n <!-- Floats in a portal next to the chosen thumb, so it never moves the chat. -->\n <CopilotChatFeedbackCommentPopover\n v-if=\"feedback?.feedback && shouldShowToolbar\"\n :comment=\"comment\"\n :saved-comment=\"feedback.feedback.comment ?? ''\"\n :rating=\"feedback.feedback.rating\"\n :anchor=\"commentAnchor\"\n :message-id=\"message.id\"\n >\n <template v-if=\"$slots['feedback-comment']\" #feedback-comment=\"slotProps\">\n <slot name=\"feedback-comment\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatFeedbackCommentPopover>\n</template>\n","export type AudioRecorderState = \"idle\" | \"recording\" | \"processing\";\n\nexport class AudioRecorderError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AudioRecorderError\";\n }\n}\n\nexport interface CopilotChatAudioRecorderRef {\n state: AudioRecorderState;\n start: () => Promise<void>;\n stop: () => Promise<Blob>;\n dispose: () => void;\n}\n","<script setup lang=\"ts\">\nimport { onBeforeUnmount, ref, useAttrs, watch } from \"vue\";\nimport { AudioRecorderError } from \"./audioRecorder\";\nimport type { AudioRecorderState } from \"./audioRecorder\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst attrs = useAttrs();\nconst canvasRef = ref<HTMLCanvasElement | null>(null);\nconst recorderState = ref<AudioRecorderState>(\"idle\");\nconst mediaRecorderRef = ref<MediaRecorder | null>(null);\nconst streamRef = ref<MediaStream | null>(null);\nconst analyserRef = ref<AnalyserNode | null>(null);\nconst audioContextRef = ref<AudioContext | null>(null);\nconst animationIdRef = ref<number | null>(null);\nconst audioChunksRef = ref<Blob[]>([]);\nconst amplitudeHistoryRef = ref<number[]>([]);\nconst scrollOffsetRef = ref(0);\nconst smoothedAmplitudeRef = ref(0);\nconst fadeOpacityRef = ref(0);\n\nfunction cleanup() {\n if (animationIdRef.value !== null) {\n cancelAnimationFrame(animationIdRef.value);\n animationIdRef.value = null;\n }\n\n const recorder = mediaRecorderRef.value;\n if (recorder && recorder.state !== \"inactive\") {\n try {\n recorder.stop();\n } catch {\n // ignore cleanup stop failures\n }\n }\n\n if (streamRef.value) {\n streamRef.value.getTracks().forEach((track) => track.stop());\n streamRef.value = null;\n }\n\n const audioContext = audioContextRef.value;\n if (audioContext && audioContext.state !== \"closed\") {\n audioContext.close().catch(() => {\n // ignore close errors\n });\n }\n\n mediaRecorderRef.value = null;\n analyserRef.value = null;\n audioContextRef.value = null;\n audioChunksRef.value = [];\n amplitudeHistoryRef.value = [];\n scrollOffsetRef.value = 0;\n smoothedAmplitudeRef.value = 0;\n fadeOpacityRef.value = 0;\n}\n\nasync function start() {\n if (recorderState.value !== \"idle\") {\n throw new AudioRecorderError(\"Recorder is already active\");\n }\n\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n streamRef.value = stream;\n\n const audioContext = new AudioContext();\n audioContextRef.value = audioContext;\n const source = audioContext.createMediaStreamSource(stream);\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 2048;\n source.connect(analyser);\n analyserRef.value = analyser;\n\n const mimeType = MediaRecorder.isTypeSupported(\"audio/webm;codecs=opus\")\n ? \"audio/webm;codecs=opus\"\n : MediaRecorder.isTypeSupported(\"audio/webm\")\n ? \"audio/webm\"\n : MediaRecorder.isTypeSupported(\"audio/mp4\")\n ? \"audio/mp4\"\n : \"\";\n\n const options = mimeType ? { mimeType } : {};\n const recorder = new MediaRecorder(stream, options);\n mediaRecorderRef.value = recorder;\n audioChunksRef.value = [];\n\n recorder.ondataavailable = (event) => {\n if (event.data.size > 0) {\n audioChunksRef.value.push(event.data);\n }\n };\n\n recorder.start(100);\n recorderState.value = \"recording\";\n } catch (error) {\n cleanup();\n if (error instanceof Error && error.name === \"NotAllowedError\") {\n throw new AudioRecorderError(\"Microphone permission denied\");\n }\n if (error instanceof Error && error.name === \"NotFoundError\") {\n throw new AudioRecorderError(\"No microphone found\");\n }\n throw new AudioRecorderError(\n error instanceof Error ? error.message : \"Failed to start recording\",\n );\n }\n}\n\nfunction stop() {\n return new Promise<Blob>((resolve, reject) => {\n const recorder = mediaRecorderRef.value;\n if (!recorder || recorderState.value !== \"recording\") {\n reject(new AudioRecorderError(\"No active recording\"));\n return;\n }\n\n recorderState.value = \"processing\";\n recorder.onstop = () => {\n const audioBlob = new Blob(audioChunksRef.value, {\n type: recorder.mimeType || \"audio/webm\",\n });\n cleanup();\n recorderState.value = \"idle\";\n resolve(audioBlob);\n };\n recorder.onerror = () => {\n cleanup();\n recorderState.value = \"idle\";\n reject(new AudioRecorderError(\"Recording failed\"));\n };\n recorder.stop();\n });\n}\n\nfunction calculateAmplitude(dataArray: Uint8Array) {\n let sum = 0;\n for (let index = 0; index < dataArray.length; index += 1) {\n const sample = (dataArray[index] ?? 128) / 128 - 1;\n sum += sample * sample;\n }\n return Math.sqrt(sum / dataArray.length);\n}\n\nfunction drawFrame() {\n const canvas = canvasRef.value;\n if (!canvas) {\n return;\n }\n\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return;\n }\n\n const rect = canvas.getBoundingClientRect();\n const dpr = window.devicePixelRatio || 1;\n if (\n canvas.width !== rect.width * dpr ||\n canvas.height !== rect.height * dpr\n ) {\n canvas.width = rect.width * dpr;\n canvas.height = rect.height * dpr;\n context.scale(dpr, dpr);\n }\n\n const barWidth = 2;\n const barGap = 1;\n const barSpacing = barWidth + barGap;\n const maxBars = Math.floor(rect.width / barSpacing) + 2;\n\n if (analyserRef.value && recorderState.value === \"recording\") {\n if (amplitudeHistoryRef.value.length === 0) {\n amplitudeHistoryRef.value = Array.from({ length: maxBars }, () => 0);\n }\n\n if (fadeOpacityRef.value < 1) {\n fadeOpacityRef.value = Math.min(1, fadeOpacityRef.value + 0.03);\n }\n\n scrollOffsetRef.value += 1 / 3;\n const bufferLength = analyserRef.value.fftSize;\n const dataArray = new Uint8Array(bufferLength);\n analyserRef.value.getByteTimeDomainData(dataArray);\n const rawAmplitude = calculateAmplitude(dataArray);\n const attackSpeed = 0.12;\n const decaySpeed = 0.08;\n const speed =\n rawAmplitude > smoothedAmplitudeRef.value ? attackSpeed : decaySpeed;\n smoothedAmplitudeRef.value +=\n (rawAmplitude - smoothedAmplitudeRef.value) * speed;\n\n if (scrollOffsetRef.value >= barSpacing) {\n scrollOffsetRef.value -= barSpacing;\n amplitudeHistoryRef.value.push(smoothedAmplitudeRef.value);\n if (amplitudeHistoryRef.value.length > maxBars) {\n amplitudeHistoryRef.value = amplitudeHistoryRef.value.slice(-maxBars);\n }\n }\n }\n\n context.clearRect(0, 0, rect.width, rect.height);\n const computedStyle = window.getComputedStyle(canvas);\n context.fillStyle = computedStyle.color;\n context.globalAlpha = fadeOpacityRef.value;\n\n const centerY = rect.height / 2;\n const maxAmplitude = rect.height / 2 - 2;\n const edgeFadeWidth = 12;\n\n for (let index = 0; index < amplitudeHistoryRef.value.length; index += 1) {\n const amplitude = amplitudeHistoryRef.value[index] ?? 0;\n const scaledAmplitude = Math.min(amplitude * 4, 1);\n const barHeight = Math.max(2, scaledAmplitude * maxAmplitude * 2);\n const x =\n rect.width -\n (amplitudeHistoryRef.value.length - index) * barSpacing -\n scrollOffsetRef.value;\n const y = centerY - barHeight / 2;\n if (x + barWidth <= 0 || x >= rect.width) {\n continue;\n }\n\n let edgeOpacity = 1;\n if (x < edgeFadeWidth) {\n edgeOpacity = Math.max(0, x / edgeFadeWidth);\n } else if (x > rect.width - edgeFadeWidth) {\n edgeOpacity = Math.max(0, (rect.width - x) / edgeFadeWidth);\n }\n\n context.globalAlpha = fadeOpacityRef.value * edgeOpacity;\n context.fillRect(x, y, barWidth, barHeight);\n }\n\n animationIdRef.value = requestAnimationFrame(drawFrame);\n}\n\nwatch(\n recorderState,\n () => {\n if (animationIdRef.value !== null) {\n cancelAnimationFrame(animationIdRef.value);\n animationIdRef.value = null;\n }\n animationIdRef.value = requestAnimationFrame(drawFrame);\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n cleanup();\n});\n\ndefineExpose({\n get state() {\n return recorderState.value;\n },\n start,\n stop,\n dispose: cleanup,\n});\n</script>\n\n<template>\n <div data-copilotkit class=\"cpk-audio-recorder\" v-bind=\"attrs\">\n <canvas ref=\"canvasRef\" class=\"cpk-audio-recorder-canvas\" />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport {\n ɵINLINE_FEATURE_WARNING_STYLE,\n ɵgetInlineFeatureWarningSpec,\n} from \"@copilotkit/core\";\nimport { useChatLabels } from \"./chat/use-chat-labels\";\n\nconst props = defineProps<{\n featureName: string;\n}>();\n\nconst labels = useChatLabels();\nconst spec = computed(() =>\n ɵgetInlineFeatureWarningSpec(props.featureName, labels.value),\n);\n</script>\n\n<template>\n <div\n :style=\"ɵINLINE_FEATURE_WARNING_STYLE.container\"\n data-testid=\"copilot-inline-feature-warning\"\n >\n {{ spec.message }}\n <a\n :href=\"spec.actionUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :style=\"ɵINLINE_FEATURE_WARNING_STYLE.link\"\n >\n {{ spec.actionLabel }}\n </a>\n </div>\n</template>\n","import { computed, shallowRef, toValue, triggerRef, watch } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport type { AbstractAgent } from \"@ag-ui/client\";\nimport {\n ProxiedCopilotRuntimeAgent,\n CopilotKitCoreRuntimeConnectionStatus,\n ɵisHttpAgent,\n} from \"@copilotkit/core\";\nimport type {\n CopilotRuntimeTransport,\n SubscribeToAgentSubscriber,\n} from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\n\nexport enum UseAgentUpdate {\n OnMessagesChanged = \"OnMessagesChanged\",\n OnStateChanged = \"OnStateChanged\",\n OnRunStatusChanged = \"OnRunStatusChanged\",\n}\n\nconst ALL_UPDATES: UseAgentUpdate[] = [\n UseAgentUpdate.OnMessagesChanged,\n UseAgentUpdate.OnStateChanged,\n UseAgentUpdate.OnRunStatusChanged,\n];\n\ninterface UseAgentPropsBase {\n updates?: UseAgentUpdate[];\n /**\n * Throttle interval (in milliseconds) for re-renders triggered by\n * `onMessagesChanged` and `onStateChanged` notifications. Useful to reduce\n * re-render frequency during high-frequency streaming updates.\n *\n * Uses a leading+trailing pattern with a shared window — first update\n * fires immediately, subsequent updates within the window are coalesced,\n * and a trailing timer ensures the most recent update fires after the\n * window expires. See `CopilotKitCore.subscribeToAgentWithOptions` in\n * `@copilotkit/core` for details.\n *\n * Resolved as: `throttleMs ?? provider defaultThrottleMs ?? 0`.\n * Passing `throttleMs: 0` explicitly disables throttling even when the\n * provider specifies a non-zero `defaultThrottleMs`.\n *\n * Run lifecycle callbacks (`onRunInitialized`, `onRunFinalized`,\n * `onRunFailed`, `onRunErrorEvent`) always fire immediately.\n *\n * @default undefined\n * When unset, inherits from the provider's `defaultThrottleMs`;\n * if that is also unset, the effective value is `0` (no throttle).\n */\n throttleMs?: MaybeRefOrGetter<number | undefined>;\n}\n\n/**\n * Thread-scoped variant. `agentId`, `runtimeAgentId` and `threadId` are a matched\n * set: together they give this hook a private proxied agent — registered under the\n * local `agentId`, routing outbound to `runtimeAgentId` — that is safe to pin a\n * thread onto. Mirrors React's `UseAgentThreadScopedProps`.\n */\ninterface UseAgentThreadScopedProps {\n /**\n * The *local* registry id to register this hook's proxied agent under. Required\n * here: the usual fallbacks (chat configuration, then `DEFAULT_AGENT_ID`) name\n * agents that already exist, and registering over one of those throws.\n */\n agentId: MaybeRefOrGetter<string>;\n /**\n * The runtime agent to route outbound requests to while this hook exposes a\n * distinct local `agentId`. Registers a proxied agent via\n * `CopilotKitCore.registerProxiedAgent`, so several frontend agents (e.g. one\n * per open thread) can mount against one runtime agent.\n *\n * REQUIRES `threadId` — a private agent with no thread to scope behaves like\n * the shared one, minus a registration and a local id to keep unique.\n */\n runtimeAgentId: MaybeRefOrGetter<string>;\n /**\n * Thread to scope the agent's run to. Written onto the underlying agent, so\n * `/agent/run`, `/agent/connect` and `/agent/stop` address this thread.\n *\n * REQUIRES `runtimeAgentId` — an agent resolved by `agentId` alone is shared,\n * so a per-hook thread written onto it would clobber every other holder.\n */\n threadId: MaybeRefOrGetter<string>;\n}\n\n/**\n * Default variant: no thread scoping. Binds to the shared agent registered under\n * `agentId` and takes its thread from the surrounding chat configuration, gated\n * on `hasExplicitThreadId`. Mirrors React's `UseAgentUnscopedProps`.\n *\n * `threadId` and `runtimeAgentId` are typed `undefined` rather than omitted so\n * that supplying either alone matches *neither* branch — that is the type-level\n * enforcement of the all-or-nothing rule.\n */\ninterface UseAgentUnscopedProps {\n /**\n * Agent to bind to. Resolution precedence: this property, then the surrounding\n * chat configuration's agentId, then the global default.\n */\n agentId?: MaybeRefOrGetter<string | undefined>;\n /** Requires `runtimeAgentId`. See {@link UseAgentThreadScopedProps.threadId}. */\n threadId?: undefined;\n /** Requires `threadId`. See {@link UseAgentThreadScopedProps.runtimeAgentId}. */\n runtimeAgentId?: undefined;\n}\n\n/**\n * Props for {@link useAgent}. Two valid shapes, nothing in between:\n *\n * - **Bind to an agent** — `useAgent()`, `useAgent({ agentId })`. The shared\n * registry instance; the thread comes from the chat configuration.\n * - **Bind a private agent to a thread** —\n * `useAgent({ agentId, runtimeAgentId, threadId })`. All three required.\n *\n * So `{ agentId, threadId }`, `{ agentId, runtimeAgentId }` and\n * `{ runtimeAgentId, threadId }` are all compile errors, matching React.\n */\nexport type UseAgentProps = UseAgentPropsBase &\n (UseAgentThreadScopedProps | UseAgentUnscopedProps);\n\n/**\n * Resolves and subscribes to a CopilotKit agent for the current Vue scope.\n *\n * It returns a reactive `agent` ref that updates when the selected agent\n * changes, when runtime connection state changes, or when subscribed update\n * events fire.\n *\n * @example\n * ```ts\n * const { agent } = useAgent({ agentId: \"default\" });\n * ```\n */\nexport function useAgent(props: UseAgentProps = {}) {\n // `threadId`, `runtimeAgentId` and an explicit `agentId` are all-or-nothing.\n // UseAgentProps rejects a partial set at compile time; these are the runtime\n // backstop for callers TypeScript doesn't reach (plain JS, `as any`). Same\n // three checks, same messages, as React's useAgent.\n const hasThreadId = props.threadId !== undefined;\n const hasRuntimeAgentId = props.runtimeAgentId !== undefined;\n const hasAgentId = props.agentId !== undefined;\n\n if (hasThreadId && !hasRuntimeAgentId) {\n throw new Error(\n \"useAgent: `threadId` requires `runtimeAgentId`. A threadId is written onto a \" +\n \"single agent, but an agent resolved by agentId alone is shared, so scoping a \" +\n \"thread to it would clobber other useAgent callers. Pass a distinct local `agentId` \" +\n 'and the runtime agent to route to, e.g. useAgent({ agentId: \"chat-1\", ' +\n 'runtimeAgentId: \"assistant\", threadId }).',\n );\n }\n\n if (hasRuntimeAgentId && !hasThreadId) {\n throw new Error(\n \"useAgent: `runtimeAgentId` requires `threadId`. A proxied agent exists to scope a \" +\n \"thread to a private instance; without a threadId it behaves like the shared agent \" +\n \"while adding a registration and a local agentId to keep unique. Either pass the \" +\n \"thread, or bind to the agent directly with useAgent({ agentId }).\",\n );\n }\n\n if (hasRuntimeAgentId && !hasAgentId) {\n throw new Error(\n \"useAgent: `runtimeAgentId` requires an explicit `agentId`. The proxied agent is \" +\n \"registered under `agentId`, and the usual fallbacks (chat configuration, then \" +\n `\"${DEFAULT_AGENT_ID}\") name agents that already exist — registering over one throws ` +\n \"or shadows it. Pick a local id for this hook, e.g. \" +\n 'useAgent({ agentId: \"chat-1\", runtimeAgentId: \"assistant\", threadId }).',\n );\n }\n\n // After the guards, all three are present or none are.\n const isThreadScoped = hasRuntimeAgentId;\n\n const chatConfig = useCopilotChatConfiguration();\n const agentId = computed(\n () =>\n toValue(props.agentId) ?? chatConfig.value?.agentId ?? DEFAULT_AGENT_ID,\n );\n const runtimeAgentId = computed(() =>\n isThreadScoped ? toValue(props.runtimeAgentId) : undefined,\n );\n // Mirrors React: an explicit `threadId` prop wins, otherwise the chat\n // configuration's thread, gated on `hasExplicitThreadId` so a\n // ThreadsProvider-minted placeholder UUID doesn't overwrite the agent's own\n // auto-minted one (both are random and useless to the backend).\n const resolvedThreadId = computed(\n () =>\n toValue(props.threadId) ??\n (chatConfig.value?.hasExplicitThreadId\n ? chatConfig.value.threadId\n : undefined),\n );\n const { copilotkit } = useCopilotKit();\n const updateFlags = computed(() => props.updates ?? ALL_UPDATES);\n // Read the provider-level default so it appears in the subscribe watcher\n // deps. `subscribeToAgentWithOptions` reads it from the core instance, but\n // Vue still needs the dep to know when to resubscribe (same role it plays\n // in React's `useEffect` dep array).\n const providerThrottleMs = computed(() => copilotkit.value.defaultThrottleMs);\n const hookThrottleMs = computed(() => toValue(props.throttleMs));\n\n const agent = shallowRef<AbstractAgent | null>(null);\n const subscriptionAgent = shallowRef<AbstractAgent | null>(null);\n const provisionalAgentCache = new Map<string, ProxiedCopilotRuntimeAgent>();\n\n const createProvisionalAgent = (\n id: string,\n runtimeUrl: string,\n transport: CopilotRuntimeTransport,\n ) => {\n const provisional = new ProxiedCopilotRuntimeAgent({\n runtimeUrl,\n agentId: id,\n transport,\n runtimeMode: \"pending\",\n });\n // Never invokes the headers builder — installs `ɵruntimeFetch` and\n // own-only headers on this proxied agent, so a request it actually sends\n // resolves the current headers at send time (#1937).\n copilotkit.value.applyHeadersToAgent(provisional);\n return provisional;\n };\n\n // On the thread-scoped path this hook owns an agent registered under\n // `agentId` that routes to `runtimeAgentId`. Register/unregister as one\n // balanced watcher — the cleanup runs both when the ids change and when the\n // scope is disposed. Mirrors React's registration effect, including its dep\n // set (core identity plus the two ids).\n const registeredProxy = shallowRef<AbstractAgent | null>(null);\n if (isThreadScoped) {\n watch(\n [agentId, runtimeAgentId, () => copilotkit.value],\n ([id, rtId], _old, onCleanup) => {\n const { agent: proxy, unregister } =\n copilotkit.value.registerProxiedAgent({\n agentId: id as string,\n runtimeAgentId: rtId as string,\n });\n provisionalAgentCache.delete(id as string);\n registeredProxy.value = proxy;\n onCleanup(() => {\n unregister();\n registeredProxy.value = null;\n });\n },\n { immediate: true },\n );\n }\n\n const resolveAgent = () => {\n const id = agentId.value;\n const core = copilotkit.value;\n\n // Proxied path: this hook registered its own agent, so bypass the shared\n // registry lookup. Until registration lands, hand back a provisional proxy\n // so `agent` is never null and its identity stays stable.\n if (isThreadScoped) {\n const proxy = registeredProxy.value;\n if (proxy) {\n provisionalAgentCache.delete(id);\n const shouldForceUpdate = agent.value === proxy;\n agent.value = proxy;\n subscriptionAgent.value = proxy;\n if (shouldForceUpdate) triggerRef(agent);\n return;\n }\n\n const cachedProxy = provisionalAgentCache.get(id);\n if (cachedProxy) {\n core.applyHeadersToAgent(cachedProxy);\n agent.value = cachedProxy;\n subscriptionAgent.value = cachedProxy;\n return;\n }\n\n const provisionalProxy = new ProxiedCopilotRuntimeAgent({\n runtimeUrl: core.runtimeUrl,\n agentId: id,\n runtimeAgentId: runtimeAgentId.value as string,\n transport: core.runtimeTransport,\n runtimeMode: \"pending\",\n });\n core.applyHeadersToAgent(provisionalProxy);\n provisionalAgentCache.set(id, provisionalProxy);\n agent.value = provisionalProxy;\n subscriptionAgent.value = provisionalProxy;\n return;\n }\n\n const existing = core.getAgent(id);\n if (existing) {\n provisionalAgentCache.delete(id);\n\n const shouldForceUpdate = agent.value === existing;\n agent.value = existing;\n subscriptionAgent.value = existing;\n if (shouldForceUpdate) {\n triggerRef(agent);\n }\n return;\n }\n\n const isRuntimeConfigured = core.runtimeUrl !== undefined;\n const status = core.runtimeConnectionStatus;\n\n if (\n isRuntimeConfigured &&\n (status === CopilotKitCoreRuntimeConnectionStatus.Disconnected ||\n status === CopilotKitCoreRuntimeConnectionStatus.Connecting ||\n status === CopilotKitCoreRuntimeConnectionStatus.Error)\n ) {\n const cached = provisionalAgentCache.get(id);\n if (cached) {\n core.applyHeadersToAgent(cached);\n agent.value = cached;\n subscriptionAgent.value = cached;\n return;\n }\n\n const provisional = createProvisionalAgent(\n id,\n core.runtimeUrl!,\n core.runtimeTransport,\n );\n provisionalAgentCache.set(id, provisional);\n agent.value = provisional;\n subscriptionAgent.value = provisional;\n return;\n }\n\n const knownAgents = Object.keys(core.agents ?? {});\n const runtimePart = isRuntimeConfigured\n ? `runtimeUrl=${core.runtimeUrl}`\n : \"no runtimeUrl\";\n throw new Error(\n `useAgent: Agent '${id}' not found after runtime sync (${runtimePart}). ` +\n (knownAgents.length\n ? `Known agents: [${knownAgents.join(\", \")}]`\n : \"No agents registered.\") +\n \" Verify your runtime /info and/or agents__unsafe_dev_only.\",\n );\n };\n\n // Keyed on `ɵheadersGeneration`, not header VALUES: a builder's returned\n // token can change on every resolution without a new source ever being\n // set (a run refreshing the snapshot), and this must not re-run\n // `resolveAgent` (and force-trigger `agent`) on that (#1937).\n // A genuine source change (a real `setHeaders()` call) still re-runs it,\n // refreshing a cached provisional's headers via the branches above.\n //\n // `registeredProxy` is wrapped as a getter (`() => registeredProxy.value`)\n // rather than passed directly: Vue's multi-source `watch` sets\n // `forceTrigger = true` for the WHOLE array whenever any raw element is\n // itself a shallowRef/reactive object, which makes the callback run on\n // ANY dependency dirtying regardless of whether a source's value actually\n // changed — silently defeating the `ɵheadersGeneration` rekey above (and\n // every other source's diffing) the moment `registeredProxy` is present.\n // A getter reads the same value without contributing to that flag.\n watch(\n [\n agentId,\n () => registeredProxy.value,\n () => copilotkit.value.agents,\n () => copilotkit.value.runtimeConnectionStatus,\n () => copilotkit.value.runtimeUrl,\n () => copilotkit.value.runtimeTransport,\n () => copilotkit.value.ɵheadersGeneration,\n ],\n resolveAgent,\n { immediate: true },\n );\n\n // Pin the resolved thread onto the current agent. AbstractAgent auto-mints a\n // UUID when none is given, so without this the agent would ship its own random\n // id in /agent/run, /agent/connect and /agent/stop. Deps are deliberately just\n // the agent and the thread — matching React — so status/header churn cannot\n // re-fire this and overwrite a thread `CopilotChat` pinned for its own chat.\n // `() => agent.value`, not `agent`: Vue sets `forceTrigger` when any array\n // watch source is a shallow ref, which would re-run this on every\n // `triggerRef(agent)` — i.e. every streamed message — and re-pin a thread that\n // `CopilotChat` may have deliberately overridden for the chat it renders. A\n // getter fires only when the identity actually changes.\n watch(\n [() => agent.value, resolvedThreadId],\n ([currentAgent, threadId]) => {\n if (!currentAgent || !threadId) return;\n currentAgent.threadId = threadId as string;\n },\n { immediate: true },\n );\n\n // Keyed on `ɵheadersGeneration`, not header VALUES: a builder's returned\n // token can change on every resolution without a new source ever being set,\n // and this watcher must not re-fire on that (see #1937).\n watch(\n [subscriptionAgent, () => copilotkit.value.ɵheadersGeneration],\n ([currentAgent]) => {\n if (ɵisHttpAgent(currentAgent)) {\n copilotkit.value.applyHeadersToAgent(currentAgent);\n }\n },\n { immediate: true },\n );\n\n // Subscribe through the shared `CopilotKitCore.subscribeToAgentWithOptions`\n // API. Core owns:\n // - shared leading+trailing throttle window across `onMessagesChanged`\n // and `onStateChanged` (parity with React)\n // - safeCall-guarded callbacks (errors in subscribers never poison the\n // agent notification loop)\n // - validation/fallback for invalid `throttleMs`\n // - `onRunErrorEvent` in the run-status callback set\n //\n // The hook only schedules a microtask-batched `triggerRef(agent)` so\n // multiple synchronous notifications (e.g. state + run-status firing in\n // the same tick) coalesce into a single Vue re-render — matching React's\n // `queueMicrotask`-batched forceUpdate strategy.\n watch(\n [subscriptionAgent, updateFlags, hookThrottleMs, providerThrottleMs],\n ([a, flags], _old, onCleanup) => {\n const f = flags as UseAgentUpdate[];\n if (!a || f.length === 0) return;\n\n let active = true;\n let batchScheduled = false;\n const batchedRefresh = () => {\n if (!active) return;\n if (!batchScheduled) {\n batchScheduled = true;\n queueMicrotask(() => {\n batchScheduled = false;\n if (active) {\n triggerRef(agent);\n }\n });\n }\n };\n\n const handlers: SubscribeToAgentSubscriber = {};\n\n if (f.includes(UseAgentUpdate.OnMessagesChanged)) {\n // Messages fire immediately (no microtask indirection) so shared-\n // window throttling in core sees an unadorned callback. Matches\n // React's `handlers.onMessagesChanged = forceUpdate`.\n handlers.onMessagesChanged = () => {\n if (active) triggerRef(agent);\n };\n }\n\n if (f.includes(UseAgentUpdate.OnStateChanged)) {\n handlers.onStateChanged = batchedRefresh;\n }\n\n if (f.includes(UseAgentUpdate.OnRunStatusChanged)) {\n handlers.onRunInitialized = batchedRefresh;\n handlers.onRunFinalized = batchedRefresh;\n handlers.onRunFailed = batchedRefresh;\n // Protocol-level RUN_ERROR event (distinct from `onRunFailed`\n // which handles local exceptions like network errors).\n handlers.onRunErrorEvent = batchedRefresh;\n }\n\n const subscription = copilotkit.value.subscribeToAgentWithOptions(\n a as AbstractAgent,\n handlers,\n { throttleMs: toValue(props.throttleMs) },\n );\n\n onCleanup(() => {\n active = false;\n subscription.unsubscribe();\n });\n },\n { immediate: true },\n );\n\n return { agent };\n}\n","import { computed, ref, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\n\nexport interface UseSuggestionsOptions {\n agentId?: MaybeRefOrGetter<string | undefined>;\n}\n\nexport interface UseSuggestionsResult {\n suggestions: Ref<Suggestion[]>;\n isLoading: Ref<boolean>;\n reloadSuggestions: () => void;\n clearSuggestions: () => void;\n}\n\n/**\n * Provides reactive access to agent suggestions.\n *\n * It tracks suggestion updates for the resolved agent and exposes helpers to\n * reload or clear suggestions.\n *\n * @example\n * ```ts\n * const { suggestions, isLoading, reloadSuggestions } = useSuggestions({\n * agentId: \"default\",\n * });\n * ```\n */\nexport function useSuggestions(\n options: UseSuggestionsOptions = {},\n): UseSuggestionsResult {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const resolvedAgentId = computed(\n () => toValue(options.agentId) ?? config.value?.agentId ?? DEFAULT_AGENT_ID,\n );\n\n const suggestions = ref<Suggestion[]>([]);\n const isLoading = ref(false);\n\n const initState = () => {\n const result = copilotkit.value.getSuggestions(resolvedAgentId.value);\n suggestions.value = result.suggestions;\n isLoading.value = result.isLoading;\n };\n\n watch([() => copilotkit.value, resolvedAgentId], () => initState(), {\n immediate: true,\n });\n\n watch(\n [() => copilotkit.value, resolvedAgentId],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n const agentId = resolvedAgentId.value;\n const sub = core.subscribe({\n onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: s }) => {\n if (changedAgentId !== agentId) return;\n suggestions.value = s;\n const result = core.getSuggestions(agentId);\n isLoading.value = result.isLoading;\n },\n onSuggestionsStartedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== agentId) return;\n isLoading.value = true;\n },\n onSuggestionsFinishedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== agentId) return;\n isLoading.value = false;\n },\n onSuggestionsConfigChanged: () => {\n const result = core.getSuggestions(agentId);\n suggestions.value = result.suggestions;\n isLoading.value = result.isLoading;\n },\n });\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n );\n\n const reloadSuggestions = () => {\n copilotkit.value.reloadSuggestions(resolvedAgentId.value);\n };\n const clearSuggestions = () => {\n copilotkit.value.clearSuggestions(resolvedAgentId.value);\n };\n\n return {\n suggestions,\n isLoading,\n reloadSuggestions,\n clearSuggestions,\n };\n}\n","import {\n computed,\n onBeforeUnmount,\n onMounted,\n ref,\n shallowRef,\n toValue,\n watch,\n} from \"vue\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport {\n randomUUID,\n getModalityFromMimeType,\n exceedsMaxSize,\n readFileAsBase64,\n generateVideoThumbnail,\n matchesAcceptFilter,\n formatFileSize,\n} from \"@copilotkit/shared\";\nimport type {\n Attachment,\n AttachmentUploadResult,\n AttachmentsConfig,\n} from \"@copilotkit/shared\";\n\nexport interface UseAttachmentsProps {\n config?: MaybeRefOrGetter<AttachmentsConfig | undefined>;\n}\n\nexport interface UseAttachmentsReturn {\n attachments: Ref<Attachment[]>;\n enabled: Ref<boolean>;\n dragOver: Ref<boolean>;\n fileInputRef: Ref<HTMLInputElement | null>;\n containerRef: Ref<HTMLElement | null>;\n processFiles: (files: File[]) => Promise<void>;\n handleFileUpload: (event: Event) => Promise<void>;\n handleDragOver: (event: DragEvent) => void;\n handleDragLeave: (event: DragEvent) => void;\n handleDrop: (event: DragEvent) => Promise<void>;\n removeAttachment: (id: string) => void;\n consumeAttachments: () => Attachment[];\n}\n\nexport function useAttachments(\n props: UseAttachmentsProps,\n): UseAttachmentsReturn {\n const attachments = shallowRef<Attachment[]>([]);\n const dragOver = ref(false);\n const fileInputRef = ref<HTMLInputElement | null>(null);\n const containerRef = ref<HTMLElement | null>(null);\n const configRef = ref<AttachmentsConfig | undefined>(toValue(props.config));\n const attachmentsRef = shallowRef<Attachment[]>(attachments.value);\n const enabled = computed(() => configRef.value?.enabled ?? false);\n\n watch(\n () => toValue(props.config),\n (next) => {\n configRef.value = next;\n },\n { immediate: true },\n );\n\n const setAttachments = (next: Attachment[]) => {\n attachments.value = next;\n attachmentsRef.value = next;\n };\n\n const updateAttachments = (\n updater: (previous: Attachment[]) => Attachment[],\n ) => {\n setAttachments(updater(attachmentsRef.value));\n };\n\n async function processFiles(files: File[]) {\n const config = configRef.value;\n const accept = config?.accept ?? \"*/*\";\n const maxSize = config?.maxSize ?? 20 * 1024 * 1024;\n\n const rejectedFiles = files.filter(\n (file) => !matchesAcceptFilter(file, accept),\n );\n for (const file of rejectedFiles) {\n config?.onUploadFailed?.({\n reason: \"invalid-type\",\n file,\n message: `File \"${file.name}\" is not accepted. Supported types: ${accept}`,\n });\n }\n\n const validFiles = files.filter((file) =>\n matchesAcceptFilter(file, accept),\n );\n for (const file of validFiles) {\n if (exceedsMaxSize(file, maxSize)) {\n config?.onUploadFailed?.({\n reason: \"file-too-large\",\n file,\n message: `File \"${file.name}\" exceeds the maximum size of ${formatFileSize(maxSize)}`,\n });\n continue;\n }\n\n const modality = getModalityFromMimeType(file.type);\n const placeholderId = randomUUID();\n updateAttachments((previous) => [\n ...previous,\n {\n id: placeholderId,\n type: modality,\n source: { type: \"data\", value: \"\", mimeType: file.type },\n filename: file.name,\n size: file.size,\n status: \"uploading\",\n },\n ]);\n\n try {\n let source: Attachment[\"source\"];\n let uploadMetadata: Record<string, unknown> | undefined;\n if (config?.onUpload) {\n const uploadResult: AttachmentUploadResult =\n await config.onUpload(file);\n const { metadata, ...uploadSource } = uploadResult;\n source = uploadSource;\n uploadMetadata = metadata;\n } else {\n const base64 = await readFileAsBase64(file);\n source = { type: \"data\", value: base64, mimeType: file.type };\n }\n\n let thumbnail: string | undefined;\n if (modality === \"video\") {\n thumbnail = await generateVideoThumbnail(file);\n }\n\n updateAttachments((previous) =>\n previous.map((attachment) =>\n attachment.id === placeholderId\n ? {\n ...attachment,\n source,\n status: \"ready\",\n thumbnail,\n metadata: uploadMetadata,\n }\n : attachment,\n ),\n );\n } catch (error) {\n updateAttachments((previous) =>\n previous.filter((attachment) => attachment.id !== placeholderId),\n );\n console.error(`[CopilotKit] Failed to upload \"${file.name}\":`, error);\n config?.onUploadFailed?.({\n reason: \"upload-failed\",\n file,\n message:\n error instanceof Error\n ? error.message\n : `Failed to upload \"${file.name}\"`,\n });\n }\n }\n }\n\n async function handleFileUpload(event: Event) {\n const target = event.target as HTMLInputElement | null;\n if (!target?.files?.length) return;\n await processFiles(Array.from(target.files));\n if (target) target.value = \"\";\n }\n\n function handleDragOver(event: DragEvent) {\n if (!enabled.value) return;\n event.preventDefault();\n event.stopPropagation();\n dragOver.value = true;\n }\n\n function handleDragLeave(event: DragEvent) {\n event.preventDefault();\n event.stopPropagation();\n dragOver.value = false;\n }\n\n async function handleDrop(event: DragEvent) {\n event.preventDefault();\n event.stopPropagation();\n dragOver.value = false;\n if (!enabled.value) return;\n\n const files = Array.from(event.dataTransfer?.files ?? []);\n if (files.length > 0) {\n await processFiles(files);\n }\n }\n\n function removeAttachment(id: string) {\n updateAttachments((previous) =>\n previous.filter((attachment) => attachment.id !== id),\n );\n }\n\n function consumeAttachments() {\n const ready = attachmentsRef.value.filter(\n (attachment) => attachment.status === \"ready\",\n );\n if (ready.length === 0) {\n return ready;\n }\n updateAttachments((previous) =>\n previous.filter((attachment) => attachment.status !== \"ready\"),\n );\n if (fileInputRef.value) {\n fileInputRef.value.value = \"\";\n }\n return ready;\n }\n\n async function handlePaste(event: ClipboardEvent) {\n if (!enabled.value) return;\n\n const target = event.target as HTMLElement | null;\n if (!target || !containerRef.value?.contains(target)) return;\n\n const accept = configRef.value?.accept ?? \"*/*\";\n const items = Array.from(event.clipboardData?.items ?? []);\n const fileItems = items.filter((item) => {\n if (item.kind !== \"file\") return false;\n const file = item.getAsFile();\n return file !== null && matchesAcceptFilter(file, accept);\n });\n if (fileItems.length === 0) return;\n\n event.preventDefault();\n const files = fileItems\n .map((item) => item.getAsFile())\n .filter((file): file is File => file !== null);\n await processFiles(files);\n }\n\n function onPaste(event: ClipboardEvent) {\n void handlePaste(event);\n }\n\n onMounted(() => {\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"paste\", onPaste);\n }\n });\n\n onBeforeUnmount(() => {\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"paste\", onPaste);\n }\n });\n\n return {\n attachments,\n enabled,\n dragOver,\n fileInputRef,\n containerRef,\n processFiles,\n handleFileUpload,\n handleDragOver,\n handleDragLeave,\n handleDrop,\n removeAttachment,\n consumeAttachments,\n };\n}\n","import { onBeforeUnmount, onMounted, readonly, ref } from \"vue\";\nimport type { Ref } from \"vue\";\nimport { ɵinitialKeyboardState, ɵwatchKeyboardState } from \"@copilotkit/core\";\n\n/**\n * Vue-idiomatic result of {@link useKeyboardHeight}. Fields mirror the React\n * `KeyboardState` shape (`isKeyboardOpen`, `keyboardHeight`, `availableHeight`,\n * `viewportHeight`) and are exposed as readonly refs so consumers can bind them\n * reactively inside templates or computed values.\n */\nexport interface KeyboardState {\n isKeyboardOpen: Readonly<Ref<boolean>>;\n keyboardHeight: Readonly<Ref<number>>;\n availableHeight: Readonly<Ref<number>>;\n viewportHeight: Readonly<Ref<number>>;\n}\n\n/**\n * Composable to detect mobile keyboard appearance and calculate available\n * viewport height. Uses the Visual Viewport API to track keyboard state on\n * mobile devices.\n *\n * Mirrors the React `useKeyboardHeight` hook: returns `keyboardHeight` as the\n * difference between `window.innerHeight` and `visualViewport.height`, clamped\n * to `0`, and reports the keyboard as open when the diff exceeds `150` px.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useKeyboardHeight } from \"@copilotkit/vue\";\n *\n * const { isKeyboardOpen, keyboardHeight } = useKeyboardHeight();\n * </script>\n * ```\n */\nexport function useKeyboardHeight(): KeyboardState {\n const initial = ɵinitialKeyboardState();\n const isKeyboardOpen = ref(initial.isKeyboardOpen);\n const keyboardHeight = ref(initial.keyboardHeight);\n const availableHeight = ref(initial.availableHeight);\n const viewportHeight = ref(initial.viewportHeight);\n let stopWatching: (() => void) | undefined;\n\n onMounted(() => {\n stopWatching = ɵwatchKeyboardState((state) => {\n keyboardHeight.value = state.keyboardHeight;\n isKeyboardOpen.value = state.isKeyboardOpen;\n availableHeight.value = state.availableHeight;\n viewportHeight.value = state.viewportHeight;\n });\n });\n\n onBeforeUnmount(() => {\n stopWatching?.();\n stopWatching = undefined;\n });\n\n return {\n isKeyboardOpen: readonly(isKeyboardOpen),\n keyboardHeight: readonly(keyboardHeight),\n availableHeight: readonly(availableHeight),\n viewportHeight: readonly(viewportHeight),\n };\n}\n","import type { InjectionKey, Ref } from \"vue\";\nimport { ref } from \"vue\";\n\n/**\n * Vue counterpart of React's `LastUserMessageContext`.\n *\n * Used by `CopilotChatView` to announce the latest user message\n * to descendants (notably `usePinToSend`), so scroll logic can anchor\n * the viewport to the most recent user turn in \"pin-to-send\" mode.\n *\n * `sendNonce` increments on each new send so repeated IDs (e.g., message\n * edits that preserve the ID) still trigger dependent effects.\n *\n * Vue divergence: React exposes a `React.Context` whose value is replaced\n * via `<Provider value={...}>`. Vue idiomatically provides a `Ref` so\n * descendant `watch` effects fire when the value changes; the underlying\n * `{ id, sendNonce }` shape and semantics match React 1:1.\n */\nexport type LastUserMessageState = {\n id: string | null;\n sendNonce: number;\n};\n\nexport const DEFAULT_LAST_USER_MESSAGE_STATE: LastUserMessageState = {\n id: null,\n sendNonce: 0,\n};\n\nexport const LastUserMessageKey: InjectionKey<Ref<LastUserMessageState>> =\n Symbol(\"LastUserMessage\");\n\n/**\n * Returns the default `LastUserMessageState` ref used when no provider\n * has been mounted above the consumer. Mirrors React's context default\n * value (`{ id: null, sendNonce: 0 }`).\n */\nexport function createDefaultLastUserMessageRef(): Ref<LastUserMessageState> {\n return ref({ ...DEFAULT_LAST_USER_MESSAGE_STATE });\n}\n","import { inject, watch } from \"vue\";\nimport type { Ref } from \"vue\";\nimport { ɵpinMessageToTop } from \"@copilotkit/core\";\nimport {\n LastUserMessageKey,\n createDefaultLastUserMessageRef,\n} from \"../components/chat/last-user-message-context\";\n\nexport interface UsePinToSendOptions {\n scrollRef: Ref<HTMLElement | null>;\n contentRef: Ref<HTMLElement | null>;\n spacerRef: Ref<HTMLElement | null>;\n topOffset?: number;\n}\n\n/**\n * Vue counterpart of React's `usePinToSend` (`packages/react-core/src/hooks/use-pin-to-send.ts`).\n *\n * Anchors the chat scroll container so the most recent user message stays\n * pinned near the top of the viewport while the assistant streams a\n * response beneath it.\n *\n * Reads the latest user message via `LastUserMessageKey` and, on each\n * `sendNonce` increment, runs core's `ɵpinMessageToTop`, which sizes the\n * spacer, scrolls, and follows the reply's growth. The previous pin stops on\n * the next run and on scope dispose.\n */\nexport function usePinToSend({\n scrollRef,\n contentRef,\n spacerRef,\n topOffset = 16,\n}: UsePinToSendOptions): void {\n const lastUserMessage = inject(\n LastUserMessageKey,\n createDefaultLastUserMessageRef(),\n true,\n );\n\n let lastNonce = -1;\n\n watch(\n [\n () => lastUserMessage.value.id,\n () => lastUserMessage.value.sendNonce,\n scrollRef,\n contentRef,\n spacerRef,\n () => topOffset,\n ],\n ([id, sendNonce, scrollEl, contentEl, spacerEl], _old, onCleanup) => {\n if (sendNonce === lastNonce) return;\n lastNonce = sendNonce;\n\n if (!id) return;\n if (!scrollEl || !contentEl || !spacerEl) return;\n\n // Registered through `onCleanup`, so the previous pin stops before the\n // next run and when the watcher stops on scope dispose.\n onCleanup(\n ɵpinMessageToTop({\n scrollEl,\n contentEl,\n spacerEl,\n messageId: id,\n topOffset,\n }),\n );\n },\n { immediate: true, flush: \"post\" },\n );\n}\n","<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from \"vue\";\nimport { ɵcomposerButtonState, ɵresolveComposerKey } from \"@copilotkit/core\";\nimport {\n IconArrowUp,\n IconCheck,\n IconLoader2,\n IconMic,\n IconPlus,\n IconSquare,\n IconX,\n} from \"../icons\";\nimport CopilotChatAudioRecorder from \"./CopilotChatAudioRecorder.vue\";\nimport CopilotTooltip from \"../ui/CopilotTooltip.vue\";\nimport CopilotDropdownMenuContent from \"../ui/CopilotDropdownMenuContent.vue\";\nimport type {\n CopilotDropdownMenuDismissReason,\n CopilotDropdownMenuItem,\n} from \"../ui/dropdown-menu\";\nimport { useCopilotId } from \"../ui/use-id\";\nimport type { CopilotChatAudioRecorderRef } from \"./audioRecorder\";\nimport type { CopilotChatInputMode, ToolsMenuItem } from \"./types\";\nimport { useChatLabels } from \"./use-chat-labels\";\n\ndefineOptions({ inheritAttrs: false });\n\ntype MenuEntry = ToolsMenuItem | \"-\";\ntype MenuDisplayEntry =\n | { type: \"separator\"; key: string }\n | { type: \"label\"; key: string; label: string; depth: number }\n | {\n type: \"item\";\n key: string;\n label: string;\n depth: number;\n action: () => void;\n };\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: string;\n disabled?: boolean;\n placeholder?: string;\n autoFocus?: boolean;\n clearOnSubmit?: boolean;\n mode?: CopilotChatInputMode;\n toolsMenu?: MenuEntry[];\n isRunning?: boolean;\n positioning?: \"static\" | \"absolute\";\n keyboardHeight?: number;\n showDisclaimer?: boolean;\n maxRows?: number;\n /**\n * Set to `true` when the input sits at the bottom of its container as a\n * flex-last-child (visible position is driven by layout, not CSS\n * positioning). Triggers reservation of bottom space for the fixed\n * CopilotKit license banner via the\n * `--copilotkit-license-banner-offset` CSS var so the two don't overlap.\n *\n * Not needed when `positioning === \"absolute\"`; that mode already pins\n * the input to the bottom and picks up the same reservation\n * automatically. Leave unset (default `false`) for inputs rendered\n * mid-layout such as the welcome screen, where the banner offset would\n * push the input off-center.\n */\n bottomAnchored?: boolean;\n onSubmitMessage?: (value: string) => void;\n onStop?: () => void;\n onAddFile?: () => void;\n onStartTranscribe?: () => void;\n onCancelTranscribe?: () => void;\n onFinishTranscribe?: () => void;\n onFinishTranscribeWithAudio?: (audioBlob: Blob) => void | Promise<void>;\n }>(),\n {\n disabled: false,\n autoFocus: true,\n clearOnSubmit: true,\n mode: \"input\",\n toolsMenu: () => [],\n isRunning: false,\n positioning: \"static\",\n keyboardHeight: 0,\n showDisclaimer: undefined,\n maxRows: 5,\n bottomAnchored: false,\n },\n);\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"submit-message\": [value: string];\n stop: [];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n \"finish-transcribe-with-audio\": [audioBlob: Blob];\n}>();\n\nconst attrs = useAttrs();\nconst shellRef = ref<HTMLElement | null>(null);\nconst textareaRef = ref<HTMLTextAreaElement | null>(null);\nconst gridRef = ref<HTMLElement | null>(null);\nconst addButtonContainerRef = ref<HTMLElement | null>(null);\nconst actionsContainerRef = ref<HTMLElement | null>(null);\nconst slashMenuRef = ref<HTMLElement | null>(null);\nconst audioRecorderRef = ref<CopilotChatAudioRecorderRef | null>(null);\nconst localValue = ref(props.modelValue ?? \"\");\nconst isComposing = ref(false);\nconst layout = ref<\"compact\" | \"expanded\">(\"compact\");\nconst commandQuery = ref<string | null>(null);\nconst slashHighlightIndex = ref(0);\nconst previousCommandQuery = ref<string | null>(null);\nconst addMenuOpen = ref(false);\n// Where focus goes as the add menu opens: its first or last item for the\n// keyboard, the menu itself for a pointer, as Radix's DropdownMenu does.\nconst addMenuInitialFocus = ref<\"first\" | \"last\" | \"content\">(\"content\");\nconst addMenuAnchor = ref<HTMLElement | null>(null);\nconst addMenuId = useCopilotId(\"cpk-add-menu\");\nconst addMenuTriggerId = `${addMenuId}-trigger`;\nconst measurements = ref({\n singleLineHeight: 0,\n maxHeight: 0,\n paddingLeft: 0,\n paddingRight: 0,\n});\nconst resizeEvaluationRafRef = ref<number | null>(null);\nconst ignoreResizeRef = ref(false);\nconst measurementCanvasRef = ref<HTMLCanvasElement | null>(null);\nconst containerCacheRef = ref<{\n compactWidth: number;\n} | null>(null);\nconst didWarnMissingFontRef = ref(false);\nconst didWarnMissingCanvasContextRef = ref(false);\nlet resizeObserver: ResizeObserver | null = null;\n\nconst isControlled = computed(() => props.modelValue !== undefined);\nconst inputValue = computed(() =>\n isControlled.value ? (props.modelValue ?? \"\") : localValue.value,\n);\nconst labels = useChatLabels();\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? labels.value.chatInputPlaceholder,\n);\nconst isExpanded = computed(\n () => props.mode === \"input\" && layout.value === \"expanded\",\n);\nconst shouldShowDisclaimer = computed(\n () => props.showDisclaimer ?? props.positioning === \"absolute\",\n);\nconst hasSubmitAction = computed(\n () => typeof props.onSubmitMessage === \"function\",\n);\nconst hasStopAction = computed(() => typeof props.onStop === \"function\");\nconst hasAddFileAction = computed(() => typeof props.onAddFile === \"function\");\nconst hasStartTranscribeAction = computed(\n () => typeof props.onStartTranscribe === \"function\",\n);\nconst hasCancelTranscribeAction = computed(\n () => typeof props.onCancelTranscribe === \"function\",\n);\nconst hasFinishTranscribeAction = computed(\n () =>\n typeof props.onFinishTranscribe === \"function\" ||\n typeof props.onFinishTranscribeWithAudio === \"function\",\n);\nconst composerInput = computed(() => ({\n mode: props.mode,\n isRunning: props.isRunning,\n value: inputValue.value,\n canSubmit: hasSubmitAction.value,\n canStop: hasStopAction.value,\n disabled: props.disabled,\n}));\nconst composerButton = computed(() =>\n ɵcomposerButtonState(composerInput.value),\n);\nconst isProcessing = computed(() => composerButton.value.isProcessing);\nconst sendDisabled = computed(() => composerButton.value.disabled);\nconst showsStop = computed(() => composerButton.value.action === \"stop\");\n\nconst containerClass = computed(() => [\n \"cpk-chat-input\",\n props.positioning === \"absolute\" && \"cpk-chat-input-absolute\",\n attrs.class,\n]);\n\nconst rootAttrs = computed(() => {\n const rest = { ...attrs };\n delete rest.class;\n return rest;\n});\n\nfunction isMenuGroup(\n item: ToolsMenuItem,\n): item is ToolsMenuItem & { items: MenuEntry[] } {\n return Array.isArray((item as ToolsMenuItem).items);\n}\n\nfunction createDefaultAddItem(): ToolsMenuItem | null {\n if (!hasAddFileAction.value) {\n return null;\n }\n return {\n label: labels.value.chatInputToolbarAddButtonLabel,\n action: () => emit(\"add-file\"),\n };\n}\n\nfunction normalizeMenuItems() {\n const items: MenuEntry[] = [];\n const addItem = createDefaultAddItem();\n if (addItem) {\n items.push(addItem);\n }\n\n if (props.toolsMenu.length > 0) {\n if (items.length > 0) {\n items.push(\"-\");\n }\n\n for (const menuEntry of props.toolsMenu) {\n if (menuEntry === \"-\") {\n if (items.length === 0 || items[items.length - 1] === \"-\") {\n continue;\n }\n items.push(\"-\");\n continue;\n }\n\n items.push(menuEntry);\n }\n }\n\n while (items.length > 0 && items[items.length - 1] === \"-\") {\n items.pop();\n }\n\n return items;\n}\n\nconst menuItems = computed(() => normalizeMenuItems());\nconst hasMenuItems = computed(() => menuItems.value.length > 0);\n\nfunction flattenMenuForCommands(items: MenuEntry[]) {\n const seen = new Set<string>();\n const commands: ToolsMenuItem[] = [];\n\n const walk = (entryList: MenuEntry[]) => {\n for (const entry of entryList) {\n if (entry === \"-\") {\n continue;\n }\n\n if (isMenuGroup(entry) && entry.items.length > 0) {\n walk(entry.items);\n continue;\n }\n\n if (!entry.action || seen.has(entry.label)) {\n continue;\n }\n\n seen.add(entry.label);\n commands.push(entry);\n }\n };\n\n walk(items);\n return commands;\n}\n\nconst commandItems = computed(() => flattenMenuForCommands(menuItems.value));\n\nfunction flattenMenuDisplay(items: MenuEntry[], depth = 0, prefix = \"root\") {\n const entries: MenuDisplayEntry[] = [];\n for (const [index, item] of items.entries()) {\n const key = `${prefix}-${index}`;\n if (item === \"-\") {\n entries.push({ type: \"separator\", key: `sep-${key}` });\n continue;\n }\n if (isMenuGroup(item) && item.items.length > 0) {\n entries.push({\n type: \"label\",\n key: `label-${key}`,\n label: item.label,\n depth,\n });\n entries.push(...flattenMenuDisplay(item.items, depth + 1, key));\n continue;\n }\n if (item.action) {\n entries.push({\n type: \"item\",\n key: `item-${key}`,\n label: item.label,\n depth,\n action: item.action,\n });\n }\n }\n return entries;\n}\n\nconst menuDisplayItems = computed(() => flattenMenuDisplay(menuItems.value));\n\nconst filteredCommands = computed(() => {\n if (commandQuery.value === null || commandItems.value.length === 0) {\n return [] as ToolsMenuItem[];\n }\n\n const normalized = commandQuery.value.trim().toLowerCase();\n if (normalized.length === 0) {\n return commandItems.value;\n }\n\n const startsWith: ToolsMenuItem[] = [];\n const contains: ToolsMenuItem[] = [];\n\n for (const command of commandItems.value) {\n const label = command.label.toLowerCase();\n if (label.startsWith(normalized)) {\n startsWith.push(command);\n continue;\n }\n if (label.includes(normalized)) {\n contains.push(command);\n }\n }\n\n return [...startsWith, ...contains];\n});\n\nconst slashMenuVisible = computed(\n () => commandQuery.value !== null && commandItems.value.length > 0,\n);\n\nfunction updateInputValue(nextValue: string) {\n if (!isControlled.value) {\n localValue.value = nextValue;\n }\n emit(\"update:modelValue\", nextValue);\n}\n\nfunction clearInputValue() {\n updateInputValue(\"\");\n}\n\nfunction updateSlashState(value: string) {\n if (commandItems.value.length === 0) {\n commandQuery.value = null;\n return;\n }\n\n if (value.startsWith(\"/\")) {\n const firstLine = value.split(/\\r?\\n/, 1)[0] ?? \"\";\n commandQuery.value = firstLine.slice(1);\n return;\n }\n\n commandQuery.value = null;\n}\n\nfunction runCommand(command: ToolsMenuItem) {\n clearInputValue();\n command.action?.();\n commandQuery.value = null;\n slashHighlightIndex.value = 0;\n requestAnimationFrame(() => {\n textareaRef.value?.focus();\n });\n}\n\nfunction submit() {\n if (props.mode !== \"input\" || props.disabled || !hasSubmitAction.value) {\n return;\n }\n // In controlled mode, parent-updated modelValue can lag one tick behind\n // the actual textarea value during intense runtime/connect churn.\n const rawValue = textareaRef.value?.value ?? inputValue.value;\n const trimmed = rawValue.trim();\n if (!trimmed) {\n return;\n }\n\n emit(\"submit-message\", trimmed);\n\n if (props.clearOnSubmit) {\n clearInputValue();\n }\n\n textareaRef.value?.focus();\n}\n\nfunction handleInput(event: Event) {\n const nextValue = (event.target as HTMLTextAreaElement).value;\n updateInputValue(nextValue);\n updateSlashState(nextValue);\n}\n\n// The button stops a run whatever the input holds. Enter differs: see\n// handleKeydown.\nfunction handleSendButtonClick() {\n if (showsStop.value) {\n emit(\"stop\");\n return;\n }\n if (!isProcessing.value) {\n submit();\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n if (props.disabled) {\n return;\n }\n\n if (isComposing.value || event.isComposing || event.keyCode === 229) {\n return;\n }\n\n if (commandQuery.value !== null && props.mode === \"input\") {\n if (event.key === \"ArrowDown\") {\n if (filteredCommands.value.length > 0) {\n event.preventDefault();\n slashHighlightIndex.value =\n slashHighlightIndex.value < 0\n ? 0\n : (slashHighlightIndex.value + 1) % filteredCommands.value.length;\n }\n return;\n }\n\n if (event.key === \"ArrowUp\") {\n if (filteredCommands.value.length > 0) {\n event.preventDefault();\n if (slashHighlightIndex.value < 0) {\n slashHighlightIndex.value = filteredCommands.value.length - 1;\n } else {\n slashHighlightIndex.value =\n slashHighlightIndex.value <= 0\n ? filteredCommands.value.length - 1\n : slashHighlightIndex.value - 1;\n }\n }\n return;\n }\n\n if (event.key === \"Enter\") {\n const selected =\n slashHighlightIndex.value >= 0\n ? filteredCommands.value[slashHighlightIndex.value]\n : undefined;\n if (selected) {\n event.preventDefault();\n runCommand(selected);\n return;\n }\n }\n\n if (event.key === \"Escape\") {\n event.preventDefault();\n commandQuery.value = null;\n return;\n }\n }\n\n if (props.mode !== \"input\") {\n return;\n }\n\n // Enter with text sends, also while a run is going. Enter in an empty input\n // stops the run. Read the textarea: a controlled modelValue can lag a tick.\n const action = ɵresolveComposerKey(event, {\n ...composerInput.value,\n value: textareaRef.value?.value ?? inputValue.value,\n });\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n }\n if (action === \"send\") {\n submit();\n } else if (action === \"stop\") {\n emit(\"stop\");\n }\n}\n\n/** The add button, or the first button of a custom `add-menu-button` slot. */\nfunction getAddMenuTrigger(): HTMLElement | null {\n const container = addButtonContainerRef.value;\n return container?.querySelector<HTMLElement>(\"button\") ?? container ?? null;\n}\n\nfunction toggleAddMenu(focus: \"first\" | \"last\" | \"content\" = \"content\") {\n if (!hasMenuItems.value || props.mode === \"transcribe\" || props.disabled) {\n return;\n }\n if (addMenuOpen.value) {\n closeAddMenu();\n return;\n }\n addMenuAnchor.value = getAddMenuTrigger();\n addMenuInitialFocus.value = focus;\n addMenuOpen.value = true;\n}\n\nfunction closeAddMenu(options: { returnFocus?: boolean } = {}) {\n if (!addMenuOpen.value) {\n return;\n }\n addMenuOpen.value = false;\n if (options.returnFocus) {\n getAddMenuTrigger()?.focus();\n }\n}\n\nfunction handleMenuAction(action: () => void) {\n // As Radix does, the menu closes and focus returns to its trigger first, so\n // an action that moves focus (for example into the textarea) keeps it.\n closeAddMenu({ returnFocus: true });\n action();\n}\n\nfunction handleAddMenuSelect(item: CopilotDropdownMenuItem) {\n if (item.action) {\n handleMenuAction(item.action);\n }\n}\n\nfunction handleAddMenuDismiss(reason: CopilotDropdownMenuDismissReason) {\n // A pointer down outside leaves focus where the pointer put it.\n closeAddMenu({ returnFocus: reason !== \"outside\" });\n}\n\n// A pointer down opens the menu, as Radix's trigger does; the click that\n// follows it then must not toggle it again. Keyboard and synthetic clicks\n// (detail 0) still toggle it from the click.\nlet addMenuPointerToggled = false;\n\nfunction handleAddMenuPointerDown(event: PointerEvent) {\n if (event.button !== 0 || event.ctrlKey) {\n return;\n }\n addMenuPointerToggled = true;\n if (!addMenuOpen.value) {\n // Keep focus off the trigger, so the menu can take it.\n event.preventDefault();\n }\n toggleAddMenu(\"content\");\n}\n\nfunction handleAddMenuClick(event: MouseEvent) {\n if (addMenuPointerToggled) {\n addMenuPointerToggled = false;\n return;\n }\n toggleAddMenu(event.detail === 0 ? \"first\" : \"content\");\n}\n\nfunction handleAddMenuTriggerKeydown(event: KeyboardEvent) {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n toggleAddMenu(\"first\");\n } else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!addMenuOpen.value) {\n toggleAddMenu(event.key === \"ArrowDown\" ? \"first\" : \"last\");\n }\n }\n}\n\nasync function handleFinishTranscribe() {\n const recorder = audioRecorderRef.value;\n if (recorder && recorder.state === \"recording\") {\n try {\n const blob = await recorder.stop();\n emit(\"finish-transcribe-with-audio\", blob);\n } catch (error) {\n console.error(\"Failed to stop recording:\", error);\n }\n }\n emit(\"finish-transcribe\");\n}\n\nfunction handleContainerClick(event: MouseEvent) {\n const target = event.target as HTMLElement | null;\n if (!target || props.mode !== \"input\") {\n return;\n }\n if (target.tagName === \"BUTTON\" || target.closest(\"button\")) {\n return;\n }\n textareaRef.value?.focus();\n}\n\nfunction ensureMeasurements() {\n const textarea = textareaRef.value;\n if (!textarea || isComposing.value) {\n return;\n }\n\n const previousValue = textarea.value;\n const previousHeight = textarea.style.height;\n textarea.style.height = \"auto\";\n\n const computedStyle = window.getComputedStyle(textarea);\n const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;\n const paddingRight = parseFloat(computedStyle.paddingRight) || 0;\n const paddingTop = parseFloat(computedStyle.paddingTop) || 0;\n const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;\n\n textarea.value = \"\";\n const singleLineHeight = textarea.scrollHeight;\n textarea.value = previousValue;\n\n const contentHeight = singleLineHeight - paddingTop - paddingBottom;\n const maxHeight = contentHeight * props.maxRows + paddingTop + paddingBottom;\n\n measurements.value = {\n singleLineHeight,\n maxHeight,\n paddingLeft,\n paddingRight,\n };\n\n textarea.style.height = previousHeight;\n textarea.style.maxHeight = `${maxHeight}px`;\n}\n\nfunction adjustTextareaHeight() {\n const textarea = textareaRef.value;\n if (!textarea) {\n return 0;\n }\n\n if (measurements.value.singleLineHeight === 0) {\n ensureMeasurements();\n }\n\n const { maxHeight } = measurements.value;\n if (maxHeight) {\n textarea.style.maxHeight = `${maxHeight}px`;\n }\n\n textarea.style.height = \"auto\";\n const scrollHeight = textarea.scrollHeight;\n textarea.style.height = `${maxHeight ? Math.min(scrollHeight, maxHeight) : scrollHeight}px`;\n return scrollHeight;\n}\n\nfunction updateLayout(nextLayout: \"compact\" | \"expanded\") {\n if (layout.value === nextLayout) {\n return;\n }\n ignoreResizeRef.value = true;\n layout.value = nextLayout;\n}\n\nfunction resolveTextareaFont(textarea: HTMLTextAreaElement): string | null {\n const textareaStyles = window.getComputedStyle(textarea);\n if (textareaStyles.font?.trim()) {\n return textareaStyles.font;\n }\n\n if (textareaStyles.fontSize && textareaStyles.fontFamily) {\n const fallbackFont =\n `${textareaStyles.fontStyle} ${textareaStyles.fontVariant} ` +\n `${textareaStyles.fontWeight} ${textareaStyles.fontSize}/${textareaStyles.lineHeight} ` +\n `${textareaStyles.fontFamily}`;\n if (fallbackFont.trim()) {\n return fallbackFont;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\" && !didWarnMissingFontRef.value) {\n didWarnMissingFontRef.value = true;\n console.warn(\n \"[CopilotChatInput] Could not resolve textarea font for layout measurement. \" +\n \"Text-width-based expansion will be skipped until the next container resize.\",\n );\n }\n return null;\n}\n\nfunction updateContainerCache() {\n const grid = gridRef.value;\n const addContainer = addButtonContainerRef.value;\n const actionsContainer = actionsContainerRef.value;\n if (!grid || !addContainer || !actionsContainer) {\n containerCacheRef.value = null;\n return null;\n }\n\n const gridStyles = window.getComputedStyle(grid);\n const paddingLeft = parseFloat(gridStyles.paddingLeft) || 0;\n const paddingRight = parseFloat(gridStyles.paddingRight) || 0;\n const columnGap = parseFloat(gridStyles.columnGap) || 0;\n const gridAvailableWidth = grid.clientWidth - paddingLeft - paddingRight;\n if (gridAvailableWidth <= 0) {\n containerCacheRef.value = null;\n return null;\n }\n\n const addWidth = addContainer.getBoundingClientRect().width;\n const actionsWidth = actionsContainer.getBoundingClientRect().width;\n const compactWidth = Math.max(\n gridAvailableWidth - addWidth - actionsWidth - columnGap * 2,\n 0,\n );\n if (compactWidth <= 0) {\n containerCacheRef.value = null;\n return null;\n }\n\n const cache = { compactWidth };\n containerCacheRef.value = cache;\n return cache;\n}\n\nfunction evaluateLayout() {\n if (props.mode !== \"input\") {\n updateLayout(\"compact\");\n return;\n }\n\n if (\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(max-width: 767px)\").matches\n ) {\n ensureMeasurements();\n adjustTextareaHeight();\n updateLayout(\"expanded\");\n return;\n }\n\n const textarea = textareaRef.value;\n if (\n !textarea ||\n !gridRef.value ||\n !addButtonContainerRef.value ||\n !actionsContainerRef.value\n ) {\n return;\n }\n\n if (measurements.value.singleLineHeight === 0) {\n ensureMeasurements();\n }\n\n const scrollHeight = adjustTextareaHeight();\n const baseline = measurements.value.singleLineHeight;\n const hasExplicitBreak = inputValue.value.includes(\"\\n\");\n const renderedMultiline = baseline > 0 ? scrollHeight > baseline + 1 : false;\n let shouldExpand = hasExplicitBreak || renderedMultiline;\n\n if (!shouldExpand) {\n const cache = containerCacheRef.value ?? updateContainerCache();\n if (cache && cache.compactWidth > 0) {\n const compactInnerWidth = Math.max(\n cache.compactWidth -\n measurements.value.paddingLeft -\n measurements.value.paddingRight,\n 0,\n );\n\n if (compactInnerWidth > 0) {\n const canvas =\n measurementCanvasRef.value ?? document.createElement(\"canvas\");\n if (!measurementCanvasRef.value) {\n measurementCanvasRef.value = canvas;\n }\n\n const context = canvas.getContext(\"2d\");\n if (context) {\n const resolvedFont = resolveTextareaFont(textarea);\n if (resolvedFont) {\n context.font = resolvedFont;\n const lines =\n inputValue.value.length > 0 ? inputValue.value.split(\"\\n\") : [\"\"];\n let longestLine = 0;\n for (const line of lines) {\n const width = context.measureText(line || \" \").width;\n if (width > longestLine) {\n longestLine = width;\n }\n }\n if (longestLine > compactInnerWidth) {\n shouldExpand = true;\n }\n }\n } else if (\n process.env.NODE_ENV !== \"production\" &&\n !didWarnMissingCanvasContextRef.value\n ) {\n didWarnMissingCanvasContextRef.value = true;\n console.warn(\n \"[CopilotChatInput] canvas.getContext('2d') returned null. \" +\n \"Text-width-based expansion will be skipped.\",\n );\n }\n }\n }\n }\n\n updateLayout(shouldExpand ? \"expanded\" : \"compact\");\n}\n\nfunction scheduleLayoutEvaluation(invalidateCache: boolean) {\n if (ignoreResizeRef.value) {\n ignoreResizeRef.value = false;\n return;\n }\n\n if (invalidateCache) {\n containerCacheRef.value = null;\n didWarnMissingFontRef.value = false;\n didWarnMissingCanvasContextRef.value = false;\n }\n\n if (resizeEvaluationRafRef.value !== null) {\n cancelAnimationFrame(resizeEvaluationRafRef.value);\n }\n\n resizeEvaluationRafRef.value = requestAnimationFrame(() => {\n resizeEvaluationRafRef.value = null;\n evaluateLayout();\n });\n}\n\nwatch(\n () => props.modelValue,\n (next) => {\n if (isControlled.value) {\n localValue.value = next ?? \"\";\n }\n },\n);\n\nwatch(inputValue, (value) => {\n updateSlashState(value);\n evaluateLayout();\n});\n\nwatch(commandItems, () => {\n if (commandItems.value.length === 0) {\n commandQuery.value = null;\n }\n});\n\nwatch(\n [commandQuery, () => filteredCommands.value.length],\n ([query, filteredCount]) => {\n if (\n query !== null &&\n query !== previousCommandQuery.value &&\n filteredCount > 0\n ) {\n slashHighlightIndex.value = 0;\n }\n\n previousCommandQuery.value = query;\n },\n { immediate: true },\n);\n\nwatch(\n [commandQuery, filteredCommands],\n () => {\n if (commandQuery.value === null) {\n slashHighlightIndex.value = 0;\n return;\n }\n if (filteredCommands.value.length === 0) {\n slashHighlightIndex.value = -1;\n return;\n }\n if (\n slashHighlightIndex.value < 0 ||\n slashHighlightIndex.value >= filteredCommands.value.length\n ) {\n slashHighlightIndex.value = 0;\n }\n },\n { immediate: true },\n);\n\nwatch(\n () => props.mode,\n async (mode) => {\n if (mode !== \"input\") {\n layout.value = \"compact\";\n commandQuery.value = null;\n closeAddMenu();\n }\n\n const recorder = audioRecorderRef.value;\n if (!recorder) {\n return;\n }\n\n if (mode === \"transcribe\") {\n try {\n await recorder.start();\n } catch (error) {\n console.error(error);\n }\n return;\n }\n\n if (recorder.state === \"recording\") {\n try {\n await recorder.stop();\n } catch {\n // ignore transition stop failures\n }\n }\n },\n { immediate: true },\n);\n\nwatch(\n audioRecorderRef,\n async (recorder) => {\n if (!recorder || props.mode !== \"transcribe\") {\n return;\n }\n if (recorder.state === \"idle\") {\n try {\n await recorder.start();\n } catch (error) {\n console.error(error);\n }\n }\n },\n { immediate: true },\n);\n\nwatch(slashHighlightIndex, async (index) => {\n if (!slashMenuVisible.value || index < 0) {\n return;\n }\n await nextTick();\n const active = slashMenuRef.value?.querySelector<HTMLElement>(\n `[data-slash-index=\"${index}\"]`,\n );\n active?.scrollIntoView?.({ block: \"nearest\" });\n});\n\nwatch(\n () => props.disabled,\n (disabled) => {\n if (disabled) {\n closeAddMenu();\n }\n },\n);\n\nonMounted(() => {\n if (props.autoFocus && props.mode === \"input\") {\n textareaRef.value?.focus();\n }\n\n evaluateLayout();\n\n if (typeof ResizeObserver !== \"undefined\") {\n const containerTargets = new Set<HTMLElement>();\n if (gridRef.value) containerTargets.add(gridRef.value);\n if (addButtonContainerRef.value)\n containerTargets.add(addButtonContainerRef.value);\n if (actionsContainerRef.value)\n containerTargets.add(actionsContainerRef.value);\n\n resizeObserver = new ResizeObserver((entries) => {\n const shouldInvalidate = entries.some((entry) =>\n containerTargets.has(entry.target as HTMLElement),\n );\n scheduleLayoutEvaluation(shouldInvalidate);\n });\n\n if (gridRef.value) resizeObserver.observe(gridRef.value);\n if (addButtonContainerRef.value)\n resizeObserver.observe(addButtonContainerRef.value);\n if (actionsContainerRef.value)\n resizeObserver.observe(actionsContainerRef.value);\n if (textareaRef.value) resizeObserver.observe(textareaRef.value);\n }\n});\n\nonBeforeUnmount(() => {\n resizeObserver?.disconnect();\n resizeObserver = null;\n if (resizeEvaluationRafRef.value !== null) {\n cancelAnimationFrame(resizeEvaluationRafRef.value);\n resizeEvaluationRafRef.value = null;\n }\n});\n</script>\n\n<template>\n <div\n data-copilotkit\n data-testid=\"copilot-chat-input-container\"\n :class=\"containerClass\"\n :style=\"{\n transform:\n keyboardHeight > 0 ? `translateY(-${keyboardHeight}px)` : undefined,\n transition: 'transform 0.2s ease-out',\n ...(positioning === 'absolute' || bottomAnchored\n ? { paddingBottom: 'var(--copilotkit-license-banner-offset, 0px)' }\n : {}),\n }\"\n v-bind=\"rootAttrs\"\n >\n <div class=\"cpk-chat-input-wrapper\">\n <slot\n name=\"layout\"\n :mode=\"mode\"\n :is-multiline=\"isExpanded\"\n :value=\"inputValue\"\n :disabled=\"disabled\"\n :placeholder=\"resolvedPlaceholder\"\n :is-processing=\"isProcessing\"\n :send-disabled=\"sendDisabled\"\n :menu-open=\"addMenuOpen\"\n :menu-items=\"menuDisplayItems\"\n :on-toggle-menu=\"() => toggleAddMenu()\"\n :on-menu-action=\"handleMenuAction\"\n :on-update-value=\"updateInputValue\"\n :on-submit=\"submit\"\n :on-keydown=\"handleKeydown\"\n :on-send-click=\"handleSendButtonClick\"\n :on-start-transcribe=\"() => emit('start-transcribe')\"\n :on-cancel-transcribe=\"() => emit('cancel-transcribe')\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n >\n <div\n ref=\"shellRef\"\n data-testid=\"copilot-chat-input-shell\"\n class=\"copilotKitInput cpk-chat-input-pill\"\n :data-layout=\"isExpanded ? 'expanded' : 'compact'\"\n @click=\"handleContainerClick\"\n >\n <div\n ref=\"gridRef\"\n class=\"cpk-chat-input-grid\"\n :data-layout=\"isExpanded ? 'expanded' : 'compact'\"\n >\n <div ref=\"addButtonContainerRef\" class=\"cpk-chat-input-start\">\n <slot\n name=\"add-menu-button\"\n :disabled=\"disabled || mode === 'transcribe' || !hasMenuItems\"\n :menu-open=\"addMenuOpen\"\n :toggle-menu=\"() => toggleAddMenu()\"\n :labels=\"labels\"\n >\n <CopilotTooltip side=\"bottom\" :suppressed=\"addMenuOpen\">\n <template #default=\"{ triggerProps }\">\n <button\n v-bind=\"triggerProps\"\n :id=\"addMenuTriggerId\"\n type=\"button\"\n data-testid=\"copilot-chat-input-add\"\n :aria-label=\"labels.chatInputToolbarAddButtonLabel\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"addMenuOpen\"\n :aria-controls=\"addMenuOpen ? addMenuId : undefined\"\n :data-state=\"addMenuOpen ? 'open' : 'closed'\"\n :disabled=\"\n disabled || mode === 'transcribe' || !hasMenuItems\n \"\n class=\"cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-add-menu-button\"\n @pointerdown=\"handleAddMenuPointerDown\"\n @click.stop=\"handleAddMenuClick\"\n @keydown=\"handleAddMenuTriggerKeydown\"\n >\n <IconPlus class=\"cpk-chat-input-add-menu-icon\" />\n </button>\n </template>\n <template #content>\n <p class=\"cpk-chat-input-add-menu-tooltip\">\n <span>{{ labels.chatInputToolbarAddButtonLabel }}</span>\n <code class=\"cpk-chat-input-add-menu-shortcut\">/</code>\n </p>\n </template>\n </CopilotTooltip>\n </slot>\n\n <CopilotDropdownMenuContent\n :id=\"addMenuId\"\n :open=\"addMenuOpen && hasMenuItems\"\n :anchor=\"addMenuAnchor\"\n :items=\"menuItems\"\n :menu-id=\"addMenuId\"\n :labelled-by=\"addMenuAnchor?.id || undefined\"\n side=\"top\"\n align=\"start\"\n :side-offset=\"4\"\n :initial-focus=\"addMenuInitialFocus\"\n data-testid=\"copilot-chat-input-add-menu\"\n @select=\"handleAddMenuSelect\"\n @dismiss=\"handleAddMenuDismiss\"\n />\n </div>\n\n <div class=\"cpk-chat-input-field\">\n <template v-if=\"mode === 'transcribe'\">\n <slot name=\"audio-recorder\">\n <CopilotChatAudioRecorder ref=\"audioRecorderRef\" />\n </slot>\n </template>\n <template v-else-if=\"mode === 'processing'\">\n <div class=\"cpk-chat-input-processing\">\n <IconLoader2 class=\"cpk-chat-input-processing-spinner\" />\n </div>\n </template>\n <template v-else>\n <slot\n name=\"text-area\"\n :value=\"inputValue\"\n :disabled=\"disabled\"\n :placeholder=\"resolvedPlaceholder\"\n :on-input=\"handleInput\"\n :on-keydown=\"handleKeydown\"\n :auto-focus=\"autoFocus\"\n :is-expanded=\"isExpanded\"\n :rows=\"1\"\n :labels=\"labels\"\n >\n <textarea\n ref=\"textareaRef\"\n data-testid=\"copilot-chat-input-textarea\"\n :value=\"inputValue\"\n :placeholder=\"resolvedPlaceholder\"\n :disabled=\"disabled\"\n rows=\"1\"\n :class=\"[\n 'cpk-chat-input-textarea',\n isExpanded\n ? 'cpk-chat-input-textarea-expanded'\n : 'cpk-chat-input-textarea-compact',\n ]\"\n style=\"overflow: auto; resize: none\"\n @input=\"handleInput\"\n @keydown=\"handleKeydown\"\n @compositionstart=\"isComposing = true\"\n @compositionend=\"isComposing = false\"\n />\n </slot>\n\n <div\n v-if=\"slashMenuVisible\"\n ref=\"slashMenuRef\"\n data-testid=\"copilot-slash-menu\"\n role=\"listbox\"\n :aria-label=\"labels.chatInputSlashMenuLabel\"\n class=\"cpk-chat-input-slash-menu\"\n :style=\"{ maxHeight: `${5 * 40}px` }\"\n >\n <div\n v-if=\"filteredCommands.length === 0\"\n class=\"cpk-chat-input-slash-menu-empty\"\n >\n {{ labels.chatInputSlashMenuEmptyText }}\n </div>\n <button\n v-for=\"(command, index) in filteredCommands\"\n v-else\n :key=\"`${command.label}-${index}`\"\n type=\"button\"\n role=\"option\"\n :data-slash-index=\"index\"\n :aria-selected=\"index === slashHighlightIndex\"\n :data-active=\"\n index === slashHighlightIndex ? 'true' : undefined\n \"\n class=\"cpk-chat-input-slash-menu-item\"\n @mouseenter=\"slashHighlightIndex = index\"\n @mousedown.prevent=\"runCommand(command)\"\n >\n {{ command.label }}\n </button>\n </div>\n </template>\n </div>\n\n <div ref=\"actionsContainerRef\" class=\"cpk-chat-input-actions\">\n <template v-if=\"mode === 'transcribe'\">\n <slot\n v-if=\"\n hasCancelTranscribeAction ||\n $slots['cancel-transcribe-button']\n \"\n name=\"cancel-transcribe-button\"\n :disabled=\"disabled\"\n :on-click=\"() => emit('cancel-transcribe')\"\n :labels=\"labels\"\n >\n <CopilotTooltip\n side=\"bottom\"\n :content=\"\n labels.chatInputToolbarCancelTranscribeButtonLabel\n \"\n >\n <template #default=\"{ triggerProps }\">\n <button\n v-bind=\"triggerProps\"\n type=\"button\"\n data-testid=\"copilot-chat-input-cancel-transcribe\"\n :aria-label=\"\n labels.chatInputToolbarCancelTranscribeButtonLabel\n \"\n :disabled=\"disabled\"\n class=\"cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-cancel-transcribe-button\"\n @click=\"emit('cancel-transcribe')\"\n >\n <IconX class=\"cpk-chat-input-toolbar-icon\" />\n </button>\n </template>\n </CopilotTooltip>\n </slot>\n <slot\n v-if=\"\n hasFinishTranscribeAction ||\n $slots['finish-transcribe-button']\n \"\n name=\"finish-transcribe-button\"\n :disabled=\"disabled\"\n :on-click=\"handleFinishTranscribe\"\n :labels=\"labels\"\n >\n <CopilotTooltip\n side=\"bottom\"\n :content=\"\n labels.chatInputToolbarFinishTranscribeButtonLabel\n \"\n >\n <template #default=\"{ triggerProps }\">\n <button\n v-bind=\"triggerProps\"\n type=\"button\"\n data-testid=\"copilot-chat-input-finish-transcribe\"\n :aria-label=\"\n labels.chatInputToolbarFinishTranscribeButtonLabel\n \"\n :disabled=\"disabled\"\n class=\"cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-finish-transcribe-button\"\n @click=\"handleFinishTranscribe\"\n >\n <IconCheck class=\"cpk-chat-input-toolbar-icon\" />\n </button>\n </template>\n </CopilotTooltip>\n </slot>\n </template>\n <template v-else>\n <slot\n v-if=\"\n hasStartTranscribeAction ||\n $slots['start-transcribe-button']\n \"\n name=\"start-transcribe-button\"\n :disabled=\"disabled\"\n :on-click=\"() => emit('start-transcribe')\"\n :labels=\"labels\"\n >\n <CopilotTooltip\n side=\"bottom\"\n :content=\"labels.chatInputToolbarStartTranscribeButtonLabel\"\n >\n <template #default=\"{ triggerProps }\">\n <button\n v-bind=\"triggerProps\"\n type=\"button\"\n data-testid=\"copilot-chat-input-start-transcribe\"\n :aria-label=\"\n labels.chatInputToolbarStartTranscribeButtonLabel\n \"\n :disabled=\"disabled\"\n class=\"cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-start-transcribe-button\"\n @click=\"emit('start-transcribe')\"\n >\n <IconMic class=\"cpk-chat-input-toolbar-icon\" />\n </button>\n </template>\n </CopilotTooltip>\n </slot>\n <slot\n name=\"send-button\"\n :disabled=\"sendDisabled\"\n :is-processing=\"isProcessing\"\n :on-click=\"handleSendButtonClick\"\n >\n <div class=\"cpk-chat-input-send\">\n <button\n type=\"button\"\n data-testid=\"copilot-chat-input-send\"\n :aria-label=\"\n showsStop\n ? labels.chatInputToolbarStopButtonLabel\n : labels.chatInputToolbarSendButtonLabel\n \"\n :disabled=\"sendDisabled\"\n class=\"cpk-button cpk-button-chat-input-toolbar-primary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-send-button\"\n @click=\"handleSendButtonClick\"\n >\n <IconSquare\n v-if=\"showsStop\"\n class=\"cpk-chat-input-stop-icon\"\n />\n <IconArrowUp v-else class=\"cpk-chat-input-send-icon\" />\n </button>\n </div>\n </slot>\n </template>\n </div>\n </div>\n </div>\n </slot>\n </div>\n\n <slot v-if=\"shouldShowDisclaimer\" name=\"disclaimer\" :labels=\"labels\">\n <p\n data-testid=\"copilot-chat-input-disclaimer\"\n class=\"cpk-chat-input-disclaimer\"\n >\n {{ labels.chatDisclaimerText }}\n </p>\n </slot>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A full-screen preview, teleported to `document.body`, as React's\n * `<Lightbox>`. It closes on Escape, a click on the backdrop, or its close\n * button, which is named by `labels.attachmentPreviewCloseButtonLabel`.\n *\n * Beyond React, it is a modal dialog for assistive technology: focus moves to\n * the close button when it opens, Tab stays inside it, and focus returns to\n * the element that opened it (or `returnFocusTo`) when it closes.\n */\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref } from \"vue\";\nimport { IconX } from \"../icons\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\n\nconst props = defineProps<{\n /** Accessible name of the dialog, for example the file name. */\n label?: string;\n /** Where focus goes on close. Defaults to the element focused on open. */\n returnFocusTo?: HTMLElement | null;\n}>();\n\nconst emit = defineEmits<{ close: [] }>();\n\ndefineSlots<{ default(): unknown }>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\n\nconst root = ref<HTMLElement | null>(null);\nconst closeButton = ref<HTMLButtonElement | null>(null);\nlet previouslyFocused: HTMLElement | null = null;\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), audio[controls], video[controls], iframe, [tabindex]:not([tabindex=\"-1\"])';\n\nfunction handleKeydown(event: KeyboardEvent) {\n if (event.key === \"Escape\") emit(\"close\");\n}\n\n/** Keeps Tab inside the lightbox while it is open. */\nfunction handleTab(event: KeyboardEvent) {\n if (event.key !== \"Tab\" || !root.value) return;\n const focusables = Array.from(\n root.value.querySelectorAll<HTMLElement>(FOCUSABLE),\n );\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n if (!first || !last) return;\n const active = document.activeElement;\n if (event.shiftKey && (active === first || !root.value.contains(active))) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n}\n\nonMounted(() => {\n if (typeof document === \"undefined\") return;\n previouslyFocused =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n document.addEventListener(\"keydown\", handleKeydown);\n void nextTick(() => closeButton.value?.focus());\n});\n\nonBeforeUnmount(() => {\n if (typeof document === \"undefined\") return;\n document.removeEventListener(\"keydown\", handleKeydown);\n const target = props.returnFocusTo ?? previouslyFocused;\n if (target?.isConnected) target.focus();\n});\n</script>\n\n<template>\n <Teleport to=\"body\">\n <div\n ref=\"root\"\n class=\"cpk-attachment-lightbox\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-label=\"label\"\n data-testid=\"copilot-chat-attachment-lightbox\"\n @click=\"emit('close')\"\n @keydown=\"handleTab\"\n >\n <button\n ref=\"closeButton\"\n type=\"button\"\n class=\"cpk-attachment-lightbox-close-button\"\n :aria-label=\"labels.attachmentPreviewCloseButtonLabel\"\n @click.stop=\"emit('close')\"\n >\n <IconX class=\"cpk-attachment-lightbox-close-icon\" aria-hidden=\"true\" />\n </button>\n\n <div data-testid=\"copilot-chat-attachment-lightbox-content\" @click.stop>\n <slot />\n </div>\n </div>\n </Teleport>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport {\n formatFileSize,\n getDocumentIcon,\n getSourceUrl,\n} from \"@copilotkit/shared\";\nimport type { Attachment } from \"@copilotkit/shared\";\nimport type { CopilotChatAttachmentQueueProps } from \"./types\";\nimport { IconPlay } from \"../icons\";\nimport CopilotChatLightbox from \"./CopilotChatLightbox.vue\";\nimport { useChatLabels } from \"./use-chat-labels\";\n\nconst props = withDefaults(defineProps<CopilotChatAttachmentQueueProps>(), {\n attachments: () => [],\n className: \"\",\n});\n\nconst emit = defineEmits<{\n \"remove-attachment\": [id: string];\n}>();\n\nconst labels = useChatLabels();\n\nconst activeLightboxAttachment = ref<Attachment | null>(null);\nconst documentBlobUrl = ref<string | null>(null);\n\nconst lightboxLabel = computed(() => {\n const attachment = activeLightboxAttachment.value;\n if (!attachment) return undefined;\n if (attachment.filename) return attachment.filename;\n return attachment.type === \"image\"\n ? labels.value.attachmentImageAltText\n : attachment.type === \"video\"\n ? \"Video attachment\"\n : labels.value.attachmentDocumentLabel;\n});\nconst isPreviewableDocument = computed(() => {\n const attachment = activeLightboxAttachment.value;\n if (!attachment || attachment.type !== \"document\") return false;\n const mimeType = attachment.source.mimeType;\n return isPdf(mimeType) || isText(mimeType);\n});\nconst decodedTextPreview = computed(() => {\n const attachment = activeLightboxAttachment.value;\n if (!attachment || attachment.type !== \"document\") return null;\n const mimeType = attachment.source.mimeType;\n if (!isText(mimeType) || attachment.source.type !== \"data\") return null;\n try {\n return atob(attachment.source.value);\n } catch {\n return attachment.source.value;\n }\n});\nconst lightboxDocumentSource = computed(() => {\n const attachment = activeLightboxAttachment.value;\n if (!attachment || attachment.type !== \"document\") return null;\n if (attachment.source.type === \"url\") return attachment.source.value;\n return documentBlobUrl.value;\n});\n\nwatch(\n activeLightboxAttachment,\n (next, previous) => {\n if (documentBlobUrl.value) {\n URL.revokeObjectURL(documentBlobUrl.value);\n documentBlobUrl.value = null;\n }\n\n if (\n !next ||\n next.type !== \"document\" ||\n next.source.type !== \"data\" ||\n typeof window === \"undefined\"\n ) {\n return;\n }\n\n const mimeType = next.source.mimeType;\n if (!isPdf(mimeType) && !isText(mimeType)) {\n return;\n }\n\n const blobUrl = createBlobUrl(next.source.value, mimeType);\n documentBlobUrl.value = blobUrl;\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n if (documentBlobUrl.value) {\n URL.revokeObjectURL(documentBlobUrl.value);\n documentBlobUrl.value = null;\n }\n});\n\nfunction openLightbox(attachment: Attachment) {\n if (typeof document !== \"undefined\") {\n const withTransition = document as Document & {\n startViewTransition?: (cb: () => void) => unknown;\n };\n if (typeof withTransition.startViewTransition === \"function\") {\n withTransition.startViewTransition(() => {\n activeLightboxAttachment.value = attachment;\n });\n return;\n }\n }\n activeLightboxAttachment.value = attachment;\n}\n\nfunction closeLightbox() {\n activeLightboxAttachment.value = null;\n}\n\nfunction cardClassName(attachment: Attachment) {\n if (attachment.type === \"image\" || attachment.type === \"video\") {\n return \"cpk-attachment-queue-item-media\";\n }\n if (attachment.type === \"audio\") {\n return \"cpk-attachment-queue-item-audio\";\n }\n return \"cpk-attachment-queue-item-document\";\n}\n\nfunction isPdf(mimeType: string | undefined): boolean {\n return !!mimeType && mimeType.includes(\"pdf\");\n}\n\nfunction isText(mimeType: string | undefined): boolean {\n return !!mimeType && mimeType.startsWith(\"text/\");\n}\n\nfunction createBlobUrl(\n base64Value: string,\n mimeType: string | undefined,\n): string | null {\n try {\n const binary = atob(base64Value);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i += 1) {\n bytes[i] = binary.charCodeAt(i);\n }\n const blob = new Blob([bytes], {\n type: mimeType || \"application/octet-stream\",\n });\n return URL.createObjectURL(blob);\n } catch (error) {\n console.error(\"[CopilotKit] Failed to decode attachment data:\", error);\n return null;\n }\n}\n</script>\n\n<template>\n <div\n v-if=\"props.attachments.length > 0\"\n class=\"cpk-attachment-queue\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-queue\"\n >\n <div\n v-for=\"attachment in props.attachments\"\n :key=\"attachment.id\"\n class=\"cpk-attachment-queue-item\"\n :class=\"cardClassName(attachment)\"\n data-testid=\"copilot-chat-attachment-item\"\n :data-card-type=\"attachment.type\"\n >\n <div\n v-if=\"attachment.status === 'uploading'\"\n class=\"cpk-attachment-queue-uploading-overlay\"\n data-testid=\"copilot-chat-attachment-uploading-overlay\"\n >\n <div class=\"cpk-attachment-queue-uploading-spinner\" />\n </div>\n\n <template v-if=\"attachment.status === 'ready'\">\n <button\n v-if=\"attachment.type === 'image'\"\n type=\"button\"\n class=\"cpk-attachment-queue-preview-button\"\n data-testid=\"copilot-chat-attachment-image-button\"\n @click=\"openLightbox(attachment)\"\n >\n <img\n :src=\"getSourceUrl(attachment.source)\"\n :alt=\"attachment.filename || 'Image attachment'\"\n class=\"cpk-attachment-queue-image\"\n data-testid=\"copilot-chat-attachment-image-thumbnail\"\n />\n </button>\n\n <template v-else-if=\"attachment.type === 'video'\">\n <div class=\"cpk-attachment-queue-video\">\n <img\n v-if=\"attachment.thumbnail\"\n :src=\"attachment.thumbnail\"\n :alt=\"attachment.filename || 'Video thumbnail'\"\n class=\"cpk-attachment-queue-video-thumbnail\"\n data-testid=\"copilot-chat-attachment-video-thumbnail\"\n />\n <video\n v-else\n :src=\"getSourceUrl(attachment.source)\"\n preload=\"metadata\"\n muted\n class=\"cpk-attachment-queue-video-thumbnail\"\n data-testid=\"copilot-chat-attachment-video-fallback\"\n />\n </div>\n <button\n type=\"button\"\n class=\"cpk-attachment-queue-video-play-button\"\n :aria-label=\"labels.attachmentPlayVideoButtonLabel\"\n data-testid=\"copilot-chat-attachment-video-play\"\n @click=\"openLightbox(attachment)\"\n >\n <div class=\"cpk-attachment-queue-video-play-badge\">\n <IconPlay class=\"cpk-attachment-queue-video-play-icon\" />\n </div>\n </button>\n </template>\n\n <div\n v-else-if=\"attachment.type === 'audio'\"\n class=\"cpk-attachment-queue-audio\"\n >\n <audio\n :src=\"getSourceUrl(attachment.source)\"\n controls\n preload=\"metadata\"\n class=\"cpk-attachment-queue-audio-player\"\n data-testid=\"copilot-chat-attachment-audio-player\"\n />\n <span\n v-if=\"attachment.filename\"\n class=\"cpk-attachment-queue-audio-filename\"\n >\n {{ attachment.filename }}\n </span>\n </div>\n\n <button\n v-else\n type=\"button\"\n class=\"cpk-attachment-queue-preview-button cpk-attachment-queue-document\"\n :class=\"{\n 'cpk-attachment-queue-document-previewable':\n isPdf(attachment.source.mimeType) ||\n isText(attachment.source.mimeType),\n }\"\n data-testid=\"copilot-chat-attachment-document-button\"\n @click=\"\n (isPdf(attachment.source.mimeType) ||\n isText(attachment.source.mimeType)) &&\n openLightbox(attachment)\n \"\n >\n <div class=\"cpk-attachment-queue-document-icon\">\n {{ getDocumentIcon(attachment.source.mimeType ?? \"\") }}\n </div>\n <div class=\"cpk-attachment-queue-document-info\">\n <span\n class=\"cpk-attachment-queue-document-name\"\n data-testid=\"copilot-chat-attachment-document-filename\"\n >\n {{ attachment.filename || labels.attachmentDocumentLabel }}\n </span>\n <span\n v-if=\"attachment.size != null\"\n class=\"cpk-attachment-queue-document-size\"\n >\n {{ formatFileSize(attachment.size) }}\n </span>\n </div>\n </button>\n </template>\n\n <div\n v-else\n class=\"cpk-attachment-queue-placeholder\"\n data-testid=\"copilot-chat-attachment-placeholder\"\n />\n\n <button\n type=\"button\"\n class=\"cpk-attachment-queue-remove-button\"\n :aria-label=\"labels.attachmentRemoveButtonLabel\"\n @click=\"emit('remove-attachment', attachment.id)\"\n >\n ✕\n </button>\n </div>\n </div>\n\n <CopilotChatLightbox\n v-if=\"activeLightboxAttachment\"\n :label=\"lightboxLabel\"\n @close=\"closeLightbox\"\n >\n <img\n v-if=\"activeLightboxAttachment.type === 'image'\"\n :src=\"getSourceUrl(activeLightboxAttachment.source)\"\n :alt=\"activeLightboxAttachment.filename || 'Image attachment'\"\n class=\"cpk-attachment-queue-lightbox-image\"\n data-testid=\"copilot-chat-attachment-lightbox-image\"\n />\n\n <video\n v-else-if=\"activeLightboxAttachment.type === 'video'\"\n :src=\"getSourceUrl(activeLightboxAttachment.source)\"\n controls\n autoplay\n class=\"cpk-attachment-queue-lightbox-video\"\n data-testid=\"copilot-chat-attachment-lightbox-video\"\n />\n\n <template v-else-if=\"activeLightboxAttachment.type === 'document'\">\n <iframe\n v-if=\"\n isPreviewableDocument &&\n isPdf(activeLightboxAttachment.source.mimeType) &&\n lightboxDocumentSource\n \"\n :src=\"lightboxDocumentSource\"\n :title=\"activeLightboxAttachment.filename || 'PDF preview'\"\n class=\"cpk-attachment-queue-pdf-preview\"\n data-testid=\"copilot-chat-attachment-lightbox-document-iframe\"\n />\n\n <div\n v-else-if=\"\n isPreviewableDocument &&\n isText(activeLightboxAttachment.source.mimeType)\n \"\n class=\"cpk-attachment-queue-text-preview\"\n >\n <div\n v-if=\"activeLightboxAttachment.filename\"\n class=\"cpk-attachment-queue-text-preview-filename\"\n >\n {{ activeLightboxAttachment.filename }}\n </div>\n <pre\n v-if=\"decodedTextPreview !== null\"\n class=\"cpk-attachment-queue-text-preview-content\"\n data-testid=\"copilot-chat-attachment-lightbox-document-text\"\n >{{ decodedTextPreview }}</pre\n >\n <iframe\n v-else-if=\"lightboxDocumentSource\"\n :src=\"lightboxDocumentSource\"\n :title=\"activeLightboxAttachment.filename || 'Text preview'\"\n class=\"cpk-attachment-queue-text-preview-frame\"\n data-testid=\"copilot-chat-attachment-lightbox-document-iframe\"\n />\n </div>\n\n <div\n v-else\n class=\"cpk-attachment-queue-document-card\"\n data-testid=\"copilot-chat-attachment-lightbox-document-fallback\"\n >\n <div class=\"cpk-attachment-queue-document-card-icon\">\n {{ getDocumentIcon(activeLightboxAttachment.source.mimeType ?? \"\") }}\n </div>\n <div class=\"cpk-attachment-queue-document-card-details\">\n <div class=\"cpk-attachment-queue-document-card-name\">\n {{\n activeLightboxAttachment.filename ||\n labels.attachmentDocumentLabel\n }}\n </div>\n <div class=\"cpk-attachment-queue-document-card-meta\">\n {{\n activeLightboxAttachment.source.mimeType ||\n labels.attachmentUnknownTypeText\n }}\n {{\n activeLightboxAttachment.size != null\n ? ` · ${formatFileSize(activeLightboxAttachment.size)}`\n : \"\"\n }}\n </div>\n </div>\n <div class=\"cpk-attachment-queue-document-card-note\">\n {{ labels.attachmentNoPreviewText }}\n </div>\n </div>\n </template>\n </CopilotChatLightbox>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport type { Message, ReasoningMessage } from \"@ag-ui/core\";\nimport { IconChevronRight } from \"../icons\";\nimport StreamingMarkdownDefault from \"./StreamingMarkdownDefault.vue\";\nimport { ɵformatLabel, ɵformatReasoningDurationLabel } from \"@copilotkit/core\";\nimport { useChatLabels } from \"./use-chat-labels\";\n\nconst props = withDefaults(\n defineProps<{\n message: ReasoningMessage;\n messages?: Message[];\n isRunning?: boolean;\n }>(),\n {\n messages: () => [],\n isRunning: false,\n },\n);\n\ndefineSlots<{\n layout?: (props: {\n message: ReasoningMessage;\n messages: Message[];\n isRunning: boolean;\n header: {\n isOpen: boolean;\n label: string;\n hasContent: boolean;\n isStreaming: boolean;\n elapsedSeconds: number;\n onClick?: () => void;\n };\n contentView: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n };\n toggle: {\n isOpen: boolean;\n contentView: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n };\n };\n }) => unknown;\n header?: (props: {\n isOpen: boolean;\n label: string;\n hasContent: boolean;\n isStreaming: boolean;\n /** Seconds spent reasoning so far, for building a localized label. */\n elapsedSeconds: number;\n onClick?: () => void;\n }) => unknown;\n \"content-view\"?: (props: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n }) => unknown;\n toggle?: (props: {\n isOpen: boolean;\n contentView: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n };\n }) => unknown;\n}>();\n\nconst normalizedContent = computed(() =>\n typeof props.message.content === \"string\" ? props.message.content : \"\",\n);\nconst hasContent = computed(() => normalizedContent.value.length > 0);\nconst isLatest = computed(\n () => props.messages[props.messages.length - 1]?.id === props.message.id,\n);\nconst isStreaming = computed(() => !!(props.isRunning && isLatest.value));\n\nconst elapsed = ref(0);\nconst isOpen = ref(isStreaming.value);\nconst userToggledDuringStreaming = ref(false);\nlet startTimeMs: number | null = null;\nlet elapsedInterval: ReturnType<typeof setInterval> | null = null;\n\nfunction clearElapsedInterval() {\n if (elapsedInterval) {\n clearInterval(elapsedInterval);\n elapsedInterval = null;\n }\n}\n\nfunction updateElapsedNow() {\n if (startTimeMs !== null) {\n elapsed.value = (Date.now() - startTimeMs) / 1000;\n }\n}\n\nwatch(\n isStreaming,\n (nextIsStreaming) => {\n if (nextIsStreaming) {\n if (startTimeMs === null) {\n startTimeMs = Date.now();\n }\n clearElapsedInterval();\n elapsedInterval = setInterval(updateElapsedNow, 1000);\n userToggledDuringStreaming.value = false;\n isOpen.value = true;\n return;\n }\n\n clearElapsedInterval();\n updateElapsedNow();\n if (!userToggledDuringStreaming.value) {\n isOpen.value = false;\n }\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n clearElapsedInterval();\n});\n\nconst labels = useChatLabels();\n/** `labels.reasoningMessageThinkingLabel` while streaming, then \"Thought for …\". */\nconst label = computed(() =>\n isStreaming.value\n ? labels.value.reasoningMessageThinkingLabel\n : ɵformatLabel(labels.value.reasoningMessageThoughtForLabel, {\n duration: ɵformatReasoningDurationLabel(elapsed.value, labels.value),\n }),\n);\n\nfunction toggleOpen() {\n if (!hasContent.value) return;\n userToggledDuringStreaming.value = true;\n isOpen.value = !isOpen.value;\n}\n</script>\n\n<template>\n <div\n data-copilotkit\n class=\"cpk-reasoning-message\"\n :data-message-id=\"message.id\"\n >\n <slot\n name=\"layout\"\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n :header=\"{\n isOpen,\n label,\n hasContent,\n isStreaming,\n elapsedSeconds: elapsed,\n onClick: hasContent ? toggleOpen : undefined,\n }\"\n :content-view=\"{\n isStreaming,\n hasContent,\n content: normalizedContent,\n }\"\n :toggle=\"{\n isOpen,\n contentView: {\n isStreaming,\n hasContent,\n content: normalizedContent,\n },\n }\"\n >\n <slot\n name=\"header\"\n :is-open=\"isOpen\"\n :label=\"label\"\n :has-content=\"hasContent\"\n :is-streaming=\"isStreaming\"\n :elapsed-seconds=\"elapsed\"\n :on-click=\"hasContent ? toggleOpen : undefined\"\n >\n <button\n type=\"button\"\n class=\"cpk-reasoning-message-header\"\n :class=\"{ 'cpk-reasoning-message-header-expandable': hasContent }\"\n :aria-expanded=\"hasContent ? isOpen : undefined\"\n @click=\"hasContent ? toggleOpen() : undefined\"\n >\n <span class=\"cpk-reasoning-message-label\">{{ label }}</span>\n <span\n v-if=\"isStreaming && !hasContent\"\n class=\"cpk-reasoning-message-indicator\"\n >\n <span class=\"cpk-reasoning-message-indicator-dot\" />\n </span>\n <IconChevronRight\n v-if=\"hasContent\"\n class=\"cpk-reasoning-message-chevron\"\n :class=\"{ 'cpk-reasoning-message-chevron-open': isOpen }\"\n />\n </button>\n </slot>\n\n <slot\n name=\"toggle\"\n :is-open=\"isOpen\"\n :content-view=\"{\n isStreaming,\n hasContent,\n content: normalizedContent,\n }\"\n >\n <div\n class=\"cpk-reasoning-message-toggle\"\n :style=\"{ gridTemplateRows: isOpen ? '1fr' : '0fr' }\"\n >\n <div class=\"cpk-reasoning-message-toggle-content\">\n <slot\n name=\"content-view\"\n :is-streaming=\"isStreaming\"\n :has-content=\"hasContent\"\n :content=\"normalizedContent\"\n >\n <div\n v-if=\"hasContent || isStreaming\"\n class=\"cpk-reasoning-message-content\"\n >\n <div class=\"cpk-reasoning-message-text\">\n <!-- Reasoning content uses the streaming renderer (same as assistant);\n the pluggable provider renderer applies to assistant messages only. -->\n <StreamingMarkdownDefault\n :content=\"normalizedContent\"\n :is-streaming=\"isStreaming\"\n />\n <span\n v-if=\"isStreaming && hasContent\"\n class=\"cpk-reasoning-message-cursor\"\n >\n <span class=\"cpk-reasoning-message-cursor-dot\" />\n </span>\n </div>\n </div>\n </slot>\n </div>\n </div>\n </slot>\n </slot>\n </div>\n</template>\n","import { nextTick, ref } from \"vue\";\nimport { useCopilotId } from \"../ui/use-id\";\n\ntype DocWithVT = Document & {\n startViewTransition?: (cb: () => void | Promise<void>) => {\n finished: Promise<void>;\n };\n};\n\n/**\n * Opens and closes a lightbox, using the View Transition API to morph the\n * thumbnail into the full-screen content, as React's `useLightbox`.\n *\n * `view-transition-name` must be on exactly one element at a time: on the\n * thumbnail in the old state, and on the lightbox content (bind `vtName` to\n * it) in the new one. The transition callback waits for Vue to render the\n * change, so the API can snapshot old and new correctly.\n * @internal\n */\nexport function useLightbox() {\n const thumbnailRef = ref<HTMLElement | null>(null);\n const open = ref(false);\n // A custom ident: Vue's ids can hold characters CSS does not allow there.\n const vtName = useCopilotId(\"cpk-lightbox\").replace(/[^\\w-]/g, \"-\");\n\n const openLightbox = () => {\n const thumb = thumbnailRef.value;\n const doc =\n typeof document === \"undefined\" ? undefined : (document as DocWithVT);\n\n if (doc?.startViewTransition && thumb) {\n thumb.style.viewTransitionName = vtName;\n doc.startViewTransition(async () => {\n thumb.style.viewTransitionName = \"\";\n open.value = true;\n await nextTick();\n });\n } else {\n open.value = true;\n }\n };\n\n const closeLightbox = () => {\n const thumb = thumbnailRef.value;\n const doc =\n typeof document === \"undefined\" ? undefined : (document as DocWithVT);\n\n if (doc?.startViewTransition && thumb) {\n const transition = doc.startViewTransition(async () => {\n open.value = false;\n await nextTick();\n thumb.style.viewTransitionName = vtName;\n });\n const clear = () => {\n thumb.style.viewTransitionName = \"\";\n };\n transition.finished.then(clear, clear);\n } else {\n open.value = false;\n }\n };\n\n return { thumbnailRef, vtName, open, openLightbox, closeLightbox };\n}\n","<script setup lang=\"ts\">\nimport { computed, ref } from \"vue\";\nimport { getDocumentIcon, getSourceUrl } from \"@copilotkit/shared\";\nimport type { CopilotChatAttachmentRendererProps } from \"./types\";\nimport CopilotChatLightbox from \"./CopilotChatLightbox.vue\";\nimport { useLightbox } from \"./use-lightbox\";\nimport { useChatLabels } from \"./use-chat-labels\";\n\nconst props = withDefaults(defineProps<CopilotChatAttachmentRendererProps>(), {\n filename: undefined,\n className: \"\",\n});\n\nconst labels = useChatLabels();\nconst imageLoadFailed = ref(false);\nconst sourceUrl = computed(() => getSourceUrl(props.source));\nconst documentLabel = computed(\n () =>\n props.filename ||\n props.source.mimeType ||\n labels.value.attachmentUnknownTypeText,\n);\nconst documentAriaLabel = computed(\n () =>\n props.filename ||\n props.source.mimeType ||\n labels.value.attachmentDocumentAltText,\n);\n\nconst imageButton = ref<HTMLButtonElement | null>(null);\nconst {\n thumbnailRef,\n vtName,\n open: lightboxOpen,\n openLightbox,\n closeLightbox,\n} = useLightbox();\n</script>\n\n<template>\n <!-- React opens the lightbox from the <img>; a button around it lets\n keyboard users open it too. The button has no look of its own. -->\n <button\n v-if=\"props.type === 'image' && !imageLoadFailed\"\n ref=\"imageButton\"\n type=\"button\"\n class=\"cpk-attachment-renderer-image-button\"\n data-testid=\"copilot-chat-attachment-renderer-image-button\"\n @click=\"openLightbox\"\n >\n <img\n ref=\"thumbnailRef\"\n :src=\"sourceUrl\"\n :alt=\"labels.attachmentImageAltText\"\n class=\"cpk-attachment-renderer cpk-attachment-renderer-image\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-image\"\n @error=\"imageLoadFailed = true\"\n />\n <!-- Teleported to the body; inside the button only to keep one root. -->\n <CopilotChatLightbox\n v-if=\"lightboxOpen\"\n :label=\"labels.attachmentImageAltText\"\n :return-focus-to=\"imageButton\"\n @close=\"closeLightbox\"\n >\n <img\n :style=\"{ viewTransitionName: vtName }\"\n :src=\"sourceUrl\"\n :alt=\"labels.attachmentImageAltText\"\n class=\"cpk-attachment-renderer-lightbox-image\"\n data-testid=\"copilot-chat-attachment-renderer-lightbox-image\"\n />\n </CopilotChatLightbox>\n </button>\n <div\n v-else-if=\"props.type === 'image'\"\n class=\"cpk-attachment-renderer cpk-attachment-renderer-image-error\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-image-fallback\"\n >\n <span>{{ labels.attachmentImageLoadErrorText }}</span>\n </div>\n\n <div\n v-else-if=\"props.type === 'audio'\"\n class=\"cpk-attachment-renderer cpk-attachment-renderer-audio\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-audio\"\n >\n <audio\n :src=\"sourceUrl\"\n controls\n preload=\"metadata\"\n class=\"cpk-attachment-renderer-audio-player\"\n />\n <span\n v-if=\"props.filename\"\n class=\"cpk-attachment-renderer-audio-filename\"\n data-testid=\"copilot-chat-attachment-renderer-audio-filename\"\n >\n {{ props.filename }}\n </span>\n </div>\n\n <video\n v-else-if=\"props.type === 'video'\"\n :src=\"sourceUrl\"\n controls\n preload=\"metadata\"\n class=\"cpk-attachment-renderer cpk-attachment-renderer-video\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-video\"\n />\n\n <!-- `download` is honoured for same-origin, data: and blob: URLs. Browsers\n ignore it for cross-origin URLs unless the server sends\n `Content-Disposition: attachment`; `target=\"_blank\"` keeps those from\n navigating the chat away and opens the file in a new tab instead. -->\n <a\n v-else\n :href=\"sourceUrl\"\n :download=\"props.filename ?? ''\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :aria-label=\"documentAriaLabel\"\n class=\"cpk-attachment-renderer cpk-attachment-renderer-document\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-document\"\n >\n <span\n class=\"cpk-attachment-renderer-document-icon\"\n data-testid=\"copilot-chat-attachment-renderer-document-icon\"\n >\n {{ getDocumentIcon(props.source.mimeType ?? \"\") }}\n </span>\n <span\n class=\"cpk-attachment-renderer-document-name\"\n data-testid=\"copilot-chat-attachment-renderer-document-label\"\n >\n {{ documentLabel }}\n </span>\n </a>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { UserMessage } from \"@ag-ui/core\";\nimport {\n ɵflattenUserMessageContent,\n ɵgetBranchNavState,\n ɵgetUserMessageMediaFilename,\n ɵgetUserMessageMediaParts,\n} from \"@copilotkit/core\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport {\n IconCheck,\n IconChevronLeft,\n IconChevronRight,\n IconCopy,\n IconEdit,\n} from \"../icons\";\nimport CopilotTooltip from \"../ui/CopilotTooltip.vue\";\nimport CopilotChatAttachmentRenderer from \"./CopilotChatAttachmentRenderer.vue\";\nimport { useCopyFeedback } from \"./use-copy-feedback\";\nimport type {\n CopilotChatUserMessageBranchNavigationSlotProps,\n CopilotChatUserMessageCopyButtonSlotProps,\n CopilotChatUserMessageEditButtonSlotProps,\n CopilotChatUserMessageLayoutSlotProps,\n CopilotChatUserMessageMessageRendererSlotProps,\n CopilotChatUserMessageOnEditMessageProps,\n CopilotChatUserMessageOnSwitchToBranchProps,\n CopilotChatUserMessageToolbarSlotProps,\n} from \"./types\";\n\nconst props = withDefaults(\n defineProps<{\n message: UserMessage;\n branchIndex?: number;\n numberOfBranches?: number;\n onEditMessage?: (payload: CopilotChatUserMessageOnEditMessageProps) => void;\n onSwitchToBranch?: (\n payload: CopilotChatUserMessageOnSwitchToBranchProps,\n ) => void;\n }>(),\n {\n branchIndex: 0,\n numberOfBranches: 1,\n },\n);\n\ndefineSlots<{\n \"message-renderer\"?: (\n props: CopilotChatUserMessageMessageRendererSlotProps,\n ) => unknown;\n toolbar?: (props: CopilotChatUserMessageToolbarSlotProps) => unknown;\n \"copy-button\"?: (props: CopilotChatUserMessageCopyButtonSlotProps) => unknown;\n \"edit-button\"?: (props: CopilotChatUserMessageEditButtonSlotProps) => unknown;\n \"branch-navigation\"?: (\n props: CopilotChatUserMessageBranchNavigationSlotProps,\n ) => unknown;\n layout?: (props: CopilotChatUserMessageLayoutSlotProps) => unknown;\n \"toolbar-items\"?: () => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"edit-message\": [payload: CopilotChatUserMessageOnEditMessageProps];\n \"switch-to-branch\": [payload: CopilotChatUserMessageOnSwitchToBranchProps];\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst { copied, copy } = useCopyFeedback();\n\n// Styles live in @copilotkit/core (ui/button.css, user-message.css).\nconst toolbarButtonClass =\n \"cpk-button cpk-button-assistant-message-toolbar cpk-button-size-default\";\n\nconst mediaParts = computed(() =>\n ɵgetUserMessageMediaParts(props.message.content),\n);\n\nconst flattenedContent = computed(() =>\n ɵflattenUserMessageContent(props.message.content),\n);\nconst isMultiline = computed(() => flattenedContent.value.includes(\"\\n\"));\nconst hasEditAction = computed(() => typeof props.onEditMessage === \"function\");\nconst branchNav = computed(() =>\n ɵgetBranchNavState({\n branchIndex: props.branchIndex,\n numberOfBranches: props.numberOfBranches,\n canSwitch: typeof props.onSwitchToBranch === \"function\",\n }),\n);\nconst showBranchNavigation = computed(() => branchNav.value.show);\nconst canGoPrev = computed(() => branchNav.value.canGoPrev);\nconst canGoNext = computed(() => branchNav.value.canGoNext);\n\nasync function handleCopyMessage() {\n await copy(flattenedContent.value);\n}\n\nfunction handleEditMessage() {\n if (!hasEditAction.value) {\n return;\n }\n const payload = { message: props.message };\n emit(\"edit-message\", payload);\n}\n\nfunction switchToBranch(branchIndex: number) {\n if (!showBranchNavigation.value) {\n return;\n }\n const payload = {\n branchIndex,\n numberOfBranches: props.numberOfBranches,\n message: props.message,\n };\n emit(\"switch-to-branch\", payload);\n}\n\nfunction goPrev() {\n if (!canGoPrev.value) {\n return;\n }\n switchToBranch(props.branchIndex - 1);\n}\n\nfunction goNext() {\n if (!canGoNext.value) {\n return;\n }\n switchToBranch(props.branchIndex + 1);\n}\n</script>\n\n<template>\n <slot\n name=\"layout\"\n :message=\"message\"\n :content=\"flattenedContent\"\n :is-multiline=\"isMultiline\"\n :show-branch-navigation=\"showBranchNavigation\"\n :has-edit-action=\"hasEditAction\"\n :branch-index=\"branchIndex\"\n :number-of-branches=\"numberOfBranches\"\n :can-go-prev=\"canGoPrev\"\n :can-go-next=\"canGoNext\"\n :on-copy=\"handleCopyMessage\"\n :on-edit=\"handleEditMessage\"\n :go-prev=\"goPrev\"\n :go-next=\"goNext\"\n :copied=\"copied\"\n >\n <div\n data-copilotkit\n data-testid=\"copilot-user-message\"\n class=\"copilotKitMessage copilotKitUserMessage cpk-user-message\"\n :data-message-id=\"message.id\"\n v-bind=\"$attrs\"\n >\n <div\n v-if=\"mediaParts.length > 0\"\n class=\"cpk-user-message-attachments\"\n data-testid=\"copilot-user-message-attachments\"\n >\n <CopilotChatAttachmentRenderer\n v-for=\"(part, index) in mediaParts\"\n :key=\"index\"\n :type=\"part.type\"\n :source=\"part.source\"\n :filename=\"ɵgetUserMessageMediaFilename(part)\"\n />\n </div>\n\n <slot\n name=\"message-renderer\"\n :message=\"message\"\n :content=\"flattenedContent\"\n :is-multiline=\"isMultiline\"\n >\n <div class=\"cpk-user-message-bubble\">\n {{ flattenedContent }}\n </div>\n </slot>\n\n <slot\n name=\"toolbar\"\n :message=\"message\"\n :show-branch-navigation=\"showBranchNavigation\"\n :has-edit-action=\"hasEditAction\"\n >\n <div\n data-testid=\"copilot-user-toolbar\"\n class=\"cpk-user-message-toolbar\"\n >\n <div class=\"cpk-user-message-toolbar-items\">\n <slot name=\"toolbar-items\" />\n\n <slot\n name=\"copy-button\"\n :on-copy=\"handleCopyMessage\"\n :copied=\"copied\"\n :label=\"labels.userMessageToolbarCopyMessageLabel\"\n >\n <CopilotTooltip\n v-slot=\"{ triggerProps }\"\n :content=\"labels.userMessageToolbarCopyMessageLabel\"\n side=\"bottom\"\n >\n <button\n data-testid=\"copilot-user-copy-button\"\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.userMessageToolbarCopyMessageLabel\"\n v-bind=\"triggerProps\"\n @click=\"handleCopyMessage\"\n >\n <IconCheck\n v-if=\"copied\"\n class=\"cpk-user-message-toolbar-icon\"\n />\n <IconCopy v-else class=\"cpk-user-message-toolbar-icon\" />\n </button>\n </CopilotTooltip>\n </slot>\n\n <slot\n v-if=\"hasEditAction || $slots['edit-button']\"\n name=\"edit-button\"\n :on-edit=\"handleEditMessage\"\n :label=\"labels.userMessageToolbarEditMessageLabel\"\n >\n <CopilotTooltip\n v-slot=\"{ triggerProps }\"\n :content=\"labels.userMessageToolbarEditMessageLabel\"\n side=\"bottom\"\n >\n <button\n data-testid=\"copilot-edit-button\"\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.userMessageToolbarEditMessageLabel\"\n v-bind=\"triggerProps\"\n @click=\"handleEditMessage\"\n >\n <IconEdit class=\"cpk-user-message-toolbar-icon\" />\n </button>\n </CopilotTooltip>\n </slot>\n\n <slot\n v-if=\"\n numberOfBranches > 1 &&\n (showBranchNavigation || $slots['branch-navigation'])\n \"\n name=\"branch-navigation\"\n :branch-index=\"branchIndex\"\n :number-of-branches=\"numberOfBranches\"\n :can-go-prev=\"canGoPrev\"\n :can-go-next=\"canGoNext\"\n :go-prev=\"goPrev\"\n :go-next=\"goNext\"\n >\n <div\n data-testid=\"copilot-branch-navigation\"\n class=\"cpk-user-message-branch-navigation\"\n >\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n class=\"cpk-user-message-branch-button\"\n :disabled=\"!canGoPrev\"\n :aria-label=\"labels.userMessageToolbarPreviousBranchLabel\"\n @click=\"goPrev\"\n >\n <IconChevronLeft class=\"cpk-user-message-branch-icon\" />\n </button>\n <span class=\"cpk-user-message-branch-counter\">\n {{ branchIndex + 1 }}/{{ numberOfBranches }}\n </span>\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n class=\"cpk-user-message-branch-button\"\n :disabled=\"!canGoNext\"\n :aria-label=\"labels.userMessageToolbarNextBranchLabel\"\n @click=\"goNext\"\n >\n <IconChevronRight class=\"cpk-user-message-branch-icon\" />\n </button>\n </div>\n </slot>\n </div>\n </div>\n </slot>\n </div>\n </slot>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The line at the top of a reply in the `\"turn\"` tool-call display. While the\n * agent works it reads \"Working 4s\"; once the reply is done it reads \"Worked\n * for 9s · 7 tools\" and toggles the work it folded away.\n */\nimport { computed, ref, watch } from \"vue\";\nimport { ɵgetWorkSummaryText } from \"@copilotkit/core\";\nimport { IconChevronRight } from \"../icons\";\nimport type { CopilotChatWorkSummarySlotProps } from \"./types\";\nimport { useChatLabels } from \"./use-chat-labels\";\n\n// `onClick` falls through to the button.\nconst props = defineProps<Omit<CopilotChatWorkSummarySlotProps, \"onClick\">>();\n\n// The current time, updated every second while the agent works.\nconst now = ref(Date.now());\nwatch(\n () => props.isWorking,\n (working, _previous, onCleanup) => {\n if (!working) return;\n now.value = Date.now();\n const timer = setInterval(() => {\n now.value = Date.now();\n }, 1000);\n onCleanup(() => clearInterval(timer));\n },\n { immediate: true },\n);\n\nconst labels = useChatLabels();\nconst text = computed(() =>\n ɵgetWorkSummaryText({\n isWorking: props.isWorking,\n calls: props.calls,\n elapsedMs: props.elapsedMs,\n workingSince: props.workingSince,\n now: now.value,\n labels: labels.value,\n }),\n);\n</script>\n\n<template>\n <button\n type=\"button\"\n data-copilotkit\n data-testid=\"copilot-work-summary\"\n :data-state=\"isWorking ? 'working' : 'done'\"\n :aria-expanded=\"isOpen ? 'true' : 'false'\"\n class=\"cpk-work-summary\"\n >\n <span :class=\"['cpk-work-summary-label', isWorking && 'cpk-shimmer']\">{{\n text.label\n }}</span>\n <span\n v-if=\"text.detail !== null\"\n :class=\"[\n 'cpk-work-summary-detail',\n isWorking && 'cpk-work-summary-timer',\n ]\"\n >{{ text.detail }}</span\n >\n <span v-if=\"text.failed !== null\" class=\"cpk-work-summary-failed\">{{\n text.failed\n }}</span>\n <IconChevronRight\n aria-hidden=\"true\"\n :class=\"[\n 'cpk-work-summary-chevron',\n isOpen && 'cpk-work-summary-chevron-open',\n ]\"\n />\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, h, onMounted, provide, ref, useSlots, watch } from \"vue\";\nimport type { Component, FunctionalComponent, VNode, VNodeChild } from \"vue\";\nimport type {\n ActivityMessage,\n AssistantMessage,\n Message,\n ReasoningMessage,\n ToolMessage,\n UserMessage,\n} from \"@ag-ui/core\";\nimport {\n DEFAULT_AGENT_ID,\n commitRowKeyStore,\n createRowKeyStore,\n resolveRowRenderKeysById,\n} from \"@copilotkit/shared\";\nimport {\n ɵdeduplicateMessages,\n ɵgetToolCallLayouts,\n ɵgetToolCallRendererNames,\n ɵgetTurnWork,\n ɵgetWorkOpenState,\n ɵisTurnWorkOpen,\n ɵisTurnWorking,\n ɵrecordWorkTime,\n ɵresolveActivityRenderer,\n ɵresolveCustomMessageRenderers,\n ɵgetLatestTurnKey,\n} from \"@copilotkit/core\";\nimport type {\n CopilotChatToolCallDisplay,\n ToolCallEntry,\n ɵToolCallDisplayContextValue,\n ɵToolCallLayout,\n ɵTurnWork,\n ɵWorkTime,\n} from \"@copilotkit/core\";\nimport type {\n InterruptRenderProps,\n VueCustomMessageRendererProps,\n} from \"../../types\";\nimport { useCopilotKit } from \"../../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport CopilotChatAssistantMessage from \"./CopilotChatAssistantMessage.vue\";\nimport CopilotChatReasoningMessage from \"./CopilotChatReasoningMessage.vue\";\nimport CopilotChatUserMessage from \"./CopilotChatUserMessage.vue\";\nimport CopilotChatWorkSummary from \"./CopilotChatWorkSummary.vue\";\nimport { CopilotChatCollapsible } from \"./tool-call-group-parts\";\nimport { TurnWorkFold } from \"./turn-work\";\nimport {\n MessageFeedbackScopeKey,\n useLearningFeedbackEnabled,\n} from \"./message-feedback\";\nimport type { MessageFeedbackScope } from \"./message-feedback\";\nimport { ToolCallDisplayContextKey } from \"./tool-call-display-context\";\nimport type { CopilotChatWorkSummarySlotProps } from \"./types\";\n\ninterface MessageMetaProps {\n message: Message;\n position: \"before\" | \"after\";\n runId: string;\n messageIndex: number;\n messageIndexInRun: number;\n numberOfMessagesInRun: number;\n agentId: string;\n stateSnapshot: unknown;\n}\n\ninterface ActivitySlotProps {\n activityType: string;\n content: unknown;\n message: ActivityMessage;\n agent: unknown;\n}\n\ntype InterruptSlotProps = InterruptRenderProps<unknown, unknown>;\ntype CustomMessagePosition = VueCustomMessageRendererProps[\"position\"];\ntype ResolvedCustomMessageRenderer = {\n renderer:\n | Component<VueCustomMessageRendererProps>\n | ((props: VueCustomMessageRendererProps) => unknown);\n props: VueCustomMessageRendererProps;\n};\n\nconst props = withDefaults(\n defineProps<{\n messages?: Message[];\n isRunning?: boolean;\n /**\n * How tool calls show. Defaults to `\"grouped\"`: calls made in a row\n * share one card that opens to a row per call. `\"line\"` and `\"stacked\"`\n * group them too; `\"turn\"` folds a reply's whole working phase into\n * \"Worked for 9s\" once it's done; `\"separate\"` gives every call its own\n * card. Calls with a renderer of their own always show on their own.\n */\n toolCallDisplay?: CopilotChatToolCallDisplay;\n /**\n * While Learning records this chat, the assistant thumbs record ratings\n * and ask for a comment. Set `false` to leave the thumbs to the app's own\n * handlers.\n */\n messageFeedback?: boolean;\n }>(),\n {\n messages: () => [],\n isRunning: false,\n toolCallDisplay: \"grouped\",\n messageFeedback: true,\n },\n);\n\ndefineSlots<{\n \"message-before\"?: (props: MessageMetaProps) => unknown;\n \"message-after\"?: (props: MessageMetaProps) => unknown;\n interrupt?: (props: InterruptSlotProps) => unknown;\n \"assistant-message\"?: (props: {\n message: AssistantMessage;\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n \"user-message\"?: (props: { message: UserMessage }) => unknown;\n \"reasoning-message\"?: (props: {\n message: ReasoningMessage;\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n \"activity-message\"?: (props: ActivitySlotProps) => unknown;\n [key: string]: ((props: any) => unknown) | undefined;\n cursor?: () => unknown;\n /** The \"Working… / Worked for 9s\" line of the `\"turn\"` tool-call display. */\n \"work-summary\"?: (props: CopilotChatWorkSummarySlotProps) => unknown;\n \"tool-call\"?: (props: {\n name: string;\n args: unknown;\n status: string;\n result: string | undefined;\n toolCall: unknown;\n toolMessage: ToolMessage | undefined;\n }) => unknown;\n [key: `tool-call-${string}`]: (props: {\n name: string;\n args: unknown;\n status: string;\n result: string | undefined;\n toolCall: unknown;\n toolMessage: ToolMessage | undefined;\n }) => unknown;\n}>();\n\nconst { copilotkit } = useCopilotKit();\nconst config = useCopilotChatConfiguration();\nconst stateTick = ref(0);\nconst interruptState = ref<InterruptSlotProps | null>(null);\nconst componentSlots = useSlots() as Record<string, (props?: any) => unknown>;\nconst forwardedSlotNames = computed(() => Object.keys(componentSlots));\nconst resolvedAgentId = computed(\n () => config.value?.agentId ?? DEFAULT_AGENT_ID,\n);\nconst resolvedThreadAgent = computed(() => {\n // Read the registry so this recomputes when agents are added or replaced.\n void copilotkit.value.agents;\n return copilotkit.value.getAgent(resolvedAgentId.value);\n});\n\nwatch(\n [\n resolvedAgentId,\n () => config.value?.threadId,\n () => copilotkit.value,\n () => copilotkit.value.runtimeConnectionStatus,\n ],\n (_values, _prev, onCleanup) => {\n const agent = resolvedThreadAgent.value;\n if (!agent) return;\n\n const sub = agent.subscribe({\n onStateChanged: () => {\n stateTick.value += 1;\n },\n onRunStartedEvent: () => {\n stateTick.value += 1;\n },\n onRunFinishedEvent: () => {\n stateTick.value += 1;\n },\n onRunErrorEvent: () => {\n stateTick.value += 1;\n },\n });\n\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n);\n\nwatch(\n () => copilotkit.value,\n (core, _previous, onCleanup) => {\n interruptState.value = core.interruptState as InterruptSlotProps | null;\n const sub = core.subscribe({\n onInterruptStateChanged: ({ interruptState: nextInterruptState }) => {\n interruptState.value = nextInterruptState as InterruptSlotProps | null;\n },\n onRuntimeConnectionStatusChanged: () => {\n stateTick.value += 1;\n },\n });\n\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n);\n\nconst deduplicatedMessages = computed(() =>\n ɵdeduplicateMessages(props.messages),\n);\n\n// Groups of calls can span messages (an agent often sends each call as its\n// own message), so they're laid out here for the whole list and handed to\n// each message's tool calls view through provide/inject.\nconst toolCallLayouts = computed<ReadonlyMap<string, ɵToolCallLayout>>(() =>\n props.toolCallDisplay === \"separate\"\n ? new Map()\n : ɵgetToolCallLayouts(\n deduplicatedMessages.value,\n props.messages,\n ɵgetToolCallRendererNames(copilotkit.value.renderToolCalls, {\n slotNames: forwardedSlotNames.value,\n }),\n ),\n);\nconst learningFeedbackEnabled = useLearningFeedbackEnabled(copilotkit);\nprovide(\n MessageFeedbackScopeKey,\n computed<MessageFeedbackScope | null>(() =>\n props.messageFeedback &&\n learningFeedbackEnabled.value &&\n config.value?.agentId !== undefined &&\n config.value?.threadId !== undefined\n ? {\n copilotkit: copilotkit.value,\n agentId: config.value.agentId,\n threadId: config.value.threadId,\n }\n : null,\n ),\n);\n\nconst turnWork = computed(() =>\n props.toolCallDisplay === \"turn\"\n ? ɵgetTurnWork(deduplicatedMessages.value, toolCallLayouts.value)\n : undefined,\n);\nconst turnByFirstMessage = computed(() => {\n const byFirst = new Map<string, ɵTurnWork>();\n for (const turn of turnWork.value?.values() ?? []) {\n byFirst.set(turn.firstMessageId, turn);\n }\n return byFirst;\n});\n\nconst lastRenderedMessage = computed(\n () => deduplicatedMessages.value[deduplicatedMessages.value.length - 1],\n);\n// The latest reply is keyed by the user message it answers (see getTurnWork).\nconst latestTurnKey = computed(() =>\n ɵgetLatestTurnKey(deduplicatedMessages.value),\n);\n\n// Work shows while the agent is on it and folds once the reply is done,\n// unless the user has opened or closed it themselves.\nconst toggledTurns = ref<ReadonlyMap<string, boolean>>(new Map());\nconst turnOpenState = computed(() => ({\n toggledTurns: toggledTurns.value,\n isRunning: props.isRunning,\n latestTurnKey: latestTurnKey.value,\n}));\n\n// How long the agent worked, for \"Worked for 9s\". Only known for replies this\n// client watched start from the user's message; a restored thread shows the\n// tool count instead.\nconst workTimes = new Map<string, ɵWorkTime>();\nconst workTimesVersion = ref(0);\nwatch(\n [\n () => props.toolCallDisplay,\n () => props.isRunning,\n latestTurnKey,\n () => lastRenderedMessage.value?.role,\n ],\n ([display, isRunning, turnKey, lastRole]) => {\n if (display !== \"turn\") return;\n ɵrecordWorkTime(workTimes, {\n isRunning,\n latestTurnKey: turnKey,\n lastMessageRole: lastRole,\n now: Date.now(),\n });\n workTimesVersion.value++;\n },\n { immediate: true },\n);\n\n// Whether each working-phase message's work, and its text, shows.\nconst workOpenState = computed(() =>\n ɵgetWorkOpenState(turnWork.value?.values() ?? [], turnOpenState.value),\n);\n\nprovide(\n ToolCallDisplayContextKey,\n computed<ɵToolCallDisplayContextValue>(() => ({\n display: props.toolCallDisplay,\n isRunning: props.isRunning,\n layouts: toolCallLayouts.value,\n workOpen: workOpenState.value.workOpen,\n workTextOpen: workOpenState.value.workTextOpen,\n })),\n);\n\n/** The `\"turn\"` display's summary line for a reply, or its slot. */\nconst WorkSummaryRow: FunctionalComponent<{\n turnKey: string;\n calls: ToolCallEntry[];\n}> = ({ turnKey, calls }) => {\n void workTimesVersion.value;\n const isWorking = ɵisTurnWorking(turnKey, turnOpenState.value);\n const isOpen = ɵisTurnWorkOpen(turnKey, turnOpenState.value);\n const times = workTimes.get(turnKey);\n const summaryProps: CopilotChatWorkSummarySlotProps = {\n isWorking,\n isOpen,\n calls,\n elapsedMs: times?.elapsedMs,\n workingSince: times?.workingSince,\n onClick: () => {\n toggledTurns.value = new Map(toggledTurns.value).set(turnKey, !isOpen);\n },\n };\n const slot = componentSlots[\"work-summary\"];\n return h(\n CopilotChatCollapsible,\n { open: isWorking || calls.length > 0 },\n () => [\n h(\n \"div\",\n { class: \"cpk-message-view-work-summary\" },\n slot\n ? (slot(summaryProps) as VNode[])\n : [h(CopilotChatWorkSummary, summaryProps)],\n ),\n ],\n );\n};\nWorkSummaryRow.props = [\"turnKey\", \"calls\"];\n\n// Stable per-row keys. Backends can re-key a message mid-stream, and keying\n// rows by the canonical id tears the row down on that swap (the HITL chat\n// flash). See @copilotkit/shared row-render-keys for the mechanism.\nconst rowKeyStore = createRowKeyStore();\nconst rowRenderKeys = computed(() =>\n resolveRowRenderKeysById(rowKeyStore, deduplicatedMessages.value),\n);\n\n// Record what the DOM was patched with, never what a computed merely\n// evaluated: an anchor from an evaluation Vue never patches would re-key a\n// rendered row and tear it down.\nonMounted(() => commitRowKeyStore(rowKeyStore, deduplicatedMessages.value));\nwatch(\n deduplicatedMessages,\n (messages) => commitRowKeyStore(rowKeyStore, messages),\n { flush: \"post\" },\n);\nconst lastMessage = computed(() => props.messages[props.messages.length - 1]);\n// In the \"turn\" display the \"Working\" line at the top of the reply is the\n// progress indicator; before the reply's first message it sits where the\n// cursor would.\nconst showCursor = computed(\n () =>\n props.isRunning &&\n lastMessage.value?.role !== \"reasoning\" &&\n props.toolCallDisplay !== \"turn\",\n);\nconst pendingWorkSummary = computed(\n () =>\n props.toolCallDisplay === \"turn\" &&\n props.isRunning &&\n lastRenderedMessage.value?.role === \"user\",\n);\n\nwatch(\n [() => props.messages.length, () => deduplicatedMessages.value.length],\n ([messageCount, deduplicatedCount]) => {\n if (\n process.env.NODE_ENV === \"development\" &&\n deduplicatedCount < messageCount\n ) {\n console.warn(\n `CopilotChatMessageView: Deduplicated ${messageCount - deduplicatedCount} message(s) with duplicate IDs.`,\n );\n }\n },\n { immediate: true },\n);\n\nfunction getMeta(\n message: Message,\n): Omit<MessageMetaProps, \"position\" | \"message\"> {\n stateTick.value += 0;\n const agentId = resolvedAgentId.value;\n const threadId = config.value?.threadId ?? \"\";\n const core = copilotkit.value;\n\n const resolvedRunId =\n core.getRunIdForMessage(agentId, threadId, message.id) ??\n core.getRunIdsForThread(agentId, threadId).slice(-1)[0];\n const runId = resolvedRunId ?? `missing-run-id:${message.id}`;\n\n const agent = resolvedThreadAgent.value ?? core.getAgent(agentId);\n\n const messageIdsInRun =\n resolvedRunId && agent\n ? agent.messages\n .filter(\n (msg) =>\n core.getRunIdForMessage(agentId, threadId, msg.id) ===\n resolvedRunId,\n )\n .map((msg) => msg.id)\n : [message.id];\n\n const rawMessageIndex = agent\n ? agent.messages.findIndex((msg) => msg.id === message.id)\n : -1;\n const messageIndex = rawMessageIndex >= 0 ? rawMessageIndex : 0;\n const messageIndexInRun = resolvedRunId\n ? Math.max(messageIdsInRun.indexOf(message.id), 0)\n : 0;\n const numberOfMessagesInRun = resolvedRunId ? messageIdsInRun.length : 1;\n\n // `getStateByRun` deep-clones the whole run state, so resolve it only when\n // a consumer reads `stateSnapshot`, and at most once per meta object.\n let stateSnapshot: unknown;\n let stateSnapshotResolved = false;\n\n return {\n runId,\n messageIndex,\n messageIndexInRun,\n numberOfMessagesInRun,\n agentId,\n get stateSnapshot() {\n if (!stateSnapshotResolved) {\n stateSnapshotResolved = true;\n stateSnapshot = resolvedRunId\n ? core.getStateByRun(agentId, threadId, resolvedRunId)\n : undefined;\n }\n return stateSnapshot;\n },\n };\n}\n\n// `Object.assign` onto the meta object keeps the lazy `stateSnapshot` getter.\n// A spread would call it.\nfunction getMessageSlotProps(\n message: Message,\n position: MessageMetaProps[\"position\"],\n): MessageMetaProps {\n return Object.assign(getMeta(message), { message, position });\n}\n\n// Calls a `#message-before` / `#message-after` slot with the meta object\n// itself. A template `<slot v-bind>` inside `v-for` goes through\n// `mergeProps`, which reads every key and so would clone the run state for\n// slots that never read `stateSnapshot`.\nconst MessageMetaSlot: FunctionalComponent<{\n render: (props: MessageMetaProps) => unknown;\n slotProps: MessageMetaProps;\n}> = ({ render, slotProps }) => render(slotProps) as VNodeChild;\nMessageMetaSlot.props = [\"render\", \"slotProps\"];\n\nfunction getActivitySlotName(activityType: string): `activity-${string}` {\n return `activity-${activityType}`;\n}\n\nfunction resolveCustomMessageRenderer(\n message: Message,\n position: CustomMessagePosition,\n): ResolvedCustomMessageRenderer | null {\n stateTick.value += 0;\n const slotName = position === \"before\" ? \"message-before\" : \"message-after\";\n if (componentSlots[slotName]) {\n return null;\n }\n\n // Try each renderer in order and use the first that has something to draw.\n const selected = ɵresolveCustomMessageRenderers(\n copilotkit.value.renderCustomMessages,\n resolvedAgentId.value,\n ).find((renderer) => renderer.render);\n if (!selected) {\n return null;\n }\n\n return {\n renderer: selected.render as ResolvedCustomMessageRenderer[\"renderer\"],\n props: getMessageSlotProps(message, position),\n };\n}\n\nfunction resolveActivityRenderer(\n message: ActivityMessage,\n): { renderer: Component; props: ActivitySlotProps } | null {\n stateTick.value += 0;\n\n const match = ɵresolveActivityRenderer(\n copilotkit.value.renderActivityMessages,\n {\n activityType: message.activityType,\n agentId: resolvedAgentId.value,\n content: message.content,\n },\n );\n if (!match) return null;\n\n return {\n renderer: match.renderer.render as Component,\n props: {\n activityType: message.activityType,\n content: match.content,\n message,\n agent: resolvedThreadAgent.value,\n },\n };\n}\n</script>\n\n<template>\n <div\n data-copilotkit\n class=\"copilotKitMessages cpk-message-view\"\n v-bind=\"$attrs\"\n >\n <template\n v-for=\"message in deduplicatedMessages\"\n :key=\"rowRenderKeys.get(message.id) ?? message.id\"\n >\n <WorkSummaryRow\n v-if=\"turnByFirstMessage.get(message.id)\"\n :turn-key=\"turnByFirstMessage.get(message.id)!.key\"\n :calls=\"turnByFirstMessage.get(message.id)!.calls\"\n />\n <MessageMetaSlot\n v-if=\"componentSlots['message-before']\"\n :render=\"componentSlots['message-before']\"\n :slot-props=\"getMessageSlotProps(message, 'before')\"\n />\n <component\n v-else-if=\"resolveCustomMessageRenderer(message, 'before')\"\n :is=\"resolveCustomMessageRenderer(message, 'before')!.renderer\"\n v-bind=\"resolveCustomMessageRenderer(message, 'before')!.props\"\n />\n\n <slot\n v-if=\"message.role === 'assistant'\"\n name=\"assistant-message\"\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <CopilotChatAssistantMessage\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <template\n v-for=\"slotName in forwardedSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatAssistantMessage>\n </slot>\n\n <slot\n v-else-if=\"message.role === 'user'\"\n name=\"user-message\"\n :message=\"message\"\n >\n <CopilotChatUserMessage :message=\"message\">\n <template\n v-for=\"slotName in forwardedSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatUserMessage>\n </slot>\n\n <!-- Reasoning during a reply's working phase folds away with the work.\n Always wrapped in this display, so reasoning that turns into work\n keeps its node (and its \"Thought for\" timer) instead of remounting. -->\n <TurnWorkFold\n v-else-if=\"message.role === 'reasoning'\"\n :open=\"\n toolCallDisplay === 'turn'\n ? (workOpenState.workOpen.get(message.id) ?? true)\n : undefined\n \"\n >\n <slot\n name=\"reasoning-message\"\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <CopilotChatReasoningMessage\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n />\n </slot>\n </TurnWorkFold>\n\n <slot\n v-else-if=\"message.role === 'activity'\"\n :name=\"getActivitySlotName(message.activityType)\"\n :activity-type=\"message.activityType\"\n :content=\"message.content\"\n :message=\"message\"\n :agent=\"resolvedThreadAgent\"\n >\n <slot\n name=\"activity-message\"\n :activity-type=\"message.activityType\"\n :content=\"message.content\"\n :message=\"message\"\n :agent=\"resolvedThreadAgent\"\n >\n <component\n v-if=\"resolveActivityRenderer(message)\"\n :is=\"resolveActivityRenderer(message)!.renderer\"\n v-bind=\"resolveActivityRenderer(message)!.props\"\n />\n </slot>\n </slot>\n\n <MessageMetaSlot\n v-if=\"componentSlots['message-after']\"\n :render=\"componentSlots['message-after']\"\n :slot-props=\"getMessageSlotProps(message, 'after')\"\n />\n <component\n v-else-if=\"resolveCustomMessageRenderer(message, 'after')\"\n :is=\"resolveCustomMessageRenderer(message, 'after')!.renderer\"\n v-bind=\"resolveCustomMessageRenderer(message, 'after')!.props\"\n />\n </template>\n\n <slot\n v-if=\"interruptState\"\n name=\"interrupt\"\n :event=\"interruptState.event\"\n :interrupt=\"interruptState.interrupt\"\n :interrupts=\"interruptState.interrupts\"\n :result=\"interruptState.result\"\n :resolve=\"interruptState.resolve\"\n :cancel=\"interruptState.cancel\"\n />\n\n <WorkSummaryRow\n v-if=\"pendingWorkSummary\"\n :turn-key=\"latestTurnKey\"\n :calls=\"[]\"\n />\n\n <div v-if=\"showCursor\" class=\"cpk-message-view-cursor-container\">\n <slot name=\"cursor\">\n <div\n class=\"cpk-message-view-cursor\"\n data-testid=\"copilot-loading-cursor\"\n />\n </slot>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { Component } from \"vue\";\nimport { computed } from \"vue\";\nimport { IconLoader2 } from \"../icons\";\n\nconst props = withDefaults(\n defineProps<{\n icon?: Component;\n isLoading?: boolean;\n disabled?: boolean;\n type?: \"button\" | \"submit\" | \"reset\";\n }>(),\n {\n icon: undefined,\n isLoading: false,\n disabled: false,\n type: \"button\",\n },\n);\n\nconst isDisabled = computed(() => props.isLoading || props.disabled);\n</script>\n\n<template>\n <button\n data-copilotkit\n data-slot=\"suggestion-pill\"\n data-testid=\"copilot-chat-suggestion-pill\"\n :type=\"type\"\n :aria-busy=\"isLoading ? 'true' : undefined\"\n :disabled=\"isDisabled\"\n class=\"cpk-suggestion-pill\"\n v-bind=\"$attrs\"\n >\n <span v-if=\"isLoading\" class=\"cpk-suggestion-pill-icon\">\n <IconLoader2 class=\"cpk-suggestion-pill-spinner\" aria-hidden=\"true\" />\n </span>\n <span v-else-if=\"$slots.icon || icon\" class=\"cpk-suggestion-pill-icon\">\n <slot name=\"icon\">\n <component :is=\"icon\" />\n </slot>\n </span>\n <span class=\"cpk-suggestion-pill-label\">\n <slot />\n </span>\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useAttrs } from \"vue\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport CopilotChatSuggestionPill from \"./CopilotChatSuggestionPill.vue\";\nimport type {\n CopilotChatSuggestionViewContainerSlotProps,\n CopilotChatSuggestionViewLayoutSlotProps,\n CopilotChatSuggestionViewSuggestionSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(\n defineProps<{\n suggestions: Suggestion[];\n loadingIndexes?: ReadonlyArray<number>;\n }>(),\n {\n loadingIndexes: () => [],\n },\n);\n\ndefineSlots<{\n suggestion?: (props: CopilotChatSuggestionViewSuggestionSlotProps) => unknown;\n container?: (props: CopilotChatSuggestionViewContainerSlotProps) => unknown;\n layout?: (props: CopilotChatSuggestionViewLayoutSlotProps) => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n}>();\n\nconst attrs = useAttrs();\nconst loadingSet = computed(() => new Set(props.loadingIndexes));\nconst containerClass = computed(() => [\"cpk-suggestion-view\", attrs.class]);\nconst containerAttrs = computed(() => {\n const { class: _className, ...rest } = attrs;\n return rest;\n});\n\nfunction isLoading(index: number, suggestion: Suggestion) {\n return loadingSet.value.has(index) || suggestion.isLoading === true;\n}\n\nfunction handleSelectSuggestion(suggestion: Suggestion, index: number) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nconst slotProps = computed<CopilotChatSuggestionViewContainerSlotProps>(() => ({\n suggestions: props.suggestions,\n loadingIndexes: props.loadingIndexes,\n onSelectSuggestion: handleSelectSuggestion,\n containerClass: containerClass.value,\n containerAttrs: containerAttrs.value as Record<string, unknown>,\n}));\n</script>\n\n<template>\n <slot name=\"layout\" v-bind=\"slotProps\">\n <slot name=\"container\" v-bind=\"slotProps\">\n <div\n data-copilotkit\n data-testid=\"copilot-chat-suggestion-view\"\n :class=\"containerClass\"\n v-bind=\"containerAttrs\"\n >\n <template\n v-for=\"(suggestion, index) in suggestions\"\n :key=\"`${suggestion.title}-${index}`\"\n >\n <slot\n name=\"suggestion\"\n :suggestion=\"suggestion\"\n :index=\"index\"\n :is-loading=\"isLoading(index, suggestion)\"\n :on-select=\"() => handleSelectSuggestion(suggestion, index)\"\n >\n <CopilotChatSuggestionPill\n :is-loading=\"isLoading(index, suggestion)\"\n type=\"button\"\n @click=\"handleSelectSuggestion(suggestion, index)\"\n >\n {{ suggestion.title }}\n </CopilotChatSuggestionPill>\n </slot>\n </template>\n </div>\n </slot>\n </slot>\n</template>\n","<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useSlots,\n watch,\n} from \"vue\";\nimport type { Message } from \"@ag-ui/core\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport type { Attachment } from \"@copilotkit/shared\";\nimport { useChatLabels } from \"./use-chat-labels\";\nimport { useKeyboardHeight } from \"../../hooks/use-keyboard-height\";\nimport { usePinToSend } from \"../../hooks/use-pin-to-send\";\nimport { IconChevronDown, IconUpload } from \"../icons\";\nimport CopilotChatInput from \"./CopilotChatInput.vue\";\nimport CopilotChatAttachmentQueue from \"./CopilotChatAttachmentQueue.vue\";\nimport CopilotChatMessageView from \"./CopilotChatMessageView.vue\";\nimport CopilotChatSuggestionView from \"./CopilotChatSuggestionView.vue\";\nimport { normalizeAutoScroll } from \"./normalize-auto-scroll\";\nimport type {\n CopilotChatInputMode,\n CopilotChatInterruptSlotProps,\n CopilotChatViewProps,\n ToolsMenuItem,\n} from \"./types\";\n\n// Vertical gap between the scroll-to-bottom button and the input container.\n// Mirrors React `CopilotChatView` `SCROLL_BUTTON_OFFSET`.\nconst SCROLL_BUTTON_OFFSET = 16;\nconst SCROLL_BOTTOM_THRESHOLD = 12;\n\nconst props = withDefaults(defineProps<CopilotChatViewProps>(), {\n messageFeedback: true,\n messages: () => [],\n autoScroll: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n isConnecting: false,\n hasExplicitThreadId: false,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"message-view\"?: (props: {\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n \"scroll-view\"?: (props: {\n messages: Message[];\n isRunning: boolean;\n suggestions: Suggestion[];\n loadingIndexes: ReadonlyArray<number>;\n messagePaddingBottom: string;\n showScrollToBottomButton: boolean;\n onSelectSuggestion: (suggestion: Suggestion, index: number) => void;\n onScroll: () => void;\n scrollToBottom: () => void;\n }) => unknown;\n feather?: () => unknown;\n \"scroll-to-bottom-button\"?: (props: { onClick: () => void }) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: {\n modelValue: string;\n isRunning: boolean;\n inputMode: CopilotChatInputMode;\n inputToolsMenu: (ToolsMenuItem | \"-\")[];\n attachments: Attachment[];\n canStop: boolean;\n canAddFile: boolean;\n canTranscribe: boolean;\n onUpdateModelValue: (value: string) => void;\n onSubmitMessage: (value: string) => void;\n onStop: () => void;\n onAddFile: () => void;\n onStartTranscribe: () => void;\n onCancelTranscribe: () => void;\n onFinishTranscribe: () => void;\n onFinishTranscribeWithAudio: (audioBlob: Blob) => void | Promise<void>;\n }) => unknown;\n \"suggestion-view\"?: (props: {\n suggestions: Suggestion[];\n loadingIndexes: ReadonlyArray<number>;\n onSelectSuggestion: (suggestion: Suggestion, index: number) => void;\n }) => unknown;\n \"welcome-screen\"?: (props: {\n suggestions: Suggestion[];\n loadingIndexes: ReadonlyArray<number>;\n attachments: Attachment[];\n modelValue: string;\n isRunning: boolean;\n inputMode: CopilotChatInputMode;\n inputToolsMenu: (ToolsMenuItem | \"-\")[];\n canStop: boolean;\n canAddFile: boolean;\n canTranscribe: boolean;\n onUpdateModelValue: (value: string) => void;\n onSubmitMessage: (value: string) => void;\n onStop: () => void;\n onAddFile: () => void;\n onStartTranscribe: () => void;\n onCancelTranscribe: () => void;\n onFinishTranscribe: () => void;\n onFinishTranscribeWithAudio: (audioBlob: Blob) => void | Promise<void>;\n onSelectSuggestion: (suggestion: Suggestion, index: number) => void;\n }) => unknown;\n \"welcome-message\"?: () => unknown;\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst labels = useChatLabels();\nconst componentSlots = useSlots();\n\nconst scrollContainerRef = ref<HTMLElement | null>(null);\nconst scrollContentRef = ref<HTMLElement | null>(null);\nconst spacerRef = ref<HTMLElement | null>(null);\nconst inputContainerRef = ref<HTMLElement | null>(null);\nconst inputContainerHeight = ref(0);\nconst isAtBottom = ref(true);\nconst isControlledInput = computed(() => props.inputValue !== undefined);\nconst localInputValue = ref(props.inputValue ?? \"\");\n\n// Normalize the `autoScroll` prop into the canonical mode triplet\n// (`pin-to-bottom` | `pin-to-send` | `none`). Boolean back-compat is\n// preserved by `normalizeAutoScroll` (parity with React).\nconst autoScrollMode = computed(() => normalizeAutoScroll(props.autoScroll));\nconst isPinToBottomMode = computed(\n () => autoScrollMode.value === \"pin-to-bottom\",\n);\nconst isPinToSendMode = computed(() => autoScrollMode.value === \"pin-to-send\");\n\n// `usePinToSend` is always wired but bails internally when the spacer ref\n// is null — i.e. unless `pin-to-send` mode is active and the spacer div\n// has been mounted in the template.\nusePinToSend({\n scrollRef: scrollContainerRef,\n contentRef: scrollContentRef,\n spacerRef,\n topOffset: 16,\n});\n\n// Track mobile keyboard state so the input can translate itself above the\n// on-screen keyboard (matches React CopilotChatView behavior).\nconst { isKeyboardOpen, keyboardHeight } = useKeyboardHeight();\nconst effectiveKeyboardHeight = computed(() =>\n isKeyboardOpen.value ? keyboardHeight.value : 0,\n);\n\nconst resolvedInputValue = computed(() =>\n isControlledInput.value ? (props.inputValue ?? \"\") : localInputValue.value,\n);\nconst hasSuggestions = computed(\n () =>\n !props.isConnecting &&\n !props.isRunning &&\n Array.isArray(props.suggestions) &&\n props.suggestions.length > 0,\n);\nconst hasAttachments = computed(\n () => Array.isArray(props.attachments) && props.attachments.length > 0,\n);\nconst forwardedMessageViewSlotNames = computed(() =>\n Object.keys(componentSlots).filter(\n (slotName) =>\n slotName !== \"message-view\" &&\n slotName !== \"scroll-view\" &&\n slotName !== \"feather\" &&\n slotName !== \"scroll-to-bottom-button\" &&\n slotName !== \"input\" &&\n slotName !== \"suggestion-view\" &&\n slotName !== \"welcome-screen\" &&\n slotName !== \"welcome-message\",\n ),\n);\nconst shouldShowWelcomeScreen = computed(\n () =>\n props.messages.length === 0 &&\n props.welcomeScreen !== false &&\n !props.isConnecting &&\n !props.hasExplicitThreadId,\n);\n// Mirrors React: `paddingBottom = inputContainerHeight + (hasSuggestions ? 4 : 32)`.\n// React intentionally does NOT add bonus padding for attachments — the\n// attachment queue lives inside the input overlay, so its height is already\n// captured by the overlay's measured `inputContainerHeight`.\nconst messagePaddingBottom = computed(\n () => `${inputContainerHeight.value + (hasSuggestions.value ? 4 : 32)}px`,\n);\nconst showScrollToBottomButton = computed(\n () => !shouldShowWelcomeScreen.value && !isAtBottom.value,\n);\n\nlet inputResizeObserver: ResizeObserver | null = null;\nlet contentResizeObserver: ResizeObserver | null = null;\n\nfunction attachInputOverlayObserver() {\n if (typeof ResizeObserver === \"undefined\") return;\n\n inputResizeObserver?.disconnect();\n inputResizeObserver = null;\n\n const el = inputContainerRef.value;\n if (!el) return;\n\n inputResizeObserver = new ResizeObserver((entries) => {\n const wasAtBottom = isAtBottom.value;\n const measured = entries[0]?.contentRect?.height;\n if (typeof measured === \"number\") {\n inputContainerHeight.value = measured;\n } else {\n syncInputContainerHeight();\n }\n updateIsAtBottom();\n if (isPinToBottomMode.value && wasAtBottom) {\n scrollToBottom(\"auto\");\n }\n });\n inputResizeObserver.observe(el);\n}\n\nfunction attachScrollContentObserver() {\n if (typeof ResizeObserver === \"undefined\") return;\n\n contentResizeObserver?.disconnect();\n contentResizeObserver = null;\n\n const el = scrollContentRef.value;\n if (!el) return;\n\n contentResizeObserver = new ResizeObserver(() => {\n const wasAtBottom = isAtBottom.value;\n updateIsAtBottom();\n if (isPinToBottomMode.value && wasAtBottom) {\n scrollToBottom(\"auto\");\n }\n });\n contentResizeObserver.observe(el);\n}\n\n// When the welcome screen disappears and the main chat view (with the input\n// overlay) appears, the template-ref elements become non-null. Re-attach\n// observers that were skipped during the initial mount.\nwatch(shouldShowWelcomeScreen, async (show) => {\n if (show) return;\n await nextTick();\n syncInputContainerHeight();\n attachInputOverlayObserver();\n attachScrollContentObserver();\n});\n\nwatch(\n () => props.inputValue,\n (next) => {\n if (isControlledInput.value) {\n localInputValue.value = next ?? \"\";\n }\n },\n);\n\nwatch(\n [() => props.messages, () => props.suggestions, () => props.isRunning],\n async () => {\n const wasAtBottom = isAtBottom.value;\n await nextTick();\n if (!isPinToBottomMode.value || !wasAtBottom) {\n return;\n }\n scrollToBottom(\"auto\");\n if (typeof requestAnimationFrame === \"function\") {\n requestAnimationFrame(() => {\n scrollToBottom(\"auto\");\n });\n }\n },\n { deep: true },\n);\n\nfunction updateIsAtBottom() {\n const element = scrollContainerRef.value;\n if (!element) {\n isAtBottom.value = true;\n return;\n }\n\n const distance =\n element.scrollHeight - element.scrollTop - element.clientHeight;\n isAtBottom.value = distance <= SCROLL_BOTTOM_THRESHOLD;\n}\n\nfunction syncInputContainerHeight() {\n const element = inputContainerRef.value;\n inputContainerHeight.value = element?.offsetHeight ?? 0;\n}\n\nfunction scrollToBottom(behavior: ScrollBehavior = \"smooth\") {\n const element = scrollContainerRef.value;\n if (!element) return;\n\n if (typeof element.scrollTo === \"function\") {\n element.scrollTo({\n top: element.scrollHeight,\n behavior,\n });\n } else {\n element.scrollTop = element.scrollHeight;\n }\n updateIsAtBottom();\n}\n\nfunction handleScroll() {\n updateIsAtBottom();\n}\n\nfunction handleInputValueChange(value: string) {\n if (!isControlledInput.value) {\n localInputValue.value = value;\n }\n emit(\"input-change\", value);\n}\n\nfunction handleSubmitMessage(value: string) {\n emit(\"submit-message\", value);\n}\n\nfunction handleStop() {\n emit(\"stop\");\n}\n\nfunction handleSelectSuggestion(suggestion: Suggestion, index: number) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n}\n\nfunction handleDragOver(event: DragEvent) {\n props.onDragOver?.(event);\n}\n\nfunction handleDragLeave(event: DragEvent) {\n props.onDragLeave?.(event);\n}\n\nfunction handleDrop(event: DragEvent) {\n void props.onDrop?.(event);\n}\n\nfunction handleStartTranscribe() {\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n emit(\"finish-transcribe\");\n}\n\nasync function handleFinishTranscribeWithAudio(audioBlob: Blob) {\n await props.onFinishTranscribeWithAudio?.(audioBlob);\n}\n\nconst inputEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n \"onUpdate:modelValue\": handleInputValueChange,\n onSubmitMessage: props.onSubmitMessage ? handleSubmitMessage : undefined,\n };\n\n if (props.onStop) {\n listeners.onStop = handleStop;\n }\n if (props.onAddFile) {\n listeners.onAddFile = handleAddFile;\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = handleStartTranscribe;\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = handleCancelTranscribe;\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n if (props.onFinishTranscribeWithAudio) {\n listeners.onFinishTranscribeWithAudio = handleFinishTranscribeWithAudio;\n }\n\n return listeners;\n});\n\nconst canStop = computed(() => !!props.onStop);\nconst canAddFile = computed(() => !!props.onAddFile);\nconst canTranscribe = computed(() => !!props.onStartTranscribe);\n\nonMounted(async () => {\n await nextTick();\n syncInputContainerHeight();\n updateIsAtBottom();\n if (isPinToBottomMode.value) {\n scrollToBottom(\"auto\");\n if (typeof requestAnimationFrame === \"function\") {\n requestAnimationFrame(() => {\n scrollToBottom(\"auto\");\n });\n }\n }\n\n attachInputOverlayObserver();\n attachScrollContentObserver();\n});\n\nonBeforeUnmount(() => {\n inputResizeObserver?.disconnect();\n contentResizeObserver?.disconnect();\n inputResizeObserver = null;\n contentResizeObserver = null;\n});\n</script>\n\n<template>\n <div\n data-copilotkit\n class=\"copilotKitChat cpk-chat-view\"\n data-testid=\"copilot-chat-view\"\n :data-copilot-running=\"isRunning ? 'true' : 'false'\"\n v-bind=\"$attrs\"\n @dragover=\"handleDragOver\"\n @dragleave=\"handleDragLeave\"\n @drop=\"handleDrop\"\n >\n <div\n v-if=\"dragOver\"\n class=\"cpk-chat-view-drop-overlay\"\n data-testid=\"copilot-chat-drop-overlay\"\n >\n <div class=\"cpk-chat-view-drop-overlay-content\">\n <IconUpload class=\"cpk-chat-view-drop-overlay-icon\" />\n <span class=\"cpk-chat-view-drop-overlay-label\">{{\n labels.chatDropFilesLabel\n }}</span>\n </div>\n </div>\n <slot\n v-if=\"shouldShowWelcomeScreen\"\n name=\"welcome-screen\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :attachments=\"attachments ?? []\"\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :can-stop=\"canStop\"\n :can-add-file=\"canAddFile\"\n :can-transcribe=\"canTranscribe\"\n :on-update-model-value=\"handleInputValueChange\"\n :on-submit-message=\"handleSubmitMessage\"\n :on-stop=\"handleStop\"\n :on-add-file=\"handleAddFile\"\n :on-start-transcribe=\"handleStartTranscribe\"\n :on-cancel-transcribe=\"handleCancelTranscribe\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n :on-finish-transcribe-with-audio=\"handleFinishTranscribeWithAudio\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n >\n <div\n class=\"cpk-chat-view-welcome-screen\"\n data-testid=\"copilot-chat-view-welcome-screen\"\n >\n <div class=\"cpk-chat-view-welcome-screen-content\">\n <div class=\"cpk-chat-view-welcome-screen-message\">\n <slot name=\"welcome-message\">\n <h1 class=\"cpk-chat-view-welcome-message\">\n {{ labels.welcomeMessageText }}\n </h1>\n </slot>\n </div>\n\n <div\n class=\"cpk-chat-view-welcome-screen-input cpk-chat-view-welcome-input-group\"\n >\n <CopilotChatAttachmentQueue\n v-if=\"hasAttachments\"\n :attachments=\"attachments ?? []\"\n class-name=\"cpk-chat-view-welcome-attachment-queue\"\n @remove-attachment=\"\n (id: string) => onRemoveAttachment && onRemoveAttachment(id)\n \"\n />\n <slot\n name=\"input\"\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :attachments=\"attachments ?? []\"\n :can-stop=\"canStop\"\n :can-add-file=\"canAddFile\"\n :can-transcribe=\"canTranscribe\"\n :on-update-model-value=\"handleInputValueChange\"\n :on-submit-message=\"handleSubmitMessage\"\n :on-stop=\"handleStop\"\n :on-add-file=\"handleAddFile\"\n :on-start-transcribe=\"handleStartTranscribe\"\n :on-cancel-transcribe=\"handleCancelTranscribe\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n :on-finish-transcribe-with-audio=\"handleFinishTranscribeWithAudio\"\n >\n <CopilotChatInput\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n :keyboard-height=\"effectiveKeyboardHeight\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n\n <div\n v-if=\"hasSuggestions\"\n class=\"cpk-chat-view-welcome-screen-suggestions\"\n >\n <slot\n name=\"suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n >\n <CopilotChatSuggestionView\n class=\"cpk-chat-view-suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n @select-suggestion=\"handleSelectSuggestion\"\n />\n </slot>\n </div>\n </div>\n </div>\n </slot>\n\n <template v-else>\n <slot\n name=\"scroll-view\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :message-padding-bottom=\"messagePaddingBottom\"\n :show-scroll-to-bottom-button=\"showScrollToBottomButton\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n :on-scroll=\"handleScroll\"\n :scroll-to-bottom=\"scrollToBottom\"\n >\n <div\n ref=\"scrollContainerRef\"\n data-testid=\"copilot-chat-view-scroll\"\n class=\"cpk-chat-view-scroll-area cpk-chat-view-scroll-viewport\"\n @scroll=\"handleScroll\"\n >\n <div class=\"cpk-chat-view-scroll-content\">\n <div\n ref=\"scrollContentRef\"\n data-testid=\"copilot-scroll-content\"\n :style=\"{ paddingBottom: messagePaddingBottom }\"\n >\n <div class=\"cpk-chat-view-feed\">\n <slot\n name=\"message-view\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <CopilotChatMessageView\n :messages=\"messages\"\n :is-running=\"isRunning\"\n :tool-call-display=\"toolCallDisplay\"\n :message-feedback=\"messageFeedback\"\n >\n <template\n v-for=\"slotName in forwardedMessageViewSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatMessageView>\n </slot>\n <div v-if=\"hasSuggestions\" class=\"cpk-chat-view-suggestions\">\n <slot\n name=\"suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n >\n <CopilotChatSuggestionView\n class=\"cpk-chat-view-suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n @select-suggestion=\"handleSelectSuggestion\"\n />\n </slot>\n </div>\n </div>\n </div>\n <!--\n `pin-to-send` spacer. Sized to anchor the latest user message\n near the top of the viewport while the assistant streams a\n response. `usePinToSend` reads this ref and only activates\n when the spacer is present in the tree.\n -->\n <div\n v-if=\"isPinToSendMode\"\n ref=\"spacerRef\"\n data-pin-to-send-spacer\n aria-hidden=\"true\"\n :style=\"{ height: '0px', flex: '0 0 auto' }\"\n />\n </div>\n </div>\n </slot>\n\n <slot name=\"feather\">\n <!--\n Default renders an empty div — no visual, but the element is\n still in the tree so a slot override / consumer styling can\n still apply (mirrors React `CopilotChatView.Feather`).\n -->\n <div data-testid=\"copilot-chat-view-feather\" />\n </slot>\n\n <div\n v-if=\"showScrollToBottomButton\"\n class=\"cpk-chat-view-scroll-to-bottom\"\n :style=\"{ bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` }\"\n >\n <slot name=\"scroll-to-bottom-button\" :on-click=\"() => scrollToBottom()\">\n <button\n type=\"button\"\n data-testid=\"copilot-chat-view-scroll-to-bottom\"\n :aria-label=\"labels.chatScrollToBottomLabel\"\n data-slot=\"button\"\n class=\"cpk-button cpk-button-outline cpk-button-size-sm cpk-chat-view-scroll-to-bottom-button\"\n @click=\"scrollToBottom()\"\n >\n <IconChevronDown class=\"cpk-chat-view-scroll-to-bottom-icon\" />\n </button>\n </slot>\n </div>\n\n <!--\n Input overlay. Mirrors React `CopilotChatView` `copilot-input-overlay`:\n absolutely positioned at the bottom, holds both the attachment queue\n and the chat input. The input itself uses `positioning=\"static\"` so\n the overlay wrapper alone owns the absolute positioning, and the\n attachment queue is layered visually above the input via DOM order.\n The welcome-screen path intentionally does NOT use this overlay.\n -->\n <div\n ref=\"inputContainerRef\"\n class=\"cpk-chat-view-input-overlay\"\n data-testid=\"copilot-input-overlay\"\n >\n <div v-if=\"hasAttachments\" class=\"cpk-chat-view-attachments\">\n <CopilotChatAttachmentQueue\n :attachments=\"attachments ?? []\"\n class-name=\"cpk-chat-view-attachment-queue\"\n @remove-attachment=\"\n (id: string) => onRemoveAttachment && onRemoveAttachment(id)\n \"\n />\n </div>\n <slot\n name=\"input\"\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :attachments=\"attachments ?? []\"\n :can-stop=\"canStop\"\n :can-add-file=\"canAddFile\"\n :can-transcribe=\"canTranscribe\"\n :on-update-model-value=\"handleInputValueChange\"\n :on-submit-message=\"handleSubmitMessage\"\n :on-stop=\"handleStop\"\n :on-add-file=\"handleAddFile\"\n :on-start-transcribe=\"handleStartTranscribe\"\n :on-cancel-transcribe=\"handleCancelTranscribe\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n :on-finish-transcribe-with-audio=\"handleFinishTranscribeWithAudio\"\n >\n <CopilotChatInput\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n :keyboard-height=\"effectiveKeyboardHeight\"\n :bottom-anchored=\"true\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n </template>\n </div>\n</template>\n","import { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport type { Ref } from \"vue\";\nimport {\n emitInspectorActiveThread,\n emitInspectorViewThreadResult,\n isInspectorThreadBridgeEnabled,\n onInspectorStopViewing,\n onInspectorViewThread,\n} from \"@copilotkit/core\";\n\ntype InspectorOverride = {\n requestId: string;\n threadId: string;\n agentId: string;\n previousThreadId: string;\n};\n\nexport function useInspectorThreadOverride(args: {\n agentId: Ref<string>;\n baseThreadId: Ref<string>;\n}): {\n inspectorThreadId: Ref<string | null>;\n inspectorRequestId: Ref<string | null>;\n failInspectorOverride: (requestId: string) => void;\n} {\n const override = ref<InspectorOverride | null>(null);\n\n const restoreOverride = (\n current: InspectorOverride,\n nextThreadId: string,\n ) => {\n override.value = null;\n emitInspectorActiveThread({\n requestId: current.requestId,\n threadId: nextThreadId,\n agentId: current.agentId,\n source: \"app\",\n });\n };\n\n const failInspectorOverride = (requestId: string) => {\n const current = override.value;\n if (!current || current.requestId !== requestId) return;\n emitInspectorViewThreadResult({\n requestId,\n threadId: current.threadId,\n agentId: current.agentId,\n ok: false,\n reason: \"connect-failed\",\n });\n restoreOverride(current, current.previousThreadId);\n };\n\n if (isInspectorThreadBridgeEnabled()) {\n const offView = onInspectorViewThread((payload) => {\n if (payload.agentId !== args.agentId.value) return false;\n override.value = override.value\n ? { ...override.value, ...payload }\n : {\n ...payload,\n previousThreadId: args.baseThreadId.value,\n };\n emitInspectorViewThreadResult({ ...payload, ok: true });\n emitInspectorActiveThread({ ...payload, source: \"override\" });\n return true;\n });\n\n const offStop = onInspectorStopViewing((payload) => {\n const current = override.value;\n if (!current) return;\n if (payload.requestId !== current.requestId) return;\n if (payload.agentId !== current.agentId) return;\n restoreOverride(current, current.previousThreadId);\n });\n\n onBeforeUnmount(() => {\n offView();\n offStop();\n });\n }\n\n watch([args.agentId, args.baseThreadId], ([agentId, baseThreadId]) => {\n const current = override.value;\n if (!current) return;\n if (agentId !== current.agentId) {\n restoreOverride(current, current.previousThreadId);\n return;\n }\n if (baseThreadId === current.previousThreadId) return;\n if (baseThreadId === current.threadId) return;\n restoreOverride(current, baseThreadId);\n });\n\n return {\n inspectorThreadId: computed(() => override.value?.threadId ?? null),\n inspectorRequestId: computed(() => override.value?.requestId ?? null),\n failInspectorOverride,\n };\n}\n","import {\n computed,\n defineComponent,\n getCurrentInstance,\n h,\n inject,\n onActivated,\n onDeactivated,\n onUnmounted,\n shallowRef,\n} from \"vue\";\nimport type { AppContext, ShallowRef } from \"vue\";\nimport { stylesheet } from \"@copilotkit/core/styles\";\nimport { CopilotStyleOptionsKey } from \"../providers/keys\";\nimport type { CopilotStyleOptions } from \"../providers/keys\";\n\ninterface StylesInstance {\n enabled: () => boolean;\n}\n\n// The mounted instances of each app, in setup order. Keyed by app, so on the\n// server each request's app has its own list.\nconst instancesByApp = new WeakMap<\n AppContext,\n ShallowRef<readonly StylesInstance[]>\n>();\n\n/**\n * Renders the CSS for CopilotKit's UI, so apps never import a stylesheet.\n * `CopilotChat` (and so `CopilotPopup` and `CopilotSidebar`) renders it for\n * you. Render it yourself only when you build a layout from the chat parts\n * without `CopilotChat`.\n *\n * The `<style>` tag renders in place, so it is in the server HTML and the page\n * is styled before it hydrates. Only the first instance in the app renders the\n * tag, so a page with many chats has one copy. When that instance unmounts, the\n * next one renders the tag in the same update. The server and the client set\n * up instances in the same order, so hydration matches.\n *\n * Renders nothing when `CopilotKitProvider` has `:inject-styles=\"false\"`.\n */\nexport const CopilotKitStyles = defineComponent({\n name: \"CopilotKitStyles\",\n setup() {\n const options = inject(\n CopilotStyleOptionsKey,\n () => computed<CopilotStyleOptions>(() => ({ inject: true })),\n true,\n );\n const appContext = getCurrentInstance()!.appContext;\n let instances = instancesByApp.get(appContext);\n if (!instances) {\n instances = shallowRef([]);\n instancesByApp.set(appContext, instances);\n }\n const list = instances;\n const self: StylesInstance = { enabled: () => options.value.inject };\n\n const add = () => {\n if (!list.value.includes(self)) {\n list.value = [...list.value, self];\n }\n };\n const remove = () => {\n list.value = list.value.filter((instance) => instance !== self);\n };\n add();\n onUnmounted(remove);\n // A deactivated <KeepAlive> child is out of the document, so it can't\n // hold the tag.\n onDeactivated(remove);\n onActivated(add);\n\n const rendersTag = computed(\n () => list.value.find((instance) => instance.enabled()) === self,\n );\n\n return () => {\n if (!rendersTag.value) {\n return null;\n }\n const { nonce } = options.value;\n return h(\"style\", {\n \"data-copilotkit-styles\": \"\",\n nonce,\n // Browsers hide a nonce from the DOM, so hydration would see a\n // mismatch that isn't one.\n \"data-allow-mismatch\": nonce ? \"attribute\" : undefined,\n // innerHTML, not a text child: the server would escape `>` in a text\n // child, and inside <style> that breaks the CSS.\n innerHTML: stylesheet,\n });\n };\n },\n});\n","<script setup lang=\"ts\">\nimport { AGUIConnectNotImplementedError, AbstractAgent } from \"@ag-ui/client\";\nimport {\n createAttachmentContent,\n DEFAULT_AGENT_ID,\n randomUUID,\n} from \"@copilotkit/shared\";\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n useAttrs,\n useSlots,\n watch,\n} from \"vue\";\nimport {\n CopilotChatDefaultLabels,\n CopilotKitCoreErrorCode,\n TranscriptionError,\n ɵisHttpAgent,\n ɵtranscribeAudio,\n ɵtranscriptionErrorMessageKey,\n} from \"@copilotkit/core\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport CopilotChatConfigurationProvider from \"../../providers/CopilotChatConfigurationProvider.vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { useCopilotKit } from \"../../providers/useCopilotKit\";\nimport { useLicenseContext } from \"../../providers/useLicenseContext\";\nimport InlineFeatureWarning from \"../InlineFeatureWarning.vue\";\nimport { useAgent } from \"../../hooks/use-agent\";\nimport { useSuggestions } from \"../../hooks/use-suggestions\";\nimport { useAttachments } from \"../../hooks/use-attachments\";\nimport { useShallowStableRef } from \"../../lib/shallow-stable\";\nimport CopilotChatView from \"./CopilotChatView.vue\";\nimport { LastUserMessageKey } from \"./last-user-message-context\";\nimport type { LastUserMessageState } from \"./last-user-message-context\";\nimport type { Message } from \"@ag-ui/core\";\nimport type { InputContent } from \"@copilotkit/shared\";\nimport { useInspectorThreadOverride } from \"../../providers/use-inspector-thread-override\";\nimport { CopilotKitStyles } from \"../../styles/CopilotKitStyles\";\nimport type {\n CopilotChatInputSlotProps,\n CopilotChatProps,\n CopilotChatInterruptSlotProps,\n CopilotChatSuggestionViewSlotProps,\n CopilotChatViewOverrideSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotChatProps>(), {\n autoScroll: true,\n messageFeedback: true,\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"chat-view\"?: (props: CopilotChatViewOverrideSlotProps) => unknown;\n \"message-view\"?: (props: {\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotChatInputSlotProps) => unknown;\n \"suggestion-view\"?: (props: CopilotChatSuggestionViewSlotProps) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst componentSlots = useSlots();\nconst existingConfig = useCopilotChatConfiguration();\nconst { copilotkit } = useCopilotKit();\nconst forwardedChatViewSlotNames = computed(() =>\n Object.keys(componentSlots).filter((slotName) => slotName !== \"chat-view\"),\n);\n\nconst generatedThreadId = ref(randomUUID());\nconst transcribeMode = ref<\"input\" | \"transcribe\" | \"processing\">(\"input\");\nconst inputValue = ref(props.inputValue ?? \"\");\nconst transcriptionError = ref<string | null>(null);\nconst isTranscribing = ref(false);\nconst isMounted = ref(false);\nconst isUnmounting = ref(false);\n\ntype ActiveConnectCycle = {\n core: object;\n agent: AbstractAgent;\n threadId: string;\n inspectorRequestId: string | null;\n abortController: AbortController;\n detached: boolean;\n clearDiscardedBaseline?: () => void;\n};\n\nconst activeConnectCycle = shallowRef<ActiveConnectCycle | null>(null);\nlet lastConnectCycle: ActiveConnectCycle | null = null;\nconst detachPromises = new WeakMap<AbstractAgent, Promise<void>>();\n// Agent clones can share cursors. Finish every old reset before connecting again.\nlet pendingTeardown = Promise.resolve();\nconst baselineThreadIds = new WeakMap<AbstractAgent, string>();\n\nconst resolvedAgentId = computed(\n () => props.agentId ?? existingConfig.value?.agentId ?? DEFAULT_AGENT_ID,\n);\n// \"Provided\" — supplied by either the caller's prop or a wrapping\n// CopilotChatConfigurationProvider. Distinct from `resolvedThreadId`, which\n// falls back to a locally minted UUID when neither source is set. We only\n// gate `/connect` on a provided id; the local UUID has never been seen by\n// the backend and would always 404.\nconst providedThreadId = computed(\n () => props.threadId ?? existingConfig.value?.threadId,\n);\nconst baseThreadId = computed(\n () => providedThreadId.value ?? generatedThreadId.value,\n);\n// \"Explicit\" means the caller actually picked this thread — via the\n// `threadId` prop on CopilotChat or a wrapping provider that flagged its\n// threadId as caller-chosen. An auto-minted UUID leaking down through a\n// CopilotChatConfigurationProvider does NOT count.\nconst baseHasExplicitThreadId = computed(\n () => !!props.threadId || !!existingConfig.value?.hasExplicitThreadId,\n);\nconst { inspectorThreadId, inspectorRequestId, failInspectorOverride } =\n useInspectorThreadOverride({\n agentId: resolvedAgentId,\n baseThreadId,\n });\nconst resolvedThreadId = computed(\n () => inspectorThreadId.value ?? baseThreadId.value,\n);\nconst hasExplicitThreadId = computed(\n () => inspectorThreadId.value !== null || baseHasExplicitThreadId.value,\n);\nconst lastConnectedThreadId = ref<string | null>(null);\nconst isConnecting = computed(\n () =>\n hasExplicitThreadId.value &&\n lastConnectedThreadId.value !== resolvedThreadId.value,\n);\nconst stableLabels = useShallowStableRef(computed(() => props.labels));\nconst resolvedLabels = computed(() => stableLabels.value);\n// The labels this chat shows, the same merge its configuration provider makes.\nconst chatLabels = computed(() => ({\n ...CopilotChatDefaultLabels,\n ...existingConfig.value?.labels,\n ...resolvedLabels.value,\n}));\n\n// `useAgent` takes no threadId: it pins one only from a surrounding chat\n// configuration, and this call sits outside the provider rendered in this\n// component's template, so it would never see the thread being rendered. The\n// thread is assigned in the connect watcher below, mirroring React's CopilotChat.\nconst { agent } = useAgent({\n agentId: resolvedAgentId,\n throttleMs: computed(() => props.throttleMs),\n});\nconst { suggestions: autoSuggestions } = useSuggestions({\n agentId: resolvedAgentId,\n});\n\nconst license = useLicenseContext();\nconst isChatLicensed = computed(() => license.value.checkFeature(\"chat\"));\n\nwatch(\n isChatLicensed,\n (licensed) => {\n if (!licensed) {\n console.warn(\n '[CopilotKit] Warning: \"chat\" feature is not licensed. Visit copilotkit.ai/pricing',\n );\n }\n },\n { immediate: true },\n);\n\nconst isTranscriptionEnabled = computed(\n () => copilotkit.value.audioFileTranscriptionEnabled,\n);\nconst isMediaRecorderSupported = computed(\n () => typeof window !== \"undefined\" && typeof MediaRecorder !== \"undefined\",\n);\nconst showTranscription = computed(\n () => isTranscriptionEnabled.value && isMediaRecorderSupported.value,\n);\nconst {\n attachments,\n enabled: attachmentsEnabled,\n dragOver,\n fileInputRef,\n containerRef: attachmentContainerRef,\n handleFileUpload,\n handleDragOver,\n handleDragLeave,\n handleDrop,\n removeAttachment,\n consumeAttachments,\n} = useAttachments({\n config: computed(() => props.attachments),\n});\nconst effectiveMode = computed<\"input\" | \"transcribe\" | \"processing\">(() =>\n isTranscribing.value ? \"processing\" : transcribeMode.value,\n);\nconst runLifecycleTick = ref(0);\nconst messages = computed(() => [...(agent.value?.messages ?? [])]);\nconst isRunning = computed(() => {\n void runLifecycleTick.value;\n return agent.value?.isRunning ?? false;\n});\nconst shouldAllowStop = computed(\n () => isRunning.value && messages.value.length > 0,\n);\n\n// Track the latest user message id so descendants (notably `usePinToSend`\n// inside `CopilotChatView`) can anchor to the most recent user turn.\n// Mirrors React `CopilotChat.tsx` `lastUserMessageId` + `sendNonce` state.\nconst lastUserMessageId = computed<string | null>(() => {\n for (let i = messages.value.length - 1; i >= 0; i--) {\n const message = messages.value[i];\n if (message?.role === \"user\") return message.id;\n }\n return null;\n});\nconst sendNonce = ref(0);\n// Seed with the current value so restoring a thread with existing messages\n// does not count as a new send. Only later id transitions bump.\nlet prevLastUserMessageId: string | null = lastUserMessageId.value;\nwatch(lastUserMessageId, (next) => {\n if (next && next !== prevLastUserMessageId) {\n sendNonce.value += 1;\n prevLastUserMessageId = next;\n }\n});\nconst lastUserMessageState = computed<LastUserMessageState>(() => ({\n id: lastUserMessageId.value,\n sendNonce: sendNonce.value,\n}));\nprovide(LastUserMessageKey, lastUserMessageState);\n\nwatch(\n () => agent.value,\n (currentAgent, _previous, onCleanup) => {\n if (!currentAgent) return;\n const sub = currentAgent.subscribe({\n onRunStartedEvent: () => {\n runLifecycleTick.value += 1;\n },\n onRunFinishedEvent: () => {\n runLifecycleTick.value += 1;\n },\n onRunErrorEvent: () => {\n runLifecycleTick.value += 1;\n },\n });\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n);\n\nwatch(\n () => props.inputValue,\n (next) => {\n if (next !== undefined) {\n inputValue.value = next;\n }\n },\n);\n\nwatch(\n [() => props.threadId, () => existingConfig.value?.threadId],\n ([threadId, inheritedThreadId], previousValues) => {\n if (threadId || inheritedThreadId) {\n return;\n }\n\n if (previousValues && (previousValues[0] || previousValues[1])) {\n generatedThreadId.value = randomUUID();\n }\n },\n);\n\nwatch(\n [() => copilotkit.value, resolvedAgentId, () => props.onError],\n ([core, agentId, onError], _old, onCleanup) => {\n if (!onError) {\n return;\n }\n\n const subscription = core.subscribe({\n onError: (event) => {\n if (event.context?.agentId === agentId || !event.context?.agentId) {\n void onError({\n error: event.error,\n code: event.code,\n context: event.context,\n });\n }\n },\n });\n\n onCleanup(() => subscription.unsubscribe());\n },\n { immediate: true },\n);\n\nwatch(\n [\n () => copilotkit.value,\n resolvedAgentId,\n resolvedThreadId,\n inspectorRequestId,\n ],\n ([core, agentId, threadId, requestId], _old, onCleanup) => {\n if (!requestId) return;\n const subscription = core.subscribe({\n onError: (event) => {\n if (event.code !== CopilotKitCoreErrorCode.AGENT_CONNECT_FAILED) return;\n if (event.context?.agentId !== agentId) return;\n if (event.context?.threadId !== threadId) return;\n failInspectorOverride(requestId);\n },\n });\n onCleanup(() => subscription.unsubscribe());\n },\n { immediate: true },\n);\n\nwatch(\n [\n isMounted,\n () => copilotkit.value,\n () => agent.value,\n resolvedThreadId,\n hasExplicitThreadId,\n inspectorRequestId,\n ],\n (\n [mounted, core, currentAgent, threadId, isExplicit, requestId],\n _old,\n onCleanup,\n ) => {\n if (!mounted) {\n return;\n }\n if (typeof window === \"undefined\") {\n return;\n }\n if (!currentAgent) {\n return;\n }\n\n const previousCycle = activeConnectCycle.value;\n const inspectorTransition =\n previousCycle !== null &&\n previousCycle.threadId !== threadId &&\n previousCycle.inspectorRequestId !== requestId &&\n (previousCycle.inspectorRequestId !== null || requestId !== null);\n if (inspectorTransition) {\n try {\n core.stopAgent({ agent: currentAgent });\n } catch {\n // No live run to stop.\n }\n }\n\n // Pin the thread this chat renders onto its agent, before anything issues a\n // request. `CopilotKitCore.connectAgent` reads `agent.threadId` synchronously\n // to decide whether this is a fresh restore, so a later assignment would let\n // /connect address the previous thread. Assigning inside this callback — as\n // React does — makes the ordering unconditional instead of depending on\n // watcher scheduling. Non-explicit threads skip /connect below, but the first\n // runAgent still has to ship the thread the UI is rendering.\n baselineThreadIds.set(currentAgent, currentAgent.threadId);\n currentAgent.threadId = threadId;\n\n // When the caller hasn't picked a specific thread, resolvedThreadId is\n // a UUID minted locally. The backend has never seen it, so /connect\n // would always 404 — skip the call. A real thread is only created\n // once the user runs the agent for the first time.\n if (!isExplicit) {\n return;\n }\n\n const abstractAgentPrototype = AbstractAgent.prototype as unknown as {\n connect?: unknown;\n connectAgent?: unknown;\n };\n const inspectableAgent = currentAgent as unknown as {\n connect?: unknown;\n connectAgent?: unknown;\n };\n const hasCustomConnect =\n inspectableAgent.connect !== abstractAgentPrototype.connect;\n const hasCustomConnectAgent =\n inspectableAgent.connectAgent !== abstractAgentPrototype.connectAgent;\n if (!hasCustomConnect && !hasCustomConnectAgent) {\n // No custom connect to wait for — mark as connected so the welcome\n // suppression / suggestion gating release immediately.\n lastConnectedThreadId.value = threadId;\n return;\n }\n\n const existingCycle = activeConnectCycle.value;\n const hasSameDeps =\n existingCycle &&\n existingCycle.core === (core as object) &&\n existingCycle.agent === currentAgent &&\n existingCycle.threadId === threadId &&\n existingCycle.inspectorRequestId === requestId;\n\n let cycle: ActiveConnectCycle;\n if (hasSameDeps && existingCycle) {\n cycle = existingCycle;\n } else {\n const connectAbortController = new AbortController();\n cycle = {\n core: core as object,\n agent: currentAgent,\n threadId,\n inspectorRequestId: requestId,\n abortController: connectAbortController,\n detached: false,\n };\n activeConnectCycle.value = cycle;\n lastConnectCycle = cycle;\n\n void pendingTeardown\n .then(() => {\n if (cycle.detached) return;\n if (ɵisHttpAgent(currentAgent))\n currentAgent.abortController = connectAbortController;\n return core.connectAgent({ agent: currentAgent });\n })\n .catch((error: unknown) => {\n if (cycle.detached) {\n cycle.clearDiscardedBaseline?.();\n return;\n }\n if (error instanceof AGUIConnectNotImplementedError) {\n return;\n }\n console.error(\"CopilotChat: connectAgent failed\", error);\n if (requestId) {\n failInspectorOverride(requestId);\n }\n })\n .finally(() => {\n // Whether the connect succeeded or failed, we're no longer in\n // the transitional \"connecting\" state for this thread — release\n // the welcome / suggestion gating so the view can settle.\n //\n // Defer one animation frame so any trailing reactive commits\n // from the bootstrap replay (final assistant message content)\n // paint before isConnecting flips off. Without this, suggestions\n // can briefly render against an incompletely-laid-out message\n // tree and visibly snap once the last text chunk lands.\n if (cycle.detached) {\n cycle.clearDiscardedBaseline?.();\n return;\n }\n const raf =\n typeof requestAnimationFrame === \"function\"\n ? requestAnimationFrame\n : (cb: () => void) => setTimeout(cb, 16);\n raf(() => {\n if (cycle.detached) return;\n lastConnectedThreadId.value = cycle.threadId;\n });\n });\n }\n\n onCleanup(() => {\n const activeCycle = activeConnectCycle.value;\n if (!activeCycle || activeCycle !== cycle) {\n return;\n }\n\n const shouldDetach =\n isUnmounting.value ||\n copilotkit.value !== activeCycle.core ||\n agent.value !== activeCycle.agent ||\n resolvedThreadId.value !== activeCycle.threadId;\n if (!shouldDetach) {\n return;\n }\n\n activeCycle.detached = true;\n activeCycle.abortController.abort();\n const detach = activeCycle.agent\n .detachActiveRun()\n .catch((error: unknown) => {\n console.error(\"CopilotChat: detachActiveRun failed\", error);\n });\n detachPromises.set(activeCycle.agent, detach);\n pendingTeardown = Promise.all([pendingTeardown, detach]).then(() => {});\n void detach.then(() => {\n if (detachPromises.get(activeCycle.agent) === detach)\n detachPromises.delete(activeCycle.agent);\n });\n activeConnectCycle.value = null;\n });\n },\n { immediate: true },\n);\n\n// Clear stale messages when the active thread switches to a fresh,\n// non-explicit thread (e.g. a \"+ New\" reset). Explicit thread switches\n// replay their history via the /connect cycle above, and the very first\n// resolution (mount) or an agent-store swap that keeps the same thread id\n// must never clear — only a real fresh-thread transition does.\nlet lastFreshSelection:\n | { threadId: string; agent: AbstractAgent | null }\n | undefined;\nwatch(\n [resolvedThreadId, hasExplicitThreadId, () => agent.value],\n ([threadId, isExplicit, currentAgent], _old, onCleanup) => {\n const previous = lastFreshSelection;\n const selection = { threadId, agent: currentAgent };\n lastFreshSelection = selection;\n if (!currentAgent) return;\n if (isExplicit) return;\n if (previous === undefined) return;\n if (threadId === previous.threadId) return;\n let active = true;\n let resetPending = true;\n onCleanup(() => {\n active = false;\n });\n const discardedThreadId =\n previous.agent === currentAgent\n ? previous.threadId\n : baselineThreadIds.get(currentAgent);\n const clearCursor = () => {\n if (!discardedThreadId) return;\n if (\n \"clearReplayCursor\" in currentAgent &&\n typeof currentAgent.clearReplayCursor === \"function\"\n )\n currentAgent.clearReplayCursor(discardedThreadId);\n if (\n \"clearReconnectCursor\" in currentAgent &&\n typeof currentAgent.clearReconnectCursor === \"function\"\n )\n currentAgent.clearReconnectCursor(discardedThreadId);\n };\n const clearDiscardedBaseline = () => {\n if (\n !active ||\n !resetPending ||\n isUnmounting.value ||\n lastFreshSelection !== selection ||\n agent.value !== currentAgent\n )\n return;\n currentAgent.setMessages([]);\n currentAgent.setState({});\n currentAgent.pendingInterrupts = [];\n clearCursor();\n };\n if (\n lastConnectCycle?.agent === currentAgent &&\n lastConnectCycle.threadId === discardedThreadId\n )\n lastConnectCycle.clearDiscardedBaseline = clearDiscardedBaseline;\n const detach =\n detachPromises.get(currentAgent) ?? currentAgent.detachActiveRun();\n detachPromises.set(currentAgent, detach);\n const finishReset = () => {\n if (!resetPending) return;\n // The cursor belongs to the discarded view, even after a fast reopen.\n clearCursor();\n clearDiscardedBaseline();\n resetPending = false;\n };\n clearDiscardedBaseline();\n pendingTeardown = Promise.all([pendingTeardown, detach])\n .then(finishReset)\n .catch((error: unknown) => {\n console.error(\"CopilotChat: detachActiveRun failed\", error);\n })\n .finally(() => {\n if (detachPromises.get(currentAgent) === detach)\n detachPromises.delete(currentAgent);\n });\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n isUnmounting.value = true;\n});\n\nonMounted(() => {\n isMounted.value = true;\n});\n\nwatch(transcriptionError, (next, _old, onCleanup) => {\n if (!next) {\n return;\n }\n const timer = setTimeout(() => {\n transcriptionError.value = null;\n }, 5000);\n onCleanup(() => clearTimeout(timer));\n});\n\nasync function runCurrentAgent() {\n const currentAgent = agent.value;\n if (!currentAgent) {\n return;\n }\n\n try {\n const activeCycle = activeConnectCycle.value;\n if (\n activeCycle &&\n activeCycle.agent === currentAgent &&\n activeCycle.threadId === resolvedThreadId.value\n ) {\n activeCycle.detached = true;\n activeCycle.abortController.abort();\n activeConnectCycle.value = null;\n await activeCycle.agent.detachActiveRun?.();\n }\n await copilotkit.value.runAgent({ agent: currentAgent });\n } catch (error) {\n console.error(\"CopilotChat: runAgent failed\", error);\n }\n}\n\nasync function handleSubmitMessage(value: string) {\n const hasUploading = attachments.value.some(\n (attachment) => attachment.status === \"uploading\",\n );\n if (hasUploading) {\n console.error(\"[CopilotKit] Cannot send while attachments are uploading\");\n return;\n }\n\n emit(\"submit-message\", value);\n\n if (!agent.value) {\n console.error(\"[CopilotKit] Cannot send message: no agent available\");\n return;\n }\n\n const readyAttachments = consumeAttachments();\n if (readyAttachments.length > 0) {\n const contentParts: InputContent[] = [];\n if (value.trim()) {\n contentParts.push({ type: \"text\", text: value });\n }\n for (const attachment of readyAttachments) {\n contentParts.push(createAttachmentContent(attachment));\n }\n agent.value.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: contentParts,\n });\n } else {\n agent.value.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: value,\n });\n }\n\n inputValue.value = \"\";\n await runCurrentAgent();\n}\n\nasync function handleSelectSuggestion(suggestion: Suggestion, index: number) {\n emit(\"select-suggestion\", suggestion, index);\n agent.value?.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: suggestion.message,\n });\n await runCurrentAgent();\n}\n\nfunction stopCurrentRun() {\n const currentAgent = agent.value;\n if (!currentAgent) {\n return;\n }\n\n try {\n copilotkit.value.stopAgent({ agent: currentAgent });\n } catch (error) {\n console.error(\"CopilotChat: stopAgent failed\", error);\n try {\n currentAgent.abortRun();\n } catch (abortError) {\n console.error(\"CopilotChat: abortRun fallback failed\", abortError);\n }\n }\n}\n\nfunction handleStop() {\n emit(\"stop\");\n if (shouldAllowStop.value) {\n stopCurrentRun();\n }\n}\n\nfunction handleInputChange(value: string) {\n inputValue.value = value;\n emit(\"input-change\", value);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n if (!attachmentsEnabled.value) {\n return;\n }\n setTimeout(() => {\n fileInputRef.value?.click();\n }, 100);\n}\n\nfunction handleStartTranscribe() {\n if (!showTranscription.value) {\n return;\n }\n transcriptionError.value = null;\n transcribeMode.value = \"transcribe\";\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n if (!showTranscription.value) {\n return;\n }\n transcriptionError.value = null;\n transcribeMode.value = \"input\";\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n if (!showTranscription.value) {\n return;\n }\n transcribeMode.value = \"input\";\n emit(\"finish-transcribe\");\n}\n\nasync function handleFinishTranscribeWithAudio(audioBlob: Blob) {\n if (!showTranscription.value) {\n return;\n }\n if (props.onFinishTranscribeWithAudio) {\n await props.onFinishTranscribeWithAudio(audioBlob);\n return;\n }\n\n isTranscribing.value = true;\n try {\n transcriptionError.value = null;\n const result = await ɵtranscribeAudio(copilotkit.value, audioBlob);\n const trimmedPrevious = inputValue.value.trim();\n inputValue.value = trimmedPrevious\n ? `${trimmedPrevious} ${result.text}`\n : result.text;\n } catch (error) {\n console.error(\"CopilotChat: Transcription failed\", error);\n const labels = chatLabels.value;\n if (error instanceof TranscriptionError) {\n const key = ɵtranscriptionErrorMessageKey(error.info);\n transcriptionError.value = key ? labels[key] : error.info.message;\n } else {\n transcriptionError.value = labels.transcriptionErrorGenericText;\n }\n } finally {\n isTranscribing.value = false;\n }\n}\n\nconst chatViewSlotProps = computed<CopilotChatViewOverrideSlotProps>(() => ({\n messages: messages.value,\n autoScroll: props.autoScroll,\n isRunning: isRunning.value,\n suggestions: autoSuggestions.value,\n suggestionLoadingIndexes: [],\n welcomeScreen: props.welcomeScreen,\n attachments: attachments.value,\n dragOver: dragOver.value,\n inputValue: inputValue.value,\n inputMode: effectiveMode.value,\n inputToolsMenu: props.inputToolsMenu,\n isConnecting: isConnecting.value,\n hasExplicitThreadId: hasExplicitThreadId.value,\n toolCallDisplay: props.toolCallDisplay,\n messageFeedback: props.messageFeedback,\n canStop: shouldAllowStop.value,\n canAddFile: attachmentsEnabled.value,\n canTranscribe: showTranscription.value,\n onSubmitMessage: handleSubmitMessage,\n onStop: handleStop,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n onRemoveAttachment: removeAttachment,\n onAddFile: handleAddFile,\n onDragOver: attachmentsEnabled.value ? handleDragOver : undefined,\n onDragLeave: attachmentsEnabled.value ? handleDragLeave : undefined,\n onDrop: attachmentsEnabled.value ? handleDrop : undefined,\n onStartTranscribe: handleStartTranscribe,\n onCancelTranscribe: handleCancelTranscribe,\n onFinishTranscribe: handleFinishTranscribe,\n onFinishTranscribeWithAudio: handleFinishTranscribeWithAudio,\n}));\n\nconst defaultChatViewBindings = computed(() => {\n const listeners: Record<string, unknown> = {\n ...attrs,\n onSubmitMessage: handleSubmitMessage,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n };\n\n if (shouldAllowStop.value) {\n listeners.onStop = handleStop;\n }\n if (attachmentsEnabled.value) {\n listeners.onAddFile = handleAddFile;\n listeners.attachments = attachments.value;\n listeners.onRemoveAttachment = removeAttachment;\n listeners.dragOver = dragOver.value;\n listeners.onDragOver = handleDragOver;\n listeners.onDragLeave = handleDragLeave;\n listeners.onDrop = handleDrop;\n }\n if (showTranscription.value) {\n listeners.onStartTranscribe = handleStartTranscribe;\n listeners.onCancelTranscribe = handleCancelTranscribe;\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <CopilotChatConfigurationProvider\n :agent-id=\"resolvedAgentId\"\n :thread-id=\"resolvedThreadId\"\n :has-explicit-thread-id=\"hasExplicitThreadId\"\n :labels=\"resolvedLabels\"\n >\n <div ref=\"attachmentContainerRef\" style=\"display: contents\">\n <CopilotKitStyles />\n <input\n v-if=\"attachmentsEnabled\"\n ref=\"fileInputRef\"\n type=\"file\"\n multiple\n :accept=\"props.attachments?.accept ?? '*/*'\"\n style=\"display: none\"\n @change=\"(event) => void handleFileUpload(event)\"\n />\n <InlineFeatureWarning v-if=\"!isChatLicensed\" feature-name=\"Chat\" />\n <div\n v-if=\"transcriptionError\"\n style=\"\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translateX(-50%);\n background-color: #ef4444;\n color: white;\n padding: 8px 16px;\n border-radius: 8px;\n font-size: 14px;\n z-index: 50;\n \"\n >\n {{ transcriptionError }}\n </div>\n\n <slot name=\"chat-view\" v-bind=\"chatViewSlotProps\">\n <CopilotChatView\n v-bind=\"defaultChatViewBindings\"\n :messages=\"chatViewSlotProps.messages\"\n :auto-scroll=\"chatViewSlotProps.autoScroll\"\n :is-running=\"chatViewSlotProps.isRunning\"\n :suggestions=\"chatViewSlotProps.suggestions\"\n :suggestion-loading-indexes=\"\n chatViewSlotProps.suggestionLoadingIndexes\n \"\n :welcome-screen=\"chatViewSlotProps.welcomeScreen\"\n :input-value=\"chatViewSlotProps.inputValue\"\n :input-mode=\"chatViewSlotProps.inputMode\"\n :input-tools-menu=\"chatViewSlotProps.inputToolsMenu\"\n :is-connecting=\"chatViewSlotProps.isConnecting\"\n :has-explicit-thread-id=\"chatViewSlotProps.hasExplicitThreadId\"\n :tool-call-display=\"chatViewSlotProps.toolCallDisplay\"\n :message-feedback=\"chatViewSlotProps.messageFeedback\"\n :on-finish-transcribe-with-audio=\"\n chatViewSlotProps.onFinishTranscribeWithAudio\n \"\n >\n <template\n v-for=\"slotName in forwardedChatViewSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatView>\n </slot>\n </div>\n </CopilotChatConfigurationProvider>\n</template>\n","import { computed, onScopeDispose, ref, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport {\n CopilotKitCoreRuntimeConnectionStatus,\n ɵcreateThreadStore,\n ɵselectHasNextPage,\n ɵselectIsFetchingNextPage,\n ɵselectIsMutating,\n ɵselectThreads,\n ɵselectThreadsError,\n ɵselectFetchMoreError,\n ɵselectThreadsIsLoading,\n} from \"@copilotkit/core\";\nimport type { ɵThreadRuntimeContext, ɵThreadStore } from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\n\nexport interface Thread {\n id: string;\n agentId: string;\n name: string | null;\n archived: boolean;\n createdAt: string;\n updatedAt: string;\n /**\n * ISO-8601 timestamp of the most recent agent run on this thread. Absent\n * when the thread has never been run. Prefer this over `updatedAt` for\n * user-facing \"last activity\" displays — it is not bumped by metadata-only\n * actions like rename or archive.\n */\n lastRunAt?: string;\n}\n\nexport interface UseThreadsInput {\n agentId: MaybeRefOrGetter<string>;\n includeArchived?: MaybeRefOrGetter<boolean | undefined>;\n limit?: MaybeRefOrGetter<number | undefined>;\n /**\n * When `false`, the hook clears the store context and issues no `/threads`\n * request — used by the drawer to skip fetching while unlicensed. Defaults\n * to `true`.\n */\n enabled?: MaybeRefOrGetter<boolean | undefined>;\n}\n\nexport interface UseThreadsResult {\n threads: Ref<Thread[]>;\n isLoading: Ref<boolean>;\n error: Ref<Error | null>;\n /** Genuine list-load/mutation errors only — excludes dev/config errors. */\n listError: Ref<Error | null>;\n /**\n * Error from the most recent FAILED next-page (fetch-more) load, or `null`.\n * Tracked separately from {@link listError} so a paginated-load failure\n * shows an inline \"couldn't load more\" affordance while the loaded list\n * stays visible. Cleared when a fetch-more is retried or succeeds.\n */\n fetchMoreError: Ref<Error | null>;\n hasMoreThreads: Ref<boolean>;\n isFetchingMoreThreads: Ref<boolean>;\n isMutating: Ref<boolean>;\n fetchMoreThreads: () => void;\n refetchThreads: () => void;\n startNewThread: () => void;\n renameThread: (threadId: string, name: string) => Promise<void>;\n archiveThread: (threadId: string) => Promise<void>;\n unarchiveThread: (threadId: string) => Promise<void>;\n deleteThread: (threadId: string) => Promise<void>;\n}\n\nfunction bindThreadStoreSelector<T>(\n store: ɵThreadStore,\n selector: (state: ReturnType<ɵThreadStore[\"getState\"]>) => T,\n target: Ref<T>,\n): void {\n target.value = selector(store.getState());\n const subscription = store.select(selector).subscribe(() => {\n target.value = selector(store.getState());\n });\n onScopeDispose(() => subscription.unsubscribe());\n}\n\n/**\n * Vue composable for listing and managing CopilotKit Intelligence threads.\n *\n * The hook fetches threads for the runtime-authenticated user and the given\n * `agentId`, then keeps the result in sync via the core thread store's realtime\n * channel when available. Inputs accept refs/computeds to make thread context\n * changes reactive.\n */\nexport function useThreads(input: UseThreadsInput): UseThreadsResult {\n const { copilotkit } = useCopilotKit();\n const store = ɵcreateThreadStore({\n fetch: copilotkit.value.ɵruntimeFetch,\n });\n\n const resolvedAgentId = computed(() => toValue(input.agentId));\n const resolvedIncludeArchived = computed(() =>\n toValue(input.includeArchived),\n );\n const resolvedLimit = computed(() => toValue(input.limit));\n const resolvedEnabled = computed(() => toValue(input.enabled) ?? true);\n\n // Thread-endpoint capability, derived from the runtime's `/info` payload.\n // `threadEndpoints` is `undefined` on legacy runtimes that don't advertise\n // the capability, so we treat \"not explicitly false\" as supported (matching\n // React's `!== false` semantics) to preserve legacy thread behavior.\n const threadListEndpointSupported = computed(\n () => copilotkit.value.threadEndpoints?.list !== false,\n );\n const threadMutationsSupported = computed(\n () => copilotkit.value.threadEndpoints?.mutations !== false,\n );\n // Connected, but the runtime explicitly does not serve the list endpoint.\n const threadEndpointsUnavailable = computed(\n () =>\n !!copilotkit.value.runtimeUrl &&\n copilotkit.value.runtimeConnectionStatus ===\n CopilotKitCoreRuntimeConnectionStatus.Connected &&\n !threadListEndpointSupported.value,\n );\n const threadEndpointsError = computed<Error | null>(() =>\n threadEndpointsUnavailable.value\n ? new Error(\n \"Thread endpoints are not available on this CopilotKit runtime\",\n )\n : null,\n );\n const threadMutationsError = computed<Error | null>(() =>\n threadMutationsSupported.value\n ? null\n : new Error(\n \"Thread mutations are not available on this CopilotKit runtime\",\n ),\n );\n\n // Keyed on the source's generation, not on header VALUES: a builder's\n // returned token can change on every resolution without a new source ever\n // being set, and this must not re-dispatch the thread context on that (see\n // #1937).\n const headersKey = computed(() => copilotkit.value.ɵheadersGeneration);\n\n const threads = ref<Thread[]>([]);\n const storeIsLoading = ref(false);\n const storeError = ref<Error | null>(null);\n const fetchMoreError = ref<Error | null>(null);\n const hasMoreThreads = ref(false);\n const isFetchingMoreThreads = ref(false);\n const isMutating = ref(false);\n\n bindThreadStoreSelector(store, ɵselectThreads, threads as Ref<Thread[]>);\n bindThreadStoreSelector(store, ɵselectThreadsIsLoading, storeIsLoading);\n bindThreadStoreSelector(store, ɵselectThreadsError, storeError);\n bindThreadStoreSelector(store, ɵselectFetchMoreError, fetchMoreError);\n bindThreadStoreSelector(store, ɵselectHasNextPage, hasMoreThreads);\n bindThreadStoreSelector(\n store,\n ɵselectIsFetchingNextPage,\n isFetchingMoreThreads,\n );\n bindThreadStoreSelector(store, ɵselectIsMutating, isMutating);\n\n store.start();\n onScopeDispose(() => {\n store.stop();\n });\n\n // Register this store in core's single-slot thread-store registry so other\n // surfaces (e.g. the chat view) can resolve the same store for the agent.\n //\n // Gated on `resolvedEnabled`: a disabled (e.g. unlicensed) drawer must not\n // claim the agentId slot. The registry is single-slot/last-writer-wins, so\n // registering an inert store would evict — and on unmount tear down — a\n // co-mounted live store for the same agent. Staying unregistered while\n // disabled leaves the live store's registration intact.\n watch(\n [resolvedEnabled, resolvedAgentId],\n ([enabled, agentId], _prev, onCleanup) => {\n if (!enabled) return;\n copilotkit.value.registerThreadStore(agentId, store);\n onCleanup(() => {\n copilotkit.value.unregisterThreadStore(agentId);\n });\n },\n { immediate: true },\n );\n\n // Tracks whether we've dispatched the first real context to the store.\n // The store itself starts with `isLoading: false`, so before we dispatch\n // consumers would otherwise see an empty, non-loading state (empty-list\n // flash). While runtimeUrl is set and we haven't dispatched yet, we\n // synthesize `isLoading: true` so the UI keeps its loading indicator until\n // the first fetch is in flight (at which point the store's own\n // isLoading takes over).\n const hasDispatchedContext = ref(false);\n\n // Defer setting the context until the runtime reports Connected. Before\n // `/info` resolves we don't know `intelligence.wsUrl`, so dispatching the\n // context early would issue a list fetch with `wsUrl: undefined`, then a\n // second list fetch (and a `/threads/subscribe`) once the flag lands.\n // Waiting lets the hook issue just one `/threads?…` + one `/threads/subscribe`.\n //\n // When `runtimeUrl` is absent we dispatch `null` to clear the store. For\n // transient states (Disconnected/Connecting/Error with a URL still set) we\n // leave the previously-dispatched context in place — any in-flight\n // realtime subscription or cached thread list stays usable while the\n // runtime recovers, and we don't re-trigger a fetch storm on transitions.\n watch(\n [\n () => copilotkit.value.runtimeUrl,\n () => copilotkit.value.runtimeConnectionStatus,\n headersKey,\n () => copilotkit.value.intelligence?.wsUrl,\n resolvedAgentId,\n resolvedIncludeArchived,\n resolvedLimit,\n resolvedEnabled,\n threadListEndpointSupported,\n ],\n ([\n runtimeUrl,\n runtimeStatus,\n ,\n wsUrl,\n agentId,\n includeArchived,\n limit,\n enabled,\n listEndpointSupported,\n ]) => {\n if (!runtimeUrl || !enabled) {\n store.setContext(null);\n hasDispatchedContext.value = false;\n return;\n }\n\n if (runtimeStatus !== CopilotKitCoreRuntimeConnectionStatus.Connected) {\n return;\n }\n\n // Connected, but the runtime explicitly does not serve the list\n // endpoint: stay inert so no `/threads` fetch fires. The\n // `threadEndpointsError` surfaces via `error` instead.\n if (!listEndpointSupported) {\n store.setContext(null);\n hasDispatchedContext.value = false;\n return;\n }\n\n // No `headers` here: the store's `fetch` is `copilotkit.value.ɵruntimeFetch`,\n // which already resolves and overlays the current core headers at send\n // time (#1937) — a snapshot here would go stale the moment the builder\n // returns something new.\n const context: ɵThreadRuntimeContext = {\n runtimeUrl,\n wsUrl,\n agentId,\n includeArchived,\n limit,\n };\n\n store.setContext(context);\n hasDispatchedContext.value = true;\n },\n { immediate: true },\n );\n\n const runtimeError = computed<Error | null>(() =>\n copilotkit.value.runtimeUrl\n ? null\n : new Error(\"Runtime URL is not configured\"),\n );\n\n const preConnectLoading = computed(\n () =>\n !!copilotkit.value.runtimeUrl &&\n resolvedEnabled.value &&\n !threadEndpointsUnavailable.value &&\n !hasDispatchedContext.value,\n );\n\n const isLoading = computed(() =>\n runtimeError.value || threadEndpointsError.value\n ? false\n : preConnectLoading.value || storeIsLoading.value,\n );\n\n // Folds developer/config errors (missing runtime URL, runtime without\n // thread endpoints) together with genuine store errors. `listError` below\n // deliberately excludes the config errors.\n const error = computed<Error | null>(\n () => runtimeError.value ?? threadEndpointsError.value ?? storeError.value,\n );\n\n // Genuine store errors only. Unlike `error`, this omits the dev/config\n // `runtimeError`/`threadEndpointsError` strings so they are never shown in\n // user-facing error UI.\n const listError = computed<Error | null>(() => storeError.value);\n\n // Reject mutations locally (before touching the network) when the runtime\n // reports mutations are unsupported, matching React's `guardMutation`.\n function guardMutation<TArgs extends unknown[]>(\n mutation: (...args: TArgs) => Promise<void>,\n ): (...args: TArgs) => Promise<void> {\n return (...args: TArgs) => {\n if (threadMutationsError.value) {\n return Promise.reject(threadMutationsError.value);\n }\n return mutation(...args);\n };\n }\n\n return {\n threads: computed(() =>\n threads.value.map(\n ({ id, agentId, name, archived, createdAt, updatedAt, lastRunAt }) => ({\n id,\n agentId,\n name,\n archived,\n createdAt,\n updatedAt,\n ...(lastRunAt !== undefined ? { lastRunAt } : {}),\n }),\n ),\n ),\n isLoading,\n error,\n listError,\n fetchMoreError,\n hasMoreThreads,\n isFetchingMoreThreads,\n isMutating,\n fetchMoreThreads: () => store.fetchNextPage(),\n refetchThreads: () => store.refetchThreads(),\n startNewThread: () => store.startNewThread(),\n renameThread: guardMutation((threadId: string, name: string) =>\n store.renameThread(threadId, name),\n ),\n archiveThread: guardMutation((threadId: string) =>\n store.archiveThread(threadId),\n ),\n unarchiveThread: guardMutation((threadId: string) =>\n store.unarchiveThread(threadId),\n ),\n deleteThread: guardMutation((threadId: string) =>\n store.deleteThread(threadId),\n ),\n };\n}\n","<script setup lang=\"ts\">\nimport { computed, onMounted, onScopeDispose, ref, watchEffect } from \"vue\";\n// NOTE: the `<copilotkit-threads-drawer>` element is a Lit custom element whose\n// module evaluates `class ... extends HTMLElement` at import time, which throws\n// under SSR (Node has no DOM). It is therefore imported LAZILY (client-only,\n// inside onMounted) rather than statically, so that importing `@copilotkit/vue`\n// stays SSR-safe for every consumer (e.g. Nuxt). Only the erased `import type`\n// below is kept at module scope.\nimport type {\n CopilotKitThreadsDrawer as CopilotKitThreadsDrawerElement,\n DrawerThread,\n ThreadSelectedDetail,\n ArchiveDetail,\n UnarchiveDetail,\n DeleteDetail,\n RetryDetail,\n OpenChangeDetail,\n} from \"@copilotkit/web-components/threads-drawer\";\n// TODO(ENT-1051): import `CollapseChangeDetail` from\n// \"@copilotkit/web-components/threads-drawer\" once the parallel element PR that\n// adds the collapse feature (property `collapsible` + event `collapse-change`)\n// lands and is published; declared locally here because the built element types\n// in this worktree predate it.\ntype CollapseChangeDetail = { collapsed: boolean };\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { useThreads } from \"../../hooks/use-threads\";\nimport type { Thread } from \"../../hooks/use-threads\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { useLicenseContext } from \"../../providers/useLicenseContext\";\n\nconst props = withDefaults(\n defineProps<{\n agentId?: string;\n onThreadSelect?: (threadId: string) => void;\n onNewThread?: () => void;\n onLicensed?: () => void;\n licenseUrl?: string;\n label?: string;\n /**\n * Heading rendered above the thread list (element attribute\n * `recent-label`). Defaults to the element's own `\"Recent Conversations\"`\n * when omitted.\n */\n recentLabel?: string;\n /**\n * Whether the drawer offers a collapse toggle. Bound to the element's\n * `collapsible` PROPERTY. When `false`, the drawer has no collapse toggle\n * and is always expanded. Defaults to `true`.\n *\n * NOTE: this MUST carry an explicit `true` default below. Vue coerces an\n * omitted `Boolean` prop to `false` (not `undefined`), so without the\n * default the `!== undefined` guard would always fire and force the element\n * to `collapsible=false` — silently disabling collapse. Defaulting to `true`\n * restores the element's own default when the prop is omitted.\n */\n collapsible?: boolean;\n limit?: number;\n dataTestId?: string;\n }>(),\n { dataTestId: \"copilot-threads-drawer\", collapsible: true },\n);\n\nconst emit = defineEmits<{\n /**\n * Emitted when the drawer's collapsed state changes (mirrors the element's\n * `collapse-change` event), carrying the new collapsed state.\n */\n \"collapse-change\": [collapsed: boolean];\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst license = useLicenseContext();\n\nconst licensed = computed(() => {\n const status = license.value.status;\n // `unknown` is an unrecovered retryable entitlement lookup, not a settled\n // negative: fetch the list and let the threads endpoint decide.\n if (status === \"unknown\") return true;\n const present = status === \"valid\" || status === \"expiring\";\n return present && license.value.checkFeature(\"threads\");\n});\nconst licensePending = computed(() => license.value.status === null);\n\nconst resolvedAgentId = computed(\n () => props.agentId ?? config.value?.agentId ?? DEFAULT_AGENT_ID,\n);\nconst activeThreadId = computed(() => config.value?.threadId ?? null);\n\n// Provider-less fallback: without a surrounding chat configuration there is\n// no shared open-state to bind to, so the wrapper keeps its own local\n// open-state. It starts CLOSED — matching the provider's own default — so a\n// bare `<CopilotThreadsDrawer>` does not render stuck-open and the element's\n// open-change events still toggle it.\nconst localDrawerOpen = ref(false);\nconst drawerOpen = computed(() =>\n config.value ? config.value.drawerOpen : localDrawerOpen.value,\n);\nfunction setDrawerOpen(open: boolean) {\n if (config.value) config.value.setDrawerOpen?.(open);\n else localDrawerOpen.value = open;\n}\n\nconst threadsApi = useThreads({\n agentId: resolvedAgentId,\n includeArchived: true,\n enabled: licensed,\n limit: () => props.limit,\n});\n\nfunction toDrawerThread(t: Thread): DrawerThread {\n return {\n id: t.id,\n name: t.name,\n archived: t.archived,\n createdAt: t.createdAt,\n updatedAt: t.updatedAt,\n ...(t.lastRunAt !== undefined ? { lastRunAt: t.lastRunAt } : {}),\n };\n}\nconst drawerThreads = computed(() =>\n threadsApi.threads.value.map(toDrawerThread),\n);\n\n// Client-only element registration (SSR-safe). The element module is imported\n// lazily here (never at module scope — see the import note above) so SSR never\n// evaluates its `extends HTMLElement`. `elementTag` holds the resolved custom-\n// element tag and `mounted` gates the render; both are set only after the\n// dynamic import resolves on the client.\nconst mounted = ref(false);\nconst elementTag = ref<string | null>(null);\nconst elRef = ref<CopilotKitThreadsDrawerElement | null>(null);\nonMounted(async () => {\n const mod = await import(\"@copilotkit/web-components/threads-drawer\");\n mod.defineCopilotKitThreadsDrawer();\n elementTag.value = mod.COPILOTKIT_THREADS_DRAWER_TAG;\n mounted.value = true;\n});\n\n// Imperatively push object/array/boolean PROPERTIES (v-bind on a custom element\n// would set string attributes for these). Re-runs whenever the element or any\n// reactive value read in the body changes (auto-tracked by watchEffect).\nwatchEffect(\n () => {\n const el = elRef.value;\n if (!el) return;\n el.threads = drawerThreads.value;\n el.loading = threadsApi.isLoading.value || licensePending.value;\n el.error = threadsApi.listError.value?.message ?? null;\n el.activeThreadId = activeThreadId.value;\n el.licensed = licensed.value || licensePending.value;\n el.hasMore = threadsApi.hasMoreThreads.value;\n el.fetchingMore = threadsApi.isFetchingMoreThreads.value;\n // Dedicated fetch-more error channel: drives the element's inline\n // \"couldn't load more — retry\" panel without disturbing the loaded list.\n el.fetchMoreError = threadsApi.fetchMoreError.value?.message ?? null;\n el.open = drawerOpen.value;\n if (props.label !== undefined) el.label = props.label;\n if (props.licenseUrl !== undefined) el.licenseUrl = props.licenseUrl;\n // `collapsible` is a default-true boolean PROPERTY (like `licensed`); leave\n // the element's own default in place when the prop is omitted.\n if (props.collapsible !== undefined) {\n // TODO(ENT-1051): drop the intersection cast once the published element\n // type declares `collapsible` (see the local CollapseChangeDetail note).\n (\n el as CopilotKitThreadsDrawerElement & { collapsible: boolean }\n ).collapsible = props.collapsible;\n }\n },\n { flush: \"post\" },\n);\n\n// Announce drawer presence so the mobile header launcher renders. Register\n// synchronously in setup (React parity: a mount-time effect) and de-register\n// on scope dispose. Not gated on `mounted`: presence is independent of the\n// client-only element registration.\nconst unregisterDrawer = config.value?.registerDrawer?.();\nif (unregisterDrawer) onScopeDispose(unregisterDrawer);\n\n// --- Outbound event handlers ------------------------------------------------\n/** The chat input textarea's documented `data-testid`. */\nconst CHAT_INPUT_TESTID = \"copilot-chat-input-textarea\";\n/** The chat view container's documented `data-testid`. */\nconst CHAT_CONTAINER_TESTID = \"copilot-chat-view\";\n\n/**\n * Returns the chat input element for focus-return after a thread is selected.\n *\n * Best-effort and SCOPED: walks up from the drawer's custom element looking\n * for an ancestor that contains a chat-view container\n * (`data-testid=\"copilot-chat-view\"`), then returns the chat input within\n * that subtree. This avoids focusing the wrong composer on a page hosting\n * more than one chat (multi-chat dashboards), where a document-global lookup\n * would grab whichever input appears first in DOM order rather than the one\n * this drawer drives.\n *\n * Falls back to a document-global lookup when no scoping ancestor is found\n * (e.g. the drawer and chat share no common container, or headless usage).\n */\nfunction findChatInput(origin: Element | null): HTMLElement | null {\n if (typeof document === \"undefined\") return null;\n const container = origin?.closest?.(\n `[data-testid=\"${CHAT_CONTAINER_TESTID}\"]`,\n );\n if (container) {\n const scoped = container.querySelector<HTMLElement>(\n `[data-testid=\"${CHAT_INPUT_TESTID}\"]`,\n );\n if (scoped) return scoped;\n }\n return document.querySelector<HTMLElement>(\n `[data-testid=\"${CHAT_INPUT_TESTID}\"]`,\n );\n}\n\nfunction focusChatInput() {\n findChatInput(elRef.value)?.focus();\n}\n\nfunction onThreadSelected(event: Event) {\n const { threadId } = (event as CustomEvent<ThreadSelectedDetail>).detail;\n if (props.onThreadSelect) props.onThreadSelect(threadId);\n else config.value?.setActiveThreadId?.(threadId, { explicit: true });\n focusChatInput();\n}\nfunction handleNewThread() {\n threadsApi.startNewThread();\n if (props.onNewThread) props.onNewThread();\n else config.value?.startNewThread?.();\n}\nfunction onArchive(event: Event) {\n const { threadId } = (event as CustomEvent<ArchiveDetail>).detail;\n void threadsApi\n .archiveThread(threadId)\n .catch((e) =>\n console.error(\"CopilotThreadsDrawer: archiveThread failed\", e),\n );\n}\nfunction onUnarchive(event: Event) {\n const { threadId } = (event as CustomEvent<UnarchiveDetail>).detail;\n void threadsApi\n .unarchiveThread(threadId)\n .catch((e) =>\n console.error(\"CopilotThreadsDrawer: unarchiveThread failed\", e),\n );\n}\nfunction onDelete(event: Event) {\n const { threadId } = (event as CustomEvent<DeleteDetail>).detail;\n const wasActive = threadId === activeThreadId.value;\n void threadsApi\n .deleteThread(threadId)\n .then(() => {\n if (wasActive) {\n handleNewThread();\n }\n })\n .catch((e) =>\n console.error(\"CopilotThreadsDrawer: deleteThread failed\", e),\n );\n}\nfunction onFilterChange() {\n threadsApi.refetchThreads();\n}\nfunction onCollapseChange(event: Event) {\n const { collapsed } = (event as CustomEvent<CollapseChangeDetail>).detail;\n emit(\"collapse-change\", collapsed);\n}\nfunction onRetry(event: Event) {\n const { scope } = (event as CustomEvent<RetryDetail>).detail;\n if (scope === \"fetch-more\") threadsApi.fetchMoreThreads();\n else threadsApi.refetchThreads();\n}\nfunction onLoadMore() {\n threadsApi.fetchMoreThreads();\n}\nfunction onOpenChange(event: Event) {\n const { open } = (event as CustomEvent<OpenChangeDetail>).detail;\n setDrawerOpen(open);\n}\nfunction handleLicensed() {\n props.onLicensed?.();\n}\n\ndefineSlots<{\n default(): unknown;\n /**\n * Optional per-row content. When provided, this slot is rendered as\n * light-DOM children with `slot=\"row:{id}\"` for EVERY thread in the list,\n * so the element projects it in place of the default row for all rows.\n *\n * Unlike React's `renderRow` (which returns `ReactNode | null` and can\n * fall back to the element's built-in row on a per-thread basis by\n * returning `null`), Vue's scoped slot is all-or-nothing: there is no\n * per-row escape hatch back to the element default once the slot is\n * defined. This is an intentional Vue-idiom divergence, not a bug — if a\n * consumer needs per-row fallback, they should replicate the default row\n * markup themselves inside the slot for the threads they don't want to\n * customize.\n */\n row(props: { thread: Thread }): unknown;\n}>();\n</script>\n\n<template>\n <component\n :is=\"elementTag\"\n v-if=\"mounted\"\n ref=\"elRef\"\n :data-testid=\"dataTestId\"\n :recent-label=\"recentLabel\"\n @thread-selected=\"onThreadSelected\"\n @new-thread=\"handleNewThread\"\n @archive=\"onArchive\"\n @unarchive=\"onUnarchive\"\n @delete=\"onDelete\"\n @filter-change=\"onFilterChange\"\n @collapse-change=\"onCollapseChange\"\n @retry=\"onRetry\"\n @load-more=\"onLoadMore\"\n @open-change=\"onOpenChange\"\n @licensed=\"handleLicensed\"\n >\n <slot />\n <!--\n When the `row` slot is defined, it is projected for EVERY thread (no\n per-row fallback to the element default) — see the JSDoc on the `row`\n slot above for the React `renderRow` comparison.\n -->\n <template v-if=\"$slots.row\">\n <div\n v-for=\"t in threadsApi.threads.value\"\n :key=\"t.id\"\n v-bind=\"{ slot: `row:${t.id}` }\"\n >\n <slot name=\"row\" :thread=\"t\" />\n </div>\n </template>\n </component>\n</template>\n","import { defineComponent, h } from \"vue\";\nimport { IconX } from \"../icons\";\n\nexport default defineComponent({\n name: \"CopilotChatToggleButtonCloseIcon\",\n inheritAttrs: false,\n setup(_, { attrs }) {\n return () => {\n const { class: className, ...rest } = attrs as Record<string, unknown>;\n return h(IconX, {\n ...rest,\n class: [\"cpk-chat-toggle-button-icon\", className],\n strokeWidth: 1.75,\n });\n };\n },\n});\n","import { defineComponent, h } from \"vue\";\nimport { IconMessageCircle } from \"../icons\";\n\nexport default defineComponent({\n name: \"CopilotChatToggleButtonOpenIcon\",\n inheritAttrs: false,\n setup(_, { attrs }) {\n return () => {\n const { class: className, ...rest } = attrs as Record<string, unknown>;\n return h(IconMessageCircle, {\n ...rest,\n class: [\"cpk-chat-toggle-button-icon\", className],\n strokeWidth: 1.75,\n fill: \"currentColor\",\n });\n };\n },\n});\n","<script setup lang=\"ts\">\nimport { computed, ref, useAttrs } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport CopilotChatToggleButtonCloseIcon from \"./CopilotChatToggleButtonCloseIcon\";\nimport CopilotChatToggleButtonOpenIcon from \"./CopilotChatToggleButtonOpenIcon\";\nimport type {\n CopilotChatToggleButtonIconSlotProps,\n CopilotChatToggleButtonProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotChatToggleButtonProps>(), {\n disabled: false,\n type: \"button\",\n});\n\ndefineSlots<{\n \"open-icon\"?: (props: CopilotChatToggleButtonIconSlotProps) => unknown;\n \"close-icon\"?: (props: CopilotChatToggleButtonIconSlotProps) => unknown;\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\nconst fallbackOpen = ref(false);\n\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst isOpen = computed(() => config.value?.isModalOpen ?? fallbackOpen.value);\nconst ariaLabel = computed(() =>\n isOpen.value\n ? labels.value.chatToggleCloseLabel\n : labels.value.chatToggleOpenLabel,\n);\nconst buttonClass = computed(() => [\n \"copilotKitButton cpk-chat-toggle-button\",\n attrs.class,\n]);\nconst buttonAttrs = computed(() => {\n const { class: _className, onClick: _onClick, ...rest } = attrs;\n return rest;\n});\n\nconst iconClass = \"cpk-chat-toggle-button-icon\";\nconst iconTransitionStyle = Object.freeze({\n transition:\n \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\nconst iconWrapperBase = \"cpk-chat-toggle-button-icon-wrapper\";\n\nfunction setModalOpen(open: boolean) {\n if (config.value?.setModalOpen) {\n config.value.setModalOpen(open);\n return;\n }\n fallbackOpen.value = open;\n}\n\nfunction getClickListeners() {\n const listener = attrs.onClick;\n if (Array.isArray(listener)) {\n return listener.filter(\n (item): item is (event: MouseEvent) => void => typeof item === \"function\",\n );\n }\n return typeof listener === \"function\"\n ? [listener as (event: MouseEvent) => void]\n : [];\n}\n\nfunction handleClick(event: MouseEvent) {\n if (props.disabled) {\n return;\n }\n\n for (const listener of getClickListeners()) {\n listener(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n setModalOpen(!isOpen.value);\n}\n</script>\n\n<template>\n <button\n data-copilotkit\n :type=\"type\"\n data-slot=\"chat-toggle-button\"\n :data-state=\"isOpen ? 'open' : 'closed'\"\n :class=\"buttonClass\"\n :aria-label=\"ariaLabel\"\n :aria-pressed=\"isOpen\"\n :disabled=\"disabled\"\n v-bind=\"buttonAttrs\"\n @click=\"handleClick\"\n >\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n :class=\"iconWrapperBase\"\n :style=\"{\n ...iconTransitionStyle,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }\"\n >\n <slot name=\"open-icon\" :icon-class=\"iconClass\" :is-open=\"isOpen\">\n <CopilotChatToggleButtonOpenIcon\n :class=\"iconClass\"\n aria-hidden=\"true\"\n :focusable=\"false\"\n />\n </slot>\n </span>\n\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n :class=\"iconWrapperBase\"\n :style=\"{\n ...iconTransitionStyle,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }\"\n >\n <slot name=\"close-icon\" :icon-class=\"iconClass\" :is-open=\"isOpen\">\n <CopilotChatToggleButtonCloseIcon\n :class=\"iconClass\"\n aria-hidden=\"true\"\n :focusable=\"false\"\n />\n </slot>\n </span>\n </button>\n</template>\n","import { computed, defineComponent, h, useAttrs } from \"vue\";\nimport { IconX } from \"../icons\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\n\n/**\n * Closes the popup or sidebar. Its accessible name is the `aria-label` the\n * parent passes, or `labels.modalHeaderCloseButtonLabel`.\n */\nexport default defineComponent({\n name: \"CopilotModalHeaderCloseButton\",\n inheritAttrs: false,\n setup(_, { slots }) {\n const attrs = useAttrs();\n const config = useCopilotChatConfiguration();\n const ariaLabel = computed(() =>\n typeof attrs[\"aria-label\"] === \"string\"\n ? attrs[\"aria-label\"]\n : (config.value?.labels ?? CopilotChatDefaultLabels)\n .modalHeaderCloseButtonLabel,\n );\n\n return () => {\n const {\n class: className,\n type,\n ...rest\n } = attrs as Record<string, unknown>;\n\n return h(\n \"button\",\n {\n ...rest,\n type: typeof type === \"string\" ? type : \"button\",\n class: [\"cpk-modal-header-close-button\", className],\n \"aria-label\": ariaLabel.value,\n },\n slots.default\n ? slots.default()\n : [\n h(IconX, {\n class: \"cpk-modal-header-close-icon\",\n \"aria-hidden\": true,\n }),\n ],\n );\n };\n },\n});\n","import { defineComponent, h } from \"vue\";\n\nexport default defineComponent({\n name: \"CopilotModalHeaderTitle\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n return () => {\n const { class: className, ...rest } = attrs as Record<string, unknown>;\n return h(\n \"div\",\n {\n ...rest,\n class: [\"cpk-modal-header-title\", className],\n },\n slots.default ? slots.default() : [],\n );\n };\n },\n});\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, useAttrs } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { ɵwatchMobileViewport } from \"@copilotkit/core\";\nimport CopilotModalHeaderCloseButton from \"./CopilotModalHeaderCloseButton\";\nimport CopilotModalHeaderTitle from \"./CopilotModalHeaderTitle\";\nimport { IconPanelLeftOpen } from \"../icons\";\nimport type {\n CopilotModalHeaderCloseButtonSlotProps,\n CopilotModalHeaderLayoutSlotProps,\n CopilotModalHeaderProps,\n CopilotModalHeaderTitleContentSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = defineProps<CopilotModalHeaderProps>();\n\ndefineSlots<{\n \"title-content\"?: (props: CopilotModalHeaderTitleContentSlotProps) => unknown;\n \"close-button\"?: (props: CopilotModalHeaderCloseButtonSlotProps) => unknown;\n layout?: (props: CopilotModalHeaderLayoutSlotProps) => unknown;\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\n\nconst resolvedTitle = computed(\n () =>\n props.title ??\n config.value?.labels.modalHeaderTitle ??\n CopilotChatDefaultLabels.modalHeaderTitle,\n);\nconst headerClass = computed(() => [\n \"copilotKitHeader cpk-modal-header\",\n attrs.class,\n]);\nconst headerAttrs = computed(() => {\n const { class: _className, ...rest } = attrs;\n return rest;\n});\n\nfunction handleClose() {\n config.value?.setModalOpen?.(false);\n}\n\n// Tracks whether the viewport is in the mobile range — the same breakpoint\n// the drawer + chat coordination use. SSR-safe: starts `false` (desktop) so\n// the server render and first client render agree, then syncs on mount and\n// on viewport changes.\nconst isMobile = ref(false);\nlet stopWatchingMobile: (() => void) | undefined;\n\nonMounted(() => {\n stopWatchingMobile = ɵwatchMobileViewport((mobile) => {\n isMobile.value = mobile;\n });\n});\n\nonBeforeUnmount(() => {\n stopWatchingMobile?.();\n stopWatchingMobile = undefined;\n});\n\n// The thread-list launcher renders ONLY when a <CopilotThreadsDrawer> wrapper\n// has registered with the chat configuration AND the viewport is mobile. On\n// desktop the drawer is an in-flow, persistent panel (it ignores `open`), so\n// an \"open the drawer\" launcher there is a dead no-op — it only does\n// anything for the mobile off-canvas drawer. Chats with no drawer get no\n// launcher and no behavior change.\nconst showDrawerLauncher = computed(\n () => (config.value?.drawerRegistered ?? false) && isMobile.value,\n);\n\nfunction toggleDrawer() {\n config.value?.setDrawerOpen?.(!config.value?.drawerOpen);\n}\n</script>\n\n<template>\n <header\n data-copilotkit\n data-slot=\"copilot-modal-header\"\n :class=\"headerClass\"\n v-bind=\"headerAttrs\"\n >\n <slot name=\"layout\" :title=\"resolvedTitle\" :on-close=\"handleClose\">\n <div class=\"cpk-modal-header-content\">\n <div class=\"cpk-modal-header-start\">\n <button\n v-if=\"showDrawerLauncher\"\n type=\"button\"\n data-testid=\"drawer-launcher\"\n class=\"cpk-modal-header-drawer-launcher\"\n :aria-expanded=\"config?.drawerOpen ?? false\"\n :aria-label=\"\n config?.labels.modalHeaderThreadsButtonLabel ??\n CopilotChatDefaultLabels.modalHeaderThreadsButtonLabel\n \"\n @click=\"toggleDrawer\"\n >\n <IconPanelLeftOpen\n class=\"cpk-modal-header-drawer-launcher-icon\"\n aria-hidden=\"true\"\n />\n </button>\n <span v-else aria-hidden=\"true\" />\n </div>\n <div class=\"cpk-modal-header-center\">\n <slot name=\"title-content\" :title=\"resolvedTitle\">\n <CopilotModalHeaderTitle>\n {{ resolvedTitle }}\n </CopilotModalHeaderTitle>\n </slot>\n </div>\n <div class=\"cpk-modal-header-end\">\n <slot name=\"close-button\" :on-close=\"handleClose\">\n <CopilotModalHeaderCloseButton @click=\"handleClose\" />\n </slot>\n </div>\n </div>\n </slot>\n </header>\n</template>\n","import type { Slots } from \"vue\";\n\n/**\n * Returns the names of the slots that a wrapper passes on to the component it\n * wraps: every slot in `slots` except the ones in `ownSlots`, which the\n * wrapper renders itself.\n *\n * CopilotChat passes every slot except `chat-view` to CopilotChatView.\n * CopilotSidebar, CopilotPopup, and their view components use this rule at\n * each layer, so a slot that works on CopilotChat also works on them.\n */\nexport function forwardedSlotNames(\n slots: Slots,\n ownSlots: readonly string[] = [],\n): string[] {\n return Object.keys(slots).filter((name) => !ownSlots.includes(name));\n}\n","<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from \"vue\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport CopilotChatToggleButton from \"./CopilotChatToggleButton.vue\";\nimport CopilotChatView from \"./CopilotChatView.vue\";\nimport CopilotModalHeader from \"./CopilotModalHeader.vue\";\nimport { forwardedSlotNames } from \"./forwarded-slots\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatInterruptSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotPopupViewHeaderSlotProps,\n CopilotPopupViewProps,\n CopilotPopupViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst DEFAULT_POPUP_WIDTH = 420;\nconst DEFAULT_POPUP_HEIGHT = 560;\nconst POPUP_ANIMATION_MS = 200;\n\nconst props = withDefaults(\n defineProps<Omit<CopilotPopupViewProps, \"defaultOpen\">>(),\n {\n messages: () => [],\n autoScroll: true,\n messageFeedback: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n height: undefined,\n clickOutsideToClose: false,\n onFinishTranscribeWithAudio: undefined,\n },\n);\n\ndefineSlots<{\n header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // Any other slot goes to the chat view, as on CopilotChat.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\n// Slots this component renders itself. It passes every other slot to the\n// chat view.\nconst OWN_SLOTS = [\"header\", \"toggle-button\"] as const;\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\n\nconst containerRef = ref<HTMLElement | null>(null);\nconst isRendered = ref(config.value?.isModalOpen ?? false);\nconst isAnimatingOut = ref(false);\nlet animationTimer: ReturnType<typeof setTimeout> | undefined;\nlet focusTimer: ReturnType<typeof setTimeout> | undefined;\n\nconst isPopupOpen = computed(() => config.value?.isModalOpen ?? false);\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst headerTitle = computed(() => labels.value.modalHeaderTitle);\nconst popupAnimationClass = computed(() =>\n isPopupOpen.value && !isAnimatingOut.value\n ? \"cpk-popup-view-window-open\"\n : undefined,\n);\nconst popupStyle = computed(\n () =>\n ({\n \"--copilot-popup-width\": dimensionToCss(props.width, DEFAULT_POPUP_WIDTH),\n \"--copilot-popup-height\": dimensionToCss(\n props.height,\n DEFAULT_POPUP_HEIGHT,\n ),\n \"--copilot-popup-max-width\": \"calc(100vw - 3rem)\",\n \"--copilot-popup-max-height\": \"calc(100dvh - 7.5rem)\",\n paddingTop: \"env(safe-area-inset-top)\",\n paddingBottom: \"env(safe-area-inset-bottom)\",\n paddingLeft: \"env(safe-area-inset-left)\",\n paddingRight: \"env(safe-area-inset-right)\",\n }) as Record<string, string>,\n);\n\nfunction dimensionToCss(\n value: number | string | undefined,\n fallback: number,\n): string {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return `${value}px`;\n }\n if (typeof value === \"string\" && value.trim().length > 0) {\n return value;\n }\n return `${fallback}px`;\n}\n\nfunction closePopup() {\n config.value?.setModalOpen?.(false);\n}\n\nfunction openPopup() {\n config.value?.setModalOpen?.(true);\n}\n\nfunction togglePopup() {\n config.value?.setModalOpen?.(!isPopupOpen.value);\n}\n\nfunction handleSubmitMessage(value: string) {\n emit(\"submit-message\", value);\n}\n\nfunction handleStop() {\n emit(\"stop\");\n}\n\nfunction handleInputChange(value: string) {\n emit(\"input-change\", value);\n}\n\nfunction handleSelectSuggestion(\n suggestion: (typeof props.suggestions)[number],\n index: number,\n) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n}\n\nfunction handleStartTranscribe() {\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n emit(\"finish-transcribe\");\n}\n\nconst chatViewEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: handleSubmitMessage,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n };\n\n if (props.onStop) {\n listeners.onStop = handleStop;\n }\n if (props.onAddFile) {\n listeners.onAddFile = handleAddFile;\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = handleStartTranscribe;\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = handleCancelTranscribe;\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n\n return listeners;\n});\n\nconst chatViewBindings = computed(() => ({\n ...attrs,\n ...chatViewEventProps.value,\n}));\n\nwatch(\n isPopupOpen,\n (open) => {\n if (animationTimer) {\n clearTimeout(animationTimer);\n animationTimer = undefined;\n }\n\n if (open) {\n isRendered.value = true;\n isAnimatingOut.value = false;\n return;\n }\n\n if (!isRendered.value) {\n return;\n }\n\n isAnimatingOut.value = true;\n animationTimer = setTimeout(() => {\n isRendered.value = false;\n isAnimatingOut.value = false;\n animationTimer = undefined;\n }, POPUP_ANIMATION_MS);\n },\n { immediate: true },\n);\n\nwatch(\n isPopupOpen,\n (open, _old, onCleanup) => {\n if (!open || typeof window === \"undefined\") {\n return;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n closePopup();\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n onCleanup(() => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n });\n },\n { immediate: true },\n);\n\nwatch(\n isPopupOpen,\n (open, _old, onCleanup) => {\n if (!open) {\n return;\n }\n\n focusTimer = setTimeout(() => {\n if (typeof document === \"undefined\") {\n return;\n }\n const container = containerRef.value;\n if (container && !container.contains(document.activeElement)) {\n container.focus({ preventScroll: true });\n }\n }, POPUP_ANIMATION_MS);\n\n onCleanup(() => {\n if (focusTimer) {\n clearTimeout(focusTimer);\n focusTimer = undefined;\n }\n });\n },\n { immediate: true },\n);\n\nwatch(\n [isPopupOpen, () => props.clickOutsideToClose],\n ([open, allowClose], _old, onCleanup) => {\n if (!open || !allowClose || typeof document === \"undefined\") {\n return;\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Node | null;\n if (!target) {\n return;\n }\n\n const container = containerRef.value;\n if (container?.contains(target)) {\n return;\n }\n\n const toggleButton = document.querySelector(\n \"[data-slot='chat-toggle-button']\",\n );\n if (toggleButton?.contains(target)) {\n return;\n }\n\n closePopup();\n };\n\n document.addEventListener(\"pointerdown\", handlePointerDown);\n onCleanup(() => {\n document.removeEventListener(\"pointerdown\", handlePointerDown);\n });\n },\n { immediate: true },\n);\n\nonMounted(async () => {\n await nextTick();\n});\n\nonBeforeUnmount(() => {\n if (animationTimer) {\n clearTimeout(animationTimer);\n }\n if (focusTimer) {\n clearTimeout(focusTimer);\n }\n});\n</script>\n\n<template>\n <slot\n name=\"toggle-button\"\n :is-open=\"isPopupOpen\"\n :toggle=\"togglePopup\"\n :open=\"openPopup\"\n :close=\"closePopup\"\n >\n <CopilotChatToggleButton />\n </slot>\n\n <div v-if=\"isRendered\" data-copilotkit class=\"cpk-popup-view\">\n <div\n ref=\"containerRef\"\n tabindex=\"-1\"\n role=\"dialog\"\n :aria-label=\"labels.modalHeaderTitle\"\n data-copilot-popup\n :class=\"[\n 'copilotKitPopup copilotKitWindow cpk-popup-view-window',\n popupAnimationClass,\n ]\"\n :style=\"popupStyle\"\n >\n <slot\n name=\"header\"\n :title=\"headerTitle\"\n :on-close=\"closePopup\"\n :is-open=\"isPopupOpen\"\n >\n <CopilotModalHeader :title=\"headerTitle\" />\n </slot>\n\n <div class=\"cpk-popup-view-chat\" data-popup-chat>\n <CopilotChatView\n class=\"cpk-popup-view-chat-view\"\n :messages=\"messages\"\n :auto-scroll=\"autoScroll\"\n :is-running=\"isRunning\"\n :suggestions=\"suggestions\"\n :suggestion-loading-indexes=\"suggestionLoadingIndexes\"\n :welcome-screen=\"welcomeScreen\"\n :input-value=\"inputValue\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :tool-call-display=\"toolCallDisplay\"\n :message-feedback=\"messageFeedback\"\n :on-finish-transcribe-with-audio=\"onFinishTranscribeWithAudio\"\n v-bind=\"chatViewBindings\"\n >\n <template\n v-for=\"slotName in forwardedSlotNames($slots, OWN_SLOTS)\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatView>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useAttrs } from \"vue\";\nimport CopilotChatConfigurationProvider from \"../../providers/CopilotChatConfigurationProvider.vue\";\nimport { forwardedSlotNames } from \"./forwarded-slots\";\nimport CopilotPopupViewInternal from \"./CopilotPopupViewInternal.vue\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatInterruptSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotPopupViewHeaderSlotProps,\n CopilotPopupViewProps,\n CopilotPopupViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotPopupViewProps>(), {\n messages: () => [],\n autoScroll: true,\n messageFeedback: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n height: undefined,\n clickOutsideToClose: false,\n defaultOpen: true,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // Any other slot goes to the chat view, as on CopilotChat.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\n\nconst internalProps = computed(() => {\n const { defaultOpen: _defaultOpen, ...rest } = props;\n return rest;\n});\n\nconst forwardedEventListeners = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: (value: string) => emit(\"submit-message\", value),\n onInputChange: (value: string) => emit(\"input-change\", value),\n onSelectSuggestion: (\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ) => emit(\"select-suggestion\", suggestion, index),\n };\n\n if (props.onStop) {\n listeners.onStop = () => emit(\"stop\");\n }\n if (props.onAddFile) {\n listeners.onAddFile = () => emit(\"add-file\");\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = () => emit(\"start-transcribe\");\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = () => emit(\"cancel-transcribe\");\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = () => emit(\"finish-transcribe\");\n }\n\n return listeners;\n});\n\nconst internalBindings = computed(() => ({\n ...attrs,\n ...internalProps.value,\n ...forwardedEventListeners.value,\n}));\n</script>\n\n<template>\n <CopilotChatConfigurationProvider :is-modal-default-open=\"defaultOpen\">\n <CopilotPopupViewInternal v-bind=\"internalBindings\">\n <template\n v-for=\"slotName in forwardedSlotNames($slots)\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotPopupViewInternal>\n </CopilotChatConfigurationProvider>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport CopilotChatInput from \"./CopilotChatInput.vue\";\nimport CopilotChatSuggestionView from \"./CopilotChatSuggestionView.vue\";\nimport type {\n CopilotPopupWelcomeScreenInputSlotProps,\n CopilotPopupWelcomeScreenLayoutSlotProps,\n CopilotPopupWelcomeScreenProps,\n CopilotPopupWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<CopilotPopupWelcomeScreenProps>(), {\n suggestions: () => [],\n loadingIndexes: () => [],\n modelValue: \"\",\n isRunning: false,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n canStop: undefined,\n canAddFile: undefined,\n canTranscribe: undefined,\n onAddFile: undefined,\n onStartTranscribe: undefined,\n onCancelTranscribe: undefined,\n onFinishTranscribe: undefined,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"welcome-message\"?: () => unknown;\n input?: (props: CopilotPopupWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotPopupWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n layout?: (props: CopilotPopupWelcomeScreenLayoutSlotProps) => unknown;\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\n\nfunction handleStop() {\n props.onStop?.();\n}\n\nfunction handleAddFile() {\n props.onAddFile?.();\n}\n\nfunction handleStartTranscribe() {\n props.onStartTranscribe?.();\n}\n\nfunction handleCancelTranscribe() {\n props.onCancelTranscribe?.();\n}\n\nfunction handleFinishTranscribe() {\n props.onFinishTranscribe?.();\n}\n\nasync function handleFinishTranscribeWithAudio(audioBlob: Blob) {\n await props.onFinishTranscribeWithAudio?.(audioBlob);\n}\n\nconst inputSlotProps = computed<CopilotPopupWelcomeScreenInputSlotProps>(\n () => ({\n modelValue: props.modelValue,\n isRunning: props.isRunning,\n inputMode: props.inputMode,\n inputToolsMenu: props.inputToolsMenu,\n canStop: props.canStop ?? Boolean(props.onStop),\n canAddFile: props.canAddFile ?? Boolean(props.onAddFile),\n canTranscribe: props.canTranscribe ?? Boolean(props.onStartTranscribe),\n onUpdateModelValue: props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: handleStop,\n onAddFile: handleAddFile,\n onStartTranscribe: handleStartTranscribe,\n onCancelTranscribe: handleCancelTranscribe,\n onFinishTranscribe: handleFinishTranscribe,\n onFinishTranscribeWithAudio: handleFinishTranscribeWithAudio,\n }),\n);\nconst suggestionViewSlotProps =\n computed<CopilotPopupWelcomeScreenSuggestionViewSlotProps>(() => ({\n suggestions: props.suggestions,\n loadingIndexes: props.loadingIndexes,\n onSelectSuggestion: props.onSelectSuggestion,\n }));\nconst layoutSlotProps = computed<CopilotPopupWelcomeScreenLayoutSlotProps>(\n () => ({\n ...inputSlotProps.value,\n ...suggestionViewSlotProps.value,\n }),\n);\n\nconst inputEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n \"onUpdate:modelValue\": props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: props.onStop,\n };\n\n if (props.onAddFile) {\n listeners.onAddFile = props.onAddFile;\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = props.onStartTranscribe;\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = props.onCancelTranscribe;\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = props.onFinishTranscribe;\n }\n if (props.onFinishTranscribeWithAudio) {\n listeners.onFinishTranscribeWithAudio = props.onFinishTranscribeWithAudio;\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <slot name=\"layout\" v-bind=\"layoutSlotProps\">\n <div\n data-copilotkit\n class=\"cpk-popup-view-welcome-screen\"\n data-testid=\"copilot-popup-welcome-screen\"\n >\n <div class=\"cpk-popup-view-welcome-screen-message\">\n <slot name=\"welcome-message\">\n <h1 class=\"cpk-chat-view-welcome-message\">\n {{ labels.welcomeMessageText }}\n </h1>\n </slot>\n </div>\n\n <div>\n <div class=\"cpk-popup-view-welcome-screen-suggestions\">\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewSlotProps\">\n <CopilotChatSuggestionView\n class=\"cpk-chat-view-suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"loadingIndexes\"\n @select-suggestion=\"onSelectSuggestion\"\n />\n </slot>\n </div>\n\n <slot name=\"input\" v-bind=\"inputSlotProps\">\n <CopilotChatInput\n :model-value=\"modelValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n </div>\n </slot>\n</template>\n","<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from \"vue\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport CopilotChatToggleButton from \"./CopilotChatToggleButton.vue\";\nimport CopilotChatView from \"./CopilotChatView.vue\";\nimport CopilotModalHeader from \"./CopilotModalHeader.vue\";\nimport { forwardedSlotNames } from \"./forwarded-slots\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatInterruptSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n CopilotSidebarViewHeaderSlotProps,\n CopilotSidebarViewProps,\n CopilotSidebarViewToggleButtonSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst DEFAULT_SIDEBAR_WIDTH = 480;\nconst SIDEBAR_TRANSITION_MS = 260;\n\nconst props = withDefaults(\n defineProps<Omit<CopilotSidebarViewProps, \"defaultOpen\">>(),\n {\n messages: () => [],\n autoScroll: true,\n messageFeedback: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n position: \"right\",\n onFinishTranscribeWithAudio: undefined,\n },\n);\n\ndefineSlots<{\n header?: (props: CopilotSidebarViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotSidebarViewToggleButtonSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // Any other slot goes to the chat view, as on CopilotChat.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\n// Slots this component renders itself. It passes every other slot to the\n// chat view.\nconst OWN_SLOTS = [\"header\", \"toggle-button\"] as const;\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\n\nconst sidebarRef = ref<HTMLElement | null>(null);\nconst measuredSidebarWidth = ref<number | string>(\n props.width ?? DEFAULT_SIDEBAR_WIDTH,\n);\nlet resizeObserver: ResizeObserver | null = null;\n\nconst isSidebarOpen = computed(() => config.value?.isModalOpen ?? false);\nconst resolvedSidebarWidth = computed(\n () => props.width ?? measuredSidebarWidth.value,\n);\nconst headerTitle = computed(\n () =>\n config.value?.labels.modalHeaderTitle ??\n CopilotChatDefaultLabels.modalHeaderTitle,\n);\nconst asideClass = computed(() => [\n \"copilotKitSidebar copilotKitWindow cpk-sidebar-view\",\n // Slides off its edge when closed.\n !isSidebarOpen.value && \"cpk-sidebar-view-closed\",\n attrs.class,\n]);\nconst asideAttrs = computed(() => {\n const { class: _className, ...rest } = attrs;\n return rest;\n});\nconst asideStyle = computed(\n () =>\n ({\n \"--sidebar-width\": widthToCss(resolvedSidebarWidth.value),\n paddingTop: \"env(safe-area-inset-top)\",\n paddingBottom: \"env(safe-area-inset-bottom)\",\n }) as Record<string, string>,\n);\n// The page makes room on the docked edge (desktop only).\nconst bodyMarginStyle = computed(() => {\n const margin =\n props.position === \"left\" ? \"margin-inline-start\" : \"margin-inline-end\";\n return `\n@media (min-width: 768px) {\n body {\n ${margin}: ${widthToMargin(resolvedSidebarWidth.value)};\n transition: ${margin} ${SIDEBAR_TRANSITION_MS}ms ease;\n }\n}\n`;\n});\n\nfunction widthToCss(width: number | string): string {\n return typeof width === \"number\" ? `${width}px` : width;\n}\n\nfunction widthToMargin(width: number | string): string {\n return typeof width === \"number\" ? `${width}px` : width;\n}\n\nfunction updateMeasuredWidth() {\n if (props.width !== undefined || !sidebarRef.value) {\n return;\n }\n\n const nextWidth = sidebarRef.value.getBoundingClientRect().width;\n if (nextWidth > 0) {\n measuredSidebarWidth.value = nextWidth;\n }\n}\n\nfunction closeSidebar() {\n config.value?.setModalOpen?.(false);\n}\n\nfunction openSidebar() {\n config.value?.setModalOpen?.(true);\n}\n\nfunction toggleSidebar() {\n config.value?.setModalOpen?.(!isSidebarOpen.value);\n}\n\nfunction handleSubmitMessage(value: string) {\n emit(\"submit-message\", value);\n}\n\nfunction handleStop() {\n emit(\"stop\");\n}\n\nfunction handleInputChange(value: string) {\n emit(\"input-change\", value);\n}\n\nfunction handleSelectSuggestion(\n suggestion: (typeof props.suggestions)[number],\n index: number,\n) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n}\n\nfunction handleStartTranscribe() {\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n emit(\"finish-transcribe\");\n}\n\nconst chatViewEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: handleSubmitMessage,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n };\n\n if (props.onStop) {\n listeners.onStop = handleStop;\n }\n if (props.onAddFile) {\n listeners.onAddFile = handleAddFile;\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = handleStartTranscribe;\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = handleCancelTranscribe;\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n\n return listeners;\n});\n\nwatch(\n () => props.width,\n (nextWidth) => {\n if (nextWidth !== undefined) {\n measuredSidebarWidth.value = nextWidth;\n return;\n }\n updateMeasuredWidth();\n },\n);\n\nonMounted(async () => {\n await nextTick();\n updateMeasuredWidth();\n\n if (\n props.width !== undefined ||\n !sidebarRef.value ||\n typeof ResizeObserver === \"undefined\"\n ) {\n return;\n }\n\n resizeObserver = new ResizeObserver(() => {\n updateMeasuredWidth();\n });\n resizeObserver.observe(sidebarRef.value);\n});\n\nonBeforeUnmount(() => {\n resizeObserver?.disconnect();\n resizeObserver = null;\n});\n</script>\n\n<template>\n <component :is=\"'style'\" v-if=\"isSidebarOpen\">\n {{ bodyMarginStyle }}\n </component>\n\n <slot\n name=\"toggle-button\"\n :is-open=\"isSidebarOpen\"\n :toggle=\"toggleSidebar\"\n :open=\"openSidebar\"\n :close=\"closeSidebar\"\n >\n <CopilotChatToggleButton\n :class=\"\n position === 'left' ? 'cpk-sidebar-view-toggle-button-left' : undefined\n \"\n />\n </slot>\n\n <aside\n ref=\"sidebarRef\"\n data-copilotkit\n data-copilot-sidebar\n :data-position=\"position\"\n :class=\"asideClass\"\n :style=\"asideStyle\"\n :aria-label=\"\n config?.labels.sidebarLabel ?? CopilotChatDefaultLabels.sidebarLabel\n \"\n :aria-hidden=\"!isSidebarOpen\"\n role=\"complementary\"\n v-bind=\"asideAttrs\"\n >\n <div class=\"cpk-sidebar-view-panel\">\n <slot\n name=\"header\"\n :title=\"headerTitle\"\n :on-close=\"closeSidebar\"\n :is-open=\"isSidebarOpen\"\n >\n <CopilotModalHeader :title=\"headerTitle\" />\n </slot>\n\n <div class=\"cpk-sidebar-view-chat\" data-sidebar-chat>\n <CopilotChatView\n :messages=\"messages\"\n :auto-scroll=\"autoScroll\"\n :is-running=\"isRunning\"\n :suggestions=\"suggestions\"\n :suggestion-loading-indexes=\"suggestionLoadingIndexes\"\n :welcome-screen=\"welcomeScreen\"\n :input-value=\"inputValue\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :tool-call-display=\"toolCallDisplay\"\n :message-feedback=\"messageFeedback\"\n :on-finish-transcribe-with-audio=\"onFinishTranscribeWithAudio\"\n v-bind=\"chatViewEventProps\"\n >\n <template\n v-for=\"slotName in forwardedSlotNames($slots, OWN_SLOTS)\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatView>\n </div>\n </div>\n </aside>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useAttrs } from \"vue\";\nimport CopilotChatConfigurationProvider from \"../../providers/CopilotChatConfigurationProvider.vue\";\nimport { forwardedSlotNames } from \"./forwarded-slots\";\nimport CopilotSidebarViewInternal from \"./CopilotSidebarViewInternal.vue\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatInterruptSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n CopilotSidebarViewProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotSidebarViewProps>(), {\n messages: () => [],\n autoScroll: true,\n messageFeedback: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n defaultOpen: true,\n position: \"right\",\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: {\n title: string;\n onClose: () => void;\n isOpen: boolean;\n }) => unknown;\n \"toggle-button\"?: (props: {\n isOpen: boolean;\n toggle: () => void;\n open: () => void;\n close: () => void;\n }) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // Any other slot goes to the chat view, as on CopilotChat.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\n\nconst internalProps = computed(() => {\n const { defaultOpen: _defaultOpen, ...rest } = props;\n return rest;\n});\nconst internalBindings = computed(() => ({\n ...attrs,\n ...internalProps.value,\n ...forwardedEventListeners.value,\n}));\n\nconst forwardedEventListeners = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: (value: string) => emit(\"submit-message\", value),\n onInputChange: (value: string) => emit(\"input-change\", value),\n onSelectSuggestion: (\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ) => emit(\"select-suggestion\", suggestion, index),\n };\n\n if (props.onStop) {\n listeners.onStop = () => emit(\"stop\");\n }\n if (props.onAddFile) {\n listeners.onAddFile = () => emit(\"add-file\");\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = () => emit(\"start-transcribe\");\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = () => emit(\"cancel-transcribe\");\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = () => emit(\"finish-transcribe\");\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <CopilotChatConfigurationProvider :is-modal-default-open=\"defaultOpen\">\n <CopilotSidebarViewInternal v-bind=\"internalBindings\">\n <template\n v-for=\"slotName in forwardedSlotNames($slots)\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotSidebarViewInternal>\n </CopilotChatConfigurationProvider>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport CopilotChatInput from \"./CopilotChatInput.vue\";\nimport CopilotChatSuggestionView from \"./CopilotChatSuggestionView.vue\";\nimport type {\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenLayoutSlotProps,\n CopilotSidebarWelcomeScreenProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<CopilotSidebarWelcomeScreenProps>(), {\n suggestions: () => [],\n loadingIndexes: () => [],\n modelValue: \"\",\n isRunning: false,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n canStop: undefined,\n canAddFile: undefined,\n canTranscribe: undefined,\n onAddFile: undefined,\n onStartTranscribe: undefined,\n onCancelTranscribe: undefined,\n onFinishTranscribe: undefined,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"welcome-message\"?: () => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n layout?: (props: CopilotSidebarWelcomeScreenLayoutSlotProps) => unknown;\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\n\nfunction handleStop() {\n props.onStop?.();\n}\n\nfunction handleAddFile() {\n props.onAddFile?.();\n}\n\nfunction handleStartTranscribe() {\n props.onStartTranscribe?.();\n}\n\nfunction handleCancelTranscribe() {\n props.onCancelTranscribe?.();\n}\n\nfunction handleFinishTranscribe() {\n props.onFinishTranscribe?.();\n}\n\nasync function handleFinishTranscribeWithAudio(audioBlob: Blob) {\n await props.onFinishTranscribeWithAudio?.(audioBlob);\n}\n\nconst inputSlotProps = computed<CopilotSidebarWelcomeScreenInputSlotProps>(\n () => ({\n modelValue: props.modelValue,\n isRunning: props.isRunning,\n inputMode: props.inputMode,\n inputToolsMenu: props.inputToolsMenu,\n canStop: props.canStop ?? Boolean(props.onStop),\n canAddFile: props.canAddFile ?? Boolean(props.onAddFile),\n canTranscribe: props.canTranscribe ?? Boolean(props.onStartTranscribe),\n onUpdateModelValue: props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: handleStop,\n onAddFile: handleAddFile,\n onStartTranscribe: handleStartTranscribe,\n onCancelTranscribe: handleCancelTranscribe,\n onFinishTranscribe: handleFinishTranscribe,\n onFinishTranscribeWithAudio: handleFinishTranscribeWithAudio,\n }),\n);\nconst suggestionViewSlotProps =\n computed<CopilotSidebarWelcomeScreenSuggestionViewSlotProps>(() => ({\n suggestions: props.suggestions,\n loadingIndexes: props.loadingIndexes,\n onSelectSuggestion: props.onSelectSuggestion,\n }));\nconst layoutSlotProps = computed<CopilotSidebarWelcomeScreenLayoutSlotProps>(\n () => ({\n ...inputSlotProps.value,\n ...suggestionViewSlotProps.value,\n }),\n);\n\nconst inputEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n \"onUpdate:modelValue\": props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: props.onStop,\n };\n\n if (props.onAddFile) {\n listeners.onAddFile = props.onAddFile;\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = props.onStartTranscribe;\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = props.onCancelTranscribe;\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = props.onFinishTranscribe;\n }\n if (props.onFinishTranscribeWithAudio) {\n listeners.onFinishTranscribeWithAudio = props.onFinishTranscribeWithAudio;\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <slot name=\"layout\" v-bind=\"layoutSlotProps\">\n <div\n data-copilotkit\n class=\"cpk-sidebar-view-welcome-screen\"\n data-testid=\"copilot-sidebar-welcome-screen\"\n >\n <div class=\"cpk-sidebar-view-welcome-screen-message\">\n <slot name=\"welcome-message\">\n <h1 class=\"cpk-chat-view-welcome-message\">\n {{ labels.welcomeMessageText }}\n </h1>\n </slot>\n </div>\n\n <div class=\"cpk-sidebar-view-welcome-screen-footer\">\n <div class=\"cpk-sidebar-view-welcome-screen-content\">\n <div class=\"cpk-sidebar-view-welcome-screen-suggestions\">\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewSlotProps\">\n <CopilotChatSuggestionView\n class=\"cpk-chat-view-suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"loadingIndexes\"\n @select-suggestion=\"onSelectSuggestion\"\n />\n </slot>\n </div>\n\n <slot name=\"input\" v-bind=\"inputSlotProps\">\n <CopilotChatInput\n :model-value=\"modelValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n </div>\n </div>\n </slot>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, watch } from \"vue\";\nimport CopilotChat from \"./CopilotChat.vue\";\nimport CopilotPopupView from \"./CopilotPopupView.vue\";\nimport CopilotPopupWelcomeScreen from \"./CopilotPopupWelcomeScreen.vue\";\nimport InlineFeatureWarning from \"../InlineFeatureWarning.vue\";\nimport { forwardedSlotNames } from \"./forwarded-slots\";\nimport { useLicenseContext } from \"../../providers/useLicenseContext\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatInterruptSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatViewOverrideSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotPopupProps,\n CopilotPopupViewHeaderSlotProps,\n CopilotPopupViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\nimport type { Suggestion } from \"@copilotkit/core\";\n\nfunction popupViewEventBindings(slotProps: CopilotChatViewOverrideSlotProps) {\n return {\n onSubmitMessage: slotProps.onSubmitMessage,\n onInputChange: slotProps.onInputChange,\n onSelectSuggestion: slotProps.onSelectSuggestion,\n ...(slotProps.canStop ? { onStop: slotProps.onStop } : {}),\n ...(slotProps.canAddFile ? { onAddFile: slotProps.onAddFile } : {}),\n ...(slotProps.canTranscribe\n ? {\n onStartTranscribe: slotProps.onStartTranscribe,\n onCancelTranscribe: slotProps.onCancelTranscribe,\n onFinishTranscribe: slotProps.onFinishTranscribe,\n }\n : {}),\n };\n}\n\nconst props = withDefaults(defineProps<CopilotPopupProps>(), {\n autoScroll: true,\n messageFeedback: true,\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n height: undefined,\n clickOutsideToClose: false,\n defaultOpen: true,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;\n \"chat-view\"?: (props: CopilotChatViewOverrideSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // Any other slot goes to the chat view, as on CopilotChat.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\n// Slots this component renders itself and does not pass to the view. It passes\n// every other slot to the view. It also renders `input` and `suggestion-view`\n// in its welcome screen, so those two go to both places.\nconst OWN_SLOTS = [\"chat-view\", \"welcome-screen\", \"welcome-message\"] as const;\n\ndefineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst license = useLicenseContext();\nconst isPopupLicensed = computed(() => license.value.checkFeature(\"popup\"));\n\nwatch(\n isPopupLicensed,\n (licensed) => {\n if (!licensed) {\n console.warn(\n '[CopilotKit] Warning: \"popup\" feature is not licensed. Visit copilotkit.ai/pricing',\n );\n }\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <InlineFeatureWarning v-if=\"!isPopupLicensed\" feature-name=\"Popup\" />\n <CopilotChat\n v-bind=\"props\"\n @submit-message=\"$emit('submit-message', $event)\"\n @stop=\"$emit('stop')\"\n @input-change=\"$emit('input-change', $event)\"\n @select-suggestion=\"\n (suggestion, index) => $emit('select-suggestion', suggestion, index)\n \"\n @add-file=\"$emit('add-file')\"\n @start-transcribe=\"$emit('start-transcribe')\"\n @cancel-transcribe=\"$emit('cancel-transcribe')\"\n @finish-transcribe=\"$emit('finish-transcribe')\"\n >\n <template #chat-view=\"slotProps\">\n <slot v-if=\"$slots['chat-view']\" name=\"chat-view\" v-bind=\"slotProps\" />\n <CopilotPopupView\n v-else\n :messages=\"slotProps.messages\"\n :auto-scroll=\"slotProps.autoScroll\"\n :is-running=\"slotProps.isRunning\"\n :suggestions=\"slotProps.suggestions\"\n :suggestion-loading-indexes=\"slotProps.suggestionLoadingIndexes\"\n :welcome-screen=\"slotProps.welcomeScreen\"\n :input-value=\"slotProps.inputValue\"\n :input-mode=\"slotProps.inputMode\"\n :input-tools-menu=\"slotProps.inputToolsMenu\"\n :width=\"width\"\n :tool-call-display=\"slotProps.toolCallDisplay\"\n :message-feedback=\"slotProps.messageFeedback\"\n :height=\"height\"\n :click-outside-to-close=\"clickOutsideToClose\"\n :default-open=\"defaultOpen\"\n :on-finish-transcribe-with-audio=\"slotProps.onFinishTranscribeWithAudio\"\n v-bind=\"popupViewEventBindings(slotProps)\"\n >\n <template\n v-for=\"slotName in forwardedSlotNames($slots, OWN_SLOTS)\"\n :key=\"slotName\"\n #[slotName]=\"forwardedProps\"\n >\n <slot :name=\"slotName\" v-bind=\"forwardedProps\" />\n </template>\n\n <template #welcome-screen=\"welcomeScreenProps\">\n <slot\n v-if=\"$slots['welcome-screen']\"\n name=\"welcome-screen\"\n v-bind=\"welcomeScreenProps\"\n />\n <CopilotPopupWelcomeScreen v-else v-bind=\"welcomeScreenProps\">\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"suggestionViewProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"inputProps\">\n <slot name=\"input\" v-bind=\"inputProps\" />\n </template>\n </CopilotPopupWelcomeScreen>\n </template>\n </CopilotPopupView>\n </template>\n </CopilotChat>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, watch } from \"vue\";\nimport CopilotChat from \"./CopilotChat.vue\";\nimport CopilotSidebarView from \"./CopilotSidebarView.vue\";\nimport CopilotSidebarWelcomeScreen from \"./CopilotSidebarWelcomeScreen.vue\";\nimport InlineFeatureWarning from \"../InlineFeatureWarning.vue\";\nimport { forwardedSlotNames } from \"./forwarded-slots\";\nimport { useLicenseContext } from \"../../providers/useLicenseContext\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatInterruptSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatViewOverrideSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotSidebarProps,\n CopilotSidebarViewHeaderSlotProps,\n CopilotSidebarViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\nimport type { Suggestion } from \"@copilotkit/core\";\n\nfunction sidebarViewEventBindings(slotProps: CopilotChatViewOverrideSlotProps) {\n return {\n onSubmitMessage: slotProps.onSubmitMessage,\n onInputChange: slotProps.onInputChange,\n onSelectSuggestion: slotProps.onSelectSuggestion,\n ...(slotProps.canStop ? { onStop: slotProps.onStop } : {}),\n ...(slotProps.canAddFile ? { onAddFile: slotProps.onAddFile } : {}),\n ...(slotProps.canTranscribe\n ? {\n onStartTranscribe: slotProps.onStartTranscribe,\n onCancelTranscribe: slotProps.onCancelTranscribe,\n onFinishTranscribe: slotProps.onFinishTranscribe,\n }\n : {}),\n };\n}\n\nconst props = withDefaults(defineProps<CopilotSidebarProps>(), {\n autoScroll: true,\n messageFeedback: true,\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n defaultOpen: true,\n position: \"right\",\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: CopilotSidebarViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotSidebarViewToggleButtonSlotProps) => unknown;\n \"chat-view\"?: (props: CopilotChatViewOverrideSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // Any other slot goes to the chat view, as on CopilotChat.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\n// Slots this component renders itself and does not pass to the view. It passes\n// every other slot to the view. It also renders `input` and `suggestion-view`\n// in its welcome screen, so those two go to both places.\nconst OWN_SLOTS = [\"chat-view\", \"welcome-screen\", \"welcome-message\"] as const;\n\ndefineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst license = useLicenseContext();\nconst isSidebarLicensed = computed(() => license.value.checkFeature(\"sidebar\"));\n\nwatch(\n isSidebarLicensed,\n (licensed) => {\n if (!licensed) {\n console.warn(\n '[CopilotKit] Warning: \"sidebar\" feature is not licensed. Visit copilotkit.ai/pricing',\n );\n }\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <InlineFeatureWarning v-if=\"!isSidebarLicensed\" feature-name=\"Sidebar\" />\n <CopilotChat\n v-bind=\"props\"\n @submit-message=\"$emit('submit-message', $event)\"\n @stop=\"$emit('stop')\"\n @input-change=\"$emit('input-change', $event)\"\n @select-suggestion=\"\n (suggestion, index) => $emit('select-suggestion', suggestion, index)\n \"\n @add-file=\"$emit('add-file')\"\n @start-transcribe=\"$emit('start-transcribe')\"\n @cancel-transcribe=\"$emit('cancel-transcribe')\"\n @finish-transcribe=\"$emit('finish-transcribe')\"\n >\n <template #chat-view=\"slotProps\">\n <slot v-if=\"$slots['chat-view']\" name=\"chat-view\" v-bind=\"slotProps\" />\n <CopilotSidebarView\n v-else\n :messages=\"slotProps.messages\"\n :auto-scroll=\"slotProps.autoScroll\"\n :is-running=\"slotProps.isRunning\"\n :suggestions=\"slotProps.suggestions\"\n :suggestion-loading-indexes=\"slotProps.suggestionLoadingIndexes\"\n :welcome-screen=\"slotProps.welcomeScreen\"\n :input-value=\"slotProps.inputValue\"\n :input-mode=\"slotProps.inputMode\"\n :input-tools-menu=\"slotProps.inputToolsMenu\"\n :width=\"width\"\n :tool-call-display=\"slotProps.toolCallDisplay\"\n :message-feedback=\"slotProps.messageFeedback\"\n :default-open=\"defaultOpen\"\n :position=\"position\"\n :on-finish-transcribe-with-audio=\"slotProps.onFinishTranscribeWithAudio\"\n v-bind=\"sidebarViewEventBindings(slotProps)\"\n >\n <template\n v-for=\"slotName in forwardedSlotNames($slots, OWN_SLOTS)\"\n :key=\"slotName\"\n #[slotName]=\"forwardedProps\"\n >\n <slot :name=\"slotName\" v-bind=\"forwardedProps\" />\n </template>\n\n <template #welcome-screen=\"welcomeScreenProps\">\n <slot\n v-if=\"$slots['welcome-screen']\"\n name=\"welcome-screen\"\n v-bind=\"welcomeScreenProps\"\n />\n <CopilotSidebarWelcomeScreen v-else v-bind=\"welcomeScreenProps\">\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"suggestionViewProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"inputProps\">\n <slot name=\"input\" v-bind=\"inputProps\" />\n </template>\n </CopilotSidebarWelcomeScreen>\n </template>\n </CopilotSidebarView>\n </template>\n </CopilotChat>\n</template>\n","export * from \"./types\";\nexport { default as StreamingMarkdownDefault } from \"./StreamingMarkdownDefault.vue\";\nexport { default as CopilotChatAssistantMessage } from \"./CopilotChatAssistantMessage.vue\";\nexport { default as CopilotChatAudioRecorder } from \"./CopilotChatAudioRecorder.vue\";\nimport _CopilotChat from \"./CopilotChat.vue\";\nimport _CopilotChatView from \"./CopilotChatView.vue\";\nexport { default as CopilotChatInput } from \"./CopilotChatInput.vue\";\nexport { default as CopilotChatAttachmentQueue } from \"./CopilotChatAttachmentQueue.vue\";\nexport { default as CopilotChatAttachmentRenderer } from \"./CopilotChatAttachmentRenderer.vue\";\nexport { default as CopilotChatMessageView } from \"./CopilotChatMessageView.vue\";\nexport { default as CopilotChatReasoningMessage } from \"./CopilotChatReasoningMessage.vue\";\nexport { default as CopilotChatSuggestionPill } from \"./CopilotChatSuggestionPill.vue\";\nexport { default as CopilotChatSuggestionView } from \"./CopilotChatSuggestionView.vue\";\nexport { default as CopilotChatToolCallsView } from \"./CopilotChatToolCallsView.vue\";\nexport { default as CopilotChatToolCallGroup } from \"./CopilotChatToolCallGroup.vue\";\nexport { default as CopilotChatUserMessage } from \"./CopilotChatUserMessage.vue\";\nexport { default as CopilotChatWorkSummary } from \"./CopilotChatWorkSummary.vue\";\nexport { default as CopilotChatView } from \"./CopilotChatView.vue\";\nexport { default as CopilotThreadsDrawer } from \"./CopilotThreadsDrawer.vue\";\nimport _CopilotChatToggleButton from \"./CopilotChatToggleButton.vue\";\nimport CopilotChatToggleButtonCloseIcon from \"./CopilotChatToggleButtonCloseIcon\";\nimport CopilotChatToggleButtonOpenIcon from \"./CopilotChatToggleButtonOpenIcon\";\nimport _CopilotModalHeader from \"./CopilotModalHeader.vue\";\nimport CopilotModalHeaderCloseButton from \"./CopilotModalHeaderCloseButton\";\nimport CopilotModalHeaderTitle from \"./CopilotModalHeaderTitle\";\nimport _CopilotPopupView from \"./CopilotPopupView.vue\";\nimport CopilotPopupWelcomeScreen from \"./CopilotPopupWelcomeScreen.vue\";\nimport _CopilotSidebarView from \"./CopilotSidebarView.vue\";\nimport CopilotSidebarWelcomeScreen from \"./CopilotSidebarWelcomeScreen.vue\";\n\nexport const CopilotChat = Object.assign(_CopilotChat, {\n View: _CopilotChatView,\n});\n\nexport const CopilotChatToggleButton = Object.assign(_CopilotChatToggleButton, {\n OpenIcon: CopilotChatToggleButtonOpenIcon,\n CloseIcon: CopilotChatToggleButtonCloseIcon,\n});\n\nexport { CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonCloseIcon };\n\nexport const CopilotModalHeader = Object.assign(_CopilotModalHeader, {\n Title: CopilotModalHeaderTitle,\n CloseButton: CopilotModalHeaderCloseButton,\n});\n\nexport const CopilotPopupView = Object.assign(_CopilotPopupView, {\n WelcomeScreen: CopilotPopupWelcomeScreen,\n});\n\nexport { default as CopilotPopup } from \"./CopilotPopup.vue\";\nexport { default as CopilotSidebar } from \"./CopilotSidebar.vue\";\n\nexport const CopilotSidebarView = Object.assign(_CopilotSidebarView, {\n WelcomeScreen: CopilotSidebarWelcomeScreen,\n});\n","import { computed, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\n\nexport type JsonSerializable =\n | string\n | number\n | boolean\n | null\n | JsonSerializable[]\n | { [key: string]: JsonSerializable };\n\nexport interface AgentContextInput {\n description: MaybeRefOrGetter<string>;\n value: MaybeRefOrGetter<JsonSerializable>;\n}\n\n/**\n * Registers reactive contextual data that is sent with agent runs.\n *\n * The context entry is added when the composable is active and removed\n * automatically on scope cleanup.\n *\n * @example\n * ```ts\n * useAgentContext({\n * description: \"Current workspace\",\n * value: \"copilotkit-vue\",\n * });\n * ```\n */\nexport function useAgentContext(context: AgentContextInput): void {\n const { copilotkit } = useCopilotKit();\n const resolvedDescription = computed(() => toValue(context.description));\n const resolvedValue = computed(() => toValue(context.value));\n\n const stringValue = computed(() =>\n typeof resolvedValue.value === \"string\"\n ? resolvedValue.value\n : JSON.stringify(resolvedValue.value),\n );\n\n watch(\n [() => copilotkit.value, resolvedDescription, stringValue],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n const id = core.addContext({\n description: resolvedDescription.value,\n value: stringValue.value,\n });\n onCleanup(() => core.removeContext(id));\n },\n { immediate: true },\n );\n}\n","import { watch } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport type { VueFrontendTool } from \"../types\";\nimport type { VueToolCallRenderer } from \"../types\";\n\nconst EMPTY_DEPS: WatchSource<unknown>[] = [];\n\n/**\n * Registers a frontend tool and optional renderer with CopilotKit core.\n *\n * The tool registration is reactive to provided dependencies and is cleaned up\n * automatically when the current scope is disposed.\n *\n * A tool with the same name and `agentId` as a tool that is already\n * registered (for example a provider `frontendTools` entry) takes its place\n * while this scope is active. When the scope is disposed, the earlier tool is\n * active again.\n *\n * @example\n * ```ts\n * useFrontendTool({\n * name: \"sayHello\",\n * parameters: z.object({ name: z.string() }),\n * handler: async ({ name }) => `Hello ${name}`,\n * });\n * ```\n */\nexport function useFrontendTool<T extends Record<string, unknown>>(\n tool: VueFrontendTool<T>,\n deps?: WatchSource<unknown>[],\n) {\n const { copilotkit } = useCopilotKit();\n const extraDeps = deps ?? EMPTY_DEPS;\n\n watch(\n [\n () => tool.name,\n () => tool.available,\n // webmcp is commonly an object literal, so compare it by value to avoid\n // re-registering on identity churn while still reacting to real changes.\n () => JSON.stringify(tool.webmcp ?? null),\n () => extraDeps.length,\n ...extraDeps,\n ],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n const name = tool.name;\n\n // Registrations stack in core: this one shadows an earlier tool with the\n // same name and agentId (a provider tool, or another component's), and\n // unregistering it brings that tool back.\n const unregister = core.addTool(tool);\n\n // The render function is registered even when tool.parameters is\n // undefined — tools like HITL confirm dialogs have no parameters\n // but still need their UI rendered in the chat.\n if (tool.render) {\n core.addHookRenderToolCall({\n name,\n args: tool.parameters,\n agentId: tool.agentId,\n render: tool.render,\n } as VueToolCallRenderer<unknown>);\n }\n\n onCleanup(unregister);\n },\n { immediate: true },\n );\n}\n","import type { StandardSchemaV1, InferSchemaOutput } from \"@copilotkit/shared\";\nimport type { Component } from \"vue\";\nimport { h } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useFrontendTool } from \"./use-frontend-tool\";\n\ntype InferRenderProps<T> = T extends StandardSchemaV1\n ? InferSchemaOutput<T>\n : any;\n\nexport function useComponent<\n TSchema extends StandardSchemaV1 | undefined = undefined,\n>(\n config: {\n name: string;\n description?: string;\n parameters?: TSchema;\n render: Component<NoInfer<InferRenderProps<TSchema>>>;\n agentId?: string;\n },\n deps?: WatchSource<unknown>[],\n): void {\n const prefix = `Use this tool to display the \"${config.name}\" component in the chat. This tool renders a visual UI component for the user.`;\n const fullDescription = config.description\n ? `${prefix}\\n\\n${config.description}`\n : prefix;\n\n useFrontendTool(\n {\n name: config.name,\n description: fullDescription,\n parameters: config.parameters as\n | StandardSchemaV1<any, Record<string, unknown>>\n | undefined,\n render: ({ args }: { args: unknown }) => {\n const RenderComponent = config.render;\n return h(\n RenderComponent as Component,\n args as InferRenderProps<TSchema>,\n );\n },\n agentId: config.agentId,\n },\n deps,\n );\n}\n","import { h, watch } from \"vue\";\nimport type { Component, WatchSource, VNodeChild } from \"vue\";\nimport type { StandardSchemaV1, InferSchemaOutput } from \"@copilotkit/shared\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { defineToolCallRenderer } from \"../types/defineToolCallRenderer\";\nimport type {\n VueToolCallRenderer,\n VueToolCallRendererRenderProps,\n} from \"../types\";\n\nconst EMPTY_DEPS: WatchSource<unknown>[] = [];\n\nexport interface RenderToolInProgressProps<S extends StandardSchemaV1> {\n name: string;\n toolCallId: string;\n parameters: Partial<InferSchemaOutput<S>>;\n status: \"inProgress\";\n result: undefined;\n}\n\nexport interface RenderToolExecutingProps<S extends StandardSchemaV1> {\n name: string;\n toolCallId: string;\n parameters: InferSchemaOutput<S>;\n status: \"executing\";\n result: undefined;\n}\n\nexport interface RenderToolCompleteProps<S extends StandardSchemaV1> {\n name: string;\n toolCallId: string;\n parameters: InferSchemaOutput<S>;\n status: \"complete\";\n result: string;\n}\n\nexport type RenderToolProps<S extends StandardSchemaV1> =\n | RenderToolInProgressProps<S>\n | RenderToolExecutingProps<S>\n | RenderToolCompleteProps<S>;\n\ntype RenderToolConfig<S extends StandardSchemaV1> = {\n name: string;\n parameters?: S;\n render:\n | ((props: RenderToolProps<S>) => VNodeChild)\n | Component<RenderToolProps<S>>;\n agentId?: string;\n group?: boolean;\n};\n\nexport function useRenderTool(\n config: {\n name: \"*\";\n render: ((props: any) => VNodeChild) | Component<any>;\n agentId?: string;\n /** Let the chat group the calls this renderer draws (see `toolCallDisplay`). */\n group?: boolean;\n },\n deps?: WatchSource<unknown>[],\n): void;\n\nexport function useRenderTool<S extends StandardSchemaV1>(\n config: {\n name: string;\n parameters: S;\n render:\n | ((props: RenderToolProps<S>) => VNodeChild)\n | Component<RenderToolProps<S>>;\n agentId?: string;\n /** Let the chat group the calls this renderer draws (see `toolCallDisplay`). */\n group?: boolean;\n },\n deps?: WatchSource<unknown>[],\n): void;\n\nexport function useRenderTool<S extends StandardSchemaV1>(\n config: RenderToolConfig<S>,\n deps?: WatchSource<unknown>[],\n): void {\n const { copilotkit } = useCopilotKit();\n const extraDeps = deps ?? EMPTY_DEPS;\n\n watch(\n [\n () => copilotkit.value,\n () => config.name,\n () => config.agentId,\n () => config.group,\n () => extraDeps.length,\n ...extraDeps,\n ],\n () => {\n const renderTool = (props: RenderToolProps<S>): VNodeChild => {\n if (typeof config.render === \"function\") {\n return (config.render as (props: RenderToolProps<S>) => VNodeChild)(\n props,\n );\n }\n return h(config.render, props);\n };\n\n const renderer =\n config.name === \"*\" && !config.parameters\n ? defineToolCallRenderer({\n name: \"*\",\n render: (props: VueToolCallRendererRenderProps<unknown>) =>\n renderTool({\n ...props,\n parameters: props.args,\n } as RenderToolProps<S>),\n ...(config.agentId ? { agentId: config.agentId } : {}),\n ...(config.group ? { group: true } : {}),\n })\n : defineToolCallRenderer({\n name: config.name,\n args: config.parameters!,\n render: (\n props: VueToolCallRendererRenderProps<InferSchemaOutput<S>>,\n ) =>\n renderTool({\n ...props,\n parameters: props.args,\n } as RenderToolProps<S>),\n ...(config.agentId ? { agentId: config.agentId } : {}),\n ...(config.group ? { group: true } : {}),\n });\n\n copilotkit.value.addHookRenderToolCall(\n renderer as VueToolCallRenderer<unknown>,\n );\n // Intentionally no cleanup removal to preserve renderers for chat history.\n },\n { immediate: true },\n );\n}\n","import { defineComponent, h, inject, ref } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport type { Component, VNodeChild } from \"vue\";\nimport { ToolCallStatus } from \"@copilotkit/core\";\nimport { useRenderTool } from \"./use-render-tool\";\nimport { ToolCallGroupContextKey } from \"../components/chat/tool-call-display-context\";\nimport { ToolCallRow } from \"../components/chat/tool-call-group-parts\";\n\ntype DefaultRenderProps = {\n name: string;\n toolCallId: string;\n parameters: unknown;\n status: \"inProgress\" | \"executing\" | \"complete\";\n result: string | undefined;\n};\n\n/**\n * Module-level dedup set so an unknown status value only emits a console\n * warning the FIRST time we encounter it. Otherwise a stuck/unmapped status\n * would log on every re-render (potentially many per second).\n */\nconst warnedUnknownStatuses = new Set<string>();\n\n/**\n * Map a {@link ToolCallStatus} enum value to the documented string-union\n * status the {@link DefaultRenderProps} contract exposes. Unknown / future\n * enum members log a warning (once per distinct value) and fall back to\n * `\"inProgress\"`.\n */\nfunction mapToolCallStatus(\n status: ToolCallStatus,\n): DefaultRenderProps[\"status\"] {\n switch (status) {\n case ToolCallStatus.Complete:\n return \"complete\";\n case ToolCallStatus.Executing:\n return \"executing\";\n case ToolCallStatus.InProgress:\n return \"inProgress\";\n default: {\n const key = String(status);\n if (!warnedUnknownStatuses.has(key)) {\n warnedUnknownStatuses.add(key);\n console.warn(\n `[CopilotKit] Unknown ToolCallStatus \"${key}\" in default tool-call renderer; falling back to \"inProgress\".`,\n );\n }\n return \"inProgress\";\n }\n }\n}\n\n/**\n * Convert framework-internal raw renderer props (`args`, enum status) to the\n * documented DefaultRenderProps shape. Idempotent on already-documented input\n * — if the caller passes `parameters` and a string-union `status`, those win.\n */\ntype AdaptInput = {\n name?: unknown;\n toolCallId?: unknown;\n args?: unknown;\n parameters?: unknown;\n status?: unknown;\n result?: unknown;\n};\n\nfunction adaptRendererProps(raw: AdaptInput): DefaultRenderProps {\n const parameters = raw.parameters !== undefined ? raw.parameters : raw.args;\n const rawStatus = raw.status;\n const status: DefaultRenderProps[\"status\"] =\n rawStatus === \"inProgress\" ||\n rawStatus === \"executing\" ||\n rawStatus === \"complete\"\n ? rawStatus\n : mapToolCallStatus(rawStatus as ToolCallStatus);\n return {\n name: raw.name as string,\n toolCallId: raw.toolCallId as string,\n parameters,\n status,\n result: raw.result as string | undefined,\n };\n}\n\n/**\n * Guarded JSON.stringify for the expanded `<pre>` blocks. A circular reference\n * would otherwise crash the Vue render.\n */\nfunction safeStringifyForPre(value: unknown): string {\n try {\n return JSON.stringify(value, null, 2);\n } catch (err) {\n console.warn(\n \"[CopilotKit] Failed to JSON.stringify tool-call payload for default renderer; falling back to String():\",\n err,\n );\n try {\n return String(value);\n } catch (innerErr) {\n console.warn(\n \"[CopilotKit] safeStringifyForPre: value could not be stringified:\",\n innerErr,\n );\n return \"[unserializable]\";\n }\n }\n}\n\nconst DefaultToolCallRenderer = defineComponent({\n props: {\n name: {\n type: String,\n required: true,\n },\n toolCallId: {\n type: String,\n required: true,\n },\n parameters: {\n type: null,\n required: false,\n default: undefined,\n },\n status: {\n type: String as () => \"inProgress\" | \"executing\" | \"complete\",\n required: true,\n },\n result: {\n // Typeless on purpose: the renderer body handles both string results\n // and structured (object) results via `safeStringifyForPre`. Declaring\n // `type: String` would trip Vue's dev-mode prop-type warning on every\n // non-string result and make the defensive branch unreachable.\n type: null,\n required: false,\n default: undefined,\n },\n },\n setup(props) {\n const isExpanded = ref(false);\n const groupContext = inject(ToolCallGroupContextKey, null);\n\n return () => {\n const group = groupContext?.value;\n // Inside a group of calls, a row that fits the group instead of a card.\n if (group) {\n return h(ToolCallRow, {\n \"data-testid\": \"copilot-tool-render\",\n \"data-tool-name\": props.name,\n \"data-tool-call-id\": props.toolCallId,\n \"data-status\": props.status,\n \"data-args\": safeStringifyForAttr(props.parameters),\n \"data-result\": safeStringifyForAttr(props.result),\n name: props.name,\n parameters: props.parameters,\n result: props.result,\n status:\n props.status === \"complete\"\n ? group.failedIds.has(props.toolCallId)\n ? \"failed\"\n : \"done\"\n : group.active\n ? \"running\"\n : \"stopped\",\n appearance: group.appearance,\n });\n }\n\n const isActive =\n props.status === \"inProgress\" || props.status === \"executing\";\n const isComplete = props.status === \"complete\";\n const statusLabel = isActive\n ? \"Running\"\n : isComplete\n ? \"Done\"\n : props.status;\n const tone = isActive ? \"running\" : isComplete ? \"done\" : \"other\";\n\n // Markup and classes match React's DefaultToolCallRenderer; styles live\n // in @copilotkit/core (default-tool-call.css).\n return h(\n \"div\",\n {\n \"data-testid\": \"copilot-tool-render\",\n \"data-tool-name\": props.name,\n \"data-tool-call-id\": props.toolCallId,\n \"data-status\": props.status,\n \"data-args\": safeStringifyForAttr(props.parameters),\n \"data-result\": safeStringifyForAttr(props.result),\n class: \"cpk-default-tool-call\",\n },\n [\n h(\"div\", { class: \"cpk-default-tool-call-card\" }, [\n h(\n \"button\",\n {\n type: \"button\",\n \"aria-expanded\": String(isExpanded.value),\n onClick: () => {\n isExpanded.value = !isExpanded.value;\n },\n class: \"cpk-default-tool-call-header\",\n style: { font: \"inherit\" },\n },\n [\n h(\"div\", { class: \"cpk-default-tool-call-title\" }, [\n h(\n \"svg\",\n {\n class: [\n \"cpk-default-tool-call-chevron\",\n isExpanded.value &&\n \"cpk-default-tool-call-chevron-open\",\n ],\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": 2,\n stroke: \"currentColor\",\n },\n [\n h(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M8.25 4.5l7.5 7.5-7.5 7.5\",\n }),\n ],\n ),\n h(\"span\", {\n class: `cpk-default-tool-call-dot cpk-default-tool-call-dot-${tone}`,\n }),\n h(\n \"span\",\n {\n \"data-testid\": \"copilot-tool-render-name\",\n class: \"cpk-default-tool-call-name\",\n },\n props.name,\n ),\n ]),\n h(\n \"span\",\n {\n \"data-testid\": \"copilot-tool-render-status\",\n class: `cpk-default-tool-call-badge cpk-default-tool-call-badge-${tone}`,\n },\n statusLabel,\n ),\n ],\n ),\n isExpanded.value\n ? h(\"div\", { class: \"cpk-default-tool-call-details\" }, [\n h(\"div\", [\n h(\n \"div\",\n { class: \"cpk-default-tool-call-label\" },\n \"Arguments\",\n ),\n h(\n \"pre\",\n { class: \"cpk-default-tool-call-code\" },\n safeStringifyForPre(props.parameters ?? {}),\n ),\n ]),\n props.result !== undefined\n ? h(\"div\", [\n h(\n \"div\",\n { class: \"cpk-default-tool-call-label\" },\n \"Result\",\n ),\n h(\n \"pre\",\n { class: \"cpk-default-tool-call-code\" },\n typeof props.result === \"string\"\n ? props.result\n : safeStringifyForPre(props.result),\n ),\n ])\n : null,\n ])\n : null,\n ]),\n ],\n );\n };\n },\n});\n\nfunction safeStringifyForAttr(value: unknown): string {\n if (value === undefined || value === null) return \"\";\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value);\n } catch (err) {\n console.warn(\n \"[CopilotKit] Failed to JSON.stringify tool-call payload for data-* attribute; falling back to String():\",\n err,\n );\n try {\n return String(value);\n } catch (innerErr) {\n console.warn(\n \"[CopilotKit] safeStringifyForAttr: value could not be stringified:\",\n innerErr,\n );\n return \"\";\n }\n }\n}\n\nexport function useDefaultRenderTool(\n config?: {\n render?:\n | ((props: DefaultRenderProps) => VNodeChild)\n | Component<DefaultRenderProps>;\n /**\n * Let the chat group calls your `render` draws, like it groups the\n * built-in card's (see `toolCallDisplay` on `CopilotChatMessageView`).\n * Off by default for a custom `render`, since it may draw nothing.\n */\n group?: boolean;\n },\n deps?: WatchSource<unknown>[],\n): void {\n const userRender = config?.render;\n\n // When the user supplies a function render, wrap it so they receive the\n // documented {@link DefaultRenderProps} shape regardless of whether the\n // call site passes `args + enum status` (CopilotChatToolCallsView's core\n // path) or `parameters + string status` (an already-adapted call site).\n // Component-typed renders are also wrapped — Vue would bind whatever attrs\n // the call site passes, which means a component-typed render would receive\n // the raw `{ args, status: <enum> }` shape instead of the documented\n // `{ parameters, status: <string-union> }` shape. Wrap so the user\n // component sees `DefaultRenderProps`.\n let registeredRender:\n | ((props: DefaultRenderProps) => VNodeChild)\n | Component<DefaultRenderProps>;\n\n if (typeof userRender === \"function\") {\n const fn = userRender as (props: DefaultRenderProps) => VNodeChild;\n registeredRender = ((rawProps: AdaptInput) => {\n const adapted = adaptRendererProps(rawProps);\n return fn(adapted);\n }) as (props: DefaultRenderProps) => VNodeChild;\n } else if (userRender) {\n const userComponent = userRender;\n registeredRender = ((rawProps: AdaptInput) => {\n const adapted = adaptRendererProps(rawProps);\n return h(userComponent as Component, {\n name: adapted.name,\n toolCallId: adapted.toolCallId,\n parameters: adapted.parameters,\n status: adapted.status,\n result: adapted.result,\n });\n }) as (props: DefaultRenderProps) => VNodeChild;\n } else {\n registeredRender = ((rawProps: AdaptInput) => {\n const adapted = adaptRendererProps(rawProps);\n return h(DefaultToolCallRenderer, {\n name: adapted.name,\n toolCallId: adapted.toolCallId,\n parameters: adapted.parameters,\n status: adapted.status,\n result: adapted.result,\n });\n }) as (props: DefaultRenderProps) => VNodeChild;\n }\n\n useRenderTool(\n {\n name: \"*\",\n render: registeredRender,\n // The built-in card draws a row inside a group; a custom render opts in.\n group: userRender ? config?.group === true : true,\n },\n deps,\n );\n}\n","import { onScopeDispose, ref } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { h } from \"vue\";\nimport { ToolCallStatus } from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useFrontendTool } from \"./use-frontend-tool\";\nimport type {\n VueFrontendTool,\n VueHumanInTheLoop,\n VueToolCallRenderer,\n VueToolCallRendererRenderProps,\n} from \"../types\";\n\n/**\n * Registers a human-in-the-loop frontend tool.\n *\n * The tool pauses execution until `respond` is called from the rendered\n * component during the `executing` phase.\n *\n * @example\n * ```ts\n * useHumanInTheLoop({\n * name: \"approveAction\",\n * parameters: z.object({ reason: z.string() }),\n * render: ApprovalCard,\n * });\n * ```\n */\nexport function useHumanInTheLoop<T extends Record<string, unknown>>(\n tool: VueHumanInTheLoop<T>,\n deps?: WatchSource<unknown>[],\n) {\n const { copilotkit } = useCopilotKit();\n const resolvePromiseRef = ref<((result: unknown) => void) | null>(null);\n const rejectPromiseRef = ref<((error: unknown) => void) | null>(null);\n const cleanupAbortRef = ref<(() => void) | null>(null);\n\n const respond = async (result: unknown) => {\n if (resolvePromiseRef.value) {\n cleanupAbortRef.value?.();\n cleanupAbortRef.value = null;\n resolvePromiseRef.value(result);\n resolvePromiseRef.value = null;\n rejectPromiseRef.value = null;\n }\n };\n\n const handler = async (_args: T, context?: { signal?: AbortSignal }) => {\n const signal = context?.signal;\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(new Error(\"Human-in-the-loop interaction aborted\"));\n return;\n }\n\n resolvePromiseRef.value = resolve;\n rejectPromiseRef.value = reject;\n\n if (signal) {\n const onAbort = () => {\n cleanupAbortRef.value = null;\n resolvePromiseRef.value = null;\n const rejectPending = rejectPromiseRef.value;\n rejectPromiseRef.value = null;\n rejectPending?.(new Error(\"Human-in-the-loop interaction aborted\"));\n };\n\n signal.addEventListener(\"abort\", onAbort, { once: true });\n cleanupAbortRef.value = () => {\n signal.removeEventListener(\"abort\", onAbort);\n };\n }\n });\n };\n\n const RenderComponent: VueToolCallRenderer<T>[\"render\"] = (\n props: VueToolCallRendererRenderProps<T>,\n ) => {\n const ToolComponent = tool.render;\n if (props.status === ToolCallStatus.InProgress) {\n return h(ToolComponent as Parameters<typeof h>[0], {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n agentId: tool.agentId,\n respond: undefined,\n });\n }\n if (props.status === ToolCallStatus.Executing) {\n return h(ToolComponent as Parameters<typeof h>[0], {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n agentId: tool.agentId,\n respond,\n });\n }\n if (props.status === ToolCallStatus.Complete) {\n return h(ToolComponent as Parameters<typeof h>[0], {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n agentId: tool.agentId,\n respond: undefined,\n });\n }\n\n const exhaustiveCheck: never = props;\n return exhaustiveCheck;\n };\n\n const frontendTool: VueFrontendTool<T> = {\n ...tool,\n type: \"human-in-the-loop\",\n handler,\n render: RenderComponent,\n };\n\n useFrontendTool(frontendTool, deps);\n\n onScopeDispose(() => {\n copilotkit.value.removeHookRenderToolCall(tool.name, tool.agentId);\n });\n}\n","import { computed, ref, watch } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport type {\n DynamicSuggestionsConfig,\n Suggestion,\n StaticSuggestionsConfig,\n SuggestionsConfig,\n} from \"@copilotkit/core\";\n\ntype StaticSuggestionInput = Omit<Suggestion, \"isLoading\"> &\n Partial<Pick<Suggestion, \"isLoading\">>;\n\ntype StaticSuggestionsConfigInput = Omit<\n StaticSuggestionsConfig,\n \"suggestions\"\n> & {\n suggestions: StaticSuggestionInput[];\n};\n\ntype SuggestionsConfigInput =\n | DynamicSuggestionsConfig\n | StaticSuggestionsConfigInput;\n\nfunction isDynamicConfig(\n config: SuggestionsConfigInput,\n): config is DynamicSuggestionsConfig {\n return \"instructions\" in config;\n}\n\nfunction normalizeStaticSuggestions(\n suggestions: StaticSuggestionInput[],\n): Suggestion[] {\n return suggestions.map((s) => ({\n ...s,\n isLoading: s.isLoading ?? false,\n }));\n}\n\n/**\n * Registers a suggestions configuration (dynamic or static) for the current\n * chat context.\n *\n * Configuration is kept in sync reactively and removed on scope cleanup.\n *\n * @example\n * ```ts\n * useConfigureSuggestions({\n * instructions: \"Suggest concise next steps for the user\",\n * available: \"always\",\n * });\n * ```\n */\nexport function useConfigureSuggestions(\n config: SuggestionsConfigInput | null | undefined,\n deps?: WatchSource<unknown>[],\n): void {\n const { copilotkit } = useCopilotKit();\n const chatConfig = useCopilotChatConfiguration();\n const extraDeps = deps ?? [];\n\n const resolvedConsumerAgentId = computed(\n () => chatConfig.value?.agentId ?? DEFAULT_AGENT_ID,\n );\n const rawConsumerAgentId = computed(() =>\n config ? (config as SuggestionsConfigInput).consumerAgentId : undefined,\n );\n\n const normalizedConfig = computed<SuggestionsConfig | null>(() => {\n if (\n !config ||\n (config as { available?: string }).available === \"disabled\"\n ) {\n return null;\n }\n if (isDynamicConfig(config)) {\n return { ...config };\n }\n const normalizedSuggestions = normalizeStaticSuggestions(\n config.suggestions,\n );\n return { ...config, suggestions: normalizedSuggestions };\n });\n const serializedConfig = computed(() =>\n normalizedConfig.value ? JSON.stringify(normalizedConfig.value) : null,\n );\n\n const targetAgentId = computed(() => {\n if (!normalizedConfig.value) return resolvedConsumerAgentId.value;\n const consumer = (\n normalizedConfig.value as\n | StaticSuggestionsConfig\n | DynamicSuggestionsConfig\n ).consumerAgentId;\n if (!consumer || consumer === \"*\") return resolvedConsumerAgentId.value;\n return consumer;\n });\n\n const isGlobalConfig = computed(\n () =>\n rawConsumerAgentId.value === undefined ||\n rawConsumerAgentId.value === \"*\",\n );\n const pendingGlobalReload = ref(false);\n const pendingReloadTimer = ref<ReturnType<typeof setTimeout> | null>(null);\n const previousSerializedConfig = ref<string | null>(null);\n\n const flushPendingGlobalReload = () => {\n if (!pendingGlobalReload.value || !isGlobalConfig.value) {\n return;\n }\n const hasRunning = Object.values(copilotkit.value.agents ?? {}).some(\n (entry) => !!entry.agentId && entry.isRunning,\n );\n if (hasRunning) {\n pendingReloadTimer.value = setTimeout(() => {\n pendingReloadTimer.value = null;\n flushPendingGlobalReload();\n }, 0);\n return;\n }\n\n pendingGlobalReload.value = false;\n requestReload();\n };\n\n const requestReload = () => {\n if (!normalizedConfig.value) {\n return;\n }\n\n if (isGlobalConfig.value) {\n let skippedBecauseRunning = false;\n const agents = Object.values(copilotkit.value.agents ?? {});\n for (const entry of agents) {\n const aid = entry.agentId;\n if (!aid) {\n continue;\n }\n if (!entry.isRunning) {\n copilotkit.value.reloadSuggestions(aid);\n } else {\n skippedBecauseRunning = true;\n }\n }\n pendingGlobalReload.value = skippedBecauseRunning;\n if (skippedBecauseRunning && pendingReloadTimer.value === null) {\n pendingReloadTimer.value = setTimeout(() => {\n pendingReloadTimer.value = null;\n flushPendingGlobalReload();\n }, 0);\n }\n return;\n }\n\n if (targetAgentId.value) {\n copilotkit.value.reloadSuggestions(targetAgentId.value);\n }\n };\n\n watch(\n [() => copilotkit.value, serializedConfig],\n ([_core, serialized], _old, onCleanup) => {\n if (!serialized || !normalizedConfig.value) {\n return;\n }\n\n const core = copilotkit.value;\n const cfg = normalizedConfig.value;\n const id = core.addSuggestionsConfig(cfg);\n requestReload();\n\n onCleanup(() => core.removeSuggestionsConfig(id));\n },\n { immediate: true },\n );\n\n watch(\n [normalizedConfig, serializedConfig],\n ([cfg, serialized]) => {\n if (!cfg) {\n previousSerializedConfig.value = null;\n return;\n }\n\n if (serialized && previousSerializedConfig.value === serialized) {\n return;\n }\n\n if (serialized) {\n previousSerializedConfig.value = serialized;\n }\n\n requestReload();\n },\n { immediate: false },\n );\n\n watch(\n [normalizedConfig, () => extraDeps.length, ...extraDeps],\n ([cfg]) => {\n if (!cfg || extraDeps.length === 0) {\n return;\n }\n requestReload();\n },\n { immediate: true },\n );\n\n watch(\n [() => copilotkit.value, pendingGlobalReload],\n (_vals, _old, onCleanup) => {\n onCleanup(() => {\n if (pendingReloadTimer.value !== null) {\n clearTimeout(pendingReloadTimer.value);\n pendingReloadTimer.value = null;\n }\n });\n },\n { immediate: true },\n );\n\n watch(\n [() => copilotkit.value, isGlobalConfig],\n ([core, global], _old, onCleanup) => {\n if (!global) {\n return;\n }\n\n const agentSubscriptions = Object.values(core.agents ?? {})\n .filter((agent): agent is NonNullable<typeof agent> => !!agent)\n .map((agent) =>\n agent.subscribe({\n onRunStartedEvent: flushPendingGlobalReload,\n onRunFinishedEvent: flushPendingGlobalReload,\n onRunFinalized: flushPendingGlobalReload,\n onRunFailed: flushPendingGlobalReload,\n onRunErrorEvent: flushPendingGlobalReload,\n }),\n );\n\n onCleanup(() => {\n for (const sub of agentSubscriptions) {\n sub.unsubscribe();\n }\n });\n },\n { immediate: true },\n );\n}\n","import { computed, onScopeDispose, shallowRef, watch } from \"vue\";\nimport type { ComputedRef, Ref } from \"vue\";\nimport { buildResumeArray, isInterruptExpired } from \"@ag-ui/client\";\nimport type { Interrupt, RunAgentResult } from \"@ag-ui/client\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useAgent } from \"./use-agent\";\nimport type {\n InterruptEvent,\n InterruptHandlerProps,\n InterruptRenderProps,\n InterruptResolveFn,\n InterruptCancelFn,\n} from \"../types/interrupt\";\n\nexport type {\n InterruptEvent,\n InterruptHandlerProps,\n InterruptRenderProps,\n Interrupt,\n};\n\nconst INTERRUPT_EVENT_NAME = \"on_interrupt\";\n\n/** Internal accumulator response shape consumed by buildResumeArray. */\ntype ResumeResponse =\n | { status: \"resolved\"; payload?: unknown }\n | { status: \"cancelled\" };\n\n/**\n * Normalized pending interrupt. `legacy` carries the custom-event payload;\n * `standard` carries the AG-UI `outcome:\"interrupt\"` interrupts array.\n */\ntype PendingInterrupt =\n | { kind: \"legacy\"; event: InterruptEvent }\n | { kind: \"standard\"; interrupts: Interrupt[] };\n\ntype InterruptHandlerFn<TValue, TResult> = (\n props: InterruptHandlerProps<TValue>,\n) => TResult | PromiseLike<TResult>;\n\ntype InterruptResultFromHandler<THandler> = THandler extends (\n ...args: never[]\n) => infer TResult\n ? TResult extends PromiseLike<infer TResolved>\n ? TResolved | null\n : TResult | null\n : null;\n\ntype InterruptResult<TValue, TResult> = InterruptResultFromHandler<\n InterruptHandlerFn<TValue, TResult>\n>;\n\nexport interface UseInterruptConfig<TValue = unknown, TResult = never> {\n handler?: InterruptHandlerFn<TValue, TResult>;\n enabled?: (event: InterruptEvent<TValue>) => boolean;\n agentId?: string;\n renderInChat?: boolean;\n}\n\nexport interface UseInterruptResult<TValue = unknown, TResult = never> {\n interrupt: Ref<InterruptEvent<TValue> | null>;\n result: Ref<InterruptResult<TValue, TResult>>;\n hasInterrupt: ComputedRef<boolean>;\n /** Resolve the pending interrupt. Standard: records resolved response and submits when all addressed. Legacy: resumes via forwardedProps.command. */\n resolve: InterruptResolveFn;\n /** Alias of resolve for back-compat. */\n resolveInterrupt: InterruptResolveFn;\n /** Cancel the pending interrupt. Standard: records cancelled response and submits when all addressed. */\n cancel: InterruptCancelFn;\n /** Alias of cancel for back-compat. */\n cancelInterrupt: InterruptCancelFn;\n slotProps: ComputedRef<InterruptRenderProps<\n TValue,\n InterruptResult<TValue, TResult>\n > | null>;\n}\n\nexport function isPromiseLike<TValue>(\n value: TValue | PromiseLike<TValue>,\n): value is PromiseLike<TValue> {\n return (\n (typeof value === \"object\" || typeof value === \"function\") &&\n value !== null &&\n typeof Reflect.get(value, \"then\") === \"function\"\n );\n}\n\nfunction normalizeAsyncResult<TValue>(\n value: PromiseLike<TValue>,\n): Promise<TValue> {\n if (value instanceof Promise) {\n return value;\n }\n\n return new Promise<TValue>((resolve, reject) => {\n try {\n value.then(resolve, reject);\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/** Derive the legacy-compatible `event` for any pending interrupt. */\nfunction toLegacyEvent(pending: PendingInterrupt): InterruptEvent {\n if (pending.kind === \"legacy\") return pending.event;\n return { name: INTERRUPT_EVENT_NAME, value: pending.interrupts[0] };\n}\n\n/**\n * Vue composable for handling agent interrupts with optional filtering,\n * preprocessing, and resume behavior.\n *\n * Supports both the AG-UI standard interrupt flow (`RUN_FINISHED` with\n * `outcome:\"interrupt\"`) and the legacy custom-event flow (`on_interrupt`).\n * For standard interrupts, `slotProps` receives `interrupt` (the primary one)\n * and `interrupts` (the full open set); call `resolve(payload)` to resume or\n * `cancel()` to cancel. Resuming addresses the targeted interrupt and, once\n * every open interrupt is addressed, submits a single spec `resume` array via\n * `copilotkit.runAgent`.\n *\n * @example\n * ```ts\n * const { interrupt, hasInterrupt, resolve, cancel } = useInterrupt({\n * handler: ({ event }) => ({ label: String(event.value) }),\n * });\n * ```\n */\nexport function useInterrupt<TValue = unknown, TResult = never>(\n config: UseInterruptConfig<TValue, TResult> = {},\n): UseInterruptResult<TValue, TResult> {\n const { copilotkit } = useCopilotKit();\n const { agent } = useAgent({ agentId: config.agentId });\n const pending = shallowRef<PendingInterrupt | null>(null);\n const result = shallowRef<InterruptResult<TValue, TResult>>(null);\n\n // Accumulated per-interrupt responses for the current standard interrupt set.\n const responses: Record<string, ResumeResponse> = {};\n\n watch(\n agent,\n (resolvedAgent, _previousAgent, onCleanup) => {\n if (!resolvedAgent) {\n pending.value = null;\n result.value = null;\n return;\n }\n\n let localLegacy: InterruptEvent<TValue> | null = null;\n let localStandard: Interrupt[] | null = null;\n\n const subscription = resolvedAgent.subscribe({\n onCustomEvent: ({ event }) => {\n if (event.name === INTERRUPT_EVENT_NAME) {\n localLegacy = {\n name: event.name,\n value: event.value as TValue,\n };\n }\n },\n onRunFinishedEvent: (params) => {\n if (params.outcome === \"interrupt\") {\n localStandard = params.interrupts;\n }\n },\n onRunStartedEvent: () => {\n localLegacy = null;\n localStandard = null;\n // Reset accumulated responses for the new run.\n for (const k of Object.keys(responses)) {\n delete responses[k];\n }\n pending.value = null;\n },\n onRunFinalized: () => {\n // Standard wins if both somehow appear for one run.\n if (localStandard && localStandard.length > 0) {\n pending.value = { kind: \"standard\", interrupts: localStandard };\n } else if (localLegacy) {\n pending.value = { kind: \"legacy\", event: localLegacy };\n }\n localLegacy = null;\n localStandard = null;\n },\n onRunFailed: () => {\n localLegacy = null;\n localStandard = null;\n for (const k of Object.keys(responses)) {\n delete responses[k];\n }\n pending.value = null;\n },\n });\n\n onCleanup(() => subscription.unsubscribe());\n },\n { immediate: true },\n );\n\n /** Submit the accumulated standard responses once all open interrupts are addressed. */\n const submitStandardIfComplete = async (\n interrupts: Interrupt[],\n ): Promise<RunAgentResult | void> => {\n const allAddressed = interrupts.every((i) => responses[i.id]);\n if (!allAddressed) return;\n\n const expired = interrupts.find((i) => isInterruptExpired(i));\n if (expired) {\n console.error(\n `[CopilotKit] useInterrupt: interrupt ${expired.id} expired at ${expired.expiresAt}; not resuming.`,\n );\n for (const k of Object.keys(responses)) {\n delete responses[k];\n }\n pending.value = null;\n return;\n }\n\n const resume = buildResumeArray(interrupts, responses);\n for (const k of Object.keys(responses)) {\n delete responses[k];\n }\n const resolvedAgent = agent.value;\n if (!resolvedAgent) return;\n try {\n return await copilotkit.value.runAgent({ agent: resolvedAgent, resume });\n } catch (err) {\n console.error(\n \"[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing\",\n err,\n );\n pending.value = null;\n throw err;\n }\n };\n\n const resolve: InterruptResolveFn = async (payload?, interruptId?) => {\n const current = pending.value;\n if (!current) return;\n\n const resolvedAgent = agent.value;\n if (!resolvedAgent) return;\n\n if (current.kind === \"legacy\") {\n const interruptEventValue = current.event.value;\n try {\n return await copilotkit.value.runAgent({\n agent: resolvedAgent,\n forwardedProps: {\n command: {\n resume: payload,\n interruptEvent: interruptEventValue,\n },\n },\n });\n } catch (err) {\n console.error(\n \"[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing\",\n err,\n );\n pending.value = null;\n throw err;\n }\n }\n\n if (current.interrupts.length > 1 && interruptId === undefined) {\n console.warn(\n `[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`,\n );\n }\n const id = interruptId ?? current.interrupts[0]?.id;\n if (!id) return;\n responses[id] = { status: \"resolved\", payload };\n return submitStandardIfComplete(current.interrupts);\n };\n\n const cancel: InterruptCancelFn = async (interruptId?) => {\n const current = pending.value;\n if (!current) return;\n\n if (current.kind === \"legacy\") {\n // Legacy interrupts have no cancel semantics; dismiss without resuming.\n console.warn(\n \"[CopilotKit] useInterrupt: cancel() is not supported for legacy on_interrupt interrupts; dismissing.\",\n );\n pending.value = null;\n return;\n }\n\n if (current.interrupts.length > 1 && interruptId === undefined) {\n console.warn(\n `[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`,\n );\n }\n const id = interruptId ?? current.interrupts[0]?.id;\n if (!id) return;\n responses[id] = { status: \"cancelled\" };\n return submitStandardIfComplete(current.interrupts);\n };\n\n // Keep resolveInterrupt and cancelInterrupt as aliases for back-compat.\n const resolveInterrupt: InterruptResolveFn = resolve;\n const cancelInterrupt: InterruptCancelFn = cancel;\n\n watch(\n pending,\n (currentPending, _previous, onCleanup) => {\n if (!currentPending) {\n result.value = null;\n return;\n }\n const legacyEvent = toLegacyEvent(\n currentPending,\n ) as InterruptEvent<TValue>;\n if (config.enabled && !config.enabled(legacyEvent)) {\n result.value = null;\n return;\n }\n const handler = config.handler;\n if (!handler) {\n result.value = null;\n return;\n }\n\n let cancelled = false;\n const maybePromise = handler({\n event: legacyEvent,\n interrupt:\n currentPending.kind === \"standard\"\n ? (currentPending.interrupts[0] ?? null)\n : null,\n interrupts:\n currentPending.kind === \"standard\" ? currentPending.interrupts : [],\n resolve,\n cancel,\n });\n\n if (isPromiseLike(maybePromise)) {\n normalizeAsyncResult(maybePromise)\n .then((resolved) => {\n if (!cancelled) {\n result.value = resolved;\n }\n })\n .catch((err) => {\n if (!cancelled) {\n console.error(\"[CopilotKit] useInterrupt handler failed:\", err);\n result.value = null;\n }\n });\n } else {\n result.value = maybePromise;\n }\n\n onCleanup(() => {\n cancelled = true;\n });\n },\n { immediate: true },\n );\n\n // Compute the legacy-compat \"interrupt\" ref for existing consumers (InterruptEvent shape).\n const interrupt = computed<InterruptEvent<TValue> | null>(() => {\n if (!pending.value) return null;\n return toLegacyEvent(pending.value) as InterruptEvent<TValue>;\n });\n\n const slotProps = computed<InterruptRenderProps<\n TValue,\n InterruptResult<TValue, TResult>\n > | null>(() => {\n const currentPending = pending.value;\n if (!currentPending) return null;\n const legacyEvent = toLegacyEvent(currentPending) as InterruptEvent<TValue>;\n if (config.enabled && !config.enabled(legacyEvent)) return null;\n\n return {\n event: legacyEvent,\n interrupt:\n currentPending.kind === \"standard\"\n ? (currentPending.interrupts[0] ?? null)\n : null,\n interrupts:\n currentPending.kind === \"standard\" ? currentPending.interrupts : [],\n result: result.value,\n resolve,\n cancel,\n };\n });\n\n watch(\n [() => copilotkit.value, slotProps, () => config.renderInChat !== false],\n ([core, nextSlotProps, shouldRenderInChat], _previous, onCleanup) => {\n if (!shouldRenderInChat) {\n return;\n }\n\n core.setInterruptState(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nextSlotProps as InterruptRenderProps<any, any> | null,\n );\n const publishedState = nextSlotProps;\n\n onCleanup(() => {\n if (core.interruptState === publishedState) {\n core.setInterruptState(null);\n }\n });\n },\n { immediate: true },\n );\n\n onScopeDispose(() => {\n const core = copilotkit.value;\n if (\n config.renderInChat !== false &&\n core.interruptState === slotProps.value\n ) {\n core.setInterruptState(null);\n }\n });\n\n return {\n interrupt: interrupt as unknown as Ref<InterruptEvent<TValue> | null>,\n result: result as Ref<InterruptResult<TValue, TResult>>,\n hasInterrupt: computed(() => slotProps.value !== null),\n resolve,\n resolveInterrupt,\n cancel,\n cancelInterrupt,\n slotProps: slotProps as ComputedRef<InterruptRenderProps<\n TValue,\n InterruptResult<TValue, TResult>\n > | null>,\n };\n}\n","import type { AgentCapabilities } from \"@ag-ui/core\";\nimport { computed } from \"vue\";\nimport type { ComputedRef } from \"vue\";\nimport { useAgent } from \"./use-agent\";\n\n/**\n * Returns the capabilities declared by the given agent (or the default agent).\n *\n * Capabilities are populated from the runtime `/info` response at connection\n * time. The composable reads them synchronously from the agent instance — there\n * is no separate loading state, but the value will be `undefined` until the\n * runtime handshake completes.\n *\n * @param agentId - Optional agent ID. If omitted, uses the default agent.\n * @returns A computed ref containing the agent's capabilities, or `undefined`\n * if the agent doesn't declare capabilities.\n */\nexport function useCapabilities(\n agentId?: string,\n): ComputedRef<AgentCapabilities | undefined> {\n const { agent } = useAgent({ agentId });\n\n return computed(() => {\n const a = agent.value;\n if (a && \"capabilities\" in a) {\n return (a as { capabilities?: AgentCapabilities }).capabilities;\n }\n return undefined;\n });\n}\n","import type { Message } from \"@ag-ui/core\";\nimport { ɵresolveCustomMessageRenderers } from \"@copilotkit/core\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport type {\n VueCustomMessageRendererPosition,\n VueCustomMessageRendererProps,\n} from \"../types\";\n\ninterface UseRenderCustomMessagesParams {\n message: Message;\n position: VueCustomMessageRendererPosition;\n}\n\n/**\n * Returns a function that resolves the appropriate custom message renderer for\n * a given message and position.\n *\n * Matches the React `useRenderCustomMessages` API: filters registered\n * renderers by the current agent, preferring agent-scoped renderers over\n * global ones, and computes the full renderer props (runId, indices, state\n * snapshot).\n *\n * The returned function yields `null` if no chat configuration is available\n * (i.e. when called outside a `CopilotChat` component tree) or if no\n * matching renderer is found.\n */\nexport function useRenderCustomMessages() {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n\n return function renderCustomMessage(params: UseRenderCustomMessagesParams) {\n const configValue = config.value;\n if (!configValue) return null;\n\n const agentId = configValue.agentId || DEFAULT_AGENT_ID;\n const { threadId } = configValue;\n const core = copilotkit.value;\n\n const customMessageRenderers = ɵresolveCustomMessageRenderers(\n core.renderCustomMessages,\n agentId,\n );\n\n if (!customMessageRenderers.length) {\n return null;\n }\n\n const { message, position } = params;\n const resolvedRunId =\n core.getRunIdForMessage(agentId, threadId, message.id) ??\n core.getRunIdsForThread(agentId, threadId).slice(-1)[0];\n const runId = resolvedRunId ?? `missing-run-id:${message.id}`;\n const agent = core.getAgent(agentId);\n if (!agent) {\n return null;\n }\n\n const messagesIdsInRun = resolvedRunId\n ? agent.messages\n .filter(\n (msg) =>\n core.getRunIdForMessage(agentId, threadId, msg.id) ===\n resolvedRunId,\n )\n .map((msg) => msg.id)\n : [message.id];\n\n const rawMessageIndex = agent.messages.findIndex(\n (msg) => msg.id === message.id,\n );\n if (rawMessageIndex < 0) {\n console.warn(\n `[CopilotKit] useRenderCustomMessages: message \"${message.id}\" ` +\n `not found in agent \"${agentId}\" messages`,\n );\n }\n const messageIndex = Math.max(0, rawMessageIndex);\n const messageIndexInRun = resolvedRunId\n ? Math.max(messagesIdsInRun.indexOf(message.id), 0)\n : 0;\n const numberOfMessagesInRun = resolvedRunId ? messagesIdsInRun.length : 1;\n const stateSnapshot = resolvedRunId\n ? core.getStateByRun(agentId, threadId, resolvedRunId)\n : undefined;\n\n const props: VueCustomMessageRendererProps = {\n message,\n position,\n runId,\n messageIndex,\n messageIndexInRun,\n numberOfMessagesInRun,\n agentId,\n stateSnapshot,\n };\n\n // Agent-scoped renderers come first. Use the first one that has a\n // render function.\n const selected = customMessageRenderers.find(\n (candidate) => candidate.render,\n );\n if (!selected) return null;\n\n return { renderer: selected.render, props };\n };\n}\n","import { computed } from \"vue\";\nimport type { Component } from \"vue\";\nimport type { ActivityMessage } from \"@ag-ui/core\";\nimport { ɵresolveActivityRenderer } from \"@copilotkit/core\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport type { VueActivityMessageRendererProps } from \"../types\";\n\n/**\n * Returns helpers for rendering activity messages.\n *\n * Matches the React `useRenderActivityMessage` API: `findRenderer` locates a\n * registered renderer by activity type (preferring agent-scoped over global,\n * with `\"*\"` as a wildcard fallback), and `renderActivityMessage` resolves the\n * renderer and validates the content with the renderer's `content` schema\n * (any Standard Schema, such as zod).\n */\nexport function useRenderActivityMessage() {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const agentId = computed(() => config.value?.agentId ?? DEFAULT_AGENT_ID);\n\n function findRenderer(activityType: string) {\n const renderers = copilotkit.value.renderActivityMessages;\n const matches = renderers.filter(\n (renderer) => renderer.activityType === activityType,\n );\n\n return (\n matches.find((candidate) => candidate.agentId === agentId.value) ??\n matches.find((candidate) => candidate.agentId === undefined) ??\n renderers.find((candidate) => candidate.activityType === \"*\") ??\n null\n );\n }\n\n function renderActivityMessage(message: ActivityMessage) {\n const match = ɵresolveActivityRenderer(\n copilotkit.value.renderActivityMessages,\n {\n activityType: message.activityType,\n agentId: agentId.value,\n content: message.content,\n },\n );\n\n if (!match) {\n if (findRenderer(message.activityType)) {\n console.warn(\n `Failed to validate content for activity message ` +\n `'${message.activityType}'.`,\n );\n }\n return null;\n }\n\n return {\n renderer: match.renderer.render as Component<\n VueActivityMessageRendererProps<unknown>\n >,\n props: {\n activityType: message.activityType,\n content: match.content,\n message,\n agent: copilotkit.value.getAgent(agentId.value),\n },\n };\n }\n\n return { renderActivityMessage, findRenderer };\n}\n"],"names":["EventType","getEnumValues","entries","numericValues","v","k","_","joinValues","array","separator","val","stringifyPrimitive","jsonStringifyReplacer","value","Cached","getter","cached","nullish","input","cleanRegex","source","start","end","floatSafeRemainder","step","ratio","roundedRatio","tolerance","assignProp","target","prop","rawShape","def","desc","sourceShape","schema","deferProp","key","putProp","mirrorShape","keys","wrap","raw","mirrorProps","mergeDefs","defs","mergedDescriptors","descriptors","esc","str","slugify","captureStackTrace","_args","isObject","data","allowsEval","globalConfig","F","isPlainObject","o","ctor","prot","shallowClone","propertyKeyTypes","escapeRegex","clone","inst","params","cl","normalizeParams","_params","optionalKeys","shape","NUMBER_FORMAT_RANGES","BIGINT_FORMAT_RANGES","pick","mask","currDef","checks","newShape","maskedKeys","omit","omitted","extend","existingShape","extended","safeExtend","merge","a","b","partial","Class","name","selected","required","aborted","x","startIndex","i","explicitlyAborted","prefixIssues","path","issues","iss","_a","unwrapMessage","message","sizeCaps","defChecks","caps","ch","d","max","attachSchema","finalizeIssue","ctx","config","traits","schemaError","full","highSurrogate","codePointLength","units","count","getLengthableOrigin","parsedType","t","obj","issue","args","members","proto","table","defineBound","own","enumerable","hide","derived","computes","compute","fn","claim","sentinel","installing","broke","breaker","defineLazyInternal","outer","err","installLazyProp","make","CONSTANT_CATCH","constantCatch","_zodDesc","_E","newError","Definition","E","saved","$constructor","initializer","zodProto","Internals","protoMembers","initialized","init","ctorProto","up","installMembers","Parent","deferred","pp","$ZodAsyncError","$ZodEncodeError","newConfig","_getMessage","internals","util.jsonStringifyReplacer","_setMessage","_messageDesc","_issuesDesc","_installedToString","$ZodError","node","flattenError","error","mapper","fieldErrors","formErrors","sub","formatError","processError","fullpath","curr","el","terminal","finalizeParams","callee","_parse","_Err","_ctx","result","core.$ZodAsyncError","e","util.finalizeIssue","core.config","util.captureStackTrace","_parseAsync","_safeParse","failure","Err","_safeParseAsync","COMPILE_INVALID","COMPILE_FALLBACK","validate","validator","validateFallback","fallbackRun","validateAsync","_encode","parse","_decode","_encodeAsync","parseAsync","_decodeAsync","_safeEncode","_safeDecode","_safeEncodeAsync","_safeDecodeAsync","cuid","cuid2","ulid","xid","ksuid","nanoid","nanoidOfLength","length","duration","guid","uuid","version","email","_emoji","emoji","ipv4","ipv6","cidrv4","cidrv6","base64","base64url","httpProtocol","e164","dateSource","anchor","date","timeSource","hhmm","time","datetime","opts","qualified","timeRegex","anyString","number","boolean","lowercase","uppercase","$ZodCheck","core.$constructor","_whenHasLength","payload","util.nullish","numericOriginMap","$ZodCheckLessThan","origin","$ZodCheckGreaterThan","$ZodCheckMultipleOf","util.floatSafeRemainder","$ZodCheckNumberFormat","isInt","minimum","maximum","util.NUMBER_FORMAT_RANGES","$ZodCheckMaxLength","util.codePointLength","util.getLengthableOrigin","$ZodCheckMinLength","$ZodCheckLengthEquals","tooBig","$ZodCheckStringFormat","_b","$ZodCheckRegex","$ZodCheckLowerCase","regexes.lowercase","$ZodCheckUpperCase","regexes.uppercase","$ZodCheckIncludes","escapedRegex","util.escapeRegex","pattern","$ZodCheckStartsWith","$ZodCheckEndsWith","$ZodCheckOverwrite","Doc","closed","arg","lines","minIndent","dedented","line","content","$ZodType","runChecks","isAborted","util.aborted","asyncResult","util.explicitlyAborted","currLen","util.attachSchema","handleCanaryResult","canary","checkResult","util.hide","standardProps","util.own","toStandardResult","r","$ZodString","regexes.anyString","$ZodStringFormat","checks.$ZodCheckStringFormat","$ZodGUID","regexes.guid","$ZodUUID","regexes.uuid","$ZodEmail","regexes.email","URL_BAD_FORMAT","URL_UNPARSEABLE","canParseURL","validateURL","trimmed","parseURLObject","regexes.httpProtocol","URLStatic","asciiTabOrNewline","stripTabAndNewline","urlHostnameOk","url","hostname","urlProtocolOk","protocol","$ZodURL","$ZodEmoji","regexes.emoji","$ZodNanoID","regexes.nanoid","regexes.nanoidOfLength","$ZodCUID","regexes.cuid","$ZodCUID2","regexes.cuid2","$ZodULID","regexes.ulid","$ZodXID","regexes.xid","$ZodKSUID","regexes.ksuid","$ZodISODateTime","regexes.datetime","$ZodISODate","regexes.date","$ZodISOTime","regexes.time","$ZodISODuration","regexes.duration","$ZodIPv4","regexes.ipv4","ipv6Alphabet","isValidIPv6","$ZodIPv6","regexes.ipv6","$ZodCIDRv4","regexes.cidrv4","isValidCIDRv6","parts","address","prefix","prefixNum","$ZodCIDRv6","regexes.cidrv6","isValidBase64","base64Charset","$ZodBase64","base64urlCharset","isValidBase64URL","c","padded","$ZodBase64URL","$ZodE164","regexes.e164","isValidJWT","token","algorithm","tokensParts","header","parsedHeader","$ZodJWT","$ZodNumber","regexes.number","received","$ZodNumberFormat","checks.$ZodCheckNumberFormat","$ZodBoolean","regexes.boolean","$ZodAny","$ZodUnknown","$ZodNever","capSize","size","util.sizeCaps","cap","n","arraySize","handleArrayResult","final","index","util.prefixIssues","$ZodArray","memo","core.globalConfig","proms","abortEarly","item","handlePropertyResult","optin","optout","isPresent","isOptionalOut","NO_SYMBOL_KEYS","normalizeDef","ownSymbols","symbolKeys","allKeys","okeys","util.optionalKeys","handleCatchall","unrecognized","keySet","_catchall","seen","$ZodObject","sh","get","newSh","_normalized","util.cached","util.defineLazyInternal","zod","propValues","field","util.assignProp","util.isObject","catchall","$ZodObjectJIT","superParse","generateFastpass","normalized","syms","doc","parseStr","prefixStr","id","ids","counter","util.esc","isOptionalIn","assign","fastpass","jit","fastEnabled","util.allowsEval","handleUnionResults","results","nonaborted","$ZodUnion","option","patterns","p","util.cleanRegex","first","async","discriminatorMap","map","values","$ZodDiscriminatedUnion","_super","undefinedCount","pv","propShape","util.rawShape","disc","opt","$ZodIntersection","left","right","handleIntersectionResults","mergeValues","util.isPlainObject","bKeys","sharedKeys","newObj","sharedValue","newArray","itemA","itemB","unrecKeys","unrecIssue","keyIssues","collect","side","bothKeys","f","aggregated","merged","$ZodEnum","util.getEnumValues","valuesSet","patternValues","util.propertyKeyTypes","$ZodLiteral","vals","$ZodTransform","core.$ZodEncodeError","_out","output","handleOptionalResult","$ZodOptional","$ZodExactOptional","$ZodNullable","$ZodDefault","handleDefaultResult","$ZodPrefault","$ZodNonOptional","handleNonOptionalResult","handleCatchResult","$ZodCatch","$ZodPipe","handlePipeResult","next","$ZodReadonly","handleReadonlyResult","$ZodCustom","checks.$ZodCheck","handleRefineResult","_iss","util.issue","$ZodCyclicError","STATE","NO_ISSUES","isRef","cloneIssues","recursive","NONE","ASSUMED","PROVEN","isRecursive","stack","resolve","check","child","answer","spread","inner","settle","bucketFor","state","bucket","handoff","open","_inst","empty","entry","base","wrapped","isBackEdge","isRecursiveInst","rechecked","lastCtx","lastBucket","walked","hit","depth","memoizer","backEdges","Sizable","getSizing","FormatDictionary","TypeDictionary","getTypeName","type","expected","receivedType","util.parsedType","util.stringifyPrimitive","util.joinValues","adj","sizing","_issue","en","$ZodRegistry","_meta","meta","pm","registry","globalRegistry","snapshotChecks","_string","util.normalizeParams","_email","_guid","_uuid","_uuidv4","_uuidv6","_uuidv7","_url","_nanoid","_cuid","_cuid2","_ulid","_xid","_ksuid","_ipv4","_ipv6","_cidrv4","_cidrv6","_base64","_base64url","_e164","_jwt","_isoDateTime","_isoDate","_isoTime","_isoDuration","_int","_boolean","_any","_unknown","_never","_lt","checks.$ZodCheckLessThan","_lte","_gt","checks.$ZodCheckGreaterThan","_gte","_multipleOf","checks.$ZodCheckMultipleOf","_maxLength","checks.$ZodCheckMaxLength","_minLength","checks.$ZodCheckMinLength","_length","checks.$ZodCheckLengthEquals","_regex","checks.$ZodCheckRegex","_lowercase","checks.$ZodCheckLowerCase","_uppercase","checks.$ZodCheckUpperCase","_includes","includes","checks.$ZodCheckIncludes","_startsWith","checks.$ZodCheckStartsWith","_endsWith","suffix","checks.$ZodCheckEndsWith","_overwrite","tx","checks.$ZodCheckOverwrite","_normalize","form","_trim","_toLowerCase","_toUpperCase","_slugify","util.slugify","_array","element","_custom","norm","_refine","_superRefine","_check","assignProps","sources","initializeContext","handleUnrepresentable","json","processSchema","overrideSchema","_json","processor","parent","isTransforming","encodeJSONPointerSegment","segment","extractDefs","root","idToSchema","existing","makeURI","defsSegment","externalId","uriGenerator","uriPrefix","defUriPrefix","defId","extractToDef","ref","ext","compactTypeUnion","options","types","member","FOLDABLE_KEYS","UNION_KEYS","undeclaredConstraint","extra","foldObjects","objects","properties","object","other","part","folded","constraints","constraint","foldIntersection","allOf","unions","m","union","keyword","rest","branches","branch","finalize","flattenRef","zodSchema","_cached","refSeen","refSchema","parentSeen","rewrite","carriers","rootMetaId","finalized","createStandardJSONSchemaMethod","_schema","createToJSONSchemaMethod","processors","io","libraryOptions","narrowMin","agg","narrowMax","narrowBoth","addDivisor","addPattern","intersectMime","mime","setFormat","format","minContributor","maxContributor","formatContributor","ranges","contributors","aggregateChecks","list","bag","formatMap","exactPatterns","regexes.base64","regexes.base64url","exactPattern","stringProcessor","contentEncoding","laxFormat","patternList","regex","numberProcessor","multipleOf","exclusiveMaximum","exclusiveMinimum","exMin","exMax","legacy","divisors","divisor","booleanProcessor","neverProcessor","anyProcessor","unknownProcessor","enumProcessor","literalProcessor","customProcessor","transformProcessor","arrayProcessor","inputOptin","objectProcessor","requiredKeys","unionProcessor","isExclusive","intersectionProcessor","isSimpleIntersection","nullableProcessor","nonoptionalProcessor","UNREPRESENTABLE_DEFAULT","serializeDefaultValue","unrepresentable","serialized","defaultProcessor","prefaultProcessor","catchProcessor","catchValue","pipeProcessor","inIsTransform","innerType","readonlyProcessor","optionalProcessor","_installedErrorProtos","_lazyMethod","self","core.formatError","core.flattenError","ZodRealError","core._parse","core._parseAsync","safeParse","core._safeParse","safeParseAsync","core._safeParseAsync","encode","core._encode","decode","core._decode","encodeAsync","core._encodeAsync","decodeAsync","core._decodeAsync","safeEncode","core._safeEncode","safeDecode","core._safeDecode","safeEncodeAsync","core._safeEncodeAsync","safeDecodeAsync","core._safeDecodeAsync","_ensureDefaultLocale","_ensureDefaultMemoizer","core.memoizer","ZodType","core.$ZodType","chks","util.mergeDefs","core.clone","reg","refine","refinement","superRefine","checks.overwrite","optional","exactOptional","nullable","nonoptional","intersection","pipe","transform","_default","prefault","_catch","readonly","description","core.globalRegistry","core.standardProps","parse.parse","parse.parseAsync","parse.safeParse","parse.safeParseAsync","parse.validate","parse.validateAsync","parse.encode","parse.decode","parse.encodeAsync","parse.decodeAsync","parse.safeEncode","parse.safeDecode","parse.safeEncodeAsync","parse.safeDecodeAsync","_ZodString","core.$ZodString","processors.stringProcessor","util.derived","processors.aggregateChecks","checks.regex","checks.includes","checks.startsWith","checks.endsWith","checks.minLength","checks.maxLength","checks.length","checks.lowercase","checks.uppercase","checks.trim","checks.normalize","checks.toLowerCase","checks.toUpperCase","checks.slugify","ZodString","core._email","ZodEmail","core._url","ZodURL","core._jwt","ZodJWT","core._emoji","ZodEmoji","core._guid","ZodGUID","core._uuid","ZodUUID","core._uuidv4","core._uuidv6","core._uuidv7","core._nanoid","ZodNanoID","core._cuid","ZodCUID","core._cuid2","ZodCUID2","core._ulid","ZodULID","core._base64","ZodBase64","core._base64url","ZodBase64URL","core._xid","ZodXID","core._ksuid","ZodKSUID","core._ipv4","ZodIPv4","core._ipv6","ZodIPv6","core._cidrv4","ZodCIDRv4","core._cidrv6","ZodCIDRv6","core._e164","ZodE164","core._isoDateTime","ZodISODateTime","core._isoDate","ZodISODate","core._isoTime","ZodISOTime","core._isoDuration","ZodISODuration","string","core._string","ZodStringFormat","core.$ZodStringFormat","core.$ZodISODateTime","core.$ZodISODate","core.$ZodISOTime","core.$ZodISODuration","core.$ZodEmail","core.$ZodGUID","core.$ZodUUID","core.$ZodURL","core.$ZodEmoji","core.$ZodNanoID","core.$ZodCUID","core.$ZodCUID2","core.$ZodULID","core.$ZodXID","core.$ZodKSUID","core.$ZodIPv4","core.$ZodIPv6","core.$ZodCIDRv4","core.$ZodCIDRv6","core.$ZodBase64","core.$ZodBase64URL","core.$ZodE164","core.$ZodJWT","ZodNumber","core.$ZodNumber","processors.numberProcessor","checks.gt","checks.gte","checks.lt","checks.lte","int","checks.multipleOf","ZodNumberFormat","core.$ZodNumberFormat","core._int","ZodBoolean","core.$ZodBoolean","processors.booleanProcessor","core._boolean","ZodAny","core.$ZodAny","processors.anyProcessor","any","core._any","ZodUnknown","core.$ZodUnknown","processors.unknownProcessor","unknown","core._unknown","ZodNever","core.$ZodNever","processors.neverProcessor","never","core._never","ZodArray","core.$ZodArray","processors.arrayProcessor","core._array","ZodObject","core.$ZodObjectJIT","processors.objectProcessor","util.installLazyProp","_enum","incoming","util.extend","util.safeExtend","util.merge","util.pick","util.omit","util.partial","ZodOptional","ZodExactOptional","util.required","ZodNonOptional","looseObject","ZodUnion","core.$ZodUnion","processors.unionProcessor","ZodDiscriminatedUnion","core.$ZodDiscriminatedUnion","discriminatedUnion","discriminator","ZodIntersection","core.$ZodIntersection","processors.intersectionProcessor","ZodEnum","core.$ZodEnum","processors.enumProcessor","newEntries","ZodLiteral","core.$ZodLiteral","processors.literalProcessor","literal","ZodTransform","core.$ZodTransform","processors.transformProcessor","core.$ZodOptional","processors.optionalProcessor","core.$ZodExactOptional","ZodNullable","core.$ZodNullable","processors.nullableProcessor","ZodDefault","core.$ZodDefault","processors.defaultProcessor","defaultValue","util.shallowClone","ZodPrefault","core.$ZodPrefault","processors.prefaultProcessor","core.$ZodNonOptional","processors.nonoptionalProcessor","ZodCatch","core.$ZodCatch","processors.catchProcessor","core.util.constantCatch","ZodPipe","core.$ZodPipe","processors.pipeProcessor","in_","out","ZodReadonly","core.$ZodReadonly","processors.readonlyProcessor","ZodCustom","core.$ZodCustom","processors.customProcessor","custom","core._custom","core._refine","core._superRefine","EventTypeSchema","z.enum","MetadataSchema","z.custom","SubagentRunIdSchema","z.string","TextMessageRoleSchema","TextMessageStartEventSchema","z.looseObject","z.literal","z.int","z.any","TextMessageContentEventSchema","TextMessageEndEventSchema","TextMessageChunkEventSchema","ToolCallStartEventSchema","ToolCallArgsEventSchema","ToolCallEndEventSchema","ToolCallChunkEventSchema","TextPartSchema","DataSourceSchema","UrlSourceSchema","FileSourceSchema","PartSourceSchema","z.discriminatedUnion","ImagePartSchema","AudioPartSchema","VideoPartSchema","DocumentPartSchema","ContentPartSchema","ToolCallResultEventSchema","z.union","z.array","StateSchema","StateSnapshotEventSchema","JsonPointerSchema","AddOperationSchema","RemoveOperationSchema","ReplaceOperationSchema","MoveOperationSchema","CopyOperationSchema","TestOperationSchema","JsonPatchOperationSchema","JsonPatchSchema","StateDeltaEventSchema","DeveloperMessageSchema","SystemMessageSchema","FunctionCallSchema","ToolCallSchema","AssistantMessageSchema","UserMessageSchema","ToolMessageSchema","ActivityMessageSchema","ReasoningMessageSchema","MessageSchema","MessagesSnapshotEventSchema","ActivitySnapshotEventSchema","z.boolean","ActivityDeltaEventSchema","RawEventSchema","CustomEventSchema","ToolSchema","ContextSchema","ResumeEntrySchema","RunAgentInputSchema","RunStartedEventSchema","RunFinishedSuccessOutcomeSchema","InterruptSchema","RunFinishedInterruptOutcomeSchema","RunFinishedCancelledOutcomeSchema","RunFinishedOutcomeSchema","TokenUsageSchema","RunFinishedEventSchema","RunErrorEventSchema","StepStartedEventSchema","StepFinishedEventSchema","ReasoningStartEventSchema","ReasoningMessageStartEventSchema","ReasoningMessageContentEventSchema","ReasoningMessageEndEventSchema","ReasoningMessageChunkEventSchema","ReasoningEndEventSchema","ReasoningEncryptedValueSubtypeSchema","ReasoningEncryptedValueEventSchema","SubagentStartedEventSchema","SubagentFinishedSuccessOutcomeSchema","SubagentFinishedSuspendedOutcomeSchema","SubagentFinishedOutcomeSchema","SubagentFinishedEventSchema","SubagentErrorEventSchema","EventSchema","RoleSchema","SubagentInfoSchema","IdentityCapabilitiesSchema","TransportCapabilitiesSchema","ToolsCapabilitiesSchema","OutputCapabilitiesSchema","StateCapabilitiesSchema","MultiAgentCapabilitiesSchema","ReasoningCapabilitiesSchema","MultimodalInputCapabilitiesSchema","MultimodalOutputCapabilitiesSchema","MultimodalCapabilitiesSchema","ExecutionCapabilitiesSchema","HumanInTheLoopCapabilitiesSchema","AgentCapabilitiesSchema","AttributableSchema","BaseEventSchema","BaseMessageSchema","OptionalMetadataSchema","props","__props","attrs","useAttrs","inspectorTag","shallowRef","inspector","isMounted","configureInspector","vConfigureInspector","onMounted","mod","core","sdkVersion","onUnmounted","watch","request","_createBlock","_resolveDynamicComponent","_normalizeProps","_mergeProps","_unref","CopilotKitKey","CopilotChatConfigurationKey","SandboxFunctionsKey","InspectorKey","CopilotStyleOptionsKey","useCopilotKit","context","inject","MCPAppsActivityRenderer","defineComponent","copilotkit","containerRef","contentError","isLoading","iframeSize","iframeRef","sessionRef","fetchedResource","messageId","computed","container","agent","_old","onCleanup","mounted","iframe","importErr","session","resource","borderStyle","h","A2UISurfaceActivityType","A2UIActivityContentSchema","z","getOperationSurfaceId","operation","CopilotKitCoreVue","CopilotKitCore","nextTick","renderers","subscriber","rc","renderToolCalls","agentId","interruptState","A2UILifecycleFields","resolveDebugExposure","optionDebugExposure","tokensOf","dot","spacer","bar","w","ht","bg","anim","opacity","transition","row","show","delay","children","renderA2UIGeneratingSkeleton","label","tokens","phase","renderDebugDetails","A2UIBuildingState","A2UIRetryingState","attempt","immediate","current","revealed","timer","isImmediate","showAfterMs","onBeforeUnmount","maxAttempts","errors","A2UIRecoveryFailure","A2UI_OPERATIONS_KEY","A2UISurfaceContentSchema","createA2UIMessageRenderer","showAfterAttempts","renderLifecycle","debugExposure","operations","A2UISurfaceActivityRenderer","defineToolCallRenderer","ɵanySchema","RENDER_A2UI_TOOL_NAME","registerA2UIBuiltInToolCallRenderer","enabled","isEnabled","_prev","renderer","createVueComponent","api","renderFn","setupState","VueWrapper","wrapperProps","resolvedProps","binder","initBinder","GenericBinder","newProps","newContext","LEAF_MARGIN","CONTAINER_PADDING","STANDARD_BORDER","STANDARD_RADIUS","mapJustify","j","mapAlign","getBaseLeafStyle","getBaseContainerStyle","renderChildList","childList","buildChild","a2uiIdCounter","useA2UIUniqueId","Text","TextApi","text","style","Image","ImageApi","mapFit","fit","Icon","IconApi","iconName","Video","VideoApi","AudioPlayer","AudioPlayerApi","Row","RowApi","Column","ColumnApi","List","ListApi","isHorizontal","Card","CardApi","Tabs","TabsApi","tabs","tab","title","Divider","DividerApi","isVertical","Modal","ModalApi","Button","ButtonApi","TextField","TextFieldApi","uniqueId","isLong","inputStyle","hasError","CheckBox","CheckBoxApi","ChoicePicker","ChoicePickerApi","isMutuallyExclusive","onToggle","newValues","isSelected","Slider","SliderApi","DateTimeInput","DateTimeInputApi","vueBasicComponents","vueBasicCatalog","Catalog","BASIC_FUNCTIONS","buildCatalogContextValue","catalog","buildContextValue","registerA2UICatalogContext","contextValue","agentIds","schemaValue","extractCatalogComponentSchemas","scope","A2UI_SCHEMA_CONTEXT_DESCRIPTION","A2UI_DEFAULT_GENERATION_GUIDELINES","A2UI_DEFAULT_DESIGN_GUIDELINES","useSandboxFunctions","functionsRef","OpenGenerativeUIActivityType","OPEN_GENERATIVE_UI_ACTIVITY_TYPE","OpenGenerativeUIContentSchema","GenerateSandboxedUiArgsSchema","OpenGenerativeUIRenderer","sandboxFunctions","controller","ɵOpenGenerativeUIController","unsubscribe","functions","generating","height","hasVisibleSandbox","OpenGenerativeUIActivityRenderer","OpenGenerativeUIToolRenderer","visibleMessageIndex","messages","ToolCallStatus","currentMessage","MARKDOWN_RENDERER_KEY","useMarkdownRenderer","isVueComponentRenderer","LicenseContextKey","createDefaultLicenseRef","createLicenseContextValue","useCopilotChatConfiguration","injected","useChatLabels","CopilotChatDefaultLabels","labels","spec","ɵgetLicenseBannerSpec","containerStyle","ɵLICENSE_BANNER_STYLE","releaseOffset","ɵreserveLicenseBannerOffset","_createElementBlock","_createElementVNode","_toDisplayString","_normalizeStyle","_hoisted_1","_cache","HEADER_NAME","COPILOT_CLOUD_CHAT_URL","FRONTEND_TOOLS_STABLE_WARNING","HUMAN_IN_THE_LOOP_STABLE_WARNING","RENDER_CUSTOM_MESSAGES_STABLE_WARNING","RENDER_ACTIVITY_MESSAGES_STABLE_WARNING","SANDBOX_FUNCTIONS_STABLE_WARNING","HUMAN_IN_THE_LOOP_ABORTED_MESSAGE","viewerTheme","SameOriginMCPAppsActivityRenderer","provide","shouldRenderInspector","updateInspectorVisibility","shouldEnableInspector","inspectorOpenRequest","isInspectorEnabled","openInspector","initialFrontendTools","initialHumanInTheLoop","initialRenderCustomMessages","initialRenderActivityMessages","initialSandboxFunctions","rawEntries","toRaw","resolvedPublicKey","mergedAgents","hasLocalAgents","isHeadersBuilder","latestHeaders","headersSource","ɵwithHeaderDefaults","chatApiEndpoint","endpoint","publicKey","localAgents","msg","pendingHumanInTheLoop","takePendingHumanInTheLoop","pending","processedHumanInTheLoop","tools","tool","signal","reject","onAbort","ToolComponent","render","renderProps","allTools","builtInFrontendTools","allRenderToolCalls","combined","allRenderCustomMessages","runtimeA2UIEnabled","runtimeOpenGenerativeUIEnabled","runtimeLicenseStatus","runtimeEntitlements","runtimeEntitlementRetryPending","openGenerativeUIActive","a2uiCatalogProvided","a2uiActive","resolvedProperties","GENERATE_SANDBOXED_UI_TOOL_NAME","GENERATE_SANDBOXED_UI_DESCRIPTION","builtInActivityRenderers","MCPAppsActivityType","MCPAppsActivityContentSchema","allRenderActivityMessages","applyDefaultThrottleMs","toLearningConfig","learning","_autoStart","learningConfig","createCopilotKit","didMountRef","executingToolCallIds","sub1","toolCallId","triggerRef","sub2","sub3","sub4","sub5","event","sub6","renderCustomMessages","renderActivityMessages","lastAppliedHeadersSource","syncRuntimeConfig","watchLearning","learningEnabled","learningAutoStart","suppliedTrajectoryId","generatesTrajectoryId","learningContainerIds","autoStart","ignoresTrajectoryId","generates","supplied","_previous","disposed","trajectoryId","randomUUID","a2uiTheme","a2uiCatalog","a2uiLoadingComponent","a2uiIncludeSchema","providerContextIds","active","designSkill","DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL","schemaToJsonSchema","licenseState","ɵresolveLicenseState","licenseContextValue","licenseBannerType","_renderSlot","CopilotKitInspector","LicenseWarningBanner","useShallowStableRef","stable","toValue","previous","ɵshallowEqualRecord","parentConfig","parentConfigValue","propIsAuthoritative","activeThreadOverride","stableLabels","mergedLabels","resolvedAgentId","DEFAULT_AGENT_ID","fallbackThreadId","resolvedThreadId","copilotKitContext","openThread","registration","threadId","resolvedHasExplicitThreadId","shouldCreateModalState","resolvedDefaultOpen","internalModalOpen","setInternalModalOpen","resolvedIsModalOpen","resolvedSetModalOpen","setActiveThreadId","startNewThread","ownDrawerOpen","ownDrawerCount","ownSetDrawerOpen","isMobileViewport","ownRegisterDrawer","resolvedDrawerOpen","resolvedSetDrawerOpen","resolvedDrawerRegistered","resolvedRegisterDrawer","publicSetModalOpen","configurationValue","useLicenseContext","DeferredChild","comp","delId","childId","specificPath","componentModel","compImpl","ComponentContext","A2uiSurface","DEFAULT_SURFACE_ID","processorRef","lastOpsHash","getOrCreateProcessor","MessageProcessor","action","handleAction","a2uiAction","processOperations","hash","grouped","op","surfaceId","ops","filtered","hasOperations","surfaceEntries","surface","_openBlock","_hoisted_2","_hoisted_3","_Fragment","_renderList","_hoisted_5","_createVNode","DEFAULT_OPTIONS","normalizeOptions","normalizeChunk","chunk","hadPendingCR","pendingCarriageReturn","splitLines","getLineBuffer","newline","toLineColumn","column","isBlank","isCitationDefinitionLine","isCitationDefinitionPrefixCandidate","hasNewline","isComplete","matchFenceOpen","backtick","tilde","matchFenceClose","marker","matchAtxHeading","match","isSetextUnderline","isThematicBreak","matchListItem","unordered","indent","contentIndent","ordered","isBlockquoteLine","isPipeTableHeader","second","looksLikeTableRow","isTableDividerRow","cells","splitTableCells","cell","body","parseTableAlignment","startsNewBlock","enableTables","isEscapable","findClosing","openAt","openChar","closeChar","parseLinkDestination","close","parseLinkTitle","firstSpace","isUrl","isEmail","trimAutolinkTrailingPunctuation","candidate","parseCitationDefinitions","definitions","warnings","offset","extracted","extractTrailingUrl","assignCitationNumber","citations","idRef","createSegments","absoluteStart","segmenterCtor","granularity","segmenter","segments","segmentText","clusterPunctuationSegments","withClosingAttached","acc","isClosingPunctuationOnly","clustered","isOpeningPunctuationOnly","isOnlyFromSet","CLOSING_PUNCTUATION$1","OPENING_PUNCTUATION","charset","character","parseInline","nodes","textBuffer","textBufferStart","hasWarnedSegmenterUnavailable","flushTextBuffer","appendResult","appendText","appendBufferedText","hardByBackslash","countTrailing","hardBySpaces","hard","citation","parseCitationInline","image","parseImageInline","link","parseLinkInline","auto","parseAutolinkInline","code","parseInlineCode","strong","parseDelimitedInline","strike","em","annotateNoBreakBeforeSegments","run","changed","typedSegments","firstSegment","shouldMark","startsWithClosingPunctuation","shouldPreventBreakBeforeNode","nextSegments","CLOSING_PUNCTUATION","segmentation","at","numbered","partialIdRef","labelEnd","destEnd","alt","parsed","childResult","len","delimiter","parseBlocks","from","to","isRoot","isCitationDefinition","isCitationDefinitionPrefix","fenced","nodePath","parseCodeFence","parseBlockquote","listMarker","parseList","heading","level","parsePipeTable","parseParagraph","fenceOpen","closeLine","endLine","picked","stripped","markerWidth","items","sawBlankBetweenItems","listStartNumber","contentLines","hadBlank","continuation","paragraphText","itemPath","parsedInline","paragraph","align","rows","headerChildren","cellIndex","headerRow","bodyRows","rowIndex","cellNodes","createAstOpsFromDraft","visit","parentPath","childPaths","applyAstOps","previousNodeById","nodeOps","pathToId","nextId","nodesById","materialized","opToAstNode","childPath","reconciled","reconcileTextNode","astNodeEquals","rootPath","parentId","previousBySignature","groupSegmentsBySignature","reusedAnySegment","signature","getSegmentSignature","reused","areSegmentArraysIdentical","bySignature","createStreamingMarkdownParserState","parseStreamingMarkdownChunk","rebuildState","finalizeStreamingMarkdown","prev","parseContext","parsedBlocks","reduced","lineBuffer","computeOpenStack","inferMode","rootId","nodeById","cursor","lastChild","warned","MIGRATION_GUIDE_URL","HIGHLIGHTABLE_CODE","BLOCK_MATH","BRACKET_MATH","isProduction","warnUnsupportedRichSyntaxOnce","hasMath","hasHighlightableCode","feature","missing","SAFE_HREF","SAFE_IMG_SRC","sanitizeHref","href","sanitizeImgSrc","src","buildParserState","renderTextSegments","renderChildren","childIds","nodeRenderers","renderNode","withOverride","defaultVNode","override","tag","safeHref","safeSrc","StreamingMarkdownRenderer","parserState","byId","rootNode","rootClass","resolvedOptions","defaultCodeBlockRenderer","mergedNodeRenderers","watchEffect","_normalizeClass","hasAccessibleAttribute","attributes","iconDrawProps","CopilotIcon","slots","icon","ɵcopilotIcons","isDecorative","ɵcopilotIconSvgAttributes","defineIcon","IconArrowUp","IconCheck","IconChevronDown","IconChevronLeft","IconChevronRight","IconCircle","IconCopy","IconEdit","IconEyeOff","IconLoader2","IconMessageCircle","IconMic","IconPanelLeftOpen","IconPlay","IconPlus","IconRefreshCw","IconSquare","IconThumbsDown","IconThumbsUp","IconUpload","IconVolume2","IconWrench","IconX","findToolMessage","getToolCallSlotName","toolName","getToolCallRenderProps","toolCall","toolMessage","parsedArgs","partialJSONParse","contentToText","isExecuting","getCoreRenderProps","getToolCallMemoDeps","ɵresolveToolCallRenderer","useLearningConfigured","configured","ToolCallCaptureScope","learningConfigured","getRenderProps","getCoreProps","getRenderConfig","getMemoDeps","_guardReactiveProps","_withMemo","useCopilotId","vueUseId","vue","ToolCallDisplayContextKey","ToolCallGroupContextKey","toolCallStatusLabel","status","CopilotChatCollapsible","syncInert","ToolCallStatusIcon","ToolCallChevron","ToolCallFailedCount","failed","ɵcountFailedToolCalls","ɵformatLabel","ɵstringifyToolCallPayload","ToolCallRow","detailsId","preview","ɵgetArgumentPreview","layer","bodyId","toggle","latest","call","ɵgetToolCallPreview","done","statuses","ɵgetToolCallRowStatus","failedIds","single","behind","latestStatus","latestPreview","runningLabel","usedToolsLabel","ɵformatCountLabel","toolNames","ɵformatToolNames","latestStatusLabel","_hoisted_4","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_10","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","appearances","componentSlots","useSlots","getToolCallSlotNames","display","layout","viewLayout","rendererNames","ɵgetToolCallRendererNames","ɵgetToolCallLayouts","groupActive","trailing","appearance","workOpen","TurnRows","rowProps","renderCall","CopilotChatToolCallItem","slotName","_withCtx","slotProps","CopilotChatToolCallGroup","TurnWorkFold","CopilotChatWorkText","OPPOSITE","clamp","min","computeFloatingPlacement","reference","viewport","preferredSide","sideOffset","alignOffset","collisionPadding","arrowSize","space","needed","opposite","vertical","arrowX","arrowY","transformOrigin","isElementClippedAway","rect","view","top","bottom","overflowX","overflowY","clip","useFloating","floating","placement","referenceHidden","cleanup","update","referenceElement","floatingElement","stop","isOpen","frame","schedule","observer","zIndex","arrowWrapperStyle","usePresence","present","finish","stopWaiting","animationName","ARROW_SIZE","HOVER_GRACE_MS","wantsOpen","trigger","wrapper","contentElement","wrapperStyle","openTimer","closeTimer","pointerDown","pointerMoveOpened","clearTimers","suppressed","onPointerMove","scheduleClose","onPointerLeave","onPointerUp","onPointerDown","onFocus","triggerProps","onKeyDown","onScroll","contentStyle","_Teleport","buttonClass","popupOpen","CopilotTooltip","mergeProps","$attrs","$slots","emit","__emit","toRef","isInside","onOutside","listen","on","__expose","popover","FOCUSABLE","selector","nextFocusable","skip","all","focusInside","isOwnThumb","focusField","setInput","onEscape","returnFocus","onInteractOutside","focusables","leaving","onSubmit","onEditingChange","editing","onLeave","onFormFocusOut","CopilotPopover","$event","MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH","SUB_OPEN_DELAY_MS","SUB_GRACE_MS","TYPEAHEAD_RESET_MS","generatedId","contentId","itemElements","openSub","subInitialFocus","highlighted","isGroup","setItemElement","focusableIndexes","focusItem","focusedIndex","indexes","subOpenTimer","graceUntil","clearSubTimer","openSubmenu","focus","closeSubmenu","onSubClosedByKey","typeahead","typeaheadTimer","labelOf","runTypeahead","position","repeated","search","activate","currentEntry","onItemPointerMove","onItemPointerLeave","onItemClick","onSubPointerEnter","isInsideMenu","method","subId","_component_CopilotDropdownMenuContent","_createTextVNode","useInspectorShortcutsHidden","hidden","ɵinspectorShortcuts","hideInspectorShortcuts","menuId","triggerId","kiteId","initialFocus","menu","ɵHoverMenuController","menuState","unsubscribeMenu","dark","cancelClose","keyboardUsed","changeOpen","isInspectItem","onPointerEnter","onClick","onSelect","onDismiss","reason","ariaLabel","descriptionFor","CopilotDropdownMenuContent","ɵinspectorKiteIcon","ɵinspectorKiteFill","gradient","_hoisted_9","MessageFeedbackScopeKey","useLearningFeedbackEnabled","read","ɵisLearningFeedbackEnabled","ɵsubscribeToLearningFeedbackEnabled","useMessageFeedback","ɵsubscribeToMessageFeedback","ɵgetMessageFeedbackControls","useFeedbackComment","controls","ɵFeedbackCommentController","useCopyFeedback","feedback","ɵCopyFeedback","copied","copy","normalizeContent","normalizedContent","hasContent","ɵhasAssistantMessageText","providerMarkdownRenderer","providerIsComponent","ActiveMarkdownRenderer","StreamingMarkdownDefault","activeMarkdownConfig","shortcutsHidden","showInspectorShortcut","comment","rating","commentAnchor","commentRating","hasThumbsUp","hasThumbsDown","hasReadAloud","hasRegenerate","isLatestAssistantMessage","shouldShowToolbar","ɵshouldShowAssistantToolbar","findCommentAnchor","onUpdated","isFocusVisible","HIDDEN_TOO","rate","thumbFeedbackProps","thumb","enter","via","thumbsUpProps","thumbsDownProps","showToolbar","currentRating","handleInspect","handleCopyMessage","handleThumbsUp","handleThumbsDown","handleReadAloud","handleRegenerate","CopilotChatToolCallsView","CopilotChatAssistantToolbarButton","CopilotChatInspectorButton","CopilotChatFeedbackCommentPopover","AudioRecorderError","canvasRef","recorderState","mediaRecorderRef","streamRef","analyserRef","audioContextRef","animationIdRef","audioChunksRef","amplitudeHistoryRef","scrollOffsetRef","smoothedAmplitudeRef","fadeOpacityRef","recorder","track","audioContext","stream","analyser","mimeType","audioBlob","calculateAmplitude","dataArray","sum","sample","drawFrame","canvas","dpr","barWidth","barSpacing","maxBars","bufferLength","rawAmplitude","speed","computedStyle","centerY","maxAmplitude","edgeFadeWidth","amplitude","scaledAmplitude","barHeight","y","edgeOpacity","ɵgetInlineFeatureWarningSpec","ɵINLINE_FEATURE_WARNING_STYLE","UseAgentUpdate","ALL_UPDATES","useAgent","hasThreadId","hasRuntimeAgentId","hasAgentId","isThreadScoped","chatConfig","runtimeAgentId","updateFlags","providerThrottleMs","hookThrottleMs","subscriptionAgent","provisionalAgentCache","createProvisionalAgent","runtimeUrl","transport","provisional","ProxiedCopilotRuntimeAgent","registeredProxy","rtId","proxy","unregister","resolveAgent","shouldForceUpdate","cachedProxy","provisionalProxy","isRuntimeConfigured","CopilotKitCoreRuntimeConnectionStatus","knownAgents","runtimePart","currentAgent","ɵisHttpAgent","flags","batchScheduled","batchedRefresh","handlers","subscription","useSuggestions","suggestions","initState","_newValues","changedAgentId","s","useAttachments","attachments","dragOver","fileInputRef","configRef","attachmentsRef","setAttachments","updateAttachments","updater","processFiles","files","accept","maxSize","rejectedFiles","file","matchesAcceptFilter","validFiles","exceedsMaxSize","formatFileSize","modality","getModalityFromMimeType","placeholderId","uploadMetadata","uploadResult","metadata","uploadSource","readFileAsBase64","thumbnail","generateVideoThumbnail","attachment","handleFileUpload","handleDragOver","handleDragLeave","handleDrop","removeAttachment","consumeAttachments","ready","handlePaste","fileItems","onPaste","useKeyboardHeight","initial","ɵinitialKeyboardState","isKeyboardOpen","keyboardHeight","availableHeight","viewportHeight","stopWatching","ɵwatchKeyboardState","DEFAULT_LAST_USER_MESSAGE_STATE","LastUserMessageKey","createDefaultLastUserMessageRef","usePinToSend","scrollRef","contentRef","spacerRef","topOffset","lastUserMessage","lastNonce","sendNonce","scrollEl","contentEl","spacerEl","ɵpinMessageToTop","shellRef","textareaRef","gridRef","addButtonContainerRef","actionsContainerRef","slashMenuRef","audioRecorderRef","localValue","isComposing","commandQuery","slashHighlightIndex","previousCommandQuery","addMenuOpen","addMenuInitialFocus","addMenuAnchor","addMenuId","addMenuTriggerId","measurements","resizeEvaluationRafRef","ignoreResizeRef","measurementCanvasRef","containerCacheRef","didWarnMissingFontRef","didWarnMissingCanvasContextRef","resizeObserver","isControlled","inputValue","resolvedPlaceholder","isExpanded","shouldShowDisclaimer","hasSubmitAction","hasStopAction","hasAddFileAction","hasStartTranscribeAction","hasCancelTranscribeAction","hasFinishTranscribeAction","composerInput","composerButton","ɵcomposerButtonState","isProcessing","sendDisabled","showsStop","containerClass","rootAttrs","isMenuGroup","createDefaultAddItem","normalizeMenuItems","addItem","menuEntry","menuItems","hasMenuItems","flattenMenuForCommands","commands","walk","entryList","commandItems","flattenMenuDisplay","menuDisplayItems","filteredCommands","startsWith","contains","command","slashMenuVisible","updateInputValue","nextValue","clearInputValue","updateSlashState","firstLine","runCommand","submit","handleInput","handleSendButtonClick","handleKeydown","ɵresolveComposerKey","getAddMenuTrigger","toggleAddMenu","closeAddMenu","handleMenuAction","handleAddMenuSelect","handleAddMenuDismiss","addMenuPointerToggled","handleAddMenuPointerDown","handleAddMenuClick","handleAddMenuTriggerKeydown","handleFinishTranscribe","blob","handleContainerClick","ensureMeasurements","textarea","previousValue","previousHeight","paddingLeft","paddingRight","paddingTop","paddingBottom","singleLineHeight","maxHeight","adjustTextareaHeight","scrollHeight","updateLayout","nextLayout","resolveTextareaFont","textareaStyles","fallbackFont","updateContainerCache","grid","addContainer","actionsContainer","gridStyles","columnGap","gridAvailableWidth","addWidth","actionsWidth","compactWidth","cache","evaluateLayout","baseline","hasExplicitBreak","renderedMultiline","shouldExpand","compactInnerWidth","resolvedFont","longestLine","width","scheduleLayoutEvaluation","invalidateCache","query","filteredCount","mode","disabled","containerTargets","shouldInvalidate","CopilotChatAudioRecorder","_withModifiers","_hoisted_11","closeButton","previouslyFocused","handleTab","last","activeLightboxAttachment","documentBlobUrl","lightboxLabel","isPreviewableDocument","isPdf","isText","decodedTextPreview","lightboxDocumentSource","blobUrl","createBlobUrl","openLightbox","withTransition","closeLightbox","cardClassName","base64Value","binary","bytes","getSourceUrl","getDocumentIcon","_hoisted_18","_hoisted_19","CopilotChatLightbox","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","isLatest","isStreaming","elapsed","userToggledDuringStreaming","startTimeMs","elapsedInterval","clearElapsedInterval","updateElapsedNow","nextIsStreaming","ɵformatReasoningDurationLabel","toggleOpen","useLightbox","thumbnailRef","vtName","clear","imageLoadFailed","sourceUrl","documentLabel","documentAriaLabel","imageButton","lightboxOpen","toolbarButtonClass","mediaParts","ɵgetUserMessageMediaParts","flattenedContent","ɵflattenUserMessageContent","isMultiline","hasEditAction","branchNav","ɵgetBranchNavState","showBranchNavigation","canGoPrev","canGoNext","handleEditMessage","switchToBranch","branchIndex","goPrev","goNext","CopilotChatAttachmentRenderer","ɵgetUserMessageMediaFilename","now","working","ɵgetWorkSummaryText","stateTick","forwardedSlotNames","resolvedThreadAgent","_values","nextInterruptState","deduplicatedMessages","ɵdeduplicateMessages","toolCallLayouts","learningFeedbackEnabled","turnWork","ɵgetTurnWork","turnByFirstMessage","byFirst","turn","lastRenderedMessage","latestTurnKey","ɵgetLatestTurnKey","toggledTurns","turnOpenState","workTimes","workTimesVersion","isRunning","turnKey","lastRole","ɵrecordWorkTime","workOpenState","ɵgetWorkOpenState","WorkSummaryRow","calls","isWorking","ɵisTurnWorking","ɵisTurnWorkOpen","times","summaryProps","slot","CopilotChatWorkSummary","rowKeyStore","createRowKeyStore","rowRenderKeys","resolveRowRenderKeysById","commitRowKeyStore","lastMessage","showCursor","pendingWorkSummary","messageCount","deduplicatedCount","getMeta","resolvedRunId","runId","messageIdsInRun","rawMessageIndex","messageIndex","messageIndexInRun","numberOfMessagesInRun","stateSnapshot","stateSnapshotResolved","getMessageSlotProps","MessageMetaSlot","getActivitySlotName","activityType","resolveCustomMessageRenderer","ɵresolveCustomMessageRenderers","resolveActivityRenderer","ɵresolveActivityRenderer","CopilotChatAssistantMessage","CopilotChatUserMessage","_createSlots","CopilotChatReasoningMessage","isDisabled","loadingSet","containerAttrs","_className","suggestion","handleSelectSuggestion","CopilotChatSuggestionPill","SCROLL_BUTTON_OFFSET","SCROLL_BOTTOM_THRESHOLD","scrollContainerRef","scrollContentRef","inputContainerRef","inputContainerHeight","isAtBottom","isControlledInput","localInputValue","autoScrollMode","normalizeAutoScroll","isPinToBottomMode","isPinToSendMode","effectiveKeyboardHeight","resolvedInputValue","hasSuggestions","hasAttachments","forwardedMessageViewSlotNames","shouldShowWelcomeScreen","messagePaddingBottom","showScrollToBottomButton","inputResizeObserver","contentResizeObserver","attachInputOverlayObserver","wasAtBottom","measured","syncInputContainerHeight","updateIsAtBottom","scrollToBottom","attachScrollContentObserver","distance","behavior","handleScroll","handleInputValueChange","handleSubmitMessage","handleStop","handleAddFile","handleStartTranscribe","handleCancelTranscribe","handleFinishTranscribeWithAudio","inputEventProps","listeners","canStop","canAddFile","canTranscribe","CopilotChatAttachmentQueue","CopilotChatInput","CopilotChatSuggestionView","CopilotChatMessageView","useInspectorThreadOverride","restoreOverride","nextThreadId","emitInspectorActiveThread","failInspectorOverride","requestId","emitInspectorViewThreadResult","isInspectorThreadBridgeEnabled","offView","onInspectorViewThread","offStop","onInspectorStopViewing","baseThreadId","instancesByApp","CopilotKitStyles","appContext","getCurrentInstance","instances","add","remove","instance","onDeactivated","onActivated","rendersTag","nonce","stylesheet","existingConfig","forwardedChatViewSlotNames","generatedThreadId","transcribeMode","transcriptionError","isTranscribing","isUnmounting","activeConnectCycle","lastConnectCycle","detachPromises","pendingTeardown","baselineThreadIds","providedThreadId","baseHasExplicitThreadId","inspectorThreadId","inspectorRequestId","hasExplicitThreadId","lastConnectedThreadId","isConnecting","resolvedLabels","chatLabels","autoSuggestions","license","isChatLicensed","licensed","isTranscriptionEnabled","isMediaRecorderSupported","showTranscription","attachmentsEnabled","attachmentContainerRef","effectiveMode","runLifecycleTick","shouldAllowStop","lastUserMessageId","prevLastUserMessageId","lastUserMessageState","inheritedThreadId","previousValues","onError","CopilotKitCoreErrorCode","isExplicit","previousCycle","abstractAgentPrototype","AbstractAgent","inspectableAgent","hasCustomConnect","hasCustomConnectAgent","existingCycle","hasSameDeps","cycle","connectAbortController","AGUIConnectNotImplementedError","cb","activeCycle","detach","lastFreshSelection","selection","resetPending","discardedThreadId","clearCursor","clearDiscardedBaseline","finishReset","runCurrentAgent","readyAttachments","contentParts","createAttachmentContent","stopCurrentRun","abortError","handleInputChange","ɵtranscribeAudio","trimmedPrevious","TranscriptionError","ɵtranscriptionErrorMessageKey","chatViewSlotProps","defaultChatViewBindings","CopilotChatConfigurationProvider","InlineFeatureWarning","CopilotChatView","bindThreadStoreSelector","store","onScopeDispose","useThreads","ɵcreateThreadStore","resolvedIncludeArchived","resolvedLimit","resolvedEnabled","threadListEndpointSupported","threadMutationsSupported","threadEndpointsUnavailable","threadEndpointsError","threadMutationsError","headersKey","threads","storeIsLoading","storeError","fetchMoreError","hasMoreThreads","isFetchingMoreThreads","isMutating","ɵselectThreads","ɵselectThreadsIsLoading","ɵselectThreadsError","ɵselectFetchMoreError","ɵselectHasNextPage","ɵselectIsFetchingNextPage","ɵselectIsMutating","hasDispatchedContext","runtimeStatus","wsUrl","includeArchived","limit","listEndpointSupported","runtimeError","preConnectLoading","listError","guardMutation","mutation","archived","createdAt","updatedAt","lastRunAt","CHAT_INPUT_TESTID","CHAT_CONTAINER_TESTID","licensePending","activeThreadId","localDrawerOpen","drawerOpen","setDrawerOpen","threadsApi","toDrawerThread","drawerThreads","elementTag","elRef","unregisterDrawer","findChatInput","scoped","focusChatInput","onThreadSelected","handleNewThread","onArchive","onUnarchive","onDelete","wasActive","onFilterChange","onCollapseChange","collapsed","onRetry","onLoadMore","onOpenChange","handleLicensed","CopilotChatToggleButtonCloseIcon","className","CopilotChatToggleButtonOpenIcon","iconClass","iconWrapperBase","fallbackOpen","buttonAttrs","_onClick","iconTransitionStyle","setModalOpen","getClickListeners","listener","handleClick","CopilotModalHeaderCloseButton","CopilotModalHeaderTitle","resolvedTitle","headerClass","headerAttrs","handleClose","isMobile","stopWatchingMobile","ɵwatchMobileViewport","mobile","showDrawerLauncher","toggleDrawer","ownSlots","DEFAULT_POPUP_WIDTH","DEFAULT_POPUP_HEIGHT","POPUP_ANIMATION_MS","OWN_SLOTS","isRendered","isAnimatingOut","animationTimer","focusTimer","isPopupOpen","headerTitle","popupAnimationClass","popupStyle","dimensionToCss","fallback","closePopup","openPopup","togglePopup","chatViewEventProps","chatViewBindings","handleKeyDown","allowClose","handlePointerDown","CopilotChatToggleButton","CopilotModalHeader","internalProps","_defaultOpen","forwardedEventListeners","internalBindings","CopilotPopupViewInternal","inputSlotProps","suggestionViewSlotProps","layoutSlotProps","DEFAULT_SIDEBAR_WIDTH","SIDEBAR_TRANSITION_MS","sidebarRef","measuredSidebarWidth","isSidebarOpen","resolvedSidebarWidth","asideClass","asideAttrs","asideStyle","widthToCss","bodyMarginStyle","margin","widthToMargin","updateMeasuredWidth","nextWidth","closeSidebar","openSidebar","toggleSidebar","CopilotSidebarViewInternal","popupViewEventBindings","isPopupLicensed","CopilotChat","$emit","CopilotPopupView","welcomeScreenProps","CopilotPopupWelcomeScreen","suggestionViewProps","inputProps","forwardedProps","sidebarViewEventBindings","isSidebarLicensed","CopilotSidebarView","CopilotSidebarWelcomeScreen","_CopilotChat","_CopilotChatView","_CopilotChatToggleButton","_CopilotModalHeader","_CopilotPopupView","_CopilotSidebarView","useAgentContext","resolvedDescription","resolvedValue","stringValue","EMPTY_DEPS","useFrontendTool","deps","extraDeps","useComponent","fullDescription","RenderComponent","useRenderTool","renderTool","warnedUnknownStatuses","mapToolCallStatus","adaptRendererProps","parameters","rawStatus","safeStringifyForPre","innerErr","DefaultToolCallRenderer","groupContext","group","safeStringifyForAttr","isActive","statusLabel","tone","useDefaultRenderTool","userRender","registeredRender","rawProps","adapted","userComponent","useHumanInTheLoop","resolvePromiseRef","rejectPromiseRef","cleanupAbortRef","respond","frontendTool","rejectPending","isDynamicConfig","normalizeStaticSuggestions","useConfigureSuggestions","resolvedConsumerAgentId","rawConsumerAgentId","normalizedConfig","normalizedSuggestions","serializedConfig","targetAgentId","consumer","isGlobalConfig","pendingGlobalReload","pendingReloadTimer","previousSerializedConfig","flushPendingGlobalReload","requestReload","skippedBecauseRunning","agents","aid","_core","cfg","_vals","global","agentSubscriptions","INTERRUPT_EVENT_NAME","isPromiseLike","normalizeAsyncResult","toLegacyEvent","useInterrupt","responses","resolvedAgent","_previousAgent","localLegacy","localStandard","submitStandardIfComplete","interrupts","expired","isInterruptExpired","resume","buildResumeArray","interruptId","interruptEventValue","cancel","resolveInterrupt","cancelInterrupt","currentPending","legacyEvent","handler","cancelled","maybePromise","resolved","interrupt","nextSlotProps","shouldRenderInChat","publishedState","useCapabilities","useRenderCustomMessages","configValue","customMessageRenderers","messagesIdsInRun","useRenderActivityMessage","findRenderer","matches","renderActivityMessage"],"mappings":"gpCAIA,IAAIA,IAA4B,SAASA,EAAW,CACnD,OAAAA,EAAU,mBAAwB,qBAClCA,EAAU,qBAA0B,uBACpCA,EAAU,iBAAsB,mBAChCA,EAAU,mBAAwB,qBAClCA,EAAU,gBAAqB,kBAC/BA,EAAU,eAAoB,iBAC9BA,EAAU,cAAmB,gBAC7BA,EAAU,gBAAqB,kBAC/BA,EAAU,iBAAsB,mBAChCA,EAAU,eAAoB,iBAC9BA,EAAU,YAAiB,cAC3BA,EAAU,kBAAuB,oBACjCA,EAAU,kB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