@invect/ui 0.0.1
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/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/Invect-CWpIwZ5F.js +92738 -0
- package/dist/Invect.d.ts +25 -0
- package/dist/InvectShell.d.ts +14 -0
- package/dist/api/agent-tools.api.d.ts +1 -0
- package/dist/api/client.d.ts +207 -0
- package/dist/api/credentials.api.d.ts +47 -0
- package/dist/api/executions.api.d.ts +43 -0
- package/dist/api/flows.api.d.ts +100 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/node-data.api.d.ts +66 -0
- package/dist/api/query-keys.d.ts +22 -0
- package/dist/api/triggers.api.d.ts +44 -0
- package/dist/api/types.d.ts +147 -0
- package/dist/api/use-flow-run-stream.d.ts +12 -0
- package/dist/assets/invect-branding.d.ts +4 -0
- package/dist/assets/provider-icons/index.d.ts +8 -0
- package/dist/babel-C9OtljFZ.js +9721 -0
- package/dist/components/PageLayout.d.ts +17 -0
- package/dist/components/chat/ChatInput.d.ts +17 -0
- package/dist/components/chat/ChatMessageList.d.ts +14 -0
- package/dist/components/chat/ChatModelSelector.d.ts +11 -0
- package/dist/components/chat/ChatPanel.d.ts +19 -0
- package/dist/components/chat/ChatPromptOverlay.d.ts +13 -0
- package/dist/components/chat/ChatProviderSelector.d.ts +9 -0
- package/dist/components/chat/ChatSettingsPanel.d.ts +11 -0
- package/dist/components/chat/InlineCredentialSetup.d.ts +9 -0
- package/dist/components/chat/MarkdownRenderer.d.ts +7 -0
- package/dist/components/chat/chat-memory.d.ts +21 -0
- package/dist/components/chat/chat.store.d.ts +416 -0
- package/dist/components/chat/index.d.ts +5 -0
- package/dist/components/chat/use-chat.d.ts +28 -0
- package/dist/components/credentials/CreateCredentialModal.d.ts +13 -0
- package/dist/components/credentials/CredentialDetailDialog.d.ts +17 -0
- package/dist/components/credentials/EditCredentialModal.d.ts +11 -0
- package/dist/components/credentials/OAuth2ConnectButton.d.ts +38 -0
- package/dist/components/credentials/OAuth2ProviderSelector.d.ts +15 -0
- package/dist/components/credentials/credential-utils.d.ts +12 -0
- package/dist/components/credentials/index.d.ts +9 -0
- package/dist/components/dashboard/FailedRunsAlert.d.ts +3 -0
- package/dist/components/dashboard/FlowCard.d.ts +7 -0
- package/dist/components/dashboard/RecentActivityTable.d.ts +9 -0
- package/dist/components/dashboard/StatCard.d.ts +10 -0
- package/dist/components/dashboard/index.d.ts +5 -0
- package/dist/components/dashboard/status-helpers.d.ts +5 -0
- package/dist/components/flow-editor/ActionsSidebar.d.ts +2 -0
- package/dist/components/flow-editor/FlowEditor.d.ts +21 -0
- package/dist/components/flow-editor/FlowHeader.d.ts +9 -0
- package/dist/components/flow-editor/FlowLayout.d.ts +24 -0
- package/dist/components/flow-editor/ModeSwitcher.d.ts +7 -0
- package/dist/components/flow-editor/NodeSidebar.d.ts +24 -0
- package/dist/components/flow-editor/RunControls.d.ts +12 -0
- package/dist/components/flow-editor/ToolConfigPanel.d.ts +16 -0
- package/dist/components/flow-editor/ValidationPanel.d.ts +5 -0
- package/dist/components/flow-editor/flow-editor.store.d.ts +1 -0
- package/dist/components/flow-editor/index.d.ts +6 -0
- package/dist/components/flow-editor/inline-edit.d.ts +10 -0
- package/dist/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/CredentialCombobox.d.ts +21 -0
- package/dist/components/flow-editor/node-config-panel/CredentialsSection.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/DroppableInput.d.ts +20 -0
- package/dist/components/flow-editor/node-config-panel/DynamicSelectField.d.ts +22 -0
- package/dist/components/flow-editor/node-config-panel/JsonPreviewPanel.d.ts +25 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanel.d.ts +14 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanelHeader.d.ts +15 -0
- package/dist/components/flow-editor/node-config-panel/ParametersSection.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/SearchableSelectField.d.ts +17 -0
- package/dist/components/flow-editor/node-config-panel/SwitchCasesField.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/hooks/index.d.ts +2 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.d.ts +24 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-execution.d.ts +46 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-upstream-slots.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/panels/AgentToolsPanel.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/panels/ConfigurationPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/DataMapperPane.d.ts +40 -0
- package/dist/components/flow-editor/node-config-panel/panels/InputPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/OutputPanel.d.ts +7 -0
- package/dist/components/flow-editor/node-config-panel/panels/index.d.ts +4 -0
- package/dist/components/flow-editor/node-config-panel/types.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-panel-store.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-state.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/use-run-node.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/utils.d.ts +9 -0
- package/dist/components/flow-editor/serialize-to-sdk.d.ts +20 -0
- package/dist/components/flow-editor/toolbar-context.d.ts +2 -0
- package/dist/components/flow-editor/use-copy-paste.d.ts +7 -0
- package/dist/components/flow-editor/use-copy-paste.types.d.ts +38 -0
- package/dist/components/flow-editor/use-flow-editor.d.ts +44 -0
- package/dist/components/flow-runs-table/FlowRunsTable.d.ts +6 -0
- package/dist/components/flow-runs-table/index.d.ts +1 -0
- package/dist/components/flow-viewer/FlowRunsView.d.ts +7 -0
- package/dist/components/flow-viewer/FlowStatusView.d.ts +21 -0
- package/dist/components/flow-viewer/RunSelector.d.ts +13 -0
- package/dist/components/flow-viewer/RunsSidebar.d.ts +14 -0
- package/dist/components/flow-viewer/agent-tool-executions-list.d.ts +7 -0
- package/dist/components/flow-viewer/index.d.ts +1 -0
- package/dist/components/flow-viewer/logs-panel.d.ts +18 -0
- package/dist/components/flow-viewer/use-execution-log-data.d.ts +113 -0
- package/dist/components/graph/BatchFlowEdge.d.ts +33 -0
- package/dist/components/graph/LayoutSelector.d.ts +9 -0
- package/dist/components/graph/index.d.ts +47 -0
- package/dist/components/graph/styleUtils.d.ts +124 -0
- package/dist/components/nodes/AgentConfigPanel.d.ts +24 -0
- package/dist/components/nodes/AgentNode.d.ts +8 -0
- package/dist/components/nodes/AgentToolsBox.d.ts +41 -0
- package/dist/components/nodes/NodeAppendix.d.ts +19 -0
- package/dist/components/nodes/NodeStatusIndicator.d.ts +30 -0
- package/dist/components/nodes/NodeViewContext.d.ts +18 -0
- package/dist/components/nodes/ToolParamField.d.ts +28 -0
- package/dist/components/nodes/ToolSelectorModal.d.ts +80 -0
- package/dist/components/nodes/ToolSelectorParts.d.ts +30 -0
- package/dist/components/nodes/UniversalNode.d.ts +2 -0
- package/dist/components/nodes/createContextAwareNodes.d.ts +6 -0
- package/dist/components/nodes/index.d.ts +22 -0
- package/dist/components/nodes/nodeRegistry.d.ts +13 -0
- package/dist/components/nodes/withNodeContext.d.ts +7 -0
- package/dist/components/shared/InvectLoader.d.ts +8 -0
- package/dist/components/shared/InvectLogo.d.ts +9 -0
- package/dist/components/shared/ProviderIcon.d.ts +23 -0
- package/dist/components/side-menu/side-menu.d.ts +4 -0
- package/dist/components/sidebar/BaseSidebar.d.ts +17 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/triggers/CronPreview.d.ts +12 -0
- package/dist/components/triggers/index.d.ts +1 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/codemirror-js-editor.d.ts +25 -0
- package/dist/components/ui/codemirror-json-editor.d.ts +18 -0
- package/dist/components/ui/codemirror-nunjucks-editor.d.ts +13 -0
- package/dist/components/ui/codemirror-vscode-theme.d.ts +24 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/empty-state.d.ts +21 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +3 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tree-view.d.ts +107 -0
- package/dist/contexts/AgentToolCallbacksContext.d.ts +23 -0
- package/dist/contexts/ApiContext.d.ts +11 -0
- package/dist/contexts/FlowDataContext.d.ts +9 -0
- package/dist/contexts/NodeRegistryContext.d.ts +14 -0
- package/dist/contexts/PluginRegistryContext.d.ts +39 -0
- package/dist/contexts/ThemeProvider.d.ts +18 -0
- package/dist/contexts/ValidationContext.d.ts +22 -0
- package/dist/demo/DemoInvect.d.ts +11 -0
- package/dist/demo/FlowViewer.d.ts +31 -0
- package/dist/demo/demo-api-client.d.ts +33 -0
- package/dist/demo/index.d.ts +6 -0
- package/dist/demo/sample-data.d.ts +1538 -0
- package/dist/demo.d.ts +2 -0
- package/dist/demo.js +2774 -0
- package/dist/estree-ClbRfS-1.js +7076 -0
- package/dist/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-document-title.d.ts +1 -0
- package/dist/hooks/use-flow-data.d.ts +22 -0
- package/dist/hooks/use-invect-portal-class.d.ts +21 -0
- package/dist/hooks/useFlowEditorStore.d.ts +1 -0
- package/dist/index.css +3 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +717 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/prettier.d.ts +13 -0
- package/dist/routes/all-flow-runs.d.ts +5 -0
- package/dist/routes/credentials.d.ts +5 -0
- package/dist/routes/flow-route-layout.d.ts +19 -0
- package/dist/routes/flow-runs.d.ts +5 -0
- package/dist/routes/flow.d.ts +5 -0
- package/dist/routes/home.d.ts +5 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/standalone-C3Df7W52.js +3463 -0
- package/dist/stores/executionViewStore.d.ts +64 -0
- package/dist/stores/flow-editor.store.d.ts +137 -0
- package/dist/stores/flowEditorStore.d.ts +1 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/uiStore.d.ts +45 -0
- package/dist/types/agent-tools.types.d.ts +53 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/node-definition.types.d.ts +85 -0
- package/dist/types/plugin.types.d.ts +100 -0
- package/dist/utils/credentialBranding.d.ts +8 -0
- package/dist/utils/credentialFiltering.d.ts +20 -0
- package/dist/utils/flowTransformations.d.ts +16 -0
- package/dist/utils/layoutUtils.d.ts +23 -0
- package/dist/utils/nodeReferenceUtils.d.ts +37 -0
- package/dist/vendor.d.ts +5 -0
- package/package.json +130 -0
- package/src/.DS_Store +0 -0
- package/src/Invect.tsx +229 -0
- package/src/InvectShell.tsx +55 -0
- package/src/api/agent-tools.api.ts +23 -0
- package/src/api/client.ts +899 -0
- package/src/api/credentials.api.ts +197 -0
- package/src/api/executions.api.ts +228 -0
- package/src/api/flows.api.ts +195 -0
- package/src/api/index.ts +17 -0
- package/src/api/node-data.api.ts +167 -0
- package/src/api/query-keys.ts +44 -0
- package/src/api/triggers.api.ts +120 -0
- package/src/api/types.ts +212 -0
- package/src/api/use-flow-run-stream.ts +206 -0
- package/src/app.css +560 -0
- package/src/assets/.DS_Store +0 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/src/assets/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/src/assets/invect-branding.ts +51 -0
- package/src/assets/provider-icons/anthropic.svg +1 -0
- package/src/assets/provider-icons/anthropic_light.svg +1 -0
- package/src/assets/provider-icons/github.svg +1 -0
- package/src/assets/provider-icons/github_light.svg +1 -0
- package/src/assets/provider-icons/gmail.svg +1 -0
- package/src/assets/provider-icons/google_calendar.svg +1 -0
- package/src/assets/provider-icons/google_docs.svg +1 -0
- package/src/assets/provider-icons/google_drive.svg +1 -0
- package/src/assets/provider-icons/google_sheets.svg +1 -0
- package/src/assets/provider-icons/index.ts +55 -0
- package/src/assets/provider-icons/linear.svg +1 -0
- package/src/assets/provider-icons/openai.svg +1 -0
- package/src/assets/provider-icons/postgres.svg +1 -0
- package/src/assets/provider-icons/slack.svg +1 -0
- package/src/assets/small-loader-dark.svg +22 -0
- package/src/assets/small-loader-light.svg +22 -0
- package/src/assets/small.svg +7 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/PageLayout.tsx +55 -0
- package/src/components/chat/ChatInput.tsx +115 -0
- package/src/components/chat/ChatMessageList.tsx +788 -0
- package/src/components/chat/ChatModelSelector.tsx +208 -0
- package/src/components/chat/ChatPanel.tsx +243 -0
- package/src/components/chat/ChatPromptOverlay.tsx +150 -0
- package/src/components/chat/ChatProviderSelector.tsx +135 -0
- package/src/components/chat/ChatSettingsPanel.tsx +277 -0
- package/src/components/chat/InlineCredentialSetup.tsx +343 -0
- package/src/components/chat/MarkdownRenderer.tsx +140 -0
- package/src/components/chat/chat-memory.ts +88 -0
- package/src/components/chat/chat.store.ts +479 -0
- package/src/components/chat/index.ts +5 -0
- package/src/components/chat/use-chat.ts +473 -0
- package/src/components/credentials/CreateCredentialModal.tsx +609 -0
- package/src/components/credentials/CredentialDetailDialog.tsx +882 -0
- package/src/components/credentials/EditCredentialModal.tsx +399 -0
- package/src/components/credentials/OAuth2ConnectButton.tsx +288 -0
- package/src/components/credentials/OAuth2ProviderSelector.tsx +360 -0
- package/src/components/credentials/credential-utils.ts +99 -0
- package/src/components/credentials/index.ts +10 -0
- package/src/components/dashboard/FailedRunsAlert.tsx +67 -0
- package/src/components/dashboard/FlowCard.tsx +64 -0
- package/src/components/dashboard/RecentActivityTable.tsx +92 -0
- package/src/components/dashboard/StatCard.tsx +32 -0
- package/src/components/dashboard/index.ts +5 -0
- package/src/components/dashboard/status-helpers.tsx +102 -0
- package/src/components/flow-editor/ActionsSidebar.tsx +503 -0
- package/src/components/flow-editor/FlowEditor.tsx +1002 -0
- package/src/components/flow-editor/FlowHeader.tsx +87 -0
- package/src/components/flow-editor/FlowLayout.tsx +117 -0
- package/src/components/flow-editor/ModeSwitcher.tsx +49 -0
- package/src/components/flow-editor/NodeSidebar.tsx +343 -0
- package/src/components/flow-editor/RunControls.tsx +109 -0
- package/src/components/flow-editor/ToolConfigPanel.tsx +434 -0
- package/src/components/flow-editor/ValidationPanel.tsx +167 -0
- package/src/components/flow-editor/flow-editor.store.ts +2 -0
- package/src/components/flow-editor/index.ts +6 -0
- package/src/components/flow-editor/inline-edit.tsx +111 -0
- package/src/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.tsx +334 -0
- package/src/components/flow-editor/node-config-panel/CredentialCombobox.tsx +217 -0
- package/src/components/flow-editor/node-config-panel/CredentialsSection.tsx +154 -0
- package/src/components/flow-editor/node-config-panel/DroppableInput.tsx +45 -0
- package/src/components/flow-editor/node-config-panel/DynamicSelectField.tsx +223 -0
- package/src/components/flow-editor/node-config-panel/JsonPreviewPanel.tsx +134 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanel.tsx +650 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanelHeader.tsx +91 -0
- package/src/components/flow-editor/node-config-panel/ParametersSection.tsx +144 -0
- package/src/components/flow-editor/node-config-panel/SearchableSelectField.tsx +126 -0
- package/src/components/flow-editor/node-config-panel/SwitchCasesField.tsx +212 -0
- package/src/components/flow-editor/node-config-panel/hooks/index.ts +2 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.ts +284 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-execution.ts +287 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-upstream-slots.ts +310 -0
- package/src/components/flow-editor/node-config-panel/panels/AgentToolsPanel.tsx +837 -0
- package/src/components/flow-editor/node-config-panel/panels/ConfigurationPanel.tsx +383 -0
- package/src/components/flow-editor/node-config-panel/panels/DataMapperPane.tsx +456 -0
- package/src/components/flow-editor/node-config-panel/panels/InputPanel.tsx +338 -0
- package/src/components/flow-editor/node-config-panel/panels/OutputPanel.tsx +109 -0
- package/src/components/flow-editor/node-config-panel/panels/index.ts +4 -0
- package/src/components/flow-editor/node-config-panel/types.ts +20 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-panel-store.ts +283 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-state.ts +172 -0
- package/src/components/flow-editor/node-config-panel/use-run-node.ts +147 -0
- package/src/components/flow-editor/node-config-panel/utils.ts +73 -0
- package/src/components/flow-editor/serialize-to-sdk.ts +204 -0
- package/src/components/flow-editor/toolbar-context.ts +9 -0
- package/src/components/flow-editor/use-copy-paste.ts +575 -0
- package/src/components/flow-editor/use-copy-paste.types.ts +35 -0
- package/src/components/flow-editor/use-flow-editor.ts +241 -0
- package/src/components/flow-runs-table/FlowRunsTable.tsx +631 -0
- package/src/components/flow-runs-table/index.ts +1 -0
- package/src/components/flow-viewer/FlowRunsView.tsx +268 -0
- package/src/components/flow-viewer/FlowStatusView.tsx +351 -0
- package/src/components/flow-viewer/RunSelector.tsx +422 -0
- package/src/components/flow-viewer/RunsSidebar.tsx +125 -0
- package/src/components/flow-viewer/agent-tool-executions-list.tsx +298 -0
- package/src/components/flow-viewer/index.ts +1 -0
- package/src/components/flow-viewer/logs-panel.tsx +567 -0
- package/src/components/flow-viewer/use-execution-log-data.ts +374 -0
- package/src/components/graph/BatchFlowEdge.tsx +229 -0
- package/src/components/graph/LayoutSelector.tsx +42 -0
- package/src/components/graph/index.ts +61 -0
- package/src/components/graph/styleUtils.ts +375 -0
- package/src/components/nodes/.DS_Store +0 -0
- package/src/components/nodes/AgentConfigPanel.tsx +1033 -0
- package/src/components/nodes/AgentNode.tsx +298 -0
- package/src/components/nodes/AgentToolsBox.tsx +193 -0
- package/src/components/nodes/NodeAppendix.tsx +98 -0
- package/src/components/nodes/NodeStatusIndicator.tsx +74 -0
- package/src/components/nodes/NodeViewContext.tsx +45 -0
- package/src/components/nodes/ToolParamField.tsx +282 -0
- package/src/components/nodes/ToolSelectorModal.tsx +648 -0
- package/src/components/nodes/ToolSelectorParts.tsx +505 -0
- package/src/components/nodes/UniversalNode.tsx +356 -0
- package/src/components/nodes/createContextAwareNodes.ts +19 -0
- package/src/components/nodes/index.ts +45 -0
- package/src/components/nodes/nodeRegistry.ts +50 -0
- package/src/components/nodes/withNodeContext.tsx +55 -0
- package/src/components/shared/InvectLoader.tsx +59 -0
- package/src/components/shared/InvectLogo.tsx +59 -0
- package/src/components/shared/ProviderIcon.tsx +115 -0
- package/src/components/side-menu/side-menu.tsx +267 -0
- package/src/components/sidebar/BaseSidebar.tsx +148 -0
- package/src/components/sidebar/index.ts +1 -0
- package/src/components/triggers/CronPreview.tsx +243 -0
- package/src/components/triggers/index.ts +1 -0
- package/src/components/ui/alert-dialog.tsx +152 -0
- package/src/components/ui/badge.tsx +39 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +75 -0
- package/src/components/ui/codemirror-js-editor.tsx +432 -0
- package/src/components/ui/codemirror-json-editor.tsx +816 -0
- package/src/components/ui/codemirror-nunjucks-editor.tsx +451 -0
- package/src/components/ui/codemirror-vscode-theme.ts +243 -0
- package/src/components/ui/collapsible.tsx +12 -0
- package/src/components/ui/command.tsx +162 -0
- package/src/components/ui/dialog.tsx +140 -0
- package/src/components/ui/dropdown-menu.tsx +232 -0
- package/src/components/ui/empty-state.tsx +93 -0
- package/src/components/ui/input.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/popover.tsx +53 -0
- package/src/components/ui/resizable.tsx +61 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +179 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/slider.tsx +58 -0
- package/src/components/ui/switch.tsx +22 -0
- package/src/components/ui/table.tsx +90 -0
- package/src/components/ui/textarea.tsx +23 -0
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/components/ui/tree-view.tsx +574 -0
- package/src/contexts/AgentToolCallbacksContext.tsx +31 -0
- package/src/contexts/ApiContext.tsx +51 -0
- package/src/contexts/FlowDataContext.tsx +21 -0
- package/src/contexts/NodeRegistryContext.tsx +54 -0
- package/src/contexts/PluginRegistryContext.tsx +182 -0
- package/src/contexts/ThemeProvider.tsx +106 -0
- package/src/contexts/ValidationContext.tsx +122 -0
- package/src/demo/DemoInvect.tsx +42 -0
- package/src/demo/FlowViewer.tsx +294 -0
- package/src/demo/demo-api-client.ts +246 -0
- package/src/demo/index.ts +28 -0
- package/src/demo/sample-data.ts +1980 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-document-title.ts +8 -0
- package/src/hooks/use-flow-data.ts +144 -0
- package/src/hooks/use-invect-portal-class.ts +27 -0
- package/src/hooks/useFlowEditorStore.ts +2 -0
- package/src/index.ts +70 -0
- package/src/lib/utils.ts +6 -0
- package/src/prettier.d.ts +13 -0
- package/src/routes/all-flow-runs.tsx +27 -0
- package/src/routes/credentials.tsx +362 -0
- package/src/routes/flow-route-layout.tsx +113 -0
- package/src/routes/flow-runs.tsx +22 -0
- package/src/routes/flow.tsx +22 -0
- package/src/routes/home.tsx +282 -0
- package/src/services/index.ts +6 -0
- package/src/stores/executionViewStore.ts +211 -0
- package/src/stores/flow-editor.store.ts +738 -0
- package/src/stores/flowEditorStore.ts +2 -0
- package/src/stores/index.ts +10 -0
- package/src/stores/uiStore.ts +189 -0
- package/src/types/agent-tools.types.ts +64 -0
- package/src/types/index.ts +5 -0
- package/src/types/node-definition.types.ts +104 -0
- package/src/types/plugin.types.ts +123 -0
- package/src/utils/credentialBranding.ts +116 -0
- package/src/utils/credentialFiltering.ts +68 -0
- package/src/utils/flowTransformations.ts +137 -0
- package/src/utils/layoutUtils.ts +127 -0
- package/src/utils/nodeReferenceUtils.ts +135 -0
- package/src/vendor.d.ts +7 -0
|
@@ -0,0 +1,3463 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region ../../node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/standalone.mjs
|
|
3
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), s = (e, n) => {
|
|
4
|
+
for (var r in n) t(e, r, {
|
|
5
|
+
get: n[r],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
}, c = (e, i, o, s) => {
|
|
9
|
+
if (i && typeof i == "object" || typeof i == "function") for (let c of r(i)) !a.call(e, c) && c !== o && t(e, c, {
|
|
10
|
+
get: () => i[c],
|
|
11
|
+
enumerable: !(s = n(i, c)) || s.enumerable
|
|
12
|
+
});
|
|
13
|
+
return e;
|
|
14
|
+
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
15
|
+
value: n,
|
|
16
|
+
enumerable: !0
|
|
17
|
+
}) : a, n)), u = o((e, t) => {
|
|
18
|
+
var n, r, i, a, o, s, c, l, u, d, f, p, m = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]|[^\/\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy, h, g, _, v, y, ee;
|
|
19
|
+
p = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y, n = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy, g = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y, f = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y, _ = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y, ee = /[\t\v\f\ufeff\p{Zs}]+/uy, l = /\r?\n|[\r\u2028\u2029]/y, u = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y, h = /\/\/.*/y, i = /[<>.:={}]|\/(?![\/*])/y, r = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy, a = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y, o = /[^<>{}]+/y, y = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/, v = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/, s = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/, c = /^(?:return|throw|yield)$/, d = RegExp(l.source), t.exports = function* (e, { jsx: t = !1 } = {}) {
|
|
20
|
+
var b, x, te, S, C, ne, w, T, re, E, ie, D, O, k;
|
|
21
|
+
for ({length: ne} = e, S = 0, C = "", k = [{ tag: "JS" }], b = [], ie = 0, D = !1; S < ne;) {
|
|
22
|
+
switch (T = k[k.length - 1], T.tag) {
|
|
23
|
+
case "JS":
|
|
24
|
+
case "JSNonExpressionParen":
|
|
25
|
+
case "InterpolationInTemplate":
|
|
26
|
+
case "InterpolationInJSX":
|
|
27
|
+
if (e[S] === "/" && (y.test(C) || s.test(C)) && (m.lastIndex = S, w = m.exec(e))) {
|
|
28
|
+
S = m.lastIndex, C = w[0], D = !0, yield {
|
|
29
|
+
type: "RegularExpressionLiteral",
|
|
30
|
+
value: w[0],
|
|
31
|
+
closed: w[1] !== void 0 && w[1] !== "\\"
|
|
32
|
+
};
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (p.lastIndex = S, w = p.exec(e)) {
|
|
36
|
+
switch (O = w[0], re = p.lastIndex, E = O, O) {
|
|
37
|
+
case "(":
|
|
38
|
+
C === "?NonExpressionParenKeyword" && k.push({
|
|
39
|
+
tag: "JSNonExpressionParen",
|
|
40
|
+
nesting: ie
|
|
41
|
+
}), ie++, D = !1;
|
|
42
|
+
break;
|
|
43
|
+
case ")":
|
|
44
|
+
ie--, D = !0, T.tag === "JSNonExpressionParen" && ie === T.nesting && (k.pop(), E = "?NonExpressionParenEnd", D = !1);
|
|
45
|
+
break;
|
|
46
|
+
case "{":
|
|
47
|
+
p.lastIndex = 0, te = !v.test(C) && (y.test(C) || s.test(C)), b.push(te), D = !1;
|
|
48
|
+
break;
|
|
49
|
+
case "}":
|
|
50
|
+
switch (T.tag) {
|
|
51
|
+
case "InterpolationInTemplate":
|
|
52
|
+
if (b.length === T.nesting) {
|
|
53
|
+
_.lastIndex = S, w = _.exec(e), S = _.lastIndex, C = w[0], w[1] === "${" ? (C = "?InterpolationInTemplate", D = !1, yield {
|
|
54
|
+
type: "TemplateMiddle",
|
|
55
|
+
value: w[0]
|
|
56
|
+
}) : (k.pop(), D = !0, yield {
|
|
57
|
+
type: "TemplateTail",
|
|
58
|
+
value: w[0],
|
|
59
|
+
closed: w[1] === "`"
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
case "InterpolationInJSX": if (b.length === T.nesting) {
|
|
65
|
+
k.pop(), S += 1, C = "}", yield {
|
|
66
|
+
type: "JSXPunctuator",
|
|
67
|
+
value: "}"
|
|
68
|
+
};
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
D = b.pop(), E = D ? "?ExpressionBraceEnd" : "}";
|
|
73
|
+
break;
|
|
74
|
+
case "]":
|
|
75
|
+
D = !0;
|
|
76
|
+
break;
|
|
77
|
+
case "++":
|
|
78
|
+
case "--":
|
|
79
|
+
E = D ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
80
|
+
break;
|
|
81
|
+
case "<":
|
|
82
|
+
if (t && (y.test(C) || s.test(C))) {
|
|
83
|
+
k.push({ tag: "JSXTag" }), S += 1, C = "<", yield {
|
|
84
|
+
type: "JSXPunctuator",
|
|
85
|
+
value: O
|
|
86
|
+
};
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
D = !1;
|
|
90
|
+
break;
|
|
91
|
+
default: D = !1;
|
|
92
|
+
}
|
|
93
|
+
S = re, C = E, yield {
|
|
94
|
+
type: "Punctuator",
|
|
95
|
+
value: O
|
|
96
|
+
};
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (n.lastIndex = S, w = n.exec(e)) {
|
|
100
|
+
switch (S = n.lastIndex, E = w[0], w[0]) {
|
|
101
|
+
case "for":
|
|
102
|
+
case "if":
|
|
103
|
+
case "while":
|
|
104
|
+
case "with": C !== "." && C !== "?." && (E = "?NonExpressionParenKeyword");
|
|
105
|
+
}
|
|
106
|
+
C = E, D = !s.test(w[0]), yield {
|
|
107
|
+
type: w[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
|
|
108
|
+
value: w[0]
|
|
109
|
+
};
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (g.lastIndex = S, w = g.exec(e)) {
|
|
113
|
+
S = g.lastIndex, C = w[0], D = !0, yield {
|
|
114
|
+
type: "StringLiteral",
|
|
115
|
+
value: w[0],
|
|
116
|
+
closed: w[2] !== void 0
|
|
117
|
+
};
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (f.lastIndex = S, w = f.exec(e)) {
|
|
121
|
+
S = f.lastIndex, C = w[0], D = !0, yield {
|
|
122
|
+
type: "NumericLiteral",
|
|
123
|
+
value: w[0]
|
|
124
|
+
};
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (_.lastIndex = S, w = _.exec(e)) {
|
|
128
|
+
S = _.lastIndex, C = w[0], w[1] === "${" ? (C = "?InterpolationInTemplate", k.push({
|
|
129
|
+
tag: "InterpolationInTemplate",
|
|
130
|
+
nesting: b.length
|
|
131
|
+
}), D = !1, yield {
|
|
132
|
+
type: "TemplateHead",
|
|
133
|
+
value: w[0]
|
|
134
|
+
}) : (D = !0, yield {
|
|
135
|
+
type: "NoSubstitutionTemplate",
|
|
136
|
+
value: w[0],
|
|
137
|
+
closed: w[1] === "`"
|
|
138
|
+
});
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
case "JSXTag":
|
|
143
|
+
case "JSXTagEnd":
|
|
144
|
+
if (i.lastIndex = S, w = i.exec(e)) {
|
|
145
|
+
switch (S = i.lastIndex, E = w[0], w[0]) {
|
|
146
|
+
case "<":
|
|
147
|
+
k.push({ tag: "JSXTag" });
|
|
148
|
+
break;
|
|
149
|
+
case ">":
|
|
150
|
+
k.pop(), C === "/" || T.tag === "JSXTagEnd" ? (E = "?JSX", D = !0) : k.push({ tag: "JSXChildren" });
|
|
151
|
+
break;
|
|
152
|
+
case "{":
|
|
153
|
+
k.push({
|
|
154
|
+
tag: "InterpolationInJSX",
|
|
155
|
+
nesting: b.length
|
|
156
|
+
}), E = "?InterpolationInJSX", D = !1;
|
|
157
|
+
break;
|
|
158
|
+
case "/": C === "<" && (k.pop(), k[k.length - 1].tag === "JSXChildren" && k.pop(), k.push({ tag: "JSXTagEnd" }));
|
|
159
|
+
}
|
|
160
|
+
C = E, yield {
|
|
161
|
+
type: "JSXPunctuator",
|
|
162
|
+
value: w[0]
|
|
163
|
+
};
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (r.lastIndex = S, w = r.exec(e)) {
|
|
167
|
+
S = r.lastIndex, C = w[0], yield {
|
|
168
|
+
type: "JSXIdentifier",
|
|
169
|
+
value: w[0]
|
|
170
|
+
};
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (a.lastIndex = S, w = a.exec(e)) {
|
|
174
|
+
S = a.lastIndex, C = w[0], yield {
|
|
175
|
+
type: "JSXString",
|
|
176
|
+
value: w[0],
|
|
177
|
+
closed: w[2] !== void 0
|
|
178
|
+
};
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
case "JSXChildren":
|
|
183
|
+
if (o.lastIndex = S, w = o.exec(e)) {
|
|
184
|
+
S = o.lastIndex, C = w[0], yield {
|
|
185
|
+
type: "JSXText",
|
|
186
|
+
value: w[0]
|
|
187
|
+
};
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
switch (e[S]) {
|
|
191
|
+
case "<":
|
|
192
|
+
k.push({ tag: "JSXTag" }), S++, C = "<", yield {
|
|
193
|
+
type: "JSXPunctuator",
|
|
194
|
+
value: "<"
|
|
195
|
+
};
|
|
196
|
+
continue;
|
|
197
|
+
case "{":
|
|
198
|
+
k.push({
|
|
199
|
+
tag: "InterpolationInJSX",
|
|
200
|
+
nesting: b.length
|
|
201
|
+
}), S++, C = "?InterpolationInJSX", D = !1, yield {
|
|
202
|
+
type: "JSXPunctuator",
|
|
203
|
+
value: "{"
|
|
204
|
+
};
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (ee.lastIndex = S, w = ee.exec(e)) {
|
|
209
|
+
S = ee.lastIndex, yield {
|
|
210
|
+
type: "WhiteSpace",
|
|
211
|
+
value: w[0]
|
|
212
|
+
};
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (l.lastIndex = S, w = l.exec(e)) {
|
|
216
|
+
S = l.lastIndex, D = !1, c.test(C) && (C = "?NoLineTerminatorHere"), yield {
|
|
217
|
+
type: "LineTerminatorSequence",
|
|
218
|
+
value: w[0]
|
|
219
|
+
};
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (u.lastIndex = S, w = u.exec(e)) {
|
|
223
|
+
S = u.lastIndex, d.test(w[0]) && (D = !1, c.test(C) && (C = "?NoLineTerminatorHere")), yield {
|
|
224
|
+
type: "MultiLineComment",
|
|
225
|
+
value: w[0],
|
|
226
|
+
closed: w[1] !== void 0
|
|
227
|
+
};
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (h.lastIndex = S, w = h.exec(e)) {
|
|
231
|
+
S = h.lastIndex, D = !1, yield {
|
|
232
|
+
type: "SingleLineComment",
|
|
233
|
+
value: w[0]
|
|
234
|
+
};
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
x = String.fromCodePoint(e.codePointAt(S)), S += x.length, C = x, D = !1, yield {
|
|
238
|
+
type: T.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
|
|
239
|
+
value: x
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
}), d = {};
|
|
244
|
+
s(d, {
|
|
245
|
+
__debug: () => Ya,
|
|
246
|
+
check: () => qa,
|
|
247
|
+
doc: () => oa,
|
|
248
|
+
format: () => Ka,
|
|
249
|
+
formatWithCursor: () => Ga,
|
|
250
|
+
getSupportInfo: () => Ja,
|
|
251
|
+
util: () => da,
|
|
252
|
+
version: () => ua
|
|
253
|
+
});
|
|
254
|
+
var f = (e, t) => (n, r, ...i) => n | 1 && r == null ? void 0 : (t.call(r) ?? r[e]).apply(r, i), p = String.prototype.replaceAll ?? function(e, t) {
|
|
255
|
+
return e.global ? this.replace(e, t) : this.split(e).join(t);
|
|
256
|
+
}, m = f("replaceAll", function() {
|
|
257
|
+
if (typeof this == "string") return p;
|
|
258
|
+
}), h = class {
|
|
259
|
+
diff(e, t, n = {}) {
|
|
260
|
+
let r;
|
|
261
|
+
typeof n == "function" ? (r = n, n = {}) : "callback" in n && (r = n.callback);
|
|
262
|
+
let i = this.castInput(e, n), a = this.castInput(t, n), o = this.removeEmpty(this.tokenize(i, n)), s = this.removeEmpty(this.tokenize(a, n));
|
|
263
|
+
return this.diffWithOptionsObj(o, s, n, r);
|
|
264
|
+
}
|
|
265
|
+
diffWithOptionsObj(e, t, n, r) {
|
|
266
|
+
let i = (e) => {
|
|
267
|
+
if (e = this.postProcess(e, n), r) {
|
|
268
|
+
setTimeout(function() {
|
|
269
|
+
r(e);
|
|
270
|
+
}, 0);
|
|
271
|
+
return;
|
|
272
|
+
} else return e;
|
|
273
|
+
}, a = t.length, o = e.length, s = 1, c = a + o;
|
|
274
|
+
n.maxEditLength != null && (c = Math.min(c, n.maxEditLength));
|
|
275
|
+
let l = n.timeout ?? Infinity, u = Date.now() + l, d = [{
|
|
276
|
+
oldPos: -1,
|
|
277
|
+
lastComponent: void 0
|
|
278
|
+
}], f = this.extractCommon(d[0], t, e, 0, n);
|
|
279
|
+
if (d[0].oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(d[0].lastComponent, t, e));
|
|
280
|
+
let p = -Infinity, m = Infinity, h = () => {
|
|
281
|
+
for (let r = Math.max(p, -s); r <= Math.min(m, s); r += 2) {
|
|
282
|
+
let s, c = d[r - 1], l = d[r + 1];
|
|
283
|
+
c && (d[r - 1] = void 0);
|
|
284
|
+
let u = !1;
|
|
285
|
+
if (l) {
|
|
286
|
+
let e = l.oldPos - r;
|
|
287
|
+
u = l && 0 <= e && e < a;
|
|
288
|
+
}
|
|
289
|
+
let h = c && c.oldPos + 1 < o;
|
|
290
|
+
if (!u && !h) {
|
|
291
|
+
d[r] = void 0;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (s = !h || u && c.oldPos < l.oldPos ? this.addToPath(l, !0, !1, 0, n) : this.addToPath(c, !1, !0, 1, n), f = this.extractCommon(s, t, e, r, n), s.oldPos + 1 >= o && f + 1 >= a) return i(this.buildValues(s.lastComponent, t, e)) || !0;
|
|
295
|
+
d[r] = s, s.oldPos + 1 >= o && (m = Math.min(m, r - 1)), f + 1 >= a && (p = Math.max(p, r + 1));
|
|
296
|
+
}
|
|
297
|
+
s++;
|
|
298
|
+
};
|
|
299
|
+
if (r) (function e() {
|
|
300
|
+
setTimeout(function() {
|
|
301
|
+
if (s > c || Date.now() > u) return r(void 0);
|
|
302
|
+
h() || e();
|
|
303
|
+
}, 0);
|
|
304
|
+
})();
|
|
305
|
+
else for (; s <= c && Date.now() <= u;) {
|
|
306
|
+
let e = h();
|
|
307
|
+
if (e) return e;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
addToPath(e, t, n, r, i) {
|
|
311
|
+
let a = e.lastComponent;
|
|
312
|
+
return a && !i.oneChangePerToken && a.added === t && a.removed === n ? {
|
|
313
|
+
oldPos: e.oldPos + r,
|
|
314
|
+
lastComponent: {
|
|
315
|
+
count: a.count + 1,
|
|
316
|
+
added: t,
|
|
317
|
+
removed: n,
|
|
318
|
+
previousComponent: a.previousComponent
|
|
319
|
+
}
|
|
320
|
+
} : {
|
|
321
|
+
oldPos: e.oldPos + r,
|
|
322
|
+
lastComponent: {
|
|
323
|
+
count: 1,
|
|
324
|
+
added: t,
|
|
325
|
+
removed: n,
|
|
326
|
+
previousComponent: a
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
extractCommon(e, t, n, r, i) {
|
|
331
|
+
let a = t.length, o = n.length, s = e.oldPos, c = s - r, l = 0;
|
|
332
|
+
for (; c + 1 < a && s + 1 < o && this.equals(n[s + 1], t[c + 1], i);) c++, s++, l++, i.oneChangePerToken && (e.lastComponent = {
|
|
333
|
+
count: 1,
|
|
334
|
+
previousComponent: e.lastComponent,
|
|
335
|
+
added: !1,
|
|
336
|
+
removed: !1
|
|
337
|
+
});
|
|
338
|
+
return l && !i.oneChangePerToken && (e.lastComponent = {
|
|
339
|
+
count: l,
|
|
340
|
+
previousComponent: e.lastComponent,
|
|
341
|
+
added: !1,
|
|
342
|
+
removed: !1
|
|
343
|
+
}), e.oldPos = s, c;
|
|
344
|
+
}
|
|
345
|
+
equals(e, t, n) {
|
|
346
|
+
return n.comparator ? n.comparator(e, t) : e === t || !!n.ignoreCase && e.toLowerCase() === t.toLowerCase();
|
|
347
|
+
}
|
|
348
|
+
removeEmpty(e) {
|
|
349
|
+
let t = [];
|
|
350
|
+
for (let n = 0; n < e.length; n++) e[n] && t.push(e[n]);
|
|
351
|
+
return t;
|
|
352
|
+
}
|
|
353
|
+
castInput(e, t) {
|
|
354
|
+
return e;
|
|
355
|
+
}
|
|
356
|
+
tokenize(e, t) {
|
|
357
|
+
return Array.from(e);
|
|
358
|
+
}
|
|
359
|
+
join(e) {
|
|
360
|
+
return e.join("");
|
|
361
|
+
}
|
|
362
|
+
postProcess(e, t) {
|
|
363
|
+
return e;
|
|
364
|
+
}
|
|
365
|
+
get useLongestToken() {
|
|
366
|
+
return !1;
|
|
367
|
+
}
|
|
368
|
+
buildValues(e, t, n) {
|
|
369
|
+
let r = [], i;
|
|
370
|
+
for (; e;) r.push(e), i = e.previousComponent, delete e.previousComponent, e = i;
|
|
371
|
+
r.reverse();
|
|
372
|
+
let a = r.length, o = 0, s = 0, c = 0;
|
|
373
|
+
for (; o < a; o++) {
|
|
374
|
+
let e = r[o];
|
|
375
|
+
if (e.removed) e.value = this.join(n.slice(c, c + e.count)), c += e.count;
|
|
376
|
+
else {
|
|
377
|
+
if (!e.added && this.useLongestToken) {
|
|
378
|
+
let r = t.slice(s, s + e.count);
|
|
379
|
+
r = r.map(function(e, t) {
|
|
380
|
+
let r = n[c + t];
|
|
381
|
+
return r.length > e.length ? r : e;
|
|
382
|
+
}), e.value = this.join(r);
|
|
383
|
+
} else e.value = this.join(t.slice(s, s + e.count));
|
|
384
|
+
s += e.count, e.added || (c += e.count);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return r;
|
|
388
|
+
}
|
|
389
|
+
}, g = new class extends h {
|
|
390
|
+
tokenize(e) {
|
|
391
|
+
return e.slice();
|
|
392
|
+
}
|
|
393
|
+
join(e) {
|
|
394
|
+
return e;
|
|
395
|
+
}
|
|
396
|
+
removeEmpty(e) {
|
|
397
|
+
return e;
|
|
398
|
+
}
|
|
399
|
+
}();
|
|
400
|
+
function _(e, t, n) {
|
|
401
|
+
return g.diff(e, t, n);
|
|
402
|
+
}
|
|
403
|
+
var v = () => {}, y = "cr", ee = "crlf", b = "lf", x = "\r", te = "\r\n", S = "\n", C = S;
|
|
404
|
+
function ne(e) {
|
|
405
|
+
let t = e.indexOf(x);
|
|
406
|
+
return t === -1 ? b : e.charAt(t + 1) === S ? ee : y;
|
|
407
|
+
}
|
|
408
|
+
function w(e) {
|
|
409
|
+
return e === y ? x : e === ee ? te : C;
|
|
410
|
+
}
|
|
411
|
+
var T = new Map([
|
|
412
|
+
[S, /\n/gu],
|
|
413
|
+
[x, /\r/gu],
|
|
414
|
+
[te, /\r\n/gu]
|
|
415
|
+
]);
|
|
416
|
+
function re(e, t) {
|
|
417
|
+
let n = T.get(t);
|
|
418
|
+
return e.match(n)?.length ?? 0;
|
|
419
|
+
}
|
|
420
|
+
var E = /\r\n?/gu;
|
|
421
|
+
function ie(e) {
|
|
422
|
+
return m(0, e, E, S);
|
|
423
|
+
}
|
|
424
|
+
function D(e) {
|
|
425
|
+
return this[e < 0 ? this.length + e : e];
|
|
426
|
+
}
|
|
427
|
+
var O = f("at", function() {
|
|
428
|
+
if (Array.isArray(this) || typeof this == "string") return D;
|
|
429
|
+
}), k = "string", A = "array", j = "cursor", M = "indent", N = "align", P = "trim", F = "group", I = "fill", L = "if-break", R = "indent-if-break", z = "line-suffix", B = "line-suffix-boundary", V = "line", H = "label", U = "break-parent", ae = new Set([
|
|
430
|
+
j,
|
|
431
|
+
M,
|
|
432
|
+
N,
|
|
433
|
+
P,
|
|
434
|
+
F,
|
|
435
|
+
I,
|
|
436
|
+
L,
|
|
437
|
+
R,
|
|
438
|
+
z,
|
|
439
|
+
B,
|
|
440
|
+
V,
|
|
441
|
+
H,
|
|
442
|
+
U
|
|
443
|
+
]);
|
|
444
|
+
function oe(e) {
|
|
445
|
+
let t = e.length;
|
|
446
|
+
for (; t > 0 && (e[t - 1] === "\r" || e[t - 1] === "\n");) t--;
|
|
447
|
+
return t < e.length ? e.slice(0, t) : e;
|
|
448
|
+
}
|
|
449
|
+
function se(e) {
|
|
450
|
+
if (typeof e == "string") return k;
|
|
451
|
+
if (Array.isArray(e)) return A;
|
|
452
|
+
if (!e) return;
|
|
453
|
+
let { type: t } = e;
|
|
454
|
+
if (ae.has(t)) return t;
|
|
455
|
+
}
|
|
456
|
+
var ce = se, le = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e);
|
|
457
|
+
function ue(e) {
|
|
458
|
+
let t = e === null ? "null" : typeof e;
|
|
459
|
+
if (t !== "string" && t !== "object") return `Unexpected doc '${t}',
|
|
460
|
+
Expected it to be 'string' or 'object'.`;
|
|
461
|
+
if (ce(e)) throw Error("doc is valid.");
|
|
462
|
+
let n = Object.prototype.toString.call(e);
|
|
463
|
+
if (n !== "[object Object]") return `Unexpected doc '${n}'.`;
|
|
464
|
+
let r = le([...ae].map((e) => `'${e}'`));
|
|
465
|
+
return `Unexpected doc.type '${e.type}'.
|
|
466
|
+
Expected it to be ${r}.`;
|
|
467
|
+
}
|
|
468
|
+
var de = class extends Error {
|
|
469
|
+
name = "InvalidDocError";
|
|
470
|
+
constructor(e) {
|
|
471
|
+
super(ue(e)), this.doc = e;
|
|
472
|
+
}
|
|
473
|
+
}, fe = {};
|
|
474
|
+
function pe(e, t, n, r) {
|
|
475
|
+
let i = [e];
|
|
476
|
+
for (; i.length > 0;) {
|
|
477
|
+
let e = i.pop();
|
|
478
|
+
if (e === fe) {
|
|
479
|
+
n(i.pop());
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
n && i.push(e, fe);
|
|
483
|
+
let a = ce(e);
|
|
484
|
+
if (!a) throw new de(e);
|
|
485
|
+
if (t?.(e) !== !1) switch (a) {
|
|
486
|
+
case A:
|
|
487
|
+
case I: {
|
|
488
|
+
let t = a === A ? e : e.parts;
|
|
489
|
+
for (let e = t.length - 1; e >= 0; --e) i.push(t[e]);
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
case L:
|
|
493
|
+
i.push(e.flatContents, e.breakContents);
|
|
494
|
+
break;
|
|
495
|
+
case F:
|
|
496
|
+
if (r && e.expandedStates) for (let t = e.expandedStates.length, n = t - 1; n >= 0; --n) i.push(e.expandedStates[n]);
|
|
497
|
+
else i.push(e.contents);
|
|
498
|
+
break;
|
|
499
|
+
case N:
|
|
500
|
+
case M:
|
|
501
|
+
case R:
|
|
502
|
+
case H:
|
|
503
|
+
case z:
|
|
504
|
+
i.push(e.contents);
|
|
505
|
+
break;
|
|
506
|
+
case k:
|
|
507
|
+
case j:
|
|
508
|
+
case P:
|
|
509
|
+
case B:
|
|
510
|
+
case V:
|
|
511
|
+
case U: break;
|
|
512
|
+
default: throw new de(e);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
var me = pe;
|
|
517
|
+
function he(e, t) {
|
|
518
|
+
if (typeof e == "string") return t(e);
|
|
519
|
+
let n = /* @__PURE__ */ new Map();
|
|
520
|
+
return r(e);
|
|
521
|
+
function r(e) {
|
|
522
|
+
if (n.has(e)) return n.get(e);
|
|
523
|
+
let t = i(e);
|
|
524
|
+
return n.set(e, t), t;
|
|
525
|
+
}
|
|
526
|
+
function i(e) {
|
|
527
|
+
switch (ce(e)) {
|
|
528
|
+
case A: return t(e.map(r));
|
|
529
|
+
case I: return t({
|
|
530
|
+
...e,
|
|
531
|
+
parts: e.parts.map(r)
|
|
532
|
+
});
|
|
533
|
+
case L: return t({
|
|
534
|
+
...e,
|
|
535
|
+
breakContents: r(e.breakContents),
|
|
536
|
+
flatContents: r(e.flatContents)
|
|
537
|
+
});
|
|
538
|
+
case F: {
|
|
539
|
+
let { expandedStates: n, contents: i } = e;
|
|
540
|
+
return n ? (n = n.map(r), i = n[0]) : i = r(i), t({
|
|
541
|
+
...e,
|
|
542
|
+
contents: i,
|
|
543
|
+
expandedStates: n
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
case N:
|
|
547
|
+
case M:
|
|
548
|
+
case R:
|
|
549
|
+
case H:
|
|
550
|
+
case z: return t({
|
|
551
|
+
...e,
|
|
552
|
+
contents: r(e.contents)
|
|
553
|
+
});
|
|
554
|
+
case k:
|
|
555
|
+
case j:
|
|
556
|
+
case P:
|
|
557
|
+
case B:
|
|
558
|
+
case V:
|
|
559
|
+
case U: return t(e);
|
|
560
|
+
default: throw new de(e);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
function ge(e, t, n) {
|
|
565
|
+
let r = n, i = !1;
|
|
566
|
+
function a(e) {
|
|
567
|
+
if (i) return !1;
|
|
568
|
+
let n = t(e);
|
|
569
|
+
n !== void 0 && (i = !0, r = n);
|
|
570
|
+
}
|
|
571
|
+
return me(e, a), r;
|
|
572
|
+
}
|
|
573
|
+
function _e(e) {
|
|
574
|
+
if (e.type === F && e.break || e.type === V && e.hard || e.type === U) return !0;
|
|
575
|
+
}
|
|
576
|
+
function ve(e) {
|
|
577
|
+
return ge(e, _e, !1);
|
|
578
|
+
}
|
|
579
|
+
function ye(e) {
|
|
580
|
+
if (e.length > 0) {
|
|
581
|
+
let t = O(0, e, -1);
|
|
582
|
+
!t.expandedStates && !t.break && (t.break = "propagated");
|
|
583
|
+
}
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
function be(e) {
|
|
587
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
588
|
+
function r(e) {
|
|
589
|
+
if (e.type === U && ye(n), e.type === F) {
|
|
590
|
+
if (n.push(e), t.has(e)) return !1;
|
|
591
|
+
t.add(e);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
function i(e) {
|
|
595
|
+
e.type === F && n.pop().break && ye(n);
|
|
596
|
+
}
|
|
597
|
+
me(e, r, i, !0);
|
|
598
|
+
}
|
|
599
|
+
function xe(e) {
|
|
600
|
+
return e.type === V && !e.hard ? e.soft ? "" : " " : e.type === L ? e.flatContents : e;
|
|
601
|
+
}
|
|
602
|
+
function Se(e) {
|
|
603
|
+
return he(e, xe);
|
|
604
|
+
}
|
|
605
|
+
function Ce(e) {
|
|
606
|
+
for (e = [...e]; e.length >= 2 && O(0, e, -2).type === V && O(0, e, -1).type === U;) e.length -= 2;
|
|
607
|
+
if (e.length > 0) {
|
|
608
|
+
let t = we(O(0, e, -1));
|
|
609
|
+
e[e.length - 1] = t;
|
|
610
|
+
}
|
|
611
|
+
return e;
|
|
612
|
+
}
|
|
613
|
+
function we(e) {
|
|
614
|
+
switch (ce(e)) {
|
|
615
|
+
case M:
|
|
616
|
+
case R:
|
|
617
|
+
case F:
|
|
618
|
+
case z:
|
|
619
|
+
case H: {
|
|
620
|
+
let t = we(e.contents);
|
|
621
|
+
return {
|
|
622
|
+
...e,
|
|
623
|
+
contents: t
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
case L: return {
|
|
627
|
+
...e,
|
|
628
|
+
breakContents: we(e.breakContents),
|
|
629
|
+
flatContents: we(e.flatContents)
|
|
630
|
+
};
|
|
631
|
+
case I: return {
|
|
632
|
+
...e,
|
|
633
|
+
parts: Ce(e.parts)
|
|
634
|
+
};
|
|
635
|
+
case A: return Ce(e);
|
|
636
|
+
case k: return oe(e);
|
|
637
|
+
case N:
|
|
638
|
+
case j:
|
|
639
|
+
case P:
|
|
640
|
+
case B:
|
|
641
|
+
case V:
|
|
642
|
+
case U: break;
|
|
643
|
+
default: throw new de(e);
|
|
644
|
+
}
|
|
645
|
+
return e;
|
|
646
|
+
}
|
|
647
|
+
function Te(e) {
|
|
648
|
+
return we(De(e));
|
|
649
|
+
}
|
|
650
|
+
function Ee(e) {
|
|
651
|
+
switch (ce(e)) {
|
|
652
|
+
case I:
|
|
653
|
+
if (e.parts.every((e) => e === "")) return "";
|
|
654
|
+
break;
|
|
655
|
+
case F:
|
|
656
|
+
if (!e.contents && !e.id && !e.break && !e.expandedStates) return "";
|
|
657
|
+
if (e.contents.type === F && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents;
|
|
658
|
+
break;
|
|
659
|
+
case N:
|
|
660
|
+
case M:
|
|
661
|
+
case R:
|
|
662
|
+
case z:
|
|
663
|
+
if (!e.contents) return "";
|
|
664
|
+
break;
|
|
665
|
+
case L:
|
|
666
|
+
if (!e.flatContents && !e.breakContents) return "";
|
|
667
|
+
break;
|
|
668
|
+
case A: {
|
|
669
|
+
let t = [];
|
|
670
|
+
for (let n of e) {
|
|
671
|
+
if (!n) continue;
|
|
672
|
+
let [e, ...r] = Array.isArray(n) ? n : [n];
|
|
673
|
+
typeof e == "string" && typeof O(0, t, -1) == "string" ? t[t.length - 1] += e : t.push(e), t.push(...r);
|
|
674
|
+
}
|
|
675
|
+
return t.length === 0 ? "" : t.length === 1 ? t[0] : t;
|
|
676
|
+
}
|
|
677
|
+
case k:
|
|
678
|
+
case j:
|
|
679
|
+
case P:
|
|
680
|
+
case B:
|
|
681
|
+
case V:
|
|
682
|
+
case H:
|
|
683
|
+
case U: break;
|
|
684
|
+
default: throw new de(e);
|
|
685
|
+
}
|
|
686
|
+
return e;
|
|
687
|
+
}
|
|
688
|
+
function De(e) {
|
|
689
|
+
return he(e, (e) => Ee(e));
|
|
690
|
+
}
|
|
691
|
+
function Oe(e, t = $e) {
|
|
692
|
+
return he(e, (e) => typeof e == "string" ? qe(t, e.split("\n")) : e);
|
|
693
|
+
}
|
|
694
|
+
function ke(e) {
|
|
695
|
+
if (e.type === V) return !0;
|
|
696
|
+
}
|
|
697
|
+
function Ae(e) {
|
|
698
|
+
return ge(e, ke, !1);
|
|
699
|
+
}
|
|
700
|
+
function je(e, t) {
|
|
701
|
+
return e.type === H ? {
|
|
702
|
+
...e,
|
|
703
|
+
contents: t(e.contents)
|
|
704
|
+
} : t(e);
|
|
705
|
+
}
|
|
706
|
+
var W = v, Me = v, Ne = v, Pe = v;
|
|
707
|
+
function Fe(e) {
|
|
708
|
+
return W(e), {
|
|
709
|
+
type: M,
|
|
710
|
+
contents: e
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
function Ie(e, t) {
|
|
714
|
+
return Pe(e), W(t), {
|
|
715
|
+
type: N,
|
|
716
|
+
contents: t,
|
|
717
|
+
n: e
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
function Le(e) {
|
|
721
|
+
return Ie(-Infinity, e);
|
|
722
|
+
}
|
|
723
|
+
function Re(e) {
|
|
724
|
+
return Ie({ type: "root" }, e);
|
|
725
|
+
}
|
|
726
|
+
function ze(e) {
|
|
727
|
+
return Ie(-1, e);
|
|
728
|
+
}
|
|
729
|
+
function Be(e, t, n) {
|
|
730
|
+
W(e);
|
|
731
|
+
let r = e;
|
|
732
|
+
if (t > 0) {
|
|
733
|
+
for (let e = 0; e < Math.floor(t / n); ++e) r = Fe(r);
|
|
734
|
+
r = Ie(t % n, r), r = Ie(-Infinity, r);
|
|
735
|
+
}
|
|
736
|
+
return r;
|
|
737
|
+
}
|
|
738
|
+
var Ve = { type: U }, G = { type: j };
|
|
739
|
+
function He(e) {
|
|
740
|
+
return Ne(e), {
|
|
741
|
+
type: I,
|
|
742
|
+
parts: e
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
function Ue(e, t = {}) {
|
|
746
|
+
return W(e), Me(t.expandedStates, !0), {
|
|
747
|
+
type: F,
|
|
748
|
+
id: t.id,
|
|
749
|
+
contents: e,
|
|
750
|
+
break: !!t.shouldBreak,
|
|
751
|
+
expandedStates: t.expandedStates
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function We(e, t) {
|
|
755
|
+
return Ue(e[0], {
|
|
756
|
+
...t,
|
|
757
|
+
expandedStates: e
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
function Ge(e, t = "", n = {}) {
|
|
761
|
+
return W(e), t !== "" && W(t), {
|
|
762
|
+
type: L,
|
|
763
|
+
breakContents: e,
|
|
764
|
+
flatContents: t,
|
|
765
|
+
groupId: n.groupId
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
function Ke(e, t) {
|
|
769
|
+
return W(e), {
|
|
770
|
+
type: R,
|
|
771
|
+
contents: e,
|
|
772
|
+
groupId: t.groupId,
|
|
773
|
+
negate: t.negate
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function qe(e, t) {
|
|
777
|
+
W(e), Me(t);
|
|
778
|
+
let n = [];
|
|
779
|
+
for (let r = 0; r < t.length; r++) r !== 0 && n.push(e), n.push(t[r]);
|
|
780
|
+
return n;
|
|
781
|
+
}
|
|
782
|
+
function Je(e, t) {
|
|
783
|
+
return W(t), e ? {
|
|
784
|
+
type: H,
|
|
785
|
+
label: e,
|
|
786
|
+
contents: t
|
|
787
|
+
} : t;
|
|
788
|
+
}
|
|
789
|
+
var Ye = { type: V }, Xe = {
|
|
790
|
+
type: V,
|
|
791
|
+
soft: !0
|
|
792
|
+
}, Ze = {
|
|
793
|
+
type: V,
|
|
794
|
+
hard: !0
|
|
795
|
+
}, K = [Ze, Ve], Qe = {
|
|
796
|
+
type: V,
|
|
797
|
+
hard: !0,
|
|
798
|
+
literal: !0
|
|
799
|
+
}, $e = [Qe, Ve];
|
|
800
|
+
function et(e) {
|
|
801
|
+
return W(e), {
|
|
802
|
+
type: z,
|
|
803
|
+
contents: e
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
var tt = { type: B }, nt = { type: P };
|
|
807
|
+
function q(e) {
|
|
808
|
+
if (!e) return "";
|
|
809
|
+
if (Array.isArray(e)) {
|
|
810
|
+
let t = [];
|
|
811
|
+
for (let n of e) if (Array.isArray(n)) t.push(...q(n));
|
|
812
|
+
else {
|
|
813
|
+
let e = q(n);
|
|
814
|
+
e !== "" && t.push(e);
|
|
815
|
+
}
|
|
816
|
+
return t;
|
|
817
|
+
}
|
|
818
|
+
return e.type === L ? {
|
|
819
|
+
...e,
|
|
820
|
+
breakContents: q(e.breakContents),
|
|
821
|
+
flatContents: q(e.flatContents)
|
|
822
|
+
} : e.type === F ? {
|
|
823
|
+
...e,
|
|
824
|
+
contents: q(e.contents),
|
|
825
|
+
expandedStates: e.expandedStates?.map(q)
|
|
826
|
+
} : e.type === I ? {
|
|
827
|
+
type: "fill",
|
|
828
|
+
parts: e.parts.map(q)
|
|
829
|
+
} : e.contents ? {
|
|
830
|
+
...e,
|
|
831
|
+
contents: q(e.contents)
|
|
832
|
+
} : e;
|
|
833
|
+
}
|
|
834
|
+
function rt(e) {
|
|
835
|
+
let t = Object.create(null), n = /* @__PURE__ */ new Set();
|
|
836
|
+
return r(q(e));
|
|
837
|
+
function r(e, t, n) {
|
|
838
|
+
if (typeof e == "string") return JSON.stringify(e);
|
|
839
|
+
if (Array.isArray(e)) {
|
|
840
|
+
let t = e.map(r).filter(Boolean);
|
|
841
|
+
return t.length === 1 ? t[0] : `[${t.join(", ")}]`;
|
|
842
|
+
}
|
|
843
|
+
if (e.type === V) {
|
|
844
|
+
let r = n?.[t + 1]?.type === U;
|
|
845
|
+
return e.literal ? r ? "literalline" : "literallineWithoutBreakParent" : e.hard ? r ? "hardline" : "hardlineWithoutBreakParent" : e.soft ? "softline" : "line";
|
|
846
|
+
}
|
|
847
|
+
if (e.type === U) return n?.[t - 1]?.type === V && n[t - 1].hard ? void 0 : "breakParent";
|
|
848
|
+
if (e.type === P) return "trim";
|
|
849
|
+
if (e.type === M) return "indent(" + r(e.contents) + ")";
|
|
850
|
+
if (e.type === N) return e.n === -Infinity ? "dedentToRoot(" + r(e.contents) + ")" : e.n < 0 ? "dedent(" + r(e.contents) + ")" : e.n.type === "root" ? "markAsRoot(" + r(e.contents) + ")" : "align(" + JSON.stringify(e.n) + ", " + r(e.contents) + ")";
|
|
851
|
+
if (e.type === L) return "ifBreak(" + r(e.breakContents) + (e.flatContents ? ", " + r(e.flatContents) : "") + (e.groupId ? (e.flatContents ? "" : ", \"\"") + `, { groupId: ${i(e.groupId)} }` : "") + ")";
|
|
852
|
+
if (e.type === R) {
|
|
853
|
+
let t = [];
|
|
854
|
+
e.negate && t.push("negate: true"), e.groupId && t.push(`groupId: ${i(e.groupId)}`);
|
|
855
|
+
let n = t.length > 0 ? `, { ${t.join(", ")} }` : "";
|
|
856
|
+
return `indentIfBreak(${r(e.contents)}${n})`;
|
|
857
|
+
}
|
|
858
|
+
if (e.type === F) {
|
|
859
|
+
let t = [];
|
|
860
|
+
e.break && e.break !== "propagated" && t.push("shouldBreak: true"), e.id && t.push(`id: ${i(e.id)}`);
|
|
861
|
+
let n = t.length > 0 ? `, { ${t.join(", ")} }` : "";
|
|
862
|
+
return e.expandedStates ? `conditionalGroup([${e.expandedStates.map((e) => r(e)).join(",")}]${n})` : `group(${r(e.contents)}${n})`;
|
|
863
|
+
}
|
|
864
|
+
if (e.type === I) return `fill([${e.parts.map((e) => r(e)).join(", ")}])`;
|
|
865
|
+
if (e.type === z) return "lineSuffix(" + r(e.contents) + ")";
|
|
866
|
+
if (e.type === B) return "lineSuffixBoundary";
|
|
867
|
+
if (e.type === H) return `label(${JSON.stringify(e.label)}, ${r(e.contents)})`;
|
|
868
|
+
if (e.type === j) return "cursor";
|
|
869
|
+
throw Error("Unknown doc type " + e.type);
|
|
870
|
+
}
|
|
871
|
+
function i(e) {
|
|
872
|
+
if (typeof e != "symbol") return JSON.stringify(String(e));
|
|
873
|
+
if (e in t) return t[e];
|
|
874
|
+
let r = e.description || "symbol";
|
|
875
|
+
for (let i = 0;; i++) {
|
|
876
|
+
let a = r + (i > 0 ? ` #${i}` : "");
|
|
877
|
+
if (!n.has(a)) return n.add(a), t[e] = `Symbol.for(${JSON.stringify(a)})`;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
var it = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
882
|
+
function at(e) {
|
|
883
|
+
return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
|
|
884
|
+
}
|
|
885
|
+
function ot(e) {
|
|
886
|
+
return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e >= 94192 && e <= 94198 || e >= 94208 && e <= 101589 || e >= 101631 && e <= 101662 || e >= 101760 && e <= 101874 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128728 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129674 || e >= 129678 && e <= 129734 || e === 129736 || e >= 129741 && e <= 129756 || e >= 129759 && e <= 129770 || e >= 129775 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
|
|
887
|
+
}
|
|
888
|
+
var st = "©®‼⁉™ℹ↔↕↖↗↘↙↩↪⌨⏏⏱⏲⏸⏹⏺▪▫▶◀◻◼☀☁☂☃☄☎☑☘☝☠☢☣☦☪☮☯☸☹☺♀♂♟♠♣♥♦♨♻♾⚒⚔⚕⚖⚗⚙⚛⚜⚠⚧⚰⚱⛈⛏⛑⛓⛩⛱⛷⛸⛹✂✈✉✌✍✏✒✔✖✝✡✳✴❄❇❣❤➡⤴⤵⬅⬆⬇", ct = /[^\x20-\x7F]/u, lt = new Set(st);
|
|
889
|
+
function ut(e) {
|
|
890
|
+
if (!e) return 0;
|
|
891
|
+
if (!ct.test(e)) return e.length;
|
|
892
|
+
e = e.replace(it(), (e) => lt.has(e) ? " " : " ");
|
|
893
|
+
let t = 0;
|
|
894
|
+
for (let n of e) {
|
|
895
|
+
let e = n.codePointAt(0);
|
|
896
|
+
e <= 31 || e >= 127 && e <= 159 || e >= 768 && e <= 879 || e >= 65024 && e <= 65039 || (t += at(e) || ot(e) ? 2 : 1);
|
|
897
|
+
}
|
|
898
|
+
return t;
|
|
899
|
+
}
|
|
900
|
+
var dt = ut, ft = { type: 0 }, pt = { type: 1 }, mt = {
|
|
901
|
+
value: "",
|
|
902
|
+
length: 0,
|
|
903
|
+
queue: [],
|
|
904
|
+
get root() {
|
|
905
|
+
return mt;
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
function ht(e, t, n) {
|
|
909
|
+
let r = t.type === 1 ? e.queue.slice(0, -1) : [...e.queue, t], i = "", a = 0, o = 0, s = 0;
|
|
910
|
+
for (let e of r) switch (e.type) {
|
|
911
|
+
case 0:
|
|
912
|
+
u(), n.useTabs ? c(1) : l(n.tabWidth);
|
|
913
|
+
break;
|
|
914
|
+
case 3: {
|
|
915
|
+
let { string: t } = e;
|
|
916
|
+
u(), i += t, a += t.length;
|
|
917
|
+
break;
|
|
918
|
+
}
|
|
919
|
+
case 2: {
|
|
920
|
+
let { width: t } = e;
|
|
921
|
+
o += 1, s += t;
|
|
922
|
+
break;
|
|
923
|
+
}
|
|
924
|
+
default: throw Error(`Unexpected indent comment '${e.type}'.`);
|
|
925
|
+
}
|
|
926
|
+
return f(), {
|
|
927
|
+
...e,
|
|
928
|
+
value: i,
|
|
929
|
+
length: a,
|
|
930
|
+
queue: r
|
|
931
|
+
};
|
|
932
|
+
function c(e) {
|
|
933
|
+
i += " ".repeat(e), a += n.tabWidth * e;
|
|
934
|
+
}
|
|
935
|
+
function l(e) {
|
|
936
|
+
i += " ".repeat(e), a += e;
|
|
937
|
+
}
|
|
938
|
+
function u() {
|
|
939
|
+
n.useTabs ? d() : f();
|
|
940
|
+
}
|
|
941
|
+
function d() {
|
|
942
|
+
o > 0 && c(o), p();
|
|
943
|
+
}
|
|
944
|
+
function f() {
|
|
945
|
+
s > 0 && l(s), p();
|
|
946
|
+
}
|
|
947
|
+
function p() {
|
|
948
|
+
o = 0, s = 0;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
function gt(e, t, n) {
|
|
952
|
+
if (!t) return e;
|
|
953
|
+
if (t.type === "root") return {
|
|
954
|
+
...e,
|
|
955
|
+
root: e
|
|
956
|
+
};
|
|
957
|
+
if (t === -Infinity) return e.root;
|
|
958
|
+
let r;
|
|
959
|
+
return r = typeof t == "number" ? t < 0 ? pt : {
|
|
960
|
+
type: 2,
|
|
961
|
+
width: t
|
|
962
|
+
} : {
|
|
963
|
+
type: 3,
|
|
964
|
+
string: t
|
|
965
|
+
}, ht(e, r, n);
|
|
966
|
+
}
|
|
967
|
+
function _t(e, t) {
|
|
968
|
+
return ht(e, ft, t);
|
|
969
|
+
}
|
|
970
|
+
function vt(e) {
|
|
971
|
+
let t = 0;
|
|
972
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
973
|
+
let r = e[n];
|
|
974
|
+
if (r === " " || r === " ") t++;
|
|
975
|
+
else break;
|
|
976
|
+
}
|
|
977
|
+
return t;
|
|
978
|
+
}
|
|
979
|
+
function yt(e) {
|
|
980
|
+
let t = vt(e);
|
|
981
|
+
return {
|
|
982
|
+
text: t === 0 ? e : e.slice(0, e.length - t),
|
|
983
|
+
count: t
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
var J = Symbol("MODE_BREAK"), Y = Symbol("MODE_FLAT"), bt = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
987
|
+
function xt(e, t, n, r, i, a) {
|
|
988
|
+
if (n === Infinity) return !0;
|
|
989
|
+
let o = t.length, s = !1, c = [e], l = "";
|
|
990
|
+
for (; n >= 0;) {
|
|
991
|
+
if (c.length === 0) {
|
|
992
|
+
if (o === 0) return !0;
|
|
993
|
+
c.push(t[--o]);
|
|
994
|
+
continue;
|
|
995
|
+
}
|
|
996
|
+
let { mode: e, doc: u } = c.pop(), d = ce(u);
|
|
997
|
+
switch (d) {
|
|
998
|
+
case k:
|
|
999
|
+
u && (s &&= (l += " ", --n, !1), l += u, n -= dt(u));
|
|
1000
|
+
break;
|
|
1001
|
+
case A:
|
|
1002
|
+
case I: {
|
|
1003
|
+
let t = d === A ? u : u.parts, n = u[bt] ?? 0;
|
|
1004
|
+
for (let r = t.length - 1; r >= n; r--) c.push({
|
|
1005
|
+
mode: e,
|
|
1006
|
+
doc: t[r]
|
|
1007
|
+
});
|
|
1008
|
+
break;
|
|
1009
|
+
}
|
|
1010
|
+
case M:
|
|
1011
|
+
case N:
|
|
1012
|
+
case R:
|
|
1013
|
+
case H:
|
|
1014
|
+
c.push({
|
|
1015
|
+
mode: e,
|
|
1016
|
+
doc: u.contents
|
|
1017
|
+
});
|
|
1018
|
+
break;
|
|
1019
|
+
case P: {
|
|
1020
|
+
let { text: e, count: t } = yt(l);
|
|
1021
|
+
l = e, n += t;
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
case F: {
|
|
1025
|
+
if (a && u.break) return !1;
|
|
1026
|
+
let t = u.break ? J : e, n = u.expandedStates && t === J ? O(0, u.expandedStates, -1) : u.contents;
|
|
1027
|
+
c.push({
|
|
1028
|
+
mode: t,
|
|
1029
|
+
doc: n
|
|
1030
|
+
});
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
case L: {
|
|
1034
|
+
let t = (u.groupId ? i[u.groupId] || Y : e) === J ? u.breakContents : u.flatContents;
|
|
1035
|
+
t && c.push({
|
|
1036
|
+
mode: e,
|
|
1037
|
+
doc: t
|
|
1038
|
+
});
|
|
1039
|
+
break;
|
|
1040
|
+
}
|
|
1041
|
+
case V:
|
|
1042
|
+
if (e === J || u.hard) return !0;
|
|
1043
|
+
u.soft || (s = !0);
|
|
1044
|
+
break;
|
|
1045
|
+
case z:
|
|
1046
|
+
r = !0;
|
|
1047
|
+
break;
|
|
1048
|
+
case B:
|
|
1049
|
+
if (r) return !1;
|
|
1050
|
+
break;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return !1;
|
|
1054
|
+
}
|
|
1055
|
+
function St(e, t) {
|
|
1056
|
+
let n = Object.create(null), r = t.printWidth, i = w(t.endOfLine), a = 0, o = [{
|
|
1057
|
+
indent: mt,
|
|
1058
|
+
mode: J,
|
|
1059
|
+
doc: e
|
|
1060
|
+
}], s = "", c = !1, l = [], u = [], d = [], f = [], p = 0;
|
|
1061
|
+
for (be(e); o.length > 0;) {
|
|
1062
|
+
let { indent: e, mode: d, doc: f } = o.pop();
|
|
1063
|
+
switch (ce(f)) {
|
|
1064
|
+
case k: {
|
|
1065
|
+
let e = i === "\n" ? f : m(0, f, "\n", i);
|
|
1066
|
+
e && (s += e, o.length > 0 && (a += dt(e)));
|
|
1067
|
+
break;
|
|
1068
|
+
}
|
|
1069
|
+
case A:
|
|
1070
|
+
for (let t = f.length - 1; t >= 0; t--) o.push({
|
|
1071
|
+
indent: e,
|
|
1072
|
+
mode: d,
|
|
1073
|
+
doc: f[t]
|
|
1074
|
+
});
|
|
1075
|
+
break;
|
|
1076
|
+
case j:
|
|
1077
|
+
if (u.length >= 2) throw Error("There are too many 'cursor' in doc.");
|
|
1078
|
+
u.push(p + s.length);
|
|
1079
|
+
break;
|
|
1080
|
+
case M:
|
|
1081
|
+
o.push({
|
|
1082
|
+
indent: _t(e, t),
|
|
1083
|
+
mode: d,
|
|
1084
|
+
doc: f.contents
|
|
1085
|
+
});
|
|
1086
|
+
break;
|
|
1087
|
+
case N:
|
|
1088
|
+
o.push({
|
|
1089
|
+
indent: gt(e, f.n, t),
|
|
1090
|
+
mode: d,
|
|
1091
|
+
doc: f.contents
|
|
1092
|
+
});
|
|
1093
|
+
break;
|
|
1094
|
+
case P:
|
|
1095
|
+
v();
|
|
1096
|
+
break;
|
|
1097
|
+
case F:
|
|
1098
|
+
switch (d) {
|
|
1099
|
+
case Y: if (!c) {
|
|
1100
|
+
o.push({
|
|
1101
|
+
indent: e,
|
|
1102
|
+
mode: f.break ? J : Y,
|
|
1103
|
+
doc: f.contents
|
|
1104
|
+
});
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1107
|
+
case J: {
|
|
1108
|
+
c = !1;
|
|
1109
|
+
let t = {
|
|
1110
|
+
indent: e,
|
|
1111
|
+
mode: Y,
|
|
1112
|
+
doc: f.contents
|
|
1113
|
+
}, i = r - a, s = l.length > 0;
|
|
1114
|
+
if (!f.break && xt(t, o, i, s, n)) o.push(t);
|
|
1115
|
+
else if (f.expandedStates) {
|
|
1116
|
+
let t = O(0, f.expandedStates, -1);
|
|
1117
|
+
if (f.break) {
|
|
1118
|
+
o.push({
|
|
1119
|
+
indent: e,
|
|
1120
|
+
mode: J,
|
|
1121
|
+
doc: t
|
|
1122
|
+
});
|
|
1123
|
+
break;
|
|
1124
|
+
} else for (let r = 1; r < f.expandedStates.length + 1; r++) if (r >= f.expandedStates.length) {
|
|
1125
|
+
o.push({
|
|
1126
|
+
indent: e,
|
|
1127
|
+
mode: J,
|
|
1128
|
+
doc: t
|
|
1129
|
+
});
|
|
1130
|
+
break;
|
|
1131
|
+
} else {
|
|
1132
|
+
let t = {
|
|
1133
|
+
indent: e,
|
|
1134
|
+
mode: Y,
|
|
1135
|
+
doc: f.expandedStates[r]
|
|
1136
|
+
};
|
|
1137
|
+
if (xt(t, o, i, s, n)) {
|
|
1138
|
+
o.push(t);
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
} else o.push({
|
|
1143
|
+
indent: e,
|
|
1144
|
+
mode: J,
|
|
1145
|
+
doc: f.contents
|
|
1146
|
+
});
|
|
1147
|
+
break;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
f.id && (n[f.id] = O(0, o, -1).mode);
|
|
1151
|
+
break;
|
|
1152
|
+
case I: {
|
|
1153
|
+
let t = r - a, i = f[bt] ?? 0, { parts: s } = f, c = s.length - i;
|
|
1154
|
+
if (c === 0) break;
|
|
1155
|
+
let u = s[i + 0], p = s[i + 1], m = {
|
|
1156
|
+
indent: e,
|
|
1157
|
+
mode: Y,
|
|
1158
|
+
doc: u
|
|
1159
|
+
}, h = {
|
|
1160
|
+
indent: e,
|
|
1161
|
+
mode: J,
|
|
1162
|
+
doc: u
|
|
1163
|
+
}, g = xt(m, [], t, l.length > 0, n, !0);
|
|
1164
|
+
if (c === 1) {
|
|
1165
|
+
g ? o.push(m) : o.push(h);
|
|
1166
|
+
break;
|
|
1167
|
+
}
|
|
1168
|
+
let _ = {
|
|
1169
|
+
indent: e,
|
|
1170
|
+
mode: Y,
|
|
1171
|
+
doc: p
|
|
1172
|
+
}, v = {
|
|
1173
|
+
indent: e,
|
|
1174
|
+
mode: J,
|
|
1175
|
+
doc: p
|
|
1176
|
+
};
|
|
1177
|
+
if (c === 2) {
|
|
1178
|
+
g ? o.push(_, m) : o.push(v, h);
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
let y = s[i + 2], ee = {
|
|
1182
|
+
indent: e,
|
|
1183
|
+
mode: d,
|
|
1184
|
+
doc: {
|
|
1185
|
+
...f,
|
|
1186
|
+
[bt]: i + 2
|
|
1187
|
+
}
|
|
1188
|
+
}, b = xt({
|
|
1189
|
+
indent: e,
|
|
1190
|
+
mode: Y,
|
|
1191
|
+
doc: [
|
|
1192
|
+
u,
|
|
1193
|
+
p,
|
|
1194
|
+
y
|
|
1195
|
+
]
|
|
1196
|
+
}, [], t, l.length > 0, n, !0);
|
|
1197
|
+
o.push(ee), b ? o.push(_, m) : g ? o.push(v, m) : o.push(v, h);
|
|
1198
|
+
break;
|
|
1199
|
+
}
|
|
1200
|
+
case L:
|
|
1201
|
+
case R: {
|
|
1202
|
+
let t = f.groupId ? n[f.groupId] : d;
|
|
1203
|
+
if (t === J) {
|
|
1204
|
+
let t = f.type === L ? f.breakContents : f.negate ? f.contents : Fe(f.contents);
|
|
1205
|
+
t && o.push({
|
|
1206
|
+
indent: e,
|
|
1207
|
+
mode: d,
|
|
1208
|
+
doc: t
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
if (t === Y) {
|
|
1212
|
+
let t = f.type === L ? f.flatContents : f.negate ? Fe(f.contents) : f.contents;
|
|
1213
|
+
t && o.push({
|
|
1214
|
+
indent: e,
|
|
1215
|
+
mode: d,
|
|
1216
|
+
doc: t
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
case z:
|
|
1222
|
+
l.push({
|
|
1223
|
+
indent: e,
|
|
1224
|
+
mode: d,
|
|
1225
|
+
doc: f.contents
|
|
1226
|
+
});
|
|
1227
|
+
break;
|
|
1228
|
+
case B:
|
|
1229
|
+
l.length > 0 && o.push({
|
|
1230
|
+
indent: e,
|
|
1231
|
+
mode: d,
|
|
1232
|
+
doc: Ze
|
|
1233
|
+
});
|
|
1234
|
+
break;
|
|
1235
|
+
case V:
|
|
1236
|
+
switch (d) {
|
|
1237
|
+
case Y: if (f.hard) c = !0;
|
|
1238
|
+
else {
|
|
1239
|
+
f.soft || (s += " ", a += 1);
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
case J:
|
|
1243
|
+
if (l.length > 0) {
|
|
1244
|
+
o.push({
|
|
1245
|
+
indent: e,
|
|
1246
|
+
mode: d,
|
|
1247
|
+
doc: f
|
|
1248
|
+
}, ...l.reverse()), l.length = 0;
|
|
1249
|
+
break;
|
|
1250
|
+
}
|
|
1251
|
+
f.literal ? (s += i, a = 0, e.root && (e.root.value && (s += e.root.value), a = e.root.length)) : (v(), s += i + e.value, a = e.length);
|
|
1252
|
+
break;
|
|
1253
|
+
}
|
|
1254
|
+
break;
|
|
1255
|
+
case H:
|
|
1256
|
+
o.push({
|
|
1257
|
+
indent: e,
|
|
1258
|
+
mode: d,
|
|
1259
|
+
doc: f.contents
|
|
1260
|
+
});
|
|
1261
|
+
break;
|
|
1262
|
+
case U: break;
|
|
1263
|
+
default: throw new de(f);
|
|
1264
|
+
}
|
|
1265
|
+
o.length === 0 && l.length > 0 && (o.push(...l.reverse()), l.length = 0);
|
|
1266
|
+
}
|
|
1267
|
+
let h = d.join("") + s, g = [...f, ...u];
|
|
1268
|
+
if (g.length !== 2) return { formatted: h };
|
|
1269
|
+
let _ = g[0];
|
|
1270
|
+
return {
|
|
1271
|
+
formatted: h,
|
|
1272
|
+
cursorNodeStart: _,
|
|
1273
|
+
cursorNodeText: h.slice(_, O(0, g, -1))
|
|
1274
|
+
};
|
|
1275
|
+
function v() {
|
|
1276
|
+
let { text: e, count: t } = yt(s);
|
|
1277
|
+
e && (d.push(e), p += e.length), s = "", a -= t, u.length > 0 && (f.push(...u.map((e) => Math.min(e, p))), u.length = 0);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
function Ct(e, t, n = 0) {
|
|
1281
|
+
let r = 0;
|
|
1282
|
+
for (let i = n; i < e.length; ++i) e[i] === " " ? r = r + t - r % t : r++;
|
|
1283
|
+
return r;
|
|
1284
|
+
}
|
|
1285
|
+
var wt = Ct, Tt = class {
|
|
1286
|
+
constructor(e) {
|
|
1287
|
+
this.stack = [e];
|
|
1288
|
+
}
|
|
1289
|
+
get key() {
|
|
1290
|
+
let { stack: e, siblings: t } = this;
|
|
1291
|
+
return O(0, e, t === null ? -2 : -4) ?? null;
|
|
1292
|
+
}
|
|
1293
|
+
get index() {
|
|
1294
|
+
return this.siblings === null ? null : O(0, this.stack, -2);
|
|
1295
|
+
}
|
|
1296
|
+
get node() {
|
|
1297
|
+
return O(0, this.stack, -1);
|
|
1298
|
+
}
|
|
1299
|
+
get parent() {
|
|
1300
|
+
return this.getNode(1);
|
|
1301
|
+
}
|
|
1302
|
+
get grandparent() {
|
|
1303
|
+
return this.getNode(2);
|
|
1304
|
+
}
|
|
1305
|
+
get isInArray() {
|
|
1306
|
+
return this.siblings !== null;
|
|
1307
|
+
}
|
|
1308
|
+
get siblings() {
|
|
1309
|
+
let { stack: e } = this, t = O(0, e, -3);
|
|
1310
|
+
return Array.isArray(t) ? t : null;
|
|
1311
|
+
}
|
|
1312
|
+
get next() {
|
|
1313
|
+
let { siblings: e } = this;
|
|
1314
|
+
return e === null ? null : e[this.index + 1];
|
|
1315
|
+
}
|
|
1316
|
+
get previous() {
|
|
1317
|
+
let { siblings: e } = this;
|
|
1318
|
+
return e === null ? null : e[this.index - 1];
|
|
1319
|
+
}
|
|
1320
|
+
get isFirst() {
|
|
1321
|
+
return this.index === 0;
|
|
1322
|
+
}
|
|
1323
|
+
get isLast() {
|
|
1324
|
+
let { siblings: e, index: t } = this;
|
|
1325
|
+
return e !== null && t === e.length - 1;
|
|
1326
|
+
}
|
|
1327
|
+
get isRoot() {
|
|
1328
|
+
return this.stack.length === 1;
|
|
1329
|
+
}
|
|
1330
|
+
get root() {
|
|
1331
|
+
return this.stack[0];
|
|
1332
|
+
}
|
|
1333
|
+
get ancestors() {
|
|
1334
|
+
return [...this.#t()];
|
|
1335
|
+
}
|
|
1336
|
+
getName() {
|
|
1337
|
+
let { stack: e } = this, { length: t } = e;
|
|
1338
|
+
return t > 1 ? O(0, e, -2) : null;
|
|
1339
|
+
}
|
|
1340
|
+
getValue() {
|
|
1341
|
+
return O(0, this.stack, -1);
|
|
1342
|
+
}
|
|
1343
|
+
getNode(e = 0) {
|
|
1344
|
+
let t = this.#e(e);
|
|
1345
|
+
return t === -1 ? null : this.stack[t];
|
|
1346
|
+
}
|
|
1347
|
+
getParentNode(e = 0) {
|
|
1348
|
+
return this.getNode(e + 1);
|
|
1349
|
+
}
|
|
1350
|
+
#e(e) {
|
|
1351
|
+
let { stack: t } = this;
|
|
1352
|
+
for (let n = t.length - 1; n >= 0; n -= 2) if (!Array.isArray(t[n]) && --e < 0) return n;
|
|
1353
|
+
return -1;
|
|
1354
|
+
}
|
|
1355
|
+
call(e, ...t) {
|
|
1356
|
+
let { stack: n } = this, { length: r } = n, i = O(0, n, -1);
|
|
1357
|
+
for (let e of t) i = i?.[e], n.push(e, i);
|
|
1358
|
+
try {
|
|
1359
|
+
return e(this);
|
|
1360
|
+
} finally {
|
|
1361
|
+
n.length = r;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
callParent(e, t = 0) {
|
|
1365
|
+
let n = this.#e(t + 1), r = this.stack.splice(n + 1);
|
|
1366
|
+
try {
|
|
1367
|
+
return e(this);
|
|
1368
|
+
} finally {
|
|
1369
|
+
this.stack.push(...r);
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
each(e, ...t) {
|
|
1373
|
+
let { stack: n } = this, { length: r } = n, i = O(0, n, -1);
|
|
1374
|
+
for (let e of t) i = i[e], n.push(e, i);
|
|
1375
|
+
try {
|
|
1376
|
+
for (let t = 0; t < i.length; ++t) n.push(t, i[t]), e(this, t, i), n.length -= 2;
|
|
1377
|
+
} finally {
|
|
1378
|
+
n.length = r;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
map(e, ...t) {
|
|
1382
|
+
let n = [];
|
|
1383
|
+
return this.each((t, r, i) => {
|
|
1384
|
+
n[r] = e(t, r, i);
|
|
1385
|
+
}, ...t), n;
|
|
1386
|
+
}
|
|
1387
|
+
match(...e) {
|
|
1388
|
+
let t = this.stack.length - 1, n = null, r = this.stack[t--];
|
|
1389
|
+
for (let i of e) {
|
|
1390
|
+
if (r === void 0) return !1;
|
|
1391
|
+
let e = null;
|
|
1392
|
+
if (typeof n == "number" && (e = n, n = this.stack[t--], r = this.stack[t--]), i && !i(r, n, e)) return !1;
|
|
1393
|
+
n = this.stack[t--], r = this.stack[t--];
|
|
1394
|
+
}
|
|
1395
|
+
return !0;
|
|
1396
|
+
}
|
|
1397
|
+
findAncestor(e) {
|
|
1398
|
+
for (let t of this.#t()) if (e(t)) return t;
|
|
1399
|
+
}
|
|
1400
|
+
hasAncestor(e) {
|
|
1401
|
+
for (let t of this.#t()) if (e(t)) return !0;
|
|
1402
|
+
return !1;
|
|
1403
|
+
}
|
|
1404
|
+
*#t() {
|
|
1405
|
+
let { stack: e } = this;
|
|
1406
|
+
for (let t = e.length - 3; t >= 0; t -= 2) {
|
|
1407
|
+
let n = e[t];
|
|
1408
|
+
Array.isArray(n) || (yield n);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
};
|
|
1412
|
+
function Et(e) {
|
|
1413
|
+
return typeof e == "object" && !!e;
|
|
1414
|
+
}
|
|
1415
|
+
var Dt = Et;
|
|
1416
|
+
function Ot(e) {
|
|
1417
|
+
return (t, n, r) => {
|
|
1418
|
+
let i = !!r?.backwards;
|
|
1419
|
+
if (n === !1) return !1;
|
|
1420
|
+
let { length: a } = t, o = n;
|
|
1421
|
+
for (; o >= 0 && o < a;) {
|
|
1422
|
+
let n = t.charAt(o);
|
|
1423
|
+
if (e instanceof RegExp) {
|
|
1424
|
+
if (!e.test(n)) return o;
|
|
1425
|
+
} else if (!e.includes(n)) return o;
|
|
1426
|
+
i ? o-- : o++;
|
|
1427
|
+
}
|
|
1428
|
+
return o === -1 || o === a ? o : !1;
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
var kt = Ot(/\s/u), X = Ot(" "), At = Ot(",; "), jt = Ot(/[^\n\r]/u), Mt = (e) => e === "\n" || e === "\r" || e === "\u2028" || e === "\u2029";
|
|
1432
|
+
function Nt(e, t, n) {
|
|
1433
|
+
let r = !!n?.backwards;
|
|
1434
|
+
if (t === !1) return !1;
|
|
1435
|
+
let i = e.charAt(t);
|
|
1436
|
+
if (r) {
|
|
1437
|
+
if (e.charAt(t - 1) === "\r" && i === "\n") return t - 2;
|
|
1438
|
+
if (Mt(i)) return t - 1;
|
|
1439
|
+
} else {
|
|
1440
|
+
if (i === "\r" && e.charAt(t + 1) === "\n") return t + 2;
|
|
1441
|
+
if (Mt(i)) return t + 1;
|
|
1442
|
+
}
|
|
1443
|
+
return t;
|
|
1444
|
+
}
|
|
1445
|
+
var Pt = Nt;
|
|
1446
|
+
function Ft(e, t, n = {}) {
|
|
1447
|
+
let r = X(e, n.backwards ? t - 1 : t, n);
|
|
1448
|
+
return r !== Pt(e, r, n);
|
|
1449
|
+
}
|
|
1450
|
+
var Z = Ft;
|
|
1451
|
+
function It(e) {
|
|
1452
|
+
return Array.isArray(e) && e.length > 0;
|
|
1453
|
+
}
|
|
1454
|
+
var Lt = It;
|
|
1455
|
+
function* Rt(e, t) {
|
|
1456
|
+
let { getVisitorKeys: n, filter: r = () => !0 } = t, i = (e) => Dt(e) && r(e);
|
|
1457
|
+
for (let t of n(e)) {
|
|
1458
|
+
let n = e[t];
|
|
1459
|
+
if (Array.isArray(n)) for (let e of n) i(e) && (yield e);
|
|
1460
|
+
else i(n) && (yield n);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
function* zt(e, t) {
|
|
1464
|
+
let n = [e];
|
|
1465
|
+
for (let e = 0; e < n.length; e++) {
|
|
1466
|
+
let r = n[e];
|
|
1467
|
+
for (let e of Rt(r, t)) yield e, n.push(e);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function Bt(e, t) {
|
|
1471
|
+
return Rt(e, t).next().done;
|
|
1472
|
+
}
|
|
1473
|
+
function Vt(e, t, n) {
|
|
1474
|
+
let { cache: r } = n;
|
|
1475
|
+
if (r.has(e)) return r.get(e);
|
|
1476
|
+
let { filter: i } = n;
|
|
1477
|
+
if (!i) return [];
|
|
1478
|
+
let a, o = (n.getChildren?.(e, n) ?? [...Rt(e, { getVisitorKeys: n.getVisitorKeys })]).flatMap((r) => (a ??= [e, ...t], i(r, a) ? [r] : Vt(r, a, n))), { locStart: s, locEnd: c } = n;
|
|
1479
|
+
return o.sort((e, t) => s(e) - s(t) || c(e) - c(t)), r.set(e, o), o;
|
|
1480
|
+
}
|
|
1481
|
+
var Ht = Vt;
|
|
1482
|
+
function Ut(e) {
|
|
1483
|
+
let t = e.type || e.kind || "(unknown type)", n = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || "");
|
|
1484
|
+
return n.length > 20 && (n = n.slice(0, 19) + "…"), t + (n ? " " + n : "");
|
|
1485
|
+
}
|
|
1486
|
+
function Wt(e, t) {
|
|
1487
|
+
(e.comments ??= []).push(t), t.printed = !1, t.nodeDescription = Ut(e);
|
|
1488
|
+
}
|
|
1489
|
+
function Gt(e, t) {
|
|
1490
|
+
t.leading = !0, t.trailing = !1, Wt(e, t);
|
|
1491
|
+
}
|
|
1492
|
+
function Kt(e, t, n) {
|
|
1493
|
+
t.leading = !1, t.trailing = !1, n && (t.marker = n), Wt(e, t);
|
|
1494
|
+
}
|
|
1495
|
+
function qt(e, t) {
|
|
1496
|
+
t.leading = !1, t.trailing = !0, Wt(e, t);
|
|
1497
|
+
}
|
|
1498
|
+
var Jt = /* @__PURE__ */ new WeakMap();
|
|
1499
|
+
function Yt(e, t, n, r, i = []) {
|
|
1500
|
+
let { locStart: a, locEnd: o } = n, s = a(t), c = o(t), l = Ht(e, i, {
|
|
1501
|
+
cache: Jt,
|
|
1502
|
+
locStart: a,
|
|
1503
|
+
locEnd: o,
|
|
1504
|
+
getVisitorKeys: n.getVisitorKeys,
|
|
1505
|
+
filter: n.printer.canAttachComment,
|
|
1506
|
+
getChildren: n.printer.getCommentChildNodes
|
|
1507
|
+
}), u, d, f = 0, p = l.length;
|
|
1508
|
+
for (; f < p;) {
|
|
1509
|
+
let e = f + p >> 1, r = l[e], m = a(r), h = o(r);
|
|
1510
|
+
if (m <= s && c <= h) return Yt(r, t, n, r, [r, ...i]);
|
|
1511
|
+
if (h <= s) {
|
|
1512
|
+
u = r, f = e + 1;
|
|
1513
|
+
continue;
|
|
1514
|
+
}
|
|
1515
|
+
if (c <= m) {
|
|
1516
|
+
d = r, p = e;
|
|
1517
|
+
continue;
|
|
1518
|
+
}
|
|
1519
|
+
throw Error("Comment location overlaps with node location");
|
|
1520
|
+
}
|
|
1521
|
+
if (r?.type === "TemplateLiteral") {
|
|
1522
|
+
let { quasis: e } = r, i = nn(e, t, n);
|
|
1523
|
+
u && nn(e, u, n) !== i && (u = null), d && nn(e, d, n) !== i && (d = null);
|
|
1524
|
+
}
|
|
1525
|
+
return {
|
|
1526
|
+
enclosingNode: r,
|
|
1527
|
+
precedingNode: u,
|
|
1528
|
+
followingNode: d
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
var Xt = () => !1;
|
|
1532
|
+
function Zt(e, t) {
|
|
1533
|
+
let { comments: n } = e;
|
|
1534
|
+
if (delete e.comments, !Lt(n) || !t.printer.canAttachComment) return;
|
|
1535
|
+
let r = [], { printer: { features: { experimental_avoidAstMutation: i }, handleComments: a = {} }, originalText: o } = t, { ownLine: s = Xt, endOfLine: c = Xt, remaining: l = Xt } = a, u = n.map((r, i) => ({
|
|
1536
|
+
...Yt(e, r, t),
|
|
1537
|
+
comment: r,
|
|
1538
|
+
text: o,
|
|
1539
|
+
options: t,
|
|
1540
|
+
ast: e,
|
|
1541
|
+
isLastComment: n.length - 1 === i
|
|
1542
|
+
}));
|
|
1543
|
+
for (let [e, t] of u.entries()) {
|
|
1544
|
+
let { comment: n, precedingNode: a, enclosingNode: o, followingNode: d, text: f, options: p, ast: m, isLastComment: h } = t, g;
|
|
1545
|
+
if (i ? g = [t] : (n.enclosingNode = o, n.precedingNode = a, n.followingNode = d, g = [
|
|
1546
|
+
n,
|
|
1547
|
+
f,
|
|
1548
|
+
p,
|
|
1549
|
+
m,
|
|
1550
|
+
h
|
|
1551
|
+
]), $t(f, p, u, e)) n.placement = "ownLine", s(...g) || (d ? Gt(d, n) : a ? qt(a, n) : Kt(o || m, n));
|
|
1552
|
+
else if (en(f, p, u, e)) n.placement = "endOfLine", c(...g) || (a ? qt(a, n) : d ? Gt(d, n) : Kt(o || m, n));
|
|
1553
|
+
else if (n.placement = "remaining", !l(...g)) if (a && d) {
|
|
1554
|
+
let e = r.length;
|
|
1555
|
+
e > 0 && r[e - 1].followingNode !== d && tn(r, p), r.push(t);
|
|
1556
|
+
} else a ? qt(a, n) : d ? Gt(d, n) : Kt(o || m, n);
|
|
1557
|
+
}
|
|
1558
|
+
if (tn(r, t), !i) for (let e of n) delete e.precedingNode, delete e.enclosingNode, delete e.followingNode;
|
|
1559
|
+
}
|
|
1560
|
+
var Qt = (e) => !/[\S\n\u2028\u2029]/u.test(e);
|
|
1561
|
+
function $t(e, t, n, r) {
|
|
1562
|
+
let { comment: i, precedingNode: a } = n[r], { locStart: o, locEnd: s } = t, c = o(i);
|
|
1563
|
+
if (a) for (let t = r - 1; t >= 0; t--) {
|
|
1564
|
+
let { comment: r, precedingNode: i } = n[t];
|
|
1565
|
+
if (i !== a || !Qt(e.slice(s(r), c))) break;
|
|
1566
|
+
c = o(r);
|
|
1567
|
+
}
|
|
1568
|
+
return Z(e, c, { backwards: !0 });
|
|
1569
|
+
}
|
|
1570
|
+
function en(e, t, n, r) {
|
|
1571
|
+
let { comment: i, followingNode: a } = n[r], { locStart: o, locEnd: s } = t, c = s(i);
|
|
1572
|
+
if (a) for (let t = r + 1; t < n.length; t++) {
|
|
1573
|
+
let { comment: r, followingNode: i } = n[t];
|
|
1574
|
+
if (i !== a || !Qt(e.slice(c, o(r)))) break;
|
|
1575
|
+
c = s(r);
|
|
1576
|
+
}
|
|
1577
|
+
return Z(e, c);
|
|
1578
|
+
}
|
|
1579
|
+
function tn(e, t) {
|
|
1580
|
+
let n = e.length;
|
|
1581
|
+
if (n === 0) return;
|
|
1582
|
+
let { precedingNode: r, followingNode: i } = e[0], a = t.locStart(i), o;
|
|
1583
|
+
for (o = n; o > 0; --o) {
|
|
1584
|
+
let { comment: n, precedingNode: r, followingNode: i } = e[o - 1], s = t.originalText.slice(t.locEnd(n), a);
|
|
1585
|
+
if (t.printer.isGap?.(s, t) ?? /^[\s(]*$/u.test(s)) a = t.locStart(n);
|
|
1586
|
+
else break;
|
|
1587
|
+
}
|
|
1588
|
+
for (let [t, { comment: n }] of e.entries()) t < o ? qt(r, n) : Gt(i, n);
|
|
1589
|
+
for (let e of [r, i]) e.comments && e.comments.length > 1 && e.comments.sort((e, n) => t.locStart(e) - t.locStart(n));
|
|
1590
|
+
e.length = 0;
|
|
1591
|
+
}
|
|
1592
|
+
function nn(e, t, n) {
|
|
1593
|
+
let r = n.locStart(t) - 1;
|
|
1594
|
+
for (let t = 1; t < e.length; ++t) if (r < n.locStart(e[t])) return t - 1;
|
|
1595
|
+
return 0;
|
|
1596
|
+
}
|
|
1597
|
+
function rn(e, t) {
|
|
1598
|
+
let n = t - 1;
|
|
1599
|
+
n = X(e, n, { backwards: !0 }), n = Pt(e, n, { backwards: !0 }), n = X(e, n, { backwards: !0 });
|
|
1600
|
+
let r = Pt(e, n, { backwards: !0 });
|
|
1601
|
+
return n !== r;
|
|
1602
|
+
}
|
|
1603
|
+
var an = rn;
|
|
1604
|
+
function on(e, t) {
|
|
1605
|
+
let n = e.node;
|
|
1606
|
+
return n.printed = !0, t.printer.printComment(e, t);
|
|
1607
|
+
}
|
|
1608
|
+
function sn(e, t) {
|
|
1609
|
+
let n = e.node, r = [on(e, t)], { printer: i, originalText: a, locStart: o, locEnd: s } = t;
|
|
1610
|
+
if (i.isBlockComment?.(n)) {
|
|
1611
|
+
let e = Z(a, s(n)) ? Z(a, o(n), { backwards: !0 }) ? K : Ye : " ";
|
|
1612
|
+
r.push(e);
|
|
1613
|
+
} else r.push(K);
|
|
1614
|
+
let c = Pt(a, X(a, s(n)));
|
|
1615
|
+
return c !== !1 && Z(a, c) && r.push(K), r;
|
|
1616
|
+
}
|
|
1617
|
+
function cn(e, t, n) {
|
|
1618
|
+
let r = e.node, i = on(e, t), { printer: a, originalText: o, locStart: s } = t, c = a.isBlockComment?.(r);
|
|
1619
|
+
return n?.hasLineSuffix && !n?.isBlock || Z(o, s(r), { backwards: !0 }) ? {
|
|
1620
|
+
doc: et([
|
|
1621
|
+
K,
|
|
1622
|
+
an(o, s(r)) ? K : "",
|
|
1623
|
+
i
|
|
1624
|
+
]),
|
|
1625
|
+
isBlock: c,
|
|
1626
|
+
hasLineSuffix: !0
|
|
1627
|
+
} : !c || n?.hasLineSuffix ? {
|
|
1628
|
+
doc: [et([" ", i]), Ve],
|
|
1629
|
+
isBlock: c,
|
|
1630
|
+
hasLineSuffix: !0
|
|
1631
|
+
} : {
|
|
1632
|
+
doc: [" ", i],
|
|
1633
|
+
isBlock: c,
|
|
1634
|
+
hasLineSuffix: !1
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
function ln(e, t) {
|
|
1638
|
+
let n = e.node;
|
|
1639
|
+
if (!n) return {};
|
|
1640
|
+
let r = t[Symbol.for("printedComments")];
|
|
1641
|
+
if ((n.comments || []).filter((e) => !r.has(e)).length === 0) return {
|
|
1642
|
+
leading: "",
|
|
1643
|
+
trailing: ""
|
|
1644
|
+
};
|
|
1645
|
+
let i = [], a = [], o;
|
|
1646
|
+
return e.each(() => {
|
|
1647
|
+
let n = e.node;
|
|
1648
|
+
if (r?.has(n)) return;
|
|
1649
|
+
let { leading: s, trailing: c } = n;
|
|
1650
|
+
s ? i.push(sn(e, t)) : c && (o = cn(e, t, o), a.push(o.doc));
|
|
1651
|
+
}, "comments"), {
|
|
1652
|
+
leading: i,
|
|
1653
|
+
trailing: a
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
function un(e, t, n) {
|
|
1657
|
+
let { leading: r, trailing: i } = ln(e, n);
|
|
1658
|
+
return !r && !i ? t : je(t, (e) => [
|
|
1659
|
+
r,
|
|
1660
|
+
e,
|
|
1661
|
+
i
|
|
1662
|
+
]);
|
|
1663
|
+
}
|
|
1664
|
+
function dn(e) {
|
|
1665
|
+
let { [Symbol.for("comments")]: t, [Symbol.for("printedComments")]: n } = e;
|
|
1666
|
+
for (let e of t) {
|
|
1667
|
+
if (!e.printed && !n.has(e)) throw Error("Comment \"" + e.value.trim() + "\" was not printed. Please report this error!");
|
|
1668
|
+
delete e.printed;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
var fn = () => v, pn = class extends Error {
|
|
1672
|
+
name = "ConfigError";
|
|
1673
|
+
}, mn = class extends Error {
|
|
1674
|
+
name = "UndefinedParserError";
|
|
1675
|
+
}, hn = {
|
|
1676
|
+
checkIgnorePragma: {
|
|
1677
|
+
category: "Special",
|
|
1678
|
+
type: "boolean",
|
|
1679
|
+
default: !1,
|
|
1680
|
+
description: "Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",
|
|
1681
|
+
cliCategory: "Other"
|
|
1682
|
+
},
|
|
1683
|
+
cursorOffset: {
|
|
1684
|
+
category: "Special",
|
|
1685
|
+
type: "int",
|
|
1686
|
+
default: -1,
|
|
1687
|
+
range: {
|
|
1688
|
+
start: -1,
|
|
1689
|
+
end: Infinity,
|
|
1690
|
+
step: 1
|
|
1691
|
+
},
|
|
1692
|
+
description: "Print (to stderr) where a cursor at the given position would move to after formatting.",
|
|
1693
|
+
cliCategory: "Editor"
|
|
1694
|
+
},
|
|
1695
|
+
endOfLine: {
|
|
1696
|
+
category: "Global",
|
|
1697
|
+
type: "choice",
|
|
1698
|
+
default: "lf",
|
|
1699
|
+
description: "Which end of line characters to apply.",
|
|
1700
|
+
choices: [
|
|
1701
|
+
{
|
|
1702
|
+
value: "lf",
|
|
1703
|
+
description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
value: "crlf",
|
|
1707
|
+
description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
value: "cr",
|
|
1711
|
+
description: "Carriage Return character only (\\r), used very rarely"
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
value: "auto",
|
|
1715
|
+
description: "Maintain existing\n(mixed values within one file are normalised by looking at what's used after the first line)"
|
|
1716
|
+
}
|
|
1717
|
+
]
|
|
1718
|
+
},
|
|
1719
|
+
filepath: {
|
|
1720
|
+
category: "Special",
|
|
1721
|
+
type: "path",
|
|
1722
|
+
description: "Specify the input filepath. This will be used to do parser inference.",
|
|
1723
|
+
cliName: "stdin-filepath",
|
|
1724
|
+
cliCategory: "Other",
|
|
1725
|
+
cliDescription: "Path to the file to pretend that stdin comes from."
|
|
1726
|
+
},
|
|
1727
|
+
insertPragma: {
|
|
1728
|
+
category: "Special",
|
|
1729
|
+
type: "boolean",
|
|
1730
|
+
default: !1,
|
|
1731
|
+
description: "Insert @format pragma into file's first docblock comment.",
|
|
1732
|
+
cliCategory: "Other"
|
|
1733
|
+
},
|
|
1734
|
+
parser: {
|
|
1735
|
+
category: "Global",
|
|
1736
|
+
type: "choice",
|
|
1737
|
+
default: void 0,
|
|
1738
|
+
description: "Which parser to use.",
|
|
1739
|
+
exception: (e) => typeof e == "string" || typeof e == "function",
|
|
1740
|
+
choices: [
|
|
1741
|
+
{
|
|
1742
|
+
value: "flow",
|
|
1743
|
+
description: "Flow"
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
value: "babel",
|
|
1747
|
+
description: "JavaScript"
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
value: "babel-flow",
|
|
1751
|
+
description: "Flow"
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
value: "babel-ts",
|
|
1755
|
+
description: "TypeScript"
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
value: "typescript",
|
|
1759
|
+
description: "TypeScript"
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
value: "acorn",
|
|
1763
|
+
description: "JavaScript"
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
value: "espree",
|
|
1767
|
+
description: "JavaScript"
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
value: "meriyah",
|
|
1771
|
+
description: "JavaScript"
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
value: "css",
|
|
1775
|
+
description: "CSS"
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
value: "less",
|
|
1779
|
+
description: "Less"
|
|
1780
|
+
},
|
|
1781
|
+
{
|
|
1782
|
+
value: "scss",
|
|
1783
|
+
description: "SCSS"
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
value: "json",
|
|
1787
|
+
description: "JSON"
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
value: "json5",
|
|
1791
|
+
description: "JSON5"
|
|
1792
|
+
},
|
|
1793
|
+
{
|
|
1794
|
+
value: "jsonc",
|
|
1795
|
+
description: "JSON with Comments"
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
value: "json-stringify",
|
|
1799
|
+
description: "JSON.stringify"
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
value: "graphql",
|
|
1803
|
+
description: "GraphQL"
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
value: "markdown",
|
|
1807
|
+
description: "Markdown"
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
value: "mdx",
|
|
1811
|
+
description: "MDX"
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
value: "vue",
|
|
1815
|
+
description: "Vue"
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
value: "yaml",
|
|
1819
|
+
description: "YAML"
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
value: "glimmer",
|
|
1823
|
+
description: "Ember / Handlebars"
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
value: "html",
|
|
1827
|
+
description: "HTML"
|
|
1828
|
+
},
|
|
1829
|
+
{
|
|
1830
|
+
value: "angular",
|
|
1831
|
+
description: "Angular"
|
|
1832
|
+
},
|
|
1833
|
+
{
|
|
1834
|
+
value: "lwc",
|
|
1835
|
+
description: "Lightning Web Components"
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
value: "mjml",
|
|
1839
|
+
description: "MJML"
|
|
1840
|
+
}
|
|
1841
|
+
]
|
|
1842
|
+
},
|
|
1843
|
+
plugins: {
|
|
1844
|
+
type: "path",
|
|
1845
|
+
array: !0,
|
|
1846
|
+
default: [{ value: [] }],
|
|
1847
|
+
category: "Global",
|
|
1848
|
+
description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
|
|
1849
|
+
exception: (e) => typeof e == "string" || typeof e == "object",
|
|
1850
|
+
cliName: "plugin",
|
|
1851
|
+
cliCategory: "Config"
|
|
1852
|
+
},
|
|
1853
|
+
printWidth: {
|
|
1854
|
+
category: "Global",
|
|
1855
|
+
type: "int",
|
|
1856
|
+
default: 80,
|
|
1857
|
+
description: "The line length where Prettier will try wrap.",
|
|
1858
|
+
range: {
|
|
1859
|
+
start: 0,
|
|
1860
|
+
end: Infinity,
|
|
1861
|
+
step: 1
|
|
1862
|
+
}
|
|
1863
|
+
},
|
|
1864
|
+
rangeEnd: {
|
|
1865
|
+
category: "Special",
|
|
1866
|
+
type: "int",
|
|
1867
|
+
default: Infinity,
|
|
1868
|
+
range: {
|
|
1869
|
+
start: 0,
|
|
1870
|
+
end: Infinity,
|
|
1871
|
+
step: 1
|
|
1872
|
+
},
|
|
1873
|
+
description: "Format code ending at a given character offset (exclusive).\nThe range will extend forwards to the end of the selected statement.",
|
|
1874
|
+
cliCategory: "Editor"
|
|
1875
|
+
},
|
|
1876
|
+
rangeStart: {
|
|
1877
|
+
category: "Special",
|
|
1878
|
+
type: "int",
|
|
1879
|
+
default: 0,
|
|
1880
|
+
range: {
|
|
1881
|
+
start: 0,
|
|
1882
|
+
end: Infinity,
|
|
1883
|
+
step: 1
|
|
1884
|
+
},
|
|
1885
|
+
description: "Format code starting at a given character offset.\nThe range will extend backwards to the start of the first line containing the selected statement.",
|
|
1886
|
+
cliCategory: "Editor"
|
|
1887
|
+
},
|
|
1888
|
+
requirePragma: {
|
|
1889
|
+
category: "Special",
|
|
1890
|
+
type: "boolean",
|
|
1891
|
+
default: !1,
|
|
1892
|
+
description: "Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",
|
|
1893
|
+
cliCategory: "Other"
|
|
1894
|
+
},
|
|
1895
|
+
tabWidth: {
|
|
1896
|
+
type: "int",
|
|
1897
|
+
category: "Global",
|
|
1898
|
+
default: 2,
|
|
1899
|
+
description: "Number of spaces per indentation level.",
|
|
1900
|
+
range: {
|
|
1901
|
+
start: 0,
|
|
1902
|
+
end: Infinity,
|
|
1903
|
+
step: 1
|
|
1904
|
+
}
|
|
1905
|
+
},
|
|
1906
|
+
useTabs: {
|
|
1907
|
+
category: "Global",
|
|
1908
|
+
type: "boolean",
|
|
1909
|
+
default: !1,
|
|
1910
|
+
description: "Indent with tabs instead of spaces."
|
|
1911
|
+
},
|
|
1912
|
+
embeddedLanguageFormatting: {
|
|
1913
|
+
category: "Global",
|
|
1914
|
+
type: "choice",
|
|
1915
|
+
default: "auto",
|
|
1916
|
+
description: "Control how Prettier formats quoted code embedded in the file.",
|
|
1917
|
+
choices: [{
|
|
1918
|
+
value: "auto",
|
|
1919
|
+
description: "Format embedded code if Prettier can automatically identify it."
|
|
1920
|
+
}, {
|
|
1921
|
+
value: "off",
|
|
1922
|
+
description: "Never automatically format embedded code."
|
|
1923
|
+
}]
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
function gn({ plugins: e = [], showDeprecated: t = !1 } = {}) {
|
|
1927
|
+
let n = e.flatMap((e) => e.languages ?? []), r = [];
|
|
1928
|
+
for (let i of vn(Object.assign({}, ...e.map(({ options: e }) => e), hn))) !t && i.deprecated || (Array.isArray(i.choices) && (t || (i.choices = i.choices.filter((e) => !e.deprecated)), i.name === "parser" && (i.choices = [...i.choices, ..._n(i.choices, n, e)])), i.pluginDefaults = Object.fromEntries(e.filter((e) => e.defaultOptions?.[i.name] !== void 0).map((e) => [e.name, e.defaultOptions[i.name]])), r.push(i));
|
|
1929
|
+
return {
|
|
1930
|
+
languages: n,
|
|
1931
|
+
options: r
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
function* _n(e, t, n) {
|
|
1935
|
+
let r = new Set(e.map((e) => e.value));
|
|
1936
|
+
for (let e of t) if (e.parsers) {
|
|
1937
|
+
for (let t of e.parsers) if (!r.has(t)) {
|
|
1938
|
+
r.add(t);
|
|
1939
|
+
let i = n.find((e) => e.parsers && Object.prototype.hasOwnProperty.call(e.parsers, t)), a = e.name;
|
|
1940
|
+
i?.name && (a += ` (plugin: ${i.name})`), yield {
|
|
1941
|
+
value: t,
|
|
1942
|
+
description: a
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
function vn(e) {
|
|
1948
|
+
let t = [];
|
|
1949
|
+
for (let [n, r] of Object.entries(e)) {
|
|
1950
|
+
let e = {
|
|
1951
|
+
name: n,
|
|
1952
|
+
...r
|
|
1953
|
+
};
|
|
1954
|
+
Array.isArray(e.default) && (e.default = O(0, e.default, -1).value), t.push(e);
|
|
1955
|
+
}
|
|
1956
|
+
return t;
|
|
1957
|
+
}
|
|
1958
|
+
var yn = Array.prototype.toReversed ?? function() {
|
|
1959
|
+
return [...this].reverse();
|
|
1960
|
+
}, bn = f("toReversed", function() {
|
|
1961
|
+
if (Array.isArray(this)) return yn;
|
|
1962
|
+
});
|
|
1963
|
+
function xn() {
|
|
1964
|
+
let e = globalThis, t = e.Deno?.build?.os;
|
|
1965
|
+
return typeof t == "string" ? t === "windows" : e.navigator?.platform?.startsWith("Win") ?? e.process?.platform?.startsWith("win") ?? !1;
|
|
1966
|
+
}
|
|
1967
|
+
var Sn = xn();
|
|
1968
|
+
function Cn(e) {
|
|
1969
|
+
if (e = e instanceof URL ? e : new URL(e), e.protocol !== "file:") throw TypeError(`URL must be a file URL: received "${e.protocol}"`);
|
|
1970
|
+
return e;
|
|
1971
|
+
}
|
|
1972
|
+
function wn(e) {
|
|
1973
|
+
return e = Cn(e), decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
|
|
1974
|
+
}
|
|
1975
|
+
function Tn(e) {
|
|
1976
|
+
e = Cn(e);
|
|
1977
|
+
let t = decodeURIComponent(e.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
|
|
1978
|
+
return e.hostname !== "" && (t = `\\\\${e.hostname}${t}`), t;
|
|
1979
|
+
}
|
|
1980
|
+
function En(e) {
|
|
1981
|
+
return Sn ? Tn(e) : wn(e);
|
|
1982
|
+
}
|
|
1983
|
+
var Dn = (e) => String(e).split(/[/\\]/u).pop(), On = (e) => String(e).startsWith("file:");
|
|
1984
|
+
function kn(e, t) {
|
|
1985
|
+
if (!t) return;
|
|
1986
|
+
let n = Dn(t).toLowerCase();
|
|
1987
|
+
return e.find(({ filenames: e }) => e?.some((e) => e.toLowerCase() === n)) ?? e.find(({ extensions: e }) => e?.some((e) => n.endsWith(e)));
|
|
1988
|
+
}
|
|
1989
|
+
function An(e, t) {
|
|
1990
|
+
if (t) return e.find(({ name: e }) => e.toLowerCase() === t) ?? e.find(({ aliases: e }) => e?.includes(t)) ?? e.find(({ extensions: e }) => e?.includes(`.${t}`));
|
|
1991
|
+
}
|
|
1992
|
+
var jn = void 0;
|
|
1993
|
+
function Mn(e, t) {
|
|
1994
|
+
if (t) {
|
|
1995
|
+
if (On(t)) try {
|
|
1996
|
+
t = En(t);
|
|
1997
|
+
} catch {
|
|
1998
|
+
return;
|
|
1999
|
+
}
|
|
2000
|
+
if (typeof t == "string") return e.find(({ isSupported: e }) => e?.({ filepath: t }));
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
function Nn(e, t) {
|
|
2004
|
+
let n = bn(0, e.plugins).flatMap((e) => e.languages ?? []);
|
|
2005
|
+
return (An(n, t.language) ?? kn(n, t.physicalFile) ?? kn(n, t.file) ?? Mn(n, t.physicalFile) ?? Mn(n, t.file) ?? jn?.(n, t.physicalFile))?.parsers[0];
|
|
2006
|
+
}
|
|
2007
|
+
var Pn = Nn, Fn = {
|
|
2008
|
+
key: (e) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e) ? e : JSON.stringify(e),
|
|
2009
|
+
value(e) {
|
|
2010
|
+
if (typeof e != "object" || !e) return JSON.stringify(e);
|
|
2011
|
+
if (Array.isArray(e)) return `[${e.map((e) => Fn.value(e)).join(", ")}]`;
|
|
2012
|
+
let t = Object.keys(e);
|
|
2013
|
+
return t.length === 0 ? "{}" : `{ ${t.map((t) => `${Fn.key(t)}: ${Fn.value(e[t])}`).join(", ")} }`;
|
|
2014
|
+
},
|
|
2015
|
+
pair: ({ key: e, value: t }) => Fn.value({ [e]: t })
|
|
2016
|
+
}, In = new Proxy(String, { get: () => In }), Q = In, Ln = () => In, Rn = (e, t, { descriptor: n }) => {
|
|
2017
|
+
let r = [`${Q.yellow(typeof e == "string" ? n.key(e) : n.pair(e))} is deprecated`];
|
|
2018
|
+
return t && r.push(`we now treat it as ${Q.blue(typeof t == "string" ? n.key(t) : n.pair(t))}`), r.join("; ") + ".";
|
|
2019
|
+
}, zn = Symbol.for("vnopts.VALUE_NOT_EXIST"), Bn = Symbol.for("vnopts.VALUE_UNCHANGED"), Vn = " ".repeat(2), Hn = (e, t, n) => {
|
|
2020
|
+
let { text: r, list: i } = n.normalizeExpectedResult(n.schemas[e].expected(n)), a = [];
|
|
2021
|
+
return r && a.push(Un(e, t, r, n.descriptor)), i && a.push([Un(e, t, i.title, n.descriptor)].concat(i.values.map((e) => Wn(e, n.loggerPrintWidth))).join("\n")), Gn(a, n.loggerPrintWidth);
|
|
2022
|
+
};
|
|
2023
|
+
function Un(e, t, n, r) {
|
|
2024
|
+
return [
|
|
2025
|
+
`Invalid ${Q.red(r.key(e))} value.`,
|
|
2026
|
+
`Expected ${Q.blue(n)},`,
|
|
2027
|
+
`but received ${t === zn ? Q.gray("nothing") : Q.red(r.value(t))}.`
|
|
2028
|
+
].join(" ");
|
|
2029
|
+
}
|
|
2030
|
+
function Wn({ text: e, list: t }, n) {
|
|
2031
|
+
let r = [];
|
|
2032
|
+
return e && r.push(`- ${Q.blue(e)}`), t && r.push([`- ${Q.blue(t.title)}:`].concat(t.values.map((e) => Wn(e, n - Vn.length).replace(/^|\n/g, `$&${Vn}`))).join("\n")), Gn(r, n);
|
|
2033
|
+
}
|
|
2034
|
+
function Gn(e, t) {
|
|
2035
|
+
if (e.length === 1) return e[0];
|
|
2036
|
+
let [n, r] = e, [i, a] = e.map((e) => e.split("\n", 1)[0].length);
|
|
2037
|
+
return i > t && i > a ? r : n;
|
|
2038
|
+
}
|
|
2039
|
+
var Kn = [], qn = [];
|
|
2040
|
+
function Jn(e, t, n) {
|
|
2041
|
+
if (e === t) return 0;
|
|
2042
|
+
let r = n?.maxDistance, i = e;
|
|
2043
|
+
e.length > t.length && (e = t, t = i);
|
|
2044
|
+
let a = e.length, o = t.length;
|
|
2045
|
+
for (; a > 0 && e.charCodeAt(~-a) === t.charCodeAt(~-o);) a--, o--;
|
|
2046
|
+
let s = 0;
|
|
2047
|
+
for (; s < a && e.charCodeAt(s) === t.charCodeAt(s);) s++;
|
|
2048
|
+
if (a -= s, o -= s, r !== void 0 && o - a > r) return r;
|
|
2049
|
+
if (a === 0) return r !== void 0 && o > r ? r : o;
|
|
2050
|
+
let c, l, u, d, f = 0, p = 0;
|
|
2051
|
+
for (; f < a;) qn[f] = e.charCodeAt(s + f), Kn[f] = ++f;
|
|
2052
|
+
for (; p < o;) {
|
|
2053
|
+
for (c = t.charCodeAt(s + p), u = p++, l = p, f = 0; f < a; f++) d = c === qn[f] ? u : u + 1, u = Kn[f], l = Kn[f] = u > l ? d > l ? l + 1 : d : d > u ? u + 1 : d;
|
|
2054
|
+
if (r !== void 0) {
|
|
2055
|
+
let e = l;
|
|
2056
|
+
for (f = 0; f < a; f++) Kn[f] < e && (e = Kn[f]);
|
|
2057
|
+
if (e > r) return r;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
return Kn.length = a, qn.length = a, r !== void 0 && l > r ? r : l;
|
|
2061
|
+
}
|
|
2062
|
+
function Yn(e, t, n) {
|
|
2063
|
+
if (!Array.isArray(t) || t.length === 0) return;
|
|
2064
|
+
let r = n?.maxDistance, i = e.length;
|
|
2065
|
+
for (let n of t) if (n === e) return n;
|
|
2066
|
+
if (r === 0) return;
|
|
2067
|
+
let a, o = Infinity, s = /* @__PURE__ */ new Set();
|
|
2068
|
+
for (let n of t) {
|
|
2069
|
+
if (s.has(n)) continue;
|
|
2070
|
+
s.add(n);
|
|
2071
|
+
let t = Math.abs(n.length - i);
|
|
2072
|
+
if (t >= o || r !== void 0 && t > r) continue;
|
|
2073
|
+
let c = Number.isFinite(o) ? r === void 0 ? o : Math.min(o, r) : r, l = c === void 0 ? Jn(e, n) : Jn(e, n, { maxDistance: c });
|
|
2074
|
+
if (r !== void 0 && l > r) continue;
|
|
2075
|
+
let u = l;
|
|
2076
|
+
if (c !== void 0 && l === c && c === r && (u = Jn(e, n)), u < o && (o = u, a = n, o === 0)) break;
|
|
2077
|
+
}
|
|
2078
|
+
if (!(r !== void 0 && o > r)) return a;
|
|
2079
|
+
}
|
|
2080
|
+
var Xn = (e, t, { descriptor: n, logger: r, schemas: i }) => {
|
|
2081
|
+
let a = [`Ignored unknown option ${Q.yellow(n.pair({
|
|
2082
|
+
key: e,
|
|
2083
|
+
value: t
|
|
2084
|
+
}))}.`], o = Yn(e, Object.keys(i), { maxDistance: 3 });
|
|
2085
|
+
o && a.push(`Did you mean ${Q.blue(n.key(o))}?`), r.warn(a.join(" "));
|
|
2086
|
+
}, Zn = [
|
|
2087
|
+
"default",
|
|
2088
|
+
"expected",
|
|
2089
|
+
"validate",
|
|
2090
|
+
"deprecated",
|
|
2091
|
+
"forward",
|
|
2092
|
+
"redirect",
|
|
2093
|
+
"overlap",
|
|
2094
|
+
"preprocess",
|
|
2095
|
+
"postprocess"
|
|
2096
|
+
];
|
|
2097
|
+
function Qn(e, t) {
|
|
2098
|
+
let n = new e(t), r = Object.create(n);
|
|
2099
|
+
for (let e of Zn) e in t && (r[e] = $n(t[e], n, $.prototype[e].length));
|
|
2100
|
+
return r;
|
|
2101
|
+
}
|
|
2102
|
+
var $ = class {
|
|
2103
|
+
static create(e) {
|
|
2104
|
+
return Qn(this, e);
|
|
2105
|
+
}
|
|
2106
|
+
constructor(e) {
|
|
2107
|
+
this.name = e.name;
|
|
2108
|
+
}
|
|
2109
|
+
default(e) {}
|
|
2110
|
+
expected(e) {
|
|
2111
|
+
return "nothing";
|
|
2112
|
+
}
|
|
2113
|
+
validate(e, t) {
|
|
2114
|
+
return !1;
|
|
2115
|
+
}
|
|
2116
|
+
deprecated(e, t) {
|
|
2117
|
+
return !1;
|
|
2118
|
+
}
|
|
2119
|
+
forward(e, t) {}
|
|
2120
|
+
redirect(e, t) {}
|
|
2121
|
+
overlap(e, t, n) {
|
|
2122
|
+
return e;
|
|
2123
|
+
}
|
|
2124
|
+
preprocess(e, t) {
|
|
2125
|
+
return e;
|
|
2126
|
+
}
|
|
2127
|
+
postprocess(e, t) {
|
|
2128
|
+
return Bn;
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2131
|
+
function $n(e, t, n) {
|
|
2132
|
+
return typeof e == "function" ? (...r) => e(...r.slice(0, n - 1), t, ...r.slice(n - 1)) : () => e;
|
|
2133
|
+
}
|
|
2134
|
+
var er = class extends $ {
|
|
2135
|
+
constructor(e) {
|
|
2136
|
+
super(e), this._sourceName = e.sourceName;
|
|
2137
|
+
}
|
|
2138
|
+
expected(e) {
|
|
2139
|
+
return e.schemas[this._sourceName].expected(e);
|
|
2140
|
+
}
|
|
2141
|
+
validate(e, t) {
|
|
2142
|
+
return t.schemas[this._sourceName].validate(e, t);
|
|
2143
|
+
}
|
|
2144
|
+
redirect(e, t) {
|
|
2145
|
+
return this._sourceName;
|
|
2146
|
+
}
|
|
2147
|
+
}, tr = class extends $ {
|
|
2148
|
+
expected() {
|
|
2149
|
+
return "anything";
|
|
2150
|
+
}
|
|
2151
|
+
validate() {
|
|
2152
|
+
return !0;
|
|
2153
|
+
}
|
|
2154
|
+
}, nr = class extends $ {
|
|
2155
|
+
constructor({ valueSchema: e, name: t = e.name, ...n }) {
|
|
2156
|
+
super({
|
|
2157
|
+
...n,
|
|
2158
|
+
name: t
|
|
2159
|
+
}), this._valueSchema = e;
|
|
2160
|
+
}
|
|
2161
|
+
expected(e) {
|
|
2162
|
+
let { text: t, list: n } = e.normalizeExpectedResult(this._valueSchema.expected(e));
|
|
2163
|
+
return {
|
|
2164
|
+
text: t && `an array of ${t}`,
|
|
2165
|
+
list: n && {
|
|
2166
|
+
title: "an array of the following values",
|
|
2167
|
+
values: [{ list: n }]
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
2170
|
+
}
|
|
2171
|
+
validate(e, t) {
|
|
2172
|
+
if (!Array.isArray(e)) return !1;
|
|
2173
|
+
let n = [];
|
|
2174
|
+
for (let r of e) {
|
|
2175
|
+
let e = t.normalizeValidateResult(this._valueSchema.validate(r, t), r);
|
|
2176
|
+
e !== !0 && n.push(e.value);
|
|
2177
|
+
}
|
|
2178
|
+
return n.length === 0 ? !0 : { value: n };
|
|
2179
|
+
}
|
|
2180
|
+
deprecated(e, t) {
|
|
2181
|
+
let n = [];
|
|
2182
|
+
for (let r of e) {
|
|
2183
|
+
let e = t.normalizeDeprecatedResult(this._valueSchema.deprecated(r, t), r);
|
|
2184
|
+
e !== !1 && n.push(...e.map(({ value: e }) => ({ value: [e] })));
|
|
2185
|
+
}
|
|
2186
|
+
return n;
|
|
2187
|
+
}
|
|
2188
|
+
forward(e, t) {
|
|
2189
|
+
let n = [];
|
|
2190
|
+
for (let r of e) {
|
|
2191
|
+
let e = t.normalizeForwardResult(this._valueSchema.forward(r, t), r);
|
|
2192
|
+
n.push(...e.map(rr));
|
|
2193
|
+
}
|
|
2194
|
+
return n;
|
|
2195
|
+
}
|
|
2196
|
+
redirect(e, t) {
|
|
2197
|
+
let n = [], r = [];
|
|
2198
|
+
for (let i of e) {
|
|
2199
|
+
let e = t.normalizeRedirectResult(this._valueSchema.redirect(i, t), i);
|
|
2200
|
+
"remain" in e && n.push(e.remain), r.push(...e.redirect.map(rr));
|
|
2201
|
+
}
|
|
2202
|
+
return n.length === 0 ? { redirect: r } : {
|
|
2203
|
+
redirect: r,
|
|
2204
|
+
remain: n
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
overlap(e, t) {
|
|
2208
|
+
return e.concat(t);
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
function rr({ from: e, to: t }) {
|
|
2212
|
+
return {
|
|
2213
|
+
from: [e],
|
|
2214
|
+
to: t
|
|
2215
|
+
};
|
|
2216
|
+
}
|
|
2217
|
+
var ir = class extends $ {
|
|
2218
|
+
expected() {
|
|
2219
|
+
return "true or false";
|
|
2220
|
+
}
|
|
2221
|
+
validate(e) {
|
|
2222
|
+
return typeof e == "boolean";
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2225
|
+
function ar(e, t) {
|
|
2226
|
+
let n = Object.create(null);
|
|
2227
|
+
for (let r of e) {
|
|
2228
|
+
let e = r[t];
|
|
2229
|
+
if (n[e]) throw Error(`Duplicate ${t} ${JSON.stringify(e)}`);
|
|
2230
|
+
n[e] = r;
|
|
2231
|
+
}
|
|
2232
|
+
return n;
|
|
2233
|
+
}
|
|
2234
|
+
function or(e, t) {
|
|
2235
|
+
let n = /* @__PURE__ */ new Map();
|
|
2236
|
+
for (let r of e) {
|
|
2237
|
+
let e = r[t];
|
|
2238
|
+
if (n.has(e)) throw Error(`Duplicate ${t} ${JSON.stringify(e)}`);
|
|
2239
|
+
n.set(e, r);
|
|
2240
|
+
}
|
|
2241
|
+
return n;
|
|
2242
|
+
}
|
|
2243
|
+
function sr() {
|
|
2244
|
+
let e = Object.create(null);
|
|
2245
|
+
return (t) => {
|
|
2246
|
+
let n = JSON.stringify(t);
|
|
2247
|
+
return e[n] ? !0 : (e[n] = !0, !1);
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
function cr(e, t) {
|
|
2251
|
+
let n = [], r = [];
|
|
2252
|
+
for (let i of e) t(i) ? n.push(i) : r.push(i);
|
|
2253
|
+
return [n, r];
|
|
2254
|
+
}
|
|
2255
|
+
function lr(e) {
|
|
2256
|
+
return e === Math.floor(e);
|
|
2257
|
+
}
|
|
2258
|
+
function ur(e, t) {
|
|
2259
|
+
if (e === t) return 0;
|
|
2260
|
+
let n = typeof e, r = typeof t, i = [
|
|
2261
|
+
"undefined",
|
|
2262
|
+
"object",
|
|
2263
|
+
"boolean",
|
|
2264
|
+
"number",
|
|
2265
|
+
"string"
|
|
2266
|
+
];
|
|
2267
|
+
return n === r ? n === "string" ? e.localeCompare(t) : Number(e) - Number(t) : i.indexOf(n) - i.indexOf(r);
|
|
2268
|
+
}
|
|
2269
|
+
function dr(e) {
|
|
2270
|
+
return (...t) => {
|
|
2271
|
+
let n = e(...t);
|
|
2272
|
+
return typeof n == "string" ? Error(n) : n;
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
function fr(e) {
|
|
2276
|
+
return e === void 0 ? {} : e;
|
|
2277
|
+
}
|
|
2278
|
+
function pr(e) {
|
|
2279
|
+
if (typeof e == "string") return { text: e };
|
|
2280
|
+
let { text: t, list: n } = e;
|
|
2281
|
+
return yr((t || n) !== void 0, "Unexpected `expected` result, there should be at least one field."), n ? {
|
|
2282
|
+
text: t,
|
|
2283
|
+
list: {
|
|
2284
|
+
title: n.title,
|
|
2285
|
+
values: n.values.map(pr)
|
|
2286
|
+
}
|
|
2287
|
+
} : { text: t };
|
|
2288
|
+
}
|
|
2289
|
+
function mr(e, t) {
|
|
2290
|
+
return e === !0 ? !0 : e === !1 ? { value: t } : e;
|
|
2291
|
+
}
|
|
2292
|
+
function hr(e, t, n = !1) {
|
|
2293
|
+
return e === !1 ? !1 : e === !0 ? n ? !0 : [{ value: t }] : "value" in e ? [e] : e.length === 0 ? !1 : e;
|
|
2294
|
+
}
|
|
2295
|
+
function gr(e, t) {
|
|
2296
|
+
return typeof e == "string" || "key" in e ? {
|
|
2297
|
+
from: t,
|
|
2298
|
+
to: e
|
|
2299
|
+
} : "from" in e ? {
|
|
2300
|
+
from: e.from,
|
|
2301
|
+
to: e.to
|
|
2302
|
+
} : {
|
|
2303
|
+
from: t,
|
|
2304
|
+
to: e.to
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
function _r(e, t) {
|
|
2308
|
+
return e === void 0 ? [] : Array.isArray(e) ? e.map((e) => gr(e, t)) : [gr(e, t)];
|
|
2309
|
+
}
|
|
2310
|
+
function vr(e, t) {
|
|
2311
|
+
let n = _r(typeof e == "object" && "redirect" in e ? e.redirect : e, t);
|
|
2312
|
+
return n.length === 0 ? {
|
|
2313
|
+
remain: t,
|
|
2314
|
+
redirect: n
|
|
2315
|
+
} : typeof e == "object" && "remain" in e ? {
|
|
2316
|
+
remain: e.remain,
|
|
2317
|
+
redirect: n
|
|
2318
|
+
} : { redirect: n };
|
|
2319
|
+
}
|
|
2320
|
+
function yr(e, t) {
|
|
2321
|
+
if (!e) throw Error(t);
|
|
2322
|
+
}
|
|
2323
|
+
var br = class extends $ {
|
|
2324
|
+
constructor(e) {
|
|
2325
|
+
super(e), this._choices = or(e.choices.map((e) => e && typeof e == "object" ? e : { value: e }), "value");
|
|
2326
|
+
}
|
|
2327
|
+
expected({ descriptor: e }) {
|
|
2328
|
+
let t = Array.from(this._choices.keys()).map((e) => this._choices.get(e)).filter(({ hidden: e }) => !e).map((e) => e.value).sort(ur).map(e.value), n = t.slice(0, -2), r = t.slice(-2);
|
|
2329
|
+
return {
|
|
2330
|
+
text: n.concat(r.join(" or ")).join(", "),
|
|
2331
|
+
list: {
|
|
2332
|
+
title: "one of the following values",
|
|
2333
|
+
values: t
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
}
|
|
2337
|
+
validate(e) {
|
|
2338
|
+
return this._choices.has(e);
|
|
2339
|
+
}
|
|
2340
|
+
deprecated(e) {
|
|
2341
|
+
let t = this._choices.get(e);
|
|
2342
|
+
return t && t.deprecated ? { value: e } : !1;
|
|
2343
|
+
}
|
|
2344
|
+
forward(e) {
|
|
2345
|
+
let t = this._choices.get(e);
|
|
2346
|
+
return t ? t.forward : void 0;
|
|
2347
|
+
}
|
|
2348
|
+
redirect(e) {
|
|
2349
|
+
let t = this._choices.get(e);
|
|
2350
|
+
return t ? t.redirect : void 0;
|
|
2351
|
+
}
|
|
2352
|
+
}, xr = class extends $ {
|
|
2353
|
+
expected() {
|
|
2354
|
+
return "a number";
|
|
2355
|
+
}
|
|
2356
|
+
validate(e, t) {
|
|
2357
|
+
return typeof e == "number";
|
|
2358
|
+
}
|
|
2359
|
+
}, Sr = class extends xr {
|
|
2360
|
+
expected() {
|
|
2361
|
+
return "an integer";
|
|
2362
|
+
}
|
|
2363
|
+
validate(e, t) {
|
|
2364
|
+
return t.normalizeValidateResult(super.validate(e, t), e) === !0 && lr(e);
|
|
2365
|
+
}
|
|
2366
|
+
}, Cr = class extends $ {
|
|
2367
|
+
expected() {
|
|
2368
|
+
return "a string";
|
|
2369
|
+
}
|
|
2370
|
+
validate(e) {
|
|
2371
|
+
return typeof e == "string";
|
|
2372
|
+
}
|
|
2373
|
+
}, wr = Fn, Tr = Xn, Er = Hn, Dr = Rn, Or = class {
|
|
2374
|
+
constructor(e, t) {
|
|
2375
|
+
let { logger: n = console, loggerPrintWidth: r = 80, descriptor: i = wr, unknown: a = Tr, invalid: o = Er, deprecated: s = Dr, missing: c = () => !1, required: l = () => !1, preprocess: u = (e) => e, postprocess: d = () => Bn } = t || {};
|
|
2376
|
+
this._utils = {
|
|
2377
|
+
descriptor: i,
|
|
2378
|
+
logger: n || { warn: () => {} },
|
|
2379
|
+
loggerPrintWidth: r,
|
|
2380
|
+
schemas: ar(e, "name"),
|
|
2381
|
+
normalizeDefaultResult: fr,
|
|
2382
|
+
normalizeExpectedResult: pr,
|
|
2383
|
+
normalizeDeprecatedResult: hr,
|
|
2384
|
+
normalizeForwardResult: _r,
|
|
2385
|
+
normalizeRedirectResult: vr,
|
|
2386
|
+
normalizeValidateResult: mr
|
|
2387
|
+
}, this._unknownHandler = a, this._invalidHandler = dr(o), this._deprecatedHandler = s, this._identifyMissing = (e, t) => !(e in t) || c(e, t), this._identifyRequired = l, this._preprocess = u, this._postprocess = d, this.cleanHistory();
|
|
2388
|
+
}
|
|
2389
|
+
cleanHistory() {
|
|
2390
|
+
this._hasDeprecationWarned = sr();
|
|
2391
|
+
}
|
|
2392
|
+
normalize(e) {
|
|
2393
|
+
let t = {}, n = [this._preprocess(e, this._utils)], r = () => {
|
|
2394
|
+
for (; n.length !== 0;) {
|
|
2395
|
+
let e = n.shift(), r = this._applyNormalization(e, t);
|
|
2396
|
+
n.push(...r);
|
|
2397
|
+
}
|
|
2398
|
+
};
|
|
2399
|
+
r();
|
|
2400
|
+
for (let e of Object.keys(this._utils.schemas)) {
|
|
2401
|
+
let r = this._utils.schemas[e];
|
|
2402
|
+
if (!(e in t)) {
|
|
2403
|
+
let t = fr(r.default(this._utils));
|
|
2404
|
+
"value" in t && n.push({ [e]: t.value });
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
r();
|
|
2408
|
+
for (let e of Object.keys(this._utils.schemas)) {
|
|
2409
|
+
if (!(e in t)) continue;
|
|
2410
|
+
let n = this._utils.schemas[e], r = t[e], i = n.postprocess(r, this._utils);
|
|
2411
|
+
i !== Bn && (this._applyValidation(i, e, n), t[e] = i);
|
|
2412
|
+
}
|
|
2413
|
+
return this._applyPostprocess(t), this._applyRequiredCheck(t), t;
|
|
2414
|
+
}
|
|
2415
|
+
_applyNormalization(e, t) {
|
|
2416
|
+
let n = [], { knownKeys: r, unknownKeys: i } = this._partitionOptionKeys(e);
|
|
2417
|
+
for (let i of r) {
|
|
2418
|
+
let r = this._utils.schemas[i], a = r.preprocess(e[i], this._utils);
|
|
2419
|
+
this._applyValidation(a, i, r);
|
|
2420
|
+
let o = ({ from: e, to: t }) => {
|
|
2421
|
+
n.push(typeof t == "string" ? { [t]: e } : { [t.key]: t.value });
|
|
2422
|
+
}, s = ({ value: e, redirectTo: t }) => {
|
|
2423
|
+
let n = hr(r.deprecated(e, this._utils), a, !0);
|
|
2424
|
+
if (n !== !1) if (n === !0) this._hasDeprecationWarned(i) || this._utils.logger.warn(this._deprecatedHandler(i, t, this._utils));
|
|
2425
|
+
else for (let { value: e } of n) {
|
|
2426
|
+
let n = {
|
|
2427
|
+
key: i,
|
|
2428
|
+
value: e
|
|
2429
|
+
};
|
|
2430
|
+
if (!this._hasDeprecationWarned(n)) {
|
|
2431
|
+
let r = typeof t == "string" ? {
|
|
2432
|
+
key: t,
|
|
2433
|
+
value: e
|
|
2434
|
+
} : t;
|
|
2435
|
+
this._utils.logger.warn(this._deprecatedHandler(n, r, this._utils));
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
};
|
|
2439
|
+
_r(r.forward(a, this._utils), a).forEach(o);
|
|
2440
|
+
let c = vr(r.redirect(a, this._utils), a);
|
|
2441
|
+
if (c.redirect.forEach(o), "remain" in c) {
|
|
2442
|
+
let e = c.remain;
|
|
2443
|
+
t[i] = i in t ? r.overlap(t[i], e, this._utils) : e, s({ value: e });
|
|
2444
|
+
}
|
|
2445
|
+
for (let { from: e, to: t } of c.redirect) s({
|
|
2446
|
+
value: e,
|
|
2447
|
+
redirectTo: t
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
for (let r of i) {
|
|
2451
|
+
let i = e[r];
|
|
2452
|
+
this._applyUnknownHandler(r, i, t, (e, t) => {
|
|
2453
|
+
n.push({ [e]: t });
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2456
|
+
return n;
|
|
2457
|
+
}
|
|
2458
|
+
_applyRequiredCheck(e) {
|
|
2459
|
+
for (let t of Object.keys(this._utils.schemas)) if (this._identifyMissing(t, e) && this._identifyRequired(t)) throw this._invalidHandler(t, zn, this._utils);
|
|
2460
|
+
}
|
|
2461
|
+
_partitionOptionKeys(e) {
|
|
2462
|
+
let [t, n] = cr(Object.keys(e).filter((t) => !this._identifyMissing(t, e)), (e) => e in this._utils.schemas);
|
|
2463
|
+
return {
|
|
2464
|
+
knownKeys: t,
|
|
2465
|
+
unknownKeys: n
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2468
|
+
_applyValidation(e, t, n) {
|
|
2469
|
+
let r = mr(n.validate(e, this._utils), e);
|
|
2470
|
+
if (r !== !0) throw this._invalidHandler(t, r.value, this._utils);
|
|
2471
|
+
}
|
|
2472
|
+
_applyUnknownHandler(e, t, n, r) {
|
|
2473
|
+
let i = this._unknownHandler(e, t, this._utils);
|
|
2474
|
+
if (i) for (let e of Object.keys(i)) {
|
|
2475
|
+
if (this._identifyMissing(e, i)) continue;
|
|
2476
|
+
let t = i[e];
|
|
2477
|
+
e in this._utils.schemas ? r(e, t) : n[e] = t;
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
_applyPostprocess(e) {
|
|
2481
|
+
let t = this._postprocess(e, this._utils);
|
|
2482
|
+
if (t !== Bn) {
|
|
2483
|
+
if (t.delete) for (let n of t.delete) delete e[n];
|
|
2484
|
+
if (t.override) {
|
|
2485
|
+
let { knownKeys: n, unknownKeys: r } = this._partitionOptionKeys(t.override);
|
|
2486
|
+
for (let r of n) {
|
|
2487
|
+
let n = t.override[r];
|
|
2488
|
+
this._applyValidation(n, r, this._utils.schemas[r]), e[r] = n;
|
|
2489
|
+
}
|
|
2490
|
+
for (let n of r) {
|
|
2491
|
+
let r = t.override[n];
|
|
2492
|
+
this._applyUnknownHandler(n, r, e, (t, n) => {
|
|
2493
|
+
let r = this._utils.schemas[t];
|
|
2494
|
+
this._applyValidation(n, t, r), e[t] = n;
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
}, kr;
|
|
2501
|
+
function Ar(e, t, { logger: n = !1, isCLI: r = !1, passThrough: i = !1, FlagSchema: a, descriptor: o } = {}) {
|
|
2502
|
+
if (r) {
|
|
2503
|
+
if (!a) throw Error("'FlagSchema' option is required.");
|
|
2504
|
+
if (!o) throw Error("'descriptor' option is required.");
|
|
2505
|
+
} else o = Fn;
|
|
2506
|
+
let s = i ? Array.isArray(i) ? (e, t) => i.includes(e) ? { [e]: t } : void 0 : (e, t) => ({ [e]: t }) : (e, t, n) => {
|
|
2507
|
+
let { _: r, ...i } = n.schemas;
|
|
2508
|
+
return Xn(e, t, {
|
|
2509
|
+
...n,
|
|
2510
|
+
schemas: i
|
|
2511
|
+
});
|
|
2512
|
+
}, c = new Or(jr(t, {
|
|
2513
|
+
isCLI: r,
|
|
2514
|
+
FlagSchema: a
|
|
2515
|
+
}), {
|
|
2516
|
+
logger: n,
|
|
2517
|
+
unknown: s,
|
|
2518
|
+
descriptor: o
|
|
2519
|
+
}), l = n !== !1;
|
|
2520
|
+
l && kr && (c._hasDeprecationWarned = kr);
|
|
2521
|
+
let u = c.normalize(e);
|
|
2522
|
+
return l && (kr = c._hasDeprecationWarned), u;
|
|
2523
|
+
}
|
|
2524
|
+
function jr(e, { isCLI: t, FlagSchema: n }) {
|
|
2525
|
+
let r = [];
|
|
2526
|
+
t && r.push(tr.create({ name: "_" }));
|
|
2527
|
+
for (let i of e) r.push(Mr(i, {
|
|
2528
|
+
isCLI: t,
|
|
2529
|
+
optionInfos: e,
|
|
2530
|
+
FlagSchema: n
|
|
2531
|
+
})), i.alias && t && r.push(er.create({
|
|
2532
|
+
name: i.alias,
|
|
2533
|
+
sourceName: i.name
|
|
2534
|
+
}));
|
|
2535
|
+
return r;
|
|
2536
|
+
}
|
|
2537
|
+
function Mr(e, { isCLI: t, optionInfos: n, FlagSchema: r }) {
|
|
2538
|
+
let { name: i } = e, a = { name: i }, o, s = {};
|
|
2539
|
+
switch (e.type) {
|
|
2540
|
+
case "int":
|
|
2541
|
+
o = Sr, t && (a.preprocess = Number);
|
|
2542
|
+
break;
|
|
2543
|
+
case "string":
|
|
2544
|
+
o = Cr;
|
|
2545
|
+
break;
|
|
2546
|
+
case "choice":
|
|
2547
|
+
o = br, a.choices = e.choices.map((t) => t?.redirect ? {
|
|
2548
|
+
...t,
|
|
2549
|
+
redirect: { to: {
|
|
2550
|
+
key: e.name,
|
|
2551
|
+
value: t.redirect
|
|
2552
|
+
} }
|
|
2553
|
+
} : t);
|
|
2554
|
+
break;
|
|
2555
|
+
case "boolean":
|
|
2556
|
+
o = ir;
|
|
2557
|
+
break;
|
|
2558
|
+
case "flag":
|
|
2559
|
+
o = r, a.flags = n.flatMap((e) => [
|
|
2560
|
+
e.alias,
|
|
2561
|
+
e.description && e.name,
|
|
2562
|
+
e.oppositeDescription && `no-${e.name}`
|
|
2563
|
+
].filter(Boolean));
|
|
2564
|
+
break;
|
|
2565
|
+
case "path":
|
|
2566
|
+
o = Cr;
|
|
2567
|
+
break;
|
|
2568
|
+
default: throw Error(`Unexpected type ${e.type}`);
|
|
2569
|
+
}
|
|
2570
|
+
if (e.exception ? a.validate = (t, n, r) => e.exception(t) || n.validate(t, r) : a.validate = (e, t, n) => e === void 0 || t.validate(e, n), e.redirect && (s.redirect = (t) => t ? { to: typeof e.redirect == "string" ? e.redirect : {
|
|
2571
|
+
key: e.redirect.option,
|
|
2572
|
+
value: e.redirect.value
|
|
2573
|
+
} } : void 0), e.deprecated && (s.deprecated = !0), t && !e.array) {
|
|
2574
|
+
let e = a.preprocess || ((e) => e);
|
|
2575
|
+
a.preprocess = (t, n, r) => n.preprocess(e(Array.isArray(t) ? O(0, t, -1) : t), r);
|
|
2576
|
+
}
|
|
2577
|
+
return e.array ? nr.create({
|
|
2578
|
+
...t ? { preprocess: (e) => Array.isArray(e) ? e : [e] } : {},
|
|
2579
|
+
...s,
|
|
2580
|
+
valueSchema: o.create(a)
|
|
2581
|
+
}) : o.create({
|
|
2582
|
+
...a,
|
|
2583
|
+
...s
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
var Nr = Ar, Pr = Array.prototype.findLast ?? function(e) {
|
|
2587
|
+
for (let t = this.length - 1; t >= 0; t--) {
|
|
2588
|
+
let n = this[t];
|
|
2589
|
+
if (e(n, t, this)) return n;
|
|
2590
|
+
}
|
|
2591
|
+
}, Fr = f("findLast", function() {
|
|
2592
|
+
if (Array.isArray(this)) return Pr;
|
|
2593
|
+
}), Ir = Symbol.for("PRETTIER_IS_FRONT_MATTER"), Lr = [];
|
|
2594
|
+
function Rr(e) {
|
|
2595
|
+
return !!e?.[Ir];
|
|
2596
|
+
}
|
|
2597
|
+
var zr = Rr, Br = new Set(["yaml", "toml"]), Vr = ({ node: e }) => zr(e) && Br.has(e.language);
|
|
2598
|
+
async function Hr(e, t, n, r) {
|
|
2599
|
+
let { node: i } = n, { language: a } = i;
|
|
2600
|
+
if (!Br.has(a)) return;
|
|
2601
|
+
let o = i.value.trim(), s;
|
|
2602
|
+
if (o) {
|
|
2603
|
+
let t = a === "yaml" ? a : Pn(r, { language: a });
|
|
2604
|
+
if (!t) return;
|
|
2605
|
+
s = o ? await e(o, { parser: t }) : "";
|
|
2606
|
+
} else s = o;
|
|
2607
|
+
return Re([
|
|
2608
|
+
i.startDelimiter,
|
|
2609
|
+
i.explicitLanguage ?? "",
|
|
2610
|
+
K,
|
|
2611
|
+
s,
|
|
2612
|
+
s ? K : "",
|
|
2613
|
+
i.endDelimiter
|
|
2614
|
+
]);
|
|
2615
|
+
}
|
|
2616
|
+
function Ur(e, t) {
|
|
2617
|
+
return Vr({ node: e }) && (delete t.end, delete t.raw, delete t.value), t;
|
|
2618
|
+
}
|
|
2619
|
+
var Wr = Ur;
|
|
2620
|
+
function Gr({ node: e }) {
|
|
2621
|
+
return e.raw;
|
|
2622
|
+
}
|
|
2623
|
+
var Kr = Gr, qr = new Set([
|
|
2624
|
+
"tokens",
|
|
2625
|
+
"comments",
|
|
2626
|
+
"parent",
|
|
2627
|
+
"enclosingNode",
|
|
2628
|
+
"precedingNode",
|
|
2629
|
+
"followingNode"
|
|
2630
|
+
]), Jr = (e) => Object.keys(e).filter((e) => !qr.has(e));
|
|
2631
|
+
function Yr(e, t) {
|
|
2632
|
+
let n = e ? (t) => e(t, qr) : Jr;
|
|
2633
|
+
return t ? new Proxy(n, { apply: (e, t, n) => zr(n[0]) ? Lr : Reflect.apply(e, t, n) }) : n;
|
|
2634
|
+
}
|
|
2635
|
+
var Xr = Yr;
|
|
2636
|
+
function Zr(e, t) {
|
|
2637
|
+
if (!t) throw Error("parserName is required.");
|
|
2638
|
+
let n = Fr(0, e, (e) => e.parsers && Object.prototype.hasOwnProperty.call(e.parsers, t));
|
|
2639
|
+
if (n) return n;
|
|
2640
|
+
let r = `Couldn't resolve parser "${t}".`;
|
|
2641
|
+
throw r += " Plugins must be explicitly added to the standalone bundle.", new pn(r);
|
|
2642
|
+
}
|
|
2643
|
+
function Qr(e, t) {
|
|
2644
|
+
if (!t) throw Error("astFormat is required.");
|
|
2645
|
+
let n = Fr(0, e, (e) => e.printers && Object.prototype.hasOwnProperty.call(e.printers, t));
|
|
2646
|
+
if (n) return n;
|
|
2647
|
+
let r = `Couldn't find plugin for AST format "${t}".`;
|
|
2648
|
+
throw r += " Plugins must be explicitly added to the standalone bundle.", new pn(r);
|
|
2649
|
+
}
|
|
2650
|
+
function $r({ plugins: e, parser: t }) {
|
|
2651
|
+
return ei(Zr(e, t), t);
|
|
2652
|
+
}
|
|
2653
|
+
function ei(e, t) {
|
|
2654
|
+
let n = e.parsers[t];
|
|
2655
|
+
return typeof n == "function" ? n() : n;
|
|
2656
|
+
}
|
|
2657
|
+
async function ti(e, t) {
|
|
2658
|
+
let n = e.printers[t];
|
|
2659
|
+
return ri(typeof n == "function" ? await n() : n);
|
|
2660
|
+
}
|
|
2661
|
+
var ni = /* @__PURE__ */ new WeakMap();
|
|
2662
|
+
function ri(e) {
|
|
2663
|
+
if (ni.has(e)) return ni.get(e);
|
|
2664
|
+
let { features: t, getVisitorKeys: n, embed: r, massageAstNode: i, print: a, ...o } = e;
|
|
2665
|
+
t = oi(t);
|
|
2666
|
+
let s = t.experimental_frontMatterSupport;
|
|
2667
|
+
n = Xr(n, s.massageAstNode || s.embed || s.print);
|
|
2668
|
+
let c = i;
|
|
2669
|
+
i && s.massageAstNode && (c = new Proxy(i, { apply(e, t, n) {
|
|
2670
|
+
return Wr(...n), Reflect.apply(e, t, n);
|
|
2671
|
+
} }));
|
|
2672
|
+
let l = r;
|
|
2673
|
+
if (r) {
|
|
2674
|
+
let e;
|
|
2675
|
+
l = new Proxy(r, {
|
|
2676
|
+
get(t, i, a) {
|
|
2677
|
+
return i === "getVisitorKeys" ? (e ??= r.getVisitorKeys ? Xr(r.getVisitorKeys, s.massageAstNode || s.embed) : n, e) : Reflect.get(t, i, a);
|
|
2678
|
+
},
|
|
2679
|
+
apply: (e, t, n) => s.embed && Vr(...n) ? Hr : Reflect.apply(e, t, n)
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
let u = a;
|
|
2683
|
+
s.print && (u = new Proxy(a, { apply(e, t, n) {
|
|
2684
|
+
let [r] = n;
|
|
2685
|
+
return zr(r.node) ? Kr(r) : Reflect.apply(e, t, n);
|
|
2686
|
+
} }));
|
|
2687
|
+
let d = {
|
|
2688
|
+
features: t,
|
|
2689
|
+
getVisitorKeys: n,
|
|
2690
|
+
embed: l,
|
|
2691
|
+
massageAstNode: c,
|
|
2692
|
+
print: u,
|
|
2693
|
+
...o
|
|
2694
|
+
};
|
|
2695
|
+
return ni.set(e, d), d;
|
|
2696
|
+
}
|
|
2697
|
+
var ii = Object.fromEntries([
|
|
2698
|
+
"clean",
|
|
2699
|
+
"embed",
|
|
2700
|
+
"print"
|
|
2701
|
+
].map((e) => [e, !1]));
|
|
2702
|
+
function ai(e) {
|
|
2703
|
+
return {
|
|
2704
|
+
...ii,
|
|
2705
|
+
...e
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2708
|
+
function oi(e) {
|
|
2709
|
+
return {
|
|
2710
|
+
experimental_avoidAstMutation: !1,
|
|
2711
|
+
...e,
|
|
2712
|
+
experimental_frontMatterSupport: ai(e?.experimental_frontMatterSupport)
|
|
2713
|
+
};
|
|
2714
|
+
}
|
|
2715
|
+
var si = {
|
|
2716
|
+
astFormat: "estree",
|
|
2717
|
+
printer: {},
|
|
2718
|
+
originalText: void 0,
|
|
2719
|
+
locStart: null,
|
|
2720
|
+
locEnd: null,
|
|
2721
|
+
getVisitorKeys: null
|
|
2722
|
+
};
|
|
2723
|
+
async function ci(e, t = {}) {
|
|
2724
|
+
let n = { ...e };
|
|
2725
|
+
if (!n.parser) if (n.filepath) {
|
|
2726
|
+
if (n.parser = Pn(n, { physicalFile: n.filepath }), !n.parser) throw new mn(`No parser could be inferred for file "${n.filepath}".`);
|
|
2727
|
+
} else throw new mn("No parser and no file path given, couldn't infer a parser.");
|
|
2728
|
+
let r = gn({
|
|
2729
|
+
plugins: e.plugins,
|
|
2730
|
+
showDeprecated: !0
|
|
2731
|
+
}).options, i = {
|
|
2732
|
+
...si,
|
|
2733
|
+
...Object.fromEntries(r.filter((e) => e.default !== void 0).map((e) => [e.name, e.default]))
|
|
2734
|
+
}, a = Zr(n.plugins, n.parser), o = await ei(a, n.parser);
|
|
2735
|
+
n.astFormat = o.astFormat, n.locEnd = o.locEnd, n.locStart = o.locStart;
|
|
2736
|
+
let s = a.printers?.[o.astFormat] ? a : Qr(n.plugins, o.astFormat), c = await ti(s, o.astFormat);
|
|
2737
|
+
n.printer = c, n.getVisitorKeys = c.getVisitorKeys;
|
|
2738
|
+
let l = s.defaultOptions ? Object.fromEntries(Object.entries(s.defaultOptions).filter(([, e]) => e !== void 0)) : {}, u = {
|
|
2739
|
+
...i,
|
|
2740
|
+
...l
|
|
2741
|
+
};
|
|
2742
|
+
for (let [e, t] of Object.entries(u)) (n[e] === null || n[e] === void 0) && (n[e] = t);
|
|
2743
|
+
return n.parser === "json" && (n.trailingComma = "none"), Nr(n, r, {
|
|
2744
|
+
passThrough: Object.keys(si),
|
|
2745
|
+
...t
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
var li = ci;
|
|
2749
|
+
l(u(), 1);
|
|
2750
|
+
var ui = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ", di = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";
|
|
2751
|
+
RegExp("[" + ui + "]"), RegExp("[" + ui + di + "]"), ui = di = null;
|
|
2752
|
+
var fi = {
|
|
2753
|
+
keyword: /* @__PURE__ */ "break.case.catch.continue.debugger.default.do.else.finally.for.function.if.return.switch.throw.try.var.const.while.with.new.this.super.class.extends.export.import.null.true.false.in.instanceof.typeof.void.delete".split("."),
|
|
2754
|
+
strict: [
|
|
2755
|
+
"implements",
|
|
2756
|
+
"interface",
|
|
2757
|
+
"let",
|
|
2758
|
+
"package",
|
|
2759
|
+
"private",
|
|
2760
|
+
"protected",
|
|
2761
|
+
"public",
|
|
2762
|
+
"static",
|
|
2763
|
+
"yield"
|
|
2764
|
+
],
|
|
2765
|
+
strictBind: ["eval", "arguments"]
|
|
2766
|
+
};
|
|
2767
|
+
new Set(fi.keyword), new Set(fi.strict), new Set(fi.strictBind);
|
|
2768
|
+
var pi = (e, t) => (n) => e(t(n));
|
|
2769
|
+
function mi(e) {
|
|
2770
|
+
return {
|
|
2771
|
+
keyword: e.cyan,
|
|
2772
|
+
capitalized: e.yellow,
|
|
2773
|
+
jsxIdentifier: e.yellow,
|
|
2774
|
+
punctuator: e.yellow,
|
|
2775
|
+
number: e.magenta,
|
|
2776
|
+
string: e.green,
|
|
2777
|
+
regex: e.magenta,
|
|
2778
|
+
comment: e.gray,
|
|
2779
|
+
invalid: pi(pi(e.white, e.bgRed), e.bold),
|
|
2780
|
+
gutter: e.gray,
|
|
2781
|
+
marker: pi(e.red, e.bold),
|
|
2782
|
+
message: pi(e.red, e.bold),
|
|
2783
|
+
reset: e.reset
|
|
2784
|
+
};
|
|
2785
|
+
}
|
|
2786
|
+
mi(Ln(!0)), mi(Ln(!1));
|
|
2787
|
+
function hi() {
|
|
2788
|
+
return new Proxy({}, { get: () => (e) => e });
|
|
2789
|
+
}
|
|
2790
|
+
var gi = /\r\n|[\n\r\u2028\u2029]/;
|
|
2791
|
+
function _i(e, t, n) {
|
|
2792
|
+
let r = Object.assign({
|
|
2793
|
+
column: 0,
|
|
2794
|
+
line: -1
|
|
2795
|
+
}, e.start), i = Object.assign({}, r, e.end), { linesAbove: a = 2, linesBelow: o = 3 } = n || {}, s = r.line, c = r.column, l = i.line, u = i.column, d = Math.max(s - (a + 1), 0), f = Math.min(t.length, l + o);
|
|
2796
|
+
s === -1 && (d = 0), l === -1 && (f = t.length);
|
|
2797
|
+
let p = l - s, m = {};
|
|
2798
|
+
if (p) for (let e = 0; e <= p; e++) {
|
|
2799
|
+
let n = e + s;
|
|
2800
|
+
c ? e === 0 ? m[n] = [c, t[n - 1].length - c + 1] : e === p ? m[n] = [0, u] : m[n] = [0, t[n - e].length] : m[n] = !0;
|
|
2801
|
+
}
|
|
2802
|
+
else c === u ? c ? m[s] = [c, 0] : m[s] = !0 : m[s] = [c, u - c];
|
|
2803
|
+
return {
|
|
2804
|
+
start: d,
|
|
2805
|
+
end: f,
|
|
2806
|
+
markerLines: m
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
function vi(e, t, n = {}) {
|
|
2810
|
+
let r = hi(!1), { start: i, end: a, markerLines: o } = _i(t, e.split(gi), n), s = t.start && typeof t.start.column == "number", c = String(a).length, l = e.split(gi, a).slice(i, a).map((e, t) => {
|
|
2811
|
+
let a = i + 1 + t, s = ` ${` ${a}`.slice(-c)} |`, l = o[a], u = !o[a + 1];
|
|
2812
|
+
if (l) {
|
|
2813
|
+
let t = "";
|
|
2814
|
+
if (Array.isArray(l)) {
|
|
2815
|
+
let i = e.slice(0, Math.max(l[0] - 1, 0)).replace(/[^\t]/g, " "), a = l[1] || 1;
|
|
2816
|
+
t = [
|
|
2817
|
+
"\n ",
|
|
2818
|
+
r.gutter(s.replace(/\d/g, " ")),
|
|
2819
|
+
" ",
|
|
2820
|
+
i,
|
|
2821
|
+
r.marker("^").repeat(a)
|
|
2822
|
+
].join(""), u && n.message && (t += " " + r.message(n.message));
|
|
2823
|
+
}
|
|
2824
|
+
return [
|
|
2825
|
+
r.marker(">"),
|
|
2826
|
+
r.gutter(s),
|
|
2827
|
+
e.length > 0 ? ` ${e}` : "",
|
|
2828
|
+
t
|
|
2829
|
+
].join("");
|
|
2830
|
+
} else return ` ${r.gutter(s)}${e.length > 0 ? ` ${e}` : ""}`;
|
|
2831
|
+
}).join("\n");
|
|
2832
|
+
return n.message && !s && (l = `${" ".repeat(c + 1)}${n.message}
|
|
2833
|
+
${l}`), l;
|
|
2834
|
+
}
|
|
2835
|
+
async function yi(e, t) {
|
|
2836
|
+
let n = await $r(t), r = n.preprocess ? await n.preprocess(e, t) : e;
|
|
2837
|
+
t.originalText = r;
|
|
2838
|
+
let i;
|
|
2839
|
+
try {
|
|
2840
|
+
i = await n.parse(r, t, t);
|
|
2841
|
+
} catch (t) {
|
|
2842
|
+
bi(t, e);
|
|
2843
|
+
}
|
|
2844
|
+
return {
|
|
2845
|
+
text: r,
|
|
2846
|
+
ast: i
|
|
2847
|
+
};
|
|
2848
|
+
}
|
|
2849
|
+
function bi(e, t) {
|
|
2850
|
+
let { loc: n } = e;
|
|
2851
|
+
if (n) {
|
|
2852
|
+
let r = vi(t, n, { highlightCode: !0 });
|
|
2853
|
+
throw e.message += "\n" + r, e.codeFrame = r, e;
|
|
2854
|
+
}
|
|
2855
|
+
throw e;
|
|
2856
|
+
}
|
|
2857
|
+
var xi = yi;
|
|
2858
|
+
async function Si(e, t, n, r, i) {
|
|
2859
|
+
if (n.embeddedLanguageFormatting !== "auto") return;
|
|
2860
|
+
let { printer: a } = n, { embed: o } = a;
|
|
2861
|
+
if (!o) return;
|
|
2862
|
+
if (o.length > 2) throw Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");
|
|
2863
|
+
let { hasPrettierIgnore: s } = a, { getVisitorKeys: c } = o, l = [];
|
|
2864
|
+
f();
|
|
2865
|
+
let u = e.stack;
|
|
2866
|
+
for (let { print: r, node: a, pathStack: o } of l) try {
|
|
2867
|
+
e.stack = o;
|
|
2868
|
+
let s = await r(d, t, e, n);
|
|
2869
|
+
s && i.set(a, s);
|
|
2870
|
+
} catch (e) {
|
|
2871
|
+
if (globalThis.PRETTIER_DEBUG) throw e;
|
|
2872
|
+
}
|
|
2873
|
+
e.stack = u;
|
|
2874
|
+
function d(e, t) {
|
|
2875
|
+
return Ci(e, t, n, r);
|
|
2876
|
+
}
|
|
2877
|
+
function f() {
|
|
2878
|
+
let { node: t } = e;
|
|
2879
|
+
if (typeof t != "object" || !t || s?.(e)) return;
|
|
2880
|
+
for (let n of c(t)) Array.isArray(t[n]) ? e.each(f, n) : e.call(f, n);
|
|
2881
|
+
let r = o(e, n);
|
|
2882
|
+
if (r) {
|
|
2883
|
+
if (typeof r == "function") {
|
|
2884
|
+
l.push({
|
|
2885
|
+
print: r,
|
|
2886
|
+
node: t,
|
|
2887
|
+
pathStack: [...e.stack]
|
|
2888
|
+
});
|
|
2889
|
+
return;
|
|
2890
|
+
}
|
|
2891
|
+
i.set(t, r);
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
async function Ci(e, t, n, r) {
|
|
2896
|
+
let i = await li({
|
|
2897
|
+
...n,
|
|
2898
|
+
...t,
|
|
2899
|
+
parentParser: n.parser,
|
|
2900
|
+
originalText: e,
|
|
2901
|
+
cursorOffset: void 0,
|
|
2902
|
+
rangeStart: void 0,
|
|
2903
|
+
rangeEnd: void 0
|
|
2904
|
+
}, { passThrough: !0 }), { ast: a } = await xi(e, i);
|
|
2905
|
+
return Te(await r(a, i));
|
|
2906
|
+
}
|
|
2907
|
+
function wi(e, t, n, r) {
|
|
2908
|
+
let { originalText: i, [Symbol.for("comments")]: a, locStart: o, locEnd: s, [Symbol.for("printedComments")]: c } = t, { node: l } = e, u = o(l), d = s(l);
|
|
2909
|
+
for (let e of a) o(e) >= u && s(e) <= d && c.add(e);
|
|
2910
|
+
let { printPrettierIgnored: f } = t.printer;
|
|
2911
|
+
return f ? f(e, t, n, r) : i.slice(u, d);
|
|
2912
|
+
}
|
|
2913
|
+
var Ti = wi;
|
|
2914
|
+
async function Ei(e, t) {
|
|
2915
|
+
({ast: e} = await Oi(e, t));
|
|
2916
|
+
let n = /* @__PURE__ */ new Map(), r = new Tt(e), i = fn(t), a = /* @__PURE__ */ new Map();
|
|
2917
|
+
await Si(r, s, t, Ei, a);
|
|
2918
|
+
let o = await Di(r, t, s, void 0, a);
|
|
2919
|
+
if (dn(t), t.cursorOffset >= 0) {
|
|
2920
|
+
if (t.nodeAfterCursor && !t.nodeBeforeCursor) return [G, o];
|
|
2921
|
+
if (t.nodeBeforeCursor && !t.nodeAfterCursor) return [o, G];
|
|
2922
|
+
}
|
|
2923
|
+
return o;
|
|
2924
|
+
function s(e, t) {
|
|
2925
|
+
return e === void 0 || e === r ? c(t) : Array.isArray(e) ? r.call(() => c(t), ...e) : r.call(() => c(t), e);
|
|
2926
|
+
}
|
|
2927
|
+
function c(e) {
|
|
2928
|
+
i(r);
|
|
2929
|
+
let o = r.node;
|
|
2930
|
+
if (o == null) return "";
|
|
2931
|
+
let c = Dt(o) && e === void 0;
|
|
2932
|
+
if (c && n.has(o)) return n.get(o);
|
|
2933
|
+
let l = Di(r, t, s, e, a);
|
|
2934
|
+
return c && n.set(o, l), l;
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
function Di(e, t, n, r, i) {
|
|
2938
|
+
let { node: a } = e, { printer: o } = t, s;
|
|
2939
|
+
switch (s = o.hasPrettierIgnore?.(e) ? Ti(e, t, n, r) : i.has(a) ? i.get(a) : o.print(e, t, n, r), a) {
|
|
2940
|
+
case t.cursorNode:
|
|
2941
|
+
s = je(s, (e) => [
|
|
2942
|
+
G,
|
|
2943
|
+
e,
|
|
2944
|
+
G
|
|
2945
|
+
]);
|
|
2946
|
+
break;
|
|
2947
|
+
case t.nodeBeforeCursor:
|
|
2948
|
+
s = je(s, (e) => [e, G]);
|
|
2949
|
+
break;
|
|
2950
|
+
case t.nodeAfterCursor:
|
|
2951
|
+
s = je(s, (e) => [G, e]);
|
|
2952
|
+
break;
|
|
2953
|
+
}
|
|
2954
|
+
return o.printComment && !o.willPrintOwnComments?.(e, t) && (s = un(e, s, t)), s;
|
|
2955
|
+
}
|
|
2956
|
+
async function Oi(e, t) {
|
|
2957
|
+
let n = e.comments ?? [];
|
|
2958
|
+
t[Symbol.for("comments")] = n, t[Symbol.for("printedComments")] = /* @__PURE__ */ new Set(), Zt(e, t);
|
|
2959
|
+
let { printer: { preprocess: r } } = t;
|
|
2960
|
+
return e = r ? await r(e, t) : e, {
|
|
2961
|
+
ast: e,
|
|
2962
|
+
comments: n
|
|
2963
|
+
};
|
|
2964
|
+
}
|
|
2965
|
+
function ki(e, t) {
|
|
2966
|
+
let { cursorOffset: n, locStart: r, locEnd: i, getVisitorKeys: a } = t, o = (e) => r(e) <= n && i(e) >= n, s = e, c = [e];
|
|
2967
|
+
for (let t of zt(e, {
|
|
2968
|
+
getVisitorKeys: a,
|
|
2969
|
+
filter: o
|
|
2970
|
+
})) c.push(t), s = t;
|
|
2971
|
+
if (Bt(s, { getVisitorKeys: a })) return { cursorNode: s };
|
|
2972
|
+
let l, u, d = -1, f = Infinity;
|
|
2973
|
+
for (; c.length > 0 && (l === void 0 || u === void 0);) {
|
|
2974
|
+
s = c.pop();
|
|
2975
|
+
let e = l !== void 0, t = u !== void 0;
|
|
2976
|
+
for (let o of Rt(s, { getVisitorKeys: a })) {
|
|
2977
|
+
if (!e) {
|
|
2978
|
+
let e = i(o);
|
|
2979
|
+
e <= n && e > d && (l = o, d = e);
|
|
2980
|
+
}
|
|
2981
|
+
if (!t) {
|
|
2982
|
+
let e = r(o);
|
|
2983
|
+
e >= n && e < f && (u = o, f = e);
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
return {
|
|
2988
|
+
nodeBeforeCursor: l,
|
|
2989
|
+
nodeAfterCursor: u
|
|
2990
|
+
};
|
|
2991
|
+
}
|
|
2992
|
+
var Ai = ki;
|
|
2993
|
+
function ji(e, t) {
|
|
2994
|
+
let { printer: n } = t, r = n.massageAstNode;
|
|
2995
|
+
if (!r) return e;
|
|
2996
|
+
let { getVisitorKeys: i } = n, { ignoredProperties: a } = r;
|
|
2997
|
+
return o(e);
|
|
2998
|
+
function o(e, t) {
|
|
2999
|
+
if (!Dt(e)) return e;
|
|
3000
|
+
if (Array.isArray(e)) return e.map((e) => o(e, t)).filter(Boolean);
|
|
3001
|
+
let n = {}, s = new Set(i(e));
|
|
3002
|
+
for (let t in e) !Object.prototype.hasOwnProperty.call(e, t) || a?.has(t) || (s.has(t) ? n[t] = o(e[t], e) : n[t] = e[t]);
|
|
3003
|
+
let c = r(e, n, t);
|
|
3004
|
+
if (c !== null) return c ?? n;
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
var Mi = ji, Ni = Array.prototype.findLastIndex ?? function(e) {
|
|
3008
|
+
for (let t = this.length - 1; t >= 0; t--) {
|
|
3009
|
+
let n = this[t];
|
|
3010
|
+
if (e(n, t, this)) return t;
|
|
3011
|
+
}
|
|
3012
|
+
return -1;
|
|
3013
|
+
}, Pi = f("findLastIndex", function() {
|
|
3014
|
+
if (Array.isArray(this)) return Ni;
|
|
3015
|
+
}), Fi = ({ parser: e }) => e === "json" || e === "json5" || e === "jsonc" || e === "json-stringify";
|
|
3016
|
+
function Ii(e, t) {
|
|
3017
|
+
return t = new Set(t), e.find((e) => Vi.has(e.type) && t.has(e));
|
|
3018
|
+
}
|
|
3019
|
+
function Li(e) {
|
|
3020
|
+
let t = Pi(0, e, (e) => e.type !== "Program" && e.type !== "File");
|
|
3021
|
+
return t === -1 ? e : e.slice(0, t + 1);
|
|
3022
|
+
}
|
|
3023
|
+
function Ri(e, t, { locStart: n, locEnd: r }) {
|
|
3024
|
+
let [i, ...a] = e, [o, ...s] = t;
|
|
3025
|
+
if (i === o) return [i, o];
|
|
3026
|
+
let c = n(i);
|
|
3027
|
+
for (let e of Li(s)) if (n(e) >= c) o = e;
|
|
3028
|
+
else break;
|
|
3029
|
+
let l = r(o);
|
|
3030
|
+
for (let e of Li(a)) {
|
|
3031
|
+
if (r(e) <= l) i = e;
|
|
3032
|
+
else break;
|
|
3033
|
+
if (i === o) break;
|
|
3034
|
+
}
|
|
3035
|
+
return [i, o];
|
|
3036
|
+
}
|
|
3037
|
+
function zi(e, t, n, r, i = [], a) {
|
|
3038
|
+
let { locStart: o, locEnd: s } = n, c = o(e), l = s(e);
|
|
3039
|
+
if (t > l || t < c || a === "rangeEnd" && t === c || a === "rangeStart" && t === l) return;
|
|
3040
|
+
let u = [e, ...i], d = Ht(e, u, {
|
|
3041
|
+
cache: Jt,
|
|
3042
|
+
locStart: o,
|
|
3043
|
+
locEnd: s,
|
|
3044
|
+
getVisitorKeys: n.getVisitorKeys,
|
|
3045
|
+
filter: n.printer.canAttachComment,
|
|
3046
|
+
getChildren: n.printer.getCommentChildNodes
|
|
3047
|
+
});
|
|
3048
|
+
for (let e of d) {
|
|
3049
|
+
let i = zi(e, t, n, r, u, a);
|
|
3050
|
+
if (i) return i;
|
|
3051
|
+
}
|
|
3052
|
+
if (r(e, i[0])) return u;
|
|
3053
|
+
}
|
|
3054
|
+
function Bi(e, t) {
|
|
3055
|
+
return t !== "DeclareExportDeclaration" && e !== "TypeParameterDeclaration" && (e === "Directive" || e === "TypeAlias" || e === "TSExportAssignment" || e.startsWith("Declare") || e.startsWith("TSDeclare") || e.endsWith("Statement") || e.endsWith("Declaration"));
|
|
3056
|
+
}
|
|
3057
|
+
var Vi = new Set([
|
|
3058
|
+
"JsonRoot",
|
|
3059
|
+
"ObjectExpression",
|
|
3060
|
+
"ArrayExpression",
|
|
3061
|
+
"StringLiteral",
|
|
3062
|
+
"NumericLiteral",
|
|
3063
|
+
"BooleanLiteral",
|
|
3064
|
+
"NullLiteral",
|
|
3065
|
+
"UnaryExpression",
|
|
3066
|
+
"TemplateLiteral"
|
|
3067
|
+
]), Hi = new Set([
|
|
3068
|
+
"OperationDefinition",
|
|
3069
|
+
"FragmentDefinition",
|
|
3070
|
+
"VariableDefinition",
|
|
3071
|
+
"TypeExtensionDefinition",
|
|
3072
|
+
"ObjectTypeDefinition",
|
|
3073
|
+
"FieldDefinition",
|
|
3074
|
+
"DirectiveDefinition",
|
|
3075
|
+
"EnumTypeDefinition",
|
|
3076
|
+
"EnumValueDefinition",
|
|
3077
|
+
"InputValueDefinition",
|
|
3078
|
+
"InputObjectTypeDefinition",
|
|
3079
|
+
"SchemaDefinition",
|
|
3080
|
+
"OperationTypeDefinition",
|
|
3081
|
+
"InterfaceTypeDefinition",
|
|
3082
|
+
"UnionTypeDefinition",
|
|
3083
|
+
"ScalarTypeDefinition"
|
|
3084
|
+
]);
|
|
3085
|
+
function Ui(e, t, n) {
|
|
3086
|
+
if (!t) return !1;
|
|
3087
|
+
switch (e.parser) {
|
|
3088
|
+
case "flow":
|
|
3089
|
+
case "hermes":
|
|
3090
|
+
case "babel":
|
|
3091
|
+
case "babel-flow":
|
|
3092
|
+
case "babel-ts":
|
|
3093
|
+
case "typescript":
|
|
3094
|
+
case "acorn":
|
|
3095
|
+
case "espree":
|
|
3096
|
+
case "meriyah":
|
|
3097
|
+
case "oxc":
|
|
3098
|
+
case "oxc-ts":
|
|
3099
|
+
case "__babel_estree": return Bi(t.type, n?.type);
|
|
3100
|
+
case "json":
|
|
3101
|
+
case "json5":
|
|
3102
|
+
case "jsonc":
|
|
3103
|
+
case "json-stringify": return Vi.has(t.type);
|
|
3104
|
+
case "graphql": return Hi.has(t.kind);
|
|
3105
|
+
case "vue": return t.tag !== "root";
|
|
3106
|
+
}
|
|
3107
|
+
return !1;
|
|
3108
|
+
}
|
|
3109
|
+
function Wi(e, t, n) {
|
|
3110
|
+
let { rangeStart: r, rangeEnd: i, locStart: a, locEnd: o } = t, s = e.slice(r, i).search(/\S/u), c = s === -1;
|
|
3111
|
+
if (!c) for (r += s; i > r && !/\S/u.test(e[i - 1]); --i);
|
|
3112
|
+
let l = zi(n, r, t, (e, n) => Ui(t, e, n), [], "rangeStart");
|
|
3113
|
+
if (!l) return;
|
|
3114
|
+
let u = c ? l : zi(n, i, t, (e) => Ui(t, e), [], "rangeEnd");
|
|
3115
|
+
if (!u) return;
|
|
3116
|
+
let d, f;
|
|
3117
|
+
if (Fi(t)) {
|
|
3118
|
+
let e = Ii(l, u);
|
|
3119
|
+
d = e, f = e;
|
|
3120
|
+
} else [d, f] = Ri(l, u, t);
|
|
3121
|
+
return [Math.min(a(d), a(f)), Math.max(o(d), o(f))];
|
|
3122
|
+
}
|
|
3123
|
+
var Gi = "", Ki = Symbol("cursor");
|
|
3124
|
+
async function qi(e, t, n = 0) {
|
|
3125
|
+
if (!e || e.trim().length === 0) return {
|
|
3126
|
+
formatted: "",
|
|
3127
|
+
cursorOffset: -1,
|
|
3128
|
+
comments: []
|
|
3129
|
+
};
|
|
3130
|
+
let { ast: r, text: i } = await xi(e, t);
|
|
3131
|
+
t.cursorOffset >= 0 && (t = {
|
|
3132
|
+
...t,
|
|
3133
|
+
...Ai(r, t)
|
|
3134
|
+
});
|
|
3135
|
+
let a = await Ei(r, t, n);
|
|
3136
|
+
n > 0 && (a = Be([K, a], n, t.tabWidth));
|
|
3137
|
+
let o = St(a, t);
|
|
3138
|
+
if (n > 0) {
|
|
3139
|
+
let e = o.formatted.trim();
|
|
3140
|
+
o.cursorNodeStart !== void 0 && (o.cursorNodeStart -= o.formatted.indexOf(e), o.cursorNodeStart < 0 && (o.cursorNodeStart = 0, o.cursorNodeText = o.cursorNodeText.trimStart()), o.cursorNodeStart + o.cursorNodeText.length > e.length && (o.cursorNodeText = o.cursorNodeText.trimEnd())), o.formatted = e + w(t.endOfLine);
|
|
3141
|
+
}
|
|
3142
|
+
let s = t[Symbol.for("comments")];
|
|
3143
|
+
if (t.cursorOffset >= 0) {
|
|
3144
|
+
let e, n, r, a;
|
|
3145
|
+
if ((t.cursorNode || t.nodeBeforeCursor || t.nodeAfterCursor) && o.cursorNodeText) if (r = o.cursorNodeStart, a = o.cursorNodeText, t.cursorNode) e = t.locStart(t.cursorNode), n = i.slice(e, t.locEnd(t.cursorNode));
|
|
3146
|
+
else {
|
|
3147
|
+
if (!t.nodeBeforeCursor && !t.nodeAfterCursor) throw Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");
|
|
3148
|
+
e = t.nodeBeforeCursor ? t.locEnd(t.nodeBeforeCursor) : 0;
|
|
3149
|
+
let r = t.nodeAfterCursor ? t.locStart(t.nodeAfterCursor) : i.length;
|
|
3150
|
+
n = i.slice(e, r);
|
|
3151
|
+
}
|
|
3152
|
+
else e = 0, n = i, r = 0, a = o.formatted;
|
|
3153
|
+
let c = t.cursorOffset - e;
|
|
3154
|
+
if (n === a) return {
|
|
3155
|
+
formatted: o.formatted,
|
|
3156
|
+
cursorOffset: r + c,
|
|
3157
|
+
comments: s
|
|
3158
|
+
};
|
|
3159
|
+
let l = n.split("");
|
|
3160
|
+
l.splice(c, 0, Ki);
|
|
3161
|
+
let u = _(l, a.split("")), d = r;
|
|
3162
|
+
for (let e of u) if (e.removed) {
|
|
3163
|
+
if (e.value.includes(Ki)) break;
|
|
3164
|
+
} else d += e.count;
|
|
3165
|
+
return {
|
|
3166
|
+
formatted: o.formatted,
|
|
3167
|
+
cursorOffset: d,
|
|
3168
|
+
comments: s
|
|
3169
|
+
};
|
|
3170
|
+
}
|
|
3171
|
+
return {
|
|
3172
|
+
formatted: o.formatted,
|
|
3173
|
+
cursorOffset: -1,
|
|
3174
|
+
comments: s
|
|
3175
|
+
};
|
|
3176
|
+
}
|
|
3177
|
+
async function Ji(e, t) {
|
|
3178
|
+
let { ast: n, text: r } = await xi(e, t), [i, a] = Wi(r, t, n) ?? [0, 0], o = r.slice(i, a), s = Math.min(i, r.lastIndexOf("\n", i) + 1), c = r.slice(s, i).match(/^\s*/u)[0], l = wt(c, t.tabWidth), u = await qi(o, {
|
|
3179
|
+
...t,
|
|
3180
|
+
rangeStart: 0,
|
|
3181
|
+
rangeEnd: Infinity,
|
|
3182
|
+
cursorOffset: t.cursorOffset > i && t.cursorOffset <= a ? t.cursorOffset - i : -1,
|
|
3183
|
+
endOfLine: "lf"
|
|
3184
|
+
}, l), d = u.formatted.trimEnd(), { cursorOffset: f } = t;
|
|
3185
|
+
f > a ? f += d.length - o.length : u.cursorOffset >= 0 && (f = u.cursorOffset + i);
|
|
3186
|
+
let p = r.slice(0, i) + d + r.slice(a);
|
|
3187
|
+
if (t.endOfLine !== "lf") {
|
|
3188
|
+
let e = w(t.endOfLine);
|
|
3189
|
+
f >= 0 && e === "\r\n" && (f += re(p.slice(0, f), "\n")), p = m(0, p, "\n", e);
|
|
3190
|
+
}
|
|
3191
|
+
return {
|
|
3192
|
+
formatted: p,
|
|
3193
|
+
cursorOffset: f,
|
|
3194
|
+
comments: u.comments
|
|
3195
|
+
};
|
|
3196
|
+
}
|
|
3197
|
+
function Yi(e, t, n) {
|
|
3198
|
+
return typeof t != "number" || Number.isNaN(t) || t < 0 || t > e.length ? n : t;
|
|
3199
|
+
}
|
|
3200
|
+
function Xi(e, t) {
|
|
3201
|
+
let { cursorOffset: n, rangeStart: r, rangeEnd: i } = t;
|
|
3202
|
+
return n = Yi(e, n, -1), r = Yi(e, r, 0), i = Yi(e, i, e.length), {
|
|
3203
|
+
...t,
|
|
3204
|
+
cursorOffset: n,
|
|
3205
|
+
rangeStart: r,
|
|
3206
|
+
rangeEnd: i
|
|
3207
|
+
};
|
|
3208
|
+
}
|
|
3209
|
+
function Zi(e, t) {
|
|
3210
|
+
let { cursorOffset: n, rangeStart: r, rangeEnd: i, endOfLine: a } = Xi(e, t), o = e.charAt(0) === Gi;
|
|
3211
|
+
if (o && (e = e.slice(1), n--, r--, i--), a === "auto" && (a = ne(e)), e.includes("\r")) {
|
|
3212
|
+
let t = (t) => re(e.slice(0, Math.max(t, 0)), "\r\n");
|
|
3213
|
+
n -= t(n), r -= t(r), i -= t(i), e = ie(e);
|
|
3214
|
+
}
|
|
3215
|
+
return {
|
|
3216
|
+
hasBOM: o,
|
|
3217
|
+
text: e,
|
|
3218
|
+
options: Xi(e, {
|
|
3219
|
+
...t,
|
|
3220
|
+
cursorOffset: n,
|
|
3221
|
+
rangeStart: r,
|
|
3222
|
+
rangeEnd: i,
|
|
3223
|
+
endOfLine: a
|
|
3224
|
+
})
|
|
3225
|
+
};
|
|
3226
|
+
}
|
|
3227
|
+
async function Qi(e, t) {
|
|
3228
|
+
let n = await $r(t);
|
|
3229
|
+
return !n.hasPragma || n.hasPragma(e);
|
|
3230
|
+
}
|
|
3231
|
+
async function $i(e, t) {
|
|
3232
|
+
return (await $r(t)).hasIgnorePragma?.(e);
|
|
3233
|
+
}
|
|
3234
|
+
async function ea(e, t) {
|
|
3235
|
+
let { hasBOM: n, text: r, options: i } = Zi(e, await li(t));
|
|
3236
|
+
if (i.rangeStart >= i.rangeEnd && r !== "" || i.requirePragma && !await Qi(r, i) || i.checkIgnorePragma && await $i(r, i)) return {
|
|
3237
|
+
formatted: e,
|
|
3238
|
+
cursorOffset: t.cursorOffset,
|
|
3239
|
+
comments: []
|
|
3240
|
+
};
|
|
3241
|
+
let a;
|
|
3242
|
+
return i.rangeStart > 0 || i.rangeEnd < r.length ? a = await Ji(r, i) : (!i.requirePragma && i.insertPragma && i.printer.insertPragma && !await Qi(r, i) && (r = i.printer.insertPragma(r)), a = await qi(r, i)), n && (a.formatted = Gi + a.formatted, a.cursorOffset >= 0 && a.cursorOffset++), a;
|
|
3243
|
+
}
|
|
3244
|
+
async function ta(e, t, n) {
|
|
3245
|
+
let { text: r, options: i } = Zi(e, await li(t)), a = await xi(r, i);
|
|
3246
|
+
return n && (n.preprocessForPrint && (a.ast = await Oi(a.ast, i)), n.massage && (a.ast = Mi(a.ast, i))), a;
|
|
3247
|
+
}
|
|
3248
|
+
async function na(e, t) {
|
|
3249
|
+
return t = await li(t), St(await Ei(e, t), t);
|
|
3250
|
+
}
|
|
3251
|
+
async function ra(e, t) {
|
|
3252
|
+
let { formatted: n } = await ea(rt(e), {
|
|
3253
|
+
...t,
|
|
3254
|
+
parser: "__js_expression"
|
|
3255
|
+
});
|
|
3256
|
+
return n;
|
|
3257
|
+
}
|
|
3258
|
+
async function ia(e, t) {
|
|
3259
|
+
t = await li(t);
|
|
3260
|
+
let { ast: n } = await xi(e, t);
|
|
3261
|
+
return t.cursorOffset >= 0 && (t = {
|
|
3262
|
+
...t,
|
|
3263
|
+
...Ai(n, t)
|
|
3264
|
+
}), Ei(n, t);
|
|
3265
|
+
}
|
|
3266
|
+
async function aa(e, t) {
|
|
3267
|
+
return St(e, await li(t));
|
|
3268
|
+
}
|
|
3269
|
+
var oa = {};
|
|
3270
|
+
s(oa, {
|
|
3271
|
+
builders: () => sa,
|
|
3272
|
+
printer: () => ca,
|
|
3273
|
+
utils: () => la
|
|
3274
|
+
});
|
|
3275
|
+
var sa = {
|
|
3276
|
+
join: qe,
|
|
3277
|
+
line: Ye,
|
|
3278
|
+
softline: Xe,
|
|
3279
|
+
hardline: K,
|
|
3280
|
+
literalline: $e,
|
|
3281
|
+
group: Ue,
|
|
3282
|
+
conditionalGroup: We,
|
|
3283
|
+
fill: He,
|
|
3284
|
+
lineSuffix: et,
|
|
3285
|
+
lineSuffixBoundary: tt,
|
|
3286
|
+
cursor: G,
|
|
3287
|
+
breakParent: Ve,
|
|
3288
|
+
ifBreak: Ge,
|
|
3289
|
+
trim: nt,
|
|
3290
|
+
indent: Fe,
|
|
3291
|
+
indentIfBreak: Ke,
|
|
3292
|
+
align: Ie,
|
|
3293
|
+
addAlignmentToDoc: Be,
|
|
3294
|
+
markAsRoot: Re,
|
|
3295
|
+
dedentToRoot: Le,
|
|
3296
|
+
dedent: ze,
|
|
3297
|
+
hardlineWithoutBreakParent: Ze,
|
|
3298
|
+
literallineWithoutBreakParent: Qe,
|
|
3299
|
+
label: Je,
|
|
3300
|
+
concat: (e) => e
|
|
3301
|
+
}, ca = { printDocToString: St }, la = {
|
|
3302
|
+
willBreak: ve,
|
|
3303
|
+
traverseDoc: me,
|
|
3304
|
+
findInDoc: ge,
|
|
3305
|
+
mapDoc: he,
|
|
3306
|
+
removeLines: Se,
|
|
3307
|
+
stripTrailingHardline: Te,
|
|
3308
|
+
replaceEndOfLine: Oe,
|
|
3309
|
+
canBreak: Ae
|
|
3310
|
+
}, ua = "3.8.1", da = {};
|
|
3311
|
+
s(da, {
|
|
3312
|
+
addDanglingComment: () => Kt,
|
|
3313
|
+
addLeadingComment: () => Gt,
|
|
3314
|
+
addTrailingComment: () => qt,
|
|
3315
|
+
getAlignmentSize: () => wt,
|
|
3316
|
+
getIndentSize: () => xa,
|
|
3317
|
+
getMaxContinuousCount: () => wa,
|
|
3318
|
+
getNextNonSpaceNonCommentCharacter: () => Ea,
|
|
3319
|
+
getNextNonSpaceNonCommentCharacterIndex: () => Ra,
|
|
3320
|
+
getPreferredQuote: () => Ma,
|
|
3321
|
+
getStringWidth: () => dt,
|
|
3322
|
+
hasNewline: () => Z,
|
|
3323
|
+
hasNewlineInRange: () => Pa,
|
|
3324
|
+
hasSpaces: () => Ia,
|
|
3325
|
+
isNextLineEmpty: () => Ua,
|
|
3326
|
+
isNextLineEmptyAfterIndex: () => ya,
|
|
3327
|
+
isPreviousLineEmpty: () => Ba,
|
|
3328
|
+
makeString: () => Ha,
|
|
3329
|
+
skip: () => Ot,
|
|
3330
|
+
skipEverythingButNewLine: () => jt,
|
|
3331
|
+
skipInlineComment: () => pa,
|
|
3332
|
+
skipNewline: () => Pt,
|
|
3333
|
+
skipSpaces: () => X,
|
|
3334
|
+
skipToLineEnd: () => At,
|
|
3335
|
+
skipTrailingComment: () => ha,
|
|
3336
|
+
skipWhitespace: () => kt
|
|
3337
|
+
});
|
|
3338
|
+
function fa(e, t) {
|
|
3339
|
+
if (t === !1) return !1;
|
|
3340
|
+
if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
|
|
3341
|
+
for (let n = t + 2; n < e.length; ++n) if (e.charAt(n) === "*" && e.charAt(n + 1) === "/") return n + 2;
|
|
3342
|
+
}
|
|
3343
|
+
return t;
|
|
3344
|
+
}
|
|
3345
|
+
var pa = fa;
|
|
3346
|
+
function ma(e, t) {
|
|
3347
|
+
return t === !1 ? !1 : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? jt(e, t) : t;
|
|
3348
|
+
}
|
|
3349
|
+
var ha = ma;
|
|
3350
|
+
function ga(e, t) {
|
|
3351
|
+
let n = null, r = t;
|
|
3352
|
+
for (; r !== n;) n = r, r = X(e, r), r = pa(e, r), r = ha(e, r), r = Pt(e, r);
|
|
3353
|
+
return r;
|
|
3354
|
+
}
|
|
3355
|
+
var _a = ga;
|
|
3356
|
+
function va(e, t) {
|
|
3357
|
+
let n = null, r = t;
|
|
3358
|
+
for (; r !== n;) n = r, r = At(e, r), r = pa(e, r), r = X(e, r);
|
|
3359
|
+
return r = ha(e, r), r = Pt(e, r), r !== !1 && Z(e, r);
|
|
3360
|
+
}
|
|
3361
|
+
var ya = va;
|
|
3362
|
+
function ba(e, t) {
|
|
3363
|
+
let n = e.lastIndexOf("\n");
|
|
3364
|
+
return n === -1 ? 0 : wt(e.slice(n + 1).match(/^[\t ]*/u)[0], t);
|
|
3365
|
+
}
|
|
3366
|
+
var xa = ba;
|
|
3367
|
+
function Sa(e) {
|
|
3368
|
+
if (typeof e != "string") throw TypeError("Expected a string");
|
|
3369
|
+
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
3370
|
+
}
|
|
3371
|
+
function Ca(e, t) {
|
|
3372
|
+
let n = e.matchAll(RegExp(`(?:${Sa(t)})+`, "gu"));
|
|
3373
|
+
return n.reduce || (n = [...n]), n.reduce((e, [t]) => Math.max(e, t.length), 0) / t.length;
|
|
3374
|
+
}
|
|
3375
|
+
var wa = Ca;
|
|
3376
|
+
function Ta(e, t) {
|
|
3377
|
+
let n = _a(e, t);
|
|
3378
|
+
return n === !1 ? "" : e.charAt(n);
|
|
3379
|
+
}
|
|
3380
|
+
var Ea = Ta, Da = Object.freeze({
|
|
3381
|
+
character: "'",
|
|
3382
|
+
codePoint: 39
|
|
3383
|
+
}), Oa = Object.freeze({
|
|
3384
|
+
character: "\"",
|
|
3385
|
+
codePoint: 34
|
|
3386
|
+
}), ka = Object.freeze({
|
|
3387
|
+
preferred: Da,
|
|
3388
|
+
alternate: Oa
|
|
3389
|
+
}), Aa = Object.freeze({
|
|
3390
|
+
preferred: Oa,
|
|
3391
|
+
alternate: Da
|
|
3392
|
+
});
|
|
3393
|
+
function ja(e, t) {
|
|
3394
|
+
let { preferred: n, alternate: r } = t === !0 || t === "'" ? ka : Aa, { length: i } = e, a = 0, o = 0;
|
|
3395
|
+
for (let t = 0; t < i; t++) {
|
|
3396
|
+
let i = e.charCodeAt(t);
|
|
3397
|
+
i === n.codePoint ? a++ : i === r.codePoint && o++;
|
|
3398
|
+
}
|
|
3399
|
+
return (a > o ? r : n).character;
|
|
3400
|
+
}
|
|
3401
|
+
var Ma = ja;
|
|
3402
|
+
function Na(e, t, n) {
|
|
3403
|
+
for (let r = t; r < n; ++r) if (e.charAt(r) === "\n") return !0;
|
|
3404
|
+
return !1;
|
|
3405
|
+
}
|
|
3406
|
+
var Pa = Na;
|
|
3407
|
+
function Fa(e, t, n = {}) {
|
|
3408
|
+
return X(e, n.backwards ? t - 1 : t, n) !== t;
|
|
3409
|
+
}
|
|
3410
|
+
var Ia = Fa;
|
|
3411
|
+
function La(e, t, n) {
|
|
3412
|
+
return _a(e, n(t));
|
|
3413
|
+
}
|
|
3414
|
+
function Ra(e, t) {
|
|
3415
|
+
return arguments.length === 2 || typeof t == "number" ? _a(e, t) : La(...arguments);
|
|
3416
|
+
}
|
|
3417
|
+
function za(e, t, n) {
|
|
3418
|
+
return an(e, n(t));
|
|
3419
|
+
}
|
|
3420
|
+
function Ba(e, t) {
|
|
3421
|
+
return arguments.length === 2 || typeof t == "number" ? an(e, t) : za(...arguments);
|
|
3422
|
+
}
|
|
3423
|
+
function Va(e, t, n) {
|
|
3424
|
+
return ya(e, n(t));
|
|
3425
|
+
}
|
|
3426
|
+
function Ha(e, t, n) {
|
|
3427
|
+
let r = t === "\"" ? "'" : "\"";
|
|
3428
|
+
return t + m(0, e, /\\(.)|(["'])/gsu, (e, i, a) => i === r ? i : a === t ? "\\" + a : a || (n && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(i) ? i : "\\" + i)) + t;
|
|
3429
|
+
}
|
|
3430
|
+
function Ua(e, t) {
|
|
3431
|
+
return arguments.length === 2 || typeof t == "number" ? ya(e, t) : Va(...arguments);
|
|
3432
|
+
}
|
|
3433
|
+
function Wa(e, t = 1) {
|
|
3434
|
+
return async (...n) => {
|
|
3435
|
+
let r = n[t] ?? {}, i = r.plugins ?? [];
|
|
3436
|
+
return n[t] = {
|
|
3437
|
+
...r,
|
|
3438
|
+
plugins: Array.isArray(i) ? i : Object.values(i)
|
|
3439
|
+
}, e(...n);
|
|
3440
|
+
};
|
|
3441
|
+
}
|
|
3442
|
+
var Ga = Wa(ea);
|
|
3443
|
+
async function Ka(e, t) {
|
|
3444
|
+
let { formatted: n } = await Ga(e, {
|
|
3445
|
+
...t,
|
|
3446
|
+
cursorOffset: -1
|
|
3447
|
+
});
|
|
3448
|
+
return n;
|
|
3449
|
+
}
|
|
3450
|
+
async function qa(e, t) {
|
|
3451
|
+
return await Ka(e, t) === e;
|
|
3452
|
+
}
|
|
3453
|
+
var Ja = Wa(gn, 0), Ya = {
|
|
3454
|
+
parse: Wa(ta),
|
|
3455
|
+
formatAST: Wa(na),
|
|
3456
|
+
formatDoc: Wa(ra),
|
|
3457
|
+
printToDoc: Wa(ia),
|
|
3458
|
+
printDocToString: Wa(aa)
|
|
3459
|
+
};
|
|
3460
|
+
//#endregion
|
|
3461
|
+
export { Ya as __debug, qa as check, d as default, oa as doc, Ka as format, Ga as formatWithCursor, Ja as getSupportInfo, da as util, ua as version };
|
|
3462
|
+
|
|
3463
|
+
//# sourceMappingURL=standalone-C3Df7W52.js.map
|