@redocly/openapi-docs 3.24.0 → 3.24.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/dist/{redocly-openapi-docs.min.AiChatProvider-CIrPFbvX.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-eAy3scC4.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-C6CGDyzy.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +1 -1
- package/dist/{redocly-openapi-docs.min.FileWatcher-dIKl80Ec.js → redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js} +1 -1
- package/dist/{redocly-openapi-docs.min.SemanticSearchService-D4V6-td8.js → redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js} +1 -1
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-D9-Rb-N7.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriFileSystemAdapter-CHW6hO3z.js → redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriRootStorage-CHiKNUn2.js → redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js} +1 -1
- package/dist/{redocly-openapi-docs.min.ai-chat-mappers-C19k85fj.js → redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js} +1 -1
- package/dist/{redocly-openapi-docs.min.external-resolver-BH7DBWU-.js → redocly-openapi-docs.min.external-resolver-BkceRyB4.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-BQp5pipW.js → redocly-openapi-docs.min.index-BCcol5vU.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-dirYvuKs.js → redocly-openapi-docs.min.index-C6uU_v-b.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-BuFUmOUm.js → redocly-openapi-docs.min.index-CmXZfuiZ.js} +11 -11
- package/dist/{redocly-openapi-docs.min.index-DLlCa16R.js → redocly-openapi-docs.min.index-DVWw0ICA.js} +1 -1
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-Xu623Q1T.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +2 -2
- package/dist/{redocly-openapi-docs.min.lint-graphql-D-Nm5P1M.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
- package/dist/{redocly-openapi-docs.min.respect-run-CWNqYysq.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
- package/dist/{redocly-openapi-docs.min.standalone-CRo0Sa5b.js → redocly-openapi-docs.min.standalone-BPCdJgtH.js} +3 -3
- package/dist/{redocly-openapi-docs.min.tauri-path-BUSVirPk.js → redocly-openapi-docs.min.tauri-path-CmqBCxGb.js} +1 -1
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-CXyQzME7.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +2 -2
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +1 -0
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +46 -0
- package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +1 -0
- package/lib/components/Callbacks/__tests__/Callbacks.test.js +46 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +1 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.js +88 -0
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
- package/lib/components/ContentItems/__tests__/Items.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/Items.test.js +66 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.js +135 -0
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +1 -0
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +63 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +1 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.js +52 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +60 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.js +133 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +1 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.js +23 -0
- package/lib/components/Markdown/__tests__/Markdown.test.d.ts +1 -0
- package/lib/components/Markdown/__tests__/Markdown.test.js +34 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +1 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.js +66 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.js +57 -0
- package/lib/components/McpTool/__tests__/McpResource.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpResource.test.js +81 -0
- package/lib/components/McpTool/__tests__/McpTool.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpTool.test.js +82 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +1 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +79 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +1 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.js +70 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +16 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +42 -0
- package/lib/components/Overview/__tests__/Overview.test.d.ts +1 -0
- package/lib/components/Overview/__tests__/Overview.test.js +59 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.js +36 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +197 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +38 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.js +21 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +52 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +191 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +365 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +23 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +16 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +104 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +1 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.js +15 -0
- package/lib/components/Replay/__tests__/utils.test.d.ts +1 -0
- package/lib/components/Replay/__tests__/utils.test.js +526 -0
- package/lib/components/Request/__tests__/RequestDetails.test.d.ts +1 -0
- package/lib/components/Request/__tests__/RequestDetails.test.js +98 -0
- package/lib/components/RequestSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/Example.test.js +384 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +226 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +64 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +1 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +29 -0
- package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/OperationResponseList.test.js +89 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.js +111 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +26 -0
- package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ArraySchema.test.js +93 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.js +115 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.js +33 -0
- package/lib/components/Schema/__tests__/Schema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/Schema.test.js +67 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +22 -0
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +1 -0
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +95 -0
- package/lib/components/Security/__tests__/Security.test.d.ts +1 -0
- package/lib/components/Security/__tests__/Security.test.js +38 -0
- package/lib/components/Security/__tests__/SecurityButton.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityButton.test.js +92 -0
- package/lib/components/Security/__tests__/SecurityModal.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityModal.test.js +172 -0
- package/lib/components/ServerList/__tests__/ServerList.test.d.ts +1 -0
- package/lib/components/ServerList/__tests__/ServerList.test.js +83 -0
- package/lib/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
- package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
- package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +1 -0
- package/lib/components/ViewNested/__tests__/ViewNested.test.js +42 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.js +45 -0
- package/lib/components/__tests__/Samples/use-example-key.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/use-example-key.test.js +28 -0
- package/lib/components/__tests__/common/ClearButton.test.d.ts +1 -0
- package/lib/components/__tests__/common/ClearButton.test.js +18 -0
- package/lib/components/__tests__/common/Dropdown.test.d.ts +1 -0
- package/lib/components/__tests__/common/Dropdown.test.js +52 -0
- package/lib/components/__tests__/mocks/examples.d.ts +4 -0
- package/lib/components/__tests__/mocks/examples.js +115 -0
- package/lib/components/common/__tests__/Dropdown.test.d.ts +1 -0
- package/lib/components/common/__tests__/Dropdown.test.js +129 -0
- package/lib/components/common/__tests__/LinkToField.test.d.ts +1 -0
- package/lib/components/common/__tests__/LinkToField.test.js +39 -0
- package/lib/jotai/__tests__/app.test.d.ts +1 -0
- package/lib/jotai/__tests__/app.test.js +53 -0
- package/lib/models/__tests__/Callback.test.d.ts +1 -0
- package/lib/models/__tests__/Callback.test.js +15 -0
- package/lib/models/__tests__/FieldModel.test.d.ts +1 -0
- package/lib/models/__tests__/FieldModel.test.js +117 -0
- package/lib/models/__tests__/MediaContent.test.d.ts +1 -0
- package/lib/models/__tests__/MediaContent.test.js +105 -0
- package/lib/models/__tests__/Operation.test.d.ts +1 -0
- package/lib/models/__tests__/Operation.test.js +459 -0
- package/lib/models/__tests__/Response.test.d.ts +1 -0
- package/lib/models/__tests__/Response.test.js +221 -0
- package/lib/models/__tests__/Schema.circular.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.circular.test.js +694 -0
- package/lib/models/__tests__/Schema.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.test.js +1395 -0
- package/lib/models/__tests__/example.test.d.ts +1 -0
- package/lib/models/__tests__/example.test.js +90 -0
- package/lib/models/__tests__/group.test.d.ts +1 -0
- package/lib/models/__tests__/group.test.js +52 -0
- package/lib/models/__tests__/helpers.d.ts +5 -0
- package/lib/models/__tests__/helpers.js +62 -0
- package/lib/models/__tests__/request.test.d.ts +1 -0
- package/lib/models/__tests__/request.test.js +119 -0
- package/lib/services/__tests__/OpenAPIParser.test.d.ts +1 -0
- package/lib/services/__tests__/OpenAPIParser.test.js +80 -0
- package/lib/services/__tests__/check.test.d.ts +1 -0
- package/lib/services/__tests__/check.test.js +22 -0
- package/lib/services/__tests__/utils.test.d.ts +1 -0
- package/lib/services/__tests__/utils.test.js +42 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.js +64 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.js +70 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.js +116 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.js +277 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +258 -0
- package/lib/services/code-samples/__tests__/generator-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-value.test.js +273 -0
- package/lib/services/code-samples/__tests__/generator.test.d.ts +249 -0
- package/lib/services/code-samples/__tests__/generator.test.js +1201 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +31 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +222 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +49 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +130 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +191 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +105 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +129 -0
- package/lib/services/config-options/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/config-options/__tests__/helpers.test.js +234 -0
- package/lib/services/history/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/history/__tests__/helpers.test.js +19 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +1 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +109 -0
- package/lib/services/menu/__tests__/builder.test.d.ts +1 -0
- package/lib/services/menu/__tests__/builder.test.js +307 -0
- package/lib/services/menu/__tests__/operation.test.d.ts +1 -0
- package/lib/services/menu/__tests__/operation.test.js +240 -0
- package/lib/services/menu/__tests__/tags.test.d.ts +1 -0
- package/lib/services/menu/__tests__/tags.test.js +71 -0
- package/lib/telemetry/RedocTelemetry.js +31 -1
- package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +1 -0
- package/lib/telemetry/__tests__/RedocTelemetry.test.js +107 -0
- package/lib/testProviders.d.ts +6 -0
- package/lib/testProviders.js +14 -0
- package/lib/utils/__tests__/areArraysEqual.test.d.ts +1 -0
- package/lib/utils/__tests__/areArraysEqual.test.js +33 -0
- package/lib/utils/__tests__/argValuesHelpers.d.ts +1 -0
- package/lib/utils/__tests__/argValuesHelpers.js +56 -0
- package/lib/utils/__tests__/calculateMaxLength.test.d.ts +1 -0
- package/lib/utils/__tests__/calculateMaxLength.test.js +119 -0
- package/lib/utils/__tests__/configure-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/configure-helpers.test.js +356 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +1 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +392 -0
- package/lib/utils/__tests__/debounce.test.d.ts +1 -0
- package/lib/utils/__tests__/debounce.test.js +54 -0
- package/lib/utils/__tests__/debug.test.d.ts +1 -0
- package/lib/utils/__tests__/debug.test.js +23 -0
- package/lib/utils/__tests__/dom.test.d.ts +1 -0
- package/lib/utils/__tests__/dom.test.js +108 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +1 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.js +98 -0
- package/lib/utils/__tests__/hasNestedFields.test.d.ts +1 -0
- package/lib/utils/__tests__/hasNestedFields.test.js +147 -0
- package/lib/utils/__tests__/helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/helpers.test.js +174 -0
- package/lib/utils/__tests__/isMobile.test.d.ts +1 -0
- package/lib/utils/__tests__/isMobile.test.js +28 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +1 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.js +22 -0
- package/lib/utils/__tests__/local-storage.test.d.ts +1 -0
- package/lib/utils/__tests__/local-storage.test.js +48 -0
- package/lib/utils/__tests__/object.test.d.ts +1 -0
- package/lib/utils/__tests__/object.test.js +45 -0
- package/lib/utils/__tests__/openapi.test.d.ts +1 -0
- package/lib/utils/__tests__/openapi.test.js +1378 -0
- package/lib/utils/__tests__/path.test.d.ts +1 -0
- package/lib/utils/__tests__/path.test.js +16 -0
- package/lib/utils/__tests__/queryString.test.d.ts +1 -0
- package/lib/utils/__tests__/queryString.test.js +60 -0
- package/lib/utils/__tests__/replaceVariables.test.d.ts +1 -0
- package/lib/utils/__tests__/replaceVariables.test.js +46 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +1 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.js +26 -0
- package/lib/utils/__tests__/sort.test.d.ts +1 -0
- package/lib/utils/__tests__/sort.test.js +16 -0
- package/lib/utils/__tests__/string.test.d.ts +1 -0
- package/lib/utils/__tests__/string.test.js +16 -0
- package/lib/utils/__tests__/theme-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/theme-helpers.test.js +24 -0
- package/lib/utils/__tests__/url.test.d.ts +1 -0
- package/lib/utils/__tests__/url.test.js +134 -0
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as v,g as it,a as x,j as u,u as qV,b as NV,c as ZV,d as Qd,C as jd,e as hr,E as Df,W as Cs,f as Td,h as tn,B as he,P as ua,t as XV,i as VV,R as ze,k as UV,l as Id,J as Mf,m as $s,n as I3,o as zf,p as bc,q as _f,S as et,s as WV,v as E3,w as Qs,x as Do,y as LV,z as da,A as qf,D as R3,F as A3,G as YV,H as FV,I as BV,K as GV,L as HV,O as KV,M as JV,N as eU,Q as ha,T as D3,U as Yr,V as X0,X as M3,Y as tU,Z as Tr,_ as cl,$ as Ir,a0 as pa,a1 as V0,a2 as nU,a3 as rU,a4 as iU,a5 as oU,a6 as sU,a7 as aU,a8 as Rn,a9 as Nf,aa as lU,ab as Si,ac as gn,ad as ul,ae as cU,af as uU,ag as dU,ah as z3,ai as hU,aj as pU,ak as Zf,al as _3,am as fU,an as xc,ao as q3,ap as gU,aq as mU,ar as OU,as as vU,at as yU,au as bU,av as xU,aw as wU,ax as SU}from"./redocly-openapi-docs.min.standalone-
|
|
1
|
+
import{r as v,g as it,a as x,j as u,u as qV,b as NV,c as ZV,d as Qd,C as jd,e as hr,E as Df,W as Cs,f as Td,h as tn,B as he,P as ua,t as XV,i as VV,R as ze,k as UV,l as Id,J as Mf,m as $s,n as I3,o as zf,p as bc,q as _f,S as et,s as WV,v as E3,w as Qs,x as Do,y as LV,z as da,A as qf,D as R3,F as A3,G as YV,H as FV,I as BV,K as GV,L as HV,O as KV,M as JV,N as eU,Q as ha,T as D3,U as Yr,V as X0,X as M3,Y as tU,Z as Tr,_ as cl,$ as Ir,a0 as pa,a1 as V0,a2 as nU,a3 as rU,a4 as iU,a5 as oU,a6 as sU,a7 as aU,a8 as Rn,a9 as Nf,aa as lU,ab as Si,ac as gn,ad as ul,ae as cU,af as uU,ag as dU,ah as z3,ai as hU,aj as pU,ak as Zf,al as _3,am as fU,an as xc,ao as q3,ap as gU,aq as mU,ar as OU,as as vU,at as yU,au as bU,av as xU,aw as wU,ax as SU}from"./redocly-openapi-docs.min.standalone-BPCdJgtH.js";function kU(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}function U0(t,e){return`${t.replace(/\s+/g,"-").toLowerCase()}-${e}`}const PU=2500,CU=4e3;function $U(t,e,n){return n!==void 0?n:e==="loading"?null:t?CU:PU}const N3=v.createContext(null),QU=t=>u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...t,children:u.jsx("path",{d:"M10.0002 1.24998C8.84911 1.24285 7.70808 1.4643 6.64326 1.9015C5.57844 2.3387 4.61101 2.98295 3.79707 3.79689C2.98313 4.61083 2.33889 5.57826 1.90168 6.64308C1.46448 7.7079 1.24303 8.84892 1.25017 9.99998C1.24303 11.151 1.46448 12.2921 1.90168 13.3569C2.33889 14.4217 2.98313 15.3891 3.79707 16.2031C4.61101 17.017 5.57844 17.6613 6.64326 18.0985C7.70808 18.5357 8.84911 18.7571 10.0002 18.75C11.1512 18.7571 12.2923 18.5357 13.3571 18.0985C14.4219 17.6613 15.3893 17.017 16.2033 16.2031C17.0172 15.3891 17.6614 14.4217 18.0986 13.3569C18.5359 12.2921 18.7573 11.151 18.7502 9.99998C18.7573 8.84892 18.5359 7.7079 18.0986 6.64308C17.6614 5.57826 17.0172 4.61083 16.2033 3.79689C15.3893 2.98295 14.4219 2.3387 13.3571 1.9015C12.2923 1.4643 11.1512 1.24285 10.0002 1.24998ZM13.4032 14.375L5.62517 6.5973L6.59748 5.62498L14.3752 13.403L13.4032 14.375Z",fill:"#F9316D"})}),Z3=x(QU).attrs({"data-component-name":"icons/ErrorFilledIcon/ErrorFilledIcon"})`
|
|
2
2
|
path {
|
|
3
3
|
fill: ${({color:t})=>it(t)};
|
|
4
4
|
}
|
|
@@ -330,7 +330,7 @@ html body {
|
|
|
330
330
|
`+R.slice(se,ge),se=ge+1),de=Se;return Pe+=`
|
|
331
331
|
`,R.length-se>H&&de>se?Pe+=R.slice(se,de)+`
|
|
332
332
|
`+R.slice(de+1):Pe+=R.slice(se),Pe.slice(1)}function je(R){let H="",ve=0;for(let ce=0;ce<R.length;ve>=65536?ce+=2:ce++){ve=Ee(R,ce);const se=A[ve];!se&&oe(ve)?(H+=R[ce],ve>=65536&&(H+=R[ce+1])):H+=se||N(ve)}return H}function ct(R,H,ve){let ce="";const se=R.tag;for(let ge=0,de=ve.length;ge<de;ge+=1){let Se=ve[ge];R.replacer&&(Se=R.replacer.call(ve,String(ge),Se)),(ae(R,H,Se,!1,!1)||typeof Se>"u"&&ae(R,H,null,!1,!1))&&(ce!==""&&(ce+=","+(R.condenseFlow?"":" ")),ce+=R.dump)}R.tag=se,R.dump="["+ce+"]"}function Ke(R,H,ve,ce){let se="";const ge=R.tag;for(let de=0,Se=ve.length;de<Se;de+=1){let Pe=ve[de];R.replacer&&(Pe=R.replacer.call(ve,String(de),Pe)),(ae(R,H+1,Pe,!0,!0,!1,!0)||typeof Pe>"u"&&ae(R,H+1,null,!0,!0,!1,!0))&&((!ce||se!=="")&&(se+=Y(R,H)),R.dump&&a===R.dump.charCodeAt(0)?se+="-":se+="- ",se+=R.dump)}R.tag=ge,R.dump=se||"[]"}function Yt(R,H,ve){let ce="";const se=R.tag,ge=Object.keys(ve);for(let de=0,Se=ge.length;de<Se;de+=1){let Pe="";ce!==""&&(Pe+=", "),R.condenseFlow&&(Pe+='"');const Re=ge[de];let Te=ve[Re];R.replacer&&(Te=R.replacer.call(ve,Re,Te)),ae(R,H,Re,!1,!1)&&(R.dump.length>1024&&(Pe+="? "),Pe+=R.dump+(R.condenseFlow?'"':"")+":"+(R.condenseFlow?"":" "),ae(R,H,Te,!1,!1)&&(Pe+=R.dump,ce+=Pe))}R.tag=se,R.dump="{"+ce+"}"}function k(R,H,ve,ce){let se="";const ge=R.tag,de=Object.keys(ve);if(R.sortKeys===!0)de.sort();else if(typeof R.sortKeys=="function")de.sort(R.sortKeys);else if(R.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let Se=0,Pe=de.length;Se<Pe;Se+=1){let Re="";(!ce||se!=="")&&(Re+=Y(R,H));const Te=de[Se];let Ze=ve[Te];if(R.replacer&&(Ze=R.replacer.call(ve,Te,Ze)),!ae(R,H+1,Te,!0,!0,!0))continue;const Le=R.tag!==null&&R.tag!=="?"||R.dump&&R.dump.length>1024;Le&&(R.dump&&a===R.dump.charCodeAt(0)?Re+="?":Re+="? "),Re+=R.dump,Le&&(Re+=Y(R,H)),ae(R,H+1,Ze,!0,Le)&&(R.dump&&a===R.dump.charCodeAt(0)?Re+=":":Re+=": ",Re+=R.dump,se+=Re)}R.tag=ge,R.dump=se||"{}"}function J(R,H,ve){const ce=ve?R.explicitTypes:R.implicitTypes;for(let se=0,ge=ce.length;se<ge;se+=1){const de=ce[se];if((de.instanceOf||de.predicate)&&(!de.instanceOf||typeof H=="object"&&H instanceof de.instanceOf)&&(!de.predicate||de.predicate(H))){if(ve?de.multi&&de.representName?R.tag=de.representName(H):R.tag=de.tag:R.tag="?",de.represent){const Se=R.styleMap[de.tag]||de.defaultStyle;let Pe;if(r.call(de.represent)==="[object Function]")Pe=de.represent(H,Se);else if(i.call(de.represent,Se))Pe=de.represent[Se](H,Se);else throw new e("!<"+de.tag+'> tag resolver accepts not "'+Se+'" style');R.dump=Pe}return!0}}return!1}function ae(R,H,ve,ce,se,ge,de){R.tag=null,R.dump=ve,J(R,ve,!1)||J(R,ve,!0);const Se=r.call(R.dump),Pe=ce;ce&&(ce=R.flowLevel<0||R.flowLevel>H);const Re=Se==="[object Object]"||Se==="[object Array]";let Te,Ze;if(Re&&(Te=R.duplicates.indexOf(ve),Ze=Te!==-1),(R.tag!==null&&R.tag!=="?"||Ze||R.indent!==2&&H>0)&&(se=!1),Ze&&R.usedDuplicates[Te])R.dump="*ref_"+Te;else{if(Re&&Ze&&!R.usedDuplicates[Te]&&(R.usedDuplicates[Te]=!0),Se==="[object Object]")ce&&Object.keys(R.dump).length!==0?(k(R,H,R.dump,se),Ze&&(R.dump="&ref_"+Te+R.dump)):(Yt(R,H,R.dump),Ze&&(R.dump="&ref_"+Te+" "+R.dump));else if(Se==="[object Array]")ce&&R.dump.length!==0?(R.noArrayIndent&&!de&&H>0?Ke(R,H-1,R.dump,se):Ke(R,H,R.dump,se),Ze&&(R.dump="&ref_"+Te+R.dump)):(ct(R,H,R.dump),Ze&&(R.dump="&ref_"+Te+" "+R.dump));else if(Se==="[object String]")R.tag!=="?"&&wt(R,R.dump,H,ge,Pe);else{if(Se==="[object Undefined]"||R.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+Se)}if(R.tag!==null&&R.tag!=="?"){let Le=encodeURI(R.tag[0]==="!"?R.tag.slice(1):R.tag).replace(/!/g,"%21");R.tag[0]==="!"?Le="!"+Le:Le.slice(0,18)==="tag:yaml.org,2002:"?Le="!!"+Le.slice(18):Le="!<"+Le+">",R.dump=Le+" "+R.dump}}return!0}function fe(R,H){const ve=[],ce=[];le(R,ve,ce);const se=ce.length;for(let ge=0;ge<se;ge+=1)H.duplicates.push(ve[ce[ge]]);H.usedDuplicates=new Array(se)}function le(R,H,ve){if(R!==null&&typeof R=="object"){const ce=H.indexOf(R);if(ce!==-1)ve.indexOf(ce)===-1&&ve.push(ce);else if(H.push(R),Array.isArray(R))for(let se=0,ge=R.length;se<ge;se+=1)le(R[se],H,ve);else{const se=Object.keys(R);for(let ge=0,de=se.length;ge<de;ge+=1)le(R[se[ge]],H,ve)}}}function xe(R,H){H=H||{};const ve=new W(H);ve.noRefs||fe(R,ve);let ce=R;return ve.replacer&&(ce=ve.replacer.call({"":ce},"",ce)),ae(ve,0,ce,!0,!0)?ve.dump+`
|
|
333
|
-
`:""}return Oy.dump=xe,Oy}var G4;function CB(){if(G4)return mr;G4=1;const t=kB(),e=PB();function n(r,i){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return mr.Type=Ar(),mr.Schema=d4(),mr.FAILSAFE_SCHEMA=y4(),mr.JSON_SCHEMA=T4(),mr.CORE_SCHEMA=R4(),mr.DEFAULT_SCHEMA=my(),mr.load=t.load,mr.loadAll=t.loadAll,mr.dump=e.dump,mr.YAMLException=Bd(),mr.types={binary:q4(),float:$4(),map:O4(),null:x4(),pairs:V4(),set:W4(),timestamp:D4(),bool:S4(),int:P4(),merge:z4(),omap:Z4(),seq:g4(),str:p4()},mr.safeLoad=n("safeLoad","load"),mr.safeLoadAll=n("safeLoadAll","loadAll"),mr.safeDump=n("safeDump","dump"),mr}var $B=CB();const Ol=wB($B),Fr={FS:"fs",WEB:"web"};class Lt{static utils=null;static async getUtils(){return Lt.utils||(Lt.utils=an()?await import("./redocly-openapi-docs.min.tauri-path-BUSVirPk.js"):{join:bc.join,resolve:bc.resolve,isAbsolute:bc.isAbsolute,relative:bc.relative,extname:bc.extname,dirname:bc.dirname}),Lt.utils}static async dirname(e){return(await Lt.getUtils()).dirname(e)}static async join(...e){return(await Lt.getUtils()).join(...e)}static async resolve(e){return(await Lt.getUtils()).resolve(e)}static async isAbsolute(e){return(await Lt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Lt.getUtils()).relative(e,n)}static async extname(e){return(await Lt.getUtils()).extname(e)}}async function bg(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([import("./redocly-openapi-docs.min.index-DLlCa16R.js"),import("./redocly-openapi-docs.min.external-resolver-BH7DBWU-.js")]),o=new r({});o.getRulesForSpecVersion=()=>[];const s=await Lt.dirname(t),a={config:o,base:s,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}function H4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function vy(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function K4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function ji(t){try{return new URL(t),!0}catch{return!1}}function QB(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(H4(e))n=e;else if(!e.startsWith("/"))n=vy(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return vy(n)}function J4(t,e){let n=t;return e.forEach(({key:r,value:i,active:o})=>{i&&o&&(n=n.replaceAll(`{${r}}`,i))}),n}function e7(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function jB(t){return t.startsWith("http://")||t.startsWith("https://")}function xg({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(jB(t)||!e)r=t;else{const i=new URL(e);i.pathname=t,i.search="",i.hash="",r=i.toString()}return n?`${n}${r}`:r}class yy{constructor(e){this.baseDir=e}baseDir;writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const n=this.makeKey(e);return Object.keys(localStorage).filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))}async get(e){const n=this.makeKey(e);return localStorage.getItem(n)??null}async has(e){const n=this.makeKey(e);return localStorage.getItem(n)!==null}async set(e,n){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.setItem(r,n)}async remove(e){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.removeItem(n)}async rename(e,n){const r=this.makeKey(e),i=this.makeKey(n),o=localStorage.getItem(r);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class TB{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,n){}async remove(e){}async rename(e,n){}setWriteExcludedKeys(e){}on(e,n){}off(e,n){}}class IB{constructor(e){this.projectId=e}projectId;async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const n=this.getKey();localStorage.setItem(n,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class t7{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Lt.resolve(await Lt.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async r=>{try{return await this.parse(r,n)}catch(i){return console.error(`Error parsing from ${r.type} ${r.uri}:`,i),null}}))).filter(r=>r!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===Tt.Draft||e.srcType!==Fr.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,n){const r=e.actions;if(r){for(const o in r){const s=parseInt(o);switch(r[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(n[s]);break}}return}const i=this.itemIds.filter(o=>!n.some(s=>s.id===o));await Promise.all([...n.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}async update(e,n){const r={path:e.path.slice(1),actions:e.actions};if(r.path.length===0&&await this.updateRoot(r,n),r.path.length>0){const i=r.path[0];r.path.length===1&&r.actions&&r.actions.id==="U"&&await this.remove(this.itemIds[i]),r.path[1]&&r.path[1]==="id"&&await this.remove(this.itemIds[i]),await this.write(n[i])}this.itemIds=n.map(i=>i.id)}}class EB extends t7{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...o}=e;return await Lt.extname(n)===".json"?JSON.stringify(o,null,2):Ol.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var Jn=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Jn||{});const Gd={active:!0,key:"",value:""},RB=/[\n\r\t]/g;function n7(t){return t.replace(RB,"").trim()}function Zo(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name);return{id:crypto.randomUUID(),key:n.name,value:r?`$inputs.${n.name}`:n.example?n7(String(n.example)):"",active:r?!0:!!n.example,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function Hd(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function Kd(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,o]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return r}function r7(){return{id:crypto.randomUUID(),...Gd}}function AB(){return{id:crypto.randomUUID(),...Gd,description:""}}function wg(t){return{...Gd,id:crypto.randomUUID(),in:t}}function DB(){return{id:crypto.randomUUID(),...Gd,type:"text",files:null}}function MB(){return{id:crypto.randomUUID(),...Gd,sendIn:fr.URL}}function by(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function Sg(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?rn(n,e):n).trim())}function Sa(t,e){const n=e.filter(r=>!!r).flatMap(r=>r).filter(r=>r.key&&r.active);return["path","header"].includes(t)?Array.from(new Map(n.map(r=>[r.key,r])).values()):n}function zB(t,e,n){return t.map(({value:r,...i})=>({...i,value:Ru(r,e,n??{})}))}function _B(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function ln(t=[],e={}){const n=[];for(const r of t)if(gl(r)){const i=_B(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function ka(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}function i7(t){return t.schema}function o7(t){return i7(t)?.fields??[]}function s7(t,e){return t.flatMap(n=>{const r=i7(n),i=r?.fields||[];return i.length>0?i.flatMap(o=>a7(o.name,o.example,n.allowReserved)):a7(n.name,r?.example??n.example,n.allowReserved)})}function a7(t,e,n){if(e===void 0)return[wy(t,"",!1,n)];const r=xy(e,t);return r.length===0?[wy(t,"",!1,n)]:r.map(i=>wy(i.key,i.value,!0,n))}function xy(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?xy(n,`${e}[${r}]`):[{key:e,value:String(n)}]):qB(t)?Object.entries(t).flatMap(([n,r])=>xy(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function qB(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function wy(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:n7(e),active:n,in:"query",...r&&{allowReserved:r}}}const l7={path:"path",query:"query",header:"headers",cookie:"cookie"};function Sy(t){return t!==void 0}function NB(t,e){if(t)return _f(t)?t:t[e]}function c7(t,e,n){const r=n[l7[e]],i=n.envVariables,o=new Set;for(const s of t??[])(r?.[s.name]||i?.[s.name])&&o.add(s.name);return o}function Rc(t,e,n){if(_f(n))return c7(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const o of c7(t,e,i))r.add(o);return r}function u7(t,e,n){const r=n.query,i=n.envVariables;for(const o of e??[]){const s=o7(o);for(const a of s)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||s.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function d7(t,e,n){const r=[...t??[],...e??[]],i=new Set(Rc(r,"query",n));if(_f(n))return u7(i,e,n),i;for(const o of Object.values(n))o&&u7(i,e,o);return i}const h7=1024;let ZB=0,Ti=class{constructor(t,e){this.from=t,this.to=e}};class mt{constructor(e={}){this.id=ZB++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Pr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}mt.closedBy=new mt({deserialize:t=>t.split(" ")}),mt.openedBy=new mt({deserialize:t=>t.split(" ")}),mt.group=new mt({deserialize:t=>t.split(" ")}),mt.isolate=new mt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),mt.contextHash=new mt({perNode:!0}),mt.lookAhead=new mt({perNode:!0}),mt.mounted=new mt({perNode:!0});class Jd{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[mt.mounted.id]}}const XB=Object.create(null);class Pr{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):XB,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Pr(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(mt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(mt.group),o=-1;o<(i?i.length:0);o++){let s=n[o<0?r.name:i[o]];if(s)return s}}}}Pr.none=new Pr("",Object.create(null),0,8);class I0{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let o of e){let s=o(r);s&&(i||(i=Object.assign({},r.props)),i[s[0].id]=s[1])}n.push(i?new Pr(r.name,i,r.id,r.flags):r)}return new I0(n)}}const kg=new WeakMap,p7=new WeakMap;var Ft;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Ft||(Ft={}));let Bt=class v3{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,a]of o)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=Jd.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Pg(this.topNode,e)}cursorAt(e,n=0,r=0){let i=kg.get(this)||this.topNode,o=new Pg(i);return o.moveTo(e,n),kg.set(this,o._tree),o}get topNode(){return new Ii(this,0,0,null)}resolve(e,n=0){let r=eh(kg.get(this)||this.topNode,e,n,!1);return kg.set(this,r),r}resolveInner(e,n=0){let r=eh(p7.get(this)||this.topNode,e,n,!0);return p7.set(this,r),r}resolveStack(e,n=0){return WB(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&Ft.IncludeAnonymous)>0;for(let l=this.cursor(s|Ft.IncludeAnonymous);;){let c=!1;if(l.from<=o&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Cy(Pr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new v3(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new v3(Pr.none,n,r,i)))}static build(e){return LB(e)}};Bt.empty=new Bt(Pr.none,[],[],0);class x3{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new x3(this.buffer,this.index)}}class Ja{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Pr.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,r,i,o){let{buffer:s}=this,a=-1;for(let l=e;l!=n&&!(f7(o,i,s[l+1],s[l+2])&&(a=l,r>0));l=s[l+3]);return a}slice(e,n,r){let i=this.buffer,o=new Uint16Array(n-e),s=0;for(let a=e,l=0;a<n;){o[l++]=i[a++],o[l++]=i[a++]-r;let c=o[l++]=i[a++]-r;o[l++]=i[a++]-e,s=Math.max(s,c)}return new Ja(o,s,this.set)}}function f7(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function eh(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let s=!r&&t instanceof Ii&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=r?0:Ft.IgnoreOverlays;if(r)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Ii&&s.index<0&&((i=a.enter(e,n,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,o);if(!s)return t;t=s}}class g7{cursor(e=0){return new Pg(this,e)}getChild(e,n=null,r=null){let i=m7(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return m7(this,e,n,r)}resolve(e,n=0){return eh(this,e,n,!1)}resolveInner(e,n=0){return eh(this,e,n,!0)}matchContext(e){return ky(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}let Ii=class T0 extends g7{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,o=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=n>0?a.length:-1;e!=c;e+=n){let d=a[e],h=l[e]+s.from;if(f7(i,r,h,h+d.length)){if(d instanceof Ja){if(o&Ft.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-h,i);if(p>-1)return new gs(new VB(s,d,e,h),null,p)}else if(o&Ft.IncludeAnonymous||!d.type.isAnonymous||Py(d)){let p;if(!(o&Ft.IgnoreMounts)&&(p=Jd.get(d))&&!p.overlay)return new T0(p.tree,h,e,s);let f=new T0(d,h,e,s);return o&Ft.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?d.children.length-1:0,n,r,i)}}}if(o&Ft.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&Ft.IgnoreOverlays)&&(i=Jd.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((n>0?s<=o:s<o)&&(n<0?a>=o:a>o))return new T0(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function m7(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=i.type.is(n),!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function ky(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class VB{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class gs extends g7{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new gs(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ft.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new gs(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new gs(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new gs(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,o=r.buffer[this.index+3];if(o>i){let s=r.buffer[this.index+1];e.push(r.slice(i,o,s)),n.push(0)}return new Bt(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function O7(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;o<t.length;o++){let s=t[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let r=n instanceof Ii&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new UB(i,n)}class UB{constructor(e,n){this.heads=e,this.node=n}get next(){return O7(this.heads)}}function WB(t,e,n){let r=t.resolveInner(e,n),i=null;for(let o=r instanceof Ii?r:r.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(i||(i=[r])).push(s.resolve(e,n)),o=s}else{let s=Jd.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Ii(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[r])).push(eh(a,e,n,!1))}}return i?O7(i):r}class Pg{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ii)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Ii?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ft.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ft.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ft.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(i.buffer.buffer[o+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let o=n+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&Ft.IncludeAnonymous||a instanceof Ja||!a.type.isAnonymous||Py(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;n=s,r=o+1;break e}i=this.stack[--o]}for(let i=r;i<this.stack.length;i++)n=new gs(this.buffer,n,this.stack[i]);return this.bufferNode=new gs(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return ky(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return ky(this._tree,e,i);let s=r[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Py(t){return t.children.some(e=>e instanceof Ja||!e.type.isAnonymous||Py(e))}function LB(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=h7,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(n)?new x3(n,n.length):n,l=r.types,c=0,d=0;function h(S,C,$,Q,T,z){let{id:M,start:E,end:_,size:A}=a,q=d,I=c;for(;A<0;)if(a.next(),A==-1){let W=o[M];$.push(W),Q.push(E-S);return}else if(A==-3){c=M;return}else if(A==-4){d=M;return}else throw new RangeError(`Unrecognized record size: ${A}`);let Z=l[M],N,L,U=E-S;if(_-E<=i&&(L=O(a.pos-C,T))){let W=new Uint16Array(L.size-L.skip),F=a.pos-L.size,Y=W.length;for(;a.pos>F;)Y=y(L.start,W,Y);N=new Ja(W,_-L.start,r),U=L.start-S}else{let W=a.pos-A;a.next();let F=[],Y=[],te=M>=s?M:-1,B=0,oe=_;for(;a.pos>W;)te>=0&&a.id==te&&a.size>=0?(a.end<=oe-i&&(m(F,Y,E,B,a.end,oe,te,q,I),B=F.length,oe=a.end),a.next()):z>2500?p(E,W,F,Y):h(E,W,F,Y,te,z+1);if(te>=0&&B>0&&B<F.length&&m(F,Y,E,B,E,oe,te,q,I),F.reverse(),Y.reverse(),te>-1&&B>0){let G=f(Z,I);N=Cy(Z,F,Y,0,F.length,0,_-E,G,G)}else N=g(Z,F,Y,_-E,q-_,I)}$.push(N),Q.push(U)}function p(S,C,$,Q){let T=[],z=0,M=-1;for(;a.pos>C;){let{id:E,start:_,end:A,size:q}=a;if(q>4)a.next();else{if(M>-1&&_<M)break;M<0&&(M=A-i),T.push(E,_,A),z++,a.next()}}if(z){let E=new Uint16Array(z*4),_=T[T.length-2];for(let A=T.length-3,q=0;A>=0;A-=3)E[q++]=T[A],E[q++]=T[A+1]-_,E[q++]=T[A+2]-_,E[q++]=q;$.push(new Ja(E,T[2]-_,r)),Q.push(_-S)}}function f(S,C){return($,Q,T)=>{let z=0,M=$.length-1,E,_;if(M>=0&&(E=$[M])instanceof Bt){if(!M&&E.type==S&&E.length==T)return E;(_=E.prop(mt.lookAhead))&&(z=Q[M]+E.length+_)}return g(S,$,Q,T,z,C)}}function m(S,C,$,Q,T,z,M,E,_){let A=[],q=[];for(;S.length>Q;)A.push(S.pop()),q.push(C.pop()+$-T);S.push(g(r.types[M],A,q,z-T,E-z,_)),C.push(T-$)}function g(S,C,$,Q,T,z,M){if(z){let E=[mt.contextHash,z];M=M?[E].concat(M):[E]}if(T>25){let E=[mt.lookAhead,T];M=M?[E].concat(M):[E]}return new Bt(S,C,$,Q,M)}function O(S,C){let $=a.fork(),Q=0,T=0,z=0,M=$.end-i,E={size:0,start:0,skip:0};e:for(let _=$.pos-S;$.pos>_;){let A=$.size;if($.id==C&&A>=0){E.size=Q,E.start=T,E.skip=z,z+=4,Q+=4,$.next();continue}let q=$.pos-A;if(A<0||q<_||$.start<M)break;let I=$.id>=s?4:0,Z=$.start;for($.next();$.pos>q;){if($.size<0)if($.size==-3)I+=4;else break e;else $.id>=s&&(I+=4);$.next()}T=Z,Q+=A,z+=I}return(C<0||Q==S)&&(E.size=Q,E.start=T,E.skip=z),E.size>4?E:void 0}function y(S,C,$){let{id:Q,start:T,end:z,size:M}=a;if(a.next(),M>=0&&Q<s){let E=$;if(M>4){let _=a.pos-(M-4);for(;a.pos>_;)$=y(S,C,$)}C[--$]=E,C[--$]=z-S,C[--$]=T-S,C[--$]=Q}else M==-3?c=Q:M==-4&&(d=Q);return $}let b=[],w=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,b,w,-1,0);let P=(e=t.length)!==null&&e!==void 0?e:b.length?w[0]+b[0].length:0;return new Bt(l[t.topID],b.reverse(),w.reverse(),P)}const v7=new WeakMap;function Cg(t,e){if(!t.isAnonymous||e instanceof Ja||e.type!=t)return 1;let n=v7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Bt)){n=1;break}n+=Cg(t,r)}v7.set(e,n)}return n}function Cy(t,e,n,r,i,o,s,a,l){let c=0;for(let m=r;m<i;m++)c+=Cg(t,e[m]);let d=Math.ceil(c*1.5/8),h=[],p=[];function f(m,g,O,y,b){for(let w=O;w<y;){let P=w,S=g[w],C=Cg(t,m[w]);for(w++;w<y;w++){let $=Cg(t,m[w]);if(C+$>=d)break;C+=$}if(w==P+1){if(C>d){let $=m[P];f($.children,$.positions,0,$.children.length,g[P]+b);continue}h.push(m[P])}else{let $=g[w-1]+m[w-1].length-S;h.push(Cy(t,m,g,P,w,S,$,null,l))}p.push(S+b-o)}}return f(e,n,r,i,0),(a||l)(h,p,s)}class $y{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof gs?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ii&&this.map.set(e.tree,n)}get(e){return e instanceof gs?this.getBuffer(e.context.buffer,e.index):e instanceof Ii?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class na{constructor(e,n,r,i,o=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new na(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=r)for(;s&&s.from<h;){let p=s;if(l>=p.from||h<=p.to||c){let f=Math.max(p.from,l)-c,m=Math.min(p.to,h)-c;p=f>=m?null:new na(f,m,p.tree,p.offset+c,a>0,!!d)}if(p&&i.push(p),s.to>h)break;s=o<e.length?e[o++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return i}}let Qy=class{startParse(t,e,n){return typeof t=="string"&&(t=new YB(t)),n=n?n.length?n.map(r=>new Ti(r.from,r.to)):[new Ti(0,0)]:[new Ti(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let r=this.startParse(t,e,n);for(;;){let i=r.advance();if(i)return i}}};class YB{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function FB(t){return(e,n,r,i)=>new GB(e,t,n,r,i)}class y7{constructor(e,n,r,i,o){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=o}}function b7(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class BB{constructor(e,n,r,i,o,s,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const jy=new mt({perNode:!0});class GB{constructor(e,n,r,i,o){this.nest=n,this.input=r,this.fragments=i,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new Bt(r.type,r.children,r.positions,r.length,r.propValues.concat([[jy,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[mt.mounted.id]=new Jd(n,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new JB(this.fragments),n=null,r=null,i=new Pg(new Ii(this.baseTree,this.ranges[0].from,0,null),Ft.IncludeAnonymous|Ft.IgnoreMounts);e:for(let o,s;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let c=n.mounts.find(d=>d.frag.from<=i.from&&d.frag.to>=i.to&&d.mount.overlay);if(c)for(let d of c.mount.overlay){let h=d.from+c.pos,p=d.to+c.pos;h>=i.from&&p<=i.to&&!n.ranges.some(f=>f.from<p&&f.to>h)&&n.ranges.push({from:h,to:p})}}a=!1}else if(r&&(s=HB(r.ranges,i.from,i.to)))a=s!=2;else if(!i.type.isAnonymous&&(o=this.nest(i,this.input))&&(i.from<i.to||!o.overlay)){i.tree||KB(i);let c=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")n=new BB(o.parser,o.overlay,c,this.inner.length,i.from,i.tree,n);else{let d=S7(this.ranges,o.overlay||(i.from<i.to?[new Ti(i.from,i.to)]:[]));d.length&&b7(d),(d.length||!o.overlay)&&this.inner.push(new y7(o.parser,d.length?o.parser.startParse(this.input,k7(c,d),d):o.parser.startParse(""),o.overlay?o.overlay.map(h=>new Ti(h.from-i.from,h.to-i.from)):null,i.tree,d.length?d[0].from:i.from)),o.overlay?d.length&&(r={ranges:d,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new Ti(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=S7(this.ranges,n.ranges);c.length&&(b7(c),this.inner.splice(n.index,0,new y7(n.parser,n.parser.startParse(this.input,k7(n.mounts,c),c),n.ranges.map(d=>new Ti(d.from-n.start,d.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function HB(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function x7(t,e,n,r,i,o){if(e<n){let s=t.buffer[e+1];r.push(t.slice(e,n,s)),i.push(s-o)}}function KB(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,l=[o];function c(d,h,p,f,m,g){let O=n[g],y=[],b=[];x7(s,d,O,y,b,f);let w=a[O+1],P=a[O+2];l.push(y.length);let S=g?c(O+4,a[O+3],s.set.types[a[O]],w,P-w,g-1):e.toTree();return y.push(S),b.push(w-f),x7(s,a[O+3],h,y,b,f),new Bt(p,y,b,m)}i.children[o]=c(0,a.length,Pr.none,0,s.length,n.length-1);for(let d of l){let h=t.tree.children[d],p=t.tree.positions[d];t.yield(new Ii(h,p+t.from,d,t._tree))}}class w7{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(Ft.IncludeAnonymous|Ft.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,Ft.IgnoreOverlays|Ft.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof Bt)n=n.children[0];else break}return!1}}let JB=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let n=this.curFrag=t[0];this.curTo=(e=n.tree.prop(jy))!==null&&e!==void 0?e:n.to,this.inner=new w7(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(jy))!==null&&t!==void 0?t:e.to,this.inner=new w7(e.tree,-e.offset)}}findMounts(t,e){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let i=this.inner.cursor.node;i;i=i.parent){let o=(n=i.tree)===null||n===void 0?void 0:n.prop(mt.mounted);if(o&&o.parser==e)for(let s=this.fragI;s<this.fragments.length;s++){let a=this.fragments[s];if(a.from>=i.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:i.from-a.offset,mount:o})}}}return r}};function S7(t,e){let n=null,r=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<r.length;o++){let l=r[o];if(l.from>=a)break;l.to<=s||(n||(r=n=e.slice()),l.from<s?(n[o]=new Ti(l.from,s),l.to>a&&n.splice(o+1,0,new Ti(a,l.to))):l.to>a?n[o--]=new Ti(a,l.to):n.splice(o--,1))}}return r}function eG(t,e,n,r){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let d=i==t.length?1e9:s?t[i].to:t[i].from,h=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let p=Math.max(l,n),f=Math.min(d,h,r);p<f&&c.push(new Ti(p,f))}if(l=Math.min(d,h),l==1e9)break;d==l&&(s?(s=!1,i++):s=!0),h==l&&(a?(a=!1,o++):a=!0)}return c}function k7(t,e){let n=[];for(let{pos:r,mount:i,frag:o}of t){let s=r+(i.overlay?i.overlay[0].from:0),a=s+i.tree.length,l=Math.max(o.from,s),c=Math.min(o.to,a);if(i.overlay){let d=i.overlay.map(p=>new Ti(p.from+r,p.to+r)),h=eG(e,d,l,c);for(let p=0,f=l;;p++){let m=p==h.length,g=m?c:h[p].from;if(g>f&&n.push(new na(f,g,i.tree,-s,o.from>=f||o.openStart,o.to<=g||o.openEnd)),m)break;f=h[p].to}}else n.push(new na(l,c,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return n}var P7={};class E0{constructor(e,n,r,i,o,s,a,l,c,d=0,h){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new E0(e,[],n,r,r,0,[],0,i?new C7(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let a=o.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,d=this.reducePos-c;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=d));let h=l?this.stack[l-1]:0,p=this.bufferBase+this.buffer.length-h;if(i<o.minRepeatTerm||e&131072){let f=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,f,p+4,!0)}if(e&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=o.getGoto(f,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:s}=this.p;(i>this.pos||n<=s.maxNode)&&(this.pos=i,s.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=s.maxNode&&this.buffer.push(n,r,i,4)}else this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4)}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new E0(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new tG(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(n[o],s);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let s=n[o+1];i.some((a,l)=>l&1&&a==s)||i.push(n[o],s)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[i],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,o+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new C7(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class C7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class tG{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class R0{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new R0(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new R0(this.stack,this.pos,this.index)}}function th(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class $g{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $7=new $g;class nG{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<r.from;){if(!i)return null;let s=this.ranges[--i];o-=r.from-s.to,r=s}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];o+=s.from-r.to,r=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=$7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class Ac{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Q7(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Ac.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Qg{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?th(e):e}token(e,n){let r=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(Q7(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||i++,s==null)break;e.reset(s,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}Qg.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Pn{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Q7(t,e,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let f=s+3;f<c;f+=2)if((t[f+1]&a)>0){let m=t[f];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||rG(m,e.token.value,i,o))){e.acceptToken(m);break}}let d=e.next,h=0,p=t[s+2];if(e.next<0&&p>h&&t[c+p*3-3]==65535){s=t[c+p*3-1];continue e}for(;h<p;){let f=h+p>>1,m=c+f+(f<<1),g=t[m],O=t[m+1]||65536;if(d<g)p=f;else if(d>=O)h=f+1;else{s=t[m+2],e.advance();continue e}}break}}function j7(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function rG(t,e,n,r){let i=j7(n,r,e);return i<0||j7(n,r,t)<i}const ai=typeof process<"u"&&P7&&/\bparse\b/.test(P7.LOG);let Ty=null;function T7(t,e,n){let r=t.cursor(Ft.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class iG{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?T7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?T7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=r.children[i],s=this.start[n]+r.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof Bt){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let l=o.prop(mt.lookAhead);if(!l||a+l<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class oG{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new $g)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,s=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<o.length;c++){if((1<<c&s)==0)continue;let d=o[c],h=this.tokens[c];if(!(r&&!d.fallback)&&((d.contextual||h.start!=e.pos||h.mask!=s||h.context!=a)&&(this.updateCachedToken(h,d,e),h.mask=s,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=n;if(h.extended>-1&&(n=this.addActions(e,h.extended,h.end,n)),n=this.addActions(e,h.value,h.end,n),!d.extend&&(r=h,n>p))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new $g,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new $g,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:o}=r.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let a=o.specializers[s](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(o,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Is(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Is(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(Is(a,c+1),n,r,i))}return i}}let sG=class{constructor(t,e,n,r){this.parser=t,this.input=e,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new nG(e,r),this.tokens=new oG(t,this.stream),this.topTerm=t.top[1];let{from:i}=r[0];this.stacks=[E0.start(this,t.top[0],i)],this.fragments=n.length&&this.stream.end-i>t.bufferLength*4?new iG(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<t.length;o++){let s=t[o];for(;;){if(this.tokens.mainToken=null,s.pos>e)n.push(s);else{if(this.advanceStack(s,n,t))continue;{r||(r=[],i=[]),r.push(s);let a=this.tokens.getMainToken(s);i.push(a.value,a.end)}}break}}if(!n.length){let o=r&&lG(r);if(o)return ai&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ai&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(o)return ai&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((s,a)=>a.score-s.score);n.length>o;)n.pop();n.some(s=>s.reducePos>e)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let s=n[o];for(let a=o+1;a<n.length;a++){let l=n[a];if(s.sameState(l)||s.buffer.length>500&&l.buffer.length>500)if((s.score-l.score||s.buffer.length-l.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,n){let r=t.pos,{parser:i}=this,o=ai?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.curContext&&t.curContext.tracker.strict,c=l?t.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let h=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(t.state,d.type.id):-1;if(h>-1&&d.length&&(!l||(d.prop(mt.contextHash)||0)==c))return t.useNode(d,h),ai&&console.log(o+this.stackID(t)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof Bt)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof Bt&&d.positions[0]==0)d=p;else break}}let s=i.stateSlot(t.state,4);if(s>0)return t.reduce(s),ai&&console.log(o+this.stackID(t)+` (via always-reduce ${i.getName(s&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let l=0;l<a.length;){let c=a[l++],d=a[l++],h=a[l++],p=l==a.length||!n,f=p?t:t.split(),m=this.tokens.mainToken;if(f.apply(c,d,m?m.start:f.pos,h),ai&&console.log(o+this.stackID(f)+` (via ${(c&65536)==0?"shift":`reduce of ${i.getName(c&65535)}`} for ${i.getName(d)} @ ${r}${f==t?"":", split"})`),p)return!0;f.pos>r?e.push(f):n.push(f)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return I7(t,e),!0}}runRecovery(t,e,n){let r=null,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=e[o<<1],l=e[(o<<1)+1],c=ai?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),ai&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let d=s.split(),h=c;for(let p=0;d.forceReduce()&&p<10&&(ai&&console.log(h+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));p++)ai&&(h=this.stackID(d)+" -> ");for(let p of s.recoverByInsert(a))ai&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),ai&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),I7(s,n)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(t){return t.close(),Bt.build({buffer:R0.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Ty||(Ty=new WeakMap)).get(t);return e||Ty.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};function I7(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class aG{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const Iy=t=>t;class nh{constructor(e){this.start=e.start,this.shift=e.shift||Iy,this.reduce=e.reduce||Iy,this.reuse=e.reuse||Iy,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ko extends Qy{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.length;a++)i.push([]);function o(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=mt[l]);for(let c=1;c<a.length;){let d=a[c++];if(d>=0)o(d,l,a[c++]);else{let h=a[c+-d];for(let p=-d;p>0;p--)o(a[c++],l,h);c++}}}this.nodeSet=new I0(n.map((a,l)=>Pr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=h7;let s=th(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(E7),this.states=th(e.states,Uint32Array),this.data=th(e.stateData),this.goto=th(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Ac(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new sG(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let s=i[o++],a=s&1,l=i[o++];if(a&&r)return l;for(let c=o+(s>>1);o<c;o++)if(i[o]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),s;;o+=3){if((s=r[o])==65535)if(r[o+1]==1)s=r[o=Is(r,o+2)];else{if(r[o+1]==2)return Is(r,o+2);break}if(s==n||s==0)return Is(r,o+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Is(this.data,o+2);else break;i=n(Is(this.data,o+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Is(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((o,s)=>s&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(ko.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=E7(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let o of e.split(" ")){let s=n.indexOf(o);s>=0&&(r[s]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let s=this.dialects[n[o]],a;(a=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new aG(e,r,i)}static deserialize(e){return new ko(e)}}function Is(t,e){return t[e]|t[e+1]<<16}function lG(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function E7(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let cG=0,Es=class y3{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=cG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof y3&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new y3(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new A0(e);return r=>r.modified.indexOf(n)>-1?r:A0.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}},uG=0;class A0{constructor(e){this.name=e,this.instances=[],this.id=uG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&dG(n,a.modified));if(r)return r;let i=[],o=new Es(e.name,i,e,n);for(let a of n)a.instances.push(o);let s=hG(n);for(let a of e.set)if(!a.modified.length)for(let l of s)i.push(A0.get(a,l));return o}}function dG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function hG(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function Rs(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let o=[],s=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){s=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!p)throw new RangeError("Invalid path: "+i);if(o.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),h+=p[0].length,h==i.length)break;let f=i[h++];if(h==i.length&&f=="!"){s=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+i);let d=new jg(r,s,l>0?o.slice(0,l):null);e[c]=d.sort(e[c])}}return R7.add(e)}const R7=new mt;class jg{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}jg.empty=new jg([],2,null);function A7(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let l of a.set){let c=n[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:r}}function pG(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function fG(t,e,n,r=0,i=t.length){let o=new gG(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class gG{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,o){let{type:s,from:a,to:l}=e;if(a>=r||l<=n)return;s.isTop&&(o=this.highlighters.filter(f=>!f.scope||f.scope(s)));let c=i,d=mG(e)||jg.empty,h=pG(o,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(n,a),c),d.opaque)return;let p=e.tree&&e.tree.prop(mt.mounted);if(p&&p.overlay){let f=e.node.enter(p.overlay[0].from+a,1),m=this.highlighters.filter(O=>!O.scope||O.scope(p.tree.type)),g=e.firstChild();for(let O=0,y=a;;O++){let b=O<p.overlay.length?p.overlay[O]:null,w=b?b.from+a:l,P=Math.max(n,y),S=Math.min(r,w);if(P<S&&g)for(;e.from<S&&(this.highlightRange(e,P,S,i,o),this.startSpan(Math.min(S,e.to),c),!(e.to>=w||!e.nextSibling())););if(!b||w>r)break;y=b.to+a,y>n&&(this.highlightRange(f.cursor(),Math.max(n,b.from+a),Math.min(r,y),"",m),this.startSpan(Math.min(r,y),c))}g&&e.parent()}else if(e.firstChild()){p&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function mG(t){let e=t.type.prop(R7);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=Es.define,Tg=Ie(),Pa=Ie(),D7=Ie(Pa),M7=Ie(Pa),Ca=Ie(),Ig=Ie(Ca),Ey=Ie(Ca),Xo=Ie(),vl=Ie(Xo),Vo=Ie(),Uo=Ie(),Ry=Ie(),rh=Ie(Ry),Eg=Ie(),j={comment:Tg,lineComment:Ie(Tg),blockComment:Ie(Tg),docComment:Ie(Tg),name:Pa,variableName:Ie(Pa),typeName:D7,tagName:Ie(D7),propertyName:M7,attributeName:Ie(M7),className:Ie(Pa),labelName:Ie(Pa),namespace:Ie(Pa),macroName:Ie(Pa),literal:Ca,string:Ig,docString:Ie(Ig),character:Ie(Ig),attributeValue:Ie(Ig),number:Ey,integer:Ie(Ey),float:Ie(Ey),bool:Ie(Ca),regexp:Ie(Ca),escape:Ie(Ca),color:Ie(Ca),url:Ie(Ca),keyword:Vo,self:Ie(Vo),null:Ie(Vo),atom:Ie(Vo),unit:Ie(Vo),modifier:Ie(Vo),operatorKeyword:Ie(Vo),controlKeyword:Ie(Vo),definitionKeyword:Ie(Vo),moduleKeyword:Ie(Vo),operator:Uo,derefOperator:Ie(Uo),arithmeticOperator:Ie(Uo),logicOperator:Ie(Uo),bitwiseOperator:Ie(Uo),compareOperator:Ie(Uo),updateOperator:Ie(Uo),definitionOperator:Ie(Uo),typeOperator:Ie(Uo),controlOperator:Ie(Uo),punctuation:Ry,separator:Ie(Ry),bracket:rh,angleBracket:Ie(rh),squareBracket:Ie(rh),paren:Ie(rh),brace:Ie(rh),content:Xo,heading:vl,heading1:Ie(vl),heading2:Ie(vl),heading3:Ie(vl),heading4:Ie(vl),heading5:Ie(vl),heading6:Ie(vl),contentSeparator:Ie(Xo),list:Ie(Xo),quote:Ie(Xo),emphasis:Ie(Xo),strong:Ie(Xo),link:Ie(Xo),monospace:Ie(Xo),strikethrough:Ie(Xo),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:Eg,documentMeta:Ie(Eg),annotation:Ie(Eg),processingInstruction:Ie(Eg),definition:Es.defineModifier("definition"),constant:Es.defineModifier("constant"),function:Es.defineModifier("function"),standard:Es.defineModifier("standard"),local:Es.defineModifier("local"),special:Es.defineModifier("special")};for(let t in j){let e=j[t];e instanceof Es&&(e.name=t)}A7([{tag:j.link,class:"tok-link"},{tag:j.heading,class:"tok-heading"},{tag:j.emphasis,class:"tok-emphasis"},{tag:j.strong,class:"tok-strong"},{tag:j.keyword,class:"tok-keyword"},{tag:j.atom,class:"tok-atom"},{tag:j.bool,class:"tok-bool"},{tag:j.url,class:"tok-url"},{tag:j.labelName,class:"tok-labelName"},{tag:j.inserted,class:"tok-inserted"},{tag:j.deleted,class:"tok-deleted"},{tag:j.literal,class:"tok-literal"},{tag:j.string,class:"tok-string"},{tag:j.number,class:"tok-number"},{tag:[j.regexp,j.escape,j.special(j.string)],class:"tok-string2"},{tag:j.variableName,class:"tok-variableName"},{tag:j.local(j.variableName),class:"tok-variableName tok-local"},{tag:j.definition(j.variableName),class:"tok-variableName tok-definition"},{tag:j.special(j.variableName),class:"tok-variableName2"},{tag:j.definition(j.propertyName),class:"tok-propertyName tok-definition"},{tag:j.typeName,class:"tok-typeName"},{tag:j.namespace,class:"tok-namespace"},{tag:j.className,class:"tok-className"},{tag:j.macroName,class:"tok-macroName"},{tag:j.propertyName,class:"tok-propertyName"},{tag:j.operator,class:"tok-operator"},{tag:j.comment,class:"tok-comment"},{tag:j.meta,class:"tok-meta"},{tag:j.invalid,class:"tok-invalid"},{tag:j.punctuation,class:"tok-punctuation"}]);const OG=Rs({String:j.string,Number:j.number,"True False":j.bool,PropertyName:j.propertyName,Null:j.null,",":j.separator,"[ ]":j.squareBracket,"{ }":j.brace}),vG=ko.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[OG],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Ay=[],z7=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?z7:Ay).push(n=n+t[e])})();function yG(t){if(t<768)return!1;for(let e=0,n=Ay.length;;){let r=e+n>>1;if(t<Ay[r])n=r;else if(t>=z7[r])e=r+1;else return!0;if(e==n)return!1}}function _7(t){return t>=127462&&t<=127487}const q7=8205;function bG(t,e,n=!0,r=!0){return(n?N7:xG)(t,e,r)}function N7(t,e,n){if(e==t.length)return e;e&&Z7(t.charCodeAt(e))&&X7(t.charCodeAt(e-1))&&e--;let r=Dy(t,e);for(e+=V7(r);e<t.length;){let i=Dy(t,e);if(r==q7||i==q7||n&&yG(i))e+=V7(i),r=i;else if(_7(i)){let o=0,s=e-2;for(;s>=0&&_7(Dy(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function xG(t,e,n){for(;e>0;){let r=N7(t,e-2,n);if(r<e)return r;e--}return 0}function Dy(t,e){let n=t.charCodeAt(e);if(!X7(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Z7(r)?(n-55296<<10)+(r-56320)+65536:n}function Z7(t){return t>=56320&&t<57344}function X7(t){return t>=55296&&t<56320}function V7(t){return t<65536?1:2}let zt=class MV{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Dc(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),ms.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Dc(this,e,n);let r=[];return this.decompose(e,n,r,0),ms.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new ih(this),o=new ih(e);for(let s=n,a=n;;){if(i.next(s),o.next(s),s=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new ih(this,e)}iterRange(e,n=this.length){return new W7(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new L7(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?MV.empty:e.length<=32?new In(e):ms.from(In.split(e,[]))}};class In extends zt{constructor(e,n=wG(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let o=0;;o++){let s=this.text[o],a=i+s.length;if((n?r:a)>=e)return new SG(i,a,r,s);i=a+1,r++}}decompose(e,n,r,i){let o=e<=0&&n>=this.length?this:new In(U7(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let s=r.pop(),a=Rg(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new In(a,s.length+o.length));else{let l=a.length>>1;r.push(new In(a.slice(0,l)),new In(a.slice(l)))}}else r.push(o)}replace(e,n,r){if(!(r instanceof In))return super.replace(e,n,r);[e,n]=Dc(this,e,n);let i=Rg(this.text,Rg(r.text,U7(this.text,0,e)),n),o=this.length+r.length-(n-e);return i.length<=32?new In(i,o):ms.from(In.split(i,[]),o)}sliceString(e,n=this.length,r=`
|
|
333
|
+
`:""}return Oy.dump=xe,Oy}var G4;function CB(){if(G4)return mr;G4=1;const t=kB(),e=PB();function n(r,i){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return mr.Type=Ar(),mr.Schema=d4(),mr.FAILSAFE_SCHEMA=y4(),mr.JSON_SCHEMA=T4(),mr.CORE_SCHEMA=R4(),mr.DEFAULT_SCHEMA=my(),mr.load=t.load,mr.loadAll=t.loadAll,mr.dump=e.dump,mr.YAMLException=Bd(),mr.types={binary:q4(),float:$4(),map:O4(),null:x4(),pairs:V4(),set:W4(),timestamp:D4(),bool:S4(),int:P4(),merge:z4(),omap:Z4(),seq:g4(),str:p4()},mr.safeLoad=n("safeLoad","load"),mr.safeLoadAll=n("safeLoadAll","loadAll"),mr.safeDump=n("safeDump","dump"),mr}var $B=CB();const Ol=wB($B),Fr={FS:"fs",WEB:"web"};class Lt{static utils=null;static async getUtils(){return Lt.utils||(Lt.utils=an()?await import("./redocly-openapi-docs.min.tauri-path-CmqBCxGb.js"):{join:bc.join,resolve:bc.resolve,isAbsolute:bc.isAbsolute,relative:bc.relative,extname:bc.extname,dirname:bc.dirname}),Lt.utils}static async dirname(e){return(await Lt.getUtils()).dirname(e)}static async join(...e){return(await Lt.getUtils()).join(...e)}static async resolve(e){return(await Lt.getUtils()).resolve(e)}static async isAbsolute(e){return(await Lt.getUtils()).isAbsolute(e)}static async relative(e,n){return(await Lt.getUtils()).relative(e,n)}static async extname(e){return(await Lt.getUtils()).extname(e)}}async function bg(t,e){const[{bundle:n,Config:r},{ExternalResolver:i}]=await Promise.all([import("./redocly-openapi-docs.min.index-DVWw0ICA.js"),import("./redocly-openapi-docs.min.external-resolver-BkceRyB4.js")]),o=new r({});o.getRulesForSpecVersion=()=>[];const s=await Lt.dirname(t),a={config:o,base:s,externalRefResolver:new i,dereference:!0};e?a.doc={source:{absoluteRef:t},parsed:e}:a.ref=t;const{bundle:{parsed:l},fileDependencies:c}=await n(a);return{definition:l,fileDependencies:c}}function H4(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}function vy(t){return t.endsWith("/")?t.substring(0,t.length-1):t}function K4(t){try{const e=new URL(t);return e.search="",e.hash="",e.toString()}catch{return t}}function ji(t){try{return new URL(t),!0}catch{return!1}}function QB(t,e){let n;if(e.startsWith("//")){const{protocol:r}=new URL(t);n=`${r||"https:"}${e}`}else if(H4(e))n=e;else if(!e.startsWith("/"))n=vy(t)+"/"+e;else{const r=new URL(t);r.pathname=e,n=r.toString()}return vy(n)}function J4(t,e){let n=t;return e.forEach(({key:r,value:i,active:o})=>{i&&o&&(n=n.replaceAll(`{${r}}`,i))}),n}function e7(t,e){let n=t;return e.forEach(({name:r,value:i})=>{i&&(n=n.replaceAll(`{${r}}`,i))}),n}function jB(t){return t.startsWith("http://")||t.startsWith("https://")}function xg({url:t,serverUrl:e,corsProxyUrl:n}){let r;if(jB(t)||!e)r=t;else{const i=new URL(e);i.pathname=t,i.search="",i.hash="",r=i.toString()}return n?`${n}${r}`:r}class yy{constructor(e){this.baseDir=e}baseDir;writeExcludedKeys=new Set;setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e=""){const n=this.makeKey(e);return Object.keys(localStorage).filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))}async get(e){const n=this.makeKey(e);return localStorage.getItem(n)??null}async has(e){const n=this.makeKey(e);return localStorage.getItem(n)!==null}async set(e,n){if(this.writeExcludedKeys.has(e))return;const r=this.makeKey(e);localStorage.setItem(r,n)}async remove(e){if(this.writeExcludedKeys.has(e))return;const n=this.makeKey(e);localStorage.removeItem(n)}async rename(e,n){const r=this.makeKey(e),i=this.makeKey(n),o=localStorage.getItem(r);o!==null&&(localStorage.setItem(i,o),localStorage.removeItem(r))}makeKey(e){return`replay:fs:${this.baseDir}/${e}`}on(e,n){}off(e,n){}}class TB{baseDir="";async ls(e=""){return[]}async get(e){return null}async has(e){return!1}async set(e,n){}async remove(e){}async rename(e,n){}setWriteExcludedKeys(e){}on(e,n){}off(e,n){}}class IB{constructor(e){this.projectId=e}projectId;async get(){const e=this.getKey();return localStorage.getItem(e)??null}async set(e){const n=this.getKey();localStorage.setItem(n,e)}async remove(){const e=this.getKey();localStorage.removeItem(e)}getKey(){return`replay:secrets:${this.projectId}`}}class t7{constructor(e){this.storage=e}storage;itemIds=[];async getAbsolutePath(e){return await Lt.resolve(await Lt.join(this.storage.baseDir,"/",e))}async parseMany(e,n){return(await Promise.all(e.map(async r=>{try{return await this.parse(r,n)}catch(i){return console.error(`Error parsing from ${r.type} ${r.uri}:`,i),null}}))).filter(r=>r!==null)}setItemIds(e){this.itemIds=e}async write(e){e.state===Tt.Draft||e.srcType!==Fr.FS||await this.storage.set(e.id,await this.stringify(e))}async remove(e){await this.storage.remove(e)}async updateRoot(e,n){const r=e.actions;if(r){for(const o in r){const s=parseInt(o);switch(r[o]){case"D":await this.remove(this.itemIds[s]);break;case"I":case"U":await this.write(n[s]);break}}return}const i=this.itemIds.filter(o=>!n.some(s=>s.id===o));await Promise.all([...n.map(o=>this.write(o)),...i.map(o=>this.remove(o))])}async update(e,n){const r={path:e.path.slice(1),actions:e.actions};if(r.path.length===0&&await this.updateRoot(r,n),r.path.length>0){const i=r.path[0];r.path.length===1&&r.actions&&r.actions.id==="U"&&await this.remove(this.itemIds[i]),r.path[1]&&r.path[1]==="id"&&await this.remove(this.itemIds[i]),await this.write(n[i])}this.itemIds=n.map(i=>i.id)}}class EB extends t7{parse(e){return{...e.content,id:e.uri,srcType:e.type,fileDependencies:e.fileDependencies}}async stringify(e){const{id:n,srcType:r,fileDependencies:i,...o}=e;return await Lt.extname(n)===".json"?JSON.stringify(o,null,2):Ol.dump(o)}async write(e){await this.storage.has(e.id)||await super.write(e)}}var Jn=(t=>(t.SIMPLE="simple",t.REGEX="regex",t.JSONPATH="jsonpath",t.XPATH="xpath",t))(Jn||{});const Gd={active:!0,key:"",value:""},RB=/[\n\r\t]/g;function n7(t){return t.replace(RB,"").trim()}function Zo(t,e){return t.map(n=>{const r=e.boundNames==="all"||!!e.boundNames?.has(n.name);return{id:crypto.randomUUID(),key:n.name,value:r?`$inputs.${n.name}`:n.example?n7(String(n.example)):"",active:r?!0:!!n.example,in:n.in,...n.allowReserved&&{allowReserved:n.allowReserved}}})}function Hd(t,e){const[n]=t.split("?"),r=e.filter(i=>i.active).map(i=>`${i.key}=${i.value}`).join("&");return`${n}${r?`?${r}`:""}`}function Kd(t){const e=t.indexOf("?");if(e===-1)return[];const n=new URLSearchParams(t.slice(e+1)),r=[];for(const[i,o]of n.entries())r.push({id:crypto.randomUUID(),active:!0,key:i,value:o,in:"query"});return r}function r7(){return{id:crypto.randomUUID(),...Gd}}function AB(){return{id:crypto.randomUUID(),...Gd,description:""}}function wg(t){return{...Gd,id:crypto.randomUUID(),in:t}}function DB(){return{id:crypto.randomUUID(),...Gd,type:"text",files:null}}function MB(){return{id:crypto.randomUUID(),...Gd,sendIn:fr.URL}}function by(t){return t.map(e=>({id:crypto.randomUUID(),key:"",value:e,active:!0}))}function Sg(t,e){return t.filter(n=>n.active&&n.value).map(({value:n})=>(e?rn(n,e):n).trim())}function Sa(t,e){const n=e.filter(r=>!!r).flatMap(r=>r).filter(r=>r.key&&r.active);return["path","header"].includes(t)?Array.from(new Map(n.map(r=>[r.key,r])).values()):n}function zB(t,e,n){return t.map(({value:r,...i})=>({...i,value:Ru(r,e,n??{})}))}function _B(t,e){if(!t.startsWith("$components.parameters."))return null;const n=t.replace("$components.parameters.","");return n&&e[n]||null}function ln(t=[],e={}){const n=[];for(const r of t)if(gl(r)){const i=_B(r.reference,e);i&&n.push({...i,active:r.active,value:r.value||i.value})}else n.push(r);return n}function ka(t){return Object.entries(t).map(([e,n])=>({id:crypto.randomUUID(),key:"",value:e,active:!0,description:n}))}function i7(t){return t.schema}function o7(t){return i7(t)?.fields??[]}function s7(t,e){return t.flatMap(n=>{const r=i7(n),i=r?.fields||[];return i.length>0?i.flatMap(o=>a7(o.name,o.example,n.allowReserved)):a7(n.name,r?.example??n.example,n.allowReserved)})}function a7(t,e,n){if(e===void 0)return[wy(t,"",!1,n)];const r=xy(e,t);return r.length===0?[wy(t,"",!1,n)]:r.map(i=>wy(i.key,i.value,!0,n))}function xy(t,e){return t===void 0?[]:t===null?[{key:e,value:""}]:Array.isArray(t)?t.flatMap((n,r)=>n!==null&&typeof n=="object"?xy(n,`${e}[${r}]`):[{key:e,value:String(n)}]):qB(t)?Object.entries(t).flatMap(([n,r])=>xy(r,`${e}[${n}]`)):[{key:e,value:String(t)}]}function qB(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function wy(t,e,n,r){return{id:crypto.randomUUID(),key:t,value:n7(e),active:n,in:"query",...r&&{allowReserved:r}}}const l7={path:"path",query:"query",header:"headers",cookie:"cookie"};function Sy(t){return t!==void 0}function NB(t,e){if(t)return _f(t)?t:t[e]}function c7(t,e,n){const r=n[l7[e]],i=n.envVariables,o=new Set;for(const s of t??[])(r?.[s.name]||i?.[s.name])&&o.add(s.name);return o}function Rc(t,e,n){if(_f(n))return c7(t,e,n);const r=new Set;for(const i of Object.values(n))if(i)for(const o of c7(t,e,i))r.add(o);return r}function u7(t,e,n){const r=n.query,i=n.envVariables;for(const o of e??[]){const s=o7(o);for(const a of s)(r?.[a.name]||i?.[a.name])&&t.add(a.name);for(const a of[...Object.keys(r??{}),...Object.keys(i??{})])!r?.[a]&&!i?.[a]||s.some(l=>a===l.name||a.startsWith(`${l.name}[`))&&t.add(a)}}function d7(t,e,n){const r=[...t??[],...e??[]],i=new Set(Rc(r,"query",n));if(_f(n))return u7(i,e,n),i;for(const o of Object.values(n))o&&u7(i,e,o);return i}const h7=1024;let ZB=0,Ti=class{constructor(t,e){this.from=t,this.to=e}};class mt{constructor(e={}){this.id=ZB++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Pr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}mt.closedBy=new mt({deserialize:t=>t.split(" ")}),mt.openedBy=new mt({deserialize:t=>t.split(" ")}),mt.group=new mt({deserialize:t=>t.split(" ")}),mt.isolate=new mt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),mt.contextHash=new mt({perNode:!0}),mt.lookAhead=new mt({perNode:!0}),mt.mounted=new mt({perNode:!0});class Jd{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[mt.mounted.id]}}const XB=Object.create(null);class Pr{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):XB,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Pr(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(mt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(mt.group),o=-1;o<(i?i.length:0);o++){let s=n[o<0?r.name:i[o]];if(s)return s}}}}Pr.none=new Pr("",Object.create(null),0,8);class I0{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let o of e){let s=o(r);s&&(i||(i=Object.assign({},r.props)),i[s[0].id]=s[1])}n.push(i?new Pr(r.name,i,r.id,r.flags):r)}return new I0(n)}}const kg=new WeakMap,p7=new WeakMap;var Ft;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Ft||(Ft={}));let Bt=class v3{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,a]of o)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=Jd.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Pg(this.topNode,e)}cursorAt(e,n=0,r=0){let i=kg.get(this)||this.topNode,o=new Pg(i);return o.moveTo(e,n),kg.set(this,o._tree),o}get topNode(){return new Ii(this,0,0,null)}resolve(e,n=0){let r=eh(kg.get(this)||this.topNode,e,n,!1);return kg.set(this,r),r}resolveInner(e,n=0){let r=eh(p7.get(this)||this.topNode,e,n,!0);return p7.set(this,r),r}resolveStack(e,n=0){return WB(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e,s=e.mode||0,a=(s&Ft.IncludeAnonymous)>0;for(let l=this.cursor(s|Ft.IncludeAnonymous);;){let c=!1;if(l.from<=o&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Cy(Pr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new v3(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new v3(Pr.none,n,r,i)))}static build(e){return LB(e)}};Bt.empty=new Bt(Pr.none,[],[],0);class x3{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new x3(this.buffer,this.index)}}class Ja{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Pr.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,r,i,o){let{buffer:s}=this,a=-1;for(let l=e;l!=n&&!(f7(o,i,s[l+1],s[l+2])&&(a=l,r>0));l=s[l+3]);return a}slice(e,n,r){let i=this.buffer,o=new Uint16Array(n-e),s=0;for(let a=e,l=0;a<n;){o[l++]=i[a++],o[l++]=i[a++]-r;let c=o[l++]=i[a++]-r;o[l++]=i[a++]-e,s=Math.max(s,c)}return new Ja(o,s,this.set)}}function f7(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function eh(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let s=!r&&t instanceof Ii&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=r?0:Ft.IgnoreOverlays;if(r)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Ii&&s.index<0&&((i=a.enter(e,n,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,o);if(!s)return t;t=s}}class g7{cursor(e=0){return new Pg(this,e)}getChild(e,n=null,r=null){let i=m7(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return m7(this,e,n,r)}resolve(e,n=0){return eh(this,e,n,!1)}resolveInner(e,n=0){return eh(this,e,n,!0)}matchContext(e){return ky(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}let Ii=class T0 extends g7{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,o=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=n>0?a.length:-1;e!=c;e+=n){let d=a[e],h=l[e]+s.from;if(f7(i,r,h,h+d.length)){if(d instanceof Ja){if(o&Ft.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-h,i);if(p>-1)return new gs(new VB(s,d,e,h),null,p)}else if(o&Ft.IncludeAnonymous||!d.type.isAnonymous||Py(d)){let p;if(!(o&Ft.IgnoreMounts)&&(p=Jd.get(d))&&!p.overlay)return new T0(p.tree,h,e,s);let f=new T0(d,h,e,s);return o&Ft.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?d.children.length-1:0,n,r,i)}}}if(o&Ft.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&Ft.IgnoreOverlays)&&(i=Jd.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((n>0?s<=o:s<o)&&(n<0?a>=o:a>o))return new T0(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function m7(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=i.type.is(n),!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function ky(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class VB{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class gs extends g7{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new gs(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ft.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new gs(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new gs(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new gs(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,o=r.buffer[this.index+3];if(o>i){let s=r.buffer[this.index+1];e.push(r.slice(i,o,s)),n.push(0)}return new Bt(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function O7(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;o<t.length;o++){let s=t[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let r=n instanceof Ii&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new UB(i,n)}class UB{constructor(e,n){this.heads=e,this.node=n}get next(){return O7(this.heads)}}function WB(t,e,n){let r=t.resolveInner(e,n),i=null;for(let o=r instanceof Ii?r:r.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(i||(i=[r])).push(s.resolve(e,n)),o=s}else{let s=Jd.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Ii(s.tree,s.overlay[0].from+o.from,-1,o);(i||(i=[r])).push(eh(a,e,n,!1))}}return i?O7(i):r}class Pg{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ii)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Ii?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ft.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ft.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ft.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(i.buffer.buffer[o+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let o=n+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&Ft.IncludeAnonymous||a instanceof Ja||!a.type.isAnonymous||Py(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;n=s,r=o+1;break e}i=this.stack[--o]}for(let i=r;i<this.stack.length;i++)n=new gs(this.buffer,n,this.stack[i]);return this.bufferNode=new gs(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return ky(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return ky(this._tree,e,i);let s=r[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Py(t){return t.children.some(e=>e instanceof Ja||!e.type.isAnonymous||Py(e))}function LB(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=h7,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(n)?new x3(n,n.length):n,l=r.types,c=0,d=0;function h(S,C,$,Q,T,z){let{id:M,start:E,end:_,size:A}=a,q=d,I=c;for(;A<0;)if(a.next(),A==-1){let W=o[M];$.push(W),Q.push(E-S);return}else if(A==-3){c=M;return}else if(A==-4){d=M;return}else throw new RangeError(`Unrecognized record size: ${A}`);let Z=l[M],N,L,U=E-S;if(_-E<=i&&(L=O(a.pos-C,T))){let W=new Uint16Array(L.size-L.skip),F=a.pos-L.size,Y=W.length;for(;a.pos>F;)Y=y(L.start,W,Y);N=new Ja(W,_-L.start,r),U=L.start-S}else{let W=a.pos-A;a.next();let F=[],Y=[],te=M>=s?M:-1,B=0,oe=_;for(;a.pos>W;)te>=0&&a.id==te&&a.size>=0?(a.end<=oe-i&&(m(F,Y,E,B,a.end,oe,te,q,I),B=F.length,oe=a.end),a.next()):z>2500?p(E,W,F,Y):h(E,W,F,Y,te,z+1);if(te>=0&&B>0&&B<F.length&&m(F,Y,E,B,E,oe,te,q,I),F.reverse(),Y.reverse(),te>-1&&B>0){let G=f(Z,I);N=Cy(Z,F,Y,0,F.length,0,_-E,G,G)}else N=g(Z,F,Y,_-E,q-_,I)}$.push(N),Q.push(U)}function p(S,C,$,Q){let T=[],z=0,M=-1;for(;a.pos>C;){let{id:E,start:_,end:A,size:q}=a;if(q>4)a.next();else{if(M>-1&&_<M)break;M<0&&(M=A-i),T.push(E,_,A),z++,a.next()}}if(z){let E=new Uint16Array(z*4),_=T[T.length-2];for(let A=T.length-3,q=0;A>=0;A-=3)E[q++]=T[A],E[q++]=T[A+1]-_,E[q++]=T[A+2]-_,E[q++]=q;$.push(new Ja(E,T[2]-_,r)),Q.push(_-S)}}function f(S,C){return($,Q,T)=>{let z=0,M=$.length-1,E,_;if(M>=0&&(E=$[M])instanceof Bt){if(!M&&E.type==S&&E.length==T)return E;(_=E.prop(mt.lookAhead))&&(z=Q[M]+E.length+_)}return g(S,$,Q,T,z,C)}}function m(S,C,$,Q,T,z,M,E,_){let A=[],q=[];for(;S.length>Q;)A.push(S.pop()),q.push(C.pop()+$-T);S.push(g(r.types[M],A,q,z-T,E-z,_)),C.push(T-$)}function g(S,C,$,Q,T,z,M){if(z){let E=[mt.contextHash,z];M=M?[E].concat(M):[E]}if(T>25){let E=[mt.lookAhead,T];M=M?[E].concat(M):[E]}return new Bt(S,C,$,Q,M)}function O(S,C){let $=a.fork(),Q=0,T=0,z=0,M=$.end-i,E={size:0,start:0,skip:0};e:for(let _=$.pos-S;$.pos>_;){let A=$.size;if($.id==C&&A>=0){E.size=Q,E.start=T,E.skip=z,z+=4,Q+=4,$.next();continue}let q=$.pos-A;if(A<0||q<_||$.start<M)break;let I=$.id>=s?4:0,Z=$.start;for($.next();$.pos>q;){if($.size<0)if($.size==-3)I+=4;else break e;else $.id>=s&&(I+=4);$.next()}T=Z,Q+=A,z+=I}return(C<0||Q==S)&&(E.size=Q,E.start=T,E.skip=z),E.size>4?E:void 0}function y(S,C,$){let{id:Q,start:T,end:z,size:M}=a;if(a.next(),M>=0&&Q<s){let E=$;if(M>4){let _=a.pos-(M-4);for(;a.pos>_;)$=y(S,C,$)}C[--$]=E,C[--$]=z-S,C[--$]=T-S,C[--$]=Q}else M==-3?c=Q:M==-4&&(d=Q);return $}let b=[],w=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,b,w,-1,0);let P=(e=t.length)!==null&&e!==void 0?e:b.length?w[0]+b[0].length:0;return new Bt(l[t.topID],b.reverse(),w.reverse(),P)}const v7=new WeakMap;function Cg(t,e){if(!t.isAnonymous||e instanceof Ja||e.type!=t)return 1;let n=v7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Bt)){n=1;break}n+=Cg(t,r)}v7.set(e,n)}return n}function Cy(t,e,n,r,i,o,s,a,l){let c=0;for(let m=r;m<i;m++)c+=Cg(t,e[m]);let d=Math.ceil(c*1.5/8),h=[],p=[];function f(m,g,O,y,b){for(let w=O;w<y;){let P=w,S=g[w],C=Cg(t,m[w]);for(w++;w<y;w++){let $=Cg(t,m[w]);if(C+$>=d)break;C+=$}if(w==P+1){if(C>d){let $=m[P];f($.children,$.positions,0,$.children.length,g[P]+b);continue}h.push(m[P])}else{let $=g[w-1]+m[w-1].length-S;h.push(Cy(t,m,g,P,w,S,$,null,l))}p.push(S+b-o)}}return f(e,n,r,i,0),(a||l)(h,p,s)}class $y{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof gs?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ii&&this.map.set(e.tree,n)}get(e){return e instanceof gs?this.getBuffer(e.context.buffer,e.index):e instanceof Ii?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class na{constructor(e,n,r,i,o=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new na(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=r)for(;s&&s.from<h;){let p=s;if(l>=p.from||h<=p.to||c){let f=Math.max(p.from,l)-c,m=Math.min(p.to,h)-c;p=f>=m?null:new na(f,m,p.tree,p.offset+c,a>0,!!d)}if(p&&i.push(p),s.to>h)break;s=o<e.length?e[o++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return i}}let Qy=class{startParse(t,e,n){return typeof t=="string"&&(t=new YB(t)),n=n?n.length?n.map(r=>new Ti(r.from,r.to)):[new Ti(0,0)]:[new Ti(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let r=this.startParse(t,e,n);for(;;){let i=r.advance();if(i)return i}}};class YB{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function FB(t){return(e,n,r,i)=>new GB(e,t,n,r,i)}class y7{constructor(e,n,r,i,o){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=o}}function b7(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class BB{constructor(e,n,r,i,o,s,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const jy=new mt({perNode:!0});class GB{constructor(e,n,r,i,o){this.nest=n,this.input=r,this.fragments=i,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new Bt(r.type,r.children,r.positions,r.length,r.propValues.concat([[jy,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[mt.mounted.id]=new Jd(n,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new JB(this.fragments),n=null,r=null,i=new Pg(new Ii(this.baseTree,this.ranges[0].from,0,null),Ft.IncludeAnonymous|Ft.IgnoreMounts);e:for(let o,s;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let c=n.mounts.find(d=>d.frag.from<=i.from&&d.frag.to>=i.to&&d.mount.overlay);if(c)for(let d of c.mount.overlay){let h=d.from+c.pos,p=d.to+c.pos;h>=i.from&&p<=i.to&&!n.ranges.some(f=>f.from<p&&f.to>h)&&n.ranges.push({from:h,to:p})}}a=!1}else if(r&&(s=HB(r.ranges,i.from,i.to)))a=s!=2;else if(!i.type.isAnonymous&&(o=this.nest(i,this.input))&&(i.from<i.to||!o.overlay)){i.tree||KB(i);let c=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")n=new BB(o.parser,o.overlay,c,this.inner.length,i.from,i.tree,n);else{let d=S7(this.ranges,o.overlay||(i.from<i.to?[new Ti(i.from,i.to)]:[]));d.length&&b7(d),(d.length||!o.overlay)&&this.inner.push(new y7(o.parser,d.length?o.parser.startParse(this.input,k7(c,d),d):o.parser.startParse(""),o.overlay?o.overlay.map(h=>new Ti(h.from-i.from,h.to-i.from)):null,i.tree,d.length?d[0].from:i.from)),o.overlay?d.length&&(r={ranges:d,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new Ti(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=S7(this.ranges,n.ranges);c.length&&(b7(c),this.inner.splice(n.index,0,new y7(n.parser,n.parser.startParse(this.input,k7(n.mounts,c),c),n.ranges.map(d=>new Ti(d.from-n.start,d.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function HB(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function x7(t,e,n,r,i,o){if(e<n){let s=t.buffer[e+1];r.push(t.slice(e,n,s)),i.push(s-o)}}function KB(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,l=[o];function c(d,h,p,f,m,g){let O=n[g],y=[],b=[];x7(s,d,O,y,b,f);let w=a[O+1],P=a[O+2];l.push(y.length);let S=g?c(O+4,a[O+3],s.set.types[a[O]],w,P-w,g-1):e.toTree();return y.push(S),b.push(w-f),x7(s,a[O+3],h,y,b,f),new Bt(p,y,b,m)}i.children[o]=c(0,a.length,Pr.none,0,s.length,n.length-1);for(let d of l){let h=t.tree.children[d],p=t.tree.positions[d];t.yield(new Ii(h,p+t.from,d,t._tree))}}class w7{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(Ft.IncludeAnonymous|Ft.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,Ft.IgnoreOverlays|Ft.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof Bt)n=n.children[0];else break}return!1}}let JB=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let n=this.curFrag=t[0];this.curTo=(e=n.tree.prop(jy))!==null&&e!==void 0?e:n.to,this.inner=new w7(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(jy))!==null&&t!==void 0?t:e.to,this.inner=new w7(e.tree,-e.offset)}}findMounts(t,e){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let i=this.inner.cursor.node;i;i=i.parent){let o=(n=i.tree)===null||n===void 0?void 0:n.prop(mt.mounted);if(o&&o.parser==e)for(let s=this.fragI;s<this.fragments.length;s++){let a=this.fragments[s];if(a.from>=i.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:i.from-a.offset,mount:o})}}}return r}};function S7(t,e){let n=null,r=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<r.length;o++){let l=r[o];if(l.from>=a)break;l.to<=s||(n||(r=n=e.slice()),l.from<s?(n[o]=new Ti(l.from,s),l.to>a&&n.splice(o+1,0,new Ti(a,l.to))):l.to>a?n[o--]=new Ti(a,l.to):n.splice(o--,1))}}return r}function eG(t,e,n,r){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let d=i==t.length?1e9:s?t[i].to:t[i].from,h=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let p=Math.max(l,n),f=Math.min(d,h,r);p<f&&c.push(new Ti(p,f))}if(l=Math.min(d,h),l==1e9)break;d==l&&(s?(s=!1,i++):s=!0),h==l&&(a?(a=!1,o++):a=!0)}return c}function k7(t,e){let n=[];for(let{pos:r,mount:i,frag:o}of t){let s=r+(i.overlay?i.overlay[0].from:0),a=s+i.tree.length,l=Math.max(o.from,s),c=Math.min(o.to,a);if(i.overlay){let d=i.overlay.map(p=>new Ti(p.from+r,p.to+r)),h=eG(e,d,l,c);for(let p=0,f=l;;p++){let m=p==h.length,g=m?c:h[p].from;if(g>f&&n.push(new na(f,g,i.tree,-s,o.from>=f||o.openStart,o.to<=g||o.openEnd)),m)break;f=h[p].to}}else n.push(new na(l,c,i.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return n}var P7={};class E0{constructor(e,n,r,i,o,s,a,l,c,d=0,h){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new E0(e,[],n,r,r,0,[],0,i?new C7(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let a=o.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,d=this.reducePos-c;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=d));let h=l?this.stack[l-1]:0,p=this.bufferBase+this.buffer.length-h;if(i<o.minRepeatTerm||e&131072){let f=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,f,p+4,!0)}if(e&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=o.getGoto(f,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:s}=this.p;(i>this.pos||n<=s.maxNode)&&(this.pos=i,s.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=s.maxNode&&this.buffer.push(n,r,i,4)}else this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4)}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new E0(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new tG(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&i.push(n[o],s);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let s=n[o+1];i.some((a,l)=>l&1&&a==s)||i.push(n[o],s)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[i],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,o+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new C7(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class C7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class tG{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class R0{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new R0(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new R0(this.stack,this.pos,this.index)}}function th(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class $g{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $7=new $g;class nG{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<r.from;){if(!i)return null;let s=this.ranges[--i];o-=r.from-s.to,r=s}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];o+=s.from-r.to,r=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=$7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class Ac{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Q7(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Ac.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Qg{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?th(e):e}token(e,n){let r=e.pos,i=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(Q7(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||i++,s==null)break;e.reset(s,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}Qg.prototype.contextual=Ac.prototype.fallback=Ac.prototype.extend=!1;class Pn{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Q7(t,e,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let f=s+3;f<c;f+=2)if((t[f+1]&a)>0){let m=t[f];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||rG(m,e.token.value,i,o))){e.acceptToken(m);break}}let d=e.next,h=0,p=t[s+2];if(e.next<0&&p>h&&t[c+p*3-3]==65535){s=t[c+p*3-1];continue e}for(;h<p;){let f=h+p>>1,m=c+f+(f<<1),g=t[m],O=t[m+1]||65536;if(d<g)p=f;else if(d>=O)h=f+1;else{s=t[m+2],e.advance();continue e}}break}}function j7(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function rG(t,e,n,r){let i=j7(n,r,e);return i<0||j7(n,r,t)<i}const ai=typeof process<"u"&&P7&&/\bparse\b/.test(P7.LOG);let Ty=null;function T7(t,e,n){let r=t.cursor(Ft.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class iG{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?T7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?T7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=r.children[i],s=this.start[n]+r.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof Bt){if(s==e){if(s<this.safeFrom)return null;let a=s+o.length;if(a<=this.safeTo){let l=o.prop(mt.lookAhead);if(!l||a+l<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class oG{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new $g)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,s=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<o.length;c++){if((1<<c&s)==0)continue;let d=o[c],h=this.tokens[c];if(!(r&&!d.fallback)&&((d.contextual||h.start!=e.pos||h.mask!=s||h.context!=a)&&(this.updateCachedToken(h,d,e),h.mask=s,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=n;if(h.extended>-1&&(n=this.addActions(e,h.extended,h.end,n)),n=this.addActions(e,h.value,h.end,n),!d.extend&&(r=h,n>p))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new $g,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new $g,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:o}=r.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let a=o.specializers[s](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(o,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Is(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Is(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(Is(a,c+1),n,r,i))}return i}}let sG=class{constructor(t,e,n,r){this.parser=t,this.input=e,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new nG(e,r),this.tokens=new oG(t,this.stream),this.topTerm=t.top[1];let{from:i}=r[0];this.stacks=[E0.start(this,t.top[0],i)],this.fragments=n.length&&this.stream.end-i>t.bufferLength*4?new iG(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<t.length;o++){let s=t[o];for(;;){if(this.tokens.mainToken=null,s.pos>e)n.push(s);else{if(this.advanceStack(s,n,t))continue;{r||(r=[],i=[]),r.push(s);let a=this.tokens.getMainToken(s);i.push(a.value,a.end)}}break}}if(!n.length){let o=r&&lG(r);if(o)return ai&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ai&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(o)return ai&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((s,a)=>a.score-s.score);n.length>o;)n.pop();n.some(s=>s.reducePos>e)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let s=n[o];for(let a=o+1;a<n.length;a++){let l=n[a];if(s.sameState(l)||s.buffer.length>500&&l.buffer.length>500)if((s.score-l.score||s.buffer.length-l.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,n){let r=t.pos,{parser:i}=this,o=ai?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.curContext&&t.curContext.tracker.strict,c=l?t.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let h=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(t.state,d.type.id):-1;if(h>-1&&d.length&&(!l||(d.prop(mt.contextHash)||0)==c))return t.useNode(d,h),ai&&console.log(o+this.stackID(t)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof Bt)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof Bt&&d.positions[0]==0)d=p;else break}}let s=i.stateSlot(t.state,4);if(s>0)return t.reduce(s),ai&&console.log(o+this.stackID(t)+` (via always-reduce ${i.getName(s&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let l=0;l<a.length;){let c=a[l++],d=a[l++],h=a[l++],p=l==a.length||!n,f=p?t:t.split(),m=this.tokens.mainToken;if(f.apply(c,d,m?m.start:f.pos,h),ai&&console.log(o+this.stackID(f)+` (via ${(c&65536)==0?"shift":`reduce of ${i.getName(c&65535)}`} for ${i.getName(d)} @ ${r}${f==t?"":", split"})`),p)return!0;f.pos>r?e.push(f):n.push(f)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return I7(t,e),!0}}runRecovery(t,e,n){let r=null,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=e[o<<1],l=e[(o<<1)+1],c=ai?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),ai&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let d=s.split(),h=c;for(let p=0;d.forceReduce()&&p<10&&(ai&&console.log(h+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));p++)ai&&(h=this.stackID(d)+" -> ");for(let p of s.recoverByInsert(a))ai&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),ai&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),I7(s,n)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(t){return t.close(),Bt.build({buffer:R0.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Ty||(Ty=new WeakMap)).get(t);return e||Ty.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};function I7(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class aG{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const Iy=t=>t;class nh{constructor(e){this.start=e.start,this.shift=e.shift||Iy,this.reduce=e.reduce||Iy,this.reuse=e.reuse||Iy,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ko extends Qy{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.length;a++)i.push([]);function o(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=mt[l]);for(let c=1;c<a.length;){let d=a[c++];if(d>=0)o(d,l,a[c++]);else{let h=a[c+-d];for(let p=-d;p>0;p--)o(a[c++],l,h);c++}}}this.nodeSet=new I0(n.map((a,l)=>Pr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=h7;let s=th(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(E7),this.states=th(e.states,Uint32Array),this.data=th(e.stateData),this.goto=th(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Ac(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new sG(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let s=i[o++],a=s&1,l=i[o++];if(a&&r)return l;for(let c=o+(s>>1);o<c;o++)if(i[o]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),s;;o+=3){if((s=r[o])==65535)if(r[o+1]==1)s=r[o=Is(r,o+2)];else{if(r[o+1]==2)return Is(r,o+2);break}if(s==n||s==0)return Is(r,o+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Is(this.data,o+2);else break;i=n(Is(this.data,o+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Is(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((o,s)=>s&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(ko.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=E7(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let o of e.split(" ")){let s=n.indexOf(o);s>=0&&(r[s]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let s=this.dialects[n[o]],a;(a=this.data[s++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new aG(e,r,i)}static deserialize(e){return new ko(e)}}function Is(t,e){return t[e]|t[e+1]<<16}function lG(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function E7(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let cG=0,Es=class y3{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=cG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof y3&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new y3(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new A0(e);return r=>r.modified.indexOf(n)>-1?r:A0.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}},uG=0;class A0{constructor(e){this.name=e,this.instances=[],this.id=uG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&dG(n,a.modified));if(r)return r;let i=[],o=new Es(e.name,i,e,n);for(let a of n)a.instances.push(o);let s=hG(n);for(let a of e.set)if(!a.modified.length)for(let l of s)i.push(A0.get(a,l));return o}}function dG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function hG(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function Rs(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let o=[],s=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){s=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!p)throw new RangeError("Invalid path: "+i);if(o.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),h+=p[0].length,h==i.length)break;let f=i[h++];if(h==i.length&&f=="!"){s=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+i);let d=new jg(r,s,l>0?o.slice(0,l):null);e[c]=d.sort(e[c])}}return R7.add(e)}const R7=new mt;class jg{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}jg.empty=new jg([],2,null);function A7(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let l of a.set){let c=n[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:r}}function pG(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function fG(t,e,n,r=0,i=t.length){let o=new gG(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class gG{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,o){let{type:s,from:a,to:l}=e;if(a>=r||l<=n)return;s.isTop&&(o=this.highlighters.filter(f=>!f.scope||f.scope(s)));let c=i,d=mG(e)||jg.empty,h=pG(o,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(n,a),c),d.opaque)return;let p=e.tree&&e.tree.prop(mt.mounted);if(p&&p.overlay){let f=e.node.enter(p.overlay[0].from+a,1),m=this.highlighters.filter(O=>!O.scope||O.scope(p.tree.type)),g=e.firstChild();for(let O=0,y=a;;O++){let b=O<p.overlay.length?p.overlay[O]:null,w=b?b.from+a:l,P=Math.max(n,y),S=Math.min(r,w);if(P<S&&g)for(;e.from<S&&(this.highlightRange(e,P,S,i,o),this.startSpan(Math.min(S,e.to),c),!(e.to>=w||!e.nextSibling())););if(!b||w>r)break;y=b.to+a,y>n&&(this.highlightRange(f.cursor(),Math.max(n,b.from+a),Math.min(r,y),"",m),this.startSpan(Math.min(r,y),c))}g&&e.parent()}else if(e.firstChild()){p&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function mG(t){let e=t.type.prop(R7);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=Es.define,Tg=Ie(),Pa=Ie(),D7=Ie(Pa),M7=Ie(Pa),Ca=Ie(),Ig=Ie(Ca),Ey=Ie(Ca),Xo=Ie(),vl=Ie(Xo),Vo=Ie(),Uo=Ie(),Ry=Ie(),rh=Ie(Ry),Eg=Ie(),j={comment:Tg,lineComment:Ie(Tg),blockComment:Ie(Tg),docComment:Ie(Tg),name:Pa,variableName:Ie(Pa),typeName:D7,tagName:Ie(D7),propertyName:M7,attributeName:Ie(M7),className:Ie(Pa),labelName:Ie(Pa),namespace:Ie(Pa),macroName:Ie(Pa),literal:Ca,string:Ig,docString:Ie(Ig),character:Ie(Ig),attributeValue:Ie(Ig),number:Ey,integer:Ie(Ey),float:Ie(Ey),bool:Ie(Ca),regexp:Ie(Ca),escape:Ie(Ca),color:Ie(Ca),url:Ie(Ca),keyword:Vo,self:Ie(Vo),null:Ie(Vo),atom:Ie(Vo),unit:Ie(Vo),modifier:Ie(Vo),operatorKeyword:Ie(Vo),controlKeyword:Ie(Vo),definitionKeyword:Ie(Vo),moduleKeyword:Ie(Vo),operator:Uo,derefOperator:Ie(Uo),arithmeticOperator:Ie(Uo),logicOperator:Ie(Uo),bitwiseOperator:Ie(Uo),compareOperator:Ie(Uo),updateOperator:Ie(Uo),definitionOperator:Ie(Uo),typeOperator:Ie(Uo),controlOperator:Ie(Uo),punctuation:Ry,separator:Ie(Ry),bracket:rh,angleBracket:Ie(rh),squareBracket:Ie(rh),paren:Ie(rh),brace:Ie(rh),content:Xo,heading:vl,heading1:Ie(vl),heading2:Ie(vl),heading3:Ie(vl),heading4:Ie(vl),heading5:Ie(vl),heading6:Ie(vl),contentSeparator:Ie(Xo),list:Ie(Xo),quote:Ie(Xo),emphasis:Ie(Xo),strong:Ie(Xo),link:Ie(Xo),monospace:Ie(Xo),strikethrough:Ie(Xo),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:Eg,documentMeta:Ie(Eg),annotation:Ie(Eg),processingInstruction:Ie(Eg),definition:Es.defineModifier("definition"),constant:Es.defineModifier("constant"),function:Es.defineModifier("function"),standard:Es.defineModifier("standard"),local:Es.defineModifier("local"),special:Es.defineModifier("special")};for(let t in j){let e=j[t];e instanceof Es&&(e.name=t)}A7([{tag:j.link,class:"tok-link"},{tag:j.heading,class:"tok-heading"},{tag:j.emphasis,class:"tok-emphasis"},{tag:j.strong,class:"tok-strong"},{tag:j.keyword,class:"tok-keyword"},{tag:j.atom,class:"tok-atom"},{tag:j.bool,class:"tok-bool"},{tag:j.url,class:"tok-url"},{tag:j.labelName,class:"tok-labelName"},{tag:j.inserted,class:"tok-inserted"},{tag:j.deleted,class:"tok-deleted"},{tag:j.literal,class:"tok-literal"},{tag:j.string,class:"tok-string"},{tag:j.number,class:"tok-number"},{tag:[j.regexp,j.escape,j.special(j.string)],class:"tok-string2"},{tag:j.variableName,class:"tok-variableName"},{tag:j.local(j.variableName),class:"tok-variableName tok-local"},{tag:j.definition(j.variableName),class:"tok-variableName tok-definition"},{tag:j.special(j.variableName),class:"tok-variableName2"},{tag:j.definition(j.propertyName),class:"tok-propertyName tok-definition"},{tag:j.typeName,class:"tok-typeName"},{tag:j.namespace,class:"tok-namespace"},{tag:j.className,class:"tok-className"},{tag:j.macroName,class:"tok-macroName"},{tag:j.propertyName,class:"tok-propertyName"},{tag:j.operator,class:"tok-operator"},{tag:j.comment,class:"tok-comment"},{tag:j.meta,class:"tok-meta"},{tag:j.invalid,class:"tok-invalid"},{tag:j.punctuation,class:"tok-punctuation"}]);const OG=Rs({String:j.string,Number:j.number,"True False":j.bool,PropertyName:j.propertyName,Null:j.null,",":j.separator,"[ ]":j.squareBracket,"{ }":j.brace}),vG=ko.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[OG],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Ay=[],z7=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?z7:Ay).push(n=n+t[e])})();function yG(t){if(t<768)return!1;for(let e=0,n=Ay.length;;){let r=e+n>>1;if(t<Ay[r])n=r;else if(t>=z7[r])e=r+1;else return!0;if(e==n)return!1}}function _7(t){return t>=127462&&t<=127487}const q7=8205;function bG(t,e,n=!0,r=!0){return(n?N7:xG)(t,e,r)}function N7(t,e,n){if(e==t.length)return e;e&&Z7(t.charCodeAt(e))&&X7(t.charCodeAt(e-1))&&e--;let r=Dy(t,e);for(e+=V7(r);e<t.length;){let i=Dy(t,e);if(r==q7||i==q7||n&&yG(i))e+=V7(i),r=i;else if(_7(i)){let o=0,s=e-2;for(;s>=0&&_7(Dy(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function xG(t,e,n){for(;e>0;){let r=N7(t,e-2,n);if(r<e)return r;e--}return 0}function Dy(t,e){let n=t.charCodeAt(e);if(!X7(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Z7(r)?(n-55296<<10)+(r-56320)+65536:n}function Z7(t){return t>=56320&&t<57344}function X7(t){return t>=55296&&t<56320}function V7(t){return t<65536?1:2}let zt=class MV{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Dc(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),ms.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Dc(this,e,n);let r=[];return this.decompose(e,n,r,0),ms.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new ih(this),o=new ih(e);for(let s=n,a=n;;){if(i.next(s),o.next(s),s=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new ih(this,e)}iterRange(e,n=this.length){return new W7(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new L7(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?MV.empty:e.length<=32?new In(e):ms.from(In.split(e,[]))}};class In extends zt{constructor(e,n=wG(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let o=0;;o++){let s=this.text[o],a=i+s.length;if((n?r:a)>=e)return new SG(i,a,r,s);i=a+1,r++}}decompose(e,n,r,i){let o=e<=0&&n>=this.length?this:new In(U7(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let s=r.pop(),a=Rg(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new In(a,s.length+o.length));else{let l=a.length>>1;r.push(new In(a.slice(0,l)),new In(a.slice(l)))}}else r.push(o)}replace(e,n,r){if(!(r instanceof In))return super.replace(e,n,r);[e,n]=Dc(this,e,n);let i=Rg(this.text,Rg(r.text,U7(this.text,0,e)),n),o=this.length+r.length-(n-e);return i.length<=32?new In(i,o):ms.from(In.split(i,[]),o)}sliceString(e,n=this.length,r=`
|
|
334
334
|
`){[e,n]=Dc(this,e,n);let i="";for(let o=0,s=0;o<=n&&s<this.text.length;s++){let a=this.text[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&n>o&&(i+=a.slice(Math.max(0,e-o),n-o)),o=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let o of e)r.push(o),i+=o.length+1,r.length==32&&(n.push(new In(r,i)),r=[],i=-1);return i>-1&&n.push(new In(r,i)),n}}class ms extends zt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let o=0;;o++){let s=this.children[o],a=i+s.length,l=r+s.lines-1;if((n?l:a)>=e)return s.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let o=0,s=0;s<=n&&o<this.children.length;o++){let a=this.children[o],l=s+a.length;if(e<=l&&n>=s){let c=i&((s<=e?1:0)|(l>=n?2:0));s>=e&&l<=n&&!c?r.push(a):a.decompose(e-s,n-s,r,c)}s=l+1}}replace(e,n,r){if([e,n]=Dc(this,e,n),r.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e>=o&&n<=a){let l=s.replace(e-o,n-o,r),c=this.lines-s.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[i]=l,new ms(d,this.length-(n-e)+r.length)}return super.replace(o,a,l)}o=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
335
335
|
`){[e,n]=Dc(this,e,n);let i="";for(let o=0,s=0;o<this.children.length&&s<=n;o++){let a=this.children[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&n>s&&(i+=a.sliceString(e-s,n-s,r)),s=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof ms))return 0;let r=0,[i,o,s,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,o+=n){if(i==s||o==a)return r;let l=this.children[i],c=e.children[o];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let m of e)m.flatten(f);return new In(f,n)}let i=Math.max(32,r>>5),o=i<<1,s=i>>1,a=[],l=0,c=-1,d=[];function h(f){let m;if(f.lines>o&&f instanceof ms)for(let g of f.children)h(g);else f.lines>s&&(l>s||!l)?(p(),a.push(f)):f instanceof In&&l&&(m=d[d.length-1])instanceof In&&f.lines+m.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new In(m.text.concat(f.text),m.length+1+f.length)):(l+f.lines>i&&p(),l+=f.lines,c+=f.length+1,d.push(f))}function p(){l!=0&&(a.push(d.length==1?d[0]:ms.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return p(),a.length==1?a[0]:new ms(a,n)}}zt.empty=new In([""],0);function wG(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Rg(t,e,n=0,r=1e9){for(let i=0,o=0,s=!0;o<t.length&&i<=r;o++){let a=t[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(e[e.length-1]+=a,s=!1):e.push(a)),i=l+1}return e}function U7(t,e,n){return Rg(t,[""],e,n)}class ih{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof In?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],o=this.offsets[r],s=o>>1,a=i instanceof In?i.text.length:i.children.length;if(s==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
336
336
|
`,this;e--}else if(i instanceof In){let l=i.text[s+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[s+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof In?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class W7{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new ih(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class L7{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(zt.prototype[Symbol.iterator]=function(){return this.iter()},ih.prototype[Symbol.iterator]=W7.prototype[Symbol.iterator]=L7.prototype[Symbol.iterator]=function(){return this});let SG=class{constructor(t,e,n,r){this.from=t,this.to=e,this.number=n,this.text=r}get length(){return this.to-this.from}};function Dc(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function er(t,e,n=!0,r=!0){return bG(t,e,n,r)}function kG(t){return t>=56320&&t<57344}function PG(t){return t>=55296&&t<56320}function Br(t,e){let n=t.charCodeAt(e);if(!PG(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return kG(r)?(n-55296<<10)+(r-56320)+65536:n}function My(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Wo(t){return t<65536?1:2}const zy=/\r\n?|\n/;var tr=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(tr||(tr={}));class fs{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let o=this.sections[n++],s=this.sections[n++];s<0?(e(r,i,o),i+=o):i+=s,r+=o}}iterChangedRanges(e,n=!1){_y(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new fs(e)}composeDesc(e){return this.empty?e:e.empty?this:Y7(this,e)}mapDesc(e,n=!1){return e.empty?this:qy(this,e,n)}mapPos(e,n=-1,r=tr.Simple){let i=0,o=0;for(let s=0;s<this.sections.length;){let a=this.sections[s++],l=this.sections[s++],c=i+a;if(l<0){if(c>e)return o+(e-i);o+=a}else{if(r!=tr.Simple&&c>=e&&(r==tr.TrackDel&&i<e&&c>e||r==tr.TrackBefore&&i<e||r==tr.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==i||n<0?o:o+l;o+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return o}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let o=this.sections[r++],s=this.sections[r++],a=i+o;if(s>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new fs(e)}static create(e){return new fs(e)}}class Ln extends fs{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return _y(this,(n,r,i,o,s)=>e=e.replace(i,i+(r-n),s),!1),e}mapDesc(e,n=!1){return qy(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,o=0;i<n.length;i+=2){let s=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=s;let l=i>>1;for(;r.length<l;)r.push(zt.empty);r.push(s?e.slice(o,o+s):zt.empty)}o+=s}return new Ln(n,r)}compose(e){return this.empty?e:e.empty?this:Y7(this,e,!0)}map(e,n=!1){return e.empty?this:qy(this,e,n,!0)}iterChanges(e,n=!1){_y(this,e,n)}get desc(){return fs.create(this.sections)}filter(e){let n=[],r=[],i=[],o=new oh(this);e:for(let s=0,a=0;;){let l=s==e.length?1e9:e[s++];for(;a<l||a==l&&o.len==0;){if(o.done)break e;let d=Math.min(o.len,l-a);Or(i,d,-1);let h=o.ins==-1?-1:o.off==0?o.ins:0;Or(n,d,h),h>0&&$a(r,n,o.text),o.forward(d),a+=d}let c=e[s++];for(;a<c;){if(o.done)break e;let d=Math.min(o.len,c-a);Or(n,d,-1),Or(i,d,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(d),a+=d}}return{changes:new Ln(n,r),filtered:fs.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],o=[],s=0,a=null;function l(d=!1){if(!d&&!i.length)return;s<n&&Or(i,n-s,-1);let h=new Ln(i,o);a=a?a.compose(h.map(a)):h,i=[],o=[],s=0}function c(d){if(Array.isArray(d))for(let h of d)c(h);else if(d instanceof Ln){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:p=h,insert:f}=d;if(h>p||h<0||p>n)throw new RangeError(`Invalid change range ${h} to ${p} (in doc of length ${n})`);let m=f?typeof f=="string"?zt.of(f.split(r||zy)):f:zt.empty,g=m.length;if(h==p&&g==0)return;h<s&&l(),h>s&&Or(i,h-s,-1),Or(i,p-h,g),$a(o,i,m),s=p}}return c(e),l(!a),a}static empty(e){return new Ln(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let o=e[i];if(typeof o=="number")n.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,a)=>a&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)n.push(o[0],0);else{for(;r.length<i;)r.push(zt.empty);r[i]=zt.of(o.slice(1)),n.push(o[0],r[i].length)}}}return new Ln(n,r)}static createSet(e,n){return new Ln(e,n)}}function Or(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function $a(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(zt.empty);t.push(n)}}function _y(t,e,n){let r=t.inserted;for(let i=0,o=0,s=0;s<t.sections.length;){let a=t.sections[s++],l=t.sections[s++];if(l<0)i+=a,o+=a;else{let c=i,d=o,h=zt.empty;for(;c+=a,d+=l,l&&r&&(h=h.append(r[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(i,c,o,d,h),i=c,o=d}}}function qy(t,e,n,r=!1){let i=[],o=r?[]:null,s=new oh(t),a=new oh(e);for(let l=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&a.ins==-1){let c=Math.min(s.len,a.len);Or(i,c,-1),s.forward(c),a.forward(c)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len<s.len||a.len==s.len&&!n))){let c=a.len;for(Or(i,a.ins,-1);c;){let d=Math.min(s.len,c);s.ins>=0&&l<s.i&&s.len<=d&&(Or(i,0,s.ins),o&&$a(o,i,s.text),l=s.i),s.forward(d),c-=d}a.next()}else if(s.ins>=0){let c=0,d=s.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);c+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;Or(i,c,l<s.i?s.ins:0),o&&l<s.i&&$a(o,i,s.text),l=s.i,s.forward(s.len-d)}else{if(s.done&&a.done)return o?Ln.createSet(i,o):fs.create(i);throw new Error("Mismatched change set lengths")}}}function Y7(t,e,n=!1){let r=[],i=n?[]:null,o=new oh(t),s=new oh(e);for(let a=!1;;){if(o.done&&s.done)return i?Ln.createSet(r,i):fs.create(r);if(o.ins==0)Or(r,o.len,0,a),o.next();else if(s.len==0&&!s.done)Or(r,0,s.ins,a),i&&$a(i,r,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let l=Math.min(o.len2,s.len),c=r.length;if(o.ins==-1){let d=s.ins==-1?-1:s.off?0:s.ins;Or(r,l,d,a),i&&d&&$a(i,r,s.text)}else s.ins==-1?(Or(r,o.off?0:o.len,l,a),i&&$a(i,r,o.textBit(l))):(Or(r,o.off?0:o.len,s.off?0:s.ins,a),i&&!s.off&&$a(i,r,s.text));a=(o.ins>l||s.ins>=0&&s.len>l)&&(a||r.length>c),o.forward2(l),s.forward(l)}}}}class oh{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?zt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?zt.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let Ag=class b3{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new b3(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return me.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return me.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return me.range(e.anchor,e.head)}static create(e,n,r){return new b3(e,n,r)}};class me{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:me.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new me([this.main],0)}addRange(e,n=!0){return me.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,me.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new me(e.ranges.map(n=>Ag.fromJSON(n)),e.main)}static single(e,n=e){return new me([me.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let o=e[i];if(o.empty?o.from<=r:o.from<r)return me.normalized(e.slice(),n);r=o.to}return new me(e,n)}static cursor(e,n=0,r,i){return Ag.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let o=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?Ag.create(n,e,48|o):Ag.create(e,n,(n>e?8:0)|o)}static normalized(e,n=0){let r=e[n];e.sort((i,o)=>i.from-o.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let o=e[i],s=e[i-1];if(o.empty?o.from<=s.to:o.from<s.to){let a=s.from,l=Math.max(o.to,s.to);i<=n&&n--,e.splice(--i,2,o.anchor>o.head?me.range(l,a):me.range(a,l))}}return new me(e,n)}}function F7(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Ny=0;class Me{constructor(e,n,r,i,o){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Ny++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Me(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Zy),!!e.static,e.enables)}of(e){return new Dg([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dg(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dg(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Zy(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Dg{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Ny++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,c=!1,d=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:(((n=e[h.id])!==null&&n!==void 0?n:1)&1)==0&&d.push(e[h.id]);return{create(h){return h.values[s]=r(h),1},update(h,p){if(l&&p.docChanged||c&&(p.docChanged||p.selection)||Xy(h,d)){let f=r(h);if(a?!B7(f,h.values[s],i):!i(f,h.values[s]))return h.values[s]=f,1}return 0},reconfigure:(h,p)=>{let f,m=p.config.address[o];if(m!=null){let g=zg(p,m);if(this.dependencies.every(O=>O instanceof Me?p.facet(O)===h.facet(O):O instanceof Wn?p.field(O,!1)==h.field(O,!1):!0)||(a?B7(f=r(h),g,i):i(f=r(h),g)))return h.values[s]=g,0}else f=r(h);return h.values[s]=f,1}}}}function B7(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Xy(t,e){let n=!1;for(let r of e)ah(t,r)&1&&(n=!0);return n}function CG(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),o=r.filter(l=>!(l&1)),s=t[e.id]>>1;function a(l){let c=[];for(let d=0;d<r.length;d++){let h=zg(l,r[d]);if(i[d]==2)for(let p of h)c.push(p);else c.push(h)}return e.combine(c)}return{create(l){for(let c of r)ah(l,c);return l.values[s]=a(l),1},update(l,c){if(!Xy(l,o))return 0;let d=a(l);return e.compare(d,l.values[s])?0:(l.values[s]=d,1)},reconfigure(l,c){let d=Xy(l,r),h=c.config.facets[e.id],p=c.facet(e);if(h&&!d&&Zy(n,h))return l.values[s]=p,0;let f=a(l);return e.compare(f,p)?(l.values[s]=p,0):(l.values[s]=f,1)}}}const Mg=Me.define({static:!0});class Wn{constructor(e,n,r,i,o){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=o,this.provides=void 0}static define(e){let n=new Wn(Ny++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){return(e.facet(Mg).find(r=>r.field==this)?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let o=r.values[n],s=this.updateF(o,i);return this.compareF(o,s)?0:(r.values[n]=s,1)},reconfigure:(r,i)=>{let o=r.facet(Mg),s=i.facet(Mg),a;return(a=o.find(l=>l.field==this))&&a!=s.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Mg.of({field:this,create:e})]}get extension(){return this}}const yl={lowest:4,low:3,default:2,high:1,highest:0};function sh(t){return e=>new G7(e,t)}const Gr={highest:sh(yl.highest),high:sh(yl.high),default:sh(yl.default),low:sh(yl.low),lowest:sh(yl.lowest)};class G7{constructor(e,n){this.inner=e,this.prec=n}}class kf{of(e){return new Vy(this,e)}reconfigure(e){return kf.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Vy{constructor(e,n){this.compartment=e,this.inner=n}}class D0{constructor(e,n,r,i,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],o=Object.create(null),s=new Map;for(let p of $G(e,n,s))p instanceof Wn?i.push(p):(o[p.facet.id]||(o[p.facet.id]=[])).push(p);let a=Object.create(null),l=[],c=[];for(let p of i)a[p.id]=c.length<<1,c.push(f=>p.slot(f));let d=r?.config.facets;for(let p in o){let f=o[p],m=f[0].facet,g=d&&d[p]||[];if(f.every(O=>O.type==0))if(a[m.id]=l.length<<1|1,Zy(g,f))l.push(r.facet(m));else{let O=m.combine(f.map(y=>y.value));l.push(r&&m.compare(O,r.facet(m))?r.facet(m):O)}else{for(let O of f)O.type==0?(a[O.id]=l.length<<1|1,l.push(O.value)):(a[O.id]=c.length<<1,c.push(y=>O.dynamicSlot(y)));a[m.id]=c.length<<1,c.push(O=>CG(O,m,f))}}let h=c.map(p=>p(a));return new D0(e,s,h,a,l,o)}}function $G(t,e,n){let r=[[],[],[],[],[]],i=new Map;function o(s,a){let l=i.get(s);if(l!=null){if(l<=a)return;let c=r[l].indexOf(s);c>-1&&r[l].splice(c,1),s instanceof Vy&&n.delete(s.compartment)}if(i.set(s,a),Array.isArray(s))for(let c of s)o(c,a);else if(s instanceof Vy){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;n.set(s.compartment,c),o(c,a)}else if(s instanceof G7)o(s.inner,s.prec);else if(s instanceof Wn)r[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Dg)r[a].push(s),s.facet.extensions&&o(s.facet.extensions,yl.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(c,a)}}return o(t,yl.default),r.reduce((s,a)=>s.concat(a))}function ah(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function zg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const H7=Me.define(),Uy=Me.define({combine:t=>t.some(e=>e),static:!0}),K7=Me.define({combine:t=>t.length?t[0]:void 0,static:!0}),J7=Me.define(),eC=Me.define(),tC=Me.define(),nC=Me.define({combine:t=>t.length?t[0]:!1});class Lo{constructor(e,n){this.type=e,this.value=n}static define(){return new QG}}class QG{of(e){return new Lo(this,e)}}class jG{constructor(e){this.map=e}of(e){return new ot(this,e)}}class ot{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new ot(this.type,n)}is(e){return this.type==e}static define(e={}){return new jG(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let o=i.map(n);o&&r.push(o)}return r}}ot.reconfigure=ot.define(),ot.appendConfig=ot.define();class zn{constructor(e,n,r,i,o,s){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&F7(r,n.newLength),o.some(a=>a.type==zn.time)||(this.annotations=o.concat(zn.time.of(Date.now())))}static create(e,n,r,i,o,s){return new zn(e,n,r,i,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(zn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}zn.time=Lo.define(),zn.userEvent=Lo.define(),zn.addToHistory=Lo.define(),zn.remote=Lo.define();function TG(t,e){let n=[];for(let r=0,i=0;;){let o,s;if(r<t.length&&(i==e.length||e[i]>=t[r]))o=t[r++],s=t[r++];else if(i<e.length)o=e[i++],s=e[i++];else return n;!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function rC(t,e,n){var r;let i,o,s;return n?(i=e.changes,o=Ln.empty(e.changes.length),s=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(i)),{changes:s,selection:e.selection?e.selection.map(o):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:ot.mapEffects(t.effects,i).concat(ot.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Wy(t,e,n){let r=e.selection,i=Mc(e.annotations);return e.userEvent&&(i=i.concat(zn.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ln?e.changes:Ln.of(e.changes||[],n,t.facet(K7)),selection:r&&(r instanceof me?r:me.single(r.anchor,r.head)),effects:Mc(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function iC(t,e,n){let r=Wy(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(n=!1);let s=!!e[o].sequential;r=rC(r,Wy(t,e[o],s?r.changes.newLength:t.doc.length),s)}let i=zn.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return EG(n?IG(i):i)}function IG(t){let e=t.startState,n=!0;for(let i of e.facet(J7)){let o=i(t);if(o===!1){n=!1;break}Array.isArray(o)&&(n=n===!0?o:TG(n,o))}if(n!==!0){let i,o;if(n===!1)o=t.changes.invertedDesc,i=Ln.empty(e.doc.length);else{let s=t.changes.filter(n);i=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}t=zn.create(e,i,t.selection&&t.selection.map(o),ot.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let r=e.facet(eC);for(let i=r.length-1;i>=0;i--){let o=r[i](t);o instanceof zn?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof zn?t=o[0]:t=iC(e,Mc(o),!1)}return t}function EG(t){let e=t.startState,n=e.facet(tC),r=t;for(let i=n.length-1;i>=0;i--){let o=n[i](t);o&&Object.keys(o).length&&(r=rC(r,Wy(e,o,t.changes.newLength),!0))}return r==t?t:zn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const RG=[];function Mc(t){return t==null?RG:Array.isArray(t)?t:[t]}var hn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(hn||(hn={}));const AG=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ly;try{Ly=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function DG(t){if(Ly)return Ly.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||AG.test(n)))return!0}return!1}function MG(t){return e=>{if(!/\S/.test(e))return hn.Space;if(DG(e))return hn.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return hn.Word;return hn.Other}}class $t{constructor(e,n,r,i,o,s){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)ah(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return ah(this,r),zg(this,r)}update(...e){return iC(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(kf.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(ot.reconfigure)?(n=null,r=a.value):a.is(ot.appendConfig)&&(n=null,r=Mc(r).concat(a.value));let o;n?o=e.startState.values.slice():(n=D0.resolve(r,i,this),o=new $t(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values);let s=e.startState.facet(Uy)?e.newSelection:e.newSelection.asSingle();new $t(n,e.newDoc,s,o,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:me.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),o=[r.range],s=Mc(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),d=c.map(i);for(let p=0;p<a;p++)o[p]=o[p].map(d);let h=i.mapDesc(c,!0);o.push(l.range.map(h)),i=i.compose(d),s=ot.mapEffects(s,d).concat(ot.mapEffects(Mc(l.effects),h))}return{changes:i,selection:me.create(o,n.mainIndex),effects:s}}changes(e=[]){return e instanceof Ln?e:Ln.of(e,this.doc.length,this.facet($t.lineSeparator))}toText(e){return zt.of(e.split(this.facet($t.lineSeparator)||zy))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(ah(this,n),zg(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Wn&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let o in r)if(Object.prototype.hasOwnProperty.call(e,o)){let s=r[o],a=e[o];i.push(s.init(l=>s.spec.fromJSON(a,l)))}}return $t.create({doc:e.doc,selection:me.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=D0.resolve(e.extensions||[],new Map),r=e.doc instanceof zt?e.doc:zt.of((e.doc||"").split(n.staticFacet($t.lineSeparator)||zy)),i=e.selection?e.selection instanceof me?e.selection:me.single(e.selection.anchor,e.selection.head):me.single(0);return F7(i,r.length),n.staticFacet(Uy)||(i=i.asSingle()),new $t(n,r,i,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet($t.tabSize)}get lineBreak(){return this.facet($t.lineSeparator)||`
|
|
@@ -521,7 +521,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
521
521
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
522
522
|
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){const e=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,e.value){const n="end"in e.value?e.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"space":case"comment":if(e.value)t.items.push({start:[this.sourceToken]});else if(e.sep)e.sep.push(this.sourceToken);else{if(this.atIndentedComment(e.start,t.indent)){const n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){wO(n,e.start),n.push(this.sourceToken),t.items.pop();return}}e.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const n=!this.onKeyLine&&this.indent===t.indent,r=n&&(e.sep||e.explicitKey)&&this.type!=="seq-item-ind";let i=[];if(r&&e.sep&&!e.value){const o=[];for(let s=0;s<e.sep.length;++s){const a=e.sep[s];switch(a.type){case"newline":o.push(s);break;case"space":break;case"comment":a.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=e.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||e.value?(i.push(this.sourceToken),t.items.push({start:i}),this.onKeyLine=!0):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"explicit-key-ind":!e.sep&&!e.explicitKey?(e.start.push(this.sourceToken),e.explicitKey=!0):r||e.value?(i.push(this.sourceToken),t.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(e.explicitKey)if(e.sep)if(e.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Va(e.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(iR(e.key)&&!Va(e.sep,"newline")){const o=ku(e.start),s=e.key,a=e.sep;a.push(this.sourceToken),delete e.key,delete e.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:a}]})}else i.length>0?e.sep=e.sep.concat(i,this.sourceToken):e.sep.push(this.sourceToken);else if(Va(e.start,"newline"))Object.assign(e,{key:null,sep:[this.sourceToken]});else{const o=ku(e.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else e.sep?e.value||r?t.items.push({start:i,key:null,sep:[this.sourceToken]}):Va(e.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):e.sep.push(this.sourceToken):Object.assign(e,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);r||e.value?(t.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):e.sep?this.stack.push(o):(Object.assign(e,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!e.explicitKey&&e.sep&&!Va(e.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&t.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){const e=t.items[t.items.length-1];switch(this.type){case"newline":if(e.value){const n="end"in e.value?e.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else e.start.push(this.sourceToken);return;case"space":case"comment":if(e.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(e.start,t.indent)){const n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){wO(n,e.start),n.push(this.sourceToken),t.items.pop();return}}e.start.push(this.sourceToken)}return;case"anchor":case"tag":if(e.value||this.indent<=t.indent)break;e.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;e.value||Va(e.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken);return}if(this.indent>t.indent){const n=this.startBlockValue(t);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const e=t.items[t.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!e||e.sep?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken);return;case"map-value-ind":!e||e.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):Object.assign(e,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!e||e.value?t.items.push({start:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!e||e.value?t.items.push({start:[],key:r,sep:[]}):e.sep?this.stack.push(r):Object.assign(e,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const n=this.startBlockValue(t);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===t.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const r=xO(n),i=ku(r);oR(t);const o=t.end.splice(1,t.end.length);o.push(this.sourceToken);const s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let e=this.source.indexOf(`
|
|
523
523
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
524
|
-
`,e)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const e=xO(t),n=ku(e);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const e=xO(t),n=ku(e);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,e){return this.type!=="comment"||this.indent<=e?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Qce(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Cce||null,prettyErrors:e}}function jce(t,e={}){const{lineCounter:n,prettyErrors:r}=Qce(e),i=new $ce(n?.addNewLine),o=new xce(e);let s=null;for(const a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new sp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(LE(t,n)),s.warnings.forEach(LE(t,n))),s}class Tce{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(i=>i!=="version").map(i=>{const o=r[i],s=Object.entries(o.inputs??{}).map(([l,c])=>{const d=this.providers.resolveProviderForMarker(c);return d?{name:l,value:d.resolve(n,i,l),isSecret:!0}:{name:l,value:typeof c=="string"?c:"",isSecret:!1}}),a=Object.entries(o.servers??{}).map(([l,c])=>({apiId:l,value:c.value,variables:Object.entries(c.variables??{}).map(([d,h])=>({name:d,value:h}))}));return{name:i,inputs:s,servers:a,state:Tt.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(o=>o.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const o of n)if(o.name){if(!e.hasIn([o.name])){const s=e.createNode({});s instanceof qr&&(s.flow=!1),e.setIn([o.name],s)}this.syncInputs(e,o.name,o.inputs,r),this.syncServers(e,o.name,o.servers)}return e}syncInputs(e,n,r,i){const o=new Set(r.map(s=>s.name));this.deleteRemovedKeys(e,[n,"inputs"],o),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const s of r){const a=[n,"inputs",s.name];if(s.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,s.name,s.value);continue}e.getIn(a)!==s.value&&e.setIn(a,s.value)}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const o of r){const s=[n,"servers",o.apiId];e.getIn([...s,"value"])!==o.value&&e.setIn([...s,"value"],o.value);const a=new Set(o.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...s,"variables"],a),o.variables.length>0&&this.unflowMap(e,[...s,"variables"]);for(const l of o.variables){const c=[...s,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof qr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const o of this.getMapKeys(e,...n))o!==i&&!r.has(o)&&e.deleteIn([...n,o])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof qr?r.items.map(i=>String(i.key)):[]}}class Ice{id="local";isMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&e.provider===this.id}createMarker(){return{provider:this.id}}resolve(e,n,r){return e[n]?.[r]??""}store(e,n,r,i){e[n]||(e[n]={}),e[n][r]=i}}class Ece{constructor(e,n){this.defaultProviderId=n,this.providersById=new Map(e.map(r=>[r.id,r]))}defaultProviderId;providersById;getDefaultProvider(){const e=this.providersById.get(this.defaultProviderId);if(!e)throw new Error(`Missing default secrets provider strategy: ${this.defaultProviderId}`);return e}resolveProviderForMarker(e){return this.isProviderMarker(e)?this.providersById.get(e.provider)??this.getDefaultProvider():null}isProviderMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class Rce{constructor(e){this.storage=e}storage;async getAll(){return this.storage.getAll()}async set(e,n){await this.storage.set(e,n)}async clear(e){await this.storage.clear(e)}}class Ace{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(o=>o.severity==="error").length,i=n.filter(o=>o.severity==="warning").length;this.notifications.set(e,{id:e,source:e,issues:n,errorCount:r,warningCount:i})}async clear(e){this.notifications.delete(e)}}const up={all:["notifications"],lists:()=>[...up.all,"list"]};function Dce(){return tg({queryKey:up.lists(),queryFn:async()=>dp.getInstance().getAll()})}function Mce(){return tg({queryKey:up.lists(),queryFn:async()=>dp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class dp{static instance=null;static initialize(){this.close();const e=new Ace;this.instance=new Rce(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let g2=null;function sR(){return g2||(g2=new HW({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),g2}function zce(t){const e=t.match(/\bline\s+(\d+)\b/i);if(!e)return;const n=Number.parseInt(e[1],10);return Number.isNaN(n)?void 0:n}function _ce(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:zce(e)}]}function qce(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function m2(t){try{const e=dp.getInstance();await t(e),sR().invalidateQueries({queryKey:up.all})}catch{}}async function O2(t,e){await m2(async n=>{await n.set(t,_ce(e))})}async function Nce(t,e){e.length!==0&&await m2(async n=>{await n.set(t,qce(e))})}async function Pu(t){await m2(async e=>{await e.clear(t)})}class Zce{constructor(e,n){this.storage=e,this.localStorageSecretsProvider=n}storage;localStorageSecretsProvider;default=[];doc=null;handler=new Tce(new Ece([new Ice],"local"));filePath="replay-environments.yaml";async read(){const e=await this.loadDocumentFromStorage();if(!e)return this.default;this.doc=e;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e,n);return await Pu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await O2(this.filePath,n),this.default}}async write(e){const n=this.doc??await this.loadDocumentFromStorage();if(!n&&Xce(e))return;const r=await this.readSecrets(),i=this.handler.hydrateDocument(n??new If({}),e,r);await this.localStorageSecretsProvider.set(JSON.stringify(r)),await this.storage.set(this.filePath,i.toString()),this.doc=i}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return await Pu(this.filePath),null;const n=jce(e);return n.contents?n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),await Nce(this.filePath,n.errors),null):n:(await Pu(this.filePath),null)}async readSecrets(){const e=await this.localStorageSecretsProvider.get();if(!e)return{};try{return JSON.parse(e)}catch(n){return console.error("Failed to parse replay secrets sidecar",n),{}}}}function Xce(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Ec&&e.inputs.length===0&&e.servers.length===0}class Vce{constructor(e,n,r){this.storage=e,this.filePath=n,this.defaultValue=r}storage;filePath;defaultValue;async parse(e){return JSON.parse(e)}stringify(e){return JSON.stringify(e)}async read(){const e=await this.storage.get(this.filePath);return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const v2=(t,e)=>({data:t,version:e});class aR extends Vce{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return v2(this.defaultValue,this.version);const n=this.migrationMap[e.version](e);return n.version===this.version?n:this.migrate(n)}async parse(e){const n=JSON.parse(e);if(n.version!==this.version){const r=this.migrate(n);return await this.write(r.data),r.data}return n.data}stringify(e){return JSON.stringify(v2(e,this.version))}}function Uce(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Ne.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}const y2=2,Wce="tabs.json";class Lce extends aR{migrationMap={1:Uce};constructor(e){super(e,Wce,so(Gv),y2)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=v2(so(Gv),y2)),n.version!==y2&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Ne.Step){if(i.data.draftStep){const o=i.data.draftStep.requestBody.formData;o["multipart/form-data"]=await lR(o["multipart/form-data"]),o["application/x-www-form-urlencoded"]=await lR(o["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Kh(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===Ne.Step){const{isProcessingRequest:i,...o}=r.data;return{...r,data:{...o,response:null}}}return r.data.type===Ne.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function lR(t){return Promise.all(t.map(async e=>{const n={...e};if(e.files){const r=e.files.map(i=>i.absolutePath).filter(i=>i!==null);n.files=await NI(r)}return n}))}const Yce=1;class cR{constructor(e,n,r,i,o,s){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.convertOperationToReplayValue=o,this.telemetry=s,this.localStorageSecretsProvider=new IB(this.project.id);const a=new TB;this.activeEnvironmentIdStorage=new aR(this.systemFilesStorage,"active_environment_id.json",Ec,Yce),this.tabsStateStorage=new Lce(this.systemFilesStorage),this.environmentsStorage=new Zce(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new yle(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new EB(this.isApiPersisted?this.userFilesStorage:a)}systemFilesStorage;userFilesStorage;project;isApiPersisted;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;addPersistExcludedId(e){this.persistExcludedIds.add(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}removePersistExcludedId(e){this.persistExcludedIds.delete(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}addWatchExcludedId(e){this.watchExcludedIds.add(e)}removeWatchExcludedId(e){this.watchExcludedIds.delete(e)}isWatchExcluded(e){return this.watchExcludedIds.has(e)}async update(e,n){switch(e.path[0]){case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(n.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(n.tabsState.get());break;case"environments":this.environmentsStorage.write(n.environments.get());break;case"apis":this.isApiPersisted&&await this.apisStorage.update(e,n.apis.get());break;case"collections":await this.collectionsStorage.update(e,n.collections.get());break}}}function pe(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!an()&&(r=K4(window.location.href)),{object:t,id:e,uri:r}}class Fce extends cR{constructor(e,n,r){const i=new yy(e.systemFilesDir),o=new yy(e.userFilesDir);super(i,o,e,!1,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[pe("storageOperation","detectFiles","storage")],e?.parentCtx),r=(await this.userFilesStorage.ls()).filter(a=>/\.(ya?ml|json)$/.test(a)),i=[],o=[],s=new Set;return await Promise.all(r.map(async a=>{const l=await this.userFilesStorage.get(a);if(l)try{const c=Ol.load(l);if(typeof c=="object"&&c!==null)if(typeof c.openapi=="string"){const d=await Lt.resolve(await Lt.join(this.userFilesStorage.baseDir,a)),{definition:h}=await bg(d,c);i.push({uri:a,type:Fr.FS,content:h}),await Pu(a)}else typeof c.arazzo=="string"&&(o.push({uri:a,type:Fr.FS,content:c}),await Pu(a),c.sourceDescriptions?.forEach(d=>{const h=d.type,p=d.url,f=!h||h==="openapi",m=typeof p=="string"&&ji(p);f&&m&&s.add(p)}))}catch(c){console.info(`Error parsing YAML/JSON file ${a}:`,c),await O2(a,c)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",r.length),n?.setAttribute("apiFilesCount",i.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",s.size),n?.setStatus(Qs.OK),n?.end(),{apiFiles:i,collectionFiles:o,apiUrls:s}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...pe("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await bg(o);i.push({uri:o,type:Fr.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),r?.setAttribute("status","completed"),r?.setStatus(Qs.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...pe("storageOperation","parseApis","storage"),apisCount:e.length}],n?.parentCtx),i=await this.apisStorage.parseMany(e);return r?.setAttribute("status","completed"),r?.setAttribute("parsedApisCount",i.length),r?.setStatus(Qs.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...pe("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),o=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(Qs.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[pe("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[pe("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(Qs.OK),n?.end();const{apiFiles:s,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),d=await this.parseApis([...s,...c],e);this.apisStorage.setItemIds(d.map(p=>p.id));const h=await this.parseCollections(a,d,e);return this.collectionsStorage.setItemIds(h.map(p=>p.id)),e?.setAttribute("status","completed"),e?.setStatus(Qs.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:d,collections:h}}}function Bce(t=!1){let e,n,r=!1,i=null,o=null,s=null;function a(){s&&(s(),s=null)}async function l(h){if(!(!an()||!e||!o)){await c();try{const{FileWatcher:p}=await import("./redocly-openapi-docs.min.FileWatcher-dIKl80Ec.js"),f=o.project.userFilesDir.get();i=new p(e,o,f,h),await i.start()}catch(p){console.error("Failed to start file watcher:",p),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function d(){an()&&(await c(),await Fn("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(h,p)=>({getTauriRootStorage:f=>()=>n,cleanup:()=>async()=>{a(),await d()},init:f=>async(m,g,O)=>{if(r||f.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:y,aiEnabled:b}=g,w=an();if(r=!0,o=f,a(),t)return r=!1,{isInitialized:!0};if(w){const{TauriRootStorage:S}=await import("./redocly-openapi-docs.min.TauriRootStorage-CHiKNUn2.js");n=new S(m,y,O),e=n}else n=void 0,e=new Fce(m,y,O);if(w){await c();const{getSemanticSearchService:S}=await import("./redocly-openapi-docs.min.index-dirYvuKs.js");S().setProject(m.id)}const P=await e.read();if(f.merge(P),!w)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:C,startPeriodicIndexRevalidation:$}]=await Promise.all([import("./redocly-openapi-docs.min.index-dirYvuKs.js"),import("./redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js")]),Q=S();Q.preloadModel().catch(()=>{}),Q.reindex(C(o)).catch(T=>{console.error("Semantic reindex failed:",T)}),s=$(Q,o)}}finally{r=!1}return{isInitialized:!0}}}),onSet(h,p,f){r||!t&&e&&e.update(p,f)},onDestroy:async()=>{a(),await d()}})}function Gce({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:so(Gv),activeEnvironmentId:Ec,environments:t||i4,collections:[],apis:[],apps:{apps:[],appsLoadingState:No.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const Hce=SW(Gce(),PW(bB({key:"replay-root-store"}),Bce())),uR=v.createContext(Hce);function Je(){const t=v.useContext(uR);return K0(t)}function Xl(){const t=Je(),{apis:e}=t;return{apis:e}}function hp(t){const{apis:e}=Xl();return{api:e.find(n=>n.id.get()===t)??null}}function SO(t,e,n){const{api:r}=hp(t);return{specDefault:r?.servers?.ornull?.find(i=>i.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function Kce({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=SO(e,n,t.get().name);return r===void 0?null:u.jsx(Jce,{fullWidth:!0,variant:"ghost",size:"small",icon:u.jsx(J9,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const Jce=x(he)`
|
|
524
|
+
`,e)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const e=xO(t),n=ku(e);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const e=xO(t),n=ku(e);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,e){return this.type!=="comment"||this.indent<=e?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Qce(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Cce||null,prettyErrors:e}}function jce(t,e={}){const{lineCounter:n,prettyErrors:r}=Qce(e),i=new $ce(n?.addNewLine),o=new xce(e);let s=null;for(const a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new sp(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(LE(t,n)),s.warnings.forEach(LE(t,n))),s}class Tce{constructor(e){this.providers=e}providers;extractEnvironments(e,n){const r=e.toJS();return Object.keys(r).filter(i=>i!=="version").map(i=>{const o=r[i],s=Object.entries(o.inputs??{}).map(([l,c])=>{const d=this.providers.resolveProviderForMarker(c);return d?{name:l,value:d.resolve(n,i,l),isSecret:!0}:{name:l,value:typeof c=="string"?c:"",isSecret:!1}}),a=Object.entries(o.servers??{}).map(([l,c])=>({apiId:l,value:c.value,variables:Object.entries(c.variables??{}).map(([d,h])=>({name:d,value:h}))}));return{name:i,inputs:s,servers:a,state:Tt.Normal}})}hydrateDocument(e,n,r){const i=new Set(n.map(o=>o.name).filter(Boolean));this.deleteRemovedKeys(e,[],i,"version");for(const o of n)if(o.name){if(!e.hasIn([o.name])){const s=e.createNode({});s instanceof qr&&(s.flow=!1),e.setIn([o.name],s)}this.syncInputs(e,o.name,o.inputs,r),this.syncServers(e,o.name,o.servers)}return e}syncInputs(e,n,r,i){const o=new Set(r.map(s=>s.name));this.deleteRemovedKeys(e,[n,"inputs"],o),r.length>0&&this.unflowMap(e,[n,"inputs"]);for(const s of r){const a=[n,"inputs",s.name];if(s.isSecret){const l=this.providers.getDefaultProvider();l.isMarker(e.getIn(a))||e.setIn(a,e.createNode(l.createMarker())),l.store(i,n,s.name,s.value);continue}e.getIn(a)!==s.value&&e.setIn(a,s.value)}}syncServers(e,n,r){const i=new Set(r.map(o=>o.apiId));this.deleteRemovedKeys(e,[n,"servers"],i),r.length>0&&this.unflowMap(e,[n,"servers"]);for(const o of r){const s=[n,"servers",o.apiId];e.getIn([...s,"value"])!==o.value&&e.setIn([...s,"value"],o.value);const a=new Set(o.variables.map(l=>l.name));this.deleteRemovedKeys(e,[...s,"variables"],a),o.variables.length>0&&this.unflowMap(e,[...s,"variables"]);for(const l of o.variables){const c=[...s,"variables",l.name];e.getIn(c)!==l.value&&e.setIn(c,l.value)}}}unflowMap(e,n){const r=e.getIn(n,!0);r instanceof qr&&r.flow&&(r.flow=!1)}deleteRemovedKeys(e,n,r,i){for(const o of this.getMapKeys(e,...n))o!==i&&!r.has(o)&&e.deleteIn([...n,o])}getMapKeys(e,...n){const r=n.length===0?e.contents:e.getIn(n,!0);return r instanceof qr?r.items.map(i=>String(i.key)):[]}}class Ice{id="local";isMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&e.provider===this.id}createMarker(){return{provider:this.id}}resolve(e,n,r){return e[n]?.[r]??""}store(e,n,r,i){e[n]||(e[n]={}),e[n][r]=i}}class Ece{constructor(e,n){this.defaultProviderId=n,this.providersById=new Map(e.map(r=>[r.id,r]))}defaultProviderId;providersById;getDefaultProvider(){const e=this.providersById.get(this.defaultProviderId);if(!e)throw new Error(`Missing default secrets provider strategy: ${this.defaultProviderId}`);return e}resolveProviderForMarker(e){return this.isProviderMarker(e)?this.providersById.get(e.provider)??this.getDefaultProvider():null}isProviderMarker(e){return typeof e=="object"&&e!==null&&"provider"in e&&typeof e.provider=="string"}}class Rce{constructor(e){this.storage=e}storage;async getAll(){return this.storage.getAll()}async set(e,n){await this.storage.set(e,n)}async clear(e){await this.storage.clear(e)}}class Ace{notifications=new Map;async getAll(){return Array.from(this.notifications.values())}async set(e,n){const r=n.filter(o=>o.severity==="error").length,i=n.filter(o=>o.severity==="warning").length;this.notifications.set(e,{id:e,source:e,issues:n,errorCount:r,warningCount:i})}async clear(e){this.notifications.delete(e)}}const up={all:["notifications"],lists:()=>[...up.all,"list"]};function Dce(){return tg({queryKey:up.lists(),queryFn:async()=>dp.getInstance().getAll()})}function Mce(){return tg({queryKey:up.lists(),queryFn:async()=>dp.getInstance().getAll(),select:t=>({total:t.reduce((e,n)=>e+n.issues.length,0),errorCount:t.reduce((e,n)=>e+n.errorCount,0)})})}class dp{static instance=null;static initialize(){this.close();const e=new Ace;this.instance=new Rce(e)}static getInstance(){if(!this.instance)throw new Error("NotificationsService not initialized");return this.instance}static close(){this.instance=null}}let g2=null;function sR(){return g2||(g2=new HW({defaultOptions:{queries:{staleTime:30*1e3,gcTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}})),g2}function zce(t){const e=t.match(/\bline\s+(\d+)\b/i);if(!e)return;const n=Number.parseInt(e[1],10);return Number.isNaN(n)?void 0:n}function _ce(t){const e=(t instanceof Error?t.message:String(t)).trim();return[{severity:"error",message:e,line:zce(e)}]}function qce(t){return t.map(e=>({severity:"error",message:e.message.trim(),line:e.linePos?.[0]?.line}))}async function m2(t){try{const e=dp.getInstance();await t(e),sR().invalidateQueries({queryKey:up.all})}catch{}}async function O2(t,e){await m2(async n=>{await n.set(t,_ce(e))})}async function Nce(t,e){e.length!==0&&await m2(async n=>{await n.set(t,qce(e))})}async function Pu(t){await m2(async e=>{await e.clear(t)})}class Zce{constructor(e,n){this.storage=e,this.localStorageSecretsProvider=n}storage;localStorageSecretsProvider;default=[];doc=null;handler=new Tce(new Ece([new Ice],"local"));filePath="replay-environments.yaml";async read(){const e=await this.loadDocumentFromStorage();if(!e)return this.default;this.doc=e;try{const n=await this.readSecrets(),r=this.handler.extractEnvironments(e,n);return await Pu(this.filePath),r}catch(n){return console.info("Error reading replay environments",n),await O2(this.filePath,n),this.default}}async write(e){const n=this.doc??await this.loadDocumentFromStorage();if(!n&&Xce(e))return;const r=await this.readSecrets(),i=this.handler.hydrateDocument(n??new If({}),e,r);await this.localStorageSecretsProvider.set(JSON.stringify(r)),await this.storage.set(this.filePath,i.toString()),this.doc=i}async loadDocumentFromStorage(){const e=await this.storage.get(this.filePath);if(!e)return await Pu(this.filePath),null;const n=jce(e);return n.contents?n.errors.length>0?(console.error("Environments file has YAML errors",n.errors),await Nce(this.filePath,n.errors),null):n:(await Pu(this.filePath),null)}async readSecrets(){const e=await this.localStorageSecretsProvider.get();if(!e)return{};try{return JSON.parse(e)}catch(n){return console.error("Failed to parse replay secrets sidecar",n),{}}}}function Xce(t){if(t.length===0)return!0;if(t.length>1)return!1;const[e]=t;return e.name===Ec&&e.inputs.length===0&&e.servers.length===0}class Vce{constructor(e,n,r){this.storage=e,this.filePath=n,this.defaultValue=r}storage;filePath;defaultValue;async parse(e){return JSON.parse(e)}stringify(e){return JSON.stringify(e)}async read(){const e=await this.storage.get(this.filePath);return e?await this.parse(e):this.defaultValue}async write(e){return this.storage.set(this.filePath,this.stringify(e))}}const v2=(t,e)=>({data:t,version:e});class aR extends Vce{constructor(e,n,r,i){super(e,n,r),this.version=i}version;migrationMap={};migrate(e){if(!this.migrationMap[e.version])return v2(this.defaultValue,this.version);const n=this.migrationMap[e.version](e);return n.version===this.version?n:this.migrate(n)}async parse(e){const n=JSON.parse(e);if(n.version!==this.version){const r=this.migrate(n);return await this.write(r.data),r.data}return n.data}stringify(e){return JSON.stringify(v2(e,this.version))}}function Uce(t){return{data:{...t.data,tabs:t.data.tabs.map(e=>e.data.type===Ne.Step?{...e,data:{...e.data,draftStep:{...e.data.step,security:e.data.step.security.securities},step:void 0,hasUnsavedChanges:void 0,showUnsavedChangesModal:void 0}}:e)},version:2}}const y2=2,Wce="tabs.json";class Lce extends aR{migrationMap={1:Uce};constructor(e){super(e,Wce,so(Gv),y2)}async parse(e){let n=null;try{n=JSON.parse(e)}catch(i){console.error("Failed to parse tabs state",i)}n||(n=v2(so(Gv),y2)),n.version!==y2&&(n=this.migrate(n));const r=await Promise.all(n.data.tabs.map(async i=>{if(i.data.type===Ne.Step){if(i.data.draftStep){const o=i.data.draftStep.requestBody.formData;o["multipart/form-data"]=await lR(o["multipart/form-data"]),o["application/x-www-form-urlencoded"]=await lR(o["application/x-www-form-urlencoded"]),i.data.draftStep.requestBody.binary&&i.data.draftStep.requestBody.binary.absolutePath&&(i.data.draftStep.requestBody.binary=await Kh(i.data.draftStep.requestBody.binary.absolutePath))}return{...i,data:{...i.data,isProcessingRequest:!1}}}return i}));return{...n.data,tabs:r}}stringify(e){const n={...e,tabs:e.tabs.map(r=>{if(r.data.type===Ne.Step){const{isProcessingRequest:i,...o}=r.data;return{...r,data:{...o,response:null}}}return r.data.type===Ne.WorkflowRun?{...r,data:{...r.data,result:null,runStatus:null,runError:null}}:r})};return super.stringify(n)}}async function lR(t){return Promise.all(t.map(async e=>{const n={...e};if(e.files){const r=e.files.map(i=>i.absolutePath).filter(i=>i!==null);n.files=await NI(r)}return n}))}const Yce=1;class cR{constructor(e,n,r,i,o,s){this.systemFilesStorage=e,this.userFilesStorage=n,this.project=r,this.isApiPersisted=i,this.convertOperationToReplayValue=o,this.telemetry=s,this.localStorageSecretsProvider=new IB(this.project.id);const a=new TB;this.activeEnvironmentIdStorage=new aR(this.systemFilesStorage,"active_environment_id.json",Ec,Yce),this.tabsStateStorage=new Lce(this.systemFilesStorage),this.environmentsStorage=new Zce(this.userFilesStorage,this.localStorageSecretsProvider),this.collectionsStorage=new yle(this.userFilesStorage,this.convertOperationToReplayValue),this.apisStorage=new EB(this.isApiPersisted?this.userFilesStorage:a)}systemFilesStorage;userFilesStorage;project;isApiPersisted;convertOperationToReplayValue;telemetry;activeEnvironmentIdStorage;tabsStateStorage;environmentsStorage;collectionsStorage;apisStorage;localStorageSecretsProvider;persistExcludedIds=new Set;watchExcludedIds=new Set;addPersistExcludedId(e){this.persistExcludedIds.add(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}removePersistExcludedId(e){this.persistExcludedIds.delete(e),this.userFilesStorage.setWriteExcludedKeys(new Set([...this.persistExcludedIds]))}addWatchExcludedId(e){this.watchExcludedIds.add(e)}removeWatchExcludedId(e){this.watchExcludedIds.delete(e)}isWatchExcluded(e){return this.watchExcludedIds.has(e)}async update(e,n){switch(e.path[0]){case"activeEnvironmentId":this.activeEnvironmentIdStorage.write(n.activeEnvironmentId.get());break;case"tabsState":this.tabsStateStorage.write(n.tabsState.get());break;case"environments":this.environmentsStorage.write(n.environments.get());break;case"apis":this.isApiPersisted&&await this.apisStorage.update(e,n.apis.get());break;case"collections":await this.collectionsStorage.update(e,n.collections.get());break}}}function pe(t,e,n="ui"){let r=`urn:redocly:replay:${n}:${t}:${encodeURIComponent(e)}`;return typeof window<"u"&&!an()&&(r=K4(window.location.href)),{object:t,id:e,uri:r}}class Fce extends cR{constructor(e,n,r){const i=new yy(e.systemFilesDir),o=new yy(e.userFilesDir);super(i,o,e,!1,n,r)}async detectProjectFiles(e){const n=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[pe("storageOperation","detectFiles","storage")],e?.parentCtx),r=(await this.userFilesStorage.ls()).filter(a=>/\.(ya?ml|json)$/.test(a)),i=[],o=[],s=new Set;return await Promise.all(r.map(async a=>{const l=await this.userFilesStorage.get(a);if(l)try{const c=Ol.load(l);if(typeof c=="object"&&c!==null)if(typeof c.openapi=="string"){const d=await Lt.resolve(await Lt.join(this.userFilesStorage.baseDir,a)),{definition:h}=await bg(d,c);i.push({uri:a,type:Fr.FS,content:h}),await Pu(a)}else typeof c.arazzo=="string"&&(o.push({uri:a,type:Fr.FS,content:c}),await Pu(a),c.sourceDescriptions?.forEach(d=>{const h=d.type,p=d.url,f=!h||h==="openapi",m=typeof p=="string"&&ji(p);f&&m&&s.add(p)}))}catch(c){console.info(`Error parsing YAML/JSON file ${a}:`,c),await O2(a,c)}})),n?.setAttribute("status","completed"),n?.setAttribute("filesCount",r.length),n?.setAttribute("apiFilesCount",i.length),n?.setAttribute("collectionFilesCount",o.length),n?.setAttribute("apiUrlsCount",s.size),n?.setStatus(Qs.OK),n?.end(),{apiFiles:i,collectionFiles:o,apiUrls:s}}async loadApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.loadApis",[{...pe("storageOperation","loadApis","storage"),apiUrlsCount:e.size}],n?.parentCtx),i=[];return await Promise.all(Array.from(e).map(async o=>{try{const{definition:s}=await bg(o);i.push({uri:o,type:Fr.WEB,content:s})}catch(s){console.error(`Error parsing YAML from ${o}:`,s)}})),r?.setAttribute("status","completed"),r?.setStatus(Qs.OK),r?.end(),i}async parseApis(e,n){const r=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...pe("storageOperation","parseApis","storage"),apisCount:e.length}],n?.parentCtx),i=await this.apisStorage.parseMany(e);return r?.setAttribute("status","completed"),r?.setAttribute("parsedApisCount",i.length),r?.setStatus(Qs.OK),r?.end(),i}async parseCollections(e,n,r){const i=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...pe("storageOperation","parseCollections","storage"),collectionsCount:e.length}],r?.parentCtx),o=await this.collectionsStorage.parseMany(e,n);return i?.setAttribute("status","completed"),i?.setAttribute("parsedCollectionsCount",o.length),i?.setStatus(Qs.OK),i?.end(),o}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[pe("storageOperation","read","storage")],void 0),n=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[pe("storageOperation","loadUserState","storage")],e?.parentCtx),[r,i,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]);n?.setAttribute("status","completed"),n?.setAttribute("environmentCount",o.length),n?.setStatus(Qs.OK),n?.end();const{apiFiles:s,collectionFiles:a,apiUrls:l}=await this.detectProjectFiles(e),c=await this.loadApis(l,e),d=await this.parseApis([...s,...c],e);this.apisStorage.setItemIds(d.map(p=>p.id));const h=await this.parseCollections(a,d,e);return this.collectionsStorage.setItemIds(h.map(p=>p.id)),e?.setAttribute("status","completed"),e?.setStatus(Qs.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:i,environments:o,apis:d,collections:h}}}function Bce(t=!1){let e,n,r=!1,i=null,o=null,s=null;function a(){s&&(s(),s=null)}async function l(h){if(!(!an()||!e||!o)){await c();try{const{FileWatcher:p}=await import("./redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js"),f=o.project.userFilesDir.get();i=new p(e,o,f,h),await i.start()}catch(p){console.error("Failed to start file watcher:",p),i=null}}}async function c(){i&&(await i.stop(),i=null)}async function d(){an()&&(await c(),await Fn("cleanup_all_managed_watchers"))}return()=>({id:"RootStoragePlugin",onCreate:(h,p)=>({getTauriRootStorage:f=>()=>n,cleanup:()=>async()=>{a(),await d()},init:f=>async(m,g,O)=>{if(r||f.path.length>0)return{isInitialized:!1};const{convertOperationToReplayValue:y,aiEnabled:b}=g,w=an();if(r=!0,o=f,a(),t)return r=!1,{isInitialized:!0};if(w){const{TauriRootStorage:S}=await import("./redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js");n=new S(m,y,O),e=n}else n=void 0,e=new Fce(m,y,O);if(w){await c();const{getSemanticSearchService:S}=await import("./redocly-openapi-docs.min.index-C6uU_v-b.js");S().setProject(m.id)}const P=await e.read();if(f.merge(P),!w)return r=!1,{isInitialized:!0};try{if(await l(b??!1),b){const[{getSemanticSearchService:S},{createIndexSnapshotGetter:C,startPeriodicIndexRevalidation:$}]=await Promise.all([import("./redocly-openapi-docs.min.index-C6uU_v-b.js"),import("./redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js")]),Q=S();Q.preloadModel().catch(()=>{}),Q.reindex(C(o)).catch(T=>{console.error("Semantic reindex failed:",T)}),s=$(Q,o)}}finally{r=!1}return{isInitialized:!0}}}),onSet(h,p,f){r||!t&&e&&e.update(p,f)},onDestroy:async()=>{a(),await d()}})}function Gce({defaultEnvironments:t}={}){return structuredClone({project:{id:"default",userFilesDir:"default",systemFilesDir:"default"},tabsState:so(Gv),activeEnvironmentId:Ec,environments:t||i4,collections:[],apis:[],apps:{apps:[],appsLoadingState:No.Idle},predefinedApiId:null,predefinedEnvironmentNames:new Set,predefinedInputNames:new Set})}const Hce=SW(Gce(),PW(bB({key:"replay-root-store"}),Bce())),uR=v.createContext(Hce);function Je(){const t=v.useContext(uR);return K0(t)}function Xl(){const t=Je(),{apis:e}=t;return{apis:e}}function hp(t){const{apis:e}=Xl();return{api:e.find(n=>n.id.get()===t)??null}}function SO(t,e,n){const{api:r}=hp(t);return{specDefault:r?.servers?.ornull?.find(i=>i.url.get()===e)?.variables?.ornull?.[n]?.ornull?.default?.get()}}function Kce({variable:t,apiId:e,serverUrl:n}){const{specDefault:r}=SO(e,n,t.get().name);return r===void 0?null:u.jsx(Jce,{fullWidth:!0,variant:"ghost",size:"small",icon:u.jsx(J9,{size:"14px"}),onClick:()=>t.merge({value:r}),children:"Reset to default"})}const Jce=x(he)`
|
|
525
525
|
justify-content: flex-start;
|
|
526
526
|
`;function eue({defaultValue:t,onReset:e,name:n}){const r=()=>{e(t)};return u.jsxs(tue,{children:[u.jsxs(nue,{children:["Default: ",t]}),u.jsx(he,{variant:"ghost",size:"small",icon:u.jsx(J9,{size:"14px"}),onClick:r,"data-testid":n?`reset-server-variable-editor-${n}`:"reset-server-variable-editor",children:"Reset"})]})}const tue=x.div`
|
|
527
527
|
display: flex;
|
|
@@ -733,7 +733,7 @@ ${L}`,ue=Math.min(I.length,T);let ke=0;for(;ke<ue-1;ke++){const Oe=E(String(ke),
|
|
|
733
733
|
${U}`,Z.pop(),`[${G}]`}let W=Object.keys(I);const F=W.length;if(F===0)return"{}";if(Q<Z.length+1)return'"[Object]"';L+=N;const Y=`,
|
|
734
734
|
${L}`;let te="",B="",oe=Math.min(F,T);l(I)&&(te+=c(I,Y,T),W=W.slice(I.length),oe-=I.length,B=Y),C&&(W=s(W,$)),Z.push(I);for(let G=0;G<oe;G++){const ye=W[G],ue=E(ye,I[ye],Z,N,L);ue!==void 0&&(te+=`${B}${o(ye)}: ${ue}`,B=Y)}if(F>T){const G=F-T;te+=`${B}"...": "${m(G)} not stringified"`,B=Y}return B!==""&&(te=`
|
|
735
735
|
${L}${te}
|
|
736
|
-
${U}`),Z.pop(),`{${te}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function _(q,I,Z){switch(typeof I){case"string":return o(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(q),typeof I!="object")return _(q,I,Z);if(I===null)return"null"}if(Z.indexOf(I)!==-1)return P;let N="";const L=I.length!==void 0;if(L&&Array.isArray(I)){if(I.length===0)return"[]";if(Q<Z.length+1)return'"[Array]"';Z.push(I);const te=Math.min(I.length,T);let B=0;for(;B<te-1;B++){const G=_(String(B),I[B],Z);N+=G!==void 0?G:"null",N+=","}const oe=_(String(B),I[B],Z);if(N+=oe!==void 0?oe:"null",I.length-1>T){const G=I.length-T-1;N+=`,"... ${m(G)} not stringified"`}return Z.pop(),`[${N}]`}let U=Object.keys(I);const W=U.length;if(W===0)return"{}";if(Q<Z.length+1)return'"[Object]"';let F="",Y=Math.min(W,T);L&&l(I)&&(N+=c(I,",",T),U=U.slice(I.length),Y-=I.length,F=","),C&&(U=s(U,$)),Z.push(I);for(let te=0;te<Y;te++){const B=U[te],oe=_(B,I[B],Z);oe!==void 0&&(N+=`${F}${o(B)}:${oe}`,F=",")}if(W>T){const te=W-T;N+=`${F}"...":"${m(te)} not stringified"`}return Z.pop(),`{${N}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function A(q,I,Z){if(arguments.length>1){let N="";if(typeof Z=="number"?N=" ".repeat(Math.min(Z,10)):typeof Z=="string"&&(N=Z.slice(0,10)),I!=null){if(typeof I=="function")return z("",{"":q},[],I,N,"");if(Array.isArray(I))return M("",q,[],g(I),N,"")}if(N.length!==0)return E("",q,[],N,"")}return _("",q,[])}return A}})(W2,W2.exports)),W2.exports}var Ofe=mfe();const vfe=Qd(Ofe),yfe=vfe.configure;class Af extends eU{static maxErrorTextChars=4096;static stringify=yfe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,o)=>o!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const n=this;return function(...r){try{const i=Af.combineConsoleErrorArgs(r);n.sendError(i,"console.error")}catch{}e?.apply(this,r)}}}sendError(e,n){this.sendErrorEvent(Af.toErrorEvent(e,n))}}class bfe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new gfe,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n,r){try{if(!this.config?.otel.isProd)return;const i=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(i)}catch(i){this.config?.otel.isProd||console.error("Event reporting failed:",i)}}init(e){e.disabled||this.initialized||(this.config=e,this.initialized=!0,this.otelClient.init({serviceVersion:e.otel.serviceVersion,version:e.otel.version,isProd:e.otel.isProd,collectorUrl:e.otel.collectorUrl,collectorTraceUrl:e.otel.collectorTraceUrl,serviceName:e.otel.serviceName,tracerName:e.otel.tracerName,spanProcessors:e.otel.spanProcessors,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new Af(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return tfe({type:e,data:n,...i,...this.otelClient.sessionId&&{sessionId:this.otelClient.sessionId}})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send({...e,signal:"log"})}forceFlush(){return this.config?.disabled?Promise.resolve():this.otelClient.forceFlush()}shutdown(){return this.config?.disabled?Promise.resolve():this.otelClient.shutdown()}sendError(e,n){if(this.config?.disabled)return;const r=Af.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const Iu=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],xfe="https://cors.redocly.com/";function wfe(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:void 0,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const Sfe=wfe(),kfe=v.createContext(Sfe);function Nr(){const t=v.useContext(kfe);return K0(t)}function Pfe(t,e){const{apps:{apiId:n}}=Je(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:o,oAuth2RedirectURI:s,certificates:a,storageKey:l,isApiBased:c,aiEnabled:d,isPreviewLayout:h}=Nr();r.set(t?.corsProxyUrl??xfe),i.set(t?.credentialOrigin),n.set(t?.apiId),s.set(t?.oAuth2RedirectURI),o.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),d.set(!!t?.aiEnabled),h.set(t?.layout==="preview"),v.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const DA=v.createContext({});function ir(){return v.useContext(DA)||{}}const Cfe=!0,$fe="0.27.0",Qfe={version:$fe},jfe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class MA{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new bfe}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}setCloudEventData(e){this._client.updateCloudEventData(()=>({...jfe,...e,env:"production"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||"desktop",o=r.enableErrorInstrumentation??i==="desktop",s={serviceName:"replay",serviceVersion:Qfe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:Cfe,enableErrorInstrumentation:o};this._client.init({otel:{...s,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(o=>({...this._globalAttributes,...o}));return this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const wp=new MA;function Ue(){const{telemetry:t}=ir();wp.isInitialized||wp.init(t);const e=t?.cloudEventData;v.useEffect(()=>{e&&wp.setCloudEventData(e)},[e]);const n=v.useCallback((i,o)=>{wp.sendEvent(i,o)},[]),r=v.useCallback((i,o,s)=>wp.startSpan(i,o,s),[]);return{sendEvent:n,startSpan:r}}const Tfe=t=>u.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M7 10.707L4.5 8.2065L5.2065 7.5L7 9.293L10.7925 5.5L11.5 6.2075L7 10.707Z"}),u.jsx("path",{d:"M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z"})]}),zA=x(Tfe).attrs({"data-component-name":"icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon"})`
|
|
736
|
+
${U}`),Z.pop(),`{${te}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function _(q,I,Z){switch(typeof I){case"string":return o(I);case"object":{if(I===null)return"null";if(typeof I.toJSON=="function"){if(I=I.toJSON(q),typeof I!="object")return _(q,I,Z);if(I===null)return"null"}if(Z.indexOf(I)!==-1)return P;let N="";const L=I.length!==void 0;if(L&&Array.isArray(I)){if(I.length===0)return"[]";if(Q<Z.length+1)return'"[Array]"';Z.push(I);const te=Math.min(I.length,T);let B=0;for(;B<te-1;B++){const G=_(String(B),I[B],Z);N+=G!==void 0?G:"null",N+=","}const oe=_(String(B),I[B],Z);if(N+=oe!==void 0?oe:"null",I.length-1>T){const G=I.length-T-1;N+=`,"... ${m(G)} not stringified"`}return Z.pop(),`[${N}]`}let U=Object.keys(I);const W=U.length;if(W===0)return"{}";if(Q<Z.length+1)return'"[Object]"';let F="",Y=Math.min(W,T);L&&l(I)&&(N+=c(I,",",T),U=U.slice(I.length),Y-=I.length,F=","),C&&(U=s(U,$)),Z.push(I);for(let te=0;te<Y;te++){const B=U[te],oe=_(B,I[B],Z);oe!==void 0&&(N+=`${F}${o(B)}:${oe}`,F=",")}if(W>T){const te=W-T;N+=`${F}"...":"${m(te)} not stringified"`}return Z.pop(),`{${N}}`}case"number":return isFinite(I)?String(I):w?w(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(I);default:return w?w(I):void 0}}function A(q,I,Z){if(arguments.length>1){let N="";if(typeof Z=="number"?N=" ".repeat(Math.min(Z,10)):typeof Z=="string"&&(N=Z.slice(0,10)),I!=null){if(typeof I=="function")return z("",{"":q},[],I,N,"");if(Array.isArray(I))return M("",q,[],g(I),N,"")}if(N.length!==0)return E("",q,[],N,"")}return _("",q,[])}return A}})(W2,W2.exports)),W2.exports}var Ofe=mfe();const vfe=Qd(Ofe),yfe=vfe.configure;class Af extends eU{static maxErrorTextChars=4096;static stringify=yfe({maximumDepth:2,maximumBreadth:10});sendErrorEvent;constructor(e,n){super("errors","1.0",e||{}),this.sendErrorEvent=n}static toErrorEvent(e,n){return{type:"error",payload:[{handler:n,errorType:this.getErrorType(e),message:this.getErrorMessage(e),stack:this.getErrorStack(e)}]}}enable(){window.addEventListener("error",this.onError),window.addEventListener("unhandledrejection",this.onUnhandledRejection),this._wrap(console,"error",this.patchConsoleError())}disable(){window.removeEventListener("error",this.onError),window.removeEventListener("unhandledrejection",this.onUnhandledRejection),this._unwrap(console,"error")}init(){}static getErrorMessage(e){return e?(typeof e=="object"&&"message"in e?String(e.message):String(e)).trim():void 0}static getErrorStack(e){if(!e||typeof e!="object"||!("stack"in e)||!e.stack)return;const n=String(e.stack);return n.length>this.maxErrorTextChars?n.substring(0,this.maxErrorTextChars):n}static getErrorType(e){return!e||typeof e!="object"?typeof e:"name"in e?String(e.name):"constructor"in e&&"name"in e.constructor?String(e.constructor.name):"Error"}static combineConsoleErrorArgs(e){const n=e.findIndex(i=>i instanceof Error),r=e.filter((i,o)=>o!==n).map(i=>typeof i=="string"?i:i instanceof Error?String(i):this.stringify(i)??String(i)).join(" ").substring(0,this.maxErrorTextChars);if(n===-1)return r;{const i=e[n];return r&&(i.message=`${i.message} ${r}`),i}}onError=e=>{this.sendError(e.error,"window.onerror")};onUnhandledRejection=e=>{this.sendError(e.reason,"window.onunhandledrejection")};patchConsoleError(){return e=>{const n=this;return function(...r){try{const i=Af.combineConsoleErrorArgs(r);n.sendError(i,"console.error")}catch{}e?.apply(this,r)}}}sendError(e,n){this.sendErrorEvent(Af.toErrorEvent(e,n))}}class bfe{config=null;initialized=!1;useCloudEventData;otelClient;tracer;constructor(){this.useCloudEventData=()=>({origin:"replayUi",signal:"log"}),this.otelClient=new gfe,this.tracer={traceStep:(e,n)=>{const r=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.traceStep(r)}}}updateCloudEventData=e=>{this.config?.disabled||(this.useCloudEventData=e)};send(e,n,r){try{if(!this.config?.otel.isProd)return;const i=e&&typeof e=="object"&&"type"in e&&"data"in e?e:this.constructCloudEvent(e,n,{...r,signal:"log"});this.sendToOtelService(i)}catch(i){this.config?.otel.isProd||console.error("Event reporting failed:",i)}}init(e){e.disabled||this.initialized||(this.config=e,this.initialized=!0,this.otelClient.init({serviceVersion:e.otel.serviceVersion,version:e.otel.version,isProd:e.otel.isProd,collectorUrl:e.otel.collectorUrl,collectorTraceUrl:e.otel.collectorTraceUrl,serviceName:e.otel.serviceName,tracerName:e.otel.tracerName,spanProcessors:e.otel.spanProcessors,instrumentations:[...e.otel.enableErrorInstrumentation===!0?[new Af(void 0,n=>{this.sendToOtelService({type:n.type,data:n.payload})})]:[],...e.otel.instrumentations||[]]}))}startSpan(e,n,r){if(this.config?.disabled)return;const i=this.constructCloudEvent(e,n,{signal:"trace"});return this.otelClient.startSpan(i,r)}constructCloudEvent(e,n,r){const i={...this.useCloudEventData(),...r};return tfe({type:e,data:n,...i,...this.otelClient.sessionId&&{sessionId:this.otelClient.sessionId}})}sendToOtelService(e){this.config?.otel.isProd||console.log("CloudEvent to be sent to OTEL service:",e),this.otelClient.send({...e,signal:"log"})}forceFlush(){return this.config?.disabled?Promise.resolve():this.otelClient.forceFlush()}shutdown(){return this.config?.disabled?Promise.resolve():this.otelClient.shutdown()}sendError(e,n){if(this.config?.disabled)return;const r=Af.toErrorEvent(e,n);this.sendToOtelService({type:r.type,data:r.payload})}sendTabChangeMessage(e,n){this.send("com.redocly.tab.change",e,n)}sendButtonClickMessage(e,n){this.send("com.redocly.button.click",e,n)}sendTabOpenFailedMessage(e,n){this.send("com.redocly.tab.openFailed",e,n)}sendChangeMessage(e,n){this.send("com.redocly.change.occurred",e,n)}sendContentCopyMessage(e,n){this.send("com.redocly.content.copy",e,n)}sendRequestSendMessage(e,n){this.send("com.redocly.request.send",e,n)}sendResponseReceivedMessage(e,n){this.send("com.redocly.response.received",e,n)}sendTokenGenerateMessage(e,n){this.send("com.redocly.token.generate",e,n)}sendAppLifecycleMessage(e,n){this.send("com.redocly.app.lifecycle",e,n)}sendEnvironmentManagementMessage(e,n){this.send("com.redocly.environment.management",e,n)}sendServerManagementMessage(e,n){this.send("com.redocly.server.management",e,n)}sendSourceManagementMessage(e,n){this.send("com.redocly.source.management",e,n)}sendInputManagementMessage(e,n){this.send("com.redocly.input.management",e,n)}sendNodeManagementMessage(e,n){this.send("com.redocly.node.management",e,n)}sendHistoryManagementMessage(e,n){this.send("com.redocly.history.management",e,n)}sendHistoryMigrationMessage(e,n){this.send("com.redocly.history.migration",e,n)}sendCredentialManagementMessage(e,n){this.send("com.redocly.credential.management",e,n)}sendPanelToggleMessage(e,n){this.send("com.redocly.panel.toggle",e,n)}sendWorkflowRunClickMessage(e,n){this.send("com.redocly.workflowRun.click",e,n)}sendWorkflowRunResultMessage(e,n){this.send("com.redocly.workflowRun.result",e,n)}sendStorageReadMessage(e,n){this.send("com.redocly.storage.read",e,n)}sendStorageLoadUserStateMessage(e,n){this.send("com.redocly.storage.loadUserState",e,n)}sendStorageDetectFilesMessage(e,n){this.send("com.redocly.storage.detectFiles",e,n)}sendStorageLoadApisMessage(e,n){this.send("com.redocly.storage.loadApis",e,n)}sendStorageParseApisMessage(e,n){this.send("com.redocly.storage.parseApis",e,n)}sendStorageParseCollectionsMessage(e,n){this.send("com.redocly.storage.parseCollections",e,n)}sendUpdaterCheckMessage(e,n){this.send("com.redocly.updater.check",e,n)}sendUpdaterDownloadMessage(e,n){this.send("com.redocly.updater.download",e,n)}sendUpdaterInstallMessage(e,n){this.send("com.redocly.updater.install",e,n)}sendUpdaterProcessMessage(e,n){this.send("com.redocly.updater.process",e,n)}sendErrorMessage(e,n){this.send("com.redocly.error.occurred",e,n)}sendBackendEventMessage(e,n){this.send("com.redocly.backend.event",e,n)}sendCodeEditorSearchMessage(e,n){this.send("com.redocly.codeEditor.search",e,n)}sendAiChatToolCallStartedMessage(e,n){this.send("com.redocly.aiChat.toolCallStarted",e,n)}sendAiChatToolCallFinishedMessage(e,n){this.send("com.redocly.aiChat.toolCallFinished",e,n)}sendAiChatConversationStartedMessage(e,n){this.send("com.redocly.aiChat.conversationStarted",e,n)}sendAiChatConversationFinishedMessage(e,n){this.send("com.redocly.aiChat.conversationFinished",e,n)}sendDeepLinkOpenedMessage(e,n){this.send("com.redocly.deepLink.opened",e,n)}}const Iu=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],xfe="https://cors.redocly.com/";function wfe(){return{theme:"light",disableCollectionsTab:!1,oAuth2RedirectURI:void 0,corsProxyUrl:void 0,credentialOrigin:void 0,certificates:[],isApiBased:!1,generatedEnvironments:[],generatedInputs:[],hideOtherSecuritySchemes:!1,aiEnabled:!1,isPreviewLayout:!1}}const Sfe=wfe(),kfe=v.createContext(Sfe);function Nr(){const t=v.useContext(kfe);return K0(t)}function Pfe(t,e){const{apps:{apiId:n}}=Je(),{corsProxyUrl:r,credentialOrigin:i,disableCollectionsTab:o,oAuth2RedirectURI:s,certificates:a,storageKey:l,isApiBased:c,aiEnabled:d,isPreviewLayout:h}=Nr();r.set(t?.corsProxyUrl??xfe),i.set(t?.credentialOrigin),n.set(t?.apiId),s.set(t?.oAuth2RedirectURI),o.set(!!t?.disableCollectionsTab),l.set(t?.storageKey),c.set(!!e),d.set(!!t?.aiEnabled),h.set(t?.layout==="preview"),v.useEffect(()=>{a.set(t?.certificates||[])},[t?.certificates])}const DA=v.createContext({});function ir(){return v.useContext(DA)||{}}const Cfe=!0,$fe="0.27.1",Qfe={version:$fe},jfe={organizationId:"",organizationSlug:"",projectId:"",projectSlug:"",actor:{id:"",object:"user",uri:""},source:"urn:redocly:replay:app",origin:"replayUi"};class MA{_client;_isInitialized=!1;_initResolve=null;_initPromise=new Promise(e=>{this._initResolve=e});_globalAttributes={platform:"",deviceId:""};constructor(){this._client=new bfe}get isInitialized(){return this._isInitialized}get client(){return this._client}awaitInit(){return this._initPromise}updateCloudEventData(e){this._client.updateCloudEventData(e)}setCloudEventData(e){this._client.updateCloudEventData(()=>({...jfe,...e,env:"production"}))}enrichGlobalAttributes(e){this._globalAttributes={...this._globalAttributes,...e}}getGlobalAttributes(){return{...this._globalAttributes}}clearGlobalAttributes(){this._globalAttributes={platform:"",deviceId:""}}init(e){if(this.isInitialized)return;const{cloudEventData:n,...r}=e??{},i=r.tracerName||"desktop",o=r.enableErrorInstrumentation??i==="desktop",s={serviceName:"replay",serviceVersion:Qfe.version,version:"1.0.0",tracerName:i,collectorUrl:"",isProd:Cfe,enableErrorInstrumentation:o};this._client.init({otel:{...s,...r}}),this.setCloudEventData(n),this._initResolve?.(this),this._isInitialized=!0}sendEvent(e,n){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}const r=n.map(i=>({...this._globalAttributes,...i}));try{this.client.send(e,r)}catch(i){console.error("Failed to send telemetry event:",i)}}startSpan(e,n,r){if(!this.isInitialized){console.warn("Telemetry client not initialized. Call init() first.");return}try{const i=(n??[{}]).map(o=>({...this._globalAttributes,...o}));return this._client.startSpan(e,i,r)}catch(i){console.error("Failed to start telemetry span:",i);return}}}const wp=new MA;function Ue(){const{telemetry:t}=ir();wp.isInitialized||wp.init(t);const e=t?.cloudEventData;v.useEffect(()=>{e&&wp.setCloudEventData(e)},[e]);const n=v.useCallback((i,o)=>{wp.sendEvent(i,o)},[]),r=v.useCallback((i,o,s)=>wp.startSpan(i,o,s),[]);return{sendEvent:n,startSpan:r}}const Tfe=t=>u.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M7 10.707L4.5 8.2065L5.2065 7.5L7 9.293L10.7925 5.5L11.5 6.2075L7 10.707Z"}),u.jsx("path",{d:"M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z"})]}),zA=x(Tfe).attrs({"data-component-name":"icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon"})`
|
|
737
737
|
path {
|
|
738
738
|
fill: ${({color:t})=>it(t)};
|
|
739
739
|
}
|
|
@@ -1074,7 +1074,7 @@ ${U}`),Z.pop(),`{${te}}`}case"number":return isFinite(I)?String(I):w?w(I):"null"
|
|
|
1074
1074
|
border-radius: var(--border-radius);
|
|
1075
1075
|
border: 1px solid var(--border-color-primary);
|
|
1076
1076
|
padding: 0 calc(var(--spacing-xxs) / 2);
|
|
1077
|
-
`,rn=(t,e,n=new Set)=>{const r=e5(t);if(!r.length)return t;let i=0;const o=r.flatMap(({start:s,end:a,name:l})=>{if(n.has(l))return null;const c=e.findLast(h=>h.name===l),d=t.slice(i,c?s:a);if(i=a,c){n.add(l);const h=rn(c.value,e,n);return n.delete(l),[d.length?d:null,h||t.slice(s,a)]}return[d.length?d:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function rge(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function ige(t,e){const n=BA(t);if(!n.length)return u.jsx(GA,{children:t});let r=0;const i=n.flatMap(({start:o,end:s})=>{const a=t.slice(r,o),l=rge(t.slice(o,s),e);return r=s,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),u.jsx(GA,{children:i.join("")})}class oge{constructor(e){this.storage=e}storage;async initialize(){await this.storage.initialize()}upsert(e){return this.storage.upsert(e)}getByWorkflow(e,n){return this.storage.getByWorkflow(e,n)}getByKey(e,n,r){return this.storage.getByKey(e,n,r)}pruneOlderThan(e){return this.storage.pruneOlderThan(e)}clear(){return this.storage.clear()}}class kp{static instance=null;static currentDbPath=null;static async initialize(e){if(this.instance&&this.currentDbPath===e)return this.instance;this.instance&&this.currentDbPath!==e&&await this.close();const{SqliteDBStorage:n}=await import("./redocly-openapi-docs.min.SqliteDBStorage-D9-Rb-N7.js");return this.instance=n.getInstance(e),this.currentDbPath=e,await this.instance.initialize(),this.instance}static getInstance(){if(!this.instance)throw new Error("SqliteDBConnection not initialized");return this.instance}static isInitialized(){return this.instance!==null}static async close(){this.instance&&(await this.instance.close(),this.instance=null,this.currentDbPath=null)}}const BO={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Vl(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function sge(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function age(t){if(!t)return null;const e=Object.fromEntries(t.headers??[]),n=Object.entries(e).find(([r])=>r.toLowerCase()==="content-type")?.[1];return{statusCode:t.status,body:sge(t.body,n),header:e,contentType:n,time:t.duration}}async function HA(t,e){const n={};if(!t.some(({key:i,value:o,active:s})=>i&&o&&s))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>vY);for(const{key:i,value:o,active:s}of t)if(!(!i||!o||!s))try{n[i]=r(o,e,BO)}catch{}return n}function lge(t,e){const n=t?.$workflows?.[e]?.steps??{};return Object.entries(n).filter(([,r])=>r?.request!=null||r?.response!=null||r?.outputs&&Object.keys(r.outputs).length>0).map(([r,i])=>({stepId:r,request:Vl(i?.request)??null,response:Vl(i?.response)??null,outputs:Vl(i?.outputs)??{}}))}const cge=10080*60*1e3;async function KA(t){const e=Ul.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:qf(),date:Date.now(),...t})}catch(n){console.error("Failed to persist step context:",n)}}async function uge(t,e,n){if(Ul.getInstance())for(const r of lge(n,e))await KA({collectionId:t,workflowId:e,...r})}class Ul{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.StepContextSqliteDBStorage-DTB5U2yh.js"),r=kp.getInstance(),i=new n(r);this.instance=new oge(i)}static getInstance(){return this.instance}static close(){this.instance=null}}async function dge(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},o=e?.[r.stepId];if(o&&r.response){const s=o.filter(a=>a.key&&a.active&&!(a.key in i));if(s.length){const a=await HA(s,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function JA(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const hge=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function pge(t){const e=new RegExp(hge),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const fge=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function gge(t,e){const n=fge.exec(t);if(!n)return;const[,r,i,o,s]=n;if(!!r!=!!s)return;let a;try{a=Oa(`${r}${i}${s}`,{$steps:e},BO)}catch{return}let l=a;try{for(const c of o.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return JA(l)}function mge(t,e){if(!t||!t.includes("$steps"))return t;const n=pge(t).map(({start:o,end:s})=>({match:t.slice(o,s),start:o,end:s}));if(!n.length)return t;let r=0;const i=[];for(const{match:o,start:s,end:a}of n){i.push(t.slice(r,s));let l=o;const c=gge(o,e);if(c!==void 0)l=c;else try{const d=JA(Oa(o,{$steps:e},BO));d!==void 0&&(l=d)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function Oge(t,e,n){const r=t.collections.find(o=>o.id.get()===e)?.workflows.find(o=>o.workflowId.get()===n)?.steps.get({noproxy:!0});if(!r)return{};const i={};for(const o of r)i[o.stepId]=o.outputs??[];return i}const vge=/\$steps\.([^.\s"'}]+)\./g;function yge(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(vge))e.add(n[1]);return[...e]}function t5(t,e,n,r){const i=[],o=s=>{if(s!=null)try{i.push(JSON.stringify(s))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};o(t.get({noproxy:!0})),o(e?.get({noproxy:!0})),o(n?.components.parameters.get({noproxy:!0}));for(const s of r?.inputs??[])s.value&&i.push(s.value);return yge(i.join("\0"))}async function n5(t,e,n,r){const i=Ul.getInstance(),o=[...new Set(r)];if(!i||!e||!n||!o.length)return{};const s=(await Promise.all(o.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return s.length?await dge(s,Oge(t,e,n)):{}}function Ru(t,e,n){return mge(rn(t,e),n)}function eD(t){return kW(t)}const tD="New Step";function r5({name:t=tD,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=bge(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function bge(t){return t.steps.filter(e=>e.state.get()!==Tt.Draft).map(e=>e.stepId.get())}function as({name:t=tD,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:o,dynamicReplayValues:s,xOperation:a}={}){if(!n){const c=o?Dw(o,s):null,d=[_i()];return{stepId:r5({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?Tt.Draft:Tt.Normal,parameters:{pathParameters:[],queryParameters:a?Kd(a.url):[],headers:[],cookies:[]},requestBody:Gh(),xOperation:a??(i?null:{method:"GET",url:""}),security:d,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:r5({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?Tt.Draft:Tt.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function Ua(t){return eD(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function Pp(t){return eD(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function GO(t,e,n,r,i){const{inputs:o,servers:s}=r,a=zB(Sa("path",[ln(e?.parameters.pathParameters,n?.components.parameters),ln(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let d="",h="";if(l)h=l.method,d=J4(l.url,a);else if(c){const f=s.find(m=>m.apiId===c.apiId);h=c.method==="x-query"?"query":c.method,d=(f?.value?e7(f.value,f.variables):"")+J4(c.path,a)}const p=d.split("?")[0];return{url:Ru(p,o,i??{}),method:h.toUpperCase()}}function i5(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(i=>i.id.get()===e)?.workflows.find(i=>i.workflowId.get()===n)?.steps.find(i=>i.stepId.get()===r)??null}function xge(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,o]=r.split("=");n[i]=o.replace(/"/g,"")}return n}function wge(t,e,n,r,i={}){const{inputs:o}=r,{requestBody:{content:s}}=t,{url:a,method:l}=GO(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(Q=>Q.securityType===ee.DigestAuth);if(!c)return"";const{username:d,password:h,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,opaque:b}=c[ee.DigestAuth],w=Ru(d,o,i),{pathname:P,search:S}=new URL(a),C=S?`${P}${S}`:P,$=Sge({username:w,password:Ru(h,o,i),uri:C,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,method:l,bodyContent:Ru(s,o,i)});return`Digest username="${w}", realm="${p}", nonce="${f}", uri="${C}", qop=${O}, nc=${y}, cnonce="${m}", response="${$}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function Sge(t){const{username:e,password:n,realm:r,nonce:i,cnonce:o,algorithm:s,qop:a,nc:l,uri:c,method:d,bodyContent:h}=t,p=kge(s),f=s?.endsWith("-sess")?p(`${p(`${e}:${r}:${n}`)}:${i}:${o}`):p(`${e}:${r}:${n}`),m=a?.includes("auth-int")?p(`${d}:${c}:${p(h)}`):p(`${d}:${c}`);return p(`${f}:${i}:${l}:${o}:${a}:${m}`).toString()}function kge(t){return t?.replace("-sess","")==="SHA-256"?e=>Md(QP(e)):e=>Md(og(e))}const ls=window.__TAURI__?.http.fetch??globalThis.fetch;function Pge(t){try{const e=new URL(t).hostname;return e==="localhost"||e==="127.0.0.1"}catch{return!1}}function HO(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function Cge(t){return t?t.split(";").map(e=>e.trim()).map(e=>{const n=e.indexOf("="),r=e.slice(0,n).trim(),i=e.slice(n+1).trim();return[r,i]}):[]}const $ge=["json","xml","html","text"],Qge=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function o5(t,e){return t.get(e)??t.get(e.toLowerCase())}function jge(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Tge(t){if(!t)return;const e=t.match(/filename\*=(?:UTF-8'')?([^;\n]+)/i);if(e?.[1])try{return decodeURIComponent(e[1].replace(/(^")|("$)/g,"").trim())}catch{return e[1].replace(/(^")|("$)/g,"").trim()}const n=t.match(/filename=([^;\n]+)/i);if(n?.[1])return n[1].replace(/(^")|("$)/g,"").trim()}function Ige(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function Ege(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return Qge.some(r=>n.includes(r))?!0:n.startsWith("application/")?!$ge.some(r=>n.includes(r)):!1}async function Rge(t,e){const n=o5(t.headers,"content-type")?.split(";")[0].trim(),r=o5(t.headers,"content-disposition"),i=jge(o5(t.headers,"content-length")),o=Ege(n,r),s=Cge(document.cookie);if(o){const d={fileName:Tge(r)||Ige(t.url)||"response",contentType:n,contentLength:i,status:"pending"};return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:new ArrayBuffer(0),body:"",duration:e,cookies:s,size:i??0,download:d,bodyNotStored:!0,url:t.url}}const a=await t.clone().arrayBuffer(),l=new TextDecoder().decode(a),c=new Uint8Array(a).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:a,body:l,duration:e,cookies:s,size:c,url:t.url}}const Age=":/?#[]@!$&'()*+,;=",Dge=new Set(["!","'","(",")","*"]);function Mge(t){return Dge.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function nD(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...Age].map(i=>({char:i,encoded:Mge(i)}));for(const{char:i,encoded:o}of r)n=n.split(o).join(i);return n}function rD(t){try{const e=new URL(t);return(e.protocol==="http:"&&e.port==="80"||e.protocol==="https:"&&e.port==="443")&&(e.port=""),e.hostname=e.hostname.toLowerCase(),e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}catch(e){return console.error("Invalid URL",e),null}}function iD(t,e){let n=rD(t);const r=e.find(({host:i,port:o})=>rD(`https://${i}:${o}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function zge(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function _ge(t,e){const{exists:n}=await Promise.resolve().then(()=>nO),{join:r}=await Promise.resolve().then(()=>RI),{baseName:i,extension:o}=zge(e);let s=0;for(;;){const a=s===0?"":` (${s})`,l=`${i}${a}${o}`,c=await r(t,l);if(!await n(c))return c;s+=1}}function qge(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const Cp=new Map;function Nge(t){Cp.get(t)?.abort()}function oD(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function Zge(t){if(!oD(t))return t}function KO(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function sD(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(KO(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function aD({store:t,step:e,settings:n,workflow:r,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=n.get(),c=cu(t),d=await n5(t,i?.id.get(),r?.workflowId.get(),t5(e,r,i,c)),{url:h,method:p}=GO(e.get(),r?.get(),i?.get(),c,d),f=s||"",m=hD(e,r,i,t,d),g=eme(h,a),O=tme({proxyUrl:f,resolvedUrl:h,ignoreProxy:g,queryParameters:m});await Vge(e,r??void 0,O,a,o);const y=JO(e,r??void 0,i??void 0,t,d),b=Zge(a5(e,t,d)),{clientCert:w,clientKey:P}=iD(h,l||[]),S=KO(O),C=p.toUpperCase(),$=!Iu.includes(C),Q=$?"POST":C,T=$?{...y,"X-HTTP-Method-Override":C}:y;return{urlWithProxyAndProtocol:S,fetchMethod:Q,fetchHeaders:T,body:b,credentials:sD(S,a),mode:HO(S)?"same-origin":"cors",clientCert:w,clientKey:P,resolvedUrl:h}}async function lD(t,e,n,r,i){const o=$p(t),s=o.data;if(s.type.get()!==Ne.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:d,isProcessingRequest:h}=s,p=t.collections.find(b=>b.id.get()===a.get()),f=p?.workflows.find(b=>b.workflowId.get()===l.get()),m=so(e.get({noproxy:!0}));h.set(!0);const g=o.id.get();Cp.get(g)?.abort();const O=new AbortController;Cp.set(g,O);const{signal:y}=O;try{const b=await aD({store:t,step:e,settings:n,workflow:f,collection:p,signal:y}),w=Date.now(),P={signal:y,method:b.fetchMethod,headers:b.fetchHeaders,body:b.body,mode:b.mode,credentials:b.credentials,clientCert:b.clientCert,clientKey:b.clientKey},S=await ls(b.urlWithProxyAndProtocol,P),C=Date.now()-w;d.set(null);const $=await Rge(S,C);c.set($);const Q=so(c.value);r?.(m,Q),i?.({outcome:"success",status:$.status,duration:$.duration,size:$.size})}catch(b){if(c.set(null),b.name==="AbortError")return;d.set(b.message||String(b));const w=so(c.value);r?.(m,w),i?.({outcome:"error",error:b.message||String(b)})}finally{Cp.get(g)===O&&Cp.delete(g),h.set(!1)}}async function Xge({store:t,step:e,settings:n,workflow:r,collection:i,fileName:o,onProgress:s}){const a=await aD({store:t,step:e,settings:n,workflow:r,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},c=an(),d=o||"response";let h=null;if(c){const{open:P}=await import("./redocly-openapi-docs.min.index-BQp5pipW.js"),S=await P({directory:!0,multiple:!1});if(!S)return;const C=Array.isArray(S)?S[0]:S;h=await _ge(C,d)}const p=await ls(a.urlWithProxyAndProtocol,l),f=p.headers.get("content-length"),m=f?Number.parseInt(f,10):void 0,g=Number.isFinite(m)?m:void 0,O=p.headers.get("content-type")??void 0;let y;if(p.body?.getReader){const P=p.body.getReader(),S=[];let C=0;for(;;){const{done:$,value:Q}=await P.read();if($)break;if(Q){const T=new Uint8Array(Q.byteLength);T.set(Q),S.push(T.buffer),C+=Q.byteLength,s?.({receivedBytes:C,totalBytes:g,done:!1})}}y=new Blob(S,{type:O}),s?.({receivedBytes:C,totalBytes:g,done:!0})}else y=await p.blob(),s?.({receivedBytes:y.size,totalBytes:g,done:!0});if(c){const{writeFile:P}=await Promise.resolve().then(()=>nO),S=new Uint8Array(await y.arrayBuffer());if(!h)return;await P(h,S);return}const b=window.URL.createObjectURL(y),w=document.createElement("a");w.href=b,w.download=d,w.rel="noopener",w.click(),window.URL.revokeObjectURL(b)}async function Vge(t,e,n,r,i){const o=Ua(t),s=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(a=>a.securityType.get()===ee.DigestAuth);if(s){const a=KO(n),l=await ls(a,{signal:i,method:o.toUpperCase(),credentials:sD(a,r),mode:HO(a)?"same-origin":"cors"}),c=xge(l.headers.get("WWW-Authenticate")||"");s[ee.DigestAuth].merge({nonce:c.nonce,realm:c.realm,qop:c.qop,algorithm:c.algorithm,opaque:c.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function Uge(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(o=>{switch(o.securityType){case ee.BasicAuth:{const s=o[ee.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${or(s.username,r,i)}:${or(s.password,r,i)}`),active:!0,in:"header"}}case ee.DigestAuth:{const s=cu(r);return{id:"",key:"Authorization",value:wge(t.get(),e?.get(),n?.get(),s,i),active:!0,in:"header"}}case ee.JWT:return{id:"",key:"Authorization",value:"Bearer "+o[ee.JWT].token,active:!0,in:"header"};case ee.OAuth2:{const{grantType:s}=o[ee.OAuth2],{accessToken:a}=o[ee.OAuth2][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.OpenIDConnect:{const{grantType:s}=o[ee.OpenIDConnect],{accessToken:a}=o[ee.OpenIDConnect][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.APIKey:{const s=o[ee.APIKey];return s.location===ii.Header?{id:"",key:s.name,value:s.key,active:!0,in:"header"}:null}default:return null}}).filter(o=>!!o)}function Wge(t,e,n){const{operation:r,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:l}=o;if(!n)return!0;const c=n.parameters??[],d=c.filter(P=>P.in==="query"),h=c.filter(P=>P.in==="header"),p=c.filter(P=>P.in==="cookie"),f=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!h.every(P=>s.some(S=>!gl(S)&&S.key===P.name)),y=!p.every(P=>a.some(S=>!gl(S)&&S.key===P.name)),b=!d.every(P=>l.some(S=>!gl(S)&&S.key===P.name)),w=Cae(t,e,n);return!f&&!m&&!g&&!O&&!y&&!b&&!w}function s5(t,e,n={}){const{requestBody:r}=t,i=Ua(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(or(r.content.get(),e,n));case"multipart/form-data":return Fge(t,e,n);case"application/x-www-form-urlencoded":return Yge(t,e,n);case"application/octet-stream":return r.binary.get();default:return or(r.content.get(),e,n)}}catch(o){console.error(o)}}function a5(t,e,n={}){const{requestBody:r}=t,i=s5(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return Bge(i);case"application/x-www-form-urlencoded":return Lge(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Lge(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function Yge(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["application/x-www-form-urlencoded"];return mD(o.get()).forEach(s=>{const a=or(s.value,e,n);i.push({key:or(s.key,e,n),value:a,type:"text"})}),i}function Fge(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["multipart/form-data"];return mD(o.get()).forEach(({type:s,files:a,value:l,key:c})=>{const d=or(c,e,n);if(s==="file"&&a)for(const h of a)i.push({key:d,value:h,type:s});else if(l){const h=or(l,e,n);i.push({key:d,value:h,type:s})}}),i}function Bge(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function cD(t,e,n){return t.filter(r=>{const{securityType:i,[ee.APIKey]:o}=r;return i===ee.APIKey&&o.location===e&&!!o.name}).map(r=>{const{[ee.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function uD(t=[]){return cD(t,ii.Query,"query")}function dD(t,e,n){const r=n?.components.parameters.get();return Sa("query",[uD(e?.security.get()),uD(t.security.get()),ln(e?.parameters.queryParameters.get(),r),ln(t.parameters.queryParameters.get(),r)])}function hD(t,e,n,r,i={}){return dD(t,e,n).map(o=>{const s=or(o.value,r,i),a=nD(s,o.allowReserved);return`${nD(o.key)}=${a}`}).join("&")}function pD(t,e,n,r,i={}){return dD(t,e,n).reduce((o,s)=>{const a=or(s.value,r,i),l=or(s.key,r,i);return o[l]=a,o},{})}function Gge(t){const e=t.split("?")[0],n=qge(e),r=/^\{[^\s]+\}$/,i=n.filter(o=>r.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function JO(t,e,n,r,i={}){const o=Jge(t,r,i),s=Uge(t,e,n,r,i),a=Hge(t,e,n,r,i),l=n?.components.parameters.get();return Sa("header",[o,s,a,ln(e?.parameters.headers.get(),l),ln(t.parameters.headers.get(),l)]).reduce((c,{key:d,value:h})=>(c[d]=or(h,r,i),c),{})}function Hge(t,e,n,r,i={}){const o=gD(t,e,n).map(s=>`${s.key}=${or(s.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function Kge(t,e,n,r,i={}){return gD(t,e,n).reduce((o,s)=>{const a=or(s.value,r,i);return{...o,[or(s.key,r,i)]:a}},{})}function fD(t=[]){return cD(t,ii.Cookie,"cookie")}function gD(t,e,n){const r=n?.components.parameters.get();return Sa("cookie",[fD(e?.security.get()),fD(t.security.get()),ln(e?.parameters.cookies.get(),r),ln(t.parameters.cookies.get(),r)])}function mD(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Jge(t,e,n={}){const{requestBody:r}=t,i=a5(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:oD(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function or(t,e,n={}){return e?Ru(t,cu(e)?.inputs,n):t}function eme(t,e){return Pge(t)||HO(t)||!!(e&&HO(KO(t),e))}function tme({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?vy(t):t;let o;return n||!i?o=e:o=`${i}/${e}`,r&&(o+=`?${r}`),o}function l5(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(r=>{const i=e.paths.nested(r),o=(i.keys??[]).filter(l=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(l.toLowerCase())).map(l=>{const c=i.nested(l),d=c.operationId.get()||"",h=c.summary.get();return{apiId:n,path:r,method:l,operationId:d,summary:h,isAdditionalOperation:!1}}),s=i.additionalOperations?.get(),a=s?Object.entries(s).map(([l,c])=>({apiId:n,path:r,method:l,operationId:c.operationId||"",summary:c.summary,isAdditionalOperation:!0})):[];return[...o,...a]})})}const OD=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:o}=e,s=t.find(l=>l.id.get()===r);if(!s)return null;if(n)try{return n(o,i,s.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=s.paths?.nested(o)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:o,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function $p({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function nme(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===Ne.Step),o=l5(n),s=i.map(l=>{const{collectionId:c,workflowId:d,satisfiesScheme:h}=l.data.get(),p=l.data.draftStep.ornull;if(p===null)return null;const{operationId:f,apiId:m}=p.get().operation??{};if(!h||!f)return null;const g=t.collections.find($=>$.id.get()===c),O=g?.workflows.find($=>$.workflowId.get()===d),y=o.find($=>$.operationId===f&&$.apiId===m);if(!y)return null;const b=JO(p,O,g,t),w=a5(p,t),P=Kge(p,O,g,t),S=pD(p,O,g,t),C=p.requestBody.activeExampleName;return{apiPath:{path:y.path,method:y.method},requestValues:{cookie:P,header:b,query:S,body:w},activeExampleName:C.get()}}).filter(l=>l!==null),a=cu(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:d})=>[c,d])),...Object.fromEntries(l.servers.map(({apiId:c,value:d})=>[c,d]))}]))}}function rme(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function ime(t){const e=new Map;return(t.paths?.keys??[]).forEach(n=>{const r=t.paths.nested(n);rme(r.keys).forEach(o=>{const s=r.nested(o),a=s.tags?.get()||[],l=s.summary?.get(),c=s.operationId?.get();(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!1}),e.set(d,h)})});const i=r.additionalOperations?.get();i&&Object.entries(i).forEach(([o,s])=>{const a=s.tags||[],l=s.summary,c=s.operationId;(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!0}),e.set(d,h)})})}),e}function ome({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([r,i])=>{const o=i.map(s=>({id:c5({apiId:t,method:s.method,path:s.path}),name:s.summary||s.path,apiTitle:e,type:"operation",apiId:t,path:s.path,tagName:r,method:s.method,summary:s.summary,isAdditionalOperation:s.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${r}`,name:r,apiTitle:e,type:"tag",apiId:t,tagName:r,children:o}}).filter(Boolean)}function vD(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=ime(t),i=ome({apiId:e,apiTitle:n,tagToOperations:r});return i.length===0?null:{id:e,name:n,apiTitle:n,type:"api",apiId:e,api:t,children:i}}const c5=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function sme(t){const e=t.data.get();switch(e.type){case Ne.Workflow:return`${e.collectionId}/${e.workflowId}`;case Ne.Collection:return e.collectionId;case Ne.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case Ne.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function ame(t){const e=t.data.get();if(e.type!==Ne.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return c5({apiId:n,path:r,method:i})}function Wa(t){const e=Je(),n=$p(e);return!n.get()||t&&!pn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:sme(n),apiNodeId:ame(n)}}const lme=t=>u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M7 13L7.705 12.295L3.915 8.5H14V7.5H3.915L7.705 3.705L7 3L2 8L7 13Z"})}),yD=x(lme).attrs({"data-component-name":"icons/ArrowLeftIcon/ArrowLeftIcon"})`
|
|
1077
|
+
`,rn=(t,e,n=new Set)=>{const r=e5(t);if(!r.length)return t;let i=0;const o=r.flatMap(({start:s,end:a,name:l})=>{if(n.has(l))return null;const c=e.findLast(h=>h.name===l),d=t.slice(i,c?s:a);if(i=a,c){n.add(l);const h=rn(c.value,e,n);return n.delete(l),[d.length?d:null,h||t.slice(s,a)]}return[d.length?d:null]});return t.slice(i).length&&o.push(t.slice(i)),o.join("")};function rge(t,e){return e.find(n=>n.name===t.slice(1,-1))?.value||t}function ige(t,e){const n=BA(t);if(!n.length)return u.jsx(GA,{children:t});let r=0;const i=n.flatMap(({start:o,end:s})=>{const a=t.slice(r,o),l=rge(t.slice(o,s),e);return r=s,[a.length?a:null,l]});return t.slice(r).length&&i.push(t.slice(r)),u.jsx(GA,{children:i.join("")})}class oge{constructor(e){this.storage=e}storage;async initialize(){await this.storage.initialize()}upsert(e){return this.storage.upsert(e)}getByWorkflow(e,n){return this.storage.getByWorkflow(e,n)}getByKey(e,n,r){return this.storage.getByKey(e,n,r)}pruneOlderThan(e){return this.storage.pruneOlderThan(e)}clear(){return this.storage.clear()}}class kp{static instance=null;static currentDbPath=null;static async initialize(e){if(this.instance&&this.currentDbPath===e)return this.instance;this.instance&&this.currentDbPath!==e&&await this.close();const{SqliteDBStorage:n}=await import("./redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js");return this.instance=n.getInstance(e),this.currentDbPath=e,await this.instance.initialize(),this.instance}static getInstance(){if(!this.instance)throw new Error("SqliteDBConnection not initialized");return this.instance}static isInitialized(){return this.instance!==null}static async close(){this.instance&&(await this.instance.close(),this.instance=null,this.currentDbPath=null)}}const BO={info:t=>{},error:t=>{},warn:t=>{},printNewLine:()=>{},printSeparator:()=>{},indent:(t,e)=>t,output:t=>t};function Vl(t){if(t!==void 0)try{return JSON.parse(JSON.stringify(t))}catch{return}}function sge(t,e){if(typeof t!="string"||t===""||!(!e||/json/i.test(e)))return t;try{return JSON.parse(t)}catch{return t}}function age(t){if(!t)return null;const e=Object.fromEntries(t.headers??[]),n=Object.entries(e).find(([r])=>r.toLowerCase()==="content-type")?.[1];return{statusCode:t.status,body:sge(t.body,n),header:e,contentType:n,time:t.duration}}async function HA(t,e){const n={};if(!t.some(({key:i,value:o,active:s})=>i&&o&&s))return n;const{evaluateRuntimeExpression:r}=await Promise.resolve().then(()=>vY);for(const{key:i,value:o,active:s}of t)if(!(!i||!o||!s))try{n[i]=r(o,e,BO)}catch{}return n}function lge(t,e){const n=t?.$workflows?.[e]?.steps??{};return Object.entries(n).filter(([,r])=>r?.request!=null||r?.response!=null||r?.outputs&&Object.keys(r.outputs).length>0).map(([r,i])=>({stepId:r,request:Vl(i?.request)??null,response:Vl(i?.response)??null,outputs:Vl(i?.outputs)??{}}))}const cge=10080*60*1e3;async function KA(t){const e=Ul.getInstance();if(e&&!(!t.collectionId||!t.workflowId||!t.stepId))try{await e.upsert({id:qf(),date:Date.now(),...t})}catch(n){console.error("Failed to persist step context:",n)}}async function uge(t,e,n){if(Ul.getInstance())for(const r of lge(n,e))await KA({collectionId:t,workflowId:e,...r})}class Ul{static instance=null;static async initialize(e){if(this.close(),!e)return;const{StepContextSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.StepContextSqliteDBStorage-DTB5U2yh.js"),r=kp.getInstance(),i=new n(r);this.instance=new oge(i)}static getInstance(){return this.instance}static close(){this.instance=null}}async function dge(t,e){const n={};for(const r of t){if(n[r.stepId])continue;const i={...r.outputs??{}},o=e?.[r.stepId];if(o&&r.response){const s=o.filter(a=>a.key&&a.active&&!(a.key in i));if(s.length){const a=await HA(s,{$response:r.response,$request:r.request??void 0});for(const[l,c]of Object.entries(a))l in i||(i[l]=c)}}n[r.stepId]={request:r.request??void 0,response:r.response??void 0,outputs:i}}return n}function JA(t){if(t!==void 0)return typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t)}const hge=/\{\$steps\.[^}\s]+\}|^\$steps\.[^}\s]+$/g;function pge(t){const e=new RegExp(hge),n=[];let r;for(;(r=e.exec(t))!==null;)n.push({start:r.index,end:r.index+r[0].length});return n}const fge=/^(\{?)(\$steps\.[^.{}\s]+\.(?:request|response)\.[^{}\s#]+)#\/([^{}\s]*)(\}?)$/;function gge(t,e){const n=fge.exec(t);if(!n)return;const[,r,i,o,s]=n;if(!!r!=!!s)return;let a;try{a=Oa(`${r}${i}${s}`,{$steps:e},BO)}catch{return}let l=a;try{for(const c of o.split("/").filter(Boolean)){if(l==null)return;typeof l=="string"&&(l=JSON.parse(l)),l=l[decodeURIComponent(c)]}}catch{return}return JA(l)}function mge(t,e){if(!t||!t.includes("$steps"))return t;const n=pge(t).map(({start:o,end:s})=>({match:t.slice(o,s),start:o,end:s}));if(!n.length)return t;let r=0;const i=[];for(const{match:o,start:s,end:a}of n){i.push(t.slice(r,s));let l=o;const c=gge(o,e);if(c!==void 0)l=c;else try{const d=JA(Oa(o,{$steps:e},BO));d!==void 0&&(l=d)}catch{}i.push(l),r=a}return i.push(t.slice(r)),i.join("")}function Oge(t,e,n){const r=t.collections.find(o=>o.id.get()===e)?.workflows.find(o=>o.workflowId.get()===n)?.steps.get({noproxy:!0});if(!r)return{};const i={};for(const o of r)i[o.stepId]=o.outputs??[];return i}const vge=/\$steps\.([^.\s"'}]+)\./g;function yge(t){if(!t||!t.includes("$steps."))return[];const e=new Set;for(const n of t.matchAll(vge))e.add(n[1]);return[...e]}function t5(t,e,n,r){const i=[],o=s=>{if(s!=null)try{i.push(JSON.stringify(s))}catch(a){console.error("findReferencedStepIds: failed to scan a source for $steps references",a)}};o(t.get({noproxy:!0})),o(e?.get({noproxy:!0})),o(n?.components.parameters.get({noproxy:!0}));for(const s of r?.inputs??[])s.value&&i.push(s.value);return yge(i.join("\0"))}async function n5(t,e,n,r){const i=Ul.getInstance(),o=[...new Set(r)];if(!i||!e||!n||!o.length)return{};const s=(await Promise.all(o.map(a=>i.getByKey(e,n,a)))).filter(a=>a!=null);return s.length?await dge(s,Oge(t,e,n)):{}}function Ru(t,e,n){return mge(rn(t,e),n)}function eD(t){return kW(t)}const tD="New Step";function r5({name:t=tD,workflow:e}={}){let n=t.replaceAll(" ","-");if(!e)return n;const r=bge(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function bge(t){return t.steps.filter(e=>e.state.get()!==Tt.Draft).map(e=>e.stepId.get())}function as({name:t=tD,isDraft:e=!1,fromStep:n,workflow:r,operation:i,apiOperation:o,dynamicReplayValues:s,xOperation:a}={}){if(!n){const c=o?Dw(o,s):null,d=[_i()];return{stepId:r5({name:t,workflow:r}),description:t,outputs:[],successCriteria:[],state:e?Tt.Draft:Tt.Normal,parameters:{pathParameters:[],queryParameters:a?Kd(a.url):[],headers:[],cookies:[]},requestBody:Gh(),xOperation:a??(i?null:{method:"GET",url:""}),security:d,operation:i??null,...c}}const l=n.get({noproxy:!0});return{stepId:r5({name:t,workflow:r}),description:l.description,outputs:l.outputs,successCriteria:l.successCriteria,state:e?Tt.Draft:Tt.Normal,parameters:l.parameters,requestBody:l.requestBody,xOperation:l.xOperation,security:l.security,operation:l.operation}}function Ua(t){return eD(t)?t.xOperation?.ornull?.method.get()??t.operation.ornull?.method.get()??"":t.xOperation?.method??t.operation?.method??""}function Pp(t){return eD(t)?t.xOperation?.ornull?.url.get()??t.operation.ornull?.nested("path").get()??"":t.xOperation?.url??t.operation?.path??""}function GO(t,e,n,r,i){const{inputs:o,servers:s}=r,a=zB(Sa("path",[ln(e?.parameters.pathParameters,n?.components.parameters),ln(t.parameters.pathParameters,n?.components.parameters)]),r.inputs,i),l=t.xOperation??null,c=t.operation??null;let d="",h="";if(l)h=l.method,d=J4(l.url,a);else if(c){const f=s.find(m=>m.apiId===c.apiId);h=c.method==="x-query"?"query":c.method,d=(f?.value?e7(f.value,f.variables):"")+J4(c.path,a)}const p=d.split("?")[0];return{url:Ru(p,o,i??{}),method:h.toUpperCase()}}function i5(t,{collectionId:e,workflowId:n,stepId:r}){return t.collections.find(i=>i.id.get()===e)?.workflows.find(i=>i.workflowId.get()===n)?.steps.find(i=>i.stepId.get()===r)??null}function xge(t){const e=t.substring(7).split(", "),n={};for(const r of e){const[i,o]=r.split("=");n[i]=o.replace(/"/g,"")}return n}function wge(t,e,n,r,i={}){const{inputs:o}=r,{requestBody:{content:s}}=t,{url:a,method:l}=GO(t,e,n,r,i),c=[...e?.security||[],...t.security].findLast(Q=>Q.securityType===ee.DigestAuth);if(!c)return"";const{username:d,password:h,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,opaque:b}=c[ee.DigestAuth],w=Ru(d,o,i),{pathname:P,search:S}=new URL(a),C=S?`${P}${S}`:P,$=Sge({username:w,password:Ru(h,o,i),uri:C,realm:p,nonce:f,cnonce:m,algorithm:g,qop:O,nc:y,method:l,bodyContent:Ru(s,o,i)});return`Digest username="${w}", realm="${p}", nonce="${f}", uri="${C}", qop=${O}, nc=${y}, cnonce="${m}", response="${$}", algorithm=${g}${b?`, opaque="${b}"`:""}`}function Sge(t){const{username:e,password:n,realm:r,nonce:i,cnonce:o,algorithm:s,qop:a,nc:l,uri:c,method:d,bodyContent:h}=t,p=kge(s),f=s?.endsWith("-sess")?p(`${p(`${e}:${r}:${n}`)}:${i}:${o}`):p(`${e}:${r}:${n}`),m=a?.includes("auth-int")?p(`${d}:${c}:${p(h)}`):p(`${d}:${c}`);return p(`${f}:${i}:${l}:${o}:${a}:${m}`).toString()}function kge(t){return t?.replace("-sess","")==="SHA-256"?e=>Md(QP(e)):e=>Md(og(e))}const ls=window.__TAURI__?.http.fetch??globalThis.fetch;function Pge(t){try{const e=new URL(t).hostname;return e==="localhost"||e==="127.0.0.1"}catch{return!1}}function HO(t,e=window.location.origin){try{const n=new URL(t);return e===n.origin}catch{return!1}}function Cge(t){return t?t.split(";").map(e=>e.trim()).map(e=>{const n=e.indexOf("="),r=e.slice(0,n).trim(),i=e.slice(n+1).trim();return[r,i]}):[]}const $ge=["json","xml","html","text"],Qge=["application/octet-stream","application/x-msdownload","application/pdf","application/zip","application/gzip","application/x-7z-compressed","application/x-tar","application/x-bzip2"];function o5(t,e){return t.get(e)??t.get(e.toLowerCase())}function jge(t){if(!t)return;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:void 0}function Tge(t){if(!t)return;const e=t.match(/filename\*=(?:UTF-8'')?([^;\n]+)/i);if(e?.[1])try{return decodeURIComponent(e[1].replace(/(^")|("$)/g,"").trim())}catch{return e[1].replace(/(^")|("$)/g,"").trim()}const n=t.match(/filename=([^;\n]+)/i);if(n?.[1])return n[1].replace(/(^")|("$)/g,"").trim()}function Ige(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||void 0}catch{return}}function Ege(t,e){if(e&&/attachment|filename=/i.test(e))return!0;if(!t)return!1;const n=t.toLowerCase();return Qge.some(r=>n.includes(r))?!0:n.startsWith("application/")?!$ge.some(r=>n.includes(r)):!1}async function Rge(t,e){const n=o5(t.headers,"content-type")?.split(";")[0].trim(),r=o5(t.headers,"content-disposition"),i=jge(o5(t.headers,"content-length")),o=Ege(n,r),s=Cge(document.cookie);if(o){const d={fileName:Tge(r)||Ige(t.url)||"response",contentType:n,contentLength:i,status:"pending"};return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:new ArrayBuffer(0),body:"",duration:e,cookies:s,size:i??0,download:d,bodyNotStored:!0,url:t.url}}const a=await t.clone().arrayBuffer(),l=new TextDecoder().decode(a),c=new Uint8Array(a).length;return{bodyUsed:t.bodyUsed,status:t.status,headers:Array.from(t.headers.entries()),arrayBuffer:a,body:l,duration:e,cookies:s,size:c,url:t.url}}const Age=":/?#[]@!$&'()*+,;=",Dge=new Set(["!","'","(",")","*"]);function Mge(t){return Dge.has(t)?`%${t.charCodeAt(0).toString(16).toUpperCase()}`:encodeURIComponent(t)}function nD(t,e=!1){let n=encodeURIComponent(t).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`);if(!e)return n;const r=[...Age].map(i=>({char:i,encoded:Mge(i)}));for(const{char:i,encoded:o}of r)n=n.split(o).join(i);return n}function rD(t){try{const e=new URL(t);return(e.protocol==="http:"&&e.port==="80"||e.protocol==="https:"&&e.port==="443")&&(e.port=""),e.hostname=e.hostname.toLowerCase(),e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}catch(e){return console.error("Invalid URL",e),null}}function iD(t,e){let n=rD(t);const r=e.find(({host:i,port:o})=>rD(`https://${i}:${o}`)===n);return{clientCert:r?.crtFilePath,clientKey:r?.keyFilePath}}function zge(t){const e=t.lastIndexOf(".");return e<=0?{baseName:t,extension:""}:{baseName:t.slice(0,e),extension:t.slice(e)}}async function _ge(t,e){const{exists:n}=await Promise.resolve().then(()=>nO),{join:r}=await Promise.resolve().then(()=>RI),{baseName:i,extension:o}=zge(e);let s=0;for(;;){const a=s===0?"":` (${s})`,l=`${i}${a}${o}`,c=await r(t,l);if(!await n(c))return c;s+=1}}function qge(t){return t.split(/(\{[^}]+\}|\/)/g).filter(e=>e!=="")}const Cp=new Map;function Nge(t){Cp.get(t)?.abort()}function oD(t){return t?t instanceof FormData||t instanceof URLSearchParams?t.entries().next().done===!0:!1:!0}function Zge(t){if(!oD(t))return t}function KO(t){return/^https?:\/\//.test(t)?t:`https://${t}`}function sD(t,e){if(!e)return"same-origin";try{const n=new URL(e).origin;return new URL(KO(t)).origin===n?"include":"same-origin"}catch{return"same-origin"}}async function aD({store:t,step:e,settings:n,workflow:r,collection:i,signal:o}){const{corsProxyUrl:s,credentialOrigin:a,certificates:l}=n.get(),c=cu(t),d=await n5(t,i?.id.get(),r?.workflowId.get(),t5(e,r,i,c)),{url:h,method:p}=GO(e.get(),r?.get(),i?.get(),c,d),f=s||"",m=hD(e,r,i,t,d),g=eme(h,a),O=tme({proxyUrl:f,resolvedUrl:h,ignoreProxy:g,queryParameters:m});await Vge(e,r??void 0,O,a,o);const y=JO(e,r??void 0,i??void 0,t,d),b=Zge(a5(e,t,d)),{clientCert:w,clientKey:P}=iD(h,l||[]),S=KO(O),C=p.toUpperCase(),$=!Iu.includes(C),Q=$?"POST":C,T=$?{...y,"X-HTTP-Method-Override":C}:y;return{urlWithProxyAndProtocol:S,fetchMethod:Q,fetchHeaders:T,body:b,credentials:sD(S,a),mode:HO(S)?"same-origin":"cors",clientCert:w,clientKey:P,resolvedUrl:h}}async function lD(t,e,n,r,i){const o=$p(t),s=o.data;if(s.type.get()!==Ne.Step){console.warn("not an operation tab");return}const{collectionId:a,workflowId:l,response:c,requestError:d,isProcessingRequest:h}=s,p=t.collections.find(b=>b.id.get()===a.get()),f=p?.workflows.find(b=>b.workflowId.get()===l.get()),m=so(e.get({noproxy:!0}));h.set(!0);const g=o.id.get();Cp.get(g)?.abort();const O=new AbortController;Cp.set(g,O);const{signal:y}=O;try{const b=await aD({store:t,step:e,settings:n,workflow:f,collection:p,signal:y}),w=Date.now(),P={signal:y,method:b.fetchMethod,headers:b.fetchHeaders,body:b.body,mode:b.mode,credentials:b.credentials,clientCert:b.clientCert,clientKey:b.clientKey},S=await ls(b.urlWithProxyAndProtocol,P),C=Date.now()-w;d.set(null);const $=await Rge(S,C);c.set($);const Q=so(c.value);r?.(m,Q),i?.({outcome:"success",status:$.status,duration:$.duration,size:$.size})}catch(b){if(c.set(null),b.name==="AbortError")return;d.set(b.message||String(b));const w=so(c.value);r?.(m,w),i?.({outcome:"error",error:b.message||String(b)})}finally{Cp.get(g)===O&&Cp.delete(g),h.set(!1)}}async function Xge({store:t,step:e,settings:n,workflow:r,collection:i,fileName:o,onProgress:s}){const a=await aD({store:t,step:e,settings:n,workflow:r,collection:i}),l={method:a.fetchMethod,headers:a.fetchHeaders,body:a.body,mode:a.mode,credentials:a.credentials,clientCert:a.clientCert,clientKey:a.clientKey},c=an(),d=o||"response";let h=null;if(c){const{open:P}=await import("./redocly-openapi-docs.min.index-BCcol5vU.js"),S=await P({directory:!0,multiple:!1});if(!S)return;const C=Array.isArray(S)?S[0]:S;h=await _ge(C,d)}const p=await ls(a.urlWithProxyAndProtocol,l),f=p.headers.get("content-length"),m=f?Number.parseInt(f,10):void 0,g=Number.isFinite(m)?m:void 0,O=p.headers.get("content-type")??void 0;let y;if(p.body?.getReader){const P=p.body.getReader(),S=[];let C=0;for(;;){const{done:$,value:Q}=await P.read();if($)break;if(Q){const T=new Uint8Array(Q.byteLength);T.set(Q),S.push(T.buffer),C+=Q.byteLength,s?.({receivedBytes:C,totalBytes:g,done:!1})}}y=new Blob(S,{type:O}),s?.({receivedBytes:C,totalBytes:g,done:!0})}else y=await p.blob(),s?.({receivedBytes:y.size,totalBytes:g,done:!0});if(c){const{writeFile:P}=await Promise.resolve().then(()=>nO),S=new Uint8Array(await y.arrayBuffer());if(!h)return;await P(h,S);return}const b=window.URL.createObjectURL(y),w=document.createElement("a");w.href=b,w.download=d,w.rel="noopener",w.click(),window.URL.revokeObjectURL(b)}async function Vge(t,e,n,r,i){const o=Ua(t),s=[...Array.from(e?.security||[]),...Array.from(t.security)].findLast(a=>a.securityType.get()===ee.DigestAuth);if(s){const a=KO(n),l=await ls(a,{signal:i,method:o.toUpperCase(),credentials:sD(a,r),mode:HO(a)?"same-origin":"cors"}),c=xge(l.headers.get("WWW-Authenticate")||"");s[ee.DigestAuth].merge({nonce:c.nonce,realm:c.realm,qop:c.qop,algorithm:c.algorithm,opaque:c.opaque,cnonce:crypto.randomUUID(),nc:"00000001"})}}function Uge(t,e,n,r,i){return[...e?.security.get()||[],...t.security.get()].map(o=>{switch(o.securityType){case ee.BasicAuth:{const s=o[ee.BasicAuth];return{id:"",key:"Authorization",value:"Basic "+btoa(`${or(s.username,r,i)}:${or(s.password,r,i)}`),active:!0,in:"header"}}case ee.DigestAuth:{const s=cu(r);return{id:"",key:"Authorization",value:wge(t.get(),e?.get(),n?.get(),s,i),active:!0,in:"header"}}case ee.JWT:return{id:"",key:"Authorization",value:"Bearer "+o[ee.JWT].token,active:!0,in:"header"};case ee.OAuth2:{const{grantType:s}=o[ee.OAuth2],{accessToken:a}=o[ee.OAuth2][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.OpenIDConnect:{const{grantType:s}=o[ee.OpenIDConnect],{accessToken:a}=o[ee.OpenIDConnect][s];return{id:"",key:"Authorization",value:"Bearer "+a,active:!0,in:"header"}}case ee.APIKey:{const s=o[ee.APIKey];return s.location===ii.Header?{id:"",key:s.name,value:s.key,active:!0,in:"header"}:null}default:return null}}).filter(o=>!!o)}function Wge(t,e,n){const{operation:r,requestBody:i,parameters:o}=e,{headers:s,cookies:a,queryParameters:l}=o;if(!n)return!0;const c=n.parameters??[],d=c.filter(P=>P.in==="query"),h=c.filter(P=>P.in==="header"),p=c.filter(P=>P.in==="cookie"),f=r?.path!==n.path,m=n.method.toLowerCase()!==r?.method.toLowerCase(),g=n.body?.mediaTypes&&n.body?.mediaTypes?.[i.type]===void 0,O=!h.every(P=>s.some(S=>!gl(S)&&S.key===P.name)),y=!p.every(P=>a.some(S=>!gl(S)&&S.key===P.name)),b=!d.every(P=>l.some(S=>!gl(S)&&S.key===P.name)),w=Cae(t,e,n);return!f&&!m&&!g&&!O&&!y&&!b&&!w}function s5(t,e,n={}){const{requestBody:r}=t,i=Ua(t).toUpperCase();if(i==="GET"||i==="HEAD"||i==="OPTIONS")return null;try{switch(r.type.get()){case"JSON":return structuredClone(or(r.content.get(),e,n));case"multipart/form-data":return Fge(t,e,n);case"application/x-www-form-urlencoded":return Yge(t,e,n);case"application/octet-stream":return r.binary.get();default:return or(r.content.get(),e,n)}}catch(o){console.error(o)}}function a5(t,e,n={}){const{requestBody:r}=t,i=s5(t,e,n);if(i===null)return null;switch(r.type.get()){default:return i;case"multipart/form-data":return Bge(i);case"application/x-www-form-urlencoded":return Lge(i);case"application/octet-stream":return r.binary.ornull?.file.get()??null}}function Lge(t){const e=new URLSearchParams;return t.forEach(({key:n,value:r})=>{e.append(n,r)}),e}function Yge(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["application/x-www-form-urlencoded"];return mD(o.get()).forEach(s=>{const a=or(s.value,e,n);i.push({key:or(s.key,e,n),value:a,type:"text"})}),i}function Fge(t,e,n={}){const{requestBody:r}=t,i=[],o=r.formData["multipart/form-data"];return mD(o.get()).forEach(({type:s,files:a,value:l,key:c})=>{const d=or(c,e,n);if(s==="file"&&a)for(const h of a)i.push({key:d,value:h,type:s});else if(l){const h=or(l,e,n);i.push({key:d,value:h,type:s})}}),i}function Bge(t){const e=new FormData;return t.forEach(({key:n,value:r,type:i})=>{i==="file"?e.append(n,r.file):r&&e.append(n,r)}),e}function cD(t,e,n){return t.filter(r=>{const{securityType:i,[ee.APIKey]:o}=r;return i===ee.APIKey&&o.location===e&&!!o.name}).map(r=>{const{[ee.APIKey]:i}=r;return{id:"",key:i.name,value:i.key,active:!0,in:n}})}function uD(t=[]){return cD(t,ii.Query,"query")}function dD(t,e,n){const r=n?.components.parameters.get();return Sa("query",[uD(e?.security.get()),uD(t.security.get()),ln(e?.parameters.queryParameters.get(),r),ln(t.parameters.queryParameters.get(),r)])}function hD(t,e,n,r,i={}){return dD(t,e,n).map(o=>{const s=or(o.value,r,i),a=nD(s,o.allowReserved);return`${nD(o.key)}=${a}`}).join("&")}function pD(t,e,n,r,i={}){return dD(t,e,n).reduce((o,s)=>{const a=or(s.value,r,i),l=or(s.key,r,i);return o[l]=a,o},{})}function Gge(t){const e=t.split("?")[0],n=qge(e),r=/^\{[^\s]+\}$/,i=n.filter(o=>r.test(o)).map(o=>o.slice(1,-1));return new Set(i)}function JO(t,e,n,r,i={}){const o=Jge(t,r,i),s=Uge(t,e,n,r,i),a=Hge(t,e,n,r,i),l=n?.components.parameters.get();return Sa("header",[o,s,a,ln(e?.parameters.headers.get(),l),ln(t.parameters.headers.get(),l)]).reduce((c,{key:d,value:h})=>(c[d]=or(h,r,i),c),{})}function Hge(t,e,n,r,i={}){const o=gD(t,e,n).map(s=>`${s.key}=${or(s.value,r,i)}`).join("; ");return o?[{id:"",key:"Cookie",value:o,active:!0,in:"header"},{id:"",key:"X-Redocly-Cookie",value:o,active:!0,in:"header"}]:[]}function Kge(t,e,n,r,i={}){return gD(t,e,n).reduce((o,s)=>{const a=or(s.value,r,i);return{...o,[or(s.key,r,i)]:a}},{})}function fD(t=[]){return cD(t,ii.Cookie,"cookie")}function gD(t,e,n){const r=n?.components.parameters.get();return Sa("cookie",[fD(e?.security.get()),fD(t.security.get()),ln(e?.parameters.cookies.get(),r),ln(t.parameters.cookies.get(),r)])}function mD(t){return t.filter(e=>e.active&&e.key&&(e.value||e?.files))}function Jge(t,e,n={}){const{requestBody:r}=t,i=a5(t,e,n);return["binary","multipart/form-data"].includes(r.type.get())?[]:oD(i)?[]:[{id:"",key:"Content-Type",value:r.type.get(),active:!0,in:"header"}]}function or(t,e,n={}){return e?Ru(t,cu(e)?.inputs,n):t}function eme(t,e){return Pge(t)||HO(t)||!!(e&&HO(KO(t),e))}function tme({proxyUrl:t,resolvedUrl:e,ignoreProxy:n,queryParameters:r=""}){const i=t!=="/"?vy(t):t;let o;return n||!i?o=e:o=`${i}/${e}`,r&&(o+=`?${r}`),o}function l5(t){return t.flatMap(e=>{const n=e.id.get();return(e.paths?.keys??[]).flatMap(r=>{const i=e.paths.nested(r),o=(i.keys??[]).filter(l=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(l.toLowerCase())).map(l=>{const c=i.nested(l),d=c.operationId.get()||"",h=c.summary.get();return{apiId:n,path:r,method:l,operationId:d,summary:h,isAdditionalOperation:!1}}),s=i.additionalOperations?.get(),a=s?Object.entries(s).map(([l,c])=>({apiId:n,path:r,method:l,operationId:c.operationId||"",summary:c.summary,isAdditionalOperation:!0})):[];return[...o,...a]})})}const OD=(t,e,n)=>{if(!e)return null;const{apiId:r,method:i,path:o}=e,s=t.find(l=>l.id.get()===r);if(!s)return null;if(n)try{return n(o,i,s.get({noproxy:!0}))??null}catch(l){console.error("Failed to convert operation to replay value",l)}const a=s.paths?.nested(o)?.nested(i)?.ornull;return a?{id:a.operationId.get()??"",name:a.summary.get()??"",method:i,path:o,href:"",operationId:a.operationId.get(),parameters:[],servers:[],security:[]}:null};function $p({tabsState:{activeTabIdx:t,tabs:e}}){return e[t?.get()??0]}function nme(t){const{environments:e,apis:n,tabsState:{tabs:r}}=t,i=r.filter(l=>l.data.type.get()===Ne.Step),o=l5(n),s=i.map(l=>{const{collectionId:c,workflowId:d,satisfiesScheme:h}=l.data.get(),p=l.data.draftStep.ornull;if(p===null)return null;const{operationId:f,apiId:m}=p.get().operation??{};if(!h||!f)return null;const g=t.collections.find($=>$.id.get()===c),O=g?.workflows.find($=>$.workflowId.get()===d),y=o.find($=>$.operationId===f&&$.apiId===m);if(!y)return null;const b=JO(p,O,g,t),w=a5(p,t),P=Kge(p,O,g,t),S=pD(p,O,g,t),C=p.requestBody.activeExampleName;return{apiPath:{path:y.path,method:y.method},requestValues:{cookie:P,header:b,query:S,body:w},activeExampleName:C.get()}}).filter(l=>l!==null),a=cu(t);return{operations:s,environment:a?.name,environments:Object.fromEntries(e.get().map(l=>[l.name,{...Object.fromEntries(l.inputs.filter(({isSecret:c})=>!c).map(({name:c,value:d})=>[c,d])),...Object.fromEntries(l.servers.map(({apiId:c,value:d})=>[c,d]))}]))}}function rme(t){return t.filter(e=>["get","put","post","delete","options","head","patch","trace","x-query","query"].includes(e.toLowerCase()))}function ime(t){const e=new Map;return(t.paths?.keys??[]).forEach(n=>{const r=t.paths.nested(n);rme(r.keys).forEach(o=>{const s=r.nested(o),a=s.tags?.get()||[],l=s.summary?.get(),c=s.operationId?.get();(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!1}),e.set(d,h)})});const i=r.additionalOperations?.get();i&&Object.entries(i).forEach(([o,s])=>{const a=s.tags||[],l=s.summary,c=s.operationId;(a.length?a:["Untagged"]).forEach(d=>{const h=e.get(d)??[];h.push({path:n,method:o,summary:l,operationId:c,isAdditionalOperation:!0}),e.set(d,h)})})}),e}function ome({apiId:t,apiTitle:e,tagToOperations:n}){return Array.from(n.entries()).map(([r,i])=>{const o=i.map(s=>({id:c5({apiId:t,method:s.method,path:s.path}),name:s.summary||s.path,apiTitle:e,type:"operation",apiId:t,path:s.path,tagName:r,method:s.method,summary:s.summary,isAdditionalOperation:s.isAdditionalOperation}));return o.length===0?null:{id:`${t}-${r}`,name:r,apiTitle:e,type:"tag",apiId:t,tagName:r,children:o}}).filter(Boolean)}function vD(t){const e=t.id.get(),n=t.info?.title?.get()||e,r=ime(t),i=ome({apiId:e,apiTitle:n,tagToOperations:r});return i.length===0?null:{id:e,name:n,apiTitle:n,type:"api",apiId:e,api:t,children:i}}const c5=({apiId:t,method:e,path:n})=>`${t}-${e.toUpperCase()}-${n}`;function sme(t){const e=t.data.get();switch(e.type){case Ne.Workflow:return`${e.collectionId}/${e.workflowId}`;case Ne.Collection:return e.collectionId;case Ne.Step:return`${e.collectionId}/${e.workflowId}/${e.stepId}`;case Ne.WorkflowRun:return`${e.collectionId}/${e.workflowId}`}}function ame(t){const e=t.data.get();if(e.type!==Ne.Step)return;const{apiId:n,path:r,method:i}=e.draftStep?.operation??{};if(!(!n||!r||!i))return c5({apiId:n,path:r,method:i})}function Wa(t){const e=Je(),n=$p(e);return!n.get()||t&&!pn(n.data.get(),t)?{tab:null,tabDataId:void 0,apiNodeId:void 0}:{tab:n,tabDataId:sme(n),apiNodeId:ame(n)}}const lme=t=>u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M7 13L7.705 12.295L3.915 8.5H14V7.5H3.915L7.705 3.705L7 3L2 8L7 13Z"})}),yD=x(lme).attrs({"data-component-name":"icons/ArrowLeftIcon/ArrowLeftIcon"})`
|
|
1078
1078
|
path {
|
|
1079
1079
|
fill: ${({color:t})=>it(t)};
|
|
1080
1080
|
}
|
|
@@ -1130,7 +1130,7 @@ ${U}`),Z.pop(),`{${te}}`}case"number":return isFinite(I)?String(I):w?w(I):"null"
|
|
|
1130
1130
|
|
|
1131
1131
|
height: ${({size:t})=>t||"16px"};
|
|
1132
1132
|
width: ${({size:t})=>t||"16px"};
|
|
1133
|
-
`;function iM(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function l1e({type:t,formData:e,content:n}){if(Km.includes(t)){const r=iM(e["multipart/form-data"]),i=iM(e["application/x-www-form-urlencoded"]);return!r&&!i}return mae.includes(t)?n.length===0:!0}function oM(t){const{disableCollectionsTab:e}=Nr();return v.useMemo(()=>{const n=[{name:Be.SECURITY,icon:u.jsx(M3,{})},{name:Be.BODY,icon:u.jsx(zp,{})},{name:Be.PATH,icon:u.jsx(rM,{})},{name:Be.QUERY,icon:u.jsx(nM,{})},{name:Be.HEADERS,icon:u.jsx(C5,{})},{name:Be.COOKIES,icon:u.jsx(P5,{})}];return!e.get()&&!t&&n.push({name:Be.STEP_SETTINGS,icon:u.jsx(_u,{})}),n},[e,t])}function Wl(t){return l1e(t.requestBody)?Be.QUERY:Be.BODY}function $5(t){return t.type==="step"}function Q5(t){return t.type==="workflow"}function j5(t,e){const n=[],r=[];for(const i of e)i.active&&Ad(i)?n.push(i):r.push(i);return[...t.map((i,o)=>{const s=n[o]?.id??i.id;return{...i,id:s}}),...r]}function c1e(){return structuredClone({id:crypto.randomUUID(),state:yn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ne.Step,draftStep:as(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function u1e(t){return t!==void 0&&t.data?.type?.get()===Ne.Step}function d1e(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?i5(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function h1e(t,e,n,r,i,o){const s=a=>a??"";return s(t)===r&&s(e)===i&&s(n)===o}const T5="New workflow";function sM({name:t=T5,collection:e}){let n=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||T5).replaceAll(" ","-").toLowerCase();if(!e)return n;const r=p1e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function p1e(t){return t.workflows.filter(e=>e.state.get()!==Tt.Draft).map(e=>e.workflowId.get())}function I5({name:t=T5,isDraft:e=!1,collection:n}={}){return{workflowId:sM({name:t,collection:n}),summary:t,steps:[],state:e?Tt.Draft:Tt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[_i()]}}function f1e(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:o,cookies:s}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...ln([...r,...i,...o,...s],e?.components.parameters.get()),...a])for(const c of Za(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case ee.BasicAuth:case ee.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const w of Za(b))n.add(w);break;case ee.JWT:for(const b of Za(O[O.securityType].token))n.add(b);break;case ee.APIKey:for(const b of Za(O[O.securityType].key))n.add(b);break;case ee.OAuth2:case ee.OpenIDConnect:const y=O[O.securityType];for(const b of Za(y[y.grantType].accessToken))n.add(b);break}const{pathParameters:d,queryParameters:h,headers:p,cookies:f}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...ln([...d,...h,...p,...f],e?.components.parameters.get()),...m])for(const y of Za(O))n.add(y);const g=l.requestBody.get();switch(g.type){case"multipart/form-data":case"application/x-www-form-urlencoded":{for(const{value:O}of g.formData[g.type])for(const y of Za(O))n.add(y);break}case"application/octet-stream":break;default:for(const O of Za(g.content))n.add(O)}}),n}function aM(t,e,n){const r=f1e(t,n);if(r.size===0){t.inputs.set(ft);return}t.inputs.set(i=>{const o=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(s=>{const a=e.inputs.find(l=>l.name.get()===s)?.isSecret;return[s,a?{type:"string",format:"password"}:o[s]||{type:"string"}]}))}})}function qu(t){return t.summary||t.workflowId||"Untitled Workflow"}function lM(t,{collectionId:e,workflowId:n}){return t.collections.find(r=>r.id.get()===e)?.workflows.find(r=>r.workflowId.get()===n)??null}function Ll(){const{apis:t}=Je(),{convertOperationToReplayValue:e}=ir();return{getApiOperation:v.useCallback(n=>OD(t,n,e),[t,e])}}function cM(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function g1e(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),r=cM(n).map(i=>({name:i,value:e.variables.ornull?.[i]?.default.get()||""}));return{url:n,variables:r}}function uM(){const t=Je();function e(n){const r=t.apis.find(s=>s.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:o}=g1e(r);t.environments.forEach(s=>{s.servers.find(a=>a.apiId.get()===n)||s.servers.merge([{apiId:n,value:i,variables:o}])})}return{attachApiServerToEnvironments:e}}const E5="New collection";function R5({name:t=E5,collections:e,isDraft:n=!1}={}){return{id:hM({name:t,collections:e}),srcType:Fr.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?Tt.Draft:Tt.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function dM(t=E5){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function hM({name:t=E5,collections:e}={}){let n=dM(t);if(!e?.length)return n;const r=m1e(e);let i=1;for(;r.includes(n);)n=dM(`${t}-${i}`),i++;return n}function m1e(t){return t.filter(e=>e.state.get()!==Tt.Draft).map(e=>e.id.get())}function pM(t,e){return t.collections.find(n=>n.id.get()===e)??null}function O1e({apiName:t="new-api-source",sourceDescriptions:e}){let n=t.replaceAll(/[\s.]/g,"-").toLowerCase();if(!e.length)return n;const r=e.map(i=>i.name);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Fa(){const t=Je(),{attachApiServerToEnvironments:e}=uM();async function n({collectionId:s,apiId:a}){const l=t.collections.find(c=>c.id.get()===s);if(l){if(!l.sourceDescriptions.get({noproxy:!0}).some(c=>c.apiId===a)){const c=t.apis.find(h=>h.id.get()===a)?.info.title.get(),d=ji(a)?a:await Lt.relative(`/${s}/..`,`/${a}`);l.sourceDescriptions.set(h=>h.some(p=>p.apiId===a)?h:[...h,{name:O1e({apiName:c,sourceDescriptions:h}),url:d,apiId:a}])}e(a)}}function r(s){return pM(t,s)}function i(s,a){const l=s.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);s.sourceDescriptions.set(l)}function o(s,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));s.workflows.forEach(c=>{const d=c.workflowId.get({noproxy:!0});c.steps.forEach(h=>{const p=h.stepId.get({noproxy:!0}),f=`${d}\0${p}`;if(!l.has(f))return;const m=h.operation.get({noproxy:!0});m&&(h.xOperation.set({method:m.method,url:m.path}),h.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:o}}function Nu(t){const e=Je();return t?e.collections.find(n=>n.id.get()===t)??null:null}const xr={all:["history"],lists:()=>[...xr.all,"list"],list:t=>[...xr.lists(),t],recent:(t,e)=>[...xr.all,"recent",t,e],detail:t=>[...xr.all,"detail",t],count:t=>[...xr.all,"count",t]};class fM{storage;constructor(e){this.storage=e}async initialize(){await this.storage.initialize()}getAll(e){return this.storage.read(e)}getRecent(e=50,n){return this.storage.getRecent(e,n)}getById(e){return this.storage.getById(e)}addItem(e){return this.storage.addItem(e)}updateItem(e,n){return this.storage.updateItem(e,n)}deleteItem(e){return this.storage.deleteItem(e)}clear(){return this.storage.clear()}count(e){return this.storage.count(e)}}const A5=(t,e)=>e.some(n=>t instanceof n);let gM,mM;function v1e(){return gM||(gM=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function y1e(){return mM||(mM=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const D5=new WeakMap,M5=new WeakMap,f1=new WeakMap;function b1e(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",o),t.removeEventListener("error",s)},o=()=>{n(Yl(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",o),t.addEventListener("error",s)});return f1.set(e,t),e}function x1e(t){if(D5.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",o),t.removeEventListener("error",s),t.removeEventListener("abort",s)},o=()=>{n(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",o),t.addEventListener("error",s),t.addEventListener("abort",s)});D5.set(t,e)}let z5={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return D5.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Yl(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function OM(t){z5=t(z5)}function w1e(t){return y1e().includes(t)?function(...e){return t.apply(_5(this),e),Yl(this.request)}:function(...e){return Yl(t.apply(_5(this),e))}}function S1e(t){return typeof t=="function"?w1e(t):(t instanceof IDBTransaction&&x1e(t),A5(t,v1e())?new Proxy(t,z5):t)}function Yl(t){if(t instanceof IDBRequest)return b1e(t);if(M5.has(t))return M5.get(t);const e=S1e(t);return e!==t&&(M5.set(t,e),f1.set(e,t)),e}const _5=t=>f1.get(t);function k1e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(t,e),a=Yl(s);return r&&s.addEventListener("upgradeneeded",l=>{r(Yl(s.result),l.oldVersion,l.newVersion,Yl(s.transaction),l)}),n&&s.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const P1e=["get","getKey","getAll","getAllKeys","count"],C1e=["put","add","delete","clear"],q5=new Map;function vM(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(q5.get(e))return q5.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=C1e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||P1e.includes(n)))return;const o=async function(s,...a){const l=this.transaction(s,i?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&l.done]))[0]};return q5.set(e,o),o}OM(t=>({...t,get:(e,n,r)=>vM(e,n)||t.get(e,n,r),has:(e,n)=>!!vM(e,n)||t.has(e,n)}));const $1e=["continue","continuePrimaryKey","advance"],yM={},N5=new WeakMap,bM=new WeakMap,Q1e={get(t,e){if(!$1e.includes(e))return t[e];let n=yM[e];return n||(n=yM[e]=function(...r){N5.set(this,bM.get(this)[e](...r))}),n}};async function*j1e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,Q1e);for(bM.set(n,e),f1.set(n,_5(e));e;)yield n,e=await(N5.get(n)||e.continue()),N5.delete(n)}function xM(t,e){return e===Symbol.asyncIterator&&A5(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&A5(t,[IDBIndex,IDBObjectStore])}OM(t=>({...t,get(e,n,r){return xM(e,n)?j1e:t.get(e,n,r)},has(e,n){return xM(e,n)||t.has(e,n)}}));class j3{constructor(e,n,r){this.dbName=e,this.version=n,this.setupCallback=r}dbName;version;setupCallback;db=null;static createInstance(e,n,r){return new j3(e,n,r)}async initialize(){this.db||(this.db=await k1e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const T1e=1;class T3{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=j3.createInstance(n,T1e,this.setupDatabase);return new T3(r)}static setupDatabase(e){if(!e.objectStoreNames.contains("history")){const n=e.createObjectStore("history",{keyPath:"id"});n.createIndex("by-date","date"),n.createIndex("by-type","type"),n.createIndex("by-workflow","workflowId")}}get storeName(){return"history"}async getDb(){return await this.indexedDB.initialize(),this.indexedDB.db}async initialize(){await this.indexedDB.initialize()}async read(e){const n=(await this.getDb()).transaction(this.storeName,"readonly"),r=e?.type?await n.store.index("by-type").getAll(e.type):await n.store.index("by-date").getAll();return await n.done,r.sort((i,o)=>o.date-i.date)}async addItem(e){await(await this.getDb()).put(this.storeName,e)}async updateItem(e,n){const r=await this.getDb(),i=await r.get(this.storeName,e);if(i){const{id:o,type:s,...a}=n;await r.put(this.storeName,{...i,...a})}}async deleteItem(e){await(await this.getDb()).delete(this.storeName,e)}async clear(){await(await this.getDb()).clear(this.storeName)}async getById(e){return await(await this.getDb()).get(this.storeName,e)||null}async getRecent(e,n){const r=(await this.getDb()).transaction(this.storeName,"readonly"),i=n?.type?await r.store.index("by-type").getAll(n.type):await r.store.index("by-date").getAll();return await r.done,i.sort((o,s)=>s.date-o.date).slice(0,e)}async count(e){const n=await this.getDb();if(e?.type){const r=n.transaction(this.storeName,"readonly"),i=await r.store.index("by-type").count(e.type);return await r.done,i}return await n.count(this.storeName)}}function I1e(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const E1e=2;function R1e(t){const e=JSON.parse(t);let n;return e.version===1?n=I1e(e):n=e,n.version!==E1e&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const Z5="history.json",A1e="history.json.backup";class D1e{static async migrateFromStorage(e,n,r){try{const i=await e.get(Z5);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const o=R1e(i);if(o.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,o);try{await e.rename(Z5,A1e)}catch{await e.remove(Z5)}return console.log(`Migrated ${o.length} history items from ${r}`),{migrated:!0,itemCount:o.length}}catch(i){const o=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,o),{migrated:!1,itemCount:0,error:o}}}static async bulkInsert(e,n){for(let r=0;r<n.length;r+=100){const i=n.slice(r,r+100);await Promise.all(i.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await import("./redocly-openapi-docs.min.TauriFileSystemAdapter-CHW6hO3z.js"),o=new i(e.systemFilesDir);return this.migrateFromStorage(o,n,"JSON file")}else{const i=new yy(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Ba{static instance=null;static async initialize(e,n){this.close(),this.instance=await M1e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function M1e(t,e){if(e){const{HistorySqliteDBStorage:n}=await import("./redocly-openapi-docs.min.HistorySqliteDBStorage-DYnaxLim.js"),r=kp.getInstance(),i=new n(r);return new fM(i)}else{const n=T3.create(t.id);return new fM(n)}}function z1e(t){return tg({queryKey:xr.list(t),queryFn:async()=>Ba.getInstance().getAll(t)})}function wM(){const t=fa();return ng({mutationFn:async e=>{await Ba.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(xr.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:xr.lists()}),t.invalidateQueries({queryKey:xr.count()})},onError:(e,n)=>{t.removeQueries({queryKey:xr.detail(n.id)}),console.error("Failed to add history item:",e)}})}function _1e(){const t=fa();return ng({mutationFn:async e=>{await Ba.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:xr.detail(n)}),t.invalidateQueries({queryKey:xr.lists()}),t.invalidateQueries({queryKey:xr.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function q1e(){const t=fa();return ng({mutationFn:async()=>{await Ba.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:xr.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function N1e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function Z1e(){const t=wM();return v.useCallback(({step:e,response:n})=>{const r=N1e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function X1e(){const t=wM();return v.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function V1e(){const t=fa();async function e(n){return t.ensureQueryData({queryKey:xr.detail(n),queryFn:()=>Ba.getInstance().getById(n)})}return{getHistoryItem:e}}function X5(){const t=Je();return{getStep:e=>i5(t,e)}}function U1e({collectionId:t,workflowId:e,stepId:n}){const r=Je().collections.find(o=>o.id.get()===t);if(!r)return null;const i=r.workflows.find(o=>o.workflowId.get()===e);return i?i.steps.find(o=>o.stepId.get()===n)??null:null}function V5(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null;return U1e({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull||null}function g1(){const t=Je();return{getWorkflow:({collectionId:e,workflowId:n})=>lM(t,{collectionId:e,workflowId:n})}}function Ga({collectionId:t,workflowId:e}){const n=Je().collections.find(r=>r.id.get()===t);return n?n.workflows.find(r=>r.workflowId.get()===e)??null:null}function U5(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const W1e=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function L1e(){const{project:{userFilesDir:t}}=Je(),{certificates:e}=Nr(),n=_t(),{getCollection:r}=Fa();return{execute:async(i,o,s)=>{const a=r(i),l=t.get(),{inputs:c,servers:d}=n.get(),h=a?.sourceDescriptions.get()??[],p=`${l}/${i}`,[{createConfig:f},{ExternalResolver:m}]=await Promise.all([import("./redocly-openapi-docs.min.index-DLlCa16R.js"),import("./redocly-openapi-docs.min.external-resolver-BH7DBWU-.js")]),g=new m,O=c.map(P=>JSON.stringify({[P.name]:P.value})),y=Y1e(d,h),{run:b}=await import("./redocly-openapi-docs.min.respect-run-CWNqYysq.js"),w=await b({files:[p],workflow:o?[o]:[],fetch:(P,S)=>{const C=W1e(P),{clientCert:$,clientKey:Q}=iD(C,e?e.get({noproxy:!0}):[]);return ls(C,{...S,clientCert:$,clientKey:Q})},logger:BO,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async P=>{if(!await Xw(P))throw new Error(`File ${P} doesn't exist or isn't readable.`);try{const S=await Zw(P),C=new TextEncoder().encode(S);return new File([C],await qw(P))}catch(S){throw new Error(`Failed to read file ${P}: ${S}`)}}},envVariables:{},config:await f({}),externalRefResolver:g,input:O,server:y,severity:JSON.stringify(s),skipLint:!0,noSecretsMasking:!0});try{await uge(i,o,w?.[0]?.ctx)}catch(P){console.error("Failed to persist workflow step context:",P)}return w}}}function Y1e(t,e){return e.map(n=>{const r=t.find(o=>o.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const o of r.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const F1e="com.redocly.tab.openFailed";function Zu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ne.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function W5(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function B1e(t,e){const n=t.draftStep.ornull,r=n?.xOperation.ornull;if(!(!n||!r)){if(e.url&&r.url.get()!==e.url){r.url.set(e.url);const i=n.parameters.queryParameters.get({noproxy:!0});n.parameters.queryParameters.set(j5(Kd(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function Dn(){const{activeTabIdx:t,tabs:e}=Na(),{dynamicReplayValues:n}=ir(),{getStep:r}=X5(),{getHistoryItem:i}=V1e(),{getWorkflow:o}=g1(),{getCollection:s}=Fa(),{getApiOperation:a}=Ll(),{sendEvent:l}=Ue(),c=_t(),d=v.useCallback((E,_,A,q)=>{console.warn(`[useTabHandlers] ${E}`,q),l(F1e,[{...pe("tab",_),reason:A,...q}])},[l]),h=v.useCallback((E,_)=>{const A=e[E];A&&A.ornull!==null&&A.state&&A.state.set(_)},[e]),p=v.useCallback(E=>{t.set(E)},[t]),f=v.useCallback(()=>{e.merge([c1e()]),t.set(e.length-1)},[e,t]),m=v.useCallback(E=>{const _=[...e.get({noproxy:!0}).filter(q=>q.state!==yn.Preview)];_.push(E),e.set(_);const A=_.length-1;return t.set(A),A},[e,t]),g=v.useCallback(E=>{const _=a(E),A=L5(E,_,n);m(A)},[m,n,a]),O=v.useCallback((E,_)=>{const A=e.get(),q=N=>A.findIndex(({data:L})=>pn(L,Ne.Step)&&N(L)),I=N=>e[N].data;if(_){const N=q(U=>U.sourceFile===_);if(N!==-1){B1e(I(N),E),p(N);return}const L=q(U=>!U.sourceFile&&W5(U,E));if(L!==-1){I(L).merge({sourceFile:_}),p(L);return}}else{const N=q(L=>W5(L,E));if(N!==-1){p(N);return}}const Z=as({xOperation:E,name:_??void 0});m({id:crypto.randomUUID(),state:yn.Normal,data:Zu({draftStep:Z,activeTabName:Wl(Z),sourceFile:_??null})})},[e,p,m]),y=v.useCallback(async E=>{t.set(Math.max(0,E-1)),await new Promise(_=>setTimeout(()=>{e[E].set(ft),_()}))},[t,e]),b=v.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function w({collectionId:E,workflowId:_,stepId:A}){const q=e.get({noproxy:!0}),I=new Set;for(let Z=0;Z<q.length;Z++){const N=q[Z].data;switch(N.type){case Ne.Step:N.collectionId===E&&N.workflowId===_&&N.stepId===A&&I.add(Z);break;case Ne.Workflow:case Ne.WorkflowRun:N.collectionId===E&&N.workflowId===_&&!A&&I.add(Z);break;case Ne.Collection:N.collectionId===E&&!_&&!A&&I.add(Z);break}}I.size&&(e.merge(Object.fromEntries(I.values().map(Z=>[Z,ft]))),t.set(0))}const P=v.useCallback(async E=>{const _=e.get().find(({data:A})=>pn(A,Ne.Step)&&A.historyId===E);if(_)t.set(e.get().indexOf(_));else{const A=await i(E);if(!A||!$5(A)){d("Step history not found","stepHistoryTab","step_history_not_found",{historyId:E});return}const q=A.step;m({id:crypto.randomUUID(),state:yn.Preview,data:Zu({historyId:E,draftStep:structuredClone(q),response:structuredClone(A.response),activeTabName:Wl(q)})})}},[t,e,m,i,d]),S=v.useCallback(({collectionId:E,activeTabName:_})=>{const A=e.findIndex(q=>{const I=q.data.get();return pn(I,Ne.Collection)&&I.collectionId===E});if(A!==-1)t.set(A);else{if(!s(E)){d("Collection not found","collectionTab","collection_not_found",{collectionId:E});return}m({id:crypto.randomUUID(),state:yn.Preview,data:{collectionId:E,type:Ne.Collection,activeTabName:_??Be.COLLECTION_SETTINGS}})}},[t,e,m,s,d]),C=v.useCallback(({collectionId:E,workflowId:_})=>{if(!o({collectionId:E,workflowId:_})){d("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:E,workflowId:_});return}m({id:crypto.randomUUID(),state:yn.Normal,data:{collectionId:E,workflowId:_,historyId:null,runDate:null,type:Ne.WorkflowRun,result:null,severitySettings:U5()}})},[m,o,d]),$=v.useCallback(async(E,{state:_=yn.Preview}={})=>{const A=e.get().find(({data:q})=>pn(q,Ne.WorkflowRun)&&q.historyId===E);if(A){const q=e.get().indexOf(A);_===yn.Normal&&A.state===yn.Preview&&h(q,yn.Normal),t.set(q)}else{const q=await i(E);if(!q||!Q5(q)){d("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:E});return}m({id:crypto.randomUUID(),state:_,data:{collectionId:q.collectionId,workflowId:q.workflowId,historyId:E,runDate:q.date,type:Ne.WorkflowRun,result:structuredClone(q.workflowResult),severitySettings:U5(),label:qu(q.workflow),secretValues:c.get().inputs.filter(I=>I.isSecret&&I.value).map(I=>String(I.value))}})}},[t,e,m,h,i,d,c]),Q=v.useCallback(({collectionId:E,workflowId:_,activeTabName:A})=>{const q=e.findIndex(I=>{const Z=I.data.get();return pn(Z,Ne.Workflow)&&Z.workflowId===_&&Z.collectionId===E});if(q!==-1){const I=e[q].data;A&&I.activeTabName.set(A),t.set(q)}else{if(!o({collectionId:E,workflowId:_})){d("Workflow not found","workflowTab","workflow_not_found",{collectionId:E,workflowId:_});return}m({id:crypto.randomUUID(),state:yn.Preview,data:{collectionId:E,workflowId:_,type:Ne.Workflow,activeTabName:A??Be.WORKFLOW_SETTINGS}})}},[t,e,m,o,d]),T=v.useCallback(({collectionId:E,workflowId:_,stepId:A,state:q})=>{const I=e.get().find(({data:Z})=>pn(Z,Ne.Step)&&Z.collectionId===E&&Z.workflowId===_&&Z.stepId===A&&Z.historyId===null);if(I)t.set(e.get().indexOf(I));else{const Z=r({collectionId:E,workflowId:_,stepId:A});if(!Z){d("Step not found","stepTab","step_not_found",{collectionId:E,workflowId:_,stepId:A});return}const N=Z.get({noproxy:!0});m({id:crypto.randomUUID(),state:q??yn.Preview,data:Zu({stepId:A,collectionId:E,workflowId:_,activeTabName:Wl(N)})})}},[t,e,r,m,d]),z=v.useCallback(({step:E})=>{m({id:crypto.randomUUID(),state:yn.Normal,data:Zu({stepId:E.stepId??null,workflowId:E.workflowId??null,draftStep:structuredClone(E),activeTabName:Wl(E)})})},[m]),M=v.useCallback((E,_)=>{if(E===_)return;const A=t.get(),q=[...e.get({noproxy:!0})],I=q[A]?.id,[Z]=q.splice(E,1);if(q.splice(_,0,Z),e.set(q),I){const N=q.findIndex(L=>L.id===I);t.set(N)}},[t,e]);return{handleNewTabOpen:f,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:p,handleTabClose:y,handleCloseAllTabs:b,handleCloseByDataId:w,openCollectionTab:S,openWorkflowTab:Q,openWorkflowRunTab:C,openWorkflowRunTabFromHistory:$,openStepTabFromHistory:P,openStepTabFromCollection:T,openStepTab:z,handleTabReorder:M,changeTabState:h}}function L5(t,e,n){const r=as({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:yn.Preview,data:Zu({draftStep:r,activeTabName:Wl(r)})}}function G1e(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const H1e=({transform:t})=>({...t,y:0}),K1e=({transform:t,draggingNodeRect:e,containerNodeRect:n})=>!e||!n?t:{...t,x:Math.max(n.left-e.left,Math.min(t.x,n.right-e.right))},Fl=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,J1e=t=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[u.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),u.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),m1=x(J1e)`
|
|
1133
|
+
`;function iM(t){return t.some(e=>!!(e.key||e.value||e.files?.length))}function l1e({type:t,formData:e,content:n}){if(Km.includes(t)){const r=iM(e["multipart/form-data"]),i=iM(e["application/x-www-form-urlencoded"]);return!r&&!i}return mae.includes(t)?n.length===0:!0}function oM(t){const{disableCollectionsTab:e}=Nr();return v.useMemo(()=>{const n=[{name:Be.SECURITY,icon:u.jsx(M3,{})},{name:Be.BODY,icon:u.jsx(zp,{})},{name:Be.PATH,icon:u.jsx(rM,{})},{name:Be.QUERY,icon:u.jsx(nM,{})},{name:Be.HEADERS,icon:u.jsx(C5,{})},{name:Be.COOKIES,icon:u.jsx(P5,{})}];return!e.get()&&!t&&n.push({name:Be.STEP_SETTINGS,icon:u.jsx(_u,{})}),n},[e,t])}function Wl(t){return l1e(t.requestBody)?Be.QUERY:Be.BODY}function $5(t){return t.type==="step"}function Q5(t){return t.type==="workflow"}function j5(t,e){const n=[],r=[];for(const i of e)i.active&&Ad(i)?n.push(i):r.push(i);return[...t.map((i,o)=>{const s=n[o]?.id??i.id;return{...i,id:s}}),...r]}function c1e(){return structuredClone({id:crypto.randomUUID(),state:yn.Normal,data:{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ne.Step,draftStep:as(),response:null,activeTabIdx:0,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0}})}function u1e(t){return t!==void 0&&t.data?.type?.get()===Ne.Step}function d1e(t,e){const n=e.data.collectionId.get(),r=e.data.workflowId.get(),i=e.data.stepId.get();return n&&r&&i?i5(t,{collectionId:n,workflowId:r,stepId:i})??e.data.draftStep.ornull:e.data.draftStep.ornull}function h1e(t,e,n,r,i,o){const s=a=>a??"";return s(t)===r&&s(e)===i&&s(n)===o}const T5="New workflow";function sM({name:t=T5,collection:e}){let n=(t.trim().replace(/[^a-zA-Z0-9\-_\s]/g,"").replace(/\s+/g," ")||T5).replaceAll(" ","-").toLowerCase();if(!e)return n;const r=p1e(e);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function p1e(t){return t.workflows.filter(e=>e.state.get()!==Tt.Draft).map(e=>e.workflowId.get())}function I5({name:t=T5,isDraft:e=!1,collection:n}={}){return{workflowId:sM({name:t,collection:n}),summary:t,steps:[],state:e?Tt.Draft:Tt.Normal,outputs:[],parameters:{pathParameters:[],queryParameters:[],headers:[],cookies:[]},security:[_i()]}}function f1e(t,e){const n=new Set,{pathParameters:r,queryParameters:i,headers:o,cookies:s}=t.parameters.get(),a=t.outputs.get();for(const{value:l}of[...ln([...r,...i,...o,...s],e?.components.parameters.get()),...a])for(const c of Za(l))n.add(c);return t.steps.forEach(l=>{const c=l.security.get();for(const O of c)switch(O.securityType){case ee.BasicAuth:case ee.DigestAuth:for(const b of[O[O.securityType].username,O[O.securityType].password])for(const w of Za(b))n.add(w);break;case ee.JWT:for(const b of Za(O[O.securityType].token))n.add(b);break;case ee.APIKey:for(const b of Za(O[O.securityType].key))n.add(b);break;case ee.OAuth2:case ee.OpenIDConnect:const y=O[O.securityType];for(const b of Za(y[y.grantType].accessToken))n.add(b);break}const{pathParameters:d,queryParameters:h,headers:p,cookies:f}=l.parameters.get(),m=l.outputs.get();for(const{value:O}of[...ln([...d,...h,...p,...f],e?.components.parameters.get()),...m])for(const y of Za(O))n.add(y);const g=l.requestBody.get();switch(g.type){case"multipart/form-data":case"application/x-www-form-urlencoded":{for(const{value:O}of g.formData[g.type])for(const y of Za(O))n.add(y);break}case"application/octet-stream":break;default:for(const O of Za(g.content))n.add(O)}}),n}function aM(t,e,n){const r=f1e(t,n);if(r.size===0){t.inputs.set(ft);return}t.inputs.set(i=>{const o=typeof i=="object"&&i?.properties||{};return{type:"object",properties:Object.fromEntries(Array.from(r).map(s=>{const a=e.inputs.find(l=>l.name.get()===s)?.isSecret;return[s,a?{type:"string",format:"password"}:o[s]||{type:"string"}]}))}})}function qu(t){return t.summary||t.workflowId||"Untitled Workflow"}function lM(t,{collectionId:e,workflowId:n}){return t.collections.find(r=>r.id.get()===e)?.workflows.find(r=>r.workflowId.get()===n)??null}function Ll(){const{apis:t}=Je(),{convertOperationToReplayValue:e}=ir();return{getApiOperation:v.useCallback(n=>OD(t,n,e),[t,e])}}function cM(t){const e=(t.match(/{([^}]+)}/g)||[]).map(n=>n.slice(1,-1));return Array.from(new Set(e))}function g1e(t){const e=t.servers.ornull?.[0];if(!e)return{url:"",variables:[]};const n=e.url.get(),r=cM(n).map(i=>({name:i,value:e.variables.ornull?.[i]?.default.get()||""}));return{url:n,variables:r}}function uM(){const t=Je();function e(n){const r=t.apis.find(s=>s.id.get()===n);if(!r){console.error(`API ${n} not found`);return}const{url:i,variables:o}=g1e(r);t.environments.forEach(s=>{s.servers.find(a=>a.apiId.get()===n)||s.servers.merge([{apiId:n,value:i,variables:o}])})}return{attachApiServerToEnvironments:e}}const E5="New collection";function R5({name:t=E5,collections:e,isDraft:n=!1}={}){return{id:hM({name:t,collections:e}),srcType:Fr.FS,arazzo:"1.0.1",info:{version:"1.0.0",title:t},workflows:[],state:n?Tt.Draft:Tt.Normal,components:{inputs:{},parameters:{}},sourceDescriptions:[]}}function dM(t=E5){return`collections/${t.replaceAll(" ","-").toLowerCase()}.arazzo.yaml`}function hM({name:t=E5,collections:e}={}){let n=dM(t);if(!e?.length)return n;const r=m1e(e);let i=1;for(;r.includes(n);)n=dM(`${t}-${i}`),i++;return n}function m1e(t){return t.filter(e=>e.state.get()!==Tt.Draft).map(e=>e.id.get())}function pM(t,e){return t.collections.find(n=>n.id.get()===e)??null}function O1e({apiName:t="new-api-source",sourceDescriptions:e}){let n=t.replaceAll(/[\s.]/g,"-").toLowerCase();if(!e.length)return n;const r=e.map(i=>i.name);if(r.includes(n)){let i=1;for(;r.includes(`${n}-${i}`);)i++;n=`${n}-${i}`}return n}function Fa(){const t=Je(),{attachApiServerToEnvironments:e}=uM();async function n({collectionId:s,apiId:a}){const l=t.collections.find(c=>c.id.get()===s);if(l){if(!l.sourceDescriptions.get({noproxy:!0}).some(c=>c.apiId===a)){const c=t.apis.find(h=>h.id.get()===a)?.info.title.get(),d=ji(a)?a:await Lt.relative(`/${s}/..`,`/${a}`);l.sourceDescriptions.set(h=>h.some(p=>p.apiId===a)?h:[...h,{name:O1e({apiName:c,sourceDescriptions:h}),url:d,apiId:a}])}e(a)}}function r(s){return pM(t,s)}function i(s,a){const l=s.sourceDescriptions.get({noproxy:!0}).filter(c=>a.name!==c.name);s.sourceDescriptions.set(l)}function o(s,a){const l=new Set(a.map(c=>`${c.workflowId??""}\0${c.stepId}`));s.workflows.forEach(c=>{const d=c.workflowId.get({noproxy:!0});c.steps.forEach(h=>{const p=h.stepId.get({noproxy:!0}),f=`${d}\0${p}`;if(!l.has(f))return;const m=h.operation.get({noproxy:!0});m&&(h.xOperation.set({method:m.method,url:m.path}),h.operation.set(null))})})}return{attachApiToCollection:n,getCollection:r,removeSourceDescription:i,disconnectStepsFromSource:o}}function Nu(t){const e=Je();return t?e.collections.find(n=>n.id.get()===t)??null:null}const xr={all:["history"],lists:()=>[...xr.all,"list"],list:t=>[...xr.lists(),t],recent:(t,e)=>[...xr.all,"recent",t,e],detail:t=>[...xr.all,"detail",t],count:t=>[...xr.all,"count",t]};class fM{storage;constructor(e){this.storage=e}async initialize(){await this.storage.initialize()}getAll(e){return this.storage.read(e)}getRecent(e=50,n){return this.storage.getRecent(e,n)}getById(e){return this.storage.getById(e)}addItem(e){return this.storage.addItem(e)}updateItem(e,n){return this.storage.updateItem(e,n)}deleteItem(e){return this.storage.deleteItem(e)}clear(){return this.storage.clear()}count(e){return this.storage.count(e)}}const A5=(t,e)=>e.some(n=>t instanceof n);let gM,mM;function v1e(){return gM||(gM=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function y1e(){return mM||(mM=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const D5=new WeakMap,M5=new WeakMap,f1=new WeakMap;function b1e(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",o),t.removeEventListener("error",s)},o=()=>{n(Yl(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",o),t.addEventListener("error",s)});return f1.set(e,t),e}function x1e(t){if(D5.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",o),t.removeEventListener("error",s),t.removeEventListener("abort",s)},o=()=>{n(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",o),t.addEventListener("error",s),t.addEventListener("abort",s)});D5.set(t,e)}let z5={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return D5.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Yl(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function OM(t){z5=t(z5)}function w1e(t){return y1e().includes(t)?function(...e){return t.apply(_5(this),e),Yl(this.request)}:function(...e){return Yl(t.apply(_5(this),e))}}function S1e(t){return typeof t=="function"?w1e(t):(t instanceof IDBTransaction&&x1e(t),A5(t,v1e())?new Proxy(t,z5):t)}function Yl(t){if(t instanceof IDBRequest)return b1e(t);if(M5.has(t))return M5.get(t);const e=S1e(t);return e!==t&&(M5.set(t,e),f1.set(e,t)),e}const _5=t=>f1.get(t);function k1e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(t,e),a=Yl(s);return r&&s.addEventListener("upgradeneeded",l=>{r(Yl(s.result),l.oldVersion,l.newVersion,Yl(s.transaction),l)}),n&&s.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const P1e=["get","getKey","getAll","getAllKeys","count"],C1e=["put","add","delete","clear"],q5=new Map;function vM(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(q5.get(e))return q5.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=C1e.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||P1e.includes(n)))return;const o=async function(s,...a){const l=this.transaction(s,i?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&l.done]))[0]};return q5.set(e,o),o}OM(t=>({...t,get:(e,n,r)=>vM(e,n)||t.get(e,n,r),has:(e,n)=>!!vM(e,n)||t.has(e,n)}));const $1e=["continue","continuePrimaryKey","advance"],yM={},N5=new WeakMap,bM=new WeakMap,Q1e={get(t,e){if(!$1e.includes(e))return t[e];let n=yM[e];return n||(n=yM[e]=function(...r){N5.set(this,bM.get(this)[e](...r))}),n}};async function*j1e(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const n=new Proxy(e,Q1e);for(bM.set(n,e),f1.set(n,_5(e));e;)yield n,e=await(N5.get(n)||e.continue()),N5.delete(n)}function xM(t,e){return e===Symbol.asyncIterator&&A5(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&A5(t,[IDBIndex,IDBObjectStore])}OM(t=>({...t,get(e,n,r){return xM(e,n)?j1e:t.get(e,n,r)},has(e,n){return xM(e,n)||t.has(e,n)}}));class j3{constructor(e,n,r){this.dbName=e,this.version=n,this.setupCallback=r}dbName;version;setupCallback;db=null;static createInstance(e,n,r){return new j3(e,n,r)}async initialize(){this.db||(this.db=await k1e(this.dbName,this.version,{upgrade:e=>{this.setupCallback(e)}}))}async close(){this.db&&(this.db.close(),this.db=null)}}const T1e=1;class T3{constructor(e){this.indexedDB=e}indexedDB;static create(e){const n=`replay-history-${e}`,r=j3.createInstance(n,T1e,this.setupDatabase);return new T3(r)}static setupDatabase(e){if(!e.objectStoreNames.contains("history")){const n=e.createObjectStore("history",{keyPath:"id"});n.createIndex("by-date","date"),n.createIndex("by-type","type"),n.createIndex("by-workflow","workflowId")}}get storeName(){return"history"}async getDb(){return await this.indexedDB.initialize(),this.indexedDB.db}async initialize(){await this.indexedDB.initialize()}async read(e){const n=(await this.getDb()).transaction(this.storeName,"readonly"),r=e?.type?await n.store.index("by-type").getAll(e.type):await n.store.index("by-date").getAll();return await n.done,r.sort((i,o)=>o.date-i.date)}async addItem(e){await(await this.getDb()).put(this.storeName,e)}async updateItem(e,n){const r=await this.getDb(),i=await r.get(this.storeName,e);if(i){const{id:o,type:s,...a}=n;await r.put(this.storeName,{...i,...a})}}async deleteItem(e){await(await this.getDb()).delete(this.storeName,e)}async clear(){await(await this.getDb()).clear(this.storeName)}async getById(e){return await(await this.getDb()).get(this.storeName,e)||null}async getRecent(e,n){const r=(await this.getDb()).transaction(this.storeName,"readonly"),i=n?.type?await r.store.index("by-type").getAll(n.type):await r.store.index("by-date").getAll();return await r.done,i.sort((o,s)=>s.date-o.date).slice(0,e)}async count(e){const n=await this.getDb();if(e?.type){const r=n.transaction(this.storeName,"readonly"),i=await r.store.index("by-type").count(e.type);return await r.done,i}return await n.count(this.storeName)}}function I1e(t){return{data:t.data.map(e=>({...e,step:{...e.step,security:e.step.security.securities}})),version:2}}const E1e=2;function R1e(t){const e=JSON.parse(t);let n;return e.version===1?n=I1e(e):n=e,n.version!==E1e&&console.warn(`Unknown history version ${n.version}, attempting migration anyway`),n.data.map(r=>({...r,type:"step"}))}const Z5="history.json",A1e="history.json.backup";class D1e{static async migrateFromStorage(e,n,r){try{const i=await e.get(Z5);if(!i||i.trim()==="")return{migrated:!1,itemCount:0};const o=R1e(i);if(o.length===0)return console.log(`No history items found in ${r}`),{migrated:!1,itemCount:0};await this.bulkInsert(n,o);try{await e.rename(Z5,A1e)}catch{await e.remove(Z5)}return console.log(`Migrated ${o.length} history items from ${r}`),{migrated:!0,itemCount:o.length}}catch(i){const o=i instanceof Error?i.message:"Unknown error";return console.error(`History migration from ${r} failed:`,o),{migrated:!1,itemCount:0,error:o}}}static async bulkInsert(e,n){for(let r=0;r<n.length;r+=100){const i=n.slice(r,r+100);await Promise.all(i.map(o=>e.addItem(o)))}}static async migrate(e,n,r){if(r){const{TauriFileSystemAdapter:i}=await import("./redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js"),o=new i(e.systemFilesDir);return this.migrateFromStorage(o,n,"JSON file")}else{const i=new yy(e.systemFilesDir);return this.migrateFromStorage(i,n,"localStorage")}}}class Ba{static instance=null;static async initialize(e,n){this.close(),this.instance=await M1e(e,n)}static getInstance(){if(!this.instance)throw new Error("HistoryService not initialized");return this.instance}static close(){this.instance=null}}async function M1e(t,e){if(e){const{HistorySqliteDBStorage:n}=await import("./redocly-openapi-docs.min.HistorySqliteDBStorage-DYnaxLim.js"),r=kp.getInstance(),i=new n(r);return new fM(i)}else{const n=T3.create(t.id);return new fM(n)}}function z1e(t){return tg({queryKey:xr.list(t),queryFn:async()=>Ba.getInstance().getAll(t)})}function wM(){const t=fa();return ng({mutationFn:async e=>{await Ba.getInstance().addItem(e)},onMutate:e=>{t.setQueryData(xr.detail(e.id),e)},onSuccess:()=>{t.invalidateQueries({queryKey:xr.lists()}),t.invalidateQueries({queryKey:xr.count()})},onError:(e,n)=>{t.removeQueries({queryKey:xr.detail(n.id)}),console.error("Failed to add history item:",e)}})}function _1e(){const t=fa();return ng({mutationFn:async e=>{await Ba.getInstance().deleteItem(e)},onSuccess:(e,n)=>{t.removeQueries({queryKey:xr.detail(n)}),t.invalidateQueries({queryKey:xr.lists()}),t.invalidateQueries({queryKey:xr.count()})},onError:(e,n)=>{console.error(`Failed to delete history item ${n}:`,e)}})}function q1e(){const t=fa();return ng({mutationFn:async()=>{await Ba.getInstance().clear()},onSuccess:()=>{t.invalidateQueries({queryKey:xr.all})},onError:e=>{console.error("Failed to clear history:",e)}})}function N1e(t){return t?{...t,bodyNotStored:!0,body:"",arrayBuffer:new ArrayBuffer(0)}:null}function Z1e(){const t=wM();return v.useCallback(({step:e,response:n})=>{const r=N1e(n),i={id:crypto.randomUUID(),date:Date.now(),type:"step",step:e,response:r,statusCode:n?.status??null};t.mutate(i)},[t])}function X1e(){const t=wM();return v.useCallback(async({workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s})=>{const a=crypto.randomUUID(),l={id:a,date:Date.now(),type:"workflow",workflowId:e,collectionId:n,workflow:r,workflowResult:i,success:o,durationMs:s};try{return await t.mutateAsync(l),a}catch{return null}},[t])}function V1e(){const t=fa();async function e(n){return t.ensureQueryData({queryKey:xr.detail(n),queryFn:()=>Ba.getInstance().getById(n)})}return{getHistoryItem:e}}function X5(){const t=Je();return{getStep:e=>i5(t,e)}}function U1e({collectionId:t,workflowId:e,stepId:n}){const r=Je().collections.find(o=>o.id.get()===t);if(!r)return null;const i=r.workflows.find(o=>o.workflowId.get()===e);return i?i.steps.find(o=>o.stepId.get()===n)??null:null}function V5(t){const e=t?.collectionId.get()??null,n=t?.workflowId.get()??null,r=t?.stepId.get()??null;return U1e({collectionId:e,workflowId:n,stepId:r})||t?.draftStep.ornull||null}function g1(){const t=Je();return{getWorkflow:({collectionId:e,workflowId:n})=>lM(t,{collectionId:e,workflowId:n})}}function Ga({collectionId:t,workflowId:e}){const n=Je().collections.find(r=>r.id.get()===t);return n?n.workflows.find(r=>r.workflowId.get()===e)??null:null}function U5(){return{STATUS_CODE_CHECK:"error",SCHEMA_CHECK:"error",CONTENT_TYPE_CHECK:"error"}}const W1e=t=>t instanceof URL?t.toString():t instanceof Request?t.url:t;function L1e(){const{project:{userFilesDir:t}}=Je(),{certificates:e}=Nr(),n=_t(),{getCollection:r}=Fa();return{execute:async(i,o,s)=>{const a=r(i),l=t.get(),{inputs:c,servers:d}=n.get(),h=a?.sourceDescriptions.get()??[],p=`${l}/${i}`,[{createConfig:f},{ExternalResolver:m}]=await Promise.all([import("./redocly-openapi-docs.min.index-DVWw0ICA.js"),import("./redocly-openapi-docs.min.external-resolver-BkceRyB4.js")]),g=new m,O=c.map(P=>JSON.stringify({[P.name]:P.value})),y=Y1e(d,h),{run:b}=await import("./redocly-openapi-docs.min.respect-run-Ct8taisL.js"),w=await b({files:[p],workflow:o?[o]:[],fetch:(P,S)=>{const C=W1e(P),{clientCert:$,clientKey:Q}=iD(C,e?e.get({noproxy:!0}):[]);return ls(C,{...S,clientCert:$,clientKey:Q})},logger:BO,maxSteps:500,maxFetchTimeout:4e4,requestFileLoader:{getFileBody:async P=>{if(!await Xw(P))throw new Error(`File ${P} doesn't exist or isn't readable.`);try{const S=await Zw(P),C=new TextEncoder().encode(S);return new File([C],await qw(P))}catch(S){throw new Error(`Failed to read file ${P}: ${S}`)}}},envVariables:{},config:await f({}),externalRefResolver:g,input:O,server:y,severity:JSON.stringify(s),skipLint:!0,noSecretsMasking:!0});try{await uge(i,o,w?.[0]?.ctx)}catch(P){console.error("Failed to persist workflow step context:",P)}return w}}}function Y1e(t,e){return e.map(n=>{const r=t.find(o=>o.apiId===n.apiId);if(!r)return null;let i=r.value;if(r.variables)for(const o of r.variables){const s=new RegExp(`\\{${o.name}\\}`,"g");i=i.replace(s,o.value)}return`${n.name}=${i}`}).filter(n=>n!==null)}const F1e="com.redocly.tab.openFailed";function Zu(t){return{stepId:null,collectionId:null,workflowId:null,historyId:null,type:Ne.Step,draftStep:null,response:null,requestError:null,isProcessingRequest:!1,satisfiesScheme:!0,...t}}function W5(t,e){const n=t.draftStep?.xOperation;return n?.method===e.method&&n?.url===e.url}function B1e(t,e){const n=t.draftStep.ornull,r=n?.xOperation.ornull;if(!(!n||!r)){if(e.url&&r.url.get()!==e.url){r.url.set(e.url);const i=n.parameters.queryParameters.get({noproxy:!0});n.parameters.queryParameters.set(j5(Kd(e.url),i))}r.method.get()!==e.method&&r.method.set(e.method)}}function Dn(){const{activeTabIdx:t,tabs:e}=Na(),{dynamicReplayValues:n}=ir(),{getStep:r}=X5(),{getHistoryItem:i}=V1e(),{getWorkflow:o}=g1(),{getCollection:s}=Fa(),{getApiOperation:a}=Ll(),{sendEvent:l}=Ue(),c=_t(),d=v.useCallback((E,_,A,q)=>{console.warn(`[useTabHandlers] ${E}`,q),l(F1e,[{...pe("tab",_),reason:A,...q}])},[l]),h=v.useCallback((E,_)=>{const A=e[E];A&&A.ornull!==null&&A.state&&A.state.set(_)},[e]),p=v.useCallback(E=>{t.set(E)},[t]),f=v.useCallback(()=>{e.merge([c1e()]),t.set(e.length-1)},[e,t]),m=v.useCallback(E=>{const _=[...e.get({noproxy:!0}).filter(q=>q.state!==yn.Preview)];_.push(E),e.set(_);const A=_.length-1;return t.set(A),A},[e,t]),g=v.useCallback(E=>{const _=a(E),A=L5(E,_,n);m(A)},[m,n,a]),O=v.useCallback((E,_)=>{const A=e.get(),q=N=>A.findIndex(({data:L})=>pn(L,Ne.Step)&&N(L)),I=N=>e[N].data;if(_){const N=q(U=>U.sourceFile===_);if(N!==-1){B1e(I(N),E),p(N);return}const L=q(U=>!U.sourceFile&&W5(U,E));if(L!==-1){I(L).merge({sourceFile:_}),p(L);return}}else{const N=q(L=>W5(L,E));if(N!==-1){p(N);return}}const Z=as({xOperation:E,name:_??void 0});m({id:crypto.randomUUID(),state:yn.Normal,data:Zu({draftStep:Z,activeTabName:Wl(Z),sourceFile:_??null})})},[e,p,m]),y=v.useCallback(async E=>{t.set(Math.max(0,E-1)),await new Promise(_=>setTimeout(()=>{e[E].set(ft),_()}))},[t,e]),b=v.useCallback(()=>{e.set([]),t.set(0)},[t,e]);function w({collectionId:E,workflowId:_,stepId:A}){const q=e.get({noproxy:!0}),I=new Set;for(let Z=0;Z<q.length;Z++){const N=q[Z].data;switch(N.type){case Ne.Step:N.collectionId===E&&N.workflowId===_&&N.stepId===A&&I.add(Z);break;case Ne.Workflow:case Ne.WorkflowRun:N.collectionId===E&&N.workflowId===_&&!A&&I.add(Z);break;case Ne.Collection:N.collectionId===E&&!_&&!A&&I.add(Z);break}}I.size&&(e.merge(Object.fromEntries(I.values().map(Z=>[Z,ft]))),t.set(0))}const P=v.useCallback(async E=>{const _=e.get().find(({data:A})=>pn(A,Ne.Step)&&A.historyId===E);if(_)t.set(e.get().indexOf(_));else{const A=await i(E);if(!A||!$5(A)){d("Step history not found","stepHistoryTab","step_history_not_found",{historyId:E});return}const q=A.step;m({id:crypto.randomUUID(),state:yn.Preview,data:Zu({historyId:E,draftStep:structuredClone(q),response:structuredClone(A.response),activeTabName:Wl(q)})})}},[t,e,m,i,d]),S=v.useCallback(({collectionId:E,activeTabName:_})=>{const A=e.findIndex(q=>{const I=q.data.get();return pn(I,Ne.Collection)&&I.collectionId===E});if(A!==-1)t.set(A);else{if(!s(E)){d("Collection not found","collectionTab","collection_not_found",{collectionId:E});return}m({id:crypto.randomUUID(),state:yn.Preview,data:{collectionId:E,type:Ne.Collection,activeTabName:_??Be.COLLECTION_SETTINGS}})}},[t,e,m,s,d]),C=v.useCallback(({collectionId:E,workflowId:_})=>{if(!o({collectionId:E,workflowId:_})){d("Workflow not found","workflowRunTab","workflow_not_found",{collectionId:E,workflowId:_});return}m({id:crypto.randomUUID(),state:yn.Normal,data:{collectionId:E,workflowId:_,historyId:null,runDate:null,type:Ne.WorkflowRun,result:null,severitySettings:U5()}})},[m,o,d]),$=v.useCallback(async(E,{state:_=yn.Preview}={})=>{const A=e.get().find(({data:q})=>pn(q,Ne.WorkflowRun)&&q.historyId===E);if(A){const q=e.get().indexOf(A);_===yn.Normal&&A.state===yn.Preview&&h(q,yn.Normal),t.set(q)}else{const q=await i(E);if(!q||!Q5(q)){d("Workflow history not found","workflowHistoryTab","workflow_history_not_found",{historyId:E});return}m({id:crypto.randomUUID(),state:_,data:{collectionId:q.collectionId,workflowId:q.workflowId,historyId:E,runDate:q.date,type:Ne.WorkflowRun,result:structuredClone(q.workflowResult),severitySettings:U5(),label:qu(q.workflow),secretValues:c.get().inputs.filter(I=>I.isSecret&&I.value).map(I=>String(I.value))}})}},[t,e,m,h,i,d,c]),Q=v.useCallback(({collectionId:E,workflowId:_,activeTabName:A})=>{const q=e.findIndex(I=>{const Z=I.data.get();return pn(Z,Ne.Workflow)&&Z.workflowId===_&&Z.collectionId===E});if(q!==-1){const I=e[q].data;A&&I.activeTabName.set(A),t.set(q)}else{if(!o({collectionId:E,workflowId:_})){d("Workflow not found","workflowTab","workflow_not_found",{collectionId:E,workflowId:_});return}m({id:crypto.randomUUID(),state:yn.Preview,data:{collectionId:E,workflowId:_,type:Ne.Workflow,activeTabName:A??Be.WORKFLOW_SETTINGS}})}},[t,e,m,o,d]),T=v.useCallback(({collectionId:E,workflowId:_,stepId:A,state:q})=>{const I=e.get().find(({data:Z})=>pn(Z,Ne.Step)&&Z.collectionId===E&&Z.workflowId===_&&Z.stepId===A&&Z.historyId===null);if(I)t.set(e.get().indexOf(I));else{const Z=r({collectionId:E,workflowId:_,stepId:A});if(!Z){d("Step not found","stepTab","step_not_found",{collectionId:E,workflowId:_,stepId:A});return}const N=Z.get({noproxy:!0});m({id:crypto.randomUUID(),state:q??yn.Preview,data:Zu({stepId:A,collectionId:E,workflowId:_,activeTabName:Wl(N)})})}},[t,e,r,m,d]),z=v.useCallback(({step:E})=>{m({id:crypto.randomUUID(),state:yn.Normal,data:Zu({stepId:E.stepId??null,workflowId:E.workflowId??null,draftStep:structuredClone(E),activeTabName:Wl(E)})})},[m]),M=v.useCallback((E,_)=>{if(E===_)return;const A=t.get(),q=[...e.get({noproxy:!0})],I=q[A]?.id,[Z]=q.splice(E,1);if(q.splice(_,0,Z),e.set(q),I){const N=q.findIndex(L=>L.id===I);t.set(N)}},[t,e]);return{handleNewTabOpen:f,addNewTab:m,openStepTabFromOperation:g,openStepTabFromXOperation:O,handleTabChange:p,handleTabClose:y,handleCloseAllTabs:b,handleCloseByDataId:w,openCollectionTab:S,openWorkflowTab:Q,openWorkflowRunTab:C,openWorkflowRunTabFromHistory:$,openStepTabFromHistory:P,openStepTabFromCollection:T,openStepTab:z,handleTabReorder:M,changeTabState:h}}function L5(t,e,n){const r=as({operation:t,apiOperation:e,dynamicReplayValues:n});return{id:crypto.randomUUID(),state:yn.Preview,data:Zu({draftStep:r,activeTabName:Wl(r)})}}function G1e(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.left>=r.left&&n.right<=r.right}const H1e=({transform:t})=>({...t,y:0}),K1e=({transform:t,draggingNodeRect:e,containerNodeRect:n})=>!e||!n?t:{...t,x:Math.max(n.left-e.left,Math.min(t.x,n.right-e.right))},Fl=(t,e="currentColor")=>t?.startsWith("--")?`var(${t})`:t||e,J1e=t=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",...t,children:[u.jsx("path",{d:"M10.8623 6.60461C11.0548 6.64292 11.2314 6.73734 11.3701 6.8761C11.5089 7.01487 11.6033 7.19144 11.6416 7.38391C11.6799 7.57633 11.661 7.77588 11.5859 7.95715C11.5108 8.13849 11.3829 8.29342 11.2197 8.40247C11.0566 8.51141 10.8651 8.5694 10.6689 8.56946C10.4939 8.5686 10.3221 8.52031 10.1729 8.42883L9.40625 9.19739C9.58461 9.44901 9.67969 9.75029 9.67969 10.0587C9.67965 10.3669 9.5844 10.6676 9.40625 10.9191L10.1729 11.6886C10.3221 11.5971 10.4938 11.5479 10.6689 11.547C10.865 11.5471 11.0567 11.6052 11.2197 11.714C11.3829 11.823 11.5108 11.9781 11.5859 12.1593C11.6611 12.3406 11.6799 12.541 11.6416 12.7335C11.6033 12.9259 11.5088 13.1026 11.3701 13.2413C11.2314 13.38 11.0547 13.4745 10.8623 13.5128C10.6698 13.5511 10.4704 13.5313 10.2891 13.4562C10.1078 13.3811 9.95279 13.2541 9.84375 13.0909C9.7347 12.9277 9.67578 12.7355 9.67578 12.5392C9.6767 12.3641 9.7258 12.1923 9.81738 12.0431L9.04883 11.2765C8.79719 11.4549 8.49595 11.5509 8.1875 11.5509C7.87917 11.5509 7.57871 11.4548 7.32715 11.2765L6.55762 12.0431C6.6492 12.1923 6.6983 12.3641 6.69922 12.5392C6.69922 12.7354 6.6412 12.9278 6.53223 13.0909C6.42318 13.2541 6.26728 13.3811 6.08594 13.4562C5.90468 13.5312 5.7051 13.5511 5.5127 13.5128C5.32032 13.4745 5.14359 13.38 5.00488 13.2413C4.86618 13.1026 4.77174 12.9259 4.7334 12.7335C4.69511 12.541 4.71493 12.3406 4.79004 12.1593C4.86518 11.9782 4.99222 11.8229 5.15527 11.714C5.31843 11.605 5.51083 11.547 5.70703 11.547C5.88211 11.5479 6.05389 11.597 6.20312 11.6886L6.96973 10.9191C6.79143 10.6675 6.69535 10.367 6.69531 10.0587C6.69531 9.75027 6.79134 9.44902 6.96973 9.19739L6.20312 8.42883C6.0539 8.52041 5.88211 8.56853 5.70703 8.56946C5.51075 8.56946 5.31847 8.51151 5.15527 8.40247C4.99211 8.29342 4.86514 8.13846 4.79004 7.95715C4.71493 7.77581 4.69511 7.57642 4.7334 7.38391C4.77168 7.19148 4.86618 7.01486 5.00488 6.8761C5.14358 6.7374 5.32034 6.64296 5.5127 6.60461C5.70502 6.56636 5.90473 6.58534 6.08594 6.66028C6.26728 6.73539 6.42318 6.86329 6.53223 7.02649C6.64104 7.18953 6.69917 7.38125 6.69922 7.57727C6.69836 7.7524 6.64917 7.92407 6.55762 8.07336L7.32715 8.83997C7.57865 8.66181 7.87929 8.56656 8.1875 8.56653C8.49595 8.56653 8.79719 8.66158 9.04883 8.83997L9.81738 8.07336C9.72588 7.9241 9.67664 7.75235 9.67578 7.57727C9.67583 7.38112 9.7348 7.1896 9.84375 7.02649C9.9528 6.86329 10.1077 6.73539 10.2891 6.66028C10.4703 6.58526 10.6699 6.56634 10.8623 6.60461ZM5.60938 12.0529C5.51328 12.0721 5.42476 12.1193 5.35547 12.1886C5.28617 12.2579 5.23889 12.3464 5.21973 12.4425C5.20058 12.5388 5.21049 12.6389 5.24805 12.7296C5.28559 12.8202 5.34915 12.8978 5.43066 12.9523C5.51226 13.0068 5.60889 13.0353 5.70703 13.0353C5.83843 13.0352 5.96467 12.9836 6.05762 12.8907C6.15067 12.7977 6.20312 12.6708 6.20312 12.5392C6.20305 12.4412 6.1736 12.3453 6.11914 12.2638C6.06462 12.1822 5.98712 12.1187 5.89648 12.0812C5.80581 12.0436 5.70563 12.0337 5.60938 12.0529ZM10.5723 12.0529C10.476 12.072 10.3868 12.1192 10.3174 12.1886C10.2481 12.2579 10.2008 12.3464 10.1816 12.4425C10.1625 12.5388 10.1724 12.6389 10.21 12.7296C10.2475 12.8202 10.3111 12.8978 10.3926 12.9523C10.4742 13.0068 10.5708 13.0353 10.6689 13.0353C10.8004 13.0352 10.9266 12.9836 11.0195 12.8907C11.1126 12.7977 11.165 12.6708 11.165 12.5392C11.165 12.4412 11.1355 12.3453 11.0811 12.2638C11.0265 12.1823 10.949 12.1187 10.8584 12.0812C10.7679 12.0437 10.6684 12.0338 10.5723 12.0529ZM5.80371 7.09094C5.70746 7.0718 5.60727 7.08171 5.5166 7.11926C5.42601 7.15683 5.34843 7.22033 5.29395 7.30188C5.2395 7.3834 5.21 7.47924 5.20996 7.57727C5.20996 7.70887 5.26241 7.83578 5.35547 7.92883C5.44852 8.02183 5.57548 8.07336 5.70703 8.07336C5.80501 8.07328 5.90095 8.04479 5.98242 7.99036C6.06394 7.93589 6.12747 7.85825 6.16504 7.7677C6.2026 7.67703 6.21251 7.57684 6.19336 7.48059C6.17421 7.38441 6.12694 7.29605 6.05762 7.22668C5.9883 7.15736 5.89985 7.11013 5.80371 7.09094ZM10.6689 7.08118C10.5373 7.08118 10.4104 7.13363 10.3174 7.22668C10.2245 7.31967 10.1729 7.44586 10.1729 7.57727C10.1729 7.67541 10.2013 7.77204 10.2559 7.85364C10.3104 7.9351 10.388 7.99873 10.4785 8.03625C10.5692 8.07381 10.6694 8.08372 10.7656 8.06457C10.8617 8.04544 10.9502 7.99808 11.0195 7.92883C11.0889 7.85944 11.1361 7.7702 11.1553 7.67395C11.1743 7.57784 11.1644 7.47835 11.127 7.38782C11.0894 7.29719 11.0259 7.21968 10.9443 7.16516C10.8628 7.11069 10.767 7.08123 10.6689 7.08118Z"}),u.jsx("path",{d:"M10.5 0.880005C10.9812 0.880005 11.375 1.27375 11.375 1.755V5.88489C11.375 5.95116 11.3212 6.005 11.2549 6.005H10.6201C10.5538 6.005 10.5 5.95116 10.5 5.88489V1.755H7V4.38C7 4.86125 6.60625 5.255 6.125 5.255H3.5V13.0099C3.5 13.0762 3.44616 13.13 3.37988 13.13H2.74512C2.67884 13.13 2.625 13.0762 2.625 13.0099V4.38C2.625 4.24875 2.66836 4.16086 2.75586 4.07336L5.81836 1.01086C5.90586 0.923364 5.99375 0.880005 6.125 0.880005H10.5ZM3.6748 4.38H6.125V1.92981L3.6748 4.38Z"})]}),m1=x(J1e)`
|
|
1134
1134
|
path {
|
|
1135
1135
|
fill: ${({color:t})=>Fl(t)};
|
|
1136
1136
|
}
|
|
@@ -4317,7 +4317,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
4317
4317
|
|
|
4318
4318
|
height: ${({size:t})=>t||"16px"};
|
|
4319
4319
|
width: ${({size:t})=>t||"16px"};
|
|
4320
|
-
`,ZCe=["text","file"];function XCe({onParameterChange:t,files:e}){const n=v.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(an())try{const{open:a}=await import("./redocly-openapi-docs.min.index-
|
|
4320
|
+
`,ZCe=["text","file"];function XCe({onParameterChange:t,files:e}){const n=v.useRef(null),r=a=>{a.target.files?.length&&t(Array.from(a.target.files).map(l=>({absolutePath:null,file:l})))},i=async()=>{if(an())try{const{open:a}=await import("./redocly-openapi-docs.min.index-BCcol5vU.js"),l=await a({multiple:!0});if(!l)return;const c=(Array.isArray(l)?l:[l]).map(Kh),d=(await Promise.all(c)).filter(h=>h!==null);t(d)}catch(a){console.error("Failed to open file dialog or read file:",a)}else n.current?.click()},o=v.useCallback(()=>{t(null)},[t]),s=v.useMemo(()=>{if(!e)return null;if(e.length===1)return u.jsx(uZ,{icon:u.jsx(hr,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:u.jsx(dZ,{children:e[0].file.name})});if(e.length>1)return u.jsx(uZ,{icon:u.jsx(hr,{}),variant:"secondary",onClick:o,iconPosition:"right",size:"small",children:u.jsxs(dZ,{children:[e.length," files"]})})},[e,o]);return u.jsx(VCe,{children:u.jsxs(UCe,{children:[u.jsx(WCe,{children:s||u.jsx(FCe,{children:"Add files here"})}),u.jsxs(LCe,{children:[u.jsx(YCe,{onClick:i,variant:"secondary",size:"small","data-testid":"add-button",icon:u.jsx(Vn,{color:"--button-content-color"})}),u.jsx("input",{"data-testid":"file-input",hidden:!0,ref:n,type:"file",multiple:!0,accept:"files/*",onChange:r})]})]})})}const VCe=x.div`
|
|
4321
4321
|
position: relative;
|
|
4322
4322
|
display: flex;
|
|
4323
4323
|
flex-grow: 1;
|
|
@@ -4485,7 +4485,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
4485
4485
|
width: 1.2em;
|
|
4486
4486
|
height: 1.2em;
|
|
4487
4487
|
}
|
|
4488
|
-
`,g$e=({data:t})=>{const e=t.get(),[n,r]=v.useState(!1),i=v.useRef(null),o=l=>{const c=l.target.files?.[0];if(c){r(!0);const d=new FileReader;d.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},d.readAsDataURL(c)}},s=async()=>{if(an())try{const{open:l}=await import("./redocly-openapi-docs.min.index-
|
|
4488
|
+
`,g$e=({data:t})=>{const e=t.get(),[n,r]=v.useState(!1),i=v.useRef(null),o=l=>{const c=l.target.files?.[0];if(c){r(!0);const d=new FileReader;d.onload=()=>{r(!1),t.set({absolutePath:null,file:c})},d.readAsDataURL(c)}},s=async()=>{if(an())try{const{open:l}=await import("./redocly-openapi-docs.min.index-BCcol5vU.js"),c=await l();if(!c)return;const d=await Kh(c);t.set(d)}catch(l){console.error("Failed to open file dialog or read file:",l)}else i.current?.click()},a=()=>{t.set(null)};return n?u.jsxs(m$e,{children:[u.jsx(y0,{}),"Loading..."]}):e&&e.file?.name?u.jsxs(O$e,{children:[u.jsxs(v$e,{children:[u.jsx(p$e,{size:"16px"}),u.jsx(y$e,{children:e.file?.name})]}),u.jsx(mi,{onClick:a,icon:u.jsx(wn,{})})]}):u.jsx(fZ,{children:!e&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"file",hidden:!0,ref:i,onChange:o}),u.jsx(he,{type:"button",variant:"text",onClick:s,icon:u.jsx(d$e,{}),children:"Upload file"})]})})},fZ=x.div`
|
|
4489
4489
|
display: flex;
|
|
4490
4490
|
align-items: center;
|
|
4491
4491
|
justify-content: flex-start;
|
|
@@ -6857,7 +6857,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
6857
6857
|
display: inline-block;
|
|
6858
6858
|
color: var(--text-color-secondary);
|
|
6859
6859
|
margin-left: var(--spacing-xs);
|
|
6860
|
-
`,aRe="request",lRe=new Set(["replay:","redocly-replay:"]),cRe=8*1024,uRe=4*1024,n3=1024,dRe=new Set([vn.JSON,vn.XML,vn.HTML,vn.Text]);function r3(t){return e5(t).length>0}function hRe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function BX(t,e){return!t||t.length>n3||e.length>n3||r3(e)}function i3(t,e,n){const r=[];for(const[i,o]of t){if(!i.startsWith(e))continue;const s=i.slice(e.length);if(BX(s,o))return null;r.push(hRe(n,s,o))}return r}function pRe(t){if(t.length>cRe)return null;let e;try{e=new URL(t)}catch{return null}if(!lRe.has(e.protocol)||e.hostname.toLowerCase()!==aRe)return null;const n=e.searchParams,r=n.get("url");if(!r||r3(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const o=(n.get("method")||"GET").toUpperCase();if(!Iu.includes(o))return null;const s=i3(n,"header.","header"),a=i3(n,"query.","query"),l=i3(n,"cookie.","cookie");if(!s||!a||!l)return null;const c=Kd(r);if(c.some(f=>BX(f.key,f.value)))return null;const d=n.get("body");if(d!==null&&(d.length>uRe||r3(d)))return null;const h=n.get("contentType")?.trim();if(h&&!dRe.has(h))return null;const p=n.get("env")?.trim();return p&&p.length>n3?null:{xOperation:{method:o,url:r},headers:s,queryParameters:[...c,...a],cookies:l,...d!==null&&{body:{content:d,...h&&{type:h}}},...p&&{environment:p}}}function fRe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function gRe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=Na(),{addNewTab:r}=Dn(),{environments:i,activeEnvironmentId:o}=Je();return v.useCallback(s=>{const a=e.get().findIndex(({data:h})=>pn(h,Ne.Step)&&fRe(h)&&W5(h,s.xOperation));let l;if(a!==-1)l=a,n.set(l);else{const h=as({xOperation:s.xOperation});l=r({id:crypto.randomUUID(),state:yn.Normal,data:Zu({draftStep:h,activeTabName:Wl(h)})})}const c=e[l]?.data;c&&(c.response.set(null),c.requestError.set(null),c.isProcessingRequest.set(!1));const d=c?.draftStep.ornull;d&&(d.parameters.headers.set(s.headers),d.parameters.queryParameters.set(s.queryParameters),d.parameters.cookies.set(s.cookies),d.requestBody.set(Gh()),s.body&&d.requestBody.merge({content:s.body.content,...s.body.type&&{type:s.body.type}})),s.environment&&(i.get().some(h=>h.name===s.environment)?o.set(s.environment):t?.(s.environment))},[e,n,r,i,o,t])}const mRe="com.redocly.deepLink.opened";let GX=!1;function ORe(){const{warning:t}=Y3(),e=Ue(),n=gRe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=v.useRef(n);r.current=n,v.useEffect(()=>{let i,o=!1;const s=a=>{const l=a[0]&&pRe(a[0]);l&&(r.current(l),e.sendEvent(mRe,[{...pe("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await import("./redocly-openapi-docs.min.index-YnvLQkG_.js"),c=await a(s);if(o){c();return}if(i=c,!GX){const d=await l();if(o)return;GX=!0,d?.[0]&&s(d)}})(),()=>{o=!0,i?.()}},[])}function vRe(t){const e=t||"default";return{id:Md(og(e)),systemFilesDir:q3.join("/replay",e),userFilesDir:q3.join("/projects",e)}}async function yRe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Md(og(t)),n=await bRe(),r=await _w(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function bRe(){return $I()}function o3(t,e){const n=`apis/${t.info.title}`.replace(/\s+/g,"-").toLowerCase(),r=a=>`${a}.yaml`,i=a=>e.some(l=>l.id===r(a));if(!i(n))return r(n);let o=1,s=`${n}-${o}`;for(;i(s);)o++,s=`${n}-${o}`;return r(s)}const xRe=[{suffix:et.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:et.Username,getValue:t=>t.username},{suffix:et.Password,getValue:t=>t.password},{suffix:et.ClientId,getValue:t=>t.client_id},{suffix:et.ClientSecret,getValue:t=>t.client_secret}];function HX(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const o=r.id;for(const s of xRe){const a=s.getValue(i);Sy(a)&&n.push({name:o+s.suffix,value:a})}}return n}function wRe(t){const e=new Set,n=Object.values(et);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function SRe(t,e){const n=new Set,r=wRe(t),i=o=>{if(o.security)for(const{name:s}of HX(t.security,o.security))n.add(s);for(const[s,a]of Object.entries(o.envVariables||{}))Sy(a)&&r.has(s)&&n.add(s)};if(_f(e))return i(e),n;for(const o of Object.values(e))o&&i(o);return n}function kRe(t,e){const n=e.query??{},r=[],i=(o,s)=>{typeof s=="string"&&r.push({name:o,value:s})};for(const o of t.parameters){if(o.in!=="querystring")continue;const s=o7(o),a=new Set(s.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const d of a)if(l.startsWith(`${d}[`)){i(l,c);break}}return r}function PRe(t,e,n){const r=NB(t,n);if(!r)return[];const i=new Map,o=(s,a,l=!1)=>{i.set(s,{name:s,value:a,isSecret:l})};for(const[s,a]of Object.entries(r.envVariables||{}))o(s,a);for(const{name:s,value:a}of kRe(e,r))o(s,a);for(const s of e.parameters){const a=l7[s.in];if(!a)continue;const l=r[a]?.[s.name];Sy(l)&&o(s.name,String(l))}if(r.security)for(const{name:s,value:a}of HX(e.security,r.security))o(s,a,!0);return Array.from(i.values())}function CRe(t,e){return t.find(n=>n.name===e)}function $Re(t,e,n){const r=Object.entries(e.variables??{}).map(([i,o])=>{const s=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:s??o.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function QRe(t,e,n,r,i){const{servers:o,parameters:s}=e,a=s.filter(p=>p.in==="path"),l=jRe(e),c=new Set,d=a.map(p=>{const f=p.example?String(p.example):"";return c.add(p.name),{name:p.name,value:f,isSecret:!1}}),h=p=>l.map(f=>{const m=e.security?.flat().find(O=>{const y=O.id;return f.name.startsWith(y)});let g="";if(m){const O=m.serverValues?.[p];O&&(O["x-defaultUsername"]&&f.name.endsWith(et.Username)?g=O["x-defaultUsername"]:O["x-defaultPassword"]&&f.name.endsWith(et.Password)?g=O["x-defaultPassword"]:O["x-defaultClientId"]&&f.name.endsWith(et.ClientId)?g=O["x-defaultClientId"]:O["x-defaultClientSecret"]&&f.name.endsWith(et.ClientSecret)?g=O["x-defaultClientSecret"]:O["x-defaultAccessToken"]&&(g=O["x-defaultAccessToken"])),g||(m["x-defaultUsername"]&&f.name.endsWith(et.Username)?g=m["x-defaultUsername"]:m["x-defaultPassword"]&&f.name.endsWith(et.Password)?g=m["x-defaultPassword"]:m["x-defaultClientId"]&&f.name.endsWith(et.ClientId)?g=m["x-defaultClientId"]:m["x-defaultClientSecret"]&&f.name.endsWith(et.ClientSecret)?g=m["x-defaultClientSecret"]:m["x-defaultAccessToken"]&&(g=m["x-defaultAccessToken"]))}return c.add(f.name),{name:f.name,value:f.value||g||"",isSecret:f.isSecret}});return{generatedInputs:c,environments:ERe(o).map(p=>{const f=p.name||p.description||p.url,m=CRe(n,f),g=m?.servers.find(C=>C.apiId===t),O=$Re(t,p,g),y=h(p.url),b=PRe(i,e,p.url),w=b.map(C=>C.name),P=m?.inputs.filter(C=>C.value&&!w.includes(C.name))||[];for(const C of b)c.add(C.name);const S=IRe(TRe(P,d,y,b),r?.[f]);return{name:f,inputs:S,servers:[O],state:Tt.Normal}})}}function jRe(t){const e=[];return(t.security?.flat()||[]).forEach(n=>{const r=tO(n),i=n.id;(r===ee.BasicAuth||r===ee.DigestAuth)&&(e.push(So(i+et.Username,!1)),e.push(So(i+et.Password))),r===ee.JWT&&e.push(So(i+et.JWTToken)),r===ee.APIKey&&e.push(So(i+et.APIKey)),r===ee.OAuth2&&(e.push(So(i+et.Token)),zw(n).forEach(o=>{e.push(So(i+et.ClientId)),[K.Implicit,K.ClientCredentialsWithJwtAssertion].includes(o)||e.push(So(i+et.ClientSecret)),o===K.ClientCredentialsWithJwtAssertion&&e.push(So(i+et.ClientAssertion))})),r===ee.OpenIDConnect&&(e.push(So(i+et.Token)),e.push(So(i+et.ClientId)),e.push(So(i+et.ClientSecret)))}),e}function So(t,e=!0){return{name:t,value:"",isSecret:e}}function TRe(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);e.set(r.name,{name:r.name,value:r.value||i?.value||"",isSecret:r.isSecret||i?.isSecret||!1})}return Array.from(e.values())}function s3(t){return typeof t=="string"?{value:t}:t}function IRe(t,e){if(!e)return t;const n=new Set(t.map(o=>o.name)),r=t.map(o=>{const s=e[o.name];if(s===void 0)return o;const{value:a,isSecret:l}=s3(s);return{...o,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([o])=>!n.has(o)).map(([o,s])=>{const{value:a,isSecret:l}=s3(s);return{name:o,value:a,isSecret:l??!1}});return[...r,...i]}function ERe(t){const e=K4(gU?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function n(r){return QB(e,r)}return t.map(r=>({...r,url:n(r.url),description:r.description||""}))}function $0(t,e){if(e.size===0)return;const n=t.get({noproxy:!0});for(let r=0;r<n.length;r++){const i=n[r];!Ad(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function KX(t,e,n){if(typeof e=="string"){const i=zi(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,o]of Object.entries(e)){const s=r[i];s&&KX(s,o,n)}}function RRe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const o=r.findIndex(s=>s.securitySchemeId===i.securitySchemeId);o!==-1&&KX(t[o],i,n)}}function ARe(t,e,n){const r=Ew(e.parameters,"in");$0(t.parameters.pathParameters,Rc(r.path,"path",n)),$0(t.parameters.queryParameters,d7(r.query,r.querystring,n)),$0(t.parameters.headers,Rc(r.header,"header",n)),$0(t.parameters.cookies,Rc(r.cookie,"cookie",n)),RRe(t.security,eO(e),SRe(e,n))}function JX(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=DRe(t,e,n);return{operations:r}}function DRe(t,e,n){const r=[];for(const[i,o]of Object.entries(t.paths)){for(const[s,a]of Object.entries(o))s!=="parameters"&&s!=="servers"&&s!=="description"&&s!=="summary"&&s!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=eV(i,s,t,l,e,!1,n);c&&r.push(c)});if(o.additionalOperations)for(const[s,a]of Object.entries(o.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=eV(i,s,t,l,e,!0,n);c&&r.push(c)})}return{operations:r}}function eV(t,e,n,r,i,o,s){if(!s)return{operation:null};const a=s(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:zae(a,o,i,l)}}const tV=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:o}=VI({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===o}return!1});class MRe{storage;constructor(e){this.storage=e}findAll(){return this.storage.findAll()}findOne(e){return this.storage.findOne(e)}upsert(e){return this.storage.upsert(e)}remove(e){return this.storage.remove(e)}findRecentChatsPage(e){return this.storage.findRecentChatsPage(e)}}class a3{static instance=null;static async initialize(e,n){this.close(),this.instance=await zRe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function zRe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.AiChatSqliteDBStorage-eAy3scC4.js"),r=kp.getInstance(),i=new n(r);return new MRe(i)}else throw new Error("Not implemented")}const cd="ai-chat",l3="detail",_Re="title",nV="infinite-history",rV={all:()=>[cd],details:()=>[cd,l3],detail:t=>[cd,l3,t],detailTitle:t=>[cd,l3,t,_Re],infiniteHistories:()=>[cd,nV],infiniteHistory:t=>[cd,nV,t]},qRe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:o})=>{const s=v.useContext(uR),a=Ue(),l=fa(),c=v.useMemo(async()=>{const h=an()?await yRe(e.storageKey):vRe(e.storageKey);e.layout!=="preview"&&an()&&dp.initialize();const{isInitialized:p}=await s.init(h,e,a);if(e.layout!=="preview"){if(an()){const w=`${h.systemFilesDir}/replay.db`;await kp.initialize(w),await a3.initialize(h,an())}await Ba.initialize(h,an()),await Ul.initialize(an());try{await Ul.getInstance()?.pruneOlderThan(Date.now()-cge)}catch(w){console.error("Failed to prune step context:",w)}try{const w=await D1e.migrate(h,Ba.getInstance(),an());w.migrated&&a.sendEvent("com.redocly.history.migration",[{...pe("migration","historyMigration","storage"),status:"success",itemCount:w.itemCount}])}catch(w){console.error("History migration failed:",w),a.sendEvent("com.redocly.history.migration",[{...pe("migration","historyMigration","storage"),status:"error",error:w instanceof Error?w.message:"Unknown error"}])}}if(!p)return;if(!n){s.environments.length===0&&s.environments.set(i4);return}const f=o3(n,[]),{operations:m}=JX(n,f,e.convertOperationToReplayValue);if(!m?.length||!m[0].collectionPath?.split("/")?.[0]||(s.apis.set([{id:f,srcType:Fr.FS,...n}]),s.predefinedApiId.set(f),!r&&!i))return;const g=tV(m,r,i),{path:O,method:y}=g?.apiPath||{};if(!g||!O||!y)return;const b=e.convertOperationToReplayValue?.(O,y,n);b&&iV(s,f,b,e),XRe(s,{apiId:f,path:O,method:y,operationId:g.operationId,isAdditionalOperation:g.isAdditionalOperation},b,e.dynamicReplayValues)},[e.storageKey]);v.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:xr.all}),l.invalidateQueries({queryKey:rV.all()}),l.invalidateQueries({queryKey:up.all}),()=>{Ba.close(),a3.close(),dp.close(),Ul.close(),an()&&kp.close().catch(h=>{console.error("Failed to close SqliteDBConnection:",h)})}},[e.storageKey,e.layout,l]),v.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const h=o3(n,[]),{operations:p}=JX(n,h,e.convertOperationToReplayValue);if(!p?.length)return;const f=tV(p,r,i),{path:m,method:g}=f?.apiPath||{};if(!f||!m||!g)return;const O=e.convertOperationToReplayValue(m,g,n);O&&iV(s,h,O,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const d=e.layout==="preview"?null:u.jsx(iRe,{projectPath:e.storageKey});return u.jsx(v.Suspense,{fallback:d,children:u.jsx(NRe,{initStore:c,settings:e,api:n,onLoad:o,children:t})})};function NRe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return v.use(t),Pfe(n,r),v.useEffect(()=>{i?.()},[]),u.jsxs(ze.Fragment,{children:[an()&&u.jsx(ZRe,{}),e]},n.storageKey)}function ZRe(){return ORe(),null}const iV=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:o,generatedInputs:s}=QRe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues);t.predefinedInputNames.set(s);let a,l,c;if(r.allowedEnvironments?.length){const d=o.filter(h=>r.allowedEnvironments?.includes(h.name));a=new Set(d.map(h=>h.name)),l=d,c=l.find(h=>h.name===r.selectedEnvironment)?.name||l[0]?.name||""}else{a=new Set(o.map(h=>h.name)),l=[...o,...i.filter(h=>!a.has(h.name))];const d=t.activeEnvironmentId.get();c=l.find(h=>h.name===d)?.name||l.find(h=>h.name===r.selectedEnvironment)?.name||l[0]?.name||""}t.predefinedEnvironmentNames.set(a),Hv(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(c)},XRe=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:o})=>pn(o,Ne.Step)&&o.draftStep?.operation?.apiId===e.apiId&&o.draftStep?.operation?.path===e.path&&o.draftStep?.operation?.method===e.method);if(i!==-1){const o=t.tabsState.tabs[i],s=o.data.get();if(n&&r&&pn(s,Ne.Step)){const a=o.data.draftStep.ornull;a&&ARe(a,n,r)}t.tabsState.activeTabIdx.set(i)}else{const o=L5(e,n,r);t.tabsState.tabs.merge([{...o,state:yn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}},oV=v.createContext({ReplayGate:null,ReplayTopBarActions:null}),VRe=oV.Provider,URe=()=>v.useContext(oV);function WRe(t){const{activeEnvironmentId:e}=Je(),[n,r]=v.useState(),[i,o]=v.useState(),s=v.useMemo(()=>t.predefinedEnvValues||n?LRe(t.predefinedEnvValues,n):void 0,[t.predefinedEnvValues,n]),a=v.useMemo(()=>({...t,...s&&{predefinedEnvValues:s},...i&&{selectedEnvironment:i}}),[t,s,i]),l=v.useCallback((d,h)=>r(p=>({...p,[d]:{...p?.[d],...h}})),[]),c=v.useCallback(d=>{o(d),e.set(d)},[e]);return{mergedSettings:a,setEnvValues:l,setSelectedEnvironment:c}}function LRe(t,e){const n={...t};for(const[r,i]of Object.entries(e??{}))n[r]={...n[r],...i};return n}const sV=v.createContext({renderProjectSelect:()=>null});function YRe(){return v.useContext(sV)}function FRe(){const{environments:t,activeEnvironmentId:e}=Je(),{sendEvent:n}=Ue(),r=v.useCallback(o=>{e.set(o),n("com.redocly.environment.management",[{...pe("environment","headerPanelEnvironment"),action:"selected",name:o}])},[e,n]),i=v.useCallback((o,s)=>{const a=t.find(c=>c.name.get()===o);if(!a)return;const l=a.inputs.get();for(const[c,d]of Object.entries(s)){const{value:h,isSecret:p}=s3(d),f=l.findIndex(m=>m.name===c);f!==-1?a.inputs[f].merge({value:h,...p!==void 0&&{isSecret:p}}):a.inputs.merge([{name:c,value:h,isSecret:p??!1}])}},[t]);return{environments:t.get(),activeEnvironment:e.get(),setSelectedEnvironment:r,setEnvironmentValues:i}}function BRe(){const{renderProjectSelect:t}=YRe(),{layout:e,apiId:n}=ir(),{apis:r}=Je(),{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a}=FRe(),{ReplayTopBarActions:l}=URe(),c=r[0]?.get()?.info?.title,d=!t&&e==="overlay"&&c;return u.jsxs(GRe,{children:[t&&u.jsx(aV,{children:u.jsx(t,{})}),d&&u.jsx(aV,{children:u.jsx(HRe,{children:c})}),u.jsxs(KRe,{children:[l&&u.jsx(l,{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a,apiId:n}),u.jsx(YX,{})]})]})}const GRe=x.div`
|
|
6860
|
+
`,aRe="request",lRe=new Set(["replay:","redocly-replay:"]),cRe=8*1024,uRe=4*1024,n3=1024,dRe=new Set([vn.JSON,vn.XML,vn.HTML,vn.Text]);function r3(t){return e5(t).length>0}function hRe(t,e,n){return{id:crypto.randomUUID(),key:e,value:n,in:t,active:!0}}function BX(t,e){return!t||t.length>n3||e.length>n3||r3(e)}function i3(t,e,n){const r=[];for(const[i,o]of t){if(!i.startsWith(e))continue;const s=i.slice(e.length);if(BX(s,o))return null;r.push(hRe(n,s,o))}return r}function pRe(t){if(t.length>cRe)return null;let e;try{e=new URL(t)}catch{return null}if(!lRe.has(e.protocol)||e.hostname.toLowerCase()!==aRe)return null;const n=e.searchParams,r=n.get("url");if(!r||r3(r))return null;let i;try{i=new URL(r)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:")return null;const o=(n.get("method")||"GET").toUpperCase();if(!Iu.includes(o))return null;const s=i3(n,"header.","header"),a=i3(n,"query.","query"),l=i3(n,"cookie.","cookie");if(!s||!a||!l)return null;const c=Kd(r);if(c.some(f=>BX(f.key,f.value)))return null;const d=n.get("body");if(d!==null&&(d.length>uRe||r3(d)))return null;const h=n.get("contentType")?.trim();if(h&&!dRe.has(h))return null;const p=n.get("env")?.trim();return p&&p.length>n3?null:{xOperation:{method:o,url:r},headers:s,queryParameters:[...c,...a],cookies:l,...d!==null&&{body:{content:d,...h&&{type:h}}},...p&&{environment:p}}}function fRe(t){return t.stepId===null&&t.collectionId===null&&t.workflowId===null&&t.historyId===null&&!t.sourceFile}function gRe({onEnvironmentNotFound:t}={}){const{tabs:e,activeTabIdx:n}=Na(),{addNewTab:r}=Dn(),{environments:i,activeEnvironmentId:o}=Je();return v.useCallback(s=>{const a=e.get().findIndex(({data:h})=>pn(h,Ne.Step)&&fRe(h)&&W5(h,s.xOperation));let l;if(a!==-1)l=a,n.set(l);else{const h=as({xOperation:s.xOperation});l=r({id:crypto.randomUUID(),state:yn.Normal,data:Zu({draftStep:h,activeTabName:Wl(h)})})}const c=e[l]?.data;c&&(c.response.set(null),c.requestError.set(null),c.isProcessingRequest.set(!1));const d=c?.draftStep.ornull;d&&(d.parameters.headers.set(s.headers),d.parameters.queryParameters.set(s.queryParameters),d.parameters.cookies.set(s.cookies),d.requestBody.set(Gh()),s.body&&d.requestBody.merge({content:s.body.content,...s.body.type&&{type:s.body.type}})),s.environment&&(i.get().some(h=>h.name===s.environment)?o.set(s.environment):t?.(s.environment))},[e,n,r,i,o,t])}const mRe="com.redocly.deepLink.opened";let GX=!1;function ORe(){const{warning:t}=Y3(),e=Ue(),n=gRe({onEnvironmentNotFound:i=>t(`Environment "${i}" not found`)}),r=v.useRef(n);r.current=n,v.useEffect(()=>{let i,o=!1;const s=a=>{const l=a[0]&&pRe(a[0]);l&&(r.current(l),e.sendEvent(mRe,[{...pe("deepLink","request"),scheme:a[0].startsWith("redocly-replay:")?"redocly-replay":"replay"}]))};return(async()=>{const{onOpenUrl:a,getCurrent:l}=await import("./redocly-openapi-docs.min.index-YnvLQkG_.js"),c=await a(s);if(o){c();return}if(i=c,!GX){const d=await l();if(o)return;GX=!0,d?.[0]&&s(d)}})(),()=>{o=!0,i?.()}},[])}function vRe(t){const e=t||"default";return{id:Md(og(e)),systemFilesDir:q3.join("/replay",e),userFilesDir:q3.join("/projects",e)}}async function yRe(t){if(!t)throw new Error("Tauri project: userFilesDir is required");const e=Md(og(t)),n=await bRe(),r=await _w(n,"replay",e);return{id:e,systemFilesDir:r,userFilesDir:t}}async function bRe(){return $I()}function o3(t,e){const n=`apis/${t.info.title}`.replace(/\s+/g,"-").toLowerCase(),r=a=>`${a}.yaml`,i=a=>e.some(l=>l.id===r(a));if(!i(n))return r(n);let o=1,s=`${n}-${o}`;for(;i(s);)o++,s=`${n}-${o}`;return r(s)}const xRe=[{suffix:et.Token,getValue:t=>t.token&&Object.prototype.hasOwnProperty.call(t.token,"access_token")?t.token.access_token:void 0},{suffix:et.Username,getValue:t=>t.username},{suffix:et.Password,getValue:t=>t.password},{suffix:et.ClientId,getValue:t=>t.client_id},{suffix:et.ClientSecret,getValue:t=>t.client_secret}];function HX(t,e){const n=[];for(const r of t?.flat()||[]){const i=e[r.id]??e.default;if(!i)continue;const o=r.id;for(const s of xRe){const a=s.getValue(i);Sy(a)&&n.push({name:o+s.suffix,value:a})}}return n}function wRe(t){const e=new Set,n=Object.values(et);for(const r of t.security?.flat()||[])if(r.id)for(const i of n)e.add(r.id+i);return e}function SRe(t,e){const n=new Set,r=wRe(t),i=o=>{if(o.security)for(const{name:s}of HX(t.security,o.security))n.add(s);for(const[s,a]of Object.entries(o.envVariables||{}))Sy(a)&&r.has(s)&&n.add(s)};if(_f(e))return i(e),n;for(const o of Object.values(e))o&&i(o);return n}function kRe(t,e){const n=e.query??{},r=[],i=(o,s)=>{typeof s=="string"&&r.push({name:o,value:s})};for(const o of t.parameters){if(o.in!=="querystring")continue;const s=o7(o),a=new Set(s.map(l=>l.name));for(const l of a)i(l,n[l]);for(const[l,c]of Object.entries(n))for(const d of a)if(l.startsWith(`${d}[`)){i(l,c);break}}return r}function PRe(t,e,n){const r=NB(t,n);if(!r)return[];const i=new Map,o=(s,a,l=!1)=>{i.set(s,{name:s,value:a,isSecret:l})};for(const[s,a]of Object.entries(r.envVariables||{}))o(s,a);for(const{name:s,value:a}of kRe(e,r))o(s,a);for(const s of e.parameters){const a=l7[s.in];if(!a)continue;const l=r[a]?.[s.name];Sy(l)&&o(s.name,String(l))}if(r.security)for(const{name:s,value:a}of HX(e.security,r.security))o(s,a,!0);return Array.from(i.values())}function CRe(t,e){return t.find(n=>n.name===e)}function $Re(t,e,n){const r=Object.entries(e.variables??{}).map(([i,o])=>{const s=n?.variables.find(a=>a.name===i)?.value;return{name:i,value:s??o.default??""}});return{apiId:t,value:n?.value||e.url,specUrl:e.url,variables:r}}function QRe(t,e,n,r,i){const{servers:o,parameters:s}=e,a=s.filter(p=>p.in==="path"),l=jRe(e),c=new Set,d=a.map(p=>{const f=p.example?String(p.example):"";return c.add(p.name),{name:p.name,value:f,isSecret:!1}}),h=p=>l.map(f=>{const m=e.security?.flat().find(O=>{const y=O.id;return f.name.startsWith(y)});let g="";if(m){const O=m.serverValues?.[p];O&&(O["x-defaultUsername"]&&f.name.endsWith(et.Username)?g=O["x-defaultUsername"]:O["x-defaultPassword"]&&f.name.endsWith(et.Password)?g=O["x-defaultPassword"]:O["x-defaultClientId"]&&f.name.endsWith(et.ClientId)?g=O["x-defaultClientId"]:O["x-defaultClientSecret"]&&f.name.endsWith(et.ClientSecret)?g=O["x-defaultClientSecret"]:O["x-defaultAccessToken"]&&(g=O["x-defaultAccessToken"])),g||(m["x-defaultUsername"]&&f.name.endsWith(et.Username)?g=m["x-defaultUsername"]:m["x-defaultPassword"]&&f.name.endsWith(et.Password)?g=m["x-defaultPassword"]:m["x-defaultClientId"]&&f.name.endsWith(et.ClientId)?g=m["x-defaultClientId"]:m["x-defaultClientSecret"]&&f.name.endsWith(et.ClientSecret)?g=m["x-defaultClientSecret"]:m["x-defaultAccessToken"]&&(g=m["x-defaultAccessToken"]))}return c.add(f.name),{name:f.name,value:f.value||g||"",isSecret:f.isSecret}});return{generatedInputs:c,environments:ERe(o).map(p=>{const f=p.name||p.description||p.url,m=CRe(n,f),g=m?.servers.find(C=>C.apiId===t),O=$Re(t,p,g),y=h(p.url),b=PRe(i,e,p.url),w=b.map(C=>C.name),P=m?.inputs.filter(C=>C.value&&!w.includes(C.name))||[];for(const C of b)c.add(C.name);const S=IRe(TRe(P,d,y,b),r?.[f]);return{name:f,inputs:S,servers:[O],state:Tt.Normal}})}}function jRe(t){const e=[];return(t.security?.flat()||[]).forEach(n=>{const r=tO(n),i=n.id;(r===ee.BasicAuth||r===ee.DigestAuth)&&(e.push(So(i+et.Username,!1)),e.push(So(i+et.Password))),r===ee.JWT&&e.push(So(i+et.JWTToken)),r===ee.APIKey&&e.push(So(i+et.APIKey)),r===ee.OAuth2&&(e.push(So(i+et.Token)),zw(n).forEach(o=>{e.push(So(i+et.ClientId)),[K.Implicit,K.ClientCredentialsWithJwtAssertion].includes(o)||e.push(So(i+et.ClientSecret)),o===K.ClientCredentialsWithJwtAssertion&&e.push(So(i+et.ClientAssertion))})),r===ee.OpenIDConnect&&(e.push(So(i+et.Token)),e.push(So(i+et.ClientId)),e.push(So(i+et.ClientSecret)))}),e}function So(t,e=!0){return{name:t,value:"",isSecret:e}}function TRe(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);e.set(r.name,{name:r.name,value:r.value||i?.value||"",isSecret:r.isSecret||i?.isSecret||!1})}return Array.from(e.values())}function s3(t){return typeof t=="string"?{value:t}:t}function IRe(t,e){if(!e)return t;const n=new Set(t.map(o=>o.name)),r=t.map(o=>{const s=e[o.name];if(s===void 0)return o;const{value:a,isSecret:l}=s3(s);return{...o,value:a,...l!==void 0&&{isSecret:l}}}),i=Object.entries(e).filter(([o])=>!n.has(o)).map(([o,s])=>{const{value:a,isSecret:l}=s3(s);return{name:o,value:a,isSecret:l??!1}});return[...r,...i]}function ERe(t){const e=K4(gU?window.location.href:globalThis.SSR_HOSTNAME||"");t.length===0&&(t=[{url:"/"}]);function n(r){return QB(e,r)}return t.map(r=>({...r,url:n(r.url),description:r.description||""}))}function $0(t,e){if(e.size===0)return;const n=t.get({noproxy:!0});for(let r=0;r<n.length;r++){const i=n[r];!Ad(i)||!i.key||!e.has(i.key)||t[r].merge({value:`$inputs.${i.key}`,active:!0})}}function KX(t,e,n){if(typeof e=="string"){const i=zi(e);i&&n.has(i)&&t.set(e);return}if(!e||typeof e!="object"||Array.isArray(e))return;const r=t;for(const[i,o]of Object.entries(e)){const s=r[i];s&&KX(s,o,n)}}function RRe(t,e,n){if(n.size===0)return;const r=t.get({noproxy:!0});for(const i of e){if(!i.securitySchemeId)continue;const o=r.findIndex(s=>s.securitySchemeId===i.securitySchemeId);o!==-1&&KX(t[o],i,n)}}function ARe(t,e,n){const r=Ew(e.parameters,"in");$0(t.parameters.pathParameters,Rc(r.path,"path",n)),$0(t.parameters.queryParameters,d7(r.query,r.querystring,n)),$0(t.parameters.headers,Rc(r.header,"header",n)),$0(t.parameters.cookies,Rc(r.cookie,"cookie",n)),RRe(t.security,eO(e),SRe(e,n))}function JX(t,e,n){if(!t||!t.paths||Object.keys(t.paths).length===0)return{operations:null,error:0};const{operations:r}=DRe(t,e,n);return{operations:r}}function DRe(t,e,n){const r=[];for(const[i,o]of Object.entries(t.paths)){for(const[s,a]of Object.entries(o))s!=="parameters"&&s!=="servers"&&s!=="description"&&s!=="summary"&&s!=="additionalOperations"&&(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=eV(i,s,t,l,e,!1,n);c&&r.push(c)});if(o.additionalOperations)for(const[s,a]of Object.entries(o.additionalOperations))(a.tags&&a.tags.length>0?a.tags:["Untagged"]).forEach(l=>{const{operation:c}=eV(i,s,t,l,e,!0,n);c&&r.push(c)})}return{operations:r}}function eV(t,e,n,r,i,o,s){if(!s)return{operation:null};const a=s(t,e,n);if(!a)return{operation:null};const l=`${n.info.title}/${r}/${a.name}`;return{operation:zae(a,o,i,l)}}const tV=(t,e,n)=>t.find(r=>{if(e&&r.operationId===e)return!0;if(n&&r.apiPath){const{path:i,method:o}=VI({operationPath:n,parsedSourceDescriptions:[]});return r.apiPath.path===i&&r.apiPath.method===o}return!1});class MRe{storage;constructor(e){this.storage=e}findAll(){return this.storage.findAll()}findOne(e){return this.storage.findOne(e)}upsert(e){return this.storage.upsert(e)}remove(e){return this.storage.remove(e)}findRecentChatsPage(e){return this.storage.findRecentChatsPage(e)}}class a3{static instance=null;static async initialize(e,n){this.close(),this.instance=await zRe(e,n)}static getInstance(){if(!this.instance)throw new Error("AiChatService not initialized");return this.instance}static close(){this.instance=null}}async function zRe(t,e){if(e){const{AiChatSqliteDBStorage:n}=await import("./redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js"),r=kp.getInstance(),i=new n(r);return new MRe(i)}else throw new Error("Not implemented")}const cd="ai-chat",l3="detail",_Re="title",nV="infinite-history",rV={all:()=>[cd],details:()=>[cd,l3],detail:t=>[cd,l3,t],detailTitle:t=>[cd,l3,t,_Re],infiniteHistories:()=>[cd,nV],infiniteHistory:t=>[cd,nV,t]},qRe=({children:t,settings:e,api:n,activeOperationId:r,activeOperationPointer:i,onLoad:o})=>{const s=v.useContext(uR),a=Ue(),l=fa(),c=v.useMemo(async()=>{const h=an()?await yRe(e.storageKey):vRe(e.storageKey);e.layout!=="preview"&&an()&&dp.initialize();const{isInitialized:p}=await s.init(h,e,a);if(e.layout!=="preview"){if(an()){const w=`${h.systemFilesDir}/replay.db`;await kp.initialize(w),await a3.initialize(h,an())}await Ba.initialize(h,an()),await Ul.initialize(an());try{await Ul.getInstance()?.pruneOlderThan(Date.now()-cge)}catch(w){console.error("Failed to prune step context:",w)}try{const w=await D1e.migrate(h,Ba.getInstance(),an());w.migrated&&a.sendEvent("com.redocly.history.migration",[{...pe("migration","historyMigration","storage"),status:"success",itemCount:w.itemCount}])}catch(w){console.error("History migration failed:",w),a.sendEvent("com.redocly.history.migration",[{...pe("migration","historyMigration","storage"),status:"error",error:w instanceof Error?w.message:"Unknown error"}])}}if(!p)return;if(!n){s.environments.length===0&&s.environments.set(i4);return}const f=o3(n,[]),{operations:m}=JX(n,f,e.convertOperationToReplayValue);if(!m?.length||!m[0].collectionPath?.split("/")?.[0]||(s.apis.set([{id:f,srcType:Fr.FS,...n}]),s.predefinedApiId.set(f),!r&&!i))return;const g=tV(m,r,i),{path:O,method:y}=g?.apiPath||{};if(!g||!O||!y)return;const b=e.convertOperationToReplayValue?.(O,y,n);b&&iV(s,f,b,e),XRe(s,{apiId:f,path:O,method:y,operationId:g.operationId,isAdditionalOperation:g.isAdditionalOperation},b,e.dynamicReplayValues)},[e.storageKey]);v.useEffect(()=>{if(e.layout!=="preview")return l.invalidateQueries({queryKey:xr.all}),l.invalidateQueries({queryKey:rV.all()}),l.invalidateQueries({queryKey:up.all}),()=>{Ba.close(),a3.close(),dp.close(),Ul.close(),an()&&kp.close().catch(h=>{console.error("Failed to close SqliteDBConnection:",h)})}},[e.storageKey,e.layout,l]),v.useEffect(()=>{if(!n||!e.convertOperationToReplayValue)return;const h=o3(n,[]),{operations:p}=JX(n,h,e.convertOperationToReplayValue);if(!p?.length)return;const f=tV(p,r,i),{path:m,method:g}=f?.apiPath||{};if(!f||!m||!g)return;const O=e.convertOperationToReplayValue(m,g,n);O&&iV(s,h,O,e)},[e.convertOperationToReplayValue,e.predefinedEnvValues,e.dynamicReplayValues,e.allowedEnvironments,e.selectedEnvironment,n,r,i]);const d=e.layout==="preview"?null:u.jsx(iRe,{projectPath:e.storageKey});return u.jsx(v.Suspense,{fallback:d,children:u.jsx(NRe,{initStore:c,settings:e,api:n,onLoad:o,children:t})})};function NRe({initStore:t,children:e,settings:n,api:r,onLoad:i}){return v.use(t),Pfe(n,r),v.useEffect(()=>{i?.()},[]),u.jsxs(ze.Fragment,{children:[an()&&u.jsx(ZRe,{}),e]},n.storageKey)}function ZRe(){return ORe(),null}const iV=(t,e,n,r)=>{const i=t.environments.get({noproxy:!0}),{environments:o,generatedInputs:s}=QRe(e,n,i,r.predefinedEnvValues,r.dynamicReplayValues);t.predefinedInputNames.set(s);let a,l,c;if(r.allowedEnvironments?.length){const d=o.filter(h=>r.allowedEnvironments?.includes(h.name));a=new Set(d.map(h=>h.name)),l=d,c=l.find(h=>h.name===r.selectedEnvironment)?.name||l[0]?.name||""}else{a=new Set(o.map(h=>h.name)),l=[...o,...i.filter(h=>!a.has(h.name))];const d=t.activeEnvironmentId.get();c=l.find(h=>h.name===d)?.name||l.find(h=>h.name===r.selectedEnvironment)?.name||l[0]?.name||""}t.predefinedEnvironmentNames.set(a),Hv(l,t.environments.get({noproxy:!0}))||t.environments.set(l),t.activeEnvironmentId.set(c)},XRe=(t,e,n,r)=>{const i=t.tabsState.tabs.get().findIndex(({data:o})=>pn(o,Ne.Step)&&o.draftStep?.operation?.apiId===e.apiId&&o.draftStep?.operation?.path===e.path&&o.draftStep?.operation?.method===e.method);if(i!==-1){const o=t.tabsState.tabs[i],s=o.data.get();if(n&&r&&pn(s,Ne.Step)){const a=o.data.draftStep.ornull;a&&ARe(a,n,r)}t.tabsState.activeTabIdx.set(i)}else{const o=L5(e,n,r);t.tabsState.tabs.merge([{...o,state:yn.Normal}]),t.tabsState.activeTabIdx.set(t.tabsState.tabs.length-1)}},oV=v.createContext({ReplayGate:null,ReplayTopBarActions:null}),VRe=oV.Provider,URe=()=>v.useContext(oV);function WRe(t){const{activeEnvironmentId:e}=Je(),[n,r]=v.useState(),[i,o]=v.useState(),s=v.useMemo(()=>t.predefinedEnvValues||n?LRe(t.predefinedEnvValues,n):void 0,[t.predefinedEnvValues,n]),a=v.useMemo(()=>({...t,...s&&{predefinedEnvValues:s},...i&&{selectedEnvironment:i}}),[t,s,i]),l=v.useCallback((d,h)=>r(p=>({...p,[d]:{...p?.[d],...h}})),[]),c=v.useCallback(d=>{o(d),e.set(d)},[e]);return{mergedSettings:a,setEnvValues:l,setSelectedEnvironment:c}}function LRe(t,e){const n={...t};for(const[r,i]of Object.entries(e??{}))n[r]={...n[r],...i};return n}const sV=v.createContext({renderProjectSelect:()=>null});function YRe(){return v.useContext(sV)}function FRe(){const{environments:t,activeEnvironmentId:e}=Je(),{sendEvent:n}=Ue(),r=v.useCallback(o=>{e.set(o),n("com.redocly.environment.management",[{...pe("environment","headerPanelEnvironment"),action:"selected",name:o}])},[e,n]),i=v.useCallback((o,s)=>{const a=t.find(c=>c.name.get()===o);if(!a)return;const l=a.inputs.get();for(const[c,d]of Object.entries(s)){const{value:h,isSecret:p}=s3(d),f=l.findIndex(m=>m.name===c);f!==-1?a.inputs[f].merge({value:h,...p!==void 0&&{isSecret:p}}):a.inputs.merge([{name:c,value:h,isSecret:p??!1}])}},[t]);return{environments:t.get(),activeEnvironment:e.get(),setSelectedEnvironment:r,setEnvironmentValues:i}}function BRe(){const{renderProjectSelect:t}=YRe(),{layout:e,apiId:n}=ir(),{apis:r}=Je(),{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a}=FRe(),{ReplayTopBarActions:l}=URe(),c=r[0]?.get()?.info?.title,d=!t&&e==="overlay"&&c;return u.jsxs(GRe,{children:[t&&u.jsx(aV,{children:u.jsx(t,{})}),d&&u.jsx(aV,{children:u.jsx(HRe,{children:c})}),u.jsxs(KRe,{children:[l&&u.jsx(l,{environments:i,activeEnvironment:o,setEnvironmentValues:s,setSelectedEnvironment:a,apiId:n}),u.jsx(YX,{})]})]})}const GRe=x.div`
|
|
6861
6861
|
display: flex;
|
|
6862
6862
|
padding: 0 var(--spacing-xs);
|
|
6863
6863
|
height: 40px;
|
|
@@ -7687,7 +7687,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
7687
7687
|
border-right: ${({$isOverlayLayout:t})=>t?"1px solid var(--border-color-secondary)":"none"};
|
|
7688
7688
|
width: 100%;
|
|
7689
7689
|
user-select: none;
|
|
7690
|
-
`;function IV({children:t}){const{apps:{apiId:e}}=Je(),{sendEvent:n}=Ue(),{tabsParams:r}=j0(e.get(),!1),[i,o]=v.useState(r[0]?.key||null),s=v.useCallback(l=>{o(l),n("com.redocly.tab.change",[{...pe("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:s};return u.jsx(CV.Provider,{value:a,children:t})}function nze(){const[t,e]=v.useState(()=>{const n=document.documentElement.clientWidth;return EV(n)});return v.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(EV(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function EV(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const rze={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},m3=v.createContext(rze);function O3(){return v.useContext(m3)}const ize=v.lazy(()=>import("./redocly-openapi-docs.min.AiPanel-
|
|
7690
|
+
`;function IV({children:t}){const{apps:{apiId:e}}=Je(),{sendEvent:n}=Ue(),{tabsParams:r}=j0(e.get(),!1),[i,o]=v.useState(r[0]?.key||null),s=v.useCallback(l=>{o(l),n("com.redocly.tab.change",[{...pe("tab","sidePanelTab"),source:"side_panel",name:l}])},[n]),a={tabsParams:r,activeTab:i,onTabChange:s};return u.jsx(CV.Provider,{value:a,children:t})}function nze(){const[t,e]=v.useState(()=>{const n=document.documentElement.clientWidth;return EV(n)});return v.useEffect(()=>{const n=()=>{const r=document.documentElement.clientWidth;e(EV(r))};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function EV(t){return t>=1512?24:t>=1280?28:t>=1024?32:35}const rze={isOpen:!1,openPanel:()=>{},closePanel:()=>{}},m3=v.createContext(rze);function O3(){return v.useContext(m3)}const ize=v.lazy(()=>import("./redocly-openapi-docs.min.AiPanel-DTzHqAiI.js").then(t=>({default:t.AiPanel}))),oze=20,sze=25,aze=40;function lze({panel:t,panelProps:e}){const[n,r]=v.useState(!1),{layout:i,aiEnabled:o}=ir(),s=nze(),{isOpen:a,openPanel:l,closePanel:c}=O3(),{panelProps:d,panel:h}=A1(!a),p=o===!0,f=i==="overlay",{onCollapse:m,onExpand:g,...O}=d;return v.useEffect(()=>{a&&h.isCollapsed&&h.expand(),!a&&!h.isCollapsed&&h.collapse()},[h,a]),i==="preview"?u.jsx(C0,{hideTabs:!0}):f?u.jsx(IV,{children:u.jsxs(RV,{direction:"horizontal",autoSaveId:"replay-layout-overlay",children:[u.jsx(wf,{id:"main-panel",defaultSize:75,minSize:55,$isResizing:n,children:u.jsx(C0,{})}),u.jsx(df,{direction:"vertical",onDragging:r}),u.jsx(wf,{id:"content-panel",defaultSize:30,minSize:s,...e,$isResizing:n,children:u.jsx(TV,{isOverlayLayout:f})}),u.jsx(QV,{panel:t,isOverlayLayout:f})]})}):u.jsx(IV,{children:u.jsxs(RV,{direction:"horizontal",autoSaveId:"replay-layout",children:[u.jsx(QV,{panel:t,isOverlayLayout:f}),u.jsx(wf,{id:"content-panel",defaultSize:30,minSize:s,...e,$isResizing:n,children:u.jsx(TV,{isOverlayLayout:f})}),u.jsx(df,{direction:"vertical",onDragging:r}),u.jsx(wf,{id:"main-panel",defaultSize:70,minSize:aze,$isResizing:n,children:u.jsx(C0,{})}),p&&u.jsxs(u.Fragment,{children:[u.jsx(df,{direction:"vertical",onDragging:r}),u.jsx(wf,{...O,id:"ai-panel",defaultSize:a?sze:0,collapsedSize:0,minSize:oze,maxSize:50,$isResizing:n,onCollapse:()=>{m?.(),c()},onExpand:()=>{g?.(),l()},children:u.jsx(v.Suspense,{fallback:null,children:u.jsx(ize,{})})})]})]})})}const RV=x(R1)`
|
|
7691
7691
|
padding: 0 var(--spacing-xs);
|
|
7692
7692
|
`,wf=x(Vu)`
|
|
7693
7693
|
transition-property: ${t=>t.$isResizing?"none":"flex-grow"};
|
|
@@ -7697,7 +7697,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
7697
7697
|
@media (prefers-reduced-motion: reduce) {
|
|
7698
7698
|
transition-duration: 0s;
|
|
7699
7699
|
}
|
|
7700
|
-
`,cze=v.lazy(()=>import("./redocly-openapi-docs.min.AiChatProvider-
|
|
7700
|
+
`,cze=v.lazy(()=>import("./redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js").then(t=>({default:t.AiChatProvider}))),uze=({className:t,renderProjectSelect:e})=>{const{isMobile:n,closeButton:r}=us(),i=A1(!1),{layout:o,aiEnabled:s}=ir(),a=o==="preview",l=s===!0,c=n?u.jsx(ZMe,{}):u.jsxs(u.Fragment,{children:[!a&&u.jsx(BRe,{}),u.jsx(lze,{panel:i.panel,panelProps:i.panelProps})]});return u.jsxs(u.Fragment,{children:[!n&&!a&&r,u.jsx(hze,{className:t,isPreviewLayout:a,children:u.jsx(QIe,{onError:d=>console.error(d),children:u.jsx(GMe,{children:u.jsx(HMe,{renderProjectSelect:e,children:l?u.jsx(v.Suspense,{fallback:null,children:u.jsx(cze,{children:c})}):c})})})})]})};function dze({className:t,renderProjectSelect:e}){return u.jsx(uze,{className:t,renderProjectSelect:e})}const hze=x.div`
|
|
7701
7701
|
display: flex;
|
|
7702
7702
|
flex-direction: column;
|
|
7703
7703
|
height: 100vh;
|