@kong-ui-public/entities-plugins 9.219.1 → 9.220.0

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.
@@ -1,6 +1,6 @@
1
1
  (function(De,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong/icons"),require("@kong/kongponents"),require("@vue-flow/background"),require("@vue-flow/controls"),require("@vue-flow/core"),require("@vueuse/core"),require("@kong-ui-public/i18n"),require("@vue-flow/controls/dist/style.css"),require("@vue-flow/core/dist/style.css"),require("@vue-flow/core/dist/theme-default.css"),require("@kong-ui-public/entities-shared"),require("@kong-ui-public/entities-plugins-icon"),require("@kong-ui-public/entities-plugins-metadata"),require("@kong-ui-public/forms"),require("marked"),require("dompurify"),require("@kong-ui-public/monaco-editor"),require("monaco-editor"),require("vue-router"),require("@kong-ui-public/monaco-editor/dist/runtime/style.css"),require("@kong-ui-public/entities-redis-configurations"),require("@kong-ui-public/entities-redis-configurations/dist/style.css"),require("@kong-ui-public/entities-vaults"),require("shiki"),require("zod"),require("axios"),require("@kong-ui-public/entities-vaults/dist/style.css"),require("@kong-ui-public/forms/dist/style.css")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","@kong/kongponents","@vue-flow/background","@vue-flow/controls","@vue-flow/core","@vueuse/core","@kong-ui-public/i18n","@vue-flow/controls/dist/style.css","@vue-flow/core/dist/style.css","@vue-flow/core/dist/theme-default.css","@kong-ui-public/entities-shared","@kong-ui-public/entities-plugins-icon","@kong-ui-public/entities-plugins-metadata","@kong-ui-public/forms","marked","dompurify","@kong-ui-public/monaco-editor","monaco-editor","vue-router","@kong-ui-public/monaco-editor/dist/runtime/style.css","@kong-ui-public/entities-redis-configurations","@kong-ui-public/entities-redis-configurations/dist/style.css","@kong-ui-public/entities-vaults","shiki","zod","axios","@kong-ui-public/entities-vaults/dist/style.css","@kong-ui-public/forms/dist/style.css"],e):(De=typeof globalThis<"u"?globalThis:De||self,e(De["kong-ui-public-entities-plugins"]={},De.Vue,De.KongIcons,De.Kongponents,De.background,De.controls,De.core$1,De.core,De["kong-ui-public-i18n"],null,null,null,De["kong-ui-public-entities-shared"],De.entitiesPluginsIcon,De.entitiesPluginsMetadata,De.forms,De.marked,De.DOMPurify,De.monacoEditor,De.monaco,De.VueRouter,null,De.entitiesRedisConfigurations,null,De.entitiesVaults,De.shiki,De.zod,De.axios))})(this,function(De,e,Re,Fe,GC,Ih,Nt,Tt,jt,Q8,eK,tK,Ie,Er,fe,Ze,el,HC,ua,lo,Nr,nK,Bh,rK,da,zC,Q,zo){"use strict";function WC(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>n[r]})}}return t.default=n,Object.freeze(t)}function YC(n,t){for(var r=0;r<t.length;r++){const o=t[r];if(typeof o!="string"&&!Array.isArray(o)){for(const i in o)if(i!=="default"&&!(i in n)){const a=Object.getOwnPropertyDescriptor(o,i);a&&Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:()=>o[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const tl=WC(lo),Yt={actions:{cancel:"Cancel",view_configuration:"View configuration",create:"New plugin",create_custom:"Create",configure:"Configure",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",enable:"Enable",enabled:"Enabled",delete:"Delete",disabled:"Disabled",confirm_delete:"Yes, delete",view:"View details",configure_dynamic_ordering:"Configure dynamic ordering",go_to_plugins:"Go to plugins",save:"Save",add_entity:"Add {entity}",remove_entity:"Remove {entity}",loading_spinner:"Loading..."},view_configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML, JSON, or Terraform. This allows for straightforward importing into APIOps tools like decK with YAML, Insomnia and cURL with JSON, or Terraform products with Terraform.",yaml:"YAML",terraform:"Terraform",json:"JSON",deck:"decK"},delete:{title:"Delete a plugin",custom_title:"Delete {name}",custom_plugin:"Custom plugin",description:"This action cannot be reversed.",description_custom:"Please ensure this plugin is not in use. This action cannot be reversed.",plugin_schema_in_use_title:"Unable to delete custom plugin",plugin_schema_in_use_message:"This custom plugin is currently in use in this control plane. Please delete any existing instances before removing this schema.",confirmModalText1:"Are you sure you want to delete",confirmModalText2:"Please ensure this plugin is not in use. This delete action cannot be reversed.",confirm_text:"Type {name} to confirm your action",success_message:"Successfully deleted custom plugin {name}"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard",tooltip:"Copy {label}",success_tooltip:"Copied!"},errors:{general:"Plugins could not be retrieved",delete:"The plugin could not be deleted at this time.",copy:"Failed to copy to clipboard",load_results:"Error loading available plugins",load_schema:"Error loading plugin schema"},search:{placeholder:{konnect:"Filter by name",exact:"Filter by exact instance name or ID",kongManager:"Filter by exact instance name or ID",select:"Filter plugins",search_plugins:"Search plugins"},filter:{field:{enabled:"Enabled"}},no_results:'No results found for "{filter}"'},labels:{new:"New"},plugins:{title:"Plugins",list:{toolbar_actions:{new_plugin:"New plugin"},table_headers:{applied_to:"Applied to",applied_to_badges:{consumer:"Consumer",global:"Global",route:"Route",service:"Service",consumer_group:"Consumer group"},id:"ID",name:"Name",instance_name:"Instance name",ordering:"Ordering",ordering_badge:{dynamic:"Dynamic",static:"Static"},enabled:"Enabled",tags:"Tags"},empty_state:{title:"Configure a new plugin",description:"Plugins are used to extend Kong functionality."},empty_state_v2:{title:"Configure your first plugin",description:"Plugins extend gateways functionalities, offering features like authentication, rate limiting, and request transformations to enhance security and performance.",create_cta:"New plugin",group:"Plugins created in gateways within this group will automatically appear here.",learn_more:"Learn more"}},meta:{"basic-auth":{name:"Basic Authentication",credential_name:"Basic Auth Credential",description:"Add Basic Authentication to your services"},"hmac-auth":{name:"HMAC Authentication",credential_name:"HMAC Credential",description:"Add HMAC Authentication to your services"},"jwt-signer":{name:"JWT Signer",description:"Verify and (re-)sign one or two tokens in a request"},jwt:{name:"JWT",credential_name:"JWT Credential",description:"Verify and authenticate JSON Web Tokens"},"key-auth":{name:"Key Authentication",credential_name:"Key Auth Credential",description:"Add key authentication to your services"},"key-auth-enc":{name:"Key Authentication Encrypted",credential_name:"Key Auth Encrypted",description:"Add key authentication to your services with an encrypted token"},"ldap-auth-advanced":{name:"LDAP Authentication Advanced",description:"Integrate Kong with a LDAP server"},"ldap-auth":{name:"LDAP Authentication",description:"Integrate Kong with a LDAP server"},"oauth2-introspection":{name:"OAuth 2.0 Introspection",description:"Integrate Kong with a third-party OAuth 2.0 Authorization Server"},oauth2:{name:"OAuth 2.0 Authentication",credential_name:"OAuth 2.0 Application",description:"Add OAuth 2.0 authentication to your services"},"openid-connect":{name:"OpenID Connect",description:"Integrate Kong with a third-party OpenID Connect 1.0 provider"},"mtls-auth":{name:"Mutual TLS Authentication",description:"Secure routes and services with client certificate and mutual TLS authentication"},"vault-auth":{name:"Vault Authentication",description:"Secure routes and services with an access token and secret token, stored securely via Vault"},"bot-detection":{name:"Bot Detection",description:"Detect and clock bots or custom clients"},cors:{name:"CORS",description:"Allow developers to make requests from the browser"},"ip-restriction":{name:"IP Restriction",description:"Whitelist or blacklist IPs that can make requests"},opa:{name:"OPA",description:"Authorize requests against Open Policy Agent"},"kubernetes-sidecar-injector":{name:"Kubernetes Sidecar Injector",description:"This plugin will inject Kong dataplane nodes and form a service mesh on top of Kubernetes"},"request-validator":{name:"Request Validator",description:"Validate requests before they reach their upstream service."},acl:{name:"ACL",credential_name:"Access Control Group",description:"Control which consumers can access services"},canary:{name:"Canary Release",description:"Methodically roll out software changes to a subset of users"},"forward-proxy":{name:"Forward Proxy",description:"Allow Kong to connect to intermediary transparent HTTP proxies"},"proxy-cache":{name:"Proxy Caching",description:"Cache and serve commonly requested responses in Kong"},"proxy-cache-advanced":{name:"Proxy Caching Advanced",description:"Cache and serve commonly requested responses in Kong"},"graphql-proxy-cache-advanced":{name:"GraphQL Proxy Caching Advanced",description:"Cache and serve commonly requested responses in Kong"},"rate-limiting-advanced":{name:"Rate Limiting Advanced",description:"Rate-limit how many HTTP requests a developer can make"},"rate-limiting":{name:"Rate Limiting",description:"Rate-limit how many HTTP requests a developer can make"},"graphql-rate-limiting-advanced":{name:"GraphQL Rate Limiting Advanced",description:"Rate-limit how many HTTP requests a developer can make"},mocking:{name:"Mocking",description:"Provide mock endpoints to test your APIs in development against your services"},"request-size-limiting":{name:"Request Size Limiting",description:"Block requests with bodies greater than a specific size"},"request-termination":{name:"Request Termination",description:"Terminate all requests with a specific response"},"response-ratelimiting":{name:"Response Rate Limiting",description:"Rate-Limiting based on a custom response header value"},"route-by-header":{name:"Route by Header",description:"Route requests based on request headers"},"ai-proxy":{name:"AI Proxy",description:"Directly call a configured LLM, with mediated security and tuning parameters, and using standardised Kong request and response formats."},"ai-prompt-decorator":{name:"AI Prompt Decorator",description:"Prepend and append chat prompts to AI Proxy plugin LLM requests."},"ai-prompt-template":{name:"AI Prompt Template",description:"Define a set of templates, containing string variable placeholders, that can be consumed by users when used with the AI Proxy plugin."},"ai-prompt-guard":{name:"AI Prompt Guard",description:"Define a set of valid, and a set of invalid, regular expression patterns when calling LLM models with the AI Proxy plugin."},"ai-request-transformer":{name:"AI Request Transformer",description:"Use an LLM to transform API request from a user, before sending to the upstream service."},"ai-response-transformer":{name:"AI Response Transformer",description:"Use an LLM to transform API responses from the upstream service, before returning to the user."},"ai-rate-limiting-advanced":{name:"AI Rate Limiting Advanced",description:"Provides rate limiting for the providers used by any AI plugins."},"ai-azure-content-safety":{name:"AI Azure Content Safety",description:"Allows checking and auditing of AI-Proxy plugin messages, using Azure Cognitive Services, before proxying to upstream large-language model."},"aws-lambda":{name:"AWS Lambda",description:"Invoke and manage AWS Lambda functions from Kong"},"azure-functions":{name:"Azure Functions",description:"Invoke Azure functions"},openwhisk:{name:"OpenWhisk",description:"Invoke and manage OpenWhisk actions from Kong"},"pre-function":{name:"Kong Functions (Pre-Plugins)",description:"Add and manage custom lua functions to run before other plugins"},"post-function":{name:"Kong Functions (Post-Plugins)",description:"Add and manage custom lua functions to run after other plugins"},datadog:{name:"Datadog",description:"Visualize metrics on Datadog"},prometheus:{name:"Prometheus",description:"Export performance metrics to Prometheus"},zipkin:{name:"Zipkin",description:"Propagate zipkin spans and report spans to a zipkin server"},collector:{name:"Collector",description:"Automate spec-driven development & anomaly detection (Early Access)"},"response-transformer-advanced":{name:"Response Transformer Advanced",description:"Transform the response sent by the upstream server on the fly on Kong, before returning the response to the client."},"correlation-id":{name:"Correlation ID",description:"Correlate requests and responses using a unique ID"},"request-transformer-advanced":{name:"Request Transformer Advanced",description:"Use powerful regular expressions, variables and templates to transform API requests"},"request-transformer":{name:"Request Transformer",description:"Modify the request before hitting the upstream server"},"response-transformer":{name:"Response Transformer",description:"Modify the upstream response before returning it to the client"},"route-transformer-advanced":{name:"Route Transformer Advanced",description:"Transforms the routing on the fly in Kong, changing the upstream server/port/path to hit"},"kafka-upstream":{name:"Kafka Upstream",description:"Transform requests into Kafka messages in a topic"},degraphql:{name:"DeGraphQL",description:"Transform a GraphQL upstream into a REST API"},"exit-transformer":{name:"Exit Transformer",description:"Customize Kong exit responses sent downstream"},jq:{name:"jq",description:"Transform JSON objects included in API requests or responses using jq programs"},"file-log":{name:"File Log",description:"Append request and response data to a log file on disk"},"http-log":{name:"HTTP Log",description:"Send request and response logs to an HTTP server"},loggly:{name:"Loggly",description:"Send request and response logs to Loggly"},"statsd-advanced":{name:"StatsD Advanced",description:"Send traffic and Kong performance metrics to StatsD"},statsd:{name:"StatsD",description:"Send request and response logs to StatsD"},syslog:{name:"Syslog",description:"Send request and response logs to Syslog"},"tcp-log":{name:"TCP Log",description:"Send request and response logs to a TCP server"},"udp-log":{name:"UDP Log",description:"Send request and response logs to a UDP server"},"kafka-log":{name:"Kafka Log",description:"Publish request and response logs to a Kafka topic"},session:{name:"Session",description:"Sessions for Kong authentication"},"upstream-tls":{name:"Upstream TLS",description:"Enable TLS on upstream traffic by providing Kong with a list of trusted certificates."},"application-registration":{name:"Portal Application Registration",description:"Allow portal developers to register applications against services"},"konnect-application-auth":{name:"Konnect Application Auth",description:"Allow Konnect portal developers to register applications against services"},acme:{name:"ACME",description:"Let's Encrypt and ACMEv2 integration with Kong"},"grpc-gateway":{name:"gRPC Gateway",description:"Access gRPC services through HTTP REST"},"grpc-web":{name:"gRPC Web",description:"Allow browser clients to call gRPC services"},"upstream-timeout":{name:"Upstream Timeout",description:"Configure read, send and connect timeouts to an upstream"},opentelemetry:{name:"OpenTelemetry",description:"Propagate distributed tracing spans and report low-level spans to a OTLP-compatible server"},"websocket-validator":{name:"WebSocket Validator",description:"Validate individual WebSocket messages against to a user-specified schema before proxying them"},"websocket-size-limit":{name:"WebSocket Size Limit",description:"Allows operators to specify a maximum size for incoming WebSocket messages"},"tls-metadata-headers":{name:"TLS Metadata Headers",description:"Detects client certificates in requests, retrieves the TLS metadata, and proxies this metadata via HTTP headers"},"tls-handshake-modifier":{name:"TLS Handshake Modifier",description:"Requests the client certificate and if it exists, makes it available to other plugins acting on the request"},"oas-validation":{name:"OAS Validation",description:"Validate HTTP requests and responses based on an API specification."},"jwe-decrypt":{name:"Kong JWE Decrypt",description:"The Kong JWE Decrypt plugin makes it possible to decrypt an inbound token(JWE) in a request."},"xml-threat-protection":{name:"XML Threat Protection",description:"Reduce the risk of XML attacks by checking the structure of XML payloads."},saml:{name:"SAML",description:"Security Assertion Markup Language (SAML) is an open standard for exchanging authentication and authorization data between an identity provider and a service provider."},"app-dynamics":{name:"AppDynamics",description:"This plugin integrates Kong with the AppDynamics APM platform so that proxy requests handled by Kong can be identified and analyzed in AppDynamics."},"json-threat-protection":{name:"JSON Threat Protection",description:"Apply size checks on JSON payload and minimize risk of content-level attacks"},"standard-webhooks":{name:"Standard Webhooks",description:"Validate incoming webhooks adhere to the Standard Webhooks specification, to which Kong is a contributor"},"ai-proxy-advanced":{name:"AI Proxy Advanced",description:"Route across different LLMs and models using advanced load balancing algorithms, including semantic routing."},"ai-semantic-cache":{name:"AI Semantic Cache",description:"Semantically cache AI requests to any LLM to reduce latency, improve end-user experiences and optimize GenAI costs."},"ai-semantic-prompt-guard":{name:"AI Semantic Prompt Guard",description:"Semantically and intelligently create allow and deny lists of topics that can be requested across every LLM."},"header-cert-auth":{name:"Header Certificate Authentication",description:"Authenticate clients with MTLS certificate passed in header by a WAF or load balancer"},"upstream-oauth":{name:"Upstream OAuth",description:"Configure Kong to obtain a OAuth2 token to consume an upstream API"},confluent:{name:"Confluent",description:"Streamlines integration with Confluent Cloud and transforms requests into messages published to a Confluent topic."},"service-protection":{name:"Service Protection",description:"Prevent abuse and protect services with absolute limits on the number of requests reaching the service."},"injection-protection":{name:"Injection Protection",description:"Protect against injection attacks by rejecting requests that match common injections patterns."},redirect:{name:"Redirect",description:"Redirect incoming requests to a new URL"},"kafka-consume":{name:"Kafka Consume",description:"Consume messages from Kafka topics over HTTP protocols."},"confluent-consume":{name:"Confluent Consume",description:"Consume messages from Confluent Kafka topics over HTTP protocols"},"request-callout":{name:"Request Callout",description:"Callout to third party APIs as part of request processing."},"ai-sanitizer":{name:"AI Sanitizer",description:"Sanitize personal or sensitive information from prompts before sending to LLM."},"ai-rag-injector":{name:"AI RAG Injector",description:"Attach contextual knowledge from vector databases with flexible template to LLM prompts."},datakit:{name:"Datakit",description:"Datakit is a workflow engine for working with external APIs."},"ai-prompt-compressor":{name:"AI Prompt Compressor",description:"The AI Prompt Compressor reduces costs associated with LLMs by compressing prompts."},"solace-upstream":{name:"Solace Upstream",description:"Transform requests into Solace messages in a Solace queue or topic."},"ai-aws-guardrails":{name:"AI AWS GuardRails",description:"The AI AWS GuardRails enables enforcement of introspection with the AWS GuardRails service for all requests processed by the AI Proxy plugin."},ace:{name:"Konnect Access Control Enforcement",description:"Enable Developer Self-Service for Konnect Dev Portals."},"solace-consume":{name:"Solace Consume",description:"Consume messages from Solace and make them available through HTTP endpoints."},"solace-log":{name:"Solace Log",description:"Publish request and response logs to a Solace topic."},"ai-llm-as-judge":{name:"AI LLM Judge",description:"Evaluate LLM responses with an external LLM service and use accuracy scores to drive dynamic load balancing for `llm/v1/chat` requests."},"ai-mcp-proxy":{name:"AI MCP Proxy",description:"Convert APIs into MCP tools, proxy MCP servers, expose multiple MCP tools, and observe MCP traffic in real time."},"ai-gcp-model-armor":{name:"AI GCP Model Armor",description:"Audit and validate AI Proxy messages with Google Cloud Model Armor before forwarding them to an upstream LLM."},"ai-mcp-oauth2":{name:"AI MCP OAuth2",description:"Secure MCP server access with OAuth2 authentication."},"ai-semantic-response-guard":{name:"AI Semantic Response Guard",description:"Permit or block prompts based on semantic similarity to known LLM responses, preventing misuse of `llm/v1/chat` or `llm/v1/completions` requests."},"ai-lakera-guard":{name:"AI Lakera Guard",description:"Audit and enforce safety policies on LLM requests and responses using the AI AWS Lakera plugin before they reach upstream LLMs."},"ai-a2a-proxy":{name:"AI A2A Proxy",description:"Securely proxy A2A agents, with real-time RPC tracing and monitoring."},"ai-custom-guardrail":{name:"AI Custom Guardrail",description:"Integrate with any 3rd-party Guardrail service, with customizable enforcement modes — choose whether violations block, log, or allow traffic to proceed."},"metering-and-billing":{name:"Metering & Billing",description:"Meter API requests and AI token usage for usage-based billing. Supports flexible customer identification, custom pricing dimensions, and fine-grained traffic filtering. Integrates natively with Konnect Metering & Billing."}},fields:{service:"Service ID",route:"Route ID",consumer:"Consumer ID",consumer_group:"Consumer group ID"},select:{custom_badge_text:"This plugin is data plane node specific",cloned_from_badge:"Cloned from {link}",installed_custom_badge:"Installed custom",streamed_custom_badge:"Streamed custom",unavailable_tooltip:"This plugin is not available",already_exists:"This plugin is already applied to this resource",misc_plugins:"Other plugins",show_all:"Show all",view_more:"View more",view_less:"View less",filter:{title:"Filter plugins",featured:"Featured",type:"Type",clear:"Clear"},list:{table_headers:{name:"Plugin",description:"Description"}},tabs:{kong:{title:"Kong plugins",description:"Kong plugins are bundled by default with Kong Gateway and are available across all control planes.",empty_title:"No plugins",empty_description:"No plugins are available."},custom:{title:"Custom plugins",description:"Custom plugins will be available in this control plane only.",disabled_tooltip:"Custom plugins are not available with this gateway. Create a hybrid or dedicated cloud gateway to leverage custom plugins.",fetch_error:"Unable to load some custom plugins. Bundled plugins are still available.",license_required:"Plugin cloning requires a license to be used.",empty_title:"No custom plugins",empty_description:"No custom plugins have been added to this control plane.",create:{name:"Custom plugin",description:"Upload schema file to create custom plugin"}}},highlighted_plugins:{title:"Highlighted plugins"}},form:{button_deck_customize:"Customize before copying to CLI",disable_data_retrieving:"You do not have permission to select {scope}",disable_source_scope_change:"Changing the {scope} is not allowed when configuring a plugin under it",no_selection:"No selection...",fields:{enabled:{label:"Enabled",on_text:"This plugin is enabled",off_text:"This plugin is disabled"},plugin_status:{label:"Plugin status",text_on:"Enabled",text_off:"Disabled"},instance_name:{label:"Name",placeholder:"Enter a unique name",help:"A custom name for this plugin instance to help with identifying from the list view."},condition:{label:"Execution condition",placeholder:"Enter an expression",tooltip:"An expression used for conditional control over plugin execution. If the expression evaluates to true during the request flow, the plugin is executed; otherwise, it is skipped.",help:{learn:"Learn more",about:"{link} about plugin conditions."}},protocols:{label:"Protocols",placeholder:"Select valid protocols for the plugin",placeholderWithDefaultValues:"Select valid protocols for the plugin. Default protocols: {protocols}",help:"A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type."},tags:{label:"Tags",help:"An optional set of strings for grouping and filtering, separated by commas.",placeholder:"Tag1, Tag2, Tag3"}},scoping:{label:"Scoped",placeholder:"Search by name or UUID",disable_global_radio:"The plugin is set to 'scoped' by default. To apply a plugin globally, please navigate to the global plugin list page.",global:{label:"Global",help:"All services, routes, and consumers"},gateway_service:{label:"Select a gateway service",help:"The gateway service to which this plugin configuration will apply",placeholder:"Select a gateway service",plural:"Gateway services"},route:{label:"Select a route",help:"The route that this plugin configuration will target",placeholder:"Select a route",plural:"Routes"},consumer:{label:"Select a consumer",help:"The consumer that this plugin configuration will target",placeholder:"Select a consumer",plural:"Consumers"},consumer_group:{label:"Select a consumer group",help:"The consumer group that this plugin configuration will target",placeholder:"Select a consumer group",plural:"Consumer groups"}},grouping:{plugin_configuration:{title:"Plugin configuration",description:"Configuration parameters for this plugin. View advanced parameters for extended configuration.",empty:"This plugin does not have required parameters."},advanced_parameters:{view:"Show additional settings",hide:"Hide additional settings"}},field_rules:{at_least_one_of:"At least one of the following values is required: {parameters}.",only_one_of:"Exactly one of these parameters is required: {parameters}",mutually_required:"These values must be used together: {parameters}.",mutually_exclusive:"Only one of these values can be used: {parameters}.",only_one_of_mutually_required:"Exactly one of the following parameter combinations is required (all parameters within a chosen combination are required):"},sections:{plugin_scope:{title:"Plugin scope",description:"Choose whether this plugin applies to all traffic (global) or is scoped to a specific service, route, or consumer."},general_info:{title:"General information",description:"Add details to help identify and manage your plugin."},plugin_config:{title:"Plugin configuration",description:"Set the plugin's behavior by defining its configuration settings."},plugin_general_info:{description:"Add a name or tags to help you identify and manage this plugin later."},code_mode:{title:"Code editor",description:"Configure this plugin by using YAML configuration."}}},"free-form":{editor_mode:{visual:"Visual editor",code:"Code editor"},"code-lens":{entity:{service:"Service",route:"Route",consumer:"Consumer",consumer_group:"Consumer group",certificate:"Certificate"},field:{name:'{entity} "{value}"',username:'Username "{value}"',custom_id:'Custom ID "{value}"',subject:'Subject "{value}"',expires_after:'Expires after "{value}"'},action:{view_entity:"View {title}",copy_certificate:"Copy certificate",copy_uuid:"Copy UUID",retry_fetch:"Retry fetch (Hover for details)"},unknown_error:"Unknown error"},acl:{mode:{allow:"Use allow list",deny:"Use deny list"}},"ai-mcp-proxy":{default_acl_item_label:"Default ACL #{index}",tool_item_label:"Tool #{index}"},"request-callout":{entity_name:"Request callout",by_lua_placeholder:"Enter Lua script here..."},"jwt-signer":{keyset_url_required:'Provide a valid HTTP/HTTPS URL to ensure signing works correctly when "{signingField}" is enabled and "{headerField}" is set.'},"metering-and-billing":{sections:{plugin_config:{title:"Plugin configuration",description:"Configure the Metering & Billing plugin."},metering:{title:"What to meter"},subject:{title:"Who to bill (subject)",description:"Define how billing subjects are identified."},ingestion:{title:"Connection",description:"Configure how metered data is delivered to the billing service."},queue:{title:"Queue",description:"Configure internal event queue settings."}},fields:{meter_api_requests:{label:"Meter API requests",description:"Emit a usage event for each API Gateway request."},meter_ai_token_usage:{label:"Meter AI token usage",description:"Emit events for LLM input and output tokens on AI Gateway requests. Each request produces separate input/output events so they can be priced independently."},ingest_endpoint:{description:"The URL of the metering data ingest endpoint.",help:"For Konnect Metering & Billing, use the regional endpoint from your Metering & Billing settings. For self-hosted OpenMeter, use your ingest URL."},api_token:{description:"Bearer token for authenticating requests to the ingest endpoint."},look_up_value_in:{label:"Look up subject in",help:"Where to find the customer identifier in the request."},subject_field:{label:"Subject field name",placeholder:"e.g., x-customer-id",help:"e.g. x-customer-id, x-api-key, x-tenant"},queue:{max_coalescing_delay:{label:"Max coalescing delay (s)"},initial_retry_delay:{label:"Initial retry delay (s)"},max_retry_delay:{label:"Max retry delay (s)"},max_retry_time:{label:"Max retry time (s)"}},attributes:{title:"Event attributes",description:"Attach custom dimensions to metered events.",look_up_value_in:{placeholder:"e.g., x-priority-id"},event_property_name:{placeholder:"e.g., priority"}},ssl_verify:{label:"Verify TLS certificate",description:"Disable only for local development with self-signed certificates."},timeout:{label:"Request timeout (ms)"},keepalive:{label:"Connection keep-alive (ms)"}}},datakit:{plugin_config:{title:"Flow editor"},description_code:"Configure this plugin by using YAML configuration. If you are copy/pasting in examples from the documentation - paste from below the <code>config</code> block.",description_flow:"Build flows visually with a drag-and-drop editor for Datakit. Visualize node connections, inputs, and outputs as you design.",description_example:"Start with a use case:",detected_config_format:"Detected {format} configuration. Do you want to convert it to Datakit configuration?",detected_config_format_title:"Convert configuration",detected_config_format_confirm:"Convert",examples:{authenticateThirdPartyWithDynamicUrl:"Authenticate Kong to a third-party service resolved at runtime",authenticateThirdParty:"Authenticate Kong to a third-party service",authenticateWithVaultSecret:"Authenticate to a third-party service using Vault secrets",clearHeaders:"Clear request headers",combineTwoApisIntoOneResponse:"Combine multiple API responses",conditionallyStoreCachedItems:"Conditionally fetch or store cache data",convertJsonIntoXml:"Transform JSON into XML",convertJsonToXmlAndBack:"Transform JSON into XML and back",convertXmlIntoJson:"Transform XML into JSON",manipulateRequestHeaders:"Manipulate request headers"},flow_editor:{mode:"Flow editor",name:"Datakit flow editor",cta:"Go to flow editor",disabled_tooltip:"The flow editor is unavailable due to critical configuration errors or features not supported in the flow editor:<br/><code>{reason}</code>",expand_panel:"Expand panel",collapse_panel:"Collapse panel",return_to_config:"Return to plugin configuration",canvas_panel:{request:"Request",response:"Response",node_count_plural:"{count} nodes",node_count_singular:"1 node"},panel_segments:{nodes:"Nodes",resources:{title:"Resources",vault:{title:"Vault secrets",add_button:"Add vault resource",name_exists_error:"Vault name already exists",name_required_error:"Vault name is required",edit:"Edit",delete:"Delete"},cache:{title:"Cache configuration",add_button:"Add cache configuration",strategy_options:{memory:"Memory",redis:"Redis"},select_redis_configuration:"Select a shared Redis configuration",inline_config:"Inline config",inline_config_preview:"You are using a dedicated Redis configuration, This is a preview of your current setup, please edit it in code editor"}}},vault_secret_picker:{title:"Add secret to Datakit",proceed_button_text:"Add secret",secret_name:{label:"Secret name",placeholder:"Enter a name",help:"A unique identifier for this secret in your Datakit configuration"}},node_panel:{title:"Node types",description:"Drag a node onto the canvas to add it to your data flow.",groups:{external_interaction:"External interaction",control_flow:"Control flow",data_transformation:"Data transformation",data_value:"Data value",authentication:"Authentication"}},examples:"Examples",debug:{label:"Debug",description:'Enables detailed error messages in client responses, making debugging easier. <a href="https://developer.konghq.com/plugins/datakit/#debugging" target="_blank">See the docs</a> for details.'},actions:{zoom_in:"Zoom in",zoom_out:"Zoom out",fit_view:"Zoom to fit",auto_layout:"Auto layout",undo:"Undo",redo:"Redo",duplicate:"Duplicate",remove_from_branch:"Remove from branch",delete:"Delete",view_docs:"View docs",done:"Done"},node_types:{call:{summary:"Call a third-party API",description:"Send an HTTP request and retrieve the response."},jq:{summary:"Transform data and cast variables with jq",description:'The <code>jq</code> node executes a jq script for processing JSON. See the official <a href="https://jqlang.org" target="_blank">jq docs</a> for more details.'},exit:{summary:"Return directly to the client",description:"Trigger an early exit that produces a direct response, rather than forwarding a proxied response."},property:{summary:"Get and set Kong Gateway-specific data",description:"Get and set Kong Gateway host and request properties."},static:{summary:"Configure static input values ahead of time",description:"Emits static values to be used as inputs for other nodes. The <code>static</code> node can help you with hardcoding some known value for an input."},branch:{summary:"Execute nodes based on matching input conditions",description:"Execute different nodes based on matching input conditions, such as a cache hit or miss."},cache:{summary:"Store and fetch cached data",description:"Store data into cache and fetch cached data from cache."},xml_to_json:{summary:"Transform XML to JSON",description:"Transform XML to JSON."},json_to_xml:{summary:"Transform JSON to XML",description:"Transform JSON to XML."},jwt_decode:{summary:"Decode JWT headers and claims",description:"Parse a JWT without verifying its signature."},jwt_sign:{summary:"Create and sign JWTs",description:"Generate a signed JWT from configured claims and a signing key."},jwt_verify:{summary:"Verify JWT signature and claims",description:"Verify a JWT signature and validate claims such as exp, nbf, iss, and aud."},request:{name:"request",description:"Reads incoming client request properties. You cannot specify request node input."},response:{name:"response",description:"Updates properties of the outgoing client response."},service_request:{name:"service request",description:"Updates properties of the request sent to the service being proxied to."},service_response:{name:"service response",description:"Reads response properties from the service being proxied to."},vault:{name:"Vault",description:"Vault is a tool for securely accessing secrets."}},node_properties:{name:"Name",configuration:"Configuration",input:{label:"Inputs configuration",placeholder:"Select a source",add_button:"Add an input",or:"or",input:"Input",fields:"Fields",source:"Source",tooltip:"Fields are part of the node input. A source can connect to either the fields or the input, but not both."},input_name:{label:"Input name",placeholder:"Enter an input name"},jq:{label:"jq script",help:"Refer to {link} for full documentation."},output_value:{label:"Output value",value_name:"Value name",value:"Value",add_button:"Add a value"},property:{get:"get",set:"set"},branch:{placeholder:"Select nodes"},jwt:{static_claims:{label:"Static claims",help:"Enter a JSON object. It will be stored as the node's static claims map.",errors:{invalid_json_object:"Static claims must be a valid JSON object"}}},errors:{invalid_identifier_format:"{fieldName} must start with a letter or underscore and contain only letters, numbers, underscores, or hyphens",invalid_url_format:"Not a valid URL format",not_empty:"{fieldName} is required",not_float:"{fieldName} must be a float",not_integer:"{fieldName} must be an integer",not_number:"{fieldName} must be a number",not_unique:"{fieldName} must be unique",number_range:"{fieldName} must be between {min} and {max}",string_len_range:"{fieldName} must be between {minLength} and {maxLength} characters",reserved_node_name:'"{nodeName}" is a reserved node name',attributes_required:"Provide at least one of attributes_block_name or attributes_name_prefix"}},error:{invalid_connection:"Invalid connection",branch_cycle:"Cannot create a circular branch relationship"},confirm:{title:"Connection conflict",message:{confirm:"Are you sure you want to make this change?",switch:"You can connect an output source to either all inputs of a node or to individual inputs.",override:"Each input can connect to only one output, but one output can connect to many inputs.",branch_replace:"This node already belongs to another branch. Move it to the new branch?"},proceed:"Yes, update"},leave_confirm:"Leave current page? Changes you made may not be saved."},code_editor:{mode:"Code editor"}},vault_picker:{component_error:"The vault secret picker is not available"},tag_helper:"Use comma to separate values. eg: value1, value2",foreign_placeholder:"Enter a UUID of {entity}"}},redis:{title:"Redis configuration",managed_ui:{title:"Redis",shared_configuration:{label:"Use shared configuration",description:"Select an existing shared Redis configuration or create a new one. Any updates to this configuration will automatically apply to all associated plugins.",badge:"Recommended"},dedicated_configuration:{label:"Use locally-scoped configuration",description:"Create and use a Redis configuration specifically for this plugin."},selector:{placeholder:"Filter Redis configurations...",create_new:"New Redis"}},shared_configuration:{label:"Shared configuration",description:"Select an existing shared Redis configuration or create a new one. Changes to this configuration automatically apply to all associated plugins.",title:"Shared Redis configuration",error:"Fetching shared Redis configurations failed."},dedicated_configuration:{label:"Dedicated configuration",description:"Create a Redis configuration that is used only by this plugin. Changes won’t affect other plugins."},config_card:{common_fields:{created_at_label:"Created at",updated_at_label:"Last updated at",type_label:"Redis type"}}},glossary:{plugin:"plugin"},custom_field:{key_auth_identity_realms:{cp_label:"Current control plane",cp_group_label:"Control plane",realm_group_label:"Realms (can only select one)"},kong_identity:{title:"Who should manage authentication and credentials?",description_with_realms:"Use Consumers or centrally managed consumers for Consumer-based authentication. Use Kong Identity for principal-based authentication and advanced integrations.",description_without_realms:"Use Consumers for Consumer-based authentication. Use Kong Identity for principal-based authentication and advanced integrations.",learn_more:"Learn more.",kong_identity_label:"Kong Identity",kong_identity_description_key_auth:"Use Kong Identity to authenticate API keys and map requests to a Kong Identity principal. The authenticated principal is added to the request context for advanced integrations.",kong_identity_description_basic_auth:"Use Kong Identity to authenticate Basic Auth credentials and map requests to a Kong Identity principal. The authenticated principal is added to the request context for advanced integrations.",consumers_label:"Consumers",consumers_description_key_auth:"Use consumer-managed API keys. Consumers provide their API key in a request header, query parameter, or request body to authenticate requests.",consumers_description_basic_auth:"Use consumer-managed Basic Auth credentials. Consumers authenticate requests using a username and password.",centrally_managed_label:"Centrally managed consumers",centrally_managed_description:"Authenticate centrally managed consumers in Konnect using identity realms. Identity realms are scoped to the control plane by default.",identity_realms_required:"To use centrally managed consumers, you must select at least one Centrally managed consumer realm.",error_on_miss_label:"If principal lookup fails",error_on_miss_reject_label:"Reject the request",error_on_miss_reject_description:"Treat the request as unauthenticated if Kong Identity cannot resolve the principal.",error_on_miss_continue_label:"Continue without a principal",error_on_miss_continue_description:"Allow the request to continue without resolving a principal.",configure_title:"Configure Kong Identity",configure_description:"Kong Identity uses principals to represent authenticated users, services, or applications. Create your first principal in Kong Identity to start using principal-based authentication.",create_principal:"Create principal",configure_learn_more:"Learn more",leave_prompt_title:"Leave this page?",leave_prompt_message:"Your unsaved changes will be lost if you continue.",leave_prompt_action:"Leave page"}},sp:{window_type:{label:"Rate limit window type",help:"Sets the time window type to either <code>sliding</code> (default) or <code>fixed</code>.<br><ul><li>Sliding windows apply the rate limiting logic while taking into account previous hit rates (from the window that immediately precedes the current) using a dynamic weight.</li><li>Fixed windows consist of buckets that are statically assigned to a definitive time range, each request is mapped to only one fixed window based on its timestamp and will affect only that window&#39;s counters.</li></ul>",options:{fixed:"Fixed",sliding:"Sliding"}},request_limits:{title:"Request limits",subtitle:"Set one or more limits on the number of API requests allowed within a defined timeframe.",label:"Limit",label_index:"Limit {index}",request_number:"Request number",time_interval:"Time interval",interval_determiner:"Every",seconds:"Seconds"},error_message:{label:"Error message",code_placeholder:"Code message",message_placeholder:"Error message",help:"Set a custom error code and message to be returned when the rate limit is exceeded."},start_with_a_use_case:"Start with a use case:",use_cases:{fixed:{hourly_500:{label:"500 requests every hour",description:"A fixed limit of 500 requests per hour resetting sharply on the hour, ensuring no user can exceed this limit."},half_hourly_200:{label:"200 requests every 30 minutes",description:"Users are allowed 200 requests per 30 minutes, resetting exactly on the 30 minute mark with no carryover of unused limits."},daily_500:{label:"500 requests every day",description:"A strict limit of 5000 requests per day resetting promptly at midnight, preventing any burst traffic or inconsistent user experiences."}},sliding:{hourly_100:{label:"100 requests every hour",description:"Maximum of 100 requests every rolling hour, continuously adjusting the count over the course of the hour. No hard limit or known reset."},half_hourly_300:{label:"300 requests every 30 minutes",description:"Each user can make up to 300 requests in any rolling 30 minute period, with older requests dropping off as new requests are made."},hourly_500:{label:"500 requests every hour",description:`Each user is allowed 500 requests per hour.
2
2
  If the limit is exceeded and the user receives a 429 error, each additional request within the sliding window (hour)
3
- will extend the wait time by about 12 minutes, continuously adjusting as new requests are made.`}}}},custom_plugin_form:{step1:{title:"Custom plugin type",types:{installed:{label:"Installed custom plugin",description:"Install and manage plugins with full control over deployment and runtime. Requires restarting data planes."},streamed:{label:"Streamed custom plugin",description:"Deploy and update plugins on running data planes without requiring gateway access."},cloned:{label:"Cloned plugin",description:"Duplicate an existing plugin to run multiple instances within a single request."}},compare_trigger:"Compare deployment options",compare_table:{columns:{installed:"Installed custom plugin",streamed:"Streamed custom plugin",cloned:"Cloned plugin"},rows:{main_use_case:{header:"Main use case",installed:"Extend Kong functionality with custom plugins and control who can modify and roll out changes.",streamed:"Extend Kong functionality with plugins without requiring sysadmin access to data plane instances.",cloned:"Modify an existing plugin to run multiple instances with different names or priorities."},file_supplied:{header:"File supplied",installed:{handler:"handler.lua",schema:"schema.lua",additional:"Any additional files or libraries needed"},streamed:{handler:"handler.lua",schema:"schema.lua"}},how_installed:{header:"How it's installed",installed:"Install directly on the data plane",streamed:"Through gateway configuration changes",cloned:"Through gateway configuration changes"},sandboxing:{header:"Sandboxing",streamed:"Follows the standard sandboxing settings. {link}",streamed_link:"Link to docs",cloned:"Inherit the same sandboxing as the original plugins"},data_plane_reload:{header:"Data plane reload"}}}},step2_files:{title:"Custom plugin files",schema_file:{label:"Upload schema file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Only Lua based schemas are supported by Konnect. Other plugin modules can be in any language as desired. Learn more"},handler_file:{label:"Upload handler file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Upload plugin handler to the data plane."},plugin_modules:{label:"Plugin modules",alert:"Upload all plugin modules to the data plane: schema.lua, handler.lua"}},step2_clone:{title:"Clone plugin",select_plugin:{label:"Select a plugin",placeholder:"Type to search"}},step3:{title:"General information",description:"Enter a custom name for this custom plugin",name:{label:"Name",placeholder:"Enter a unique name",help:"The name must be identical to the name of the plugin in the schema file."},alias_name:{label:"Alias name",placeholder:"Enter a unique name",help:"Format: ^[a-z][a-z0-9-]*[a-z0-9]$. The name must be unique enough to avoid future conflicts with bundled plugins."},priority:{label:"Priority",tooltip:"Set the execution priority for this cloned plugin",help:{text:"Optional. Use a number to set the absolute execution priority. If priority isn't set, plugins run in alphabetical order. {link} in the docs.",link:"Learn more"}}},errors:{file_read_error:"Failed to read file content. Please try again.",file_too_large:"File size exceeds the maximum limit of 1 MB.",plugin_not_found:"The selected plugin could not be found. Please refresh the list and try again.",no_supported_types:"No supported custom plugin types are available in this context.",unsupported_plugin_type:"Unsupported plugin type {type}."}}};function Je(){const n=jt.createI18n("en-us",Yt);return{i18n:n,i18nT:jt.i18nTComponent(n)}}const JC=["undo","redo","duplicate","cut","copy","paste"],Th=()=>{};function XC(n){const t=n;return t?!!t.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'):!1}function ZC(n){if(!(n.metaKey||n.ctrlKey))return;switch(n.key.toLowerCase()){case"z":return n.shiftKey?"redo":"undo";case"y":return"redo";case"d":return"duplicate";case"x":return"cut";case"c":return"copy";case"v":return"paste"}}const QC=Tt.createSharedComposable(()=>{const n=new Set;Tt.useEventListener("keydown",r=>{if(XC(r.target))return;const o=ZC(r);if(o)for(const i of n){if(!e.toValue(i.enabled))continue;const a=i[o];if(a){if(r.defaultPrevented){e.warn(`[useHotkeys] event for "${o}" was already defaultPrevented. Hotkey ignored.`);return}r.preventDefault(),a();return}}},{passive:!1});function t(r){if(!JC.some(i=>typeof r[i]=="function"))return Th;const o={enabled:r.enabled??!0,...r};return n.add(o),()=>n.delete(o)}return{subscribe:t}});function Oh(n={}){if(typeof window>"u")return Th;const t=QC().subscribe(n);return e.onScopeDispose(t),t}const e1="#ecfcff",t1="#f1f0ff",n1="#52596e",r1="#e0e4ea",o1="#007d60",i1="#fffce0",a1="#6c7489",s1="#0044f4",l1="#5f9aff",od="#000933",Ph="#d60027",c1="#00abd2",Vh="#6f28ff",$h="#afb7c5",sr="#6c7489",u1="#0044f4",d1="#eefaff",Rh="#007d60",f1="#ecfffb",p1="#995c00",m1="#306fff",nl="12px",zn="16px",fa="20px",id="24px",h1="2px",Lh="8px",g1="32px",Dh=44,y1=220,Mh=366,_1=1e3,b1=Dh+parseFloat(Lh),rl=1,w1=0,k1=1,C1=2,E1=3,Wo=parseInt(g1,10),pa="application/x-datakit+json",ol={delete:["Delete"],undo:["Mod","Z"],redo:{mac:["Mod","Shift","Z"],windows:["Mod","Y"],linux:["Mod","Shift","Z"]},copy:["Mod","C"],paste:["Mod","V"],duplicate:["Mod","D"]},zr={padding:80,gaps:{nodes:60,edges:80,ranks:60}},N1=1600,S1=1.2,x1=0,A1=200,jh=Symbol("confirm-modal");var Fh=typeof global=="object"&&global&&global.Object===Object&&global,v1=typeof self=="object"&&self&&self.Object===Object&&self,lr=Fh||v1||Function("return this")(),Pn=lr.Symbol,Uh=Object.prototype,I1=Uh.hasOwnProperty,B1=Uh.toString,ma=Pn?Pn.toStringTag:void 0;function T1(n){var t=I1.call(n,ma),r=n[ma];try{n[ma]=void 0;var o=!0}catch{}var i=B1.call(n);return o&&(t?n[ma]=r:delete n[ma]),i}var O1=Object.prototype,P1=O1.toString;function V1(n){return P1.call(n)}var $1="[object Null]",R1="[object Undefined]",Kh=Pn?Pn.toStringTag:void 0;function co(n){return n==null?n===void 0?R1:$1:Kh&&Kh in Object(n)?T1(n):V1(n)}function cr(n){return n!=null&&typeof n=="object"}var L1="[object Symbol]";function ad(n){return typeof n=="symbol"||cr(n)&&co(n)==L1}function sd(n,t){for(var r=-1,o=n==null?0:n.length,i=Array(o);++r<o;)i[r]=t(n[r],r,n);return i}var Wn=Array.isArray,qh=Pn?Pn.prototype:void 0,Gh=qh?qh.toString:void 0;function Hh(n){if(typeof n=="string")return n;if(Wn(n))return sd(n,Hh)+"";if(ad(n))return Gh?Gh.call(n):"";var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function uo(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function zh(n){return n}var D1="[object AsyncFunction]",M1="[object Function]",j1="[object GeneratorFunction]",F1="[object Proxy]";function il(n){if(!uo(n))return!1;var t=co(n);return t==M1||t==j1||t==D1||t==F1}var ld=lr["__core-js_shared__"],Wh=function(){var n=/[^.]+$/.exec(ld&&ld.keys&&ld.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function U1(n){return!!Wh&&Wh in n}var K1=Function.prototype,q1=K1.toString;function fo(n){if(n!=null){try{return q1.call(n)}catch{}try{return n+""}catch{}}return""}var G1=/[\\^$.*+?()[\]{}|]/g,H1=/^\[object .+?Constructor\]$/,z1=Function.prototype,W1=Object.prototype,Y1=z1.toString,J1=W1.hasOwnProperty,X1=RegExp("^"+Y1.call(J1).replace(G1,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Z1(n){if(!uo(n)||U1(n))return!1;var t=il(n)?X1:H1;return t.test(fo(n))}function Q1(n,t){return n==null?void 0:n[t]}function po(n,t){var r=Q1(n,t);return Z1(r)?r:void 0}var cd=po(lr,"WeakMap"),Yh=Object.create,eE=function(){function n(){}return function(t){if(!uo(t))return{};if(Yh)return Yh(t);n.prototype=t;var r=new n;return n.prototype=void 0,r}}();function tE(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function nE(n,t){var r=-1,o=n.length;for(t||(t=Array(o));++r<o;)t[r]=n[r];return t}var rE=800,oE=16,iE=Date.now;function aE(n){var t=0,r=0;return function(){var o=iE(),i=oE-(o-r);if(r=o,i>0){if(++t>=rE)return arguments[0]}else t=0;return n.apply(void 0,arguments)}}function sE(n){return function(){return n}}var al=function(){try{var n=po(Object,"defineProperty");return n({},"",{}),n}catch{}}(),lE=al?function(n,t){return al(n,"toString",{configurable:!0,enumerable:!1,value:sE(t),writable:!0})}:zh,Jh=aE(lE);function cE(n,t){for(var r=-1,o=n==null?0:n.length;++r<o&&t(n[r],r,n)!==!1;);return n}function uE(n,t,r,o){for(var i=n.length,a=r+-1;++a<i;)if(t(n[a],a,n))return a;return-1}function dE(n){return n!==n}function fE(n,t,r){for(var o=r-1,i=n.length;++o<i;)if(n[o]===t)return o;return-1}function pE(n,t,r){return t===t?fE(n,t,r):uE(n,dE,r)}function mE(n,t){var r=n==null?0:n.length;return!!r&&pE(n,t,0)>-1}var hE=9007199254740991,gE=/^(?:0|[1-9]\d*)$/;function ud(n,t){var r=typeof n;return t=t??hE,!!t&&(r=="number"||r!="symbol"&&gE.test(n))&&n>-1&&n%1==0&&n<t}function Xh(n,t,r){t=="__proto__"&&al?al(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function dd(n,t){return n===t||n!==n&&t!==t}var yE=Object.prototype,_E=yE.hasOwnProperty;function fd(n,t,r){var o=n[t];(!(_E.call(n,t)&&dd(o,r))||r===void 0&&!(t in n))&&Xh(n,t,r)}function ha(n,t,r,o){var i=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var c=t[a],l=void 0;l===void 0&&(l=n[c]),i?Xh(r,c,l):fd(r,c,l)}return r}var Zh=Math.max;function Qh(n,t,r){return t=Zh(t===void 0?n.length-1:t,0),function(){for(var o=arguments,i=-1,a=Zh(o.length-t,0),s=Array(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=Array(t+1);++i<t;)c[i]=o[i];return c[t]=r(s),tE(n,this,c)}}function bE(n,t){return Jh(Qh(n,t,zh),n+"")}var wE=9007199254740991;function pd(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=wE}function sl(n){return n!=null&&pd(n.length)&&!il(n)}var kE=Object.prototype;function ll(n){var t=n&&n.constructor,r=typeof t=="function"&&t.prototype||kE;return n===r}function CE(n,t){for(var r=-1,o=Array(n);++r<n;)o[r]=t(r);return o}var EE="[object Arguments]";function eg(n){return cr(n)&&co(n)==EE}var tg=Object.prototype,NE=tg.hasOwnProperty,SE=tg.propertyIsEnumerable,cl=eg(function(){return arguments}())?eg:function(n){return cr(n)&&NE.call(n,"callee")&&!SE.call(n,"callee")};function xE(){return!1}var ng=typeof De=="object"&&De&&!De.nodeType&&De,rg=ng&&typeof module=="object"&&module&&!module.nodeType&&module,AE=rg&&rg.exports===ng,og=AE?lr.Buffer:void 0,vE=og?og.isBuffer:void 0,ga=vE||xE,IE="[object Arguments]",BE="[object Array]",TE="[object Boolean]",OE="[object Date]",PE="[object Error]",VE="[object Function]",$E="[object Map]",RE="[object Number]",LE="[object Object]",DE="[object RegExp]",ME="[object Set]",jE="[object String]",FE="[object WeakMap]",UE="[object ArrayBuffer]",KE="[object DataView]",qE="[object Float32Array]",GE="[object Float64Array]",HE="[object Int8Array]",zE="[object Int16Array]",WE="[object Int32Array]",YE="[object Uint8Array]",JE="[object Uint8ClampedArray]",XE="[object Uint16Array]",ZE="[object Uint32Array]",vt={};vt[qE]=vt[GE]=vt[HE]=vt[zE]=vt[WE]=vt[YE]=vt[JE]=vt[XE]=vt[ZE]=!0,vt[IE]=vt[BE]=vt[UE]=vt[TE]=vt[KE]=vt[OE]=vt[PE]=vt[VE]=vt[$E]=vt[RE]=vt[LE]=vt[DE]=vt[ME]=vt[jE]=vt[FE]=!1;function QE(n){return cr(n)&&pd(n.length)&&!!vt[co(n)]}function md(n){return function(t){return n(t)}}var ig=typeof De=="object"&&De&&!De.nodeType&&De,ya=ig&&typeof module=="object"&&module&&!module.nodeType&&module,eN=ya&&ya.exports===ig,hd=eN&&Fh.process,Yo=function(){try{var n=ya&&ya.require&&ya.require("util").types;return n||hd&&hd.binding&&hd.binding("util")}catch{}}(),ag=Yo&&Yo.isTypedArray,gd=ag?md(ag):QE,tN=Object.prototype,nN=tN.hasOwnProperty;function sg(n,t){var r=Wn(n),o=!r&&cl(n),i=!r&&!o&&ga(n),a=!r&&!o&&!i&&gd(n),s=r||o||i||a,c=s?CE(n.length,String):[],l=c.length;for(var u in n)(t||nN.call(n,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ud(u,l)))&&c.push(u);return c}function lg(n,t){return function(r){return n(t(r))}}var rN=lg(Object.keys,Object),oN=Object.prototype,iN=oN.hasOwnProperty;function cg(n){if(!ll(n))return rN(n);var t=[];for(var r in Object(n))iN.call(n,r)&&r!="constructor"&&t.push(r);return t}function yd(n){return sl(n)?sg(n):cg(n)}function aN(n){var t=[];if(n!=null)for(var r in Object(n))t.push(r);return t}var sN=Object.prototype,lN=sN.hasOwnProperty;function cN(n){if(!uo(n))return aN(n);var t=ll(n),r=[];for(var o in n)o=="constructor"&&(t||!lN.call(n,o))||r.push(o);return r}function _d(n){return sl(n)?sg(n,!0):cN(n)}var uN=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dN=/^\w*$/;function fN(n,t){if(Wn(n))return!1;var r=typeof n;return r=="number"||r=="symbol"||r=="boolean"||n==null||ad(n)?!0:dN.test(n)||!uN.test(n)||t!=null&&n in Object(t)}var _a=po(Object,"create");function pN(){this.__data__=_a?_a(null):{},this.size=0}function mN(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}var hN="__lodash_hash_undefined__",gN=Object.prototype,yN=gN.hasOwnProperty;function _N(n){var t=this.__data__;if(_a){var r=t[n];return r===hN?void 0:r}return yN.call(t,n)?t[n]:void 0}var bN=Object.prototype,wN=bN.hasOwnProperty;function kN(n){var t=this.__data__;return _a?t[n]!==void 0:wN.call(t,n)}var CN="__lodash_hash_undefined__";function EN(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=_a&&t===void 0?CN:t,this}function mo(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}mo.prototype.clear=pN,mo.prototype.delete=mN,mo.prototype.get=_N,mo.prototype.has=kN,mo.prototype.set=EN;function NN(){this.__data__=[],this.size=0}function ul(n,t){for(var r=n.length;r--;)if(dd(n[r][0],t))return r;return-1}var SN=Array.prototype,xN=SN.splice;function AN(n){var t=this.__data__,r=ul(t,n);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():xN.call(t,r,1),--this.size,!0}function vN(n){var t=this.__data__,r=ul(t,n);return r<0?void 0:t[r][1]}function IN(n){return ul(this.__data__,n)>-1}function BN(n,t){var r=this.__data__,o=ul(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}function Sr(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}Sr.prototype.clear=NN,Sr.prototype.delete=AN,Sr.prototype.get=vN,Sr.prototype.has=IN,Sr.prototype.set=BN;var ba=po(lr,"Map");function TN(){this.size=0,this.__data__={hash:new mo,map:new(ba||Sr),string:new mo}}function ON(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}function dl(n,t){var r=n.__data__;return ON(t)?r[typeof t=="string"?"string":"hash"]:r.map}function PN(n){var t=dl(this,n).delete(n);return this.size-=t?1:0,t}function VN(n){return dl(this,n).get(n)}function $N(n){return dl(this,n).has(n)}function RN(n,t){var r=dl(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this}function xr(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}xr.prototype.clear=TN,xr.prototype.delete=PN,xr.prototype.get=VN,xr.prototype.has=$N,xr.prototype.set=RN;var LN="Expected a function";function bd(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new TypeError(LN);var r=function(){var o=arguments,i=t?t.apply(this,o):o[0],a=r.cache;if(a.has(i))return a.get(i);var s=n.apply(this,o);return r.cache=a.set(i,s)||a,s};return r.cache=new(bd.Cache||xr),r}bd.Cache=xr;var DN=500;function MN(n){var t=bd(n,function(o){return r.size===DN&&r.clear(),o}),r=t.cache;return t}var jN=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,FN=/\\(\\)?/g,UN=MN(function(n){var t=[];return n.charCodeAt(0)===46&&t.push(""),n.replace(jN,function(r,o,i,a){t.push(i?a.replace(FN,"$1"):o||r)}),t});function ho(n){return n==null?"":Hh(n)}function Jo(n,t){return Wn(n)?n:fN(n,t)?[n]:UN(ho(n))}function wa(n){if(typeof n=="string"||ad(n))return n;var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function wd(n,t){t=Jo(t,n);for(var r=0,o=t.length;n!=null&&r<o;)n=n[wa(t[r++])];return r&&r==o?n:void 0}function ka(n,t,r){var o=n==null?void 0:wd(n,t);return o===void 0?r:o}function kd(n,t){for(var r=-1,o=t.length,i=n.length;++r<o;)n[i+r]=t[r];return n}var ug=Pn?Pn.isConcatSpreadable:void 0;function KN(n){return Wn(n)||cl(n)||!!(ug&&n&&n[ug])}function qN(n,t,r,o,i){var a=-1,s=n.length;for(r||(r=KN),i||(i=[]);++a<s;){var c=n[a];r(c)?kd(i,c):i[i.length]=c}return i}function GN(n){var t=n==null?0:n.length;return t?qN(n):[]}function dg(n){return Jh(Qh(n,void 0,GN),n+"")}var Cd=lg(Object.getPrototypeOf,Object),HN="[object Object]",zN=Function.prototype,WN=Object.prototype,fg=zN.toString,YN=WN.hasOwnProperty,JN=fg.call(Object);function XN(n){if(!cr(n)||co(n)!=HN)return!1;var t=Cd(n);if(t===null)return!0;var r=YN.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&fg.call(r)==JN}function pg(n,t,r){var o=-1,i=n.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++o<i;)a[o]=n[o+t];return a}function ZN(n,t,r){var o=n.length;return r=r===void 0?o:r,!t&&r>=o?n:pg(n,t,r)}var QN="\\ud800-\\udfff",eS="\\u0300-\\u036f",tS="\\ufe20-\\ufe2f",nS="\\u20d0-\\u20ff",rS=eS+tS+nS,oS="\\ufe0e\\ufe0f",iS="\\u200d",aS=RegExp("["+iS+QN+rS+oS+"]");function mg(n){return aS.test(n)}function sS(n){return n.split("")}var hg="\\ud800-\\udfff",lS="\\u0300-\\u036f",cS="\\ufe20-\\ufe2f",uS="\\u20d0-\\u20ff",dS=lS+cS+uS,fS="\\ufe0e\\ufe0f",pS="["+hg+"]",Ed="["+dS+"]",Nd="\\ud83c[\\udffb-\\udfff]",mS="(?:"+Ed+"|"+Nd+")",gg="[^"+hg+"]",yg="(?:\\ud83c[\\udde6-\\uddff]){2}",_g="[\\ud800-\\udbff][\\udc00-\\udfff]",hS="\\u200d",bg=mS+"?",wg="["+fS+"]?",gS="(?:"+hS+"(?:"+[gg,yg,_g].join("|")+")"+wg+bg+")*",yS=wg+bg+gS,_S="(?:"+[gg+Ed+"?",Ed,yg,_g,pS].join("|")+")",bS=RegExp(Nd+"(?="+Nd+")|"+_S+yS,"g");function wS(n){return n.match(bS)||[]}function kS(n){return mg(n)?wS(n):sS(n)}function CS(n){return function(t){t=ho(t);var r=mg(t)?kS(t):void 0,o=r?r[0]:t.charAt(0),i=r?ZN(r,1).join(""):t.slice(1);return o[n]()+i}}var kg=CS("toUpperCase");function ES(n){return kg(ho(n).toLowerCase())}function NS(n,t,r,o){for(var i=-1,a=n==null?0:n.length;++i<a;)r=t(r,n[i],i,n);return r}function Cg(n){return function(t){return n==null?void 0:n[t]}}var SS={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},xS=Cg(SS),AS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vS="\\u0300-\\u036f",IS="\\ufe20-\\ufe2f",BS="\\u20d0-\\u20ff",TS=vS+IS+BS,OS="["+TS+"]",PS=RegExp(OS,"g");function VS(n){return n=ho(n),n&&n.replace(AS,xS).replace(PS,"")}var $S=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function RS(n){return n.match($S)||[]}var LS=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function DS(n){return LS.test(n)}var Eg="\\ud800-\\udfff",MS="\\u0300-\\u036f",jS="\\ufe20-\\ufe2f",FS="\\u20d0-\\u20ff",US=MS+jS+FS,Ng="\\u2700-\\u27bf",Sg="a-z\\xdf-\\xf6\\xf8-\\xff",KS="\\xac\\xb1\\xd7\\xf7",qS="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",GS="\\u2000-\\u206f",HS=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xg="A-Z\\xc0-\\xd6\\xd8-\\xde",zS="\\ufe0e\\ufe0f",Ag=KS+qS+GS+HS,vg="['’]",Ig="["+Ag+"]",WS="["+US+"]",Bg="\\d+",YS="["+Ng+"]",Tg="["+Sg+"]",Og="[^"+Eg+Ag+Bg+Ng+Sg+xg+"]",JS="\\ud83c[\\udffb-\\udfff]",XS="(?:"+WS+"|"+JS+")",ZS="[^"+Eg+"]",Pg="(?:\\ud83c[\\udde6-\\uddff]){2}",Vg="[\\ud800-\\udbff][\\udc00-\\udfff]",Xo="["+xg+"]",QS="\\u200d",$g="(?:"+Tg+"|"+Og+")",ex="(?:"+Xo+"|"+Og+")",Rg="(?:"+vg+"(?:d|ll|m|re|s|t|ve))?",Lg="(?:"+vg+"(?:D|LL|M|RE|S|T|VE))?",Dg=XS+"?",Mg="["+zS+"]?",tx="(?:"+QS+"(?:"+[ZS,Pg,Vg].join("|")+")"+Mg+Dg+")*",nx="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rx="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ox=Mg+Dg+tx,ix="(?:"+[YS,Pg,Vg].join("|")+")"+ox,ax=RegExp([Xo+"?"+Tg+"+"+Rg+"(?="+[Ig,Xo,"$"].join("|")+")",ex+"+"+Lg+"(?="+[Ig,Xo+$g,"$"].join("|")+")",Xo+"?"+$g+"+"+Rg,Xo+"+"+Lg,rx,nx,Bg,ix].join("|"),"g");function sx(n){return n.match(ax)||[]}function lx(n,t,r){return n=ho(n),t=t,t===void 0?DS(n)?sx(n):RS(n):n.match(t)||[]}var cx="['’]",ux=RegExp(cx,"g");function dx(n){return function(t){return NS(lx(VS(t).replace(ux,"")),n,"")}}var fx=dx(function(n,t,r){return t=t.toLowerCase(),n+(r?ES(t):t)});function px(){this.__data__=new Sr,this.size=0}function mx(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function hx(n){return this.__data__.get(n)}function gx(n){return this.__data__.has(n)}var yx=200;function _x(n,t){var r=this.__data__;if(r instanceof Sr){var o=r.__data__;if(!ba||o.length<yx-1)return o.push([n,t]),this.size=++r.size,this;r=this.__data__=new xr(o)}return r.set(n,t),this.size=r.size,this}function Ar(n){var t=this.__data__=new Sr(n);this.size=t.size}Ar.prototype.clear=px,Ar.prototype.delete=mx,Ar.prototype.get=hx,Ar.prototype.has=gx,Ar.prototype.set=_x;function bx(n,t){return n&&ha(t,yd(t),n)}function wx(n,t){return n&&ha(t,_d(t),n)}var jg=typeof De=="object"&&De&&!De.nodeType&&De,Fg=jg&&typeof module=="object"&&module&&!module.nodeType&&module,kx=Fg&&Fg.exports===jg,Ug=kx?lr.Buffer:void 0,Kg=Ug?Ug.allocUnsafe:void 0;function Cx(n,t){if(t)return n.slice();var r=n.length,o=Kg?Kg(r):new n.constructor(r);return n.copy(o),o}function Ex(n,t){for(var r=-1,o=n==null?0:n.length,i=0,a=[];++r<o;){var s=n[r];t(s,r,n)&&(a[i++]=s)}return a}function qg(){return[]}var Nx=Object.prototype,Sx=Nx.propertyIsEnumerable,Gg=Object.getOwnPropertySymbols,Sd=Gg?function(n){return n==null?[]:(n=Object(n),Ex(Gg(n),function(t){return Sx.call(n,t)}))}:qg;function xx(n,t){return ha(n,Sd(n),t)}var Ax=Object.getOwnPropertySymbols,Hg=Ax?function(n){for(var t=[];n;)kd(t,Sd(n)),n=Cd(n);return t}:qg;function vx(n,t){return ha(n,Hg(n),t)}function zg(n,t,r){var o=t(n);return Wn(n)?o:kd(o,r(n))}function xd(n){return zg(n,yd,Sd)}function Wg(n){return zg(n,_d,Hg)}var Ad=po(lr,"DataView"),vd=po(lr,"Promise"),Id=po(lr,"Set"),Yg="[object Map]",Ix="[object Object]",Jg="[object Promise]",Xg="[object Set]",Zg="[object WeakMap]",Qg="[object DataView]",Bx=fo(Ad),Tx=fo(ba),Ox=fo(vd),Px=fo(Id),Vx=fo(cd),Vn=co;(Ad&&Vn(new Ad(new ArrayBuffer(1)))!=Qg||ba&&Vn(new ba)!=Yg||vd&&Vn(vd.resolve())!=Jg||Id&&Vn(new Id)!=Xg||cd&&Vn(new cd)!=Zg)&&(Vn=function(n){var t=co(n),r=t==Ix?n.constructor:void 0,o=r?fo(r):"";if(o)switch(o){case Bx:return Qg;case Tx:return Yg;case Ox:return Jg;case Px:return Xg;case Vx:return Zg}return t});var $x=Object.prototype,Rx=$x.hasOwnProperty;function Lx(n){var t=n.length,r=new n.constructor(t);return t&&typeof n[0]=="string"&&Rx.call(n,"index")&&(r.index=n.index,r.input=n.input),r}var fl=lr.Uint8Array;function Bd(n){var t=new n.constructor(n.byteLength);return new fl(t).set(new fl(n)),t}function Dx(n,t){var r=t?Bd(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}var Mx=/\w*$/;function jx(n){var t=new n.constructor(n.source,Mx.exec(n));return t.lastIndex=n.lastIndex,t}var ey=Pn?Pn.prototype:void 0,ty=ey?ey.valueOf:void 0;function Fx(n){return ty?Object(ty.call(n)):{}}function Ux(n,t){var r=t?Bd(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}var Kx="[object Boolean]",qx="[object Date]",Gx="[object Map]",Hx="[object Number]",zx="[object RegExp]",Wx="[object Set]",Yx="[object String]",Jx="[object Symbol]",Xx="[object ArrayBuffer]",Zx="[object DataView]",Qx="[object Float32Array]",eA="[object Float64Array]",tA="[object Int8Array]",nA="[object Int16Array]",rA="[object Int32Array]",oA="[object Uint8Array]",iA="[object Uint8ClampedArray]",aA="[object Uint16Array]",sA="[object Uint32Array]";function lA(n,t,r){var o=n.constructor;switch(t){case Xx:return Bd(n);case Kx:case qx:return new o(+n);case Zx:return Dx(n,r);case Qx:case eA:case tA:case nA:case rA:case oA:case iA:case aA:case sA:return Ux(n,r);case Gx:return new o;case Hx:case Yx:return new o(n);case zx:return jx(n);case Wx:return new o;case Jx:return Fx(n)}}function cA(n){return typeof n.constructor=="function"&&!ll(n)?eE(Cd(n)):{}}var uA="[object Map]";function dA(n){return cr(n)&&Vn(n)==uA}var ny=Yo&&Yo.isMap,fA=ny?md(ny):dA,pA="[object Set]";function mA(n){return cr(n)&&Vn(n)==pA}var ry=Yo&&Yo.isSet,hA=ry?md(ry):mA,gA=1,yA=2,_A=4,oy="[object Arguments]",bA="[object Array]",wA="[object Boolean]",kA="[object Date]",CA="[object Error]",iy="[object Function]",EA="[object GeneratorFunction]",NA="[object Map]",SA="[object Number]",ay="[object Object]",xA="[object RegExp]",AA="[object Set]",vA="[object String]",IA="[object Symbol]",BA="[object WeakMap]",TA="[object ArrayBuffer]",OA="[object DataView]",PA="[object Float32Array]",VA="[object Float64Array]",$A="[object Int8Array]",RA="[object Int16Array]",LA="[object Int32Array]",DA="[object Uint8Array]",MA="[object Uint8ClampedArray]",jA="[object Uint16Array]",FA="[object Uint32Array]",St={};St[oy]=St[bA]=St[TA]=St[OA]=St[wA]=St[kA]=St[PA]=St[VA]=St[$A]=St[RA]=St[LA]=St[NA]=St[SA]=St[ay]=St[xA]=St[AA]=St[vA]=St[IA]=St[DA]=St[MA]=St[jA]=St[FA]=!0,St[CA]=St[iy]=St[BA]=!1;function Ca(n,t,r,o,i,a){var s,c=t&gA,l=t&yA,u=t&_A;if(r&&(s=i?r(n,o,i,a):r(n)),s!==void 0)return s;if(!uo(n))return n;var p=Wn(n);if(p){if(s=Lx(n),!c)return nE(n,s)}else{var d=Vn(n),f=d==iy||d==EA;if(ga(n))return Cx(n,c);if(d==ay||d==oy||f&&!i){if(s=l||f?{}:cA(n),!c)return l?vx(n,wx(s,n)):xx(n,bx(s,n))}else{if(!St[d])return i?n:{};s=lA(n,d,c)}}a||(a=new Ar);var m=a.get(n);if(m)return m;a.set(n,s),hA(n)?n.forEach(function(b){s.add(Ca(b,t,r,b,n,a))}):fA(n)&&n.forEach(function(b,_){s.set(_,Ca(b,t,r,_,n,a))});var g=u?l?Wg:xd:l?_d:yd,y=p?void 0:g(n);return cE(y||n,function(b,_){y&&(_=b,b=n[_]),fd(s,_,Ca(b,t,r,_,n,a))}),s}var UA=1,KA=4;function Ea(n){return Ca(n,UA|KA)}var qA="__lodash_hash_undefined__";function GA(n){return this.__data__.set(n,qA),this}function HA(n){return this.__data__.has(n)}function Na(n){var t=-1,r=n==null?0:n.length;for(this.__data__=new xr;++t<r;)this.add(n[t])}Na.prototype.add=Na.prototype.push=GA,Na.prototype.has=HA;function zA(n,t){for(var r=-1,o=n==null?0:n.length;++r<o;)if(t(n[r],r,n))return!0;return!1}function Td(n,t){return n.has(t)}var WA=1,YA=2;function sy(n,t,r,o,i,a){var s=r&WA,c=n.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=a.get(n),p=a.get(t);if(u&&p)return u==t&&p==n;var d=-1,f=!0,m=r&YA?new Na:void 0;for(a.set(n,t),a.set(t,n);++d<c;){var g=n[d],y=t[d];if(o)var b=s?o(y,g,d,t,n,a):o(g,y,d,n,t,a);if(b!==void 0){if(b)continue;f=!1;break}if(m){if(!zA(t,function(_,k){if(!Td(m,k)&&(g===_||i(g,_,r,o,a)))return m.push(k)})){f=!1;break}}else if(!(g===y||i(g,y,r,o,a))){f=!1;break}}return a.delete(n),a.delete(t),f}function JA(n){var t=-1,r=Array(n.size);return n.forEach(function(o,i){r[++t]=[i,o]}),r}function XA(n){var t=-1,r=Array(n.size);return n.forEach(function(o){r[++t]=o}),r}var ZA=1,QA=2,ev="[object Boolean]",tv="[object Date]",nv="[object Error]",rv="[object Map]",ov="[object Number]",iv="[object RegExp]",av="[object Set]",sv="[object String]",lv="[object Symbol]",cv="[object ArrayBuffer]",uv="[object DataView]",ly=Pn?Pn.prototype:void 0,Od=ly?ly.valueOf:void 0;function dv(n,t,r,o,i,a,s){switch(r){case uv:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case cv:return!(n.byteLength!=t.byteLength||!a(new fl(n),new fl(t)));case ev:case tv:case ov:return dd(+n,+t);case nv:return n.name==t.name&&n.message==t.message;case iv:case sv:return n==t+"";case rv:var c=JA;case av:var l=o&ZA;if(c||(c=XA),n.size!=t.size&&!l)return!1;var u=s.get(n);if(u)return u==t;o|=QA,s.set(n,t);var p=sy(c(n),c(t),o,i,a,s);return s.delete(n),p;case lv:if(Od)return Od.call(n)==Od.call(t)}return!1}var fv=1,pv=Object.prototype,mv=pv.hasOwnProperty;function hv(n,t,r,o,i,a){var s=r&fv,c=xd(n),l=c.length,u=xd(t),p=u.length;if(l!=p&&!s)return!1;for(var d=l;d--;){var f=c[d];if(!(s?f in t:mv.call(t,f)))return!1}var m=a.get(n),g=a.get(t);if(m&&g)return m==t&&g==n;var y=!0;a.set(n,t),a.set(t,n);for(var b=s;++d<l;){f=c[d];var _=n[f],k=t[f];if(o)var C=s?o(k,_,f,t,n,a):o(_,k,f,n,t,a);if(!(C===void 0?_===k||i(_,k,r,o,a):C)){y=!1;break}b||(b=f=="constructor")}if(y&&!b){var N=n.constructor,E=t.constructor;N!=E&&"constructor"in n&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof E=="function"&&E instanceof E)&&(y=!1)}return a.delete(n),a.delete(t),y}var gv=1,cy="[object Arguments]",uy="[object Array]",pl="[object Object]",yv=Object.prototype,dy=yv.hasOwnProperty;function _v(n,t,r,o,i,a){var s=Wn(n),c=Wn(t),l=s?uy:Vn(n),u=c?uy:Vn(t);l=l==cy?pl:l,u=u==cy?pl:u;var p=l==pl,d=u==pl,f=l==u;if(f&&ga(n)){if(!ga(t))return!1;s=!0,p=!1}if(f&&!p)return a||(a=new Ar),s||gd(n)?sy(n,t,r,o,i,a):dv(n,t,l,r,o,i,a);if(!(r&gv)){var m=p&&dy.call(n,"__wrapped__"),g=d&&dy.call(t,"__wrapped__");if(m||g){var y=m?n.value():n,b=g?t.value():t;return a||(a=new Ar),i(y,b,r,o,a)}}return f?(a||(a=new Ar),hv(n,t,r,o,i,a)):!1}function fy(n,t,r,o,i){return n===t?!0:n==null||t==null||!cr(n)&&!cr(t)?n!==n&&t!==t:_v(n,t,r,o,fy,i)}function bv(n,t){return n!=null&&t in Object(n)}function py(n,t,r){t=Jo(t,n);for(var o=-1,i=t.length,a=!1;++o<i;){var s=wa(t[o]);if(!(a=n!=null&&r(n,s)))break;n=n[s]}return a||++o!=i?a:(i=n==null?0:n.length,!!i&&pd(i)&&ud(s,i)&&(Wn(n)||cl(n)))}function wv(n,t){return n!=null&&py(n,t,bv)}function kv(n){return cr(n)&&sl(n)}function Cv(n){var t=n==null?0:n.length;return t?n[t-1]:void 0}var Ev={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Nv=Cg(Ev),my=/[&<>"']/g,Sv=RegExp(my.source);function xv(n){return n=ho(n),n&&Sv.test(n)?n.replace(my,Nv):n}var Av=Object.prototype,vv=Av.hasOwnProperty;function Iv(n,t){return n!=null&&vv.call(n,t)}function ml(n,t){return n!=null&&py(n,t,Iv)}var Bv=Math.min;function Tv(n,t,r){for(var o=mE,i=n[0].length,a=n.length,s=a,c=Array(a),l=1/0,u=[];s--;){var p=n[s];l=Bv(p.length,l),c[s]=i>=120&&p.length>=120?new Na(s&&p):void 0}p=n[0];var d=-1,f=c[0];e:for(;++d<i&&u.length<l;){var m=p[d],g=m;if(m=m!==0?m:0,!(f?Td(f,g):o(u,g))){for(s=a;--s;){var y=c[s];if(!(y?Td(y,g):o(n[s],g)))continue e}f&&f.push(g),u.push(m)}}return u}function Ov(n){return kv(n)?n:[]}var Pv=bE(function(n){var t=sd(n,Ov);return t.length&&t[0]===n[0]?Tv(t):[]});function Vv(n,t){return t.length<2?n:wd(n,pg(t,0,-1))}var $v="[object Map]",Rv="[object Set]",Lv=Object.prototype,Dv=Lv.hasOwnProperty;function hy(n){if(n==null)return!0;if(sl(n)&&(Wn(n)||typeof n=="string"||typeof n.splice=="function"||ga(n)||gd(n)||cl(n)))return!n.length;var t=Vn(n);if(t==$v||t==Rv)return!n.size;if(ll(n))return!cg(n).length;for(var r in n)if(Dv.call(n,r))return!1;return!0}function en(n,t){return fy(n,t)}var Mv=Object.prototype,jv=Mv.hasOwnProperty;function gy(n,t){t=Jo(t,n);var r=-1,o=t.length;if(!o)return!0;for(;++r<o;){var i=wa(t[r]);if(i==="__proto__"&&!jv.call(n,"__proto__")||(i==="constructor"||i==="prototype")&&r<o-1)return!1}var a=Vv(n,t);return a==null||delete a[wa(Cv(t))]}function Fv(n){return XN(n)?void 0:n}var Uv=1,Kv=2,qv=4,Wr=dg(function(n,t){var r={};if(n==null)return r;var o=!1;t=sd(t,function(a){return a=Jo(a,n),o||(o=a.length>1),a}),ha(n,Wg(n),r),o&&(r=Ca(r,Uv|Kv|qv,Fv));for(var i=t.length;i--;)gy(r,t[i]);return r});function yy(n,t,r,o){if(!uo(n))return n;t=Jo(t,n);for(var i=-1,a=t.length,s=a-1,c=n;c!=null&&++i<a;){var l=wa(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(i!=s){var p=c[l];u=void 0,u===void 0&&(u=uo(p)?p:ud(t[i+1])?[]:{})}fd(c,l,u),c=c[l]}return n}function Gv(n,t,r){for(var o=-1,i=t.length,a={};++o<i;){var s=t[o],c=wd(n,s);r(c,s)&&yy(a,Jo(s,n),c)}return a}function Hv(n,t){return Gv(n,t,function(r,o){return wv(n,o)})}var Pd=dg(function(n,t){return n==null?{}:Hv(n,t)});function _y(n,t,r){return n==null?n:yy(n,t,r)}var zv=0;function hl(n){var t=++zv;return ho(n)+t}function by(n,t){return n==null?!0:gy(n,t)}const Zo="{key}",go={"kong.client.consumer":{dataType:"object",writable:!1,readable:!0},"kong.client.consumer_groups":{dataType:"array",writable:!1,readable:!0},"kong.client.credential":{dataType:"object",writable:!1,readable:!0},"kong.client.get_identity_realm_source":{dataType:"object",writable:!1,readable:!0},"kong.client.forwarded_ip":{dataType:"string",writable:!1,readable:!0},"kong.client.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.client.ip":{dataType:"string",writable:!1,readable:!0},"kong.client.port":{dataType:"number",writable:!1,readable:!0},"kong.client.protocol":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_host":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.request.forwarded_scheme":{dataType:"string",writable:!1,readable:!0},"kong.request.port":{dataType:"number",writable:!1,readable:!0},"kong.response.source":{dataType:"string",writable:!1,readable:!0},"kong.router.route":{dataType:"object",writable:!1,readable:!0},"kong.route_id":{dataType:"string",writable:!1,readable:!0},"kong.route_name":{dataType:"string",writable:!1,readable:!0},"kong.router.service":{dataType:"object",writable:!1,readable:!0},"kong.service_name":{dataType:"string",writable:!1,readable:!0},"kong.service_id":{dataType:"string",writable:!1,readable:!0},"kong.service.response.status":{dataType:"number",writable:!1,readable:!0},"kong.version":{dataType:"string",writable:!1,readable:!0},"kong.node.id":{dataType:"string",writable:!1,readable:!0},"kong.configuration.{key}":{dataType:"any",writable:!1,readable:!0},"kong.service.target":{dataType:"string ({host}:{port})",writable:!0,readable:!1},"kong.service.request_scheme":{dataType:"string ({scheme})",writable:!0,readable:!1},"kong.ctx.plugin.{key}":{dataType:"any",writable:!0,readable:!0},"kong.ctx.shared.{key}":{dataType:"any",writable:!0,readable:!0}},gl=Object.keys(go).filter(n=>n.includes(Zo)).map(n=>n.replace(Zo,""));function Vd(n){if(!n||!xa(n))return;const t=gl.find(r=>n.startsWith(r));if(t)return n.slice(t.length).replace(Zo,"")}function Sa(n){if(!n)return null;const t=gl.find(r=>n.startsWith(r));return t||n}function xa(n){return n?gl.some(t=>n.startsWith(t)):!1}function wy(n){return n?xa(n)?Sa(n)+Zo:n:null}function $d(n){var r;if(!n)return!1;const t=wy(n);return t?((r=go[t])==null?void 0:r.readable)??!1:!1}function Rd(n){var r;if(!n)return!1;const t=wy(n);return t?((r=go[t])==null?void 0:r.writable)??!1:!1}const Ld=Symbol("EXPERIMENTAL_FREE_FORM_PROVIDER"),ur={KM_2262_CODE_MODE:"KM-2262-code-mode",KM_2306_CONDITION_FIELD_314:"KM-2306-condition-field-314",KM_2446_DATAKIT_JWT_NODES:"KM-2446-Datakit-JWT-nodes",KM_2503_CUSTOM_PLUGIN_FREEFORM:"KM-2503-custom-plugin-freeform",KM_2485_CLONED_PLUGINS:"KM-2485-cloned-plugins",KHCP_20393_IDENTITY_PRINCIPALS_UI:"khcp-20393-identity-principals-ui"},ky=Symbol("TOASTER_PROVIDER"),Qo="__FREEFORM_SCHEMA_MAP__";function Dd(){const n=(...r)=>{console.warn("TOASTER_PROVIDER is not provided",...r)},t=e.inject(ky,n);return r=>t(r)}const Cy=["request","service_request","service_response","response","vault"],ei=Cy,Ey=["call","jq","exit","property","static","branch","cache","xml_to_json","json_to_xml","jwt_decode","jwt_sign","jwt_verify"],Ny=["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","TRACE","CONNECT"],Md=["EdDSA","ES256","ES384","ES512","HS256","HS384","HS512","PS256","PS384","PS512","RS256","RS384","RS512"],Me=(n,t)=>{const r=n.__vccOpts||n;for(const[o,i]of t)r[o]=i;return r},Wv={},Yv={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function Jv(n,t){return e.openBlock(),e.createElementBlock("svg",Yv,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M240-160h480v-400H240v400Zm296.5-143.5Q560-327 560-360t-23.5-56.5Q513-440 480-440t-56.5 23.5Q400-393 400-360t23.5 56.5Q447-280 480-280t56.5-23.5ZM240-160v-400 400Zm0 80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h280v-80q0-83 58.5-141.5T720-920q83 0 141.5 58.5T920-720h-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80h120q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Z",fill:"currentColor"},null,-1)])])}const Xv=Me(Wv,[["render",Jv]]),Zv={},Qv={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function eI(n,t){return e.openBlock(),e.createElementBlock("svg",Qv,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z",fill:"currentColor"},null,-1)])])}const tI=Me(Zv,[["render",eI]]),Aa=[{id:"external_interaction",colors:{foreground:p1,background:i1},nodes:[{type:"call",icon:Re.NetworkIcon},{type:"cache",icon:Re.CachedIcon}]},{id:"control_flow",colors:{foreground:c1,background:e1},nodes:[{type:"branch",icon:Re.ArrowSplitIcon},{type:"exit",icon:Re.GatewayIcon}]},{id:"data_transformation",colors:{foreground:Vh,background:t1},nodes:[{type:"jq",icon:Re.CodeblockIcon},{type:"xml_to_json",icon:Re.DataObjectIcon},{type:"json_to_xml",icon:Re.CodeIcon}]},{id:"data_value",colors:{foreground:Rh,background:f1},nodes:[{type:"property",icon:Re.StackIcon},{type:"static",icon:Re.DeployIcon}]},{id:"authentication",colors:{foreground:u1,background:d1},nodes:[{type:"jwt_sign",icon:Re.EditSquareIcon},{type:"jwt_decode",icon:Xv},{type:"jwt_verify",icon:tI}]}],nI=Aa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]={icon:r.icon,colors:t.colors};return n},{}),ti={vault:{icon:Re.KeyIcon},request:{icon:Re.CloudIcon},service_request:{icon:Re.CloudIcon},service_response:{icon:Re.CloudIcon},response:{icon:Re.CloudIcon}};function rI(n){return Aa.find(({id:t})=>t===n).colors}function jd(n){return nI[n]??ti[n]}const{t:Fd}=jt.createI18n("en-us",Yt);function ni(n){return Fd(`plugins.free-form.datakit.flow_editor.node_types.${n}.description`)}function oI(n){return Fd(`plugins.free-form.datakit.flow_editor.node_types.${n}.summary`)}function iI(n){return Fd(`plugins.free-form.datakit.flow_editor.node_panel.groups.${n}`)}const aI={call:{io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]},output:{fields:[{name:"headers"},{name:"body"},{name:"status"}]}}},jq:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},exit:{io:{input:{fields:[{name:"headers"},{name:"body"}]}}},property:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},static:{io:{output:{fields:[],configurable:!0}}},branch:{io:{input:{fields:[]},next:{branches:[{name:"then"},{name:"else"}]}}},cache:{io:{input:{fields:[{name:"data"},{name:"key"},{name:"ttl"}]},output:{fields:[{name:"data"},{name:"hit"},{name:"miss"},{name:"stored"}]}}},xml_to_json:{io:{input:{fields:[]},output:{fields:[]}}},json_to_xml:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},jwt_decode:{io:{input:{fields:[]},output:{fields:[{name:"header"},{name:"payload"},{name:"signature"}]}}},jwt_sign:{io:{input:{fields:[{name:"claims"},{name:"key"}]},output:{fields:[{name:"claims"},{name:"header"},{name:"token"}]}}},jwt_verify:{io:{input:{fields:[{name:"key"},{name:"token"}]},output:{fields:[{name:"claims"},{name:"header"}]}}}};function sI(n){return{id:n.id,title:iI(n.id),colors:rI(n.id),nodeTypes:n.nodes.map(({type:t})=>t)}}function lI(n,t){return{...aI[t.type],type:t.type,icon:t.icon,group:n.id,summary:oI(t.type),description:ni(t.type)}}const Sy=Aa.reduce((n,t)=>(n[t.id]=sI(t),n),{}),yl=Aa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]=lI(t,r);return n},{}),xy=Aa.map(n=>({...Sy[n.id],nodes:n.nodes.map(({type:t})=>yl[t])}));function cI(n){return Sy[n]}const _l={request:{type:"request",description:ni("request"),io:{output:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ti.request},service_request:{type:"service_request",description:ni("service_request"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ti.service_request},service_response:{type:"service_response",description:ni("service_response"),io:{output:{fields:[{name:"headers"},{name:"body"}]}},...ti.service_response},response:{type:"response",description:ni("response"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...ti.response},vault:{type:"vault",io:{output:{fields:[],configurable:!0}},...ti.vault,hidden:!0}},Ud=Object.keys(_l),Kd=n=>Ud.includes(n),uI=n=>[...Ud,...Ey].includes(n),pn=n=>Ud.includes(n),bl=n=>pn(n.type),qd=n=>!!(n!=null&&n.startsWith("node:")),va=n=>Object.prototype.hasOwnProperty.call(n,"ownerId");function vr(n){return Ea(n)}function Gd(n,t){if(n.length!==t.length)return!1;if(n.length===0)return!0;const r=new Set(t);return n.every(o=>r.has(o))}function ri(n){return`${n}:${hl()}`}function wl(n){const[t,r]=n.split(".");return{nodeName:t,fieldName:r}}function Ay(n){const[t,r]=n.split(".");return{nodeId:t,fieldId:r}}function oi(n){return pn(n)?_l[n]:yl[n]}function vy(n){var i,a,s,c;const t=oi(n),r=((a=(i=t.io)==null?void 0:i.input)==null?void 0:a.fields.map(({name:l})=>l))??[],o=((c=(s=t.io)==null?void 0:s.output)==null?void 0:c.fields.map(({name:l})=>l))??[];return{input:r,output:o}}function Ia(n){var r,o,i;return((i=(o=(r=oi(n).io)==null?void 0:r.next)==null?void 0:o.branches)==null?void 0:i.map(({name:a})=>a))??[]}function Iy(n){return(n??[]).map(t=>({id:ri("field"),name:t}))}function Yr(n,t,r){if(r)return n.fields[t].find(o=>o.name===r)}function Jr(n,t,r){if(r)return n.fields[t].find(o=>o.id===r)}function Hd(n,t){return t?n.fields.output.some(r=>r.id===t):!0}function By(n,t){return t?n.fields.input.some(r=>r.id===t):!0}function dI(n){const t=["request","service_request","vault"].includes(n)?"request":"response",r=_l[n];return{name:n,phase:t,position:{x:0,y:0},fields:vy(r.type),expanded:{},hidden:r.hidden}}function Ty(n,t){const o=(typeof n=="string"&&uI(n)?n.toUpperCase():n).replace(/_\d+$/,"");for(let i=1;;i++){const a=`${o}_${i}`;if(!t.has(a))return a}}function zd(n,t){return`${n}:${t}`}function fI(n){const t=n.lastIndexOf(":");if(t===-1)throw new Error(`Invalid group ID format: ${n}`);const r=n.slice(0,t),o=n.slice(t+1);return{nodeId:r,branch:o}}function kl(n,t){return`${n}:${t}`}function Oy(n,t,r,o,i){return{id:zd(n,t),ownerId:n,branch:t,phase:r,memberIds:[...o],position:i!=null&&i.position?{...i.position}:void 0,dimensions:i!=null&&i.dimensions?{...i.dimensions}:void 0}}function Cl(n,t,r){const o=t?Jr(n,r,t):void 0;return`${n.name}${o?`.${o.name}`:""}`}function Ba(n,t){const r=t(n.source),o=t(n.target);return[Cl(r,n.sourceField,"output"),Cl(o,n.targetField,"input")]}function Wd(n,t,r,o,i){const a=i(n),s=i(r);return[Cl(a,t,"output"),Cl(s,o,"input")]}function Py(n){if(n.length===0)throw new Error("getBoundingRect requires at least one rect");let t=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const{x:a,y:s,width:c,height:l}of n){if(![a,s,c,l].every(Number.isFinite))throw new Error("Rect values must be finite numbers");if(c<0||l<0)throw new RangeError("Rect width and height must be non-negative");const u=a+c,p=s+l;if(!Number.isFinite(u)||!Number.isFinite(p))throw new RangeError("Rect boundaries must be finite numbers");a<t&&(t=a),s<r&&(r=s),u>o&&(o=u),p>i&&(i=p)}return{x:t,y:r,width:o-t,height:i-r}}var wt=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Yn=wt((n,t)=>{var r=Object.defineProperty,o=(P,R,W)=>R in P?r(P,R,{enumerable:!0,configurable:!0,writable:!0,value:W}):P[R]=W,i=(P,R)=>()=>(R||P((R={exports:{}}).exports,R),R.exports),a=(P,R,W)=>o(P,typeof R!="symbol"?R+"":R,W),s=i((P,R)=>{var W="\0",Z="\0",X="",F=class{constructor(M){a(this,"_isDirected",!0),a(this,"_isMultigraph",!1),a(this,"_isCompound",!1),a(this,"_label"),a(this,"_defaultNodeLabelFn",()=>{}),a(this,"_defaultEdgeLabelFn",()=>{}),a(this,"_nodes",{}),a(this,"_in",{}),a(this,"_preds",{}),a(this,"_out",{}),a(this,"_sucs",{}),a(this,"_edgeObjs",{}),a(this,"_edgeLabels",{}),a(this,"_nodeCount",0),a(this,"_edgeCount",0),a(this,"_parent"),a(this,"_children"),M&&(this._isDirected=Object.hasOwn(M,"directed")?M.directed:!0,this._isMultigraph=Object.hasOwn(M,"multigraph")?M.multigraph:!1,this._isCompound=Object.hasOwn(M,"compound")?M.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Z]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(M){return this._label=M,this}graph(){return this._label}setDefaultNodeLabel(M){return this._defaultNodeLabelFn=M,typeof M!="function"&&(this._defaultNodeLabelFn=()=>M),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var M=this;return this.nodes().filter(v=>Object.keys(M._in[v]).length===0)}sinks(){var M=this;return this.nodes().filter(v=>Object.keys(M._out[v]).length===0)}setNodes(M,v){var H=arguments,oe=this;return M.forEach(function(te){H.length>1?oe.setNode(te,v):oe.setNode(te)}),this}setNode(M,v){return Object.hasOwn(this._nodes,M)?(arguments.length>1&&(this._nodes[M]=v),this):(this._nodes[M]=arguments.length>1?v:this._defaultNodeLabelFn(M),this._isCompound&&(this._parent[M]=Z,this._children[M]={},this._children[Z][M]=!0),this._in[M]={},this._preds[M]={},this._out[M]={},this._sucs[M]={},++this._nodeCount,this)}node(M){return this._nodes[M]}hasNode(M){return Object.hasOwn(this._nodes,M)}removeNode(M){var v=this;if(Object.hasOwn(this._nodes,M)){var H=oe=>v.removeEdge(v._edgeObjs[oe]);delete this._nodes[M],this._isCompound&&(this._removeFromParentsChildList(M),delete this._parent[M],this.children(M).forEach(function(oe){v.setParent(oe)}),delete this._children[M]),Object.keys(this._in[M]).forEach(H),delete this._in[M],delete this._preds[M],Object.keys(this._out[M]).forEach(H),delete this._out[M],delete this._sucs[M],--this._nodeCount}return this}setParent(M,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(v===void 0)v=Z;else{v+="";for(var H=v;H!==void 0;H=this.parent(H))if(H===M)throw new Error("Setting "+v+" as parent of "+M+" would create a cycle");this.setNode(v)}return this.setNode(M),this._removeFromParentsChildList(M),this._parent[M]=v,this._children[v][M]=!0,this}_removeFromParentsChildList(M){delete this._children[this._parent[M]][M]}parent(M){if(this._isCompound){var v=this._parent[M];if(v!==Z)return v}}children(M=Z){if(this._isCompound){var v=this._children[M];if(v)return Object.keys(v)}else{if(M===Z)return this.nodes();if(this.hasNode(M))return[]}}predecessors(M){var v=this._preds[M];if(v)return Object.keys(v)}successors(M){var v=this._sucs[M];if(v)return Object.keys(v)}neighbors(M){var v=this.predecessors(M);if(v){let oe=new Set(v);for(var H of this.successors(M))oe.add(H);return Array.from(oe.values())}}isLeaf(M){var v;return this.isDirected()?v=this.successors(M):v=this.neighbors(M),v.length===0}filterNodes(M){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var H=this;Object.entries(this._nodes).forEach(function([ge,me]){M(ge)&&v.setNode(ge,me)}),Object.values(this._edgeObjs).forEach(function(ge){v.hasNode(ge.v)&&v.hasNode(ge.w)&&v.setEdge(ge,H.edge(ge))});var oe={};function te(ge){var me=H.parent(ge);return me===void 0||v.hasNode(me)?(oe[ge]=me,me):me in oe?oe[me]:te(me)}return this._isCompound&&v.nodes().forEach(ge=>v.setParent(ge,te(ge))),v}setDefaultEdgeLabel(M){return this._defaultEdgeLabelFn=M,typeof M!="function"&&(this._defaultEdgeLabelFn=()=>M),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(M,v){var H=this,oe=arguments;return M.reduce(function(te,ge){return oe.length>1?H.setEdge(te,ge,v):H.setEdge(te,ge),ge}),this}setEdge(){var M,v,H,oe,te=!1,ge=arguments[0];typeof ge=="object"&&ge!==null&&"v"in ge?(M=ge.v,v=ge.w,H=ge.name,arguments.length===2&&(oe=arguments[1],te=!0)):(M=ge,v=arguments[1],H=arguments[3],arguments.length>2&&(oe=arguments[2],te=!0)),M=""+M,v=""+v,H!==void 0&&(H=""+H);var me=q(this._isDirected,M,v,H);if(Object.hasOwn(this._edgeLabels,me))return te&&(this._edgeLabels[me]=oe),this;if(H!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(M),this.setNode(v),this._edgeLabels[me]=te?oe:this._defaultEdgeLabelFn(M,v,H);var le=K(this._isDirected,M,v,H);return M=le.v,v=le.w,Object.freeze(le),this._edgeObjs[me]=le,J(this._preds[v],M),J(this._sucs[M],v),this._in[v][me]=le,this._out[M][me]=le,this._edgeCount++,this}edge(M,v,H){var oe=arguments.length===1?ae(this._isDirected,arguments[0]):q(this._isDirected,M,v,H);return this._edgeLabels[oe]}edgeAsObj(){let M=this.edge(...arguments);return typeof M!="object"?{label:M}:M}hasEdge(M,v,H){var oe=arguments.length===1?ae(this._isDirected,arguments[0]):q(this._isDirected,M,v,H);return Object.hasOwn(this._edgeLabels,oe)}removeEdge(M,v,H){var oe=arguments.length===1?ae(this._isDirected,arguments[0]):q(this._isDirected,M,v,H),te=this._edgeObjs[oe];return te&&(M=te.v,v=te.w,delete this._edgeLabels[oe],delete this._edgeObjs[oe],$(this._preds[v],M),$(this._sucs[M],v),delete this._in[v][oe],delete this._out[M][oe],this._edgeCount--),this}inEdges(M,v){return this.isDirected()?this.filterEdges(this._in[M],M,v):this.nodeEdges(M,v)}outEdges(M,v){return this.isDirected()?this.filterEdges(this._out[M],M,v):this.nodeEdges(M,v)}nodeEdges(M,v){if(M in this._nodes)return this.filterEdges({...this._in[M],...this._out[M]},M,v)}filterEdges(M,v,H){if(M){var oe=Object.values(M);return H?oe.filter(function(te){return te.v===v&&te.w===H||te.v===H&&te.w===v}):oe}}};function J(M,v){M[v]?M[v]++:M[v]=1}function $(M,v){--M[v]||delete M[v]}function q(M,v,H,oe){var te=""+v,ge=""+H;if(!M&&te>ge){var me=te;te=ge,ge=me}return te+X+ge+X+(oe===void 0?W:oe)}function K(M,v,H,oe){var te=""+v,ge=""+H;if(!M&&te>ge){var me=te;te=ge,ge=me}var le={v:te,w:ge};return oe&&(le.name=oe),le}function ae(M,v){return q(M,v.v,v.w,v.name)}R.exports=F}),c=i((P,R)=>{R.exports="3.0.2"}),l=i((P,R)=>{R.exports={Graph:s(),version:c()}}),u=i((P,R)=>{var W=s();R.exports={write:Z,read:J};function Z($){var q={options:{directed:$.isDirected(),multigraph:$.isMultigraph(),compound:$.isCompound()},nodes:X($),edges:F($)};return $.graph()!==void 0&&(q.value=structuredClone($.graph())),q}function X($){return $.nodes().map(function(q){var K=$.node(q),ae=$.parent(q),M={v:q};return K!==void 0&&(M.value=K),ae!==void 0&&(M.parent=ae),M})}function F($){return $.edges().map(function(q){var K=$.edge(q),ae={v:q.v,w:q.w};return q.name!==void 0&&(ae.name=q.name),K!==void 0&&(ae.value=K),ae})}function J($){var q=new W($.options).setGraph($.value);return $.nodes.forEach(function(K){q.setNode(K.v,K.value),K.parent&&q.setParent(K.v,K.parent)}),$.edges.forEach(function(K){q.setEdge({v:K.v,w:K.w,name:K.name},K.value)}),q}}),p=i((P,R)=>{R.exports=Z;var W=()=>1;function Z(F,J,$,q){return X(F,String(J),$||W,q||function(K){return F.outEdges(K)})}function X(F,J,$,q){var K={},ae=!0,M=0,v=F.nodes(),H=function(me){var le=$(me);K[me.v].distance+le<K[me.w].distance&&(K[me.w]={distance:K[me.v].distance+le,predecessor:me.v},ae=!0)},oe=function(){v.forEach(function(me){q(me).forEach(function(le){var he=le.v===me?le.v:le.w,Oe=he===le.v?le.w:le.v;H({v:he,w:Oe})})})};v.forEach(function(me){var le=me===J?0:Number.POSITIVE_INFINITY;K[me]={distance:le}});for(var te=v.length,ge=1;ge<te&&(ae=!1,M++,oe(),!!ae);ge++);if(M===te-1&&(ae=!1,oe(),ae))throw new Error("The graph contains a negative weight cycle");return K}}),d=i((P,R)=>{R.exports=W;function W(Z){var X={},F=[],J;function $(q){Object.hasOwn(X,q)||(X[q]=!0,J.push(q),Z.successors(q).forEach($),Z.predecessors(q).forEach($))}return Z.nodes().forEach(function(q){J=[],$(q),J.length&&F.push(J)}),F}}),f=i((P,R)=>{var W=class{constructor(){a(this,"_arr",[]),a(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(Z){return Z.key})}has(Z){return Object.hasOwn(this._keyIndices,Z)}priority(Z){var X=this._keyIndices[Z];if(X!==void 0)return this._arr[X].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(Z,X){var F=this._keyIndices;if(Z=String(Z),!Object.hasOwn(F,Z)){var J=this._arr,$=J.length;return F[Z]=$,J.push({key:Z,priority:X}),this._decrease($),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var Z=this._arr.pop();return delete this._keyIndices[Z.key],this._heapify(0),Z.key}decrease(Z,X){var F=this._keyIndices[Z];if(X>this._arr[F].priority)throw new Error("New priority is greater than current priority. Key: "+Z+" Old: "+this._arr[F].priority+" New: "+X);this._arr[F].priority=X,this._decrease(F)}_heapify(Z){var X=this._arr,F=2*Z,J=F+1,$=Z;F<X.length&&($=X[F].priority<X[$].priority?F:$,J<X.length&&($=X[J].priority<X[$].priority?J:$),$!==Z&&(this._swap(Z,$),this._heapify($)))}_decrease(Z){for(var X=this._arr,F=X[Z].priority,J;Z!==0&&(J=Z>>1,!(X[J].priority<F));)this._swap(Z,J),Z=J}_swap(Z,X){var F=this._arr,J=this._keyIndices,$=F[Z],q=F[X];F[Z]=q,F[X]=$,J[q.key]=Z,J[$.key]=X}};R.exports=W}),m=i((P,R)=>{var W=f();R.exports=X;var Z=()=>1;function X(J,$,q,K){var ae=function(M){return J.outEdges(M)};return F(J,String($),q||Z,K||ae)}function F(J,$,q,K){var ae={},M=new W,v,H,oe=function(te){var ge=te.v!==v?te.v:te.w,me=ae[ge],le=q(te),he=H.distance+le;if(le<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+te+" Weight: "+le);he<me.distance&&(me.distance=he,me.predecessor=v,M.decrease(ge,he))};for(J.nodes().forEach(function(te){var ge=te===$?0:Number.POSITIVE_INFINITY;ae[te]={distance:ge},M.add(te,ge)});M.size()>0&&(v=M.removeMin(),H=ae[v],H.distance!==Number.POSITIVE_INFINITY);)K(v).forEach(oe);return ae}}),g=i((P,R)=>{var W=m();R.exports=Z;function Z(X,F,J){return X.nodes().reduce(function($,q){return $[q]=W(X,q,F,J),$},{})}}),y=i((P,R)=>{R.exports=W;function W(X,F,J){if(X[F].predecessor!==void 0)throw new Error("Invalid source vertex");if(X[J].predecessor===void 0&&J!==F)throw new Error("Invalid destination vertex");return{weight:X[J].distance,path:Z(X,F,J)}}function Z(X,F,J){for(var $=[],q=J;q!==F;)$.push(q),q=X[q].predecessor;return $.push(F),$.reverse()}}),b=i((P,R)=>{R.exports=W;function W(Z){var X=0,F=[],J={},$=[];function q(K){var ae=J[K]={onStack:!0,lowlink:X,index:X++};if(F.push(K),Z.successors(K).forEach(function(H){Object.hasOwn(J,H)?J[H].onStack&&(ae.lowlink=Math.min(ae.lowlink,J[H].index)):(q(H),ae.lowlink=Math.min(ae.lowlink,J[H].lowlink))}),ae.lowlink===ae.index){var M=[],v;do v=F.pop(),J[v].onStack=!1,M.push(v);while(K!==v);$.push(M)}}return Z.nodes().forEach(function(K){Object.hasOwn(J,K)||q(K)}),$}}),_=i((P,R)=>{var W=b();R.exports=Z;function Z(X){return W(X).filter(function(F){return F.length>1||F.length===1&&X.hasEdge(F[0],F[0])})}}),k=i((P,R)=>{R.exports=Z;var W=()=>1;function Z(F,J,$){return X(F,J||W,$||function(q){return F.outEdges(q)})}function X(F,J,$){var q={},K=F.nodes();return K.forEach(function(ae){q[ae]={},q[ae][ae]={distance:0},K.forEach(function(M){ae!==M&&(q[ae][M]={distance:Number.POSITIVE_INFINITY})}),$(ae).forEach(function(M){var v=M.v===ae?M.w:M.v,H=J(M);q[ae][v]={distance:H,predecessor:ae}})}),K.forEach(function(ae){var M=q[ae];K.forEach(function(v){var H=q[v];K.forEach(function(oe){var te=H[ae],ge=M[oe],me=H[oe],le=te.distance+ge.distance;le<me.distance&&(me.distance=le,me.predecessor=ge.predecessor)})})}),q}}),C=i((P,R)=>{function W(X){var F={},J={},$=[];function q(K){if(Object.hasOwn(J,K))throw new Z;Object.hasOwn(F,K)||(J[K]=!0,F[K]=!0,X.predecessors(K).forEach(q),delete J[K],$.push(K))}if(X.sinks().forEach(q),Object.keys(F).length!==X.nodeCount())throw new Z;return $}var Z=class extends Error{constructor(){super(...arguments)}};R.exports=W,W.CycleException=Z}),N=i((P,R)=>{var W=C();R.exports=Z;function Z(X){try{W(X)}catch(F){if(F instanceof W.CycleException)return!1;throw F}return!0}}),E=i((P,R)=>{R.exports=W;function W(X,F,J,$,q){Array.isArray(F)||(F=[F]);var K=(X.isDirected()?X.successors:X.neighbors).bind(X),ae={};return F.forEach(function(M){if(!X.hasNode(M))throw new Error("Graph does not have node: "+M);q=Z(X,M,J==="post",ae,K,$,q)}),q}function Z(X,F,J,$,q,K,ae){return Object.hasOwn($,F)||($[F]=!0,J||(ae=K(ae,F)),q(F).forEach(function(M){ae=Z(X,M,J,$,q,K,ae)}),J&&(ae=K(ae,F))),ae}}),w=i((P,R)=>{var W=E();R.exports=Z;function Z(X,F,J){return W(X,F,J,function($,q){return $.push(q),$},[])}}),S=i((P,R)=>{var W=w();R.exports=Z;function Z(X,F){return W(X,F,"post")}}),I=i((P,R)=>{var W=w();R.exports=Z;function Z(X,F){return W(X,F,"pre")}}),j=i((P,R)=>{var W=s(),Z=f();R.exports=X;function X(F,J){var $=new W,q={},K=new Z,ae;function M(H){var oe=H.v===ae?H.w:H.v,te=K.priority(oe);if(te!==void 0){var ge=J(H);ge<te&&(q[oe]=ae,K.decrease(oe,ge))}}if(F.nodeCount()===0)return $;F.nodes().forEach(function(H){K.add(H,Number.POSITIVE_INFINITY),$.setNode(H)}),K.decrease(F.nodes()[0],0);for(var v=!1;K.size()>0;){if(ae=K.removeMin(),Object.hasOwn(q,ae))$.setEdge(ae,q[ae]);else{if(v)throw new Error("Input graph is not connected: "+F);v=!0}F.nodeEdges(ae).forEach(M)}return $}}),A=i((P,R)=>{var W=m(),Z=p();R.exports=X;function X(J,$,q,K){return F(J,$,q,K||function(ae){return J.outEdges(ae)})}function F(J,$,q,K){if(q===void 0)return W(J,$,q,K);for(var ae=!1,M=J.nodes(),v=0;v<M.length;v++){for(var H=K(M[v]),oe=0;oe<H.length;oe++){var te=H[oe],ge=te.v===M[v]?te.v:te.w,me=ge===te.v?te.w:te.v;q({v:ge,w:me})<0&&(ae=!0)}if(ae)return Z(J,$,q,K)}return W(J,$,q,K)}}),x=i((P,R)=>{R.exports={bellmanFord:p(),components:d(),dijkstra:m(),dijkstraAll:g(),extractPath:y(),findCycles:_(),floydWarshall:k(),isAcyclic:N(),postorder:S(),preorder:I(),prim:j(),shortestPaths:A(),reduce:E(),tarjan:b(),topsort:C()}}),O=l();t.exports={Graph:O.Graph,json:u(),alg:x(),version:O.version}}),pI=wt((n,t)=>{var r=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,s=a._prev;if(s!==a)return o(s),s}enqueue(a){let s=this._sentinel;a._prev&&a._next&&o(a),a._next=s._next,s._next._prev=a,s._next=a,a._prev=s}toString(){let a=[],s=this._sentinel,c=s._prev;for(;c!==s;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}};function o(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,s){if(a!=="_next"&&a!=="_prev")return s}t.exports=r}),mI=wt((n,t)=>{var r=Yn().Graph,o=pI();t.exports=a;var i=()=>1;function a(d,f){if(d.nodeCount()<=1)return[];let m=l(d,f||i);return s(m.graph,m.buckets,m.zeroIdx).flatMap(g=>d.outEdges(g.v,g.w))}function s(d,f,m){let g=[],y=f[f.length-1],b=f[0],_;for(;d.nodeCount();){for(;_=b.dequeue();)c(d,f,m,_);for(;_=y.dequeue();)c(d,f,m,_);if(d.nodeCount()){for(let k=f.length-2;k>0;--k)if(_=f[k].dequeue(),_){g=g.concat(c(d,f,m,_,!0));break}}}return g}function c(d,f,m,g,y){let b=y?[]:void 0;return d.inEdges(g.v).forEach(_=>{let k=d.edge(_),C=d.node(_.v);y&&b.push({v:_.v,w:_.w}),C.out-=k,u(f,m,C)}),d.outEdges(g.v).forEach(_=>{let k=d.edge(_),C=_.w,N=d.node(C);N.in-=k,u(f,m,N)}),d.removeNode(g.v),b}function l(d,f){let m=new r,g=0,y=0;d.nodes().forEach(k=>{m.setNode(k,{v:k,in:0,out:0})}),d.edges().forEach(k=>{let C=m.edge(k.v,k.w)||0,N=f(k),E=C+N;m.setEdge(k.v,k.w,E),y=Math.max(y,m.node(k.v).out+=N),g=Math.max(g,m.node(k.w).in+=N)});let b=p(y+g+3).map(()=>new o),_=g+1;return m.nodes().forEach(k=>{u(b,_,m.node(k))}),{graph:m,buckets:b,zeroIdx:_}}function u(d,f,m){m.out?m.in?d[m.out-m.in+f].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}function p(d){let f=[];for(let m=0;m<d;m++)f.push(m);return f}}),qt=wt((n,t)=>{var r=Yn().Graph;t.exports={addBorderNode:f,addDummyNode:o,applyWithChunking:y,asNonCompoundGraph:a,buildLayerMatrix:u,intersectRect:l,mapValues:I,maxRank:b,normalizeRanks:p,notime:C,partition:_,pick:S,predecessorWeights:c,range:w,removeEmptyRanks:d,simplify:i,successorWeights:s,time:k,uniqueId:E,zipObject:j};function o(A,x,O,P){for(var R=P;A.hasNode(R);)R=E(P);return O.dummy=x,A.setNode(R,O),R}function i(A){let x=new r().setGraph(A.graph());return A.nodes().forEach(O=>x.setNode(O,A.node(O))),A.edges().forEach(O=>{let P=x.edge(O.v,O.w)||{weight:0,minlen:1},R=A.edge(O);x.setEdge(O.v,O.w,{weight:P.weight+R.weight,minlen:Math.max(P.minlen,R.minlen)})}),x}function a(A){let x=new r({multigraph:A.isMultigraph()}).setGraph(A.graph());return A.nodes().forEach(O=>{A.children(O).length||x.setNode(O,A.node(O))}),A.edges().forEach(O=>{x.setEdge(O,A.edge(O))}),x}function s(A){let x=A.nodes().map(O=>{let P={};return A.outEdges(O).forEach(R=>{P[R.w]=(P[R.w]||0)+A.edge(R).weight}),P});return j(A.nodes(),x)}function c(A){let x=A.nodes().map(O=>{let P={};return A.inEdges(O).forEach(R=>{P[R.v]=(P[R.v]||0)+A.edge(R).weight}),P});return j(A.nodes(),x)}function l(A,x){let O=A.x,P=A.y,R=x.x-O,W=x.y-P,Z=A.width/2,X=A.height/2;if(!R&&!W)throw new Error("Not possible to find intersection inside of the rectangle");let F,J;return Math.abs(W)*Z>Math.abs(R)*X?(W<0&&(X=-X),F=X*R/W,J=X):(R<0&&(Z=-Z),F=Z,J=Z*W/R),{x:O+F,y:P+J}}function u(A){let x=w(b(A)+1).map(()=>[]);return A.nodes().forEach(O=>{let P=A.node(O),R=P.rank;R!==void 0&&(x[R][P.order]=O)}),x}function p(A){let x=A.nodes().map(P=>{let R=A.node(P).rank;return R===void 0?Number.MAX_VALUE:R}),O=y(Math.min,x);A.nodes().forEach(P=>{let R=A.node(P);Object.hasOwn(R,"rank")&&(R.rank-=O)})}function d(A){let x=A.nodes().map(Z=>A.node(Z).rank).filter(Z=>Z!==void 0),O=y(Math.min,x),P=[];A.nodes().forEach(Z=>{let X=A.node(Z).rank-O;P[X]||(P[X]=[]),P[X].push(Z)});let R=0,W=A.graph().nodeRankFactor;Array.from(P).forEach((Z,X)=>{Z===void 0&&X%W!==0?--R:Z!==void 0&&R&&Z.forEach(F=>A.node(F).rank+=R)})}function f(A,x,O,P){let R={width:0,height:0};return arguments.length>=4&&(R.rank=O,R.order=P),o(A,"border",R,x)}function m(A,x=g){let O=[];for(let P=0;P<A.length;P+=x){let R=A.slice(P,P+x);O.push(R)}return O}var g=65535;function y(A,x){if(x.length>g){let O=m(x);return A.apply(null,O.map(P=>A.apply(null,P)))}else return A.apply(null,x)}function b(A){let x=A.nodes().map(O=>{let P=A.node(O).rank;return P===void 0?Number.MIN_VALUE:P});return y(Math.max,x)}function _(A,x){let O={lhs:[],rhs:[]};return A.forEach(P=>{x(P)?O.lhs.push(P):O.rhs.push(P)}),O}function k(A,x){let O=Date.now();try{return x()}finally{console.log(A+" time: "+(Date.now()-O)+"ms")}}function C(A,x){return x()}var N=0;function E(A){var x=++N;return A+(""+x)}function w(A,x,O=1){x==null&&(x=A,A=0);let P=W=>W<x;O<0&&(P=W=>x<W);let R=[];for(let W=A;P(W);W+=O)R.push(W);return R}function S(A,x){let O={};for(let P of x)A[P]!==void 0&&(O[P]=A[P]);return O}function I(A,x){let O=x;return typeof x=="string"&&(O=P=>P[x]),Object.entries(A).reduce((P,[R,W])=>(P[R]=O(W,R),P),{})}function j(A,x){return A.reduce((O,P,R)=>(O[P]=x[R],O),{})}}),hI=wt((n,t)=>{var r=mI(),o=qt().uniqueId;t.exports={run:i,undo:s};function i(c){(c.graph().acyclicer==="greedy"?r(c,l(c)):a(c)).forEach(u=>{let p=c.edge(u);c.removeEdge(u),p.forwardName=u.name,p.reversed=!0,c.setEdge(u.w,u.v,p,o("rev"))});function l(u){return p=>u.edge(p).weight}}function a(c){let l=[],u={},p={};function d(f){Object.hasOwn(p,f)||(p[f]=!0,u[f]=!0,c.outEdges(f).forEach(m=>{Object.hasOwn(u,m.w)?l.push(m):d(m.w)}),delete u[f])}return c.nodes().forEach(d),l}function s(c){c.edges().forEach(l=>{let u=c.edge(l);if(u.reversed){c.removeEdge(l);let p=u.forwardName;delete u.reversed,delete u.forwardName,c.setEdge(l.w,l.v,u,p)}})}}),gI=wt((n,t)=>{var r=qt();t.exports={run:o,undo:a};function o(s){s.graph().dummyChains=[],s.edges().forEach(c=>i(s,c))}function i(s,c){let l=c.v,u=s.node(l).rank,p=c.w,d=s.node(p).rank,f=c.name,m=s.edge(c),g=m.labelRank;if(d===u+1)return;s.removeEdge(c);let y,b,_;for(_=0,++u;u<d;++_,++u)m.points=[],b={width:0,height:0,edgeLabel:m,edgeObj:c,rank:u},y=r.addDummyNode(s,"edge",b,"_d"),u===g&&(b.width=m.width,b.height=m.height,b.dummy="edge-label",b.labelpos=m.labelpos),s.setEdge(l,y,{weight:m.weight},f),_===0&&s.graph().dummyChains.push(y),l=y;s.setEdge(l,p,{weight:m.weight},f)}function a(s){s.graph().dummyChains.forEach(c=>{let l=s.node(c),u=l.edgeLabel,p;for(s.setEdge(l.edgeObj,u);l.dummy;)p=s.successors(c)[0],s.removeNode(c),u.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(u.x=l.x,u.y=l.y,u.width=l.width,u.height=l.height),c=p,l=s.node(c)})}}),El=wt((n,t)=>{var{applyWithChunking:r}=qt();t.exports={longestPath:o,slack:i};function o(a){var s={};function c(l){var u=a.node(l);if(Object.hasOwn(s,l))return u.rank;s[l]=!0;let p=a.outEdges(l).map(f=>f==null?Number.POSITIVE_INFINITY:c(f.w)-a.edge(f).minlen);var d=r(Math.min,p);return d===Number.POSITIVE_INFINITY&&(d=0),u.rank=d}a.sources().forEach(c)}function i(a,s){return a.node(s.w).rank-a.node(s.v).rank-a.edge(s).minlen}}),Vy=wt((n,t)=>{var r=Yn().Graph,o=El().slack;t.exports=i;function i(l){var u=new r({directed:!1}),p=l.nodes()[0],d=l.nodeCount();u.setNode(p,{});for(var f,m;a(u,l)<d;)f=s(u,l),m=u.hasNode(f.v)?o(l,f):-o(l,f),c(u,l,m);return u}function a(l,u){function p(d){u.nodeEdges(d).forEach(f=>{var m=f.v,g=d===m?f.w:m;!l.hasNode(g)&&!o(u,f)&&(l.setNode(g,{}),l.setEdge(d,g,{}),p(g))})}return l.nodes().forEach(p),l.nodeCount()}function s(l,u){return u.edges().reduce((p,d)=>{let f=Number.POSITIVE_INFINITY;return l.hasNode(d.v)!==l.hasNode(d.w)&&(f=o(u,d)),f<p[0]?[f,d]:p},[Number.POSITIVE_INFINITY,null])[1]}function c(l,u,p){l.nodes().forEach(d=>u.node(d).rank+=p)}}),yI=wt((n,t)=>{var r=Vy(),o=El().slack,i=El().longestPath,a=Yn().alg.preorder,s=Yn().alg.postorder,c=qt().simplify;t.exports=l,l.initLowLimValues=f,l.initCutValues=u,l.calcCutValue=d,l.leaveEdge=g,l.enterEdge=y,l.exchangeEdges=b;function l(N){N=c(N),i(N);var E=r(N);f(E),u(E,N);for(var w,S;w=g(E);)S=y(E,N,w),b(E,N,w,S)}function u(N,E){var w=s(N,N.nodes());w=w.slice(0,w.length-1),w.forEach(S=>p(N,E,S))}function p(N,E,w){var S=N.node(w),I=S.parent;N.edge(w,I).cutvalue=d(N,E,w)}function d(N,E,w){var S=N.node(w),I=S.parent,j=!0,A=E.edge(w,I),x=0;return A||(j=!1,A=E.edge(I,w)),x=A.weight,E.nodeEdges(w).forEach(O=>{var P=O.v===w,R=P?O.w:O.v;if(R!==I){var W=P===j,Z=E.edge(O).weight;if(x+=W?Z:-Z,k(N,w,R)){var X=N.edge(w,R).cutvalue;x+=W?-X:X}}}),x}function f(N,E){arguments.length<2&&(E=N.nodes()[0]),m(N,{},1,E)}function m(N,E,w,S,I){var j=w,A=N.node(S);return E[S]=!0,N.neighbors(S).forEach(x=>{Object.hasOwn(E,x)||(w=m(N,E,w,x,S))}),A.low=j,A.lim=w++,I?A.parent=I:delete A.parent,w}function g(N){return N.edges().find(E=>N.edge(E).cutvalue<0)}function y(N,E,w){var S=w.v,I=w.w;E.hasEdge(S,I)||(S=w.w,I=w.v);var j=N.node(S),A=N.node(I),x=j,O=!1;j.lim>A.lim&&(x=A,O=!0);var P=E.edges().filter(R=>O===C(N,N.node(R.v),x)&&O!==C(N,N.node(R.w),x));return P.reduce((R,W)=>o(E,W)<o(E,R)?W:R)}function b(N,E,w,S){var I=w.v,j=w.w;N.removeEdge(I,j),N.setEdge(S.v,S.w,{}),f(N),u(N,E),_(N,E)}function _(N,E){var w=N.nodes().find(I=>!E.node(I).parent),S=a(N,w);S=S.slice(1),S.forEach(I=>{var j=N.node(I).parent,A=E.edge(I,j),x=!1;A||(A=E.edge(j,I),x=!0),E.node(I).rank=E.node(j).rank+(x?A.minlen:-A.minlen)})}function k(N,E,w){return N.hasEdge(E,w)}function C(N,E,w){return w.low<=E.lim&&E.lim<=w.lim}}),_I=wt((n,t)=>{var r=El(),o=r.longestPath,i=Vy(),a=yI();t.exports=s;function s(p){var d=p.graph().ranker;if(d instanceof Function)return d(p);switch(p.graph().ranker){case"network-simplex":u(p);break;case"tight-tree":l(p);break;case"longest-path":c(p);break;case"none":break;default:u(p)}}var c=o;function l(p){o(p),i(p)}function u(p){a(p)}}),bI=wt((n,t)=>{t.exports=r;function r(a){let s=i(a);a.graph().dummyChains.forEach(c=>{let l=a.node(c),u=l.edgeObj,p=o(a,s,u.v,u.w),d=p.path,f=p.lca,m=0,g=d[m],y=!0;for(;c!==u.w;){if(l=a.node(c),y){for(;(g=d[m])!==f&&a.node(g).maxRank<l.rank;)m++;g===f&&(y=!1)}if(!y){for(;m<d.length-1&&a.node(g=d[m+1]).minRank<=l.rank;)m++;g=d[m]}a.setParent(c,g),c=a.successors(c)[0]}})}function o(a,s,c,l){let u=[],p=[],d=Math.min(s[c].low,s[l].low),f=Math.max(s[c].lim,s[l].lim),m,g;m=c;do m=a.parent(m),u.push(m);while(m&&(s[m].low>d||f>s[m].lim));for(g=m,m=l;(m=a.parent(m))!==g;)p.push(m);return{path:u.concat(p.reverse()),lca:g}}function i(a){let s={},c=0;function l(u){let p=c;a.children(u).forEach(l),s[u]={low:p,lim:c++}}return a.children().forEach(l),s}}),wI=wt((n,t)=>{var r=qt();t.exports={run:o,cleanup:c};function o(l){let u=r.addDummyNode(l,"root",{},"_root"),p=a(l),d=Object.values(p),f=r.applyWithChunking(Math.max,d)-1,m=2*f+1;l.graph().nestingRoot=u,l.edges().forEach(y=>l.edge(y).minlen*=m);let g=s(l)+1;l.children().forEach(y=>i(l,u,m,g,f,p,y)),l.graph().nodeRankFactor=m}function i(l,u,p,d,f,m,g){let y=l.children(g);if(!y.length){g!==u&&l.setEdge(u,g,{weight:0,minlen:p});return}let b=r.addBorderNode(l,"_bt"),_=r.addBorderNode(l,"_bb"),k=l.node(g);l.setParent(b,g),k.borderTop=b,l.setParent(_,g),k.borderBottom=_,y.forEach(C=>{i(l,u,p,d,f,m,C);let N=l.node(C),E=N.borderTop?N.borderTop:C,w=N.borderBottom?N.borderBottom:C,S=N.borderTop?d:2*d,I=E!==w?1:f-m[g]+1;l.setEdge(b,E,{weight:S,minlen:I,nestingEdge:!0}),l.setEdge(w,_,{weight:S,minlen:I,nestingEdge:!0})}),l.parent(g)||l.setEdge(u,b,{weight:0,minlen:f+m[g]})}function a(l){var u={};function p(d,f){var m=l.children(d);m&&m.length&&m.forEach(g=>p(g,f+1)),u[d]=f}return l.children().forEach(d=>p(d,1)),u}function s(l){return l.edges().reduce((u,p)=>u+l.edge(p).weight,0)}function c(l){var u=l.graph();l.removeNode(u.nestingRoot),delete u.nestingRoot,l.edges().forEach(p=>{var d=l.edge(p);d.nestingEdge&&l.removeEdge(p)})}}),kI=wt((n,t)=>{var r=qt();t.exports=o;function o(a){function s(c){let l=a.children(c),u=a.node(c);if(l.length&&l.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let p=u.minRank,d=u.maxRank+1;p<d;++p)i(a,"borderLeft","_bl",c,u,p),i(a,"borderRight","_br",c,u,p)}}a.children().forEach(s)}function i(a,s,c,l,u,p){let d={width:0,height:0,rank:p,borderType:s},f=u[s][p-1],m=r.addDummyNode(a,"border",d,c);u[s][p]=m,a.setParent(m,l),f&&a.setEdge(f,m,{weight:1})}}),CI=wt((n,t)=>{t.exports={adjust:r,undo:o};function r(p){let d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function o(p){let d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(p),(d==="lr"||d==="rl")&&(l(p),i(p))}function i(p){p.nodes().forEach(d=>a(p.node(d))),p.edges().forEach(d=>a(p.edge(d)))}function a(p){let d=p.width;p.width=p.height,p.height=d}function s(p){p.nodes().forEach(d=>c(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(c),Object.hasOwn(f,"y")&&c(f)})}function c(p){p.y=-p.y}function l(p){p.nodes().forEach(d=>u(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(u),Object.hasOwn(f,"x")&&u(f)})}function u(p){let d=p.x;p.x=p.y,p.y=d}}),EI=wt((n,t)=>{var r=qt();t.exports=o;function o(i){let a={},s=i.nodes().filter(d=>!i.children(d).length),c=s.map(d=>i.node(d).rank),l=r.applyWithChunking(Math.max,c),u=r.range(l+1).map(()=>[]);function p(d){if(a[d])return;a[d]=!0;let f=i.node(d);u[f.rank].push(d),i.successors(d).forEach(p)}return s.sort((d,f)=>i.node(d).rank-i.node(f).rank).forEach(p),u}}),NI=wt((n,t)=>{var r=qt().zipObject;t.exports=o;function o(a,s){let c=0;for(let l=1;l<s.length;++l)c+=i(a,s[l-1],s[l]);return c}function i(a,s,c){let l=r(c,c.map((g,y)=>y)),u=s.flatMap(g=>a.outEdges(g).map(y=>({pos:l[y.w],weight:a.edge(y).weight})).sort((y,b)=>y.pos-b.pos)),p=1;for(;p<c.length;)p<<=1;let d=2*p-1;p-=1;let f=new Array(d).fill(0),m=0;return u.forEach(g=>{let y=g.pos+p;f[y]+=g.weight;let b=0;for(;y>0;)y%2&&(b+=f[y+1]),y=y-1>>1,f[y]+=g.weight;m+=g.weight*b}),m}}),SI=wt((n,t)=>{t.exports=r;function r(o,i=[]){return i.map(a=>{let s=o.inEdges(a);if(s.length){let c=s.reduce((l,u)=>{let p=o.edge(u),d=o.node(u.v);return{sum:l.sum+p.weight*d.order,weight:l.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}}),xI=wt((n,t)=>{var r=qt();t.exports=o;function o(s,c){let l={};s.forEach((p,d)=>{let f=l[p.v]={indegree:0,in:[],out:[],vs:[p.v],i:d};p.barycenter!==void 0&&(f.barycenter=p.barycenter,f.weight=p.weight)}),c.edges().forEach(p=>{let d=l[p.v],f=l[p.w];d!==void 0&&f!==void 0&&(f.indegree++,d.out.push(l[p.w]))});let u=Object.values(l).filter(p=>!p.indegree);return i(u)}function i(s){let c=[];function l(p){return d=>{d.merged||(d.barycenter===void 0||p.barycenter===void 0||d.barycenter>=p.barycenter)&&a(p,d)}}function u(p){return d=>{d.in.push(p),--d.indegree===0&&s.push(d)}}for(;s.length;){let p=s.pop();c.push(p),p.in.reverse().forEach(l(p)),p.out.forEach(u(p))}return c.filter(p=>!p.merged).map(p=>r.pick(p,["vs","i","barycenter","weight"]))}function a(s,c){let l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),c.weight&&(l+=c.barycenter*c.weight,u+=c.weight),s.vs=c.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(c.i,s.i),c.merged=!0}}),AI=wt((n,t)=>{var r=qt();t.exports=o;function o(s,c){let l=r.partition(s,b=>Object.hasOwn(b,"barycenter")),u=l.lhs,p=l.rhs.sort((b,_)=>_.i-b.i),d=[],f=0,m=0,g=0;u.sort(a(!!c)),g=i(d,p,g),u.forEach(b=>{g+=b.vs.length,d.push(b.vs),f+=b.barycenter*b.weight,m+=b.weight,g=i(d,p,g)});let y={vs:d.flat(!0)};return m&&(y.barycenter=f/m,y.weight=m),y}function i(s,c,l){let u;for(;c.length&&(u=c[c.length-1]).i<=l;)c.pop(),s.push(u.vs),l++;return l}function a(s){return(c,l)=>c.barycenter<l.barycenter?-1:c.barycenter>l.barycenter?1:s?l.i-c.i:c.i-l.i}}),vI=wt((n,t)=>{var r=SI(),o=xI(),i=AI();t.exports=a;function a(l,u,p,d){let f=l.children(u),m=l.node(u),g=m?m.borderLeft:void 0,y=m?m.borderRight:void 0,b={};g&&(f=f.filter(N=>N!==g&&N!==y));let _=r(l,f);_.forEach(N=>{if(l.children(N.v).length){let E=a(l,N.v,p,d);b[N.v]=E,Object.hasOwn(E,"barycenter")&&c(N,E)}});let k=o(_,p);s(k,b);let C=i(k,d);if(g&&(C.vs=[g,C.vs,y].flat(!0),l.predecessors(g).length)){let N=l.node(l.predecessors(g)[0]),E=l.node(l.predecessors(y)[0]);Object.hasOwn(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+N.order+E.order)/(C.weight+2),C.weight+=2}return C}function s(l,u){l.forEach(p=>{p.vs=p.vs.flatMap(d=>u[d]?u[d].vs:d)})}function c(l,u){l.barycenter!==void 0?(l.barycenter=(l.barycenter*l.weight+u.barycenter*u.weight)/(l.weight+u.weight),l.weight+=u.weight):(l.barycenter=u.barycenter,l.weight=u.weight)}}),II=wt((n,t)=>{var r=Yn().Graph,o=qt();t.exports=i;function i(s,c,l,u){u||(u=s.nodes());let p=a(s),d=new r({compound:!0}).setGraph({root:p}).setDefaultNodeLabel(f=>s.node(f));return u.forEach(f=>{let m=s.node(f),g=s.parent(f);(m.rank===c||m.minRank<=c&&c<=m.maxRank)&&(d.setNode(f),d.setParent(f,g||p),s[l](f).forEach(y=>{let b=y.v===f?y.w:y.v,_=d.edge(b,f),k=_!==void 0?_.weight:0;d.setEdge(b,f,{weight:s.edge(y).weight+k})}),Object.hasOwn(m,"minRank")&&d.setNode(f,{borderLeft:m.borderLeft[c],borderRight:m.borderRight[c]}))}),d}function a(s){for(var c;s.hasNode(c=o.uniqueId("_root")););return c}}),BI=wt((n,t)=>{t.exports=r;function r(o,i,a){let s={},c;a.forEach(l=>{let u=o.parent(l),p,d;for(;u;){if(p=o.parent(u),p?(d=s[p],s[p]=u):(d=c,c=u),d&&d!==u){i.setEdge(d,u);return}u=p}})}}),TI=wt((n,t)=>{var r=EI(),o=NI(),i=vI(),a=II(),s=BI(),c=Yn().Graph,l=qt();t.exports=u;function u(m,g={}){if(typeof g.customOrder=="function"){g.customOrder(m,u);return}let y=l.maxRank(m),b=p(m,l.range(1,y+1),"inEdges"),_=p(m,l.range(y-1,-1,-1),"outEdges"),k=r(m);if(f(m,k),g.disableOptimalOrderHeuristic)return;let C=Number.POSITIVE_INFINITY,N,E=g.constraints||[];for(let w=0,S=0;S<4;++w,++S){d(w%2?b:_,w%4>=2,E),k=l.buildLayerMatrix(m);let I=o(m,k);I<C?(S=0,N=Object.assign({},k),C=I):I===C&&(N=structuredClone(k))}f(m,N)}function p(m,g,y){let b=new Map,_=(k,C)=>{b.has(k)||b.set(k,[]),b.get(k).push(C)};for(let k of m.nodes()){let C=m.node(k);if(typeof C.rank=="number"&&_(C.rank,k),typeof C.minRank=="number"&&typeof C.maxRank=="number")for(let N=C.minRank;N<=C.maxRank;N++)N!==C.rank&&_(N,k)}return g.map(function(k){return a(m,k,y,b.get(k)||[])})}function d(m,g,y){let b=new c;m.forEach(function(_){y.forEach(N=>b.setEdge(N.left,N.right));let k=_.graph().root,C=i(_,k,b,g);C.vs.forEach((N,E)=>_.node(N).order=E),s(_,b,C.vs)})}function f(m,g){Object.values(g).forEach(y=>y.forEach((b,_)=>m.node(b).order=_))}}),OI=wt((n,t)=>{var r=Yn().Graph,o=qt();t.exports={positionX:y,findType1Conflicts:i,findType2Conflicts:a,addConflict:c,hasConflict:l,verticalAlignment:u,horizontalCompaction:p,alignCoordinates:m,findSmallestWidthAlignment:f,balance:g};function i(k,C){let N={};function E(w,S){let I=0,j=0,A=w.length,x=S[S.length-1];return S.forEach((O,P)=>{let R=s(k,O),W=R?k.node(R).order:A;(R||O===x)&&(S.slice(j,P+1).forEach(Z=>{k.predecessors(Z).forEach(X=>{let F=k.node(X),J=F.order;(J<I||W<J)&&!(F.dummy&&k.node(Z).dummy)&&c(N,X,Z)})}),j=P+1,I=W)}),S}return C.length&&C.reduce(E),N}function a(k,C){let N={};function E(S,I,j,A,x){let O;o.range(I,j).forEach(P=>{O=S[P],k.node(O).dummy&&k.predecessors(O).forEach(R=>{let W=k.node(R);W.dummy&&(W.order<A||W.order>x)&&c(N,R,O)})})}function w(S,I){let j=-1,A,x=0;return I.forEach((O,P)=>{if(k.node(O).dummy==="border"){let R=k.predecessors(O);R.length&&(A=k.node(R[0]).order,E(I,x,P,j,A),x=P,j=A)}E(I,x,I.length,A,S.length)}),I}return C.length&&C.reduce(w),N}function s(k,C){if(k.node(C).dummy)return k.predecessors(C).find(N=>k.node(N).dummy)}function c(k,C,N){if(C>N){let w=C;C=N,N=w}let E=k[C];E||(k[C]=E={}),E[N]=!0}function l(k,C,N){if(C>N){let E=C;C=N,N=E}return!!k[C]&&Object.hasOwn(k[C],N)}function u(k,C,N,E){let w={},S={},I={};return C.forEach(j=>{j.forEach((A,x)=>{w[A]=A,S[A]=A,I[A]=x})}),C.forEach(j=>{let A=-1;j.forEach(x=>{let O=E(x);if(O.length){O=O.sort((R,W)=>I[R]-I[W]);let P=(O.length-1)/2;for(let R=Math.floor(P),W=Math.ceil(P);R<=W;++R){let Z=O[R];S[x]===x&&A<I[Z]&&!l(N,x,Z)&&(S[Z]=x,S[x]=w[x]=w[Z],A=I[Z])}}})}),{root:w,align:S}}function p(k,C,N,E,w){let S={},I=d(k,C,N,w),j=w?"borderLeft":"borderRight";function A(P,R){let W=I.nodes().slice(),Z={},X=W.pop();for(;X;){if(Z[X])P(X);else{Z[X]=!0,W.push(X);for(let F of R(X))W.push(F)}X=W.pop()}}function x(P){S[P]=I.inEdges(P).reduce((R,W)=>Math.max(R,S[W.v]+I.edge(W)),0)}function O(P){let R=I.outEdges(P).reduce((Z,X)=>Math.min(Z,S[X.w]-I.edge(X)),Number.POSITIVE_INFINITY),W=k.node(P);R!==Number.POSITIVE_INFINITY&&W.borderType!==j&&(S[P]=Math.max(S[P],R))}return A(x,I.predecessors.bind(I)),A(O,I.successors.bind(I)),Object.keys(E).forEach(P=>S[P]=S[N[P]]),S}function d(k,C,N,E){let w=new r,S=k.graph(),I=b(S.nodesep,S.edgesep,E);return C.forEach(j=>{let A;j.forEach(x=>{let O=N[x];if(w.setNode(O),A){var P=N[A],R=w.edge(P,O);w.setEdge(P,O,Math.max(I(k,x,A),R||0))}A=x})}),w}function f(k,C){return Object.values(C).reduce((N,E)=>{let w=Number.NEGATIVE_INFINITY,S=Number.POSITIVE_INFINITY;Object.entries(E).forEach(([j,A])=>{let x=_(k,j)/2;w=Math.max(A+x,w),S=Math.min(A-x,S)});let I=w-S;return I<N[0]&&(N=[I,E]),N},[Number.POSITIVE_INFINITY,null])[1]}function m(k,C){let N=Object.values(C),E=o.applyWithChunking(Math.min,N),w=o.applyWithChunking(Math.max,N);["u","d"].forEach(S=>{["l","r"].forEach(I=>{let j=S+I,A=k[j];if(A===C)return;let x=Object.values(A),O=E-o.applyWithChunking(Math.min,x);I!=="l"&&(O=w-o.applyWithChunking(Math.max,x)),O&&(k[j]=o.mapValues(A,P=>P+O))})})}function g(k,C){return o.mapValues(k.ul,(N,E)=>{if(C)return k[C.toLowerCase()][E];{let w=Object.values(k).map(S=>S[E]).sort((S,I)=>S-I);return(w[1]+w[2])/2}})}function y(k){let C=o.buildLayerMatrix(k),N=Object.assign(i(k,C),a(k,C)),E={},w;["u","d"].forEach(I=>{w=I==="u"?C:Object.values(C).reverse(),["l","r"].forEach(j=>{j==="r"&&(w=w.map(P=>Object.values(P).reverse()));let A=(I==="u"?k.predecessors:k.successors).bind(k),x=u(k,w,N,A),O=p(k,w,x.root,x.align,j==="r");j==="r"&&(O=o.mapValues(O,P=>-P)),E[I+j]=O})});let S=f(k,E);return m(E,S),g(E,k.graph().align)}function b(k,C,N){return(E,w,S)=>{let I=E.node(w),j=E.node(S),A=0,x;if(A+=I.width/2,Object.hasOwn(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":x=-I.width/2;break;case"r":x=I.width/2;break}if(x&&(A+=N?x:-x),x=0,A+=(I.dummy?C:k)/2,A+=(j.dummy?C:k)/2,A+=j.width/2,Object.hasOwn(j,"labelpos"))switch(j.labelpos.toLowerCase()){case"l":x=j.width/2;break;case"r":x=-j.width/2;break}return x&&(A+=N?x:-x),x=0,A}}function _(k,C){return k.node(C).width}}),PI=wt((n,t)=>{var r=qt(),o=OI().positionX;t.exports=i;function i(s){s=r.asNonCompoundGraph(s),a(s),Object.entries(o(s)).forEach(([c,l])=>s.node(c).x=l)}function a(s){let c=r.buildLayerMatrix(s),l=s.graph().ranksep,u=s.graph().rankalign,p=0;c.forEach(d=>{let f=d.reduce((m,g)=>{let y=s.node(g).height;return m>y?m:y},0);d.forEach(m=>{let g=s.node(m);u==="top"?g.y=p+g.height/2:u==="bottom"?g.y=p+f-g.height/2:g.y=p+f/2}),p+=f+l})}}),VI=wt((n,t)=>{var r=hI(),o=gI(),i=_I(),a=qt().normalizeRanks,s=bI(),c=qt().removeEmptyRanks,l=wI(),u=kI(),p=CI(),d=TI(),f=PI(),m=qt(),g=Yn().Graph;t.exports=y;function y(v,H={}){let oe=H.debugTiming?m.time:m.notime;return oe("layout",()=>{let te=oe(" buildLayoutGraph",()=>A(v));return oe(" runLayout",()=>b(te,oe,H)),oe(" updateInputGraph",()=>_(v,te)),te})}function b(v,H,oe){H(" makeSpaceForEdgeLabels",()=>x(v)),H(" removeSelfEdges",()=>$(v)),H(" acyclic",()=>r.run(v)),H(" nestingGraph.run",()=>l.run(v)),H(" rank",()=>i(m.asNonCompoundGraph(v))),H(" injectEdgeLabelProxies",()=>O(v)),H(" removeEmptyRanks",()=>c(v)),H(" nestingGraph.cleanup",()=>l.cleanup(v)),H(" normalizeRanks",()=>a(v)),H(" assignRankMinMax",()=>P(v)),H(" removeEdgeLabelProxies",()=>R(v)),H(" normalize.run",()=>o.run(v)),H(" parentDummyChains",()=>s(v)),H(" addBorderSegments",()=>u(v)),H(" order",()=>d(v,oe)),H(" insertSelfEdges",()=>q(v)),H(" adjustCoordinateSystem",()=>p.adjust(v)),H(" position",()=>f(v)),H(" positionSelfEdges",()=>K(v)),H(" removeBorderNodes",()=>J(v)),H(" normalize.undo",()=>o.undo(v)),H(" fixupEdgeLabelCoords",()=>X(v)),H(" undoCoordinateSystem",()=>p.undo(v)),H(" translateGraph",()=>W(v)),H(" assignNodeIntersects",()=>Z(v)),H(" reversePoints",()=>F(v)),H(" acyclic.undo",()=>r.undo(v))}function _(v,H){v.nodes().forEach(oe=>{let te=v.node(oe),ge=H.node(oe);te&&(te.x=ge.x,te.y=ge.y,te.order=ge.order,te.rank=ge.rank,H.children(oe).length&&(te.width=ge.width,te.height=ge.height))}),v.edges().forEach(oe=>{let te=v.edge(oe),ge=H.edge(oe);te.points=ge.points,Object.hasOwn(ge,"x")&&(te.x=ge.x,te.y=ge.y)}),v.graph().width=H.graph().width,v.graph().height=H.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],C={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},N=["acyclicer","ranker","rankdir","align","rankalign"],E=["width","height","rank"],w={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},j=["labelpos"];function A(v){let H=new g({multigraph:!0,compound:!0}),oe=M(v.graph());return H.setGraph(Object.assign({},C,ae(oe,k),m.pick(oe,N))),v.nodes().forEach(te=>{let ge=M(v.node(te)),me=ae(ge,E);Object.keys(w).forEach(le=>{me[le]===void 0&&(me[le]=w[le])}),H.setNode(te,me),H.setParent(te,v.parent(te))}),v.edges().forEach(te=>{let ge=M(v.edge(te));H.setEdge(te,Object.assign({},I,ae(ge,S),m.pick(ge,j)))}),H}function x(v){let H=v.graph();H.ranksep/=2,v.edges().forEach(oe=>{let te=v.edge(oe);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(H.rankdir==="TB"||H.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function O(v){v.edges().forEach(H=>{let oe=v.edge(H);if(oe.width&&oe.height){let te=v.node(H.v),ge={rank:(v.node(H.w).rank-te.rank)/2+te.rank,e:H};m.addDummyNode(v,"edge-proxy",ge,"_ep")}})}function P(v){let H=0;v.nodes().forEach(oe=>{let te=v.node(oe);te.borderTop&&(te.minRank=v.node(te.borderTop).rank,te.maxRank=v.node(te.borderBottom).rank,H=Math.max(H,te.maxRank))}),v.graph().maxRank=H}function R(v){v.nodes().forEach(H=>{let oe=v.node(H);oe.dummy==="edge-proxy"&&(v.edge(oe.e).labelRank=oe.rank,v.removeNode(H))})}function W(v){let H=Number.POSITIVE_INFINITY,oe=0,te=Number.POSITIVE_INFINITY,ge=0,me=v.graph(),le=me.marginx||0,he=me.marginy||0;function Oe($e){let Pe=$e.x,qe=$e.y,Ye=$e.width,et=$e.height;H=Math.min(H,Pe-Ye/2),oe=Math.max(oe,Pe+Ye/2),te=Math.min(te,qe-et/2),ge=Math.max(ge,qe+et/2)}v.nodes().forEach($e=>Oe(v.node($e))),v.edges().forEach($e=>{let Pe=v.edge($e);Object.hasOwn(Pe,"x")&&Oe(Pe)}),H-=le,te-=he,v.nodes().forEach($e=>{let Pe=v.node($e);Pe.x-=H,Pe.y-=te}),v.edges().forEach($e=>{let Pe=v.edge($e);Pe.points.forEach(qe=>{qe.x-=H,qe.y-=te}),Object.hasOwn(Pe,"x")&&(Pe.x-=H),Object.hasOwn(Pe,"y")&&(Pe.y-=te)}),me.width=oe-H+le,me.height=ge-te+he}function Z(v){v.edges().forEach(H=>{let oe=v.edge(H),te=v.node(H.v),ge=v.node(H.w),me,le;oe.points?(me=oe.points[0],le=oe.points[oe.points.length-1]):(oe.points=[],me=ge,le=te),oe.points.unshift(m.intersectRect(te,me)),oe.points.push(m.intersectRect(ge,le))})}function X(v){v.edges().forEach(H=>{let oe=v.edge(H);if(Object.hasOwn(oe,"x"))switch((oe.labelpos==="l"||oe.labelpos==="r")&&(oe.width-=oe.labeloffset),oe.labelpos){case"l":oe.x-=oe.width/2+oe.labeloffset;break;case"r":oe.x+=oe.width/2+oe.labeloffset;break}})}function F(v){v.edges().forEach(H=>{let oe=v.edge(H);oe.reversed&&oe.points.reverse()})}function J(v){v.nodes().forEach(H=>{if(v.children(H).length){let oe=v.node(H),te=v.node(oe.borderTop),ge=v.node(oe.borderBottom),me=v.node(oe.borderLeft[oe.borderLeft.length-1]),le=v.node(oe.borderRight[oe.borderRight.length-1]);oe.width=Math.abs(le.x-me.x),oe.height=Math.abs(ge.y-te.y),oe.x=me.x+oe.width/2,oe.y=te.y+oe.height/2}}),v.nodes().forEach(H=>{v.node(H).dummy==="border"&&v.removeNode(H)})}function $(v){v.edges().forEach(H=>{if(H.v===H.w){var oe=v.node(H.v);oe.selfEdges||(oe.selfEdges=[]),oe.selfEdges.push({e:H,label:v.edge(H)}),v.removeEdge(H)}})}function q(v){var H=m.buildLayerMatrix(v);H.forEach(oe=>{var te=0;oe.forEach((ge,me)=>{var le=v.node(ge);le.order=me+te,(le.selfEdges||[]).forEach(he=>{m.addDummyNode(v,"selfedge",{width:he.label.width,height:he.label.height,rank:le.rank,order:me+ ++te,e:he.e,label:he.label},"_se")}),delete le.selfEdges})})}function K(v){v.nodes().forEach(H=>{var oe=v.node(H);if(oe.dummy==="selfedge"){var te=v.node(oe.e.v),ge=te.x+te.width/2,me=te.y,le=oe.x-ge,he=te.height/2;v.setEdge(oe.e,oe.label),v.removeNode(H),oe.label.points=[{x:ge+2*le/3,y:me-he},{x:ge+5*le/6,y:me-he},{x:ge+le,y:me},{x:ge+5*le/6,y:me+he},{x:ge+2*le/3,y:me+he}],oe.label.x=oe.x,oe.label.y=oe.y}})}function ae(v,H){return m.mapValues(m.pick(v,H),Number)}function M(v){var H={};return v&&Object.entries(v).forEach(([oe,te])=>{typeof oe=="string"&&(oe=oe.toLowerCase()),H[oe]=te}),H}}),$I=wt((n,t)=>{var r=qt(),o=Yn().Graph;t.exports={debugOrdering:i};function i(a){let s=r.buildLayerMatrix(a),c=new o({compound:!0,multigraph:!0}).setGraph({});return a.nodes().forEach(l=>{c.setNode(l,{label:l}),c.setParent(l,"layer"+a.node(l).rank)}),a.edges().forEach(l=>c.setEdge(l.v,l.w,{},l.name)),s.forEach((l,u)=>{let p="layer"+u;c.setNode(p,{rank:"same"}),l.reduce((d,f)=>(c.setEdge(d,f,{style:"invis"}),f))}),c}}),RI=wt((n,t)=>{t.exports="2.0.4"}),LI=wt((n,t)=>{t.exports={graphlib:Yn(),layout:VI(),debug:$I(),util:{time:qt().time,notime:qt().notime},version:RI()}});const $y=LI();/*! For license information please see dagre.esm.js.LEGAL.txt */function DI(n){return n.map(({source:t,target:r})=>({source:t,target:r}))}function MI(n){const t=[];for(const r of n)for(const o of r.memberIds)t.push({source:r.ownerId,target:o});return t}function Ry(n,t){return[...DI(n),...MI(t)]}function Nl(n,t){const r=new Map;for(const{source:o,target:i}of n)r.has(o)||r.set(o,[]),r.get(o).push(i),r.has(i)||r.set(i,[]);return t&&(r.has(t.source)||r.set(t.source,[]),r.get(t.source).push(t.target),r.has(t.target)||r.set(t.target,[])),r}function Yd(n){const t=new Set,r=new Set;function o(i){if(r.has(i))return!0;if(t.has(i))return!1;t.add(i),r.add(i);for(const a of n.get(i)??[])if(o(a))return!0;return r.delete(i),!1}for(const i of n.keys())if(o(i))return!0;return!1}function Jd(n,t){const r=n.config;if(!r)return[];const o=r[t];return Array.isArray(o)?o.filter(i=>typeof i=="string"&&qd(i)):[]}function jI({state:n,groupMapById:t,getNodeById:r,history:o}){const i=e.computed(()=>{const x=new Map;for(const O of n.value.groups)for(const P of O.memberIds)x.set(P,{ownerId:O.ownerId,branch:O.branch});return x}),a=e.computed(()=>{const x=new Map;for(const O of n.value.groups)for(const P of O.memberIds)x.set(P,O);return x}),s=e.computed(()=>{const x=new Map;for(const O of n.value.groups)x.has(O.ownerId)||x.set(O.ownerId,[]),x.get(O.ownerId).push(O);return x}),c=e.computed(()=>Ry(n.value.edges,n.value.groups)),l=e.computed(()=>Nl(c.value));function u(x,O){return x?Ia(x.type).includes(O):!1}function p(x,O){if(O===x.id)return!1;const P=r(O);return!(!P||pn(P.type)||P.phase!==x.phase)}function d(x,O){const P=[],R=new Set;for(const W of O)R.has(W)||(R.add(W),p(x,W)&&P.push(W));return P}function f(x,O,P){const R=r(x);return u(R,O)?d(R,P):[]}function m(x,O,P){const R=zd(x.id,O),W=t.value.get(R);P.length>0?W?(W.phase!==x.phase&&(W.phase=x.phase),Gd(W.memberIds,P)||(W.position=void 0,W.dimensions=void 0,W.memberIds=[...P])):n.value.groups.push(Oy(x.id,O,x.phase,P)):W&&(n.value.groups=n.value.groups.filter(Z=>Z.id!==R))}function g(x,O,P,R={}){const W=r(x);if(!u(W,O))return!1;const Z=d(W,P),X=Jd(W,O);if(Gd(X,Z))return!1;const F=W.config??(W.config={});return Z.length>0?F[O]=[...Z]:(delete F[O],Object.keys(F).length===0&&delete W.config),m(W,O,Z),(R.commit??!0)&&o.commit(R.tag),!0}function y(x,O={}){const P=n.value.groups.filter(R=>R.ownerId!==x);return P.length===n.value.groups.length?!1:(n.value.groups=P,(O.commit??!0)&&o.commit(O.tag),!0)}function b(x,O){const P=t.value.get(zd(x,O));if(P)return[...P.memberIds];const R=r(x);return R?Jd(R,O):[]}function _(x){return i.value.get(x)}function k(x){const O=[];let P=a.value.get(x);for(;P;)O.push(P.id),P=a.value.get(P.ownerId);return O}function C(x,O){const P=k(O);if(P.length===0)return!1;const R=new Set(k(x));return R.size===0?!0:P.some(W=>!R.has(W))}function N(x,O){if(x===O)return!0;const P=new Set,R=[O];for(;R.length>0;){const W=R.pop();if(P.has(W))continue;if(P.add(W),W===x)return!0;const Z=l.value.get(W);if(Z)for(const X of Z)P.has(X)||R.push(X)}return!1}function E(x,O,P){const R=r(x);return!(!u(R,O)||!p(R,P)||N(x,P))}function w(x,O,P,R={}){const W=r(x);if(!W||!E(x,O,P))return!1;const Z=Jd(W,O);if(Z.includes(P))return!1;S(P,{commit:!1});const X=[...Z,P];return g(x,O,X,{commit:!1})?((R.commit??!0)&&o.commit(R.tag),!0):!1}function S(x,O={}){const P=_(x);if(!P)return!1;const R=b(P.ownerId,P.branch),W=R.filter(Z=>Z!==x);return W.length===R.length?!1:g(P.ownerId,P.branch,W,O)}function I(x){let O=0;const P=new Set;let R=a.value.get(x);for(;R&&!P.has(R.id);)O+=1,P.add(R.id),R=a.value.get(R.ownerId);return O}function j(x){const O=t.value.get(x);return O?I(O.ownerId):0}function A(x){return x?t.value.has(x):!1}return{memberGroupMap:a,groupsByOwner:s,findMembership:_,getMembers:b,wouldCreateCycle:N,setMembers:g,prepareMembers:f,addMember:w,removeMember:S,clear:y,getNodeDepth:I,getGroupDepth:j,isGroupId:A,isEdgeEnteringGroup:C,canAddMember:E}}function FI(n,t){const{commit:r,undo:o,redo:i,canUndo:a,canRedo:s,clear:c,reset:l,undoStack:u,redoStack:p}=Tt.useManualRefHistory(n,{capacity:t==null?void 0:t.capacity,clone:t==null?void 0:t.clone});let d;function f(C){var N;(N=t==null?void 0:t.onHistoryChange)==null||N.call(t,C,n.value)}function m(C){if(!C){d=void 0,r(),f("commit");return}if(C!=="*"&&d!==C){d=C,r(),f("commit");return}r(),u.value.shift(),f("commit")}function g(){o(),d=void 0,f("undo")}function y(){i(),d=void 0,f("redo")}function b(){c(),d=void 0,f("clear")}function _(){l(),d=void 0,f("reset")}function k(){o(),p.value.shift(),d=void 0,f("revert")}return{canUndo:a,canRedo:s,commit:m,undo:g,redo:y,clear:b,reset:_,revert:k}}function UI(n){var t,r;return((r=(t=n.config)==null?void 0:t.resources)==null?void 0:r.vault)||{}}function KI(n){const{resources:t}=n.config||{};return t!=null&&t.vault?Object.keys(t.vault):[]}function qI(n){const t=Object.entries(n);if(t.length===0)return;const r={};for(const[o,i]of t)r[o]=i;return r}function Ly(n,t){var b,_,k,C,N,E,w;const r=((b=n.config)==null?void 0:b.nodes)??[],o=((_=n.__ui_data)==null?void 0:_.nodes)??[],i=((k=n.__ui_data)==null?void 0:k.groups)??[],a=new Map(o.map(S=>[S.name,S])),s=new Map(i.map(S=>[S.name,S])),c=[],l=[],u=new Map,p=[],d=[],f=new Map,m=S=>{const I=new Set,j=[...S];for(;j.length>0;){const A=j.shift();if(!I.has(A)&&(I.add(A),Kd(A)||(u.get(A).phase="request"),!!f.has(A)))for(const x of f.get(A))I.has(x)||j.push(x)}};let g=!1;for(const S of r){const I=a.get(S.name);!I&&!g&&(g=!0);const j=My({type:S.type,configNode:S,uiNode:I,pluginData:n});c.push(j),u.set(j.name,j)}for(const S of c){const I=Ia(S.type);if(!I.length)continue;const j=S.config;if(j)for(const A of I){const x=j[A];if(!Array.isArray(x)){s.has(kl(S.name,A))&&(g=!0);continue}const O=[];for(const P of x){if(typeof P!="string")continue;const R=u.get(P);R&&!pn(R.type)&&O.push(R.id)}if(O.length){j[A]=O;const P=kl(S.name,A),R=s.get(P),W=R?{position:vr(R.position)}:void 0,Z=Oy(S.id,A,S.phase,O,W);p.push(Z),!R&&!g&&(g=!0)}else delete j[A],s.has(kl(S.name,A))&&(g=!0)}}for(const S of ei)if(!u.has(S)){let I=a.get(S);I||(g||(g=!0),I=dI(S));const j=My({type:S,uiNode:I,pluginData:n});c.push(j),u.set(j.name,j)}for(const S of r)zI(S,d);for(const S of d){const I=u.get(S.source),j=u.get(S.target);if(!I||!j){I||console.warn(`[initEditorState] skip: source "${S.source}" not found`),j||console.warn(`[initEditorState] skip: target "${S.target}" not found`);continue}f.has(S.source)||f.set(S.source,new Set),f.get(S.source).add(S.target),f.has(S.target)||f.set(S.target,new Set),f.get(S.target).add(S.source),l.push({id:ri("edge"),source:I.id,sourceField:(C=Yr(I,"output",S.sourceField))==null?void 0:C.id,target:j.id,targetField:(N=Yr(j,"input",S.targetField))==null?void 0:N.id})}m(["request","service_request"]);let y=null;return(w=(E=n.config)==null?void 0:E.resources)!=null&&w.cache&&(y={...n.config.resources.cache},n.partials&&(y.partial_id=n.partials[0].id)),{nodes:c,edges:l,groups:p,pendingLayout:g?t?"keepHistory":"clearHistory":!1,pendingFitView:!0,...y?{cacheConfig:y}:{}}}function Dy(n){const{type:t,name:r,phase:o,position:i,fields:a,config:s}=n,c=vy(t),l=oi(t);return{id:ri("node"),type:t,name:r??t,phase:o??"request",position:i??{x:0,y:0},expanded:{},fields:{input:Iy((a==null?void 0:a.input)??c.input),output:Iy((a==null?void 0:a.output)??c.output)},hidden:n.hidden||l.hidden,config:s?vr(s):{}}}function GI(n){return pn(n)?n==="request"||n==="service_request"?"request":"response":"request"}function My({type:n,configNode:t,uiNode:r,pluginData:o}){return Dy({type:n,name:t==null?void 0:t.name,phase:(r==null?void 0:r.phase)??GI(n),position:r==null?void 0:r.position,fields:WI({type:n,uiNode:r,configNode:t,pluginData:o}),hidden:r==null?void 0:r.hidden,config:YI({type:n,configNode:t,pluginData:o})})}function HI(n){const{type:t,name:r,input:o,inputs:i,output:a,outputs:s,...c}=n;return vr(c)}function zI(n,t){const r=n.name;if(n.input){const{nodeName:o,fieldName:i}=wl(n.input);o&&t.push({source:o,sourceField:i,target:r})}if(n.inputs)for(const[o,i]of Object.entries(n.inputs)){if(!i)continue;const{nodeName:a,fieldName:s}=wl(i);a&&t.push({source:a,sourceField:s,target:r,targetField:o})}if(n.output){const{nodeName:o,fieldName:i}=wl(n.output);o&&t.push({source:r,target:o,targetField:i})}if(n.outputs)for(const[o,i]of Object.entries(n.outputs)){if(!i)continue;const{nodeName:a,fieldName:s}=wl(i);a&&t.push({source:r,sourceField:o,target:a,targetField:s})}}function WI({type:n,uiNode:t,configNode:r,pluginData:o}){var c,l,u,p;const i=oi(n),a=i==null?void 0:i.io;if(!a)return;const s={};if((c=a.input)!=null&&c.configurable&&(t?s.input=((l=t.fields)==null?void 0:l.input)??[]:r!=null&&r.inputs&&(s.input=Object.keys(r.inputs))),(u=a.output)!=null&&u.configurable){if(t)s.output=((p=t.fields)==null?void 0:p.output)??[];else{const d=new Set;r!=null&&r.outputs&&Object.keys(r.outputs).forEach(f=>d.add(f)),(r==null?void 0:r.type)==="static"&&r.values&&Object.keys(r.values).forEach(f=>d.add(f)),d.size&&(s.output=Array.from(d))}n==="vault"&&(s.output=KI(o))}return Object.keys(s).length?s:void 0}function YI({type:n,configNode:t,pluginData:r}){return n==="vault"?UI(r):t?HI(t):void 0}function JI(n){const t=e.computed(()=>{const d=new Map;return n.value.nodes.forEach(f=>d.set(f.id,f)),d}),r=e.computed(()=>n.value.edges),o=e.computed(()=>n.value.groups),i=e.computed(()=>Ry(r.value,o.value));function a(d){return Nl(i.value,d?{source:d.source,target:d.target}:void 0)}function s(d){const f=t.value.get(d.source),m=t.value.get(d.target);if(!f||!m)return d;const g=By(f,d.sourceField)&&!Hd(f,d.sourceField),y=Hd(m,d.targetField);return g&&y?{source:d.target,sourceField:d.targetField,target:d.source,targetField:d.sourceField}:d}function c(d){const f=s(d),m=[],g=t.value.get(f.source),y=t.value.get(f.target);if(g||m.push("source node not found"),y||m.push("target node not found"),!g||!y)return{ok:!1,errors:m};Hd(g,f.sourceField)||m.push("source handle is not an output field"),By(y,f.targetField)||m.push("target handle is not an input field"),y.name==="request"&&m.push('cannot target "request"'),g.name==="response"&&m.push('cannot source from "response"');const b=r.value.some(C=>C.target===f.target&&!C.targetField),_=r.value.some(C=>C.target===f.target&&!!C.targetField);(b&&f.targetField||_&&!f.targetField)&&m.push("cannot mix whole-node and field-level inputs on same target"),f.targetField&&r.value.some(C=>C.target===f.target&&C.targetField===f.targetField)&&m.push("target field already connected"),!f.targetField&&r.value.some(C=>C.target===f.target&&!C.targetField)&&m.push("target input already taken"),f.source===f.target&&m.push("self-loop not allowed");const k=a({source:f.source,target:f.target});return Yd(k)&&m.push("connection introduces a cycle"),m.length?{ok:!1,errors:m}:{ok:!0}}function l(){const d=[];for(const f of ei)[...t.value.values()].some(m=>m.name===f)||d.push(`missing implicit node "${f}"`);for(const f of r.value){const m=t.value.get(f.source);t.value.get(f.target).name==="request"&&d.push(`edge "${f.id}" targets "request"`),m.name==="response"&&d.push(`edge "${f.id}" sources from "response"`)}return Yd(a())&&d.push("graph contains cycle"),d.length?{ok:!1,errors:d}:{ok:!0}}function u(d){return c(d).ok}function p(d){return!d.source||!d.target?!1:u({source:d.source,sourceField:d.sourceHandle,target:d.target,targetField:d.targetHandle})}return{canonicalizeConnection:s,validateConnection:c,validateGraph:l,isValidConnection:u,isValidVueFlowConnection:p,buildAdjacency:Nl}}const[Xd,XI]=Tt.createInjectionState(function(t,r={}){const o=e.ref(Ly(t)),i=e.ref(),a=e.ref(),s=e.ref(!1),c=e.ref(!1),l=FI(o,{capacity:200,clone:vr,onHistoryChange:ee=>{var se,ue;ee!=="clear"&&((ue=r.onChange)==null||ue.call(r,et(),ye(),ke(),(se=o.value.cacheConfig)==null?void 0:se.partial_id))}}),u=e.ref(!1),p=e.ref(new Set);function d(){o.value.pendingLayout=!1,l.commit("*")}function f(ee=!0){o.value.pendingFitView!==ee&&(o.value.pendingFitView=ee,l.commit("*"))}const m=e.computed(()=>{const ee={request:0,response:0};return o.value.nodes.forEach(se=>{pn(se.type)||ee[se.phase]++}),ee}),g=e.computed(()=>new Map(o.value.nodes.map(ee=>[ee.id,ee]))),y=e.computed(()=>new Map(o.value.nodes.map(ee=>[ee.name,ee]))),b=e.computed(()=>{const ee=new Map,se=new Map;for(const ue of o.value.edges)ee.set(ue.id,ue),se.has(ue.source)||se.set(ue.source,new Set),se.get(ue.source).add(ue.id),se.has(ue.target)||se.set(ue.target,new Set),se.get(ue.target).add(ue.id);return{edgeMapById:ee,edgeIdMapByNodeId:se}}),_=e.computed(()=>b.value.edgeMapById),k=e.computed(()=>b.value.edgeIdMapByNodeId),C=e.computed(()=>new Map(o.value.groups.map(ee=>[ee.id,ee]))),N=e.computed(()=>new Set(o.value.nodes.map(ee=>ee.name))),E=jI({state:o,groupMapById:C,getNodeById:x,history:l}),{canonicalizeConnection:w,validateConnection:S,validateGraph:I,isValidConnection:j,isValidVueFlowConnection:A}=JI(o);function x(ee){return g.value.get(ee)}function O(ee){return y.value.get(ee)}function P(ee){return _.value.get(ee)}function R(ee){if(!k.value.has(ee))return[];const se=[];return k.value.get(ee).forEach(ue=>{const Ee=P(ue);Ee&&se.push(Ee)}),se}function W(ee){return R(ee).filter(se=>se.target===ee)}function Z(ee){return R(ee).filter(se=>se.source===ee)}const X=e.computed(()=>i.value?x(i.value):void 0);function F(ee){i.value=ee}function J(ee){a.value=ee}function $(ee){if(pn(ee.type))throw new Error("[createNode] implicit nodes are fixed.");return Dy({type:ee.type,name:ee.name||(pn(ee.type)?void 0:Ty(ee.type,N.value)),phase:ee.phase,position:ee.position,fields:ee.fields,config:ee.config})}function q(ee,se=!0){const ue=$(ee);if(ue)return o.value.nodes.push(ue),se&&l.commit(),u.value=!0,ue.id}function K(ee,se,ue=!0){const Ee=x(ee);if(!Ee||pn(Ee.type))return;const _e={...vr(Ee),id:ri("node"),name:Ty(Ee.name,N.value),position:se??{x:Ee.position.x+20,y:Ee.position.y+20}},xe=Ia(_e.type);if(xe.length&&_e.config){for(const h of xe)delete _e.config[h];Object.keys(_e.config).length===0&&delete _e.config}return o.value.nodes.push(_e),ue&&l.commit(),u.value=!0,_e.id}function ae(ee,se=!0){if(!x(ee))return;o.value.edges=o.value.edges.filter(_e=>_e.source!==ee&&_e.target!==ee),E.clear(ee,{commit:!1}),E.removeMember(ee,{commit:!1}),o.value.nodes=o.value.nodes.filter(_e=>_e.id!==ee),i.value===ee&&(i.value=void 0);const Ee=I();Ee.ok||console.warn("[removeNode] topology invalid:",Ee.errors.join("; ")),se&&l.commit()}function M(ee,se,ue=!0,Ee){const _e=x(ee);if(!_e)return;if(Kd(_e.name)){console.warn("[renameNode] implicit node name is reserved.");return}_e.name!==se&&(_e.name=se,ue&&l.commit(Ee))}function v(ee,se,ue=!0){const Ee=x(ee);Ee&&(Ee.position={...se},ue&&l.commit())}function H(ee,se,ue=!0){const Ee=C.value.get(ee);if(!Ee)return;const _e=Ee.position;_e&&_e.x===se.x&&_e.y===se.y||(Ee.position={...se},ue&&l.commit())}function oe(ee,se,ue=!0){const Ee=C.value.get(ee);if(!Ee)return!1;const _e={...se.position},xe={...se.dimensions},h=Ee.position&&Ee.position.x===_e.x&&Ee.position.y===_e.y,T=Ee.dimensions&&Ee.dimensions.width===xe.width&&Ee.dimensions.height===xe.height;return h&&T?!1:(Ee.position=_e,Ee.dimensions=xe,ue&&l.commit(),!0)}function te(ee,se,ue,Ee=!0,_e){const xe=x(ee);if(!xe)return;const h=ue??!xe.expanded[se];h!==!!xe.expanded[se]&&(xe.expanded[se]=h,Ee&&l.commit(_e??`toggle:${ee}:${se}`))}function ge(ee,se,ue=!0,Ee){const _e=x(ee);_e&&(_e.config=vr(se),ue&&l.commit(Ee))}function me(ee,se,ue,Ee=!0){const _e=x(ee);if(!_e)return;const xe=_e.fields[se];if(xe.some(h=>h.name===ue)){console.warn(`[addField] field "${ue}" already exists on ${se}.`);return}xe.push({id:ri("field"),name:ue}),se==="input"?_e.fields.input=xe:_e.fields.output=xe,Ee&&l.commit()}function le(ee,se,ue,Ee=!0){const _e=x(ee);if(!_e)return;const xe=_e.fields.input,h=_e.fields.output,T=xe.find(G=>G.id===se)??h.find(G=>G.id===se);T&&(T.name=ue,Ee&&l.commit())}function he(ee,se,ue=!0,Ee=!0){const _e=x(ee);if(!_e)return;const xe=_e.fields.input,h=_e.fields.output,T=xe.findIndex(re=>re.id===se);T>=0&&xe.splice(T,1);const G=h.findIndex(re=>re.id===se);G>=0&&h.splice(G,1),_e.fields.input=xe,_e.fields.output=h,ue&&(o.value.edges=o.value.edges.filter(re=>re.sourceField!==se&&re.targetField!==se));const Y=I();Y.ok||console.warn("[removeField] topology invalid:",Y.errors.join("; ")),Ee&&l.commit()}function Oe(ee,se=!0){const ue=w(ee),Ee=S(ue);if(!Ee.ok){console.warn("[connectEdge] invalid connection:",Ee.errors.join("; "));return}const _e={id:ri("edge"),...ue};o.value.edges.push(_e);const xe=I();if(!xe.ok){o.value.edges.pop(),console.warn("[connectEdge] topology invalid:",xe.errors.join("; "));return}return se&&l.commit(),_e.id}function $e(ee,se,ue=!0){Pe(ee,!1),Oe(se,!1),ue&&l.commit()}function Pe(ee,se=!0){const ue=o.value.edges.findIndex(xe=>xe.id===ee);if(ue<0)return;const Ee=o.value.edges[ue];o.value.edges.splice(ue,1);const _e=I();if(!_e.ok){o.value.edges.splice(ue,0,Ee),console.warn("[disconnectEdge] topology invalid:",_e.errors.join("; "));return}se&&l.commit()}function qe(ee,se=!0){const ue=W(ee);for(const Ee of ue)Pe(Ee.id,!1);se&&l.commit()}function Ye(ee,se=!0){const ue=Z(ee);for(const Ee of ue)Pe(Ee.id,!1);se&&l.commit()}function et(){var se,ue,Ee,_e,xe;const ee=[];for(const h of o.value.nodes){if(pn(h.type))continue;let T;const G={};let Y;const re={};for(const z of o.value.edges.filter(V=>V.target===h.id)){const V=x(z.source);if(!V)continue;const D=(se=Jr(V,"output",z.sourceField))==null?void 0:se.name,ne=D?`${V.name}.${D}`:V.name,ce=(ue=Jr(h,"input",z.targetField))==null?void 0:ue.name;ce?G[ce]=ne:T===void 0&&(T=ne)}for(const z of o.value.edges.filter(V=>V.source===h.id)){const V=x(z.target);if(!V)continue;const D=V.type;if(!pn(D)||!((Ee=_l[D].io)!=null&&Ee.input))continue;const ne=(_e=Jr(V,"input",z.targetField))==null?void 0:_e.name,ce=ne?`${V.name}.${ne}`:V.name,Ce=(xe=Jr(h,"output",z.sourceField))==null?void 0:xe.name;Ce?re[Ce]=ce:Y===void 0&&(Y=ce)}const be={...vr(h.config),name:h.name,type:h.type},L=Ia(h.type);if(L.length)for(const z of L){const V=be[z];if(!Array.isArray(V))continue;const D=[];for(const ne of V){const ce=x(ne);ce&&D.push(ce.name)}D.length?be[z]=Array.from(new Set(D)):delete be[z]}Object.keys(G).length>0?be.inputs=G:T!==void 0&&(be.input=T),Object.keys(re).length>0?be.outputs=re:Y!==void 0&&(be.output=Y),ee.push(be)}return ee}function Ve(){return o.value.nodes.map(ee=>vr({name:ee.name,phase:ee.phase,position:{...ee.position},expanded:{...ee.expanded},fields:{input:ee.fields.input.map(se=>se.name),output:ee.fields.output.map(se=>se.name)}}))}function ke(){const ee={},se=O("vault");if(se){const ue=qI(se.config);ue&&Object.keys(ue).length>0&&(ee.vault=ue)}if(o.value.cacheConfig){const{strategy:ue,redis:Ee,memory:_e}=o.value.cacheConfig;ee.cache={strategy:ue,redis:Ee,memory:_e}}if(Object.keys(ee).length!==0)return ee}function we(){const ee=[];for(const se of o.value.groups){const ue=x(se.ownerId);if(!ue)continue;const Ee=se.position;Ee&&ee.push({name:kl(ue.name,se.branch),position:{...Ee}})}return ee}function ye(){return{nodes:Ve(),groups:we()}}function ie(ee,se){se&&l.commit(),o.value=Ly(ee,se),se||l.clear()}return{state:o,selection:i,portalSelection:a,modalOpen:s,skipValidation:u,invalidConfigNodeIds:p,propertiesPanelOpen:c,configNodeCounts:m,nodeMapById:g,nodeMapByName:y,edgeMapById:_,edgeIdMapByNodeId:k,groupMapById:C,getNodeById:x,getNodeByName:O,getEdgeById:P,getEdgesByNodeId:R,getInEdgesByNodeId:W,getOutEdgesByNodeId:Z,selectedNode:X,selectNode:F,selectPortalEdge:J,createNode:$,addNode:q,duplicateNode:K,removeNode:ae,renameNode:M,moveNode:v,moveGroup:H,setGroupLayout:oe,toggleExpanded:te,replaceConfig:ge,branchGroups:E,addField:me,renameField:le,removeField:he,connectEdge:Oe,replaceConnection:$e,disconnectEdge:Pe,disconnectInEdges:qe,disconnectOutEdges:Ye,toConfigNodes:et,toUINodes:Ve,toUIGroups:we,toUIData:ye,load:ie,commit:l.commit,undo:l.undo,redo:l.redo,canUndo:l.canUndo,canRedo:l.canRedo,clear:l.clear,reset:l.reset,revert:l.revert,isValidConnection:j,isValidVueFlowConnection:A,validateGraph:()=>I(),clearPendingLayout:d,setPendingFitView:f}});function Pt(){const n=XI();if(!n)throw new Error("Editor state is not provided. Ensure you are using provideEditorStore in a parent component.");return n}function ZI(n){const{branchLayout:t,phase:r,layoutOptions:o,nodes:i,edges:a}=n,{findNode:s}=Nt.useVueFlow(),{state:c,branchGroups:l,getNodeById:u,moveNode:p,commit:d}=Pt(),{getNodeDepth:f,isGroupId:m,groupsByOwner:g}=l,{isBranchEdgeId:y,updateGroupLayout:b,translateGroupTree:_,waitForLayoutFlush:k}=t,{viewport:C,padding:N=zr.padding,gaps:E=zr.gaps}=o,{nodes:w=zr.gaps.nodes,edges:S=zr.gaps.edges,ranks:I=zr.gaps.ranks}=E;async function j(O=!0){const P=new Map(i.value.map(v=>[v.id,v.data])),R=new Map,W=new Map,Z=v=>{if(!v)return;let H=W.get(v);return H||(H=s(v),H&&W.set(v,H),H)},X=new Map,F=v=>{let H=X.get(v);return H!==void 0||(H=f(v),X.set(v,H)),H},J=v=>{if(!va(v.data))return v.parentNode;const H=Z(v.data.ownerId);if(!H)throw new Error(`Cannot find owner node '${v.data.ownerId}' for group node '${v.id}' via findNode`);return H.parentNode};for(const v of a.value){if(y(v.id))continue;const H=v.source,oe=v.target;if(m(H)||m(oe))continue;const te=Z(H),ge=Z(oe);if(te){if(!ge)throw new Error(`Cannot find target node '${oe}' for edge '${v.id}' via findNode`)}else throw new Error(`Cannot find source node '${H}' for edge '${v.id}' via findNode`);if(J(te)===J(ge))continue;let me=te,le=ge,he=F(me.id),Oe=F(le.id);for(;he!==Oe;)if(he>Oe){const $e=J(me);if(!$e)throw new Error(`Expected node '${me.id}' to have parent, but it does not`);const Pe=Z($e);if(!Pe)throw new Error(`Cannot find parent node '${$e}' for node '${me.id}' via findNode`);me=Pe,he--}else if(Oe>he){const $e=J(le);if(!$e)throw new Error(`Expected node '${le.id}' to have parent, but it does not`);const Pe=Z($e);if(!Pe)throw new Error(`Cannot find parent node '${$e}' for node '${le.id}' via findNode`);le=Pe,Oe--}for(;he>=0;){const $e=J(me),Pe=J(le);if($e===Pe){R.has(he)||R.set(he,[]),R.get(he).push({v:me.id,w:le.id});break}if($e){if(!Pe){const et=`Expected node '${le.id}' to have parent, but it does not`;throw console.error(et,le),new Error(et)}}else{const et=`Expected node '${me.id}' to have parent, but it does not`;throw console.error(et,me),new Error(et)}const qe=Z($e),Ye=Z(Pe);if(qe){if(!Ye)throw new Error(`Cannot find parent node '${Pe}' for node '${le.id}' via findNode`)}else throw new Error(`Cannot find parent node '${$e}' for node '${me.id}' via findNode`);me=qe,le=Ye,he--,Oe--}}const $=c.value.groups.toSorted((v,H)=>F(H.ownerId)-F(v.ownerId));for(const v of $)A(v.memberIds.reduce((H,oe)=>{const te=u(oe);if(!te)return console.warn(`Cannot find node '${oe}' of group '${v.id}' by getNodeById`),H;if(te.phase!==r)return H;if(te.type==="branch"){const ge=g.value.get(te.id);ge&&H.push(...ge)}return P.delete(te.id),H.push(te),H},[]),{virtualEdges:R.get(F(v.ownerId)),cachedFindNode:Z}),await e.nextTick(),b(v.id,!1),await k();const q=P.values().toArray();for(const v of q){if(va(v)||v.type!=="branch")continue;const H=g.value.get(v.id);H&&q.push(...H)}const{autoNodes:K,leftNode:ae,rightNode:M}=x(q);A(K,{leftNode:ae,rightNode:M,virtualEdges:R.get(0),cachedFindNode:Z}),O&&d()}function A(O,P){var me,le,he,Oe,$e;const{leftNode:R,rightNode:W,virtualEdges:Z,cachedFindNode:X}=P||{},F=R?(X??s)(R.id):void 0,J=W?(X??s)(W.id):void 0;let $;if(O.length>0){$=new $y.graphlib.Graph({multigraph:!0}),$.setGraph({rankdir:r==="request"?"LR":"RL",nodesep:w,edgesep:S,ranksep:I});const Pe=new Set;for(const qe of O){const Ye=(X??s)(qe.id);if(!Ye){console.warn(`Cannot find graph node '${qe.id}' in ${r} phase`);continue}Pe.add(qe.id),va(qe)?$.setNode(qe.id,{...qe.dimensions??Ye.dimensions}):$.setNode(qe.id,{...Ye.dimensions})}for(const qe of a.value)!Pe.has(qe.source)||!Pe.has(qe.target)||$.setEdge(qe.source,qe.target,{points:[]});Z==null||Z.forEach(qe=>$.setEdge(qe,{points:[]})),$y.layout($)}const q=[],K=Pe=>({x:Pe.x-Pe.width/2,y:Pe.y-Pe.height/2,width:Pe.width,height:Pe.height});if(O.length>0){if(!$)throw new Error("Expected dagreGraph to be initialized");for(const Pe of O){const qe=$.node(Pe.id),Ye=K(qe);q.push(Ye),va(Pe)?_(Pe.id,Ye,Ye.x+Wo,Ye.y+Wo):p(Pe.id,{x:Ye.x,y:Ye.y},!1)}}const ae=q.length>0?Py(q):{x:0,y:0,width:0,height:0},M=ae.width,v=ae.height,H=ae.x,oe=ae.x+ae.width,te=Math.max(0,Math.min(e.toValue(C==null?void 0:C.width)??Number.POSITIVE_INFINITY,N1)-M-2*w-(((me=F==null?void 0:F.dimensions)==null?void 0:me.width)??0)-(((le=J==null?void 0:J.dimensions)==null?void 0:le.width)??0)-2*N),ge=ae.y+v/2;R&&p(R.id,{x:H-w-te/2-(((he=F==null?void 0:F.dimensions)==null?void 0:he.width)??0),y:ge-(((Oe=F==null?void 0:F.dimensions)==null?void 0:Oe.height)??0)/2},!1),W&&p(W.id,{x:oe+w+te/2,y:ge-((($e=J==null?void 0:J.dimensions)==null?void 0:$e.height)??0)/2},!1)}function x(O){let P,R;const W=[];for(const Z of O){if(va(Z)){W.push(Z);continue}switch(Z.name){case"request":{if(r!=="request")throw new Error(`Unexpected request node in ${r} phase`);if(P)throw new Error("Duplicated request node in request phase");P=Z;break}case"service_request":{if(r!=="request")throw new Error(`Unexpected service_request node in ${r} phase`);if(R)throw new Error("Duplicated service_request node in request phase");R=Z;break}case"service_response":{if(r!=="response")throw new Error(`Unexpected service_response node in ${r} phase`);if(R)throw new Error("Duplicated service_response node in response phase");R=Z;break}case"response":{if(r!=="response")throw new Error(`Unexpected response node in ${r} phase`);if(P)throw new Error("Duplicated response node in response phase");P=Z;break}default:{W.push(Z);break}}}return{autoNodes:W,leftNode:P,rightNode:R}}return{autoLayout:j}}function QI({phase:n,groupMapById:t,getNodeDepth:r,canAddMember:o,draggingId:i}){const a=e.shallowRef(),s=e.shallowRef();function c(d){a.value=d,s.value=void 0}function l(){a.value&&(a.value=void 0,s.value=void 0)}function u(d){let f;const m=i==null?void 0:i.value;return t.value.forEach(g=>{if(g.phase!==n||m&&qd(m)&&!o(g.ownerId,g.branch,m))return;const y=g.position,b=g.dimensions;if(!y||!b||!(d.x>=y.x&&d.x<=y.x+b.width&&d.y>=y.y&&d.y<=y.y+b.height))return;const k=r(g.ownerId);(!f||k>f.depth)&&(f={depth:k,id:g.id})}),f==null?void 0:f.id}function p(d){if(!a.value){s.value=void 0;return}if(!d){s.value=void 0;return}s.value=u(d)}return{activeGroupId:s,start:c,updateActiveGroup:p,end:l}}function eB({phase:n,readonly:t,flowId:r,draggingId:o}){const{findNode:i}=Nt.useVueFlow(r),a=Pt(),{state:s,groupMapById:c,getNodeById:l,moveNode:u,moveGroup:p,setGroupLayout:d,commit:f,branchGroups:m}=a,{memberGroupMap:g,groupsByOwner:y,getNodeDepth:b,getGroupDepth:_}=m,k=J=>!!J&&J.startsWith("branch:");function C(J){const $=[];for(const q of J.memberIds){const K=l(q);K&&$.push(K)}return $}const N=e.computed(()=>{const J=new Map;return g.value.forEach(($,q)=>{if($.phase!==n||!$.position)return;const K=l(q);K&&(K.phase!==n||K.hidden||J.set(q,$))}),J}),E=e.computed(()=>{const J=new Map;return y.value.forEach(($,q)=>{const K=$.filter(ae=>ae.phase===n);K.length>0&&J.set(q,K)}),J}),w=e.computed(()=>{const J=[];for(const $ of s.value.groups){const q=l($.ownerId);if(!q||q.phase!==n)continue;const K=$.position,ae=$.dimensions;if(!K||!ae)continue;const M=C($).filter(H=>H.phase===n&&!H.hidden),v=_($.id);J.push({id:$.id,type:"group",position:K,width:ae.width,height:ae.height,data:{...$,memberIds:M.map(H=>H.id)},draggable:!t,selectable:!1,zIndex:v*rl+w1})}return J}),S=e.computed(()=>{let J=0;for(const $ of s.value.groups){if($.phase!==n)continue;const q=_($.id);q>J&&(J=q)}return J}),I=e.computed(()=>{const J=[];for(const $ of s.value.groups){if($.phase!==n||!$.position||!$.dimensions)continue;const q=l($.ownerId);if(!q||q.phase!==n||q.hidden||!C($).filter(v=>v.phase===n&&!v.hidden).length)continue;const ae=Math.max(b(q.id),_($.id))+S.value+1,M={id:`branch:${$.id}`,source:q.id,target:$.id,sourceHandle:`branch@${$.branch}`,targetHandle:"input",markerEnd:Nt.MarkerType.ArrowClosed,selectable:!1,focusable:!1,updatable:!1,data:{type:"branch",ownerId:q.id,branch:$.branch,groupId:$.id},zIndex:ae*rl+C1};J.push(M)}return J}),j=new Map,A=new Map;let x;function O(J,$=!0){if(J.phase!==n)return;const q=C(J).filter(H=>H.phase===n&&!H.hidden);if(!q.length)return;const K=[];for(const H of q){const oe=i(H.id),te=oe==null?void 0:oe.dimensions,ge=(te==null?void 0:te.width)??0,me=(te==null?void 0:te.height)??0;if(ge<=0||me<=0)return;K.push({...H.position,width:ge,height:me});const le=y.value.get(H.id)??[];for(const he of le){if(he.phase!==n)continue;const Oe=j.get(he.id),$e=(Oe==null?void 0:Oe.position)??he.position,Pe=(Oe==null?void 0:Oe.dimensions)??he.dimensions;!$e||!Pe||K.push({x:$e.x,y:$e.y,width:Pe.width,height:Pe.height})}}const ae=Py(K),M=ae.width+Wo*2,v=ae.height+Wo*2;return{position:{x:Math.round(ae.x-Wo),y:Math.round(ae.y-Wo)},dimensions:{width:Math.round(M),height:Math.round(v)},commit:$}}function P(){if(j.size===0){x=void 0;return}const J=[];let $=!1;j.forEach((q,K)=>{const ae=d(K,q,!1);J.push({id:K,changed:ae,commit:q.commit}),q.commit&&ae&&!$&&($=!0)}),j.clear(),x=void 0;for(const{id:q,changed:K,commit:ae}of J){if(!K)continue;const M=c.value.get(q);if(!M)continue;const v=N.value.get(M.ownerId);v&&A.set(v.id,{commit:ae})}if(A.size>0){const q=Array.from(A);A.clear();for(const[K,{commit:ae}]of q)W(K,ae)}$&&f("*")}function R(){j.size!==0&&(x||(x=e.nextTick().then(P)))}function W(J,$=!0){const q=c.value.get(J);if(!q)return;const K=O(q,$);K&&(j.set(J,K),R())}function Z(J,$,q,K){const ae=c.value.get(J);if(!ae)return;if(!ae.position){p(J,$,!1),W(J);return}if(q===0&&K===0){p(J,$,!1);return}p(J,$,!1);const M=[J],v=new Set([J]),H=new Set;for(;M.length;){const oe=M.shift(),te=c.value.get(oe);if(!te)continue;const ge=C(te).filter(me=>me.phase===n&&!me.hidden);for(const me of ge){H.has(me.id)||(u(me.id,{x:me.position.x+q,y:me.position.y+K},!1),H.add(me.id));const le=E.value.get(me.id)??[];for(const he of le){if(v.has(he.id))continue;const Oe=c.value.get(he.id);Oe!=null&&Oe.position&&p(he.id,{x:Oe.position.x+q,y:Oe.position.y+K},!1),v.add(he.id),M.push(he.id)}}}}function X(J,$){const q=o==null?void 0:o.value;if(!q)return!1;if(q===J||$.some(K=>q===K))return!0;for(const K of $){const ae=E.value.get(K)??[];if(ae!=null&&ae.some(M=>M.id===q))return!0}return!1}const F=new Map;return e.watch(()=>s.value.groups.filter($=>$.phase===n).map($=>{const q=$.memberIds.map(K=>{var H,oe;const ae=i(K),M=Math.round(((H=ae==null?void 0:ae.dimensions)==null?void 0:H.width)??0),v=Math.round(((oe=ae==null?void 0:ae.dimensions)==null?void 0:oe.height)??0);return`${K}:${M}x${v}`});return{id:$.id,memberIds:$.memberIds,signature:q.join(",")}}),J=>{const $=new Set(J.map(q=>q.id));for(const q of F.keys())$.has(q)||F.delete(q);for(const q of J)X(q.id,q.memberIds)||F.get(q.id)===q.signature||(F.set(q.id,q.signature),W(q.id))},{deep:!0,flush:"post"}),{groupsByOwner:E,memberGroupMap:N,groupNodes:w,branchEdges:I,isBranchEdgeId:k,updateGroupLayout:W,translateGroupTree:Z,getNodeDepth:b,maxGroupDepth:S,waitForLayoutFlush:()=>x??Promise.resolve()}}function tB(n){e.provide(jh,n)}function jy(){return e.inject(jh,void 0)}function Fy(){const n=jy();if(!n)throw new Error("Confirm modal not provided");return n}function nB(n){const{readonly:t,flowId:r}=n,o=Nt.useVueFlow(r),{onNodesChange:i,onEdgesChange:a,onPaneClick:s,findEdge:c}=o,{disconnectEdge:l,commit:u,portalSelection:p,selectPortalEdge:d}=Pt();i(f=>{f.some(m=>m.type==="select"&&"selected"in m&&m.selected)&&d(void 0)}),a(f=>{const m=f.some(y=>y.type==="select"&&"selected"in y&&y.selected),g=p.value?f.some(y=>y.type==="remove"&&y.id===p.value):!1;(m||g)&&d(void 0)}),s(()=>d(void 0)),Tt.useEventListener("keydown",f=>{if(t||f.key!=="Delete"&&f.key!=="Backspace")return;const m=p.value;!m||c(m)||(f.preventDefault(),l(m,!1),d(void 0),u())})}function Uy(n){const t=n.match(/^(input|output)(?:s@(.*))?$/);if(t)return{io:t[1],field:t[2]}}const rB={default:a1,hover:l1,selected:s1};let Ky,Zd;function Sl(n){const t=n.id===Ky?"selected":n.id===Zd?"hover":"default",r=rB[t],{markerEnd:o}=n,i=typeof o=="object"?{...o,color:r}:{type:o,color:r},a=n.zIndex??0,s=t==="selected"?a+2:t==="hover"?a+1:a;return{...n,style:{...n.style,stroke:r,strokeWidth:t==="selected"?1.5:void 0},markerEnd:i,zIndex:s}}const[oB,iB]=Tt.createInjectionState(function(n){const{phase:t,flowId:r,layoutOptions:o,readonly:i}=n,{viewport:a,padding:s=zr.padding,gaps:c=zr.gaps}=o,{nodes:l=zr.gaps.nodes}=c,u=Nt.useVueFlow(r),p=Pt(),d=jy(),f=Dd(),{i18n:{t:m}}=Je(),{findNode:g,fitView:y,deleteKeyCode:b,onNodeDrag:_,onNodeDragStop:k,onConnect:C,onNodesChange:N,onEdgesChange:E,onEdgeUpdate:w,onEdgeMouseEnter:S,onEdgeMouseLeave:I,getNodes:j,setNodes:A,setEdges:x,addSelectedNodes:O,screenToFlowCoordinate:P}=u;b.value=["Delete","Backspace"];const{state:R,commit:W,moveNode:Z,selectNode:X,removeNode:F,getNodeById:J,connectEdge:$,disconnectEdge:q,getInEdgesByNodeId:K,branchGroups:ae,commit:M,reset:v,groupMapById:H}=p,{isGroupId:oe,canAddMember:te}=ae,ge=e.shallowRef(),me=V=>{ge.value=V},le=e.readonly(ge);function he(V,D){const ne=J(V.source),ce=J(V.target);return!!(ne&&ce&&ne.phase===D&&ce.phase===D)}const Oe=eB({phase:t,readonly:i,flowId:r,draggingId:le}),{memberGroupMap:$e,groupNodes:Pe,branchEdges:qe,isBranchEdgeId:Ye,updateGroupLayout:et,translateGroupTree:Ve,getNodeDepth:ke,maxGroupDepth:we}=Oe,{activeGroupId:ye,start:ie,updateActiveGroup:ee,end:se}=QI({phase:t,groupMapById:H,getNodeDepth:ke,canAddMember:te,draggingId:le}),ue=e.computed(()=>R.value.nodes.filter(V=>V.phase===t&&!V.hidden).map(V=>{const D=$e.value.get(V.id),ne=D==null?void 0:D.position,ce=D==null?void 0:D.dimensions,Ce=D&&ne&&ce?{x:V.position.x-ne.x,y:V.position.y-ne.y}:V.position,Se=ke(V.id),ve=!!(D&&ne&&ce),ze=(ve?Se:0)+we.value+1;return{id:V.id,type:"flow",position:Ce,data:V,deletable:!i&&!bl(V),parentNode:ve?D.id:void 0,zIndex:ze*rl+E1}})),Ee=e.computed(()=>R.value.edges.filter(V=>he(V,t)).filter(V=>!ae.isEdgeEnteringGroup(V.source,V.target)).filter(V=>{const D=J(V.source),ne=J(V.target);return!(D!=null&&D.hidden)&&!(ne!=null&&ne.hidden)}).map(V=>{const D=J(V.source),ne=J(V.target);if(!D||!ne){const Ce=[];throw D||Ce.push(`source node "${V.source}"`),ne||Ce.push(`target node "${V.target}"`),new Error(`Missing ${Ce.join(" and ")} for edge "${V.id}" in phase "${t}"`)}const ce=Math.max(ke(V.source),ke(V.target))+we.value+1;return Sl({id:V.id,source:V.source,target:V.target,sourceHandle:V.sourceField?`outputs@${V.sourceField}`:"output",targetHandle:V.targetField?`inputs@${V.targetField}`:"input",markerEnd:Nt.MarkerType.ArrowClosed,data:V,updatable:!i,zIndex:ce*rl+k1})})),_e=e.computed(()=>[...qe.value,...Ee.value]),{autoLayout:xe}=ZI({phase:t,layoutOptions:o,branchLayout:Oe,nodes:ue,edges:_e});nB({readonly:i,flowId:r}),e.watch([ue,Pe,_e],([V,D,ne])=>{A([...D,...V]),x(ne)},{immediate:!0});const h=e.computed(()=>({padding:s/Math.max(e.toValue(a==null?void 0:a.width)??0,e.toValue(a==null?void 0:a.height)??0)}));async function T({source:V,sourceHandle:D,target:ne,targetHandle:ce}){if(!D||!ce)return;const Ce=Uy(D),Se=Uy(ce);if((Ce==null?void 0:Ce.io)==="input"||(Se==null?void 0:Se.io)==="output"||D==="output"&&ce==="output")return;const ve=K(ne);let ze=!1,Ke=!1;const Be=[],Ae=[],Xe=(Se==null?void 0:Se.io)==="input"?ve.filter(xt=>!xt.targetField):ve.filter(xt=>!!xt.targetField);Xe.length>0&&(ze=!0,Xe.forEach(xt=>{Ae.push(Ba(xt,J)),q(xt.id,!1)}));const Lt=(Se==null?void 0:Se.io)==="input"?Se!=null&&Se.field?ve.filter(xt=>xt.targetField===Se.field):ve.filter(xt=>!!xt.targetField):ve.filter(xt=>!xt.targetField);if(Lt.length>0){if(Lt.some(Zt=>Zt.source===V&&Zt.target===ne&&Zt.targetField===(Se==null?void 0:Se.field)&&Zt.sourceField===(Ce==null?void 0:Ce.field)))return;Ke=!0,Lt.forEach(Zt=>{Ae.push(Ba(Zt,J)),q(Zt.id,!1)})}if(!$({source:V,sourceField:Ce==null?void 0:Ce.field,target:ne,targetField:Se==null?void 0:Se.field},!1)){v(),f({message:m("plugins.free-form.datakit.flow_editor.error.invalid_connection"),appearance:"danger"});return}if(Be.push(Wd(V,Ce==null?void 0:Ce.field,ne,Se==null?void 0:Se.field,J)),ze||Ke){if(!d)throw v(),new Error("Expected confirm modal to be provided here when reachable");if(!await d(m(ze?"plugins.free-form.datakit.flow_editor.confirm.message.switch":"plugins.free-form.datakit.flow_editor.confirm.message.override"),Be,Ae)){v();return}}M()}C(T);let G=!1;const Y=()=>{G&&(G=!1,M())};N(V=>{V.filter(ce=>ce.type==="select").filter(ce=>!oe(ce.id)).sort((ce,Ce)=>ce.selected===Ce.selected?0:ce.selected?1:-1).forEach(ce=>{X(ce.selected?ce.id:void 0)});let ne=!1;V.forEach(ce=>{if(ce.type==="remove"){if(oe(ce.id))return;ne=!0,F(ce.id,!1)}}),ne&&!G&&(G=!0,queueMicrotask(Y))}),_(({node:V,event:D})=>{var ve,ze,Ke;if(!V)return;if(oe(V.id)){const Be=V.id;me(Be),ee(void 0);const Ae=H.value.get(Be);if(!Ae)return;const Xe=Ae.position??{...V.position},Lt=V.position.x-Xe.x,ar=V.position.y-Xe.y;Ve(Be,V.position,Lt,ar);const xt=$e.value.get(Ae.ownerId);xt&&et(xt.id,!1);return}const ne=V.id;ie("canvas"),me(ne);const ce=V.parentNode;let Ce={...V.position};if(ce&&oe(ce)){const Be=H.value.get(ce);Be!=null&&Be.position&&(Ce={x:Be.position.x+V.position.x,y:Be.position.y+V.position.y})}if(Z(ne,Ce,!1),!bl(J(ne))){const Be={x:Ce.x,y:Ce.y,width:((ve=V.dimensions)==null?void 0:ve.width)??0,height:((ze=V.dimensions)==null?void 0:ze.height)??0},Ae=D&&"clientX"in D?P({x:D.clientX,y:D.clientY}):void 0,Xe={x:Be.x+Be.width/2,y:Be.y+Be.height/2};ee(Ae??Xe)}const Se=ce&&oe(ce)?ce:(Ke=$e.value.get(ne))==null?void 0:Ke.id;Se&&et(Se,!1)}),k(({node:V})=>{var Se;if(!V)return;if(me(void 0),oe(V.id)){W();return}const D=V.id,ne=V.parentNode;let ce={...V.position};if(ne&&oe(ne)){const ve=H.value.get(ne);ve!=null&&ve.position&&(ce={x:ve.position.x+V.position.x,y:ve.position.y+V.position.y})}Z(D,ce,!1);const Ce=ne&&oe(ne)?ne:(Se=$e.value.get(D))==null?void 0:Se.id;Ce&&et(Ce,!1),Ne(D),se(),W()}),E(V=>{V.filter(ce=>ce.type==="select").sort((ce,Ce)=>ce.selected===Ce.selected?0:ce.selected?1:-1).forEach(ce=>{Ye(ce.id)||(Ky=ce.selected?ce.id:void 0,x(Ce=>Ce.map(Se=>Se.id!==ce.id||!Se.markerEnd?Se:Sl({...Se,zIndex:ce.selected?1:void 0}))))});let ne=!1;V.forEach(ce=>{if(ce.type==="remove"){if(Ye(ce.id))return;ne=!0,q(ce.id,!1)}}),ne&&!G&&(G=!0,queueMicrotask(Y))}),S(({edge:V})=>{Ye(V.id)||(Zd=V.id,x(D=>D.map(ne=>ne.id!==V.id?ne:Sl(ne))))}),I(({edge:V})=>{Ye(V.id)||(Zd=void 0,x(D=>D.map(ne=>ne.id!==V.id?ne:Sl(ne))))}),w(({edge:V,connection:D})=>{Ye(V.id)||(q(V.id,!1),T(D))});function re(V){y({...h.value,...V})}async function be(V){return X(V),new Promise(D=>setTimeout(()=>{const ne=g(V);O(ne?[ne]:[]),D()},0))}function L(V){const D=j.value.filter(({type:Xe})=>Xe!=="group"),ne=D.find(({id:Xe})=>Xe===V);if(!ne)throw new Error(`Node ${V} not found`);const{x:ce,y:Ce}=ne.data.position,{width:Se,height:ve}=ne.dimensions,ze=Ce,Ke=Ce+ve,Be=D.filter(({id:Xe})=>Xe!==V).filter(({data:{position:{y:Xe}},dimensions:{height:Lt}})=>Xe<Ke&&Xe+Lt>ze).map(({data:{position:{x:Xe}},dimensions:{width:Lt}})=>({left:Xe,right:Xe+Lt})).sort((Xe,Lt)=>Xe.left-Lt.left);let Ae=ce+Se+l;for(const{left:Xe,right:Lt}of Be)if(!(Lt<=Ae)){if(Ae+Se<=Xe)return{x:Ae,y:ze};Ae=Math.max(Ae,Lt)+l}return{x:Ae,y:ze}}function de(V){if(!V)return;const D=g(V);if(!D)throw new Error(`Node ${V} not found`);const{position:{x:ne},dimensions:{width:ce}}=D,Ce=ne+ce,{viewport:Se,dimensions:ve,setViewport:ze}=u,{x:Ke,y:Be,zoom:Ae}=Se.value,{width:Xe}=ve.value,Lt=ne*Ae+Ke,ar=Ce*Ae+Ke,xt=Xe-Mh-l;if(ar<=xt)return;let Zt=xt-ar;Lt+Zt<0&&(Zt=-Lt),Zt!==0&&ze({x:Ke+Zt,y:Be,zoom:Ae},{duration:A1})}function Ne(V){if(!ye.value)return!1;const{nodeId:D,branch:ne}=fI(ye.value),ce=ae.addMember(D,ne,V,{commit:!1});return ee(void 0),ce}return{vueFlowStore:u,editorStore:p,readonly:i,nodes:ue,edges:_e,selectNode:be,autoLayout:xe,placeToRight:L,scrollRightToReveal:de,fitViewParams:h,fitView:re,groupDrop:{activeGroupId:ye,startPanelDrag:()=>ie("panel"),endPanelDrag:se,updateActiveGroup:ee,attachNodeToActiveGroup:Ne}}});let ii=null;function aB(){var t;if(ii)return ii;if(typeof navigator>"u")return ii="windows";const n=((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(n)?ii="mac":/Linux/i.test(n)&&!/Android/i.test(n)?ii="linux":ii="windows"}const sB={Shift:"⇧",Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Mod:"⌘",Enter:"↩",ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Tab:"⇥",Esc:"⎋",Space:"Space",Delete:"⌫"},lB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Win",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Spacebar",Delete:"Delete"},cB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Super",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Space",Delete:"Delete"};function uB(n,t={}){const r=t.platform??aB(),o=t.joiner??(r==="mac"?"":" + "),i=r==="mac"?sB:r==="linux"?cB:lB;return(Array.isArray(n)?n:n[r]).map(s=>s in i?i[s]:s).join(o)}const dB={key:0,class:"label"},fB={class:"keys"},xl=Me(e.defineComponent({__name:"HotkeyLabel",props:{label:{},keys:{},reverse:{type:Boolean}},setup(n){const t=uB(n.keys);return(r,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["dk-hotkey-label",{reverse:n.reverse}])},[n.label?(e.openBlock(),e.createElementBlock("span",dB,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("kbd",fB,e.toDisplayString(e.unref(t)),1)],2))}}),[["__scopeId","data-v-7ca86b0d"]]),pB=["onClick"],mB={key:0,class:"additional-count"},qy=24,hB=16,Al=Me(e.defineComponent({__name:"NodePortal",props:{expanded:{type:Boolean,default:()=>{}},reversed:{type:Boolean},targets:{}},setup(n){const t=Number.parseFloat(h1)||0,r={target:"body"},{portalSelection:o,selectPortalEdge:i}=Pt(),a=e.ref(!1),s=e.computed(()=>{const g=o.value;return g?n.targets.some(y=>y.edgeId===g):!1}),c=e.computed(()=>n.expanded!==void 0?n.expanded||s.value:a.value||s.value),l=()=>qy*n.targets.length+t*(n.targets.length-1),u=e.computed(()=>({width:c.value?`${l()}px`:"fit-content"})),p=g=>{i(g)},d=g=>o.value===g,f=e.computed(()=>n.targets.map((g,y)=>{const b=(qy+t)*y;return{edgeId:g.edgeId,key:`${g.node.id}-${g.fieldName??"node"}-${y}`,icon:jd(g.node.type).icon,tooltip:g.fieldName?`${g.node.name}.${g.fieldName}`:g.node.name,highlighted:d(g.edgeId),tooltipEl:null,style:y===0?{width:"fit-content",zIndex:n.targets.length}:{position:"absolute",...n.reversed?{left:`${b}px`,transform:c.value?"translateX(0)":`translateX(-${b}px)`}:{right:0,transform:c.value?`translateX(-${b}px)`:"translateX(0)"},zIndex:n.targets.length-y}}})),m=e.computed(()=>Math.max(n.targets.length-1,0));return(g,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-portal",{expanded:c.value,reversed:n.reversed}]),onClick:y[0]||(y[0]=e.withModifiers(()=>{},["stop"])),onDragstart:y[1]||(y[1]=e.withModifiers(()=>{},["stop"])),onMousedown:y[2]||(y[2]=e.withModifiers(()=>{},["stop"])),onMouseenter:y[3]||(y[3]=b=>a.value=!0),onMouseleave:y[4]||(y[4]=b=>a.value=!1)},[e.createElementVNode("div",{class:"target-boxes",style:e.normalizeStyle(u.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(b,_)=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:b.key,class:"target-box-wrapper","kpop-attributes":r,placement:"top",style:e.normalizeStyle(b.style),text:b.tooltip},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["target-box",{highlighted:b.highlighted}]),onClick:e.withModifiers(k=>p(b.edgeId),["stop"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.icon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:hB},null,8,["color"])),_===0&&m.value>0?(e.openBlock(),e.createElementBlock("span",mB," +"+e.toDisplayString(m.value),1)):e.createCommentVNode("",!0)],10,pB)]),_:2},1032,["style","text"]))),128))],4)],34))}}),[["__scopeId","data-v-45ce7484"]]),vl=Me(e.defineComponent({__name:"HandleTwig",props:{color:{},position:{default:()=>Nt.Position.Left},size:{default:()=>Number.parseFloat(Lh)},type:{}},setup(n){e.useCssVars(r=>({v64bbaf90:r.color}));const t=e.computed(()=>({width:`${n.size}px`,minWidth:`${n.size}px`}));return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["handle-twig",[n.type,n.position===e.unref(Nt.Position).Left?"left":"right"]]),style:e.normalizeStyle(t.value)},null,6))}}),[["__scopeId","data-v-74b600f2"]]),Qd=Me(e.defineComponent({__name:"NodeBadge",props:{type:{},size:{},iconOnly:{type:Boolean}},setup(n){e.useCssVars(r=>{var o,i;return{v3b4ea967:(o=t.value.colors)==null?void 0:o.background,v00febd7c:(i=t.value.colors)==null?void 0:i.foreground}});const t=e.computed(()=>jd(n.type));return(r,o)=>{var a;const i=e.resolveComponent("KBadge");return e.openBlock(),e.createBlock(i,{appearance:"neutral",class:e.normalizeClass(["dk-node-badge",{"icon-only":n.iconOnly,"has-colors":!!t.value.colors}]),size:n.size},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(n.type),1)]),_:2},[(a=t.value)!=null&&a.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value.icon)))]),key:"0"}:void 0]),1032,["class","size"])}}}),[["__scopeId","data-v-409d29e5"]]),gB={class:"body"},yB={class:"name"},_B={class:"handle"},bB={class:"handle-label-wrapper"},wB={class:"handle-label-wrapper"},kB={class:"handle-label text"},CB={class:"handle"},EB={class:"handle-label-wrapper"},NB={class:"handle-label-wrapper"},SB={class:"handle-label text"},xB={key:2,class:"branch-handles"},AB={class:"handle-label-wrapper"},vB={class:"handle-label text"},Gy=Me(e.defineComponent({__name:"FlowNode",props:{data:{},error:{type:Boolean},readonly:{type:Boolean}},setup(n){const t=e.useSlots(),{t:r}=jt.createI18n("en-us",Yt),o=iB(),{getInEdgesByNodeId:i,getOutEdgesByNodeId:a,getNodeById:s,toggleExpanded:c,duplicateNode:l,removeNode:u,propertiesPanelOpen:p,branchGroups:d}=Pt(),f=e.computed(()=>oi(n.data.type)),m=e.computed(()=>n.data.fields.input.length>0),g=e.computed(()=>n.data.fields.output.length>0),y=e.computed(()=>m.value&&i(n.data.id).every(K=>K.targetField===void 0)),b=e.computed(()=>g.value&&a(n.data.id).every(K=>K.sourceField===void 0)),_=e.computed(()=>n.data.expanded.input??!1),k=e.computed(()=>n.data.expanded.output??!1),C=e.computed(()=>{var K,ae,M;return((M=(ae=(K=f.value.io)==null?void 0:K.next)==null?void 0:ae.branches)==null?void 0:M.map(({name:v})=>v))??[]}),N=e.computed(()=>C.value.length>0),E=e.computed(()=>d.findMembership(n.data.id)),w=e.computed(()=>{var K,ae;if(n.data.type==="property"){const M=(K=n.data.config)==null?void 0:K.property;return Rd(M)}return(ae=f.value.io)==null?void 0:ae.input}),S=e.computed(()=>{var K,ae;if(n.data.type==="property"){const M=(K=n.data.config)==null?void 0:K.property;return $d(M)}return(ae=f.value.io)==null?void 0:ae.output}),I=e.computed(()=>bl(n.data)),j=e.computed(()=>n.data.phase==="response"),A=e.computed(()=>n.data.phase==="request"?Nt.Position.Left:Nt.Position.Right),x=e.computed(()=>n.data.phase==="request"?Nt.Position.Right:Nt.Position.Left),O=e.computed(()=>n.data.phase==="request"?Nt.Position.Right:Nt.Position.Left),P=e.computed(()=>bl(n.data)?r(`plugins.free-form.datakit.flow_editor.node_types.${n.data.type}.name`):n.data.name),R=e.computed(()=>I.value?n1:r1);function W(K){return K==="input"?j.value:!j.value}function Z(K){const ae=new Map,M=K==="input"?i(n.data.id):a(n.data.id);for(const v of M){const H=s(K==="input"?v.source:v.target);if(!H)continue;if(K==="input"){const le=H.type==="vault",he=H.phase!==n.data.phase,Oe=d.isEdgeEnteringGroup(H.id,n.data.id);if(!(le||he||Oe))continue}else{const le=H.phase!==n.data.phase,he=d.isEdgeEnteringGroup(n.data.id,H.id);if(!(le||he))continue}const oe=K==="input"?v.targetField||"input":v.sourceField||"output";let te;if(K==="input"&&v.sourceField){const le=H.fields.output.find(he=>he.id===v.sourceField);te=le==null?void 0:le.name}else if(K==="output"&&v.targetField){const le=H.fields.input.find(he=>he.id===v.targetField);te=le==null?void 0:le.name}const ge={edgeId:v.id,node:H,fieldName:te},me=ae.get(oe);me?me.push(ge):ae.set(oe,[ge])}return ae}const X=e.computed(()=>Z("input")),F=e.computed(()=>Z("output"));function J(K){!o||o.readonly||K==="input"&&!y.value||K==="output"&&!b.value||c(n.data.id,K)}async function $(){if(!o||o.readonly)return;const K=l(n.data.id,o.placeToRight(n.data.id));await o.selectNode(K),o.scrollRightToReveal(K),p.value=!0}function q(){d.removeMember(n.data.id)}return e.watch(y,K=>{K||c(n.data.id,"input",!0,!0,"*")},{immediate:!0}),e.watch(b,K=>{K||c(n.data.id,"output",!0,!0,"*")},{immediate:!0}),e.watch(()=>n.data.fields.input,(K,ae)=>{en(K,ae)||c(n.data.id,"input",K.length>0,!0,"*")},{deep:!0}),e.watch(()=>n.data.fields.output,(K,ae)=>{en(K,ae)||c(n.data.id,"output",K.length>0,!0,"*")},{deep:!0}),(K,ae)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-flow-node",{reversed:j.value,implicit:I.value,readonly:n.readonly}])},[e.createElementVNode("div",gB,[I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:0,class:"badge",placement:"top",text:n.data.type},{default:e.withCtx(()=>[e.createVNode(Qd,{"icon-only":"",size:"small",type:n.data.type},null,8,["type"])]),_:1},8,["text"])),e.createElementVNode("div",yB,e.toDisplayString(P.value),1),n.error?(e.openBlock(),e.createBlock(e.unref(Re.WarningIcon),{key:1,class:"error-icon",color:`var(--kui-color-text-danger, ${e.unref(Ph)})`,size:16},null,8,["color"])):e.createCommentVNode("",!0),t.actions?e.renderSlot(K.$slots,"actions",{key:2,data:n.data},void 0,!0):I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KDropdown),{key:3,class:"menu",disabled:n.readonly,"kpop-attributes":{offset:"4px",target:"body",popoverClasses:"dk-flow-node-menu"},width:"160",onClick:ae[1]||(ae[1]=e.withModifiers(()=>{},["stop"]))},{items:e.withCtx(()=>[e.createVNode(e.unref(Fe.KDropdownItem),{onClick:$},{default:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).duplicate,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.duplicate")},null,8,["keys","label"])]),_:1}),E.value?(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:0,onClick:q},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KDropdownItem),{danger:"",onClick:ae[0]||(ae[0]=M=>e.unref(u)(n.data.id))},{default:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).delete,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.delete")},null,8,["keys","label"])]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",class:"menu-trigger",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text, ${e.unref(od)})`},null,8,["color"])]),_:1})]),_:1},8,["disabled"]))]),t["before-handles"]?e.renderSlot(K.$slots,"before-handles",{key:0,data:n.data},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["handles",{reversed:j.value}])},[w.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["input-handles",{"has-fields":m.value}])},[e.createElementVNode("div",_B,[e.createVNode(e.unref(Nt.Handle),{id:"input",position:A.value,type:"target"},null,8,["position"]),X.value.has("input")?(e.openBlock(),e.createBlock(Al,{key:0,mode:"input",reversed:W("input"),targets:X.value.get("input")},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",bB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:y.value}]),onClick:ae[2]||(ae[2]=e.withModifiers(M=>J("input"),["stop"]))},[ae[4]||(ae[4]=e.createElementVNode("div",{class:"text"}," inputs ",-1)),m.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Re.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["size"])),_.value?(e.openBlock(),e.createBlock(e.unref(Re.UnfoldLessIcon),{key:1,color:y.value?void 0:`var(--kui-color-text-disabled, ${e.unref($h)})`,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),m.value&&_.value?(e.openBlock(),e.createBlock(vl,{key:0,color:R.value,position:A.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)])]),m.value&&_.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.input,(M,v)=>(e.openBlock(),e.createElementBlock("div",{key:`inputs-${M.id}`,class:"handle indented"},[e.createVNode(e.unref(Nt.Handle),{id:`inputs@${M.id}`,position:A.value,type:"target"},null,8,["id","position"]),X.value.has(M.id)?(e.openBlock(),e.createBlock(Al,{key:0,mode:"input",reversed:W("input"),targets:X.value.get(M.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",wB,[e.createElementVNode("div",kB,e.toDisplayString(M.name),1),e.createVNode(vl,{color:R.value,position:A.value,type:v<n.data.fields.input.length-1?"trident":"corner"},null,8,["color","position","type"])])]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["output-handles",{"has-fields":g.value}])},[e.createElementVNode("div",CB,[e.createElementVNode("div",EB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:b.value}]),onClick:ae[3]||(ae[3]=e.withModifiers(M=>J("output"),["stop"]))},[ae[5]||(ae[5]=e.createElementVNode("div",{class:"text"}," outputs ",-1)),g.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Re.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["size"])),k.value?(e.openBlock(),e.createBlock(e.unref(Re.UnfoldLessIcon),{key:1,color:b.value?void 0:`var(--kui-color-text-disabled, ${e.unref($h)})`,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),g.value&&k.value?(e.openBlock(),e.createBlock(vl,{key:0,color:R.value,position:x.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(Nt.Handle),{id:"output",position:x.value,type:"source"},null,8,["position"]),F.value.has("output")?(e.openBlock(),e.createBlock(Al,{key:0,mode:"output",reversed:W("output"),targets:F.value.get("output")},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]),g.value&&k.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.output,(M,v)=>(e.openBlock(),e.createElementBlock("div",{key:`outputs-${M.id}`,class:"handle indented"},[e.createElementVNode("div",NB,[e.createElementVNode("div",SB,e.toDisplayString(M.name),1),e.createVNode(vl,{color:R.value,position:x.value,type:v<n.data.fields.output.length-1?"trident":"corner"},null,8,["color","position","type"])]),e.createVNode(e.unref(Nt.Handle),{id:`outputs@${M.id}`,position:x.value,type:"source"},null,8,["id","position"]),F.value.has(M.id)?(e.openBlock(),e.createBlock(Al,{key:0,mode:"output",reversed:W("output"),targets:F.value.get(M.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createElementBlock("div",xB,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,M=>(e.openBlock(),e.createElementBlock("div",{key:`branch-${M}`,class:"handle"},[e.createElementVNode("div",AB,[e.createElementVNode("div",vB,e.toDisplayString(M),1)]),e.createVNode(e.unref(Nt.Handle),{id:`branch@${M}`,connectable:!1,position:O.value,type:"source"},null,8,["id","position"])]))),128))])):e.createCommentVNode("",!0)],2),t["after-handles"]?e.renderSlot(K.$slots,"after-handles",{key:1,data:n.data},void 0,!0):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-1de3b7cb"]]),IB=Me(e.defineComponent({__name:"GroupNode",props:{data:{},active:{type:Boolean}},setup(n){const t=n,r=e.computed(()=>t.data.phase==="response"),o=e.computed(()=>r.value?Nt.Position.Right:Nt.Position.Left);return(i,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-branch-group-node",{reversed:r.value,"drop-target":n.active}])},[e.createVNode(e.unref(Nt.Handle),{id:"input",connectable:!1,position:o.value,type:"target"},null,8,["position"])],2))}}),[["__scopeId","data-v-cf30ffea"]]),ef=Me(e.defineComponent({__name:"FlowCanvas",props:{flowId:{},phase:{},mode:{}},emits:["initialized","nodes-change","node-click"],setup(n,{expose:t,emit:r}){const o=e.useSlots(),i=r,a=e.useTemplateRef("flowCanvas"),s=Tt.useElementBounding(a),{i18n:{t:c}}=Je(),l=e.computed(()=>{const te=n.mode==="edit"||n.mode==="inspect";return{panOnDrag:te?void 0:!1,panOnScroll:te?void 0:!1,zoomOnDoubleClick:te?void 0:!1,zoomOnPinch:te?void 0:!1,zoomOnScroll:te?void 0:!1}}),{vueFlowStore:u,editorStore:p,autoLayout:d,fitViewParams:f,fitView:m,selectNode:g,placeToRight:y,scrollRightToReveal:b,groupDrop:_}=oB({phase:n.phase,flowId:n.flowId,layoutOptions:{viewport:{width:s.width,height:s.height}},readonly:n.mode!=="edit"}),{addNode:k,propertiesPanelOpen:C,invalidConfigNodeIds:N,selectedNode:E,duplicateNode:w,commit:S,selectPortalEdge:I}=p,{screenToFlowCoordinate:j,zoomIn:A,zoomOut:x,viewport:O,maxZoom:P,minZoom:R}=u,{activeGroupId:W,startPanelDrag:Z,endPanelDrag:X,updateActiveGroup:F,attachNodeToActiveGroup:J}=_;function $(te){var me;const ge=(me=te.dataTransfer)==null?void 0:me.types.find(le=>le.startsWith(`${pa}/`));if(ge)return ge.replace(`${pa}/`,"")}function q(te){var ge,me;if(n.mode==="inspect"){if(((ge=te==null?void 0:te.node)==null?void 0:ge.type)==="group")return;i("node-click",te.node.data);return}if(n.mode==="edit"){if(((me=te==null?void 0:te.node)==null?void 0:me.type)==="group"){g(void 0),I(void 0);return}C.value=!0}}function K(te){n.mode==="edit"&&(te.preventDefault(),F(j({x:te.clientX,y:te.clientY})))}function ae(te){var qe;if(n.mode!=="edit")return;const ge=(qe=te.dataTransfer)==null?void 0:qe.getData(pa);if(!ge)return;te.preventDefault();const me=JSON.parse(ge);if(me.action!=="create-node")return;const le=j({x:te.clientX,y:te.clientY}),{type:he,anchor:Oe}=me.data,$e={type:he,phase:n.phase,position:{x:le.x-Oe.offsetX,y:le.y-Oe.offsetY}},Pe=k($e,!1);if(!Pe){X();return}J(Pe),S(),g(Pe),C.value=!0,X()}async function M(){i("initialized"),n.mode==="inspect"&&setTimeout(async()=>{await d(!1),setTimeout(()=>m(),0)},0)}async function v(){await d(),setTimeout(()=>m(),0)}const H=e.computed(()=>{if(n.mode==="preview")return[];const te=[{name:"zoom_in",icon:Re.AddIcon,action:A,disabled:O.value.zoom>=P.value},{name:"zoom_out",icon:Re.RemoveIcon,action:x,disabled:O.value.zoom<=R.value},{name:"fit_view",icon:Re.FullscreenIcon,action:m}];return n.mode==="edit"&&te.push({name:"auto_layout",icon:Re.AutoLayoutIcon,action:v}),te});n.mode==="edit"&&(Tt.useEventListener("dragstart",te=>{$(te)&&Z()}),Tt.useEventListener("dragend",()=>{X()}));async function oe(){const te=E.value;if(n.mode!=="edit"||!te||te.phase!==n.phase)return;const ge=w(te.id,y(te.id));ge&&(await g(ge),C.value=!0,b(ge))}return Oh({enabled:e.computed(()=>!!E.value&&n.mode==="edit"&&E.value.phase===n.phase),duplicate:oe}),t({autoLayout:d,fitView:m}),(te,ge)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowCanvas",ref:a,class:"dk-flow-canvas"},[e.createVNode(e.unref(Nt.VueFlow),e.mergeProps({id:n.flowId,class:["flow",{readonly:n.mode!=="edit",inspect:n.mode==="inspect"}]},l.value,{"connect-on-click":!1,"elements-selectable":n.mode==="edit"||n.mode==="inspect","max-zoom":e.unref(S1),"min-zoom":e.unref(x1),"multi-selection-key-code":null,"nodes-connectable":n.mode==="edit","nodes-draggable":n.mode==="edit",onDragover:K,onDrop:ae,onNodeClick:q,onNodesChange:ge[0]||(ge[0]=me=>i("nodes-change")),onNodesInitialized:M}),{"node-flow":e.withCtx(({data:me})=>[e.createVNode(Gy,{data:me,error:e.unref(N).has(me.id),readonly:n.mode!=="edit"},e.createSlots({_:2},[o["node-before-handles"]?{name:"before-handles",fn:e.withCtx(()=>[e.renderSlot(te.$slots,"node-before-handles",{data:me},void 0,!0)]),key:"0"}:void 0,o["node-actions"]?{name:"actions",fn:e.withCtx(()=>[e.renderSlot(te.$slots,"node-actions",{data:me},void 0,!0)]),key:"1"}:void 0,o["node-after-handles"]?{name:"after-handles",fn:e.withCtx(()=>[e.renderSlot(te.$slots,"node-after-handles",{data:me},void 0,!0)]),key:"2"}:void 0]),1032,["data","error","readonly"])]),"node-group":e.withCtx(({data:me})=>[e.createVNode(IB,{active:e.unref(W)===me.id,data:me},null,8,["active","data"])]),default:e.withCtx(()=>[e.createVNode(e.unref(GC.Background)),e.createVNode(e.unref(Ih.Controls),{"fit-view-params":e.unref(f),position:"bottom-left","show-fit-view":!1,"show-interactive":!1,"show-zoom":!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(H.value,me=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:me.name,placement:"right",text:e.unref(c)(`plugins.free-form.datakit.flow_editor.actions.${me.name}`)},{default:e.withCtx(()=>[e.createVNode(e.unref(Ih.ControlButton),{disabled:me.disabled,onClick:e.withModifiers(me.action,["stop"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(me.icon),{size:18}))]),_:2},1032,["disabled","onClick"])]),_:2},1032,["text"]))),128))]),_:1},8,["fit-view-params"])]),_:3},16,["id","class","elements-selectable","max-zoom","min-zoom","nodes-connectable","nodes-draggable"])],512))}}),[["__scopeId","data-v-11561a7e"]]);function Hy(){const n=["methods","logout_methods"];return{setFieldType:(p,d,f)=>{var m,g,y;if(!(!p||!d||!f))switch(f.type){case"boolean":p[d]={type:Ie.ConfigurationSchemaType.BadgeStatus,...p[d]};break;case"string":f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.Redacted,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break;case"set":((m=f.elements)==null?void 0:m.type)==="string"&&(p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]});break;case"array":n.includes(d)?p[d]={type:Ie.ConfigurationSchemaType.BadgeMethod,...p[d]}:((g=f.elements)==null?void 0:g.type)==="string"?f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.RedactedArray,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]}:((y=f.elements)==null?void 0:y.type)==="record"&&(p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]});break;case"record":p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]};break;default:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break}},convertToDotNotation:p=>p.replace(/-/g,"."),unFlattenObject:p=>{const d={};for(const f in p){const m=f.split(".");m.reduce((g,y,b)=>g[y]||(g[y]=isNaN(m[b+1])?m.length-1===b?p[f]:{}:[]),d)}return d},dismissField:(p,d,f="redis",m=!1)=>{const g=new RegExp("(?<=-redis-).*");if(typeof p!="object"||p===null)return p;f==="redis"?Object.keys(p).forEach(y=>{y.match(g)&&delete p[y]}):m?p[f]=null:delete p[f],Object.assign(p,d)},isObjectEmpty:p=>Object.keys(p).length===0,unsetNullForeignKey:(p,d)=>{["service.id","route.id","consumer.id","consumer_group.id"].indexOf(p)>-1&&d[p]===null&&(delete d[p],d[p.replace(".id","")]=null)},formatPluginFieldLabel:p=>p.replace(/_/g," ").split("-").map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join("-"),getTallestPluginCardHeight:p=>{let d=0;if(p.length)for(let f=0;f<p.length;f++){const m=p[f].$el;d=m.offsetHeight>d?m.offsetHeight:d}return d},getToggleVisibility:(p,d)=>{var f,m;if(p&&d){const g=(m=(f=window==null?void 0:window.getComputedStyle(p))==null?void 0:f.getPropertyValue("grid-template-columns"))==null?void 0:m.split(" ").length;return d>g}return!0}}}var Il=(n=>(n.REDIS_CE="redis-ce",n.REDIS_EE="redis-ee",n))(Il||{});const Bl=["Featured"],tf=[fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.AI,fe.PluginGroup.SECURITY,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.SERVERLESS,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.LOGGING,fe.PluginGroup.DEPLOYMENT,fe.PluginGroup.WEBSOCKET,fe.PluginGroup.MONETIZATION,fe.PluginGroup.CUSTOM_PLUGINS],Tl=[fe.PluginGroup.AI,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.LOGGING,fe.PluginGroup.MONETIZATION,fe.PluginGroup.SECURITY,fe.PluginGroup.SERVERLESS,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.CUSTOM_PLUGINS];var yo=(n=>(n.SERVICE="service_id",n.ROUTE="route_id",n.CONSUMER="consumer_id",n.CONSUMER_GROUP="consumer_group_id",n))(yo||{});const _o=n=>{const t=Object.fromEntries(n.fields.map(r=>Object.entries(r)[0]));return"id"in t||(t.id={}),t},bo={label:"Tags",name:"tags",type:"input",inputType:"text",valueType:"array",valueArrayType:"string",placeholder:"Enter list of tags",help:"An optional set of strings for grouping and filtering, separated by commas.",hint:"e.g. tag1, tag2, tag3"},ai={getColumnFields:_o,tags:bo,id:{label:"ID"},enabled:{label:"Enabled",indexed:!0,type:"boolean"},created_at:{label:"Created"},updated_at:{label:"Last updated"},fields:{arrayItems(n){const t=n.inputAttributes||{};return delete n.inputAttributes,{type:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",newElementButtonLabelClasses:"kong-form-new-element-button-label",inputAttributes:{class:"form-control",style:{minWidth:"200px"},...t},removeElementButtonLabel:"remove",styleClasses:"kong-form-field-wrapper",inputType:"text",valueType:"array",valueArrayType:"string",...n}}}},zy={fields:[{group:{hint:"The arbitrary group name to associate to the consumer."}},{tags:bo}]},BB={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{group:{required:!0,type:"string",hint:"The arbitrary group name to associate to the consumer."}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},Wy={fields:[{username:{}},{password:{inputType:"password"}},{tags:bo}]},TB={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{username:{required:!0,type:"string",unique:!0}},{password:{type:"string",required:!0,encrypted:!0}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},Yy=e.defineComponent({name:"KeyAuthIdentityRealmsBase",__name:"Base",props:e.mergeModels({realms:{}},{modelValue:{default:[{scope:"cp",id:null,region:null}]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=n,r=e.useModel(n,"modelValue"),{i18n:o}=st.useI18n(),{t:i}=o,a={value:"current-cp",label:i("custom_field.key_auth_identity_realms.cp_label"),group:i("custom_field.key_auth_identity_realms.cp_group_label")},s=e.inject(Ze.FORMS_CONFIG),{axiosInstance:c}=Ie.useAxios(s==null?void 0:s.axiosRequestConfig),l=()=>{if((s==null?void 0:s.app)==="konnect"){const g=/\b(us|eu|au|me|in|sg)\b/.exec((s==null?void 0:s.apiBaseUrl)||"");if(g)return{region:g[1]}}return{}},u=e.ref(!0),p=e.ref([a]),d=async()=>{if((s==null?void 0:s.app)==="konnect")try{u.value=!0;let g=`${s==null?void 0:s.apiBaseUrl}/v1/realms`;const y=[];do{const b=await c.get(g);b&&b.data&&b.data.data&&y.push(...b.data.data.map(_=>({value:_.id,label:_.name,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))),g=b.data.meta.next?`${s==null?void 0:s.apiBaseUrl}${b.data.meta.next}`:null}while(g);p.value=[a,...y]}catch(g){console.error("Failed to fetch Konnect realms",g)}finally{u.value=!1}},f=e.computed(()=>r.value.map(g=>g.id||"current-cp")),m=g=>{const y=g.includes("current-cp")?[{scope:"cp",id:null,region:null}]:[],b=r.value.filter(({scope:E})=>E!=="cp").map(({id:E})=>E),_=g.filter(E=>E!=="current-cp"),N=(b.length!==_.length||b.some(E=>!_.includes(E))?_.filter(E=>!b.includes(E)):_).map(E=>({...l(),scope:"realm",id:E}));r.value=[...y,...N]};return e.onMounted(()=>{t.realms===void 0&&d()}),e.watch(()=>t.realms,g=>{g&&(p.value=[a,...g.map(y=>({...y,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))],u.value=!1)},{immediate:!0}),(g,y)=>{const b=e.resolveComponent("KMultiselect");return e.openBlock(),e.createBlock(b,{items:p.value,loading:u.value,"model-value":f.value,"onUpdate:modelValue":m},null,8,["items","loading","model-value"])}}}),OB={class:"field-wrapper"},PB=Me(e.defineComponent({__name:"VfgAdapter",props:{disabled:{type:Boolean},formOptions:{},model:{},schema:{},vfg:{},errors:{},hint:{}},emits:["modelUpdated"],setup(n,{expose:t,emit:r}){const o=n,i=r,{clearValidationErrors:a,value:s}=Ze.composables.useAbstractFields({model:e.toRef(()=>o.model),schema:o.schema,formOptions:o.formOptions,emitModelUpdated:c=>{i("modelUpdated",c.value,c.model)}});return t({clearValidationErrors:a}),(c,l)=>(e.openBlock(),e.createElementBlock("div",OB,[e.createVNode(Yy,{modelValue:e.unref(s),"onUpdate:modelValue":l[0]||(l[0]=u=>e.isRef(s)?s.value=u:null)},null,8,["modelValue"])]))}}),[["__scopeId","data-v-269e85ed"]]),Jy={fields:[{key:{submitWhenNull:!1,hint:`You can optionally set your own unique key to authenticate the
3
+ will extend the wait time by about 12 minutes, continuously adjusting as new requests are made.`}}}},custom_plugin_form:{step1:{title:"Custom plugin type",types:{installed:{label:"Installed custom plugin",description:"Install and manage plugins with full control over deployment and runtime. Requires restarting data planes."},streamed:{label:"Streamed custom plugin",description:"Deploy and update plugins on running data planes without requiring gateway access."},cloned:{label:"Cloned plugin",description:"Duplicate an existing plugin to run multiple instances within a single request."}},compare_trigger:"Compare deployment options",compare_table:{columns:{installed:"Installed custom plugin",streamed:"Streamed custom plugin",cloned:"Cloned plugin"},rows:{main_use_case:{header:"Main use case",installed:"Extend Kong functionality with custom plugins and control who can modify and roll out changes.",streamed:"Extend Kong functionality with plugins without requiring sysadmin access to data plane instances.",cloned:"Modify an existing plugin to run multiple instances with different names or priorities."},file_supplied:{header:"File supplied",installed:{handler:"handler.lua",schema:"schema.lua",additional:"Any additional files or libraries needed"},streamed:{handler:"handler.lua",schema:"schema.lua"}},how_installed:{header:"How it's installed",installed:"Install directly on the data plane",streamed:"Through gateway configuration changes",cloned:"Through gateway configuration changes"},sandboxing:{header:"Sandboxing",streamed:"Follows the standard sandboxing settings. {link}",streamed_link:"Link to docs",cloned:"Inherit the same sandboxing as the original plugins"},data_plane_reload:{header:"Data plane reload"}}}},step2_files:{title:"Custom plugin files",schema_file:{label:"Upload schema file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Only Lua based schemas are supported by Konnect. Other plugin modules can be in any language as desired. Learn more"},handler_file:{label:"Upload handler file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Upload plugin handler to the data plane."},plugin_modules:{label:"Plugin modules",alert:"Upload all plugin modules to the data plane: schema.lua, handler.lua"}},step2_clone:{title:"Clone plugin",select_plugin:{label:"Select a plugin",placeholder:"Type to search"}},step3:{title:"General information",description:"Enter a custom name for this custom plugin",name:{label:"Name",placeholder:"Enter a unique name",help:"The name must be identical to the name of the plugin in the schema file."},alias_name:{label:"Alias name",placeholder:"Enter a unique name",help:"Format: ^[a-z][a-z0-9-]*[a-z0-9]$. The name must be unique enough to avoid future conflicts with bundled plugins."},priority:{label:"Priority",tooltip:"Set the execution priority for this cloned plugin",help:{text:"Optional. Use a number to set the absolute execution priority. If priority isn't set, plugins run in alphabetical order. {link} in the docs.",link:"Learn more"}}},errors:{file_read_error:"Failed to read file content. Please try again.",file_too_large:"File size exceeds the maximum limit of 1 MB.",plugin_not_found:"The selected plugin could not be found. Please refresh the list and try again.",no_supported_types:"No supported custom plugin types are available in this context.",unsupported_plugin_type:"Unsupported plugin type {type}."}}};function Je(){const n=jt.createI18n("en-us",Yt);return{i18n:n,i18nT:jt.i18nTComponent(n)}}const JC=["undo","redo","duplicate","cut","copy","paste"],Th=()=>{};function XC(n){const t=n;return t?!!t.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'):!1}function ZC(n){if(!(n.metaKey||n.ctrlKey))return;switch(n.key.toLowerCase()){case"z":return n.shiftKey?"redo":"undo";case"y":return"redo";case"d":return"duplicate";case"x":return"cut";case"c":return"copy";case"v":return"paste"}}const QC=Tt.createSharedComposable(()=>{const n=new Set;Tt.useEventListener("keydown",r=>{if(XC(r.target))return;const o=ZC(r);if(o)for(const i of n){if(!e.toValue(i.enabled))continue;const a=i[o];if(a){if(r.defaultPrevented){e.warn(`[useHotkeys] event for "${o}" was already defaultPrevented. Hotkey ignored.`);return}r.preventDefault(),a();return}}},{passive:!1});function t(r){if(!JC.some(i=>typeof r[i]=="function"))return Th;const o={enabled:r.enabled??!0,...r};return n.add(o),()=>n.delete(o)}return{subscribe:t}});function Oh(n={}){if(typeof window>"u")return Th;const t=QC().subscribe(n);return e.onScopeDispose(t),t}const e1="#ecfcff",t1="#f1f0ff",n1="#52596e",r1="#e0e4ea",o1="#007d60",i1="#fffce0",a1="#6c7489",s1="#0044f4",l1="#5f9aff",od="#000933",Ph="#d60027",c1="#00abd2",Vh="#6f28ff",$h="#afb7c5",sr="#6c7489",u1="#0044f4",d1="#eefaff",Rh="#007d60",f1="#ecfffb",p1="#995c00",m1="#306fff",nl="12px",zn="16px",fa="20px",id="24px",h1="2px",Lh="8px",g1="32px",Dh=44,y1=220,Mh=366,_1=1e3,b1=Dh+parseFloat(Lh),rl=1,w1=0,k1=1,C1=2,E1=3,Wo=parseInt(g1,10),pa="application/x-datakit+json",ol={delete:["Delete"],undo:["Mod","Z"],redo:{mac:["Mod","Shift","Z"],windows:["Mod","Y"],linux:["Mod","Shift","Z"]},copy:["Mod","C"],paste:["Mod","V"],duplicate:["Mod","D"]},zr={padding:80,gaps:{nodes:60,edges:80,ranks:60}},N1=1600,S1=1.2,x1=0,A1=200,jh=Symbol("confirm-modal");var Fh=typeof global=="object"&&global&&global.Object===Object&&global,v1=typeof self=="object"&&self&&self.Object===Object&&self,lr=Fh||v1||Function("return this")(),Pn=lr.Symbol,Uh=Object.prototype,I1=Uh.hasOwnProperty,B1=Uh.toString,ma=Pn?Pn.toStringTag:void 0;function T1(n){var t=I1.call(n,ma),r=n[ma];try{n[ma]=void 0;var o=!0}catch{}var i=B1.call(n);return o&&(t?n[ma]=r:delete n[ma]),i}var O1=Object.prototype,P1=O1.toString;function V1(n){return P1.call(n)}var $1="[object Null]",R1="[object Undefined]",Kh=Pn?Pn.toStringTag:void 0;function co(n){return n==null?n===void 0?R1:$1:Kh&&Kh in Object(n)?T1(n):V1(n)}function cr(n){return n!=null&&typeof n=="object"}var L1="[object Symbol]";function ad(n){return typeof n=="symbol"||cr(n)&&co(n)==L1}function sd(n,t){for(var r=-1,o=n==null?0:n.length,i=Array(o);++r<o;)i[r]=t(n[r],r,n);return i}var Wn=Array.isArray,qh=Pn?Pn.prototype:void 0,Gh=qh?qh.toString:void 0;function Hh(n){if(typeof n=="string")return n;if(Wn(n))return sd(n,Hh)+"";if(ad(n))return Gh?Gh.call(n):"";var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function uo(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function zh(n){return n}var D1="[object AsyncFunction]",M1="[object Function]",j1="[object GeneratorFunction]",F1="[object Proxy]";function il(n){if(!uo(n))return!1;var t=co(n);return t==M1||t==j1||t==D1||t==F1}var ld=lr["__core-js_shared__"],Wh=function(){var n=/[^.]+$/.exec(ld&&ld.keys&&ld.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function U1(n){return!!Wh&&Wh in n}var K1=Function.prototype,q1=K1.toString;function fo(n){if(n!=null){try{return q1.call(n)}catch{}try{return n+""}catch{}}return""}var G1=/[\\^$.*+?()[\]{}|]/g,H1=/^\[object .+?Constructor\]$/,z1=Function.prototype,W1=Object.prototype,Y1=z1.toString,J1=W1.hasOwnProperty,X1=RegExp("^"+Y1.call(J1).replace(G1,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Z1(n){if(!uo(n)||U1(n))return!1;var t=il(n)?X1:H1;return t.test(fo(n))}function Q1(n,t){return n==null?void 0:n[t]}function po(n,t){var r=Q1(n,t);return Z1(r)?r:void 0}var cd=po(lr,"WeakMap"),Yh=Object.create,eE=function(){function n(){}return function(t){if(!uo(t))return{};if(Yh)return Yh(t);n.prototype=t;var r=new n;return n.prototype=void 0,r}}();function tE(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function nE(n,t){var r=-1,o=n.length;for(t||(t=Array(o));++r<o;)t[r]=n[r];return t}var rE=800,oE=16,iE=Date.now;function aE(n){var t=0,r=0;return function(){var o=iE(),i=oE-(o-r);if(r=o,i>0){if(++t>=rE)return arguments[0]}else t=0;return n.apply(void 0,arguments)}}function sE(n){return function(){return n}}var al=function(){try{var n=po(Object,"defineProperty");return n({},"",{}),n}catch{}}(),lE=al?function(n,t){return al(n,"toString",{configurable:!0,enumerable:!1,value:sE(t),writable:!0})}:zh,Jh=aE(lE);function cE(n,t){for(var r=-1,o=n==null?0:n.length;++r<o&&t(n[r],r,n)!==!1;);return n}function uE(n,t,r,o){for(var i=n.length,a=r+-1;++a<i;)if(t(n[a],a,n))return a;return-1}function dE(n){return n!==n}function fE(n,t,r){for(var o=r-1,i=n.length;++o<i;)if(n[o]===t)return o;return-1}function pE(n,t,r){return t===t?fE(n,t,r):uE(n,dE,r)}function mE(n,t){var r=n==null?0:n.length;return!!r&&pE(n,t,0)>-1}var hE=9007199254740991,gE=/^(?:0|[1-9]\d*)$/;function ud(n,t){var r=typeof n;return t=t??hE,!!t&&(r=="number"||r!="symbol"&&gE.test(n))&&n>-1&&n%1==0&&n<t}function Xh(n,t,r){t=="__proto__"&&al?al(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function dd(n,t){return n===t||n!==n&&t!==t}var yE=Object.prototype,_E=yE.hasOwnProperty;function fd(n,t,r){var o=n[t];(!(_E.call(n,t)&&dd(o,r))||r===void 0&&!(t in n))&&Xh(n,t,r)}function ha(n,t,r,o){var i=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var c=t[a],l=void 0;l===void 0&&(l=n[c]),i?Xh(r,c,l):fd(r,c,l)}return r}var Zh=Math.max;function Qh(n,t,r){return t=Zh(t===void 0?n.length-1:t,0),function(){for(var o=arguments,i=-1,a=Zh(o.length-t,0),s=Array(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=Array(t+1);++i<t;)c[i]=o[i];return c[t]=r(s),tE(n,this,c)}}function bE(n,t){return Jh(Qh(n,t,zh),n+"")}var wE=9007199254740991;function pd(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=wE}function sl(n){return n!=null&&pd(n.length)&&!il(n)}var kE=Object.prototype;function ll(n){var t=n&&n.constructor,r=typeof t=="function"&&t.prototype||kE;return n===r}function CE(n,t){for(var r=-1,o=Array(n);++r<n;)o[r]=t(r);return o}var EE="[object Arguments]";function eg(n){return cr(n)&&co(n)==EE}var tg=Object.prototype,NE=tg.hasOwnProperty,SE=tg.propertyIsEnumerable,cl=eg(function(){return arguments}())?eg:function(n){return cr(n)&&NE.call(n,"callee")&&!SE.call(n,"callee")};function xE(){return!1}var ng=typeof De=="object"&&De&&!De.nodeType&&De,rg=ng&&typeof module=="object"&&module&&!module.nodeType&&module,AE=rg&&rg.exports===ng,og=AE?lr.Buffer:void 0,vE=og?og.isBuffer:void 0,ga=vE||xE,IE="[object Arguments]",BE="[object Array]",TE="[object Boolean]",OE="[object Date]",PE="[object Error]",VE="[object Function]",$E="[object Map]",RE="[object Number]",LE="[object Object]",DE="[object RegExp]",ME="[object Set]",jE="[object String]",FE="[object WeakMap]",UE="[object ArrayBuffer]",KE="[object DataView]",qE="[object Float32Array]",GE="[object Float64Array]",HE="[object Int8Array]",zE="[object Int16Array]",WE="[object Int32Array]",YE="[object Uint8Array]",JE="[object Uint8ClampedArray]",XE="[object Uint16Array]",ZE="[object Uint32Array]",vt={};vt[qE]=vt[GE]=vt[HE]=vt[zE]=vt[WE]=vt[YE]=vt[JE]=vt[XE]=vt[ZE]=!0,vt[IE]=vt[BE]=vt[UE]=vt[TE]=vt[KE]=vt[OE]=vt[PE]=vt[VE]=vt[$E]=vt[RE]=vt[LE]=vt[DE]=vt[ME]=vt[jE]=vt[FE]=!1;function QE(n){return cr(n)&&pd(n.length)&&!!vt[co(n)]}function md(n){return function(t){return n(t)}}var ig=typeof De=="object"&&De&&!De.nodeType&&De,ya=ig&&typeof module=="object"&&module&&!module.nodeType&&module,eN=ya&&ya.exports===ig,hd=eN&&Fh.process,Yo=function(){try{var n=ya&&ya.require&&ya.require("util").types;return n||hd&&hd.binding&&hd.binding("util")}catch{}}(),ag=Yo&&Yo.isTypedArray,gd=ag?md(ag):QE,tN=Object.prototype,nN=tN.hasOwnProperty;function sg(n,t){var r=Wn(n),o=!r&&cl(n),i=!r&&!o&&ga(n),a=!r&&!o&&!i&&gd(n),s=r||o||i||a,c=s?CE(n.length,String):[],l=c.length;for(var u in n)(t||nN.call(n,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ud(u,l)))&&c.push(u);return c}function lg(n,t){return function(r){return n(t(r))}}var rN=lg(Object.keys,Object),oN=Object.prototype,iN=oN.hasOwnProperty;function cg(n){if(!ll(n))return rN(n);var t=[];for(var r in Object(n))iN.call(n,r)&&r!="constructor"&&t.push(r);return t}function yd(n){return sl(n)?sg(n):cg(n)}function aN(n){var t=[];if(n!=null)for(var r in Object(n))t.push(r);return t}var sN=Object.prototype,lN=sN.hasOwnProperty;function cN(n){if(!uo(n))return aN(n);var t=ll(n),r=[];for(var o in n)o=="constructor"&&(t||!lN.call(n,o))||r.push(o);return r}function _d(n){return sl(n)?sg(n,!0):cN(n)}var uN=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dN=/^\w*$/;function fN(n,t){if(Wn(n))return!1;var r=typeof n;return r=="number"||r=="symbol"||r=="boolean"||n==null||ad(n)?!0:dN.test(n)||!uN.test(n)||t!=null&&n in Object(t)}var _a=po(Object,"create");function pN(){this.__data__=_a?_a(null):{},this.size=0}function mN(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}var hN="__lodash_hash_undefined__",gN=Object.prototype,yN=gN.hasOwnProperty;function _N(n){var t=this.__data__;if(_a){var r=t[n];return r===hN?void 0:r}return yN.call(t,n)?t[n]:void 0}var bN=Object.prototype,wN=bN.hasOwnProperty;function kN(n){var t=this.__data__;return _a?t[n]!==void 0:wN.call(t,n)}var CN="__lodash_hash_undefined__";function EN(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=_a&&t===void 0?CN:t,this}function mo(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}mo.prototype.clear=pN,mo.prototype.delete=mN,mo.prototype.get=_N,mo.prototype.has=kN,mo.prototype.set=EN;function NN(){this.__data__=[],this.size=0}function ul(n,t){for(var r=n.length;r--;)if(dd(n[r][0],t))return r;return-1}var SN=Array.prototype,xN=SN.splice;function AN(n){var t=this.__data__,r=ul(t,n);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():xN.call(t,r,1),--this.size,!0}function vN(n){var t=this.__data__,r=ul(t,n);return r<0?void 0:t[r][1]}function IN(n){return ul(this.__data__,n)>-1}function BN(n,t){var r=this.__data__,o=ul(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}function Sr(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}Sr.prototype.clear=NN,Sr.prototype.delete=AN,Sr.prototype.get=vN,Sr.prototype.has=IN,Sr.prototype.set=BN;var ba=po(lr,"Map");function TN(){this.size=0,this.__data__={hash:new mo,map:new(ba||Sr),string:new mo}}function ON(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}function dl(n,t){var r=n.__data__;return ON(t)?r[typeof t=="string"?"string":"hash"]:r.map}function PN(n){var t=dl(this,n).delete(n);return this.size-=t?1:0,t}function VN(n){return dl(this,n).get(n)}function $N(n){return dl(this,n).has(n)}function RN(n,t){var r=dl(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this}function xr(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}xr.prototype.clear=TN,xr.prototype.delete=PN,xr.prototype.get=VN,xr.prototype.has=$N,xr.prototype.set=RN;var LN="Expected a function";function bd(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new TypeError(LN);var r=function(){var o=arguments,i=t?t.apply(this,o):o[0],a=r.cache;if(a.has(i))return a.get(i);var s=n.apply(this,o);return r.cache=a.set(i,s)||a,s};return r.cache=new(bd.Cache||xr),r}bd.Cache=xr;var DN=500;function MN(n){var t=bd(n,function(o){return r.size===DN&&r.clear(),o}),r=t.cache;return t}var jN=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,FN=/\\(\\)?/g,UN=MN(function(n){var t=[];return n.charCodeAt(0)===46&&t.push(""),n.replace(jN,function(r,o,i,a){t.push(i?a.replace(FN,"$1"):o||r)}),t});function ho(n){return n==null?"":Hh(n)}function Jo(n,t){return Wn(n)?n:fN(n,t)?[n]:UN(ho(n))}function wa(n){if(typeof n=="string"||ad(n))return n;var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function wd(n,t){t=Jo(t,n);for(var r=0,o=t.length;n!=null&&r<o;)n=n[wa(t[r++])];return r&&r==o?n:void 0}function ka(n,t,r){var o=n==null?void 0:wd(n,t);return o===void 0?r:o}function kd(n,t){for(var r=-1,o=t.length,i=n.length;++r<o;)n[i+r]=t[r];return n}var ug=Pn?Pn.isConcatSpreadable:void 0;function KN(n){return Wn(n)||cl(n)||!!(ug&&n&&n[ug])}function qN(n,t,r,o,i){var a=-1,s=n.length;for(r||(r=KN),i||(i=[]);++a<s;){var c=n[a];r(c)?kd(i,c):i[i.length]=c}return i}function GN(n){var t=n==null?0:n.length;return t?qN(n):[]}function dg(n){return Jh(Qh(n,void 0,GN),n+"")}var Cd=lg(Object.getPrototypeOf,Object),HN="[object Object]",zN=Function.prototype,WN=Object.prototype,fg=zN.toString,YN=WN.hasOwnProperty,JN=fg.call(Object);function XN(n){if(!cr(n)||co(n)!=HN)return!1;var t=Cd(n);if(t===null)return!0;var r=YN.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&fg.call(r)==JN}function pg(n,t,r){var o=-1,i=n.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++o<i;)a[o]=n[o+t];return a}function ZN(n,t,r){var o=n.length;return r=r===void 0?o:r,!t&&r>=o?n:pg(n,t,r)}var QN="\\ud800-\\udfff",eS="\\u0300-\\u036f",tS="\\ufe20-\\ufe2f",nS="\\u20d0-\\u20ff",rS=eS+tS+nS,oS="\\ufe0e\\ufe0f",iS="\\u200d",aS=RegExp("["+iS+QN+rS+oS+"]");function mg(n){return aS.test(n)}function sS(n){return n.split("")}var hg="\\ud800-\\udfff",lS="\\u0300-\\u036f",cS="\\ufe20-\\ufe2f",uS="\\u20d0-\\u20ff",dS=lS+cS+uS,fS="\\ufe0e\\ufe0f",pS="["+hg+"]",Ed="["+dS+"]",Nd="\\ud83c[\\udffb-\\udfff]",mS="(?:"+Ed+"|"+Nd+")",gg="[^"+hg+"]",yg="(?:\\ud83c[\\udde6-\\uddff]){2}",_g="[\\ud800-\\udbff][\\udc00-\\udfff]",hS="\\u200d",bg=mS+"?",wg="["+fS+"]?",gS="(?:"+hS+"(?:"+[gg,yg,_g].join("|")+")"+wg+bg+")*",yS=wg+bg+gS,_S="(?:"+[gg+Ed+"?",Ed,yg,_g,pS].join("|")+")",bS=RegExp(Nd+"(?="+Nd+")|"+_S+yS,"g");function wS(n){return n.match(bS)||[]}function kS(n){return mg(n)?wS(n):sS(n)}function CS(n){return function(t){t=ho(t);var r=mg(t)?kS(t):void 0,o=r?r[0]:t.charAt(0),i=r?ZN(r,1).join(""):t.slice(1);return o[n]()+i}}var kg=CS("toUpperCase");function ES(n){return kg(ho(n).toLowerCase())}function NS(n,t,r,o){for(var i=-1,a=n==null?0:n.length;++i<a;)r=t(r,n[i],i,n);return r}function Cg(n){return function(t){return n==null?void 0:n[t]}}var SS={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},xS=Cg(SS),AS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vS="\\u0300-\\u036f",IS="\\ufe20-\\ufe2f",BS="\\u20d0-\\u20ff",TS=vS+IS+BS,OS="["+TS+"]",PS=RegExp(OS,"g");function VS(n){return n=ho(n),n&&n.replace(AS,xS).replace(PS,"")}var $S=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function RS(n){return n.match($S)||[]}var LS=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function DS(n){return LS.test(n)}var Eg="\\ud800-\\udfff",MS="\\u0300-\\u036f",jS="\\ufe20-\\ufe2f",FS="\\u20d0-\\u20ff",US=MS+jS+FS,Ng="\\u2700-\\u27bf",Sg="a-z\\xdf-\\xf6\\xf8-\\xff",KS="\\xac\\xb1\\xd7\\xf7",qS="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",GS="\\u2000-\\u206f",HS=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xg="A-Z\\xc0-\\xd6\\xd8-\\xde",zS="\\ufe0e\\ufe0f",Ag=KS+qS+GS+HS,vg="['’]",Ig="["+Ag+"]",WS="["+US+"]",Bg="\\d+",YS="["+Ng+"]",Tg="["+Sg+"]",Og="[^"+Eg+Ag+Bg+Ng+Sg+xg+"]",JS="\\ud83c[\\udffb-\\udfff]",XS="(?:"+WS+"|"+JS+")",ZS="[^"+Eg+"]",Pg="(?:\\ud83c[\\udde6-\\uddff]){2}",Vg="[\\ud800-\\udbff][\\udc00-\\udfff]",Xo="["+xg+"]",QS="\\u200d",$g="(?:"+Tg+"|"+Og+")",ex="(?:"+Xo+"|"+Og+")",Rg="(?:"+vg+"(?:d|ll|m|re|s|t|ve))?",Lg="(?:"+vg+"(?:D|LL|M|RE|S|T|VE))?",Dg=XS+"?",Mg="["+zS+"]?",tx="(?:"+QS+"(?:"+[ZS,Pg,Vg].join("|")+")"+Mg+Dg+")*",nx="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rx="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ox=Mg+Dg+tx,ix="(?:"+[YS,Pg,Vg].join("|")+")"+ox,ax=RegExp([Xo+"?"+Tg+"+"+Rg+"(?="+[Ig,Xo,"$"].join("|")+")",ex+"+"+Lg+"(?="+[Ig,Xo+$g,"$"].join("|")+")",Xo+"?"+$g+"+"+Rg,Xo+"+"+Lg,rx,nx,Bg,ix].join("|"),"g");function sx(n){return n.match(ax)||[]}function lx(n,t,r){return n=ho(n),t=t,t===void 0?DS(n)?sx(n):RS(n):n.match(t)||[]}var cx="['’]",ux=RegExp(cx,"g");function dx(n){return function(t){return NS(lx(VS(t).replace(ux,"")),n,"")}}var fx=dx(function(n,t,r){return t=t.toLowerCase(),n+(r?ES(t):t)});function px(){this.__data__=new Sr,this.size=0}function mx(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function hx(n){return this.__data__.get(n)}function gx(n){return this.__data__.has(n)}var yx=200;function _x(n,t){var r=this.__data__;if(r instanceof Sr){var o=r.__data__;if(!ba||o.length<yx-1)return o.push([n,t]),this.size=++r.size,this;r=this.__data__=new xr(o)}return r.set(n,t),this.size=r.size,this}function Ar(n){var t=this.__data__=new Sr(n);this.size=t.size}Ar.prototype.clear=px,Ar.prototype.delete=mx,Ar.prototype.get=hx,Ar.prototype.has=gx,Ar.prototype.set=_x;function bx(n,t){return n&&ha(t,yd(t),n)}function wx(n,t){return n&&ha(t,_d(t),n)}var jg=typeof De=="object"&&De&&!De.nodeType&&De,Fg=jg&&typeof module=="object"&&module&&!module.nodeType&&module,kx=Fg&&Fg.exports===jg,Ug=kx?lr.Buffer:void 0,Kg=Ug?Ug.allocUnsafe:void 0;function Cx(n,t){if(t)return n.slice();var r=n.length,o=Kg?Kg(r):new n.constructor(r);return n.copy(o),o}function Ex(n,t){for(var r=-1,o=n==null?0:n.length,i=0,a=[];++r<o;){var s=n[r];t(s,r,n)&&(a[i++]=s)}return a}function qg(){return[]}var Nx=Object.prototype,Sx=Nx.propertyIsEnumerable,Gg=Object.getOwnPropertySymbols,Sd=Gg?function(n){return n==null?[]:(n=Object(n),Ex(Gg(n),function(t){return Sx.call(n,t)}))}:qg;function xx(n,t){return ha(n,Sd(n),t)}var Ax=Object.getOwnPropertySymbols,Hg=Ax?function(n){for(var t=[];n;)kd(t,Sd(n)),n=Cd(n);return t}:qg;function vx(n,t){return ha(n,Hg(n),t)}function zg(n,t,r){var o=t(n);return Wn(n)?o:kd(o,r(n))}function xd(n){return zg(n,yd,Sd)}function Wg(n){return zg(n,_d,Hg)}var Ad=po(lr,"DataView"),vd=po(lr,"Promise"),Id=po(lr,"Set"),Yg="[object Map]",Ix="[object Object]",Jg="[object Promise]",Xg="[object Set]",Zg="[object WeakMap]",Qg="[object DataView]",Bx=fo(Ad),Tx=fo(ba),Ox=fo(vd),Px=fo(Id),Vx=fo(cd),Vn=co;(Ad&&Vn(new Ad(new ArrayBuffer(1)))!=Qg||ba&&Vn(new ba)!=Yg||vd&&Vn(vd.resolve())!=Jg||Id&&Vn(new Id)!=Xg||cd&&Vn(new cd)!=Zg)&&(Vn=function(n){var t=co(n),r=t==Ix?n.constructor:void 0,o=r?fo(r):"";if(o)switch(o){case Bx:return Qg;case Tx:return Yg;case Ox:return Jg;case Px:return Xg;case Vx:return Zg}return t});var $x=Object.prototype,Rx=$x.hasOwnProperty;function Lx(n){var t=n.length,r=new n.constructor(t);return t&&typeof n[0]=="string"&&Rx.call(n,"index")&&(r.index=n.index,r.input=n.input),r}var fl=lr.Uint8Array;function Bd(n){var t=new n.constructor(n.byteLength);return new fl(t).set(new fl(n)),t}function Dx(n,t){var r=t?Bd(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}var Mx=/\w*$/;function jx(n){var t=new n.constructor(n.source,Mx.exec(n));return t.lastIndex=n.lastIndex,t}var ey=Pn?Pn.prototype:void 0,ty=ey?ey.valueOf:void 0;function Fx(n){return ty?Object(ty.call(n)):{}}function Ux(n,t){var r=t?Bd(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}var Kx="[object Boolean]",qx="[object Date]",Gx="[object Map]",Hx="[object Number]",zx="[object RegExp]",Wx="[object Set]",Yx="[object String]",Jx="[object Symbol]",Xx="[object ArrayBuffer]",Zx="[object DataView]",Qx="[object Float32Array]",eA="[object Float64Array]",tA="[object Int8Array]",nA="[object Int16Array]",rA="[object Int32Array]",oA="[object Uint8Array]",iA="[object Uint8ClampedArray]",aA="[object Uint16Array]",sA="[object Uint32Array]";function lA(n,t,r){var o=n.constructor;switch(t){case Xx:return Bd(n);case Kx:case qx:return new o(+n);case Zx:return Dx(n,r);case Qx:case eA:case tA:case nA:case rA:case oA:case iA:case aA:case sA:return Ux(n,r);case Gx:return new o;case Hx:case Yx:return new o(n);case zx:return jx(n);case Wx:return new o;case Jx:return Fx(n)}}function cA(n){return typeof n.constructor=="function"&&!ll(n)?eE(Cd(n)):{}}var uA="[object Map]";function dA(n){return cr(n)&&Vn(n)==uA}var ny=Yo&&Yo.isMap,fA=ny?md(ny):dA,pA="[object Set]";function mA(n){return cr(n)&&Vn(n)==pA}var ry=Yo&&Yo.isSet,hA=ry?md(ry):mA,gA=1,yA=2,_A=4,oy="[object Arguments]",bA="[object Array]",wA="[object Boolean]",kA="[object Date]",CA="[object Error]",iy="[object Function]",EA="[object GeneratorFunction]",NA="[object Map]",SA="[object Number]",ay="[object Object]",xA="[object RegExp]",AA="[object Set]",vA="[object String]",IA="[object Symbol]",BA="[object WeakMap]",TA="[object ArrayBuffer]",OA="[object DataView]",PA="[object Float32Array]",VA="[object Float64Array]",$A="[object Int8Array]",RA="[object Int16Array]",LA="[object Int32Array]",DA="[object Uint8Array]",MA="[object Uint8ClampedArray]",jA="[object Uint16Array]",FA="[object Uint32Array]",St={};St[oy]=St[bA]=St[TA]=St[OA]=St[wA]=St[kA]=St[PA]=St[VA]=St[$A]=St[RA]=St[LA]=St[NA]=St[SA]=St[ay]=St[xA]=St[AA]=St[vA]=St[IA]=St[DA]=St[MA]=St[jA]=St[FA]=!0,St[CA]=St[iy]=St[BA]=!1;function Ca(n,t,r,o,i,a){var s,c=t&gA,l=t&yA,u=t&_A;if(r&&(s=i?r(n,o,i,a):r(n)),s!==void 0)return s;if(!uo(n))return n;var p=Wn(n);if(p){if(s=Lx(n),!c)return nE(n,s)}else{var d=Vn(n),f=d==iy||d==EA;if(ga(n))return Cx(n,c);if(d==ay||d==oy||f&&!i){if(s=l||f?{}:cA(n),!c)return l?vx(n,wx(s,n)):xx(n,bx(s,n))}else{if(!St[d])return i?n:{};s=lA(n,d,c)}}a||(a=new Ar);var m=a.get(n);if(m)return m;a.set(n,s),hA(n)?n.forEach(function(b){s.add(Ca(b,t,r,b,n,a))}):fA(n)&&n.forEach(function(b,_){s.set(_,Ca(b,t,r,_,n,a))});var g=u?l?Wg:xd:l?_d:yd,y=p?void 0:g(n);return cE(y||n,function(b,_){y&&(_=b,b=n[_]),fd(s,_,Ca(b,t,r,_,n,a))}),s}var UA=1,KA=4;function Ea(n){return Ca(n,UA|KA)}var qA="__lodash_hash_undefined__";function GA(n){return this.__data__.set(n,qA),this}function HA(n){return this.__data__.has(n)}function Na(n){var t=-1,r=n==null?0:n.length;for(this.__data__=new xr;++t<r;)this.add(n[t])}Na.prototype.add=Na.prototype.push=GA,Na.prototype.has=HA;function zA(n,t){for(var r=-1,o=n==null?0:n.length;++r<o;)if(t(n[r],r,n))return!0;return!1}function Td(n,t){return n.has(t)}var WA=1,YA=2;function sy(n,t,r,o,i,a){var s=r&WA,c=n.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=a.get(n),p=a.get(t);if(u&&p)return u==t&&p==n;var d=-1,f=!0,m=r&YA?new Na:void 0;for(a.set(n,t),a.set(t,n);++d<c;){var g=n[d],y=t[d];if(o)var b=s?o(y,g,d,t,n,a):o(g,y,d,n,t,a);if(b!==void 0){if(b)continue;f=!1;break}if(m){if(!zA(t,function(_,k){if(!Td(m,k)&&(g===_||i(g,_,r,o,a)))return m.push(k)})){f=!1;break}}else if(!(g===y||i(g,y,r,o,a))){f=!1;break}}return a.delete(n),a.delete(t),f}function JA(n){var t=-1,r=Array(n.size);return n.forEach(function(o,i){r[++t]=[i,o]}),r}function XA(n){var t=-1,r=Array(n.size);return n.forEach(function(o){r[++t]=o}),r}var ZA=1,QA=2,ev="[object Boolean]",tv="[object Date]",nv="[object Error]",rv="[object Map]",ov="[object Number]",iv="[object RegExp]",av="[object Set]",sv="[object String]",lv="[object Symbol]",cv="[object ArrayBuffer]",uv="[object DataView]",ly=Pn?Pn.prototype:void 0,Od=ly?ly.valueOf:void 0;function dv(n,t,r,o,i,a,s){switch(r){case uv:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case cv:return!(n.byteLength!=t.byteLength||!a(new fl(n),new fl(t)));case ev:case tv:case ov:return dd(+n,+t);case nv:return n.name==t.name&&n.message==t.message;case iv:case sv:return n==t+"";case rv:var c=JA;case av:var l=o&ZA;if(c||(c=XA),n.size!=t.size&&!l)return!1;var u=s.get(n);if(u)return u==t;o|=QA,s.set(n,t);var p=sy(c(n),c(t),o,i,a,s);return s.delete(n),p;case lv:if(Od)return Od.call(n)==Od.call(t)}return!1}var fv=1,pv=Object.prototype,mv=pv.hasOwnProperty;function hv(n,t,r,o,i,a){var s=r&fv,c=xd(n),l=c.length,u=xd(t),p=u.length;if(l!=p&&!s)return!1;for(var d=l;d--;){var f=c[d];if(!(s?f in t:mv.call(t,f)))return!1}var m=a.get(n),g=a.get(t);if(m&&g)return m==t&&g==n;var y=!0;a.set(n,t),a.set(t,n);for(var b=s;++d<l;){f=c[d];var _=n[f],k=t[f];if(o)var C=s?o(k,_,f,t,n,a):o(_,k,f,n,t,a);if(!(C===void 0?_===k||i(_,k,r,o,a):C)){y=!1;break}b||(b=f=="constructor")}if(y&&!b){var N=n.constructor,E=t.constructor;N!=E&&"constructor"in n&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof E=="function"&&E instanceof E)&&(y=!1)}return a.delete(n),a.delete(t),y}var gv=1,cy="[object Arguments]",uy="[object Array]",pl="[object Object]",yv=Object.prototype,dy=yv.hasOwnProperty;function _v(n,t,r,o,i,a){var s=Wn(n),c=Wn(t),l=s?uy:Vn(n),u=c?uy:Vn(t);l=l==cy?pl:l,u=u==cy?pl:u;var p=l==pl,d=u==pl,f=l==u;if(f&&ga(n)){if(!ga(t))return!1;s=!0,p=!1}if(f&&!p)return a||(a=new Ar),s||gd(n)?sy(n,t,r,o,i,a):dv(n,t,l,r,o,i,a);if(!(r&gv)){var m=p&&dy.call(n,"__wrapped__"),g=d&&dy.call(t,"__wrapped__");if(m||g){var y=m?n.value():n,b=g?t.value():t;return a||(a=new Ar),i(y,b,r,o,a)}}return f?(a||(a=new Ar),hv(n,t,r,o,i,a)):!1}function fy(n,t,r,o,i){return n===t?!0:n==null||t==null||!cr(n)&&!cr(t)?n!==n&&t!==t:_v(n,t,r,o,fy,i)}function bv(n,t){return n!=null&&t in Object(n)}function py(n,t,r){t=Jo(t,n);for(var o=-1,i=t.length,a=!1;++o<i;){var s=wa(t[o]);if(!(a=n!=null&&r(n,s)))break;n=n[s]}return a||++o!=i?a:(i=n==null?0:n.length,!!i&&pd(i)&&ud(s,i)&&(Wn(n)||cl(n)))}function wv(n,t){return n!=null&&py(n,t,bv)}function kv(n){return cr(n)&&sl(n)}function Cv(n){var t=n==null?0:n.length;return t?n[t-1]:void 0}var Ev={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Nv=Cg(Ev),my=/[&<>"']/g,Sv=RegExp(my.source);function xv(n){return n=ho(n),n&&Sv.test(n)?n.replace(my,Nv):n}var Av=Object.prototype,vv=Av.hasOwnProperty;function Iv(n,t){return n!=null&&vv.call(n,t)}function ml(n,t){return n!=null&&py(n,t,Iv)}var Bv=Math.min;function Tv(n,t,r){for(var o=mE,i=n[0].length,a=n.length,s=a,c=Array(a),l=1/0,u=[];s--;){var p=n[s];l=Bv(p.length,l),c[s]=i>=120&&p.length>=120?new Na(s&&p):void 0}p=n[0];var d=-1,f=c[0];e:for(;++d<i&&u.length<l;){var m=p[d],g=m;if(m=m!==0?m:0,!(f?Td(f,g):o(u,g))){for(s=a;--s;){var y=c[s];if(!(y?Td(y,g):o(n[s],g)))continue e}f&&f.push(g),u.push(m)}}return u}function Ov(n){return kv(n)?n:[]}var Pv=bE(function(n){var t=sd(n,Ov);return t.length&&t[0]===n[0]?Tv(t):[]});function Vv(n,t){return t.length<2?n:wd(n,pg(t,0,-1))}var $v="[object Map]",Rv="[object Set]",Lv=Object.prototype,Dv=Lv.hasOwnProperty;function hy(n){if(n==null)return!0;if(sl(n)&&(Wn(n)||typeof n=="string"||typeof n.splice=="function"||ga(n)||gd(n)||cl(n)))return!n.length;var t=Vn(n);if(t==$v||t==Rv)return!n.size;if(ll(n))return!cg(n).length;for(var r in n)if(Dv.call(n,r))return!1;return!0}function en(n,t){return fy(n,t)}var Mv=Object.prototype,jv=Mv.hasOwnProperty;function gy(n,t){t=Jo(t,n);var r=-1,o=t.length;if(!o)return!0;for(;++r<o;){var i=wa(t[r]);if(i==="__proto__"&&!jv.call(n,"__proto__")||(i==="constructor"||i==="prototype")&&r<o-1)return!1}var a=Vv(n,t);return a==null||delete a[wa(Cv(t))]}function Fv(n){return XN(n)?void 0:n}var Uv=1,Kv=2,qv=4,Wr=dg(function(n,t){var r={};if(n==null)return r;var o=!1;t=sd(t,function(a){return a=Jo(a,n),o||(o=a.length>1),a}),ha(n,Wg(n),r),o&&(r=Ca(r,Uv|Kv|qv,Fv));for(var i=t.length;i--;)gy(r,t[i]);return r});function yy(n,t,r,o){if(!uo(n))return n;t=Jo(t,n);for(var i=-1,a=t.length,s=a-1,c=n;c!=null&&++i<a;){var l=wa(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(i!=s){var p=c[l];u=void 0,u===void 0&&(u=uo(p)?p:ud(t[i+1])?[]:{})}fd(c,l,u),c=c[l]}return n}function Gv(n,t,r){for(var o=-1,i=t.length,a={};++o<i;){var s=t[o],c=wd(n,s);r(c,s)&&yy(a,Jo(s,n),c)}return a}function Hv(n,t){return Gv(n,t,function(r,o){return wv(n,o)})}var Pd=dg(function(n,t){return n==null?{}:Hv(n,t)});function _y(n,t,r){return n==null?n:yy(n,t,r)}var zv=0;function hl(n){var t=++zv;return ho(n)+t}function by(n,t){return n==null?!0:gy(n,t)}const Zo="{key}",go={"kong.client.consumer":{dataType:"object",writable:!1,readable:!0},"kong.client.consumer_groups":{dataType:"array",writable:!1,readable:!0},"kong.client.credential":{dataType:"object",writable:!1,readable:!0},"kong.client.get_identity_realm_source":{dataType:"object",writable:!1,readable:!0},"kong.client.forwarded_ip":{dataType:"string",writable:!1,readable:!0},"kong.client.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.client.ip":{dataType:"string",writable:!1,readable:!0},"kong.client.port":{dataType:"number",writable:!1,readable:!0},"kong.client.protocol":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_host":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.request.forwarded_scheme":{dataType:"string",writable:!1,readable:!0},"kong.request.port":{dataType:"number",writable:!1,readable:!0},"kong.response.source":{dataType:"string",writable:!1,readable:!0},"kong.router.route":{dataType:"object",writable:!1,readable:!0},"kong.route_id":{dataType:"string",writable:!1,readable:!0},"kong.route_name":{dataType:"string",writable:!1,readable:!0},"kong.router.service":{dataType:"object",writable:!1,readable:!0},"kong.service_name":{dataType:"string",writable:!1,readable:!0},"kong.service_id":{dataType:"string",writable:!1,readable:!0},"kong.service.response.status":{dataType:"number",writable:!1,readable:!0},"kong.version":{dataType:"string",writable:!1,readable:!0},"kong.node.id":{dataType:"string",writable:!1,readable:!0},"kong.configuration.{key}":{dataType:"any",writable:!1,readable:!0},"kong.service.target":{dataType:"string ({host}:{port})",writable:!0,readable:!1},"kong.service.request_scheme":{dataType:"string ({scheme})",writable:!0,readable:!1},"kong.ctx.plugin.{key}":{dataType:"any",writable:!0,readable:!0},"kong.ctx.shared.{key}":{dataType:"any",writable:!0,readable:!0}},gl=Object.keys(go).filter(n=>n.includes(Zo)).map(n=>n.replace(Zo,""));function Vd(n){if(!n||!xa(n))return;const t=gl.find(r=>n.startsWith(r));if(t)return n.slice(t.length).replace(Zo,"")}function Sa(n){if(!n)return null;const t=gl.find(r=>n.startsWith(r));return t||n}function xa(n){return n?gl.some(t=>n.startsWith(t)):!1}function wy(n){return n?xa(n)?Sa(n)+Zo:n:null}function $d(n){var r;if(!n)return!1;const t=wy(n);return t?((r=go[t])==null?void 0:r.readable)??!1:!1}function Rd(n){var r;if(!n)return!1;const t=wy(n);return t?((r=go[t])==null?void 0:r.writable)??!1:!1}const Ld=Symbol("EXPERIMENTAL_FREE_FORM_PROVIDER"),ur={KM_2262_CODE_MODE:"KM-2262-code-mode",KM_2306_CONDITION_FIELD_314:"KM-2306-condition-field-314",KM_2446_DATAKIT_JWT_NODES:"KM-2446-Datakit-JWT-nodes",KM_2503_CUSTOM_PLUGIN_FREEFORM:"KM-2503-custom-plugin-freeform",KM_2485_CLONED_PLUGINS:"KM-2485-cloned-plugins",KHCP_20393_IDENTITY_PRINCIPALS_UI:"khcp-20393-identity-principals-ui"},ky=Symbol("TOASTER_PROVIDER"),Qo="__FREEFORM_SCHEMA_MAP__";function Dd(){const n=(...r)=>{console.warn("TOASTER_PROVIDER is not provided",...r)},t=e.inject(ky,n);return r=>t(r)}const Cy=["request","service_request","service_response","response","vault"],ei=Cy,Ey=["call","jq","exit","property","static","branch","cache","xml_to_json","json_to_xml","jwt_decode","jwt_sign","jwt_verify"],Ny=["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","TRACE","CONNECT"],Md=["EdDSA","ES256","ES384","ES512","HS256","HS384","HS512","PS256","PS384","PS512","RS256","RS384","RS512"],Me=(n,t)=>{const r=n.__vccOpts||n;for(const[o,i]of t)r[o]=i;return r},Wv={},Yv={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function Jv(n,t){return e.openBlock(),e.createElementBlock("svg",Yv,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M240-160h480v-400H240v400Zm296.5-143.5Q560-327 560-360t-23.5-56.5Q513-440 480-440t-56.5 23.5Q400-393 400-360t23.5 56.5Q447-280 480-280t56.5-23.5ZM240-160v-400 400Zm0 80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h280v-80q0-83 58.5-141.5T720-920q83 0 141.5 58.5T920-720h-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80h120q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Z",fill:"currentColor"},null,-1)])])}const Xv=Me(Wv,[["render",Jv]]),Zv={},Qv={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function eI(n,t){return e.openBlock(),e.createElementBlock("svg",Qv,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z",fill:"currentColor"},null,-1)])])}const tI=Me(Zv,[["render",eI]]),Aa=[{id:"external_interaction",colors:{foreground:p1,background:i1},nodes:[{type:"call",icon:Re.NetworkIcon},{type:"cache",icon:Re.CachedIcon}]},{id:"control_flow",colors:{foreground:c1,background:e1},nodes:[{type:"branch",icon:Re.ArrowSplitIcon},{type:"exit",icon:Re.GatewayIcon}]},{id:"data_transformation",colors:{foreground:Vh,background:t1},nodes:[{type:"jq",icon:Re.CodeblockIcon},{type:"xml_to_json",icon:Re.DataObjectIcon},{type:"json_to_xml",icon:Re.CodeIcon}]},{id:"data_value",colors:{foreground:Rh,background:f1},nodes:[{type:"property",icon:Re.StackIcon},{type:"static",icon:Re.DeployIcon}]},{id:"authentication",colors:{foreground:u1,background:d1},nodes:[{type:"jwt_sign",icon:Re.EditSquareIcon},{type:"jwt_decode",icon:Xv},{type:"jwt_verify",icon:tI}]}],nI=Aa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]={icon:r.icon,colors:t.colors};return n},{}),ti={vault:{icon:Re.KeyIcon},request:{icon:Re.CloudIcon},service_request:{icon:Re.CloudIcon},service_response:{icon:Re.CloudIcon},response:{icon:Re.CloudIcon}};function rI(n){return Aa.find(({id:t})=>t===n).colors}function jd(n){return nI[n]??ti[n]}const{t:Fd}=jt.createI18n("en-us",Yt);function ni(n){return Fd(`plugins.free-form.datakit.flow_editor.node_types.${n}.description`)}function oI(n){return Fd(`plugins.free-form.datakit.flow_editor.node_types.${n}.summary`)}function iI(n){return Fd(`plugins.free-form.datakit.flow_editor.node_panel.groups.${n}`)}const aI={call:{io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]},output:{fields:[{name:"headers"},{name:"body"},{name:"status"}]}}},jq:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},exit:{io:{input:{fields:[{name:"headers"},{name:"body"}]}}},property:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},static:{io:{output:{fields:[],configurable:!0}}},branch:{io:{input:{fields:[]},next:{branches:[{name:"then"},{name:"else"}]}}},cache:{io:{input:{fields:[{name:"data"},{name:"key"},{name:"ttl"}]},output:{fields:[{name:"data"},{name:"hit"},{name:"miss"},{name:"stored"}]}}},xml_to_json:{io:{input:{fields:[]},output:{fields:[]}}},json_to_xml:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},jwt_decode:{io:{input:{fields:[]},output:{fields:[{name:"header"},{name:"payload"},{name:"signature"}]}}},jwt_sign:{io:{input:{fields:[{name:"claims"},{name:"key"}]},output:{fields:[{name:"claims"},{name:"header"},{name:"token"}]}}},jwt_verify:{io:{input:{fields:[{name:"key"},{name:"token"}]},output:{fields:[{name:"claims"},{name:"header"}]}}}};function sI(n){return{id:n.id,title:iI(n.id),colors:rI(n.id),nodeTypes:n.nodes.map(({type:t})=>t)}}function lI(n,t){return{...aI[t.type],type:t.type,icon:t.icon,group:n.id,summary:oI(t.type),description:ni(t.type)}}const Sy=Aa.reduce((n,t)=>(n[t.id]=sI(t),n),{}),yl=Aa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]=lI(t,r);return n},{}),xy=Aa.map(n=>({...Sy[n.id],nodes:n.nodes.map(({type:t})=>yl[t])}));function cI(n){return Sy[n]}const _l={request:{type:"request",description:ni("request"),io:{output:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ti.request},service_request:{type:"service_request",description:ni("service_request"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ti.service_request},service_response:{type:"service_response",description:ni("service_response"),io:{output:{fields:[{name:"headers"},{name:"body"}]}},...ti.service_response},response:{type:"response",description:ni("response"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...ti.response},vault:{type:"vault",io:{output:{fields:[],configurable:!0}},...ti.vault,hidden:!0}},Ud=Object.keys(_l),Kd=n=>Ud.includes(n),uI=n=>[...Ud,...Ey].includes(n),pn=n=>Ud.includes(n),bl=n=>pn(n.type),qd=n=>!!(n!=null&&n.startsWith("node:")),va=n=>Object.prototype.hasOwnProperty.call(n,"ownerId");function vr(n){return Ea(n)}function Gd(n,t){if(n.length!==t.length)return!1;if(n.length===0)return!0;const r=new Set(t);return n.every(o=>r.has(o))}function ri(n){return`${n}:${hl()}`}function wl(n){const[t,r]=n.split(".");return{nodeName:t,fieldName:r}}function Ay(n){const[t,r]=n.split(".");return{nodeId:t,fieldId:r}}function oi(n){return pn(n)?_l[n]:yl[n]}function vy(n){var i,a,s,c;const t=oi(n),r=((a=(i=t.io)==null?void 0:i.input)==null?void 0:a.fields.map(({name:l})=>l))??[],o=((c=(s=t.io)==null?void 0:s.output)==null?void 0:c.fields.map(({name:l})=>l))??[];return{input:r,output:o}}function Ia(n){var r,o,i;return((i=(o=(r=oi(n).io)==null?void 0:r.next)==null?void 0:o.branches)==null?void 0:i.map(({name:a})=>a))??[]}function Iy(n){return(n??[]).map(t=>({id:ri("field"),name:t}))}function Yr(n,t,r){if(r)return n.fields[t].find(o=>o.name===r)}function Jr(n,t,r){if(r)return n.fields[t].find(o=>o.id===r)}function Hd(n,t){return t?n.fields.output.some(r=>r.id===t):!0}function By(n,t){return t?n.fields.input.some(r=>r.id===t):!0}function dI(n){const t=["request","service_request","vault"].includes(n)?"request":"response",r=_l[n];return{name:n,phase:t,position:{x:0,y:0},fields:vy(r.type),expanded:{},hidden:r.hidden}}function Ty(n,t){const o=(typeof n=="string"&&uI(n)?n.toUpperCase():n).replace(/_\d+$/,"");for(let i=1;;i++){const a=`${o}_${i}`;if(!t.has(a))return a}}function zd(n,t){return`${n}:${t}`}function fI(n){const t=n.lastIndexOf(":");if(t===-1)throw new Error(`Invalid group ID format: ${n}`);const r=n.slice(0,t),o=n.slice(t+1);return{nodeId:r,branch:o}}function kl(n,t){return`${n}:${t}`}function Oy(n,t,r,o,i){return{id:zd(n,t),ownerId:n,branch:t,phase:r,memberIds:[...o],position:i!=null&&i.position?{...i.position}:void 0,dimensions:i!=null&&i.dimensions?{...i.dimensions}:void 0}}function Cl(n,t,r){const o=t?Jr(n,r,t):void 0;return`${n.name}${o?`.${o.name}`:""}`}function Ba(n,t){const r=t(n.source),o=t(n.target);return[Cl(r,n.sourceField,"output"),Cl(o,n.targetField,"input")]}function Wd(n,t,r,o,i){const a=i(n),s=i(r);return[Cl(a,t,"output"),Cl(s,o,"input")]}function Py(n){if(n.length===0)throw new Error("getBoundingRect requires at least one rect");let t=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const{x:a,y:s,width:c,height:l}of n){if(![a,s,c,l].every(Number.isFinite))throw new Error("Rect values must be finite numbers");if(c<0||l<0)throw new RangeError("Rect width and height must be non-negative");const u=a+c,p=s+l;if(!Number.isFinite(u)||!Number.isFinite(p))throw new RangeError("Rect boundaries must be finite numbers");a<t&&(t=a),s<r&&(r=s),u>o&&(o=u),p>i&&(i=p)}return{x:t,y:r,width:o-t,height:i-r}}var wt=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Yn=wt((n,t)=>{var r=Object.defineProperty,o=(P,R,W)=>R in P?r(P,R,{enumerable:!0,configurable:!0,writable:!0,value:W}):P[R]=W,i=(P,R)=>()=>(R||P((R={exports:{}}).exports,R),R.exports),a=(P,R,W)=>o(P,typeof R!="symbol"?R+"":R,W),s=i((P,R)=>{var W="\0",Z="\0",X="",F=class{constructor(M){a(this,"_isDirected",!0),a(this,"_isMultigraph",!1),a(this,"_isCompound",!1),a(this,"_label"),a(this,"_defaultNodeLabelFn",()=>{}),a(this,"_defaultEdgeLabelFn",()=>{}),a(this,"_nodes",{}),a(this,"_in",{}),a(this,"_preds",{}),a(this,"_out",{}),a(this,"_sucs",{}),a(this,"_edgeObjs",{}),a(this,"_edgeLabels",{}),a(this,"_nodeCount",0),a(this,"_edgeCount",0),a(this,"_parent"),a(this,"_children"),M&&(this._isDirected=Object.hasOwn(M,"directed")?M.directed:!0,this._isMultigraph=Object.hasOwn(M,"multigraph")?M.multigraph:!1,this._isCompound=Object.hasOwn(M,"compound")?M.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Z]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(M){return this._label=M,this}graph(){return this._label}setDefaultNodeLabel(M){return this._defaultNodeLabelFn=M,typeof M!="function"&&(this._defaultNodeLabelFn=()=>M),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var M=this;return this.nodes().filter(v=>Object.keys(M._in[v]).length===0)}sinks(){var M=this;return this.nodes().filter(v=>Object.keys(M._out[v]).length===0)}setNodes(M,v){var H=arguments,oe=this;return M.forEach(function(te){H.length>1?oe.setNode(te,v):oe.setNode(te)}),this}setNode(M,v){return Object.hasOwn(this._nodes,M)?(arguments.length>1&&(this._nodes[M]=v),this):(this._nodes[M]=arguments.length>1?v:this._defaultNodeLabelFn(M),this._isCompound&&(this._parent[M]=Z,this._children[M]={},this._children[Z][M]=!0),this._in[M]={},this._preds[M]={},this._out[M]={},this._sucs[M]={},++this._nodeCount,this)}node(M){return this._nodes[M]}hasNode(M){return Object.hasOwn(this._nodes,M)}removeNode(M){var v=this;if(Object.hasOwn(this._nodes,M)){var H=oe=>v.removeEdge(v._edgeObjs[oe]);delete this._nodes[M],this._isCompound&&(this._removeFromParentsChildList(M),delete this._parent[M],this.children(M).forEach(function(oe){v.setParent(oe)}),delete this._children[M]),Object.keys(this._in[M]).forEach(H),delete this._in[M],delete this._preds[M],Object.keys(this._out[M]).forEach(H),delete this._out[M],delete this._sucs[M],--this._nodeCount}return this}setParent(M,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(v===void 0)v=Z;else{v+="";for(var H=v;H!==void 0;H=this.parent(H))if(H===M)throw new Error("Setting "+v+" as parent of "+M+" would create a cycle");this.setNode(v)}return this.setNode(M),this._removeFromParentsChildList(M),this._parent[M]=v,this._children[v][M]=!0,this}_removeFromParentsChildList(M){delete this._children[this._parent[M]][M]}parent(M){if(this._isCompound){var v=this._parent[M];if(v!==Z)return v}}children(M=Z){if(this._isCompound){var v=this._children[M];if(v)return Object.keys(v)}else{if(M===Z)return this.nodes();if(this.hasNode(M))return[]}}predecessors(M){var v=this._preds[M];if(v)return Object.keys(v)}successors(M){var v=this._sucs[M];if(v)return Object.keys(v)}neighbors(M){var v=this.predecessors(M);if(v){let oe=new Set(v);for(var H of this.successors(M))oe.add(H);return Array.from(oe.values())}}isLeaf(M){var v;return this.isDirected()?v=this.successors(M):v=this.neighbors(M),v.length===0}filterNodes(M){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var H=this;Object.entries(this._nodes).forEach(function([ge,me]){M(ge)&&v.setNode(ge,me)}),Object.values(this._edgeObjs).forEach(function(ge){v.hasNode(ge.v)&&v.hasNode(ge.w)&&v.setEdge(ge,H.edge(ge))});var oe={};function te(ge){var me=H.parent(ge);return me===void 0||v.hasNode(me)?(oe[ge]=me,me):me in oe?oe[me]:te(me)}return this._isCompound&&v.nodes().forEach(ge=>v.setParent(ge,te(ge))),v}setDefaultEdgeLabel(M){return this._defaultEdgeLabelFn=M,typeof M!="function"&&(this._defaultEdgeLabelFn=()=>M),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(M,v){var H=this,oe=arguments;return M.reduce(function(te,ge){return oe.length>1?H.setEdge(te,ge,v):H.setEdge(te,ge),ge}),this}setEdge(){var M,v,H,oe,te=!1,ge=arguments[0];typeof ge=="object"&&ge!==null&&"v"in ge?(M=ge.v,v=ge.w,H=ge.name,arguments.length===2&&(oe=arguments[1],te=!0)):(M=ge,v=arguments[1],H=arguments[3],arguments.length>2&&(oe=arguments[2],te=!0)),M=""+M,v=""+v,H!==void 0&&(H=""+H);var me=q(this._isDirected,M,v,H);if(Object.hasOwn(this._edgeLabels,me))return te&&(this._edgeLabels[me]=oe),this;if(H!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(M),this.setNode(v),this._edgeLabels[me]=te?oe:this._defaultEdgeLabelFn(M,v,H);var le=K(this._isDirected,M,v,H);return M=le.v,v=le.w,Object.freeze(le),this._edgeObjs[me]=le,J(this._preds[v],M),J(this._sucs[M],v),this._in[v][me]=le,this._out[M][me]=le,this._edgeCount++,this}edge(M,v,H){var oe=arguments.length===1?ae(this._isDirected,arguments[0]):q(this._isDirected,M,v,H);return this._edgeLabels[oe]}edgeAsObj(){let M=this.edge(...arguments);return typeof M!="object"?{label:M}:M}hasEdge(M,v,H){var oe=arguments.length===1?ae(this._isDirected,arguments[0]):q(this._isDirected,M,v,H);return Object.hasOwn(this._edgeLabels,oe)}removeEdge(M,v,H){var oe=arguments.length===1?ae(this._isDirected,arguments[0]):q(this._isDirected,M,v,H),te=this._edgeObjs[oe];return te&&(M=te.v,v=te.w,delete this._edgeLabels[oe],delete this._edgeObjs[oe],$(this._preds[v],M),$(this._sucs[M],v),delete this._in[v][oe],delete this._out[M][oe],this._edgeCount--),this}inEdges(M,v){return this.isDirected()?this.filterEdges(this._in[M],M,v):this.nodeEdges(M,v)}outEdges(M,v){return this.isDirected()?this.filterEdges(this._out[M],M,v):this.nodeEdges(M,v)}nodeEdges(M,v){if(M in this._nodes)return this.filterEdges({...this._in[M],...this._out[M]},M,v)}filterEdges(M,v,H){if(M){var oe=Object.values(M);return H?oe.filter(function(te){return te.v===v&&te.w===H||te.v===H&&te.w===v}):oe}}};function J(M,v){M[v]?M[v]++:M[v]=1}function $(M,v){--M[v]||delete M[v]}function q(M,v,H,oe){var te=""+v,ge=""+H;if(!M&&te>ge){var me=te;te=ge,ge=me}return te+X+ge+X+(oe===void 0?W:oe)}function K(M,v,H,oe){var te=""+v,ge=""+H;if(!M&&te>ge){var me=te;te=ge,ge=me}var le={v:te,w:ge};return oe&&(le.name=oe),le}function ae(M,v){return q(M,v.v,v.w,v.name)}R.exports=F}),c=i((P,R)=>{R.exports="3.0.2"}),l=i((P,R)=>{R.exports={Graph:s(),version:c()}}),u=i((P,R)=>{var W=s();R.exports={write:Z,read:J};function Z($){var q={options:{directed:$.isDirected(),multigraph:$.isMultigraph(),compound:$.isCompound()},nodes:X($),edges:F($)};return $.graph()!==void 0&&(q.value=structuredClone($.graph())),q}function X($){return $.nodes().map(function(q){var K=$.node(q),ae=$.parent(q),M={v:q};return K!==void 0&&(M.value=K),ae!==void 0&&(M.parent=ae),M})}function F($){return $.edges().map(function(q){var K=$.edge(q),ae={v:q.v,w:q.w};return q.name!==void 0&&(ae.name=q.name),K!==void 0&&(ae.value=K),ae})}function J($){var q=new W($.options).setGraph($.value);return $.nodes.forEach(function(K){q.setNode(K.v,K.value),K.parent&&q.setParent(K.v,K.parent)}),$.edges.forEach(function(K){q.setEdge({v:K.v,w:K.w,name:K.name},K.value)}),q}}),p=i((P,R)=>{R.exports=Z;var W=()=>1;function Z(F,J,$,q){return X(F,String(J),$||W,q||function(K){return F.outEdges(K)})}function X(F,J,$,q){var K={},ae=!0,M=0,v=F.nodes(),H=function(me){var le=$(me);K[me.v].distance+le<K[me.w].distance&&(K[me.w]={distance:K[me.v].distance+le,predecessor:me.v},ae=!0)},oe=function(){v.forEach(function(me){q(me).forEach(function(le){var he=le.v===me?le.v:le.w,Oe=he===le.v?le.w:le.v;H({v:he,w:Oe})})})};v.forEach(function(me){var le=me===J?0:Number.POSITIVE_INFINITY;K[me]={distance:le}});for(var te=v.length,ge=1;ge<te&&(ae=!1,M++,oe(),!!ae);ge++);if(M===te-1&&(ae=!1,oe(),ae))throw new Error("The graph contains a negative weight cycle");return K}}),d=i((P,R)=>{R.exports=W;function W(Z){var X={},F=[],J;function $(q){Object.hasOwn(X,q)||(X[q]=!0,J.push(q),Z.successors(q).forEach($),Z.predecessors(q).forEach($))}return Z.nodes().forEach(function(q){J=[],$(q),J.length&&F.push(J)}),F}}),f=i((P,R)=>{var W=class{constructor(){a(this,"_arr",[]),a(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(Z){return Z.key})}has(Z){return Object.hasOwn(this._keyIndices,Z)}priority(Z){var X=this._keyIndices[Z];if(X!==void 0)return this._arr[X].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(Z,X){var F=this._keyIndices;if(Z=String(Z),!Object.hasOwn(F,Z)){var J=this._arr,$=J.length;return F[Z]=$,J.push({key:Z,priority:X}),this._decrease($),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var Z=this._arr.pop();return delete this._keyIndices[Z.key],this._heapify(0),Z.key}decrease(Z,X){var F=this._keyIndices[Z];if(X>this._arr[F].priority)throw new Error("New priority is greater than current priority. Key: "+Z+" Old: "+this._arr[F].priority+" New: "+X);this._arr[F].priority=X,this._decrease(F)}_heapify(Z){var X=this._arr,F=2*Z,J=F+1,$=Z;F<X.length&&($=X[F].priority<X[$].priority?F:$,J<X.length&&($=X[J].priority<X[$].priority?J:$),$!==Z&&(this._swap(Z,$),this._heapify($)))}_decrease(Z){for(var X=this._arr,F=X[Z].priority,J;Z!==0&&(J=Z>>1,!(X[J].priority<F));)this._swap(Z,J),Z=J}_swap(Z,X){var F=this._arr,J=this._keyIndices,$=F[Z],q=F[X];F[Z]=q,F[X]=$,J[q.key]=Z,J[$.key]=X}};R.exports=W}),m=i((P,R)=>{var W=f();R.exports=X;var Z=()=>1;function X(J,$,q,K){var ae=function(M){return J.outEdges(M)};return F(J,String($),q||Z,K||ae)}function F(J,$,q,K){var ae={},M=new W,v,H,oe=function(te){var ge=te.v!==v?te.v:te.w,me=ae[ge],le=q(te),he=H.distance+le;if(le<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+te+" Weight: "+le);he<me.distance&&(me.distance=he,me.predecessor=v,M.decrease(ge,he))};for(J.nodes().forEach(function(te){var ge=te===$?0:Number.POSITIVE_INFINITY;ae[te]={distance:ge},M.add(te,ge)});M.size()>0&&(v=M.removeMin(),H=ae[v],H.distance!==Number.POSITIVE_INFINITY);)K(v).forEach(oe);return ae}}),g=i((P,R)=>{var W=m();R.exports=Z;function Z(X,F,J){return X.nodes().reduce(function($,q){return $[q]=W(X,q,F,J),$},{})}}),y=i((P,R)=>{R.exports=W;function W(X,F,J){if(X[F].predecessor!==void 0)throw new Error("Invalid source vertex");if(X[J].predecessor===void 0&&J!==F)throw new Error("Invalid destination vertex");return{weight:X[J].distance,path:Z(X,F,J)}}function Z(X,F,J){for(var $=[],q=J;q!==F;)$.push(q),q=X[q].predecessor;return $.push(F),$.reverse()}}),b=i((P,R)=>{R.exports=W;function W(Z){var X=0,F=[],J={},$=[];function q(K){var ae=J[K]={onStack:!0,lowlink:X,index:X++};if(F.push(K),Z.successors(K).forEach(function(H){Object.hasOwn(J,H)?J[H].onStack&&(ae.lowlink=Math.min(ae.lowlink,J[H].index)):(q(H),ae.lowlink=Math.min(ae.lowlink,J[H].lowlink))}),ae.lowlink===ae.index){var M=[],v;do v=F.pop(),J[v].onStack=!1,M.push(v);while(K!==v);$.push(M)}}return Z.nodes().forEach(function(K){Object.hasOwn(J,K)||q(K)}),$}}),_=i((P,R)=>{var W=b();R.exports=Z;function Z(X){return W(X).filter(function(F){return F.length>1||F.length===1&&X.hasEdge(F[0],F[0])})}}),k=i((P,R)=>{R.exports=Z;var W=()=>1;function Z(F,J,$){return X(F,J||W,$||function(q){return F.outEdges(q)})}function X(F,J,$){var q={},K=F.nodes();return K.forEach(function(ae){q[ae]={},q[ae][ae]={distance:0},K.forEach(function(M){ae!==M&&(q[ae][M]={distance:Number.POSITIVE_INFINITY})}),$(ae).forEach(function(M){var v=M.v===ae?M.w:M.v,H=J(M);q[ae][v]={distance:H,predecessor:ae}})}),K.forEach(function(ae){var M=q[ae];K.forEach(function(v){var H=q[v];K.forEach(function(oe){var te=H[ae],ge=M[oe],me=H[oe],le=te.distance+ge.distance;le<me.distance&&(me.distance=le,me.predecessor=ge.predecessor)})})}),q}}),C=i((P,R)=>{function W(X){var F={},J={},$=[];function q(K){if(Object.hasOwn(J,K))throw new Z;Object.hasOwn(F,K)||(J[K]=!0,F[K]=!0,X.predecessors(K).forEach(q),delete J[K],$.push(K))}if(X.sinks().forEach(q),Object.keys(F).length!==X.nodeCount())throw new Z;return $}var Z=class extends Error{constructor(){super(...arguments)}};R.exports=W,W.CycleException=Z}),N=i((P,R)=>{var W=C();R.exports=Z;function Z(X){try{W(X)}catch(F){if(F instanceof W.CycleException)return!1;throw F}return!0}}),E=i((P,R)=>{R.exports=W;function W(X,F,J,$,q){Array.isArray(F)||(F=[F]);var K=(X.isDirected()?X.successors:X.neighbors).bind(X),ae={};return F.forEach(function(M){if(!X.hasNode(M))throw new Error("Graph does not have node: "+M);q=Z(X,M,J==="post",ae,K,$,q)}),q}function Z(X,F,J,$,q,K,ae){return Object.hasOwn($,F)||($[F]=!0,J||(ae=K(ae,F)),q(F).forEach(function(M){ae=Z(X,M,J,$,q,K,ae)}),J&&(ae=K(ae,F))),ae}}),w=i((P,R)=>{var W=E();R.exports=Z;function Z(X,F,J){return W(X,F,J,function($,q){return $.push(q),$},[])}}),S=i((P,R)=>{var W=w();R.exports=Z;function Z(X,F){return W(X,F,"post")}}),I=i((P,R)=>{var W=w();R.exports=Z;function Z(X,F){return W(X,F,"pre")}}),j=i((P,R)=>{var W=s(),Z=f();R.exports=X;function X(F,J){var $=new W,q={},K=new Z,ae;function M(H){var oe=H.v===ae?H.w:H.v,te=K.priority(oe);if(te!==void 0){var ge=J(H);ge<te&&(q[oe]=ae,K.decrease(oe,ge))}}if(F.nodeCount()===0)return $;F.nodes().forEach(function(H){K.add(H,Number.POSITIVE_INFINITY),$.setNode(H)}),K.decrease(F.nodes()[0],0);for(var v=!1;K.size()>0;){if(ae=K.removeMin(),Object.hasOwn(q,ae))$.setEdge(ae,q[ae]);else{if(v)throw new Error("Input graph is not connected: "+F);v=!0}F.nodeEdges(ae).forEach(M)}return $}}),A=i((P,R)=>{var W=m(),Z=p();R.exports=X;function X(J,$,q,K){return F(J,$,q,K||function(ae){return J.outEdges(ae)})}function F(J,$,q,K){if(q===void 0)return W(J,$,q,K);for(var ae=!1,M=J.nodes(),v=0;v<M.length;v++){for(var H=K(M[v]),oe=0;oe<H.length;oe++){var te=H[oe],ge=te.v===M[v]?te.v:te.w,me=ge===te.v?te.w:te.v;q({v:ge,w:me})<0&&(ae=!0)}if(ae)return Z(J,$,q,K)}return W(J,$,q,K)}}),x=i((P,R)=>{R.exports={bellmanFord:p(),components:d(),dijkstra:m(),dijkstraAll:g(),extractPath:y(),findCycles:_(),floydWarshall:k(),isAcyclic:N(),postorder:S(),preorder:I(),prim:j(),shortestPaths:A(),reduce:E(),tarjan:b(),topsort:C()}}),O=l();t.exports={Graph:O.Graph,json:u(),alg:x(),version:O.version}}),pI=wt((n,t)=>{var r=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,s=a._prev;if(s!==a)return o(s),s}enqueue(a){let s=this._sentinel;a._prev&&a._next&&o(a),a._next=s._next,s._next._prev=a,s._next=a,a._prev=s}toString(){let a=[],s=this._sentinel,c=s._prev;for(;c!==s;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}};function o(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,s){if(a!=="_next"&&a!=="_prev")return s}t.exports=r}),mI=wt((n,t)=>{var r=Yn().Graph,o=pI();t.exports=a;var i=()=>1;function a(d,f){if(d.nodeCount()<=1)return[];let m=l(d,f||i);return s(m.graph,m.buckets,m.zeroIdx).flatMap(g=>d.outEdges(g.v,g.w))}function s(d,f,m){let g=[],y=f[f.length-1],b=f[0],_;for(;d.nodeCount();){for(;_=b.dequeue();)c(d,f,m,_);for(;_=y.dequeue();)c(d,f,m,_);if(d.nodeCount()){for(let k=f.length-2;k>0;--k)if(_=f[k].dequeue(),_){g=g.concat(c(d,f,m,_,!0));break}}}return g}function c(d,f,m,g,y){let b=y?[]:void 0;return d.inEdges(g.v).forEach(_=>{let k=d.edge(_),C=d.node(_.v);y&&b.push({v:_.v,w:_.w}),C.out-=k,u(f,m,C)}),d.outEdges(g.v).forEach(_=>{let k=d.edge(_),C=_.w,N=d.node(C);N.in-=k,u(f,m,N)}),d.removeNode(g.v),b}function l(d,f){let m=new r,g=0,y=0;d.nodes().forEach(k=>{m.setNode(k,{v:k,in:0,out:0})}),d.edges().forEach(k=>{let C=m.edge(k.v,k.w)||0,N=f(k),E=C+N;m.setEdge(k.v,k.w,E),y=Math.max(y,m.node(k.v).out+=N),g=Math.max(g,m.node(k.w).in+=N)});let b=p(y+g+3).map(()=>new o),_=g+1;return m.nodes().forEach(k=>{u(b,_,m.node(k))}),{graph:m,buckets:b,zeroIdx:_}}function u(d,f,m){m.out?m.in?d[m.out-m.in+f].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}function p(d){let f=[];for(let m=0;m<d;m++)f.push(m);return f}}),qt=wt((n,t)=>{var r=Yn().Graph;t.exports={addBorderNode:f,addDummyNode:o,applyWithChunking:y,asNonCompoundGraph:a,buildLayerMatrix:u,intersectRect:l,mapValues:I,maxRank:b,normalizeRanks:p,notime:C,partition:_,pick:S,predecessorWeights:c,range:w,removeEmptyRanks:d,simplify:i,successorWeights:s,time:k,uniqueId:E,zipObject:j};function o(A,x,O,P){for(var R=P;A.hasNode(R);)R=E(P);return O.dummy=x,A.setNode(R,O),R}function i(A){let x=new r().setGraph(A.graph());return A.nodes().forEach(O=>x.setNode(O,A.node(O))),A.edges().forEach(O=>{let P=x.edge(O.v,O.w)||{weight:0,minlen:1},R=A.edge(O);x.setEdge(O.v,O.w,{weight:P.weight+R.weight,minlen:Math.max(P.minlen,R.minlen)})}),x}function a(A){let x=new r({multigraph:A.isMultigraph()}).setGraph(A.graph());return A.nodes().forEach(O=>{A.children(O).length||x.setNode(O,A.node(O))}),A.edges().forEach(O=>{x.setEdge(O,A.edge(O))}),x}function s(A){let x=A.nodes().map(O=>{let P={};return A.outEdges(O).forEach(R=>{P[R.w]=(P[R.w]||0)+A.edge(R).weight}),P});return j(A.nodes(),x)}function c(A){let x=A.nodes().map(O=>{let P={};return A.inEdges(O).forEach(R=>{P[R.v]=(P[R.v]||0)+A.edge(R).weight}),P});return j(A.nodes(),x)}function l(A,x){let O=A.x,P=A.y,R=x.x-O,W=x.y-P,Z=A.width/2,X=A.height/2;if(!R&&!W)throw new Error("Not possible to find intersection inside of the rectangle");let F,J;return Math.abs(W)*Z>Math.abs(R)*X?(W<0&&(X=-X),F=X*R/W,J=X):(R<0&&(Z=-Z),F=Z,J=Z*W/R),{x:O+F,y:P+J}}function u(A){let x=w(b(A)+1).map(()=>[]);return A.nodes().forEach(O=>{let P=A.node(O),R=P.rank;R!==void 0&&(x[R][P.order]=O)}),x}function p(A){let x=A.nodes().map(P=>{let R=A.node(P).rank;return R===void 0?Number.MAX_VALUE:R}),O=y(Math.min,x);A.nodes().forEach(P=>{let R=A.node(P);Object.hasOwn(R,"rank")&&(R.rank-=O)})}function d(A){let x=A.nodes().map(Z=>A.node(Z).rank).filter(Z=>Z!==void 0),O=y(Math.min,x),P=[];A.nodes().forEach(Z=>{let X=A.node(Z).rank-O;P[X]||(P[X]=[]),P[X].push(Z)});let R=0,W=A.graph().nodeRankFactor;Array.from(P).forEach((Z,X)=>{Z===void 0&&X%W!==0?--R:Z!==void 0&&R&&Z.forEach(F=>A.node(F).rank+=R)})}function f(A,x,O,P){let R={width:0,height:0};return arguments.length>=4&&(R.rank=O,R.order=P),o(A,"border",R,x)}function m(A,x=g){let O=[];for(let P=0;P<A.length;P+=x){let R=A.slice(P,P+x);O.push(R)}return O}var g=65535;function y(A,x){if(x.length>g){let O=m(x);return A.apply(null,O.map(P=>A.apply(null,P)))}else return A.apply(null,x)}function b(A){let x=A.nodes().map(O=>{let P=A.node(O).rank;return P===void 0?Number.MIN_VALUE:P});return y(Math.max,x)}function _(A,x){let O={lhs:[],rhs:[]};return A.forEach(P=>{x(P)?O.lhs.push(P):O.rhs.push(P)}),O}function k(A,x){let O=Date.now();try{return x()}finally{console.log(A+" time: "+(Date.now()-O)+"ms")}}function C(A,x){return x()}var N=0;function E(A){var x=++N;return A+(""+x)}function w(A,x,O=1){x==null&&(x=A,A=0);let P=W=>W<x;O<0&&(P=W=>x<W);let R=[];for(let W=A;P(W);W+=O)R.push(W);return R}function S(A,x){let O={};for(let P of x)A[P]!==void 0&&(O[P]=A[P]);return O}function I(A,x){let O=x;return typeof x=="string"&&(O=P=>P[x]),Object.entries(A).reduce((P,[R,W])=>(P[R]=O(W,R),P),{})}function j(A,x){return A.reduce((O,P,R)=>(O[P]=x[R],O),{})}}),hI=wt((n,t)=>{var r=mI(),o=qt().uniqueId;t.exports={run:i,undo:s};function i(c){(c.graph().acyclicer==="greedy"?r(c,l(c)):a(c)).forEach(u=>{let p=c.edge(u);c.removeEdge(u),p.forwardName=u.name,p.reversed=!0,c.setEdge(u.w,u.v,p,o("rev"))});function l(u){return p=>u.edge(p).weight}}function a(c){let l=[],u={},p={};function d(f){Object.hasOwn(p,f)||(p[f]=!0,u[f]=!0,c.outEdges(f).forEach(m=>{Object.hasOwn(u,m.w)?l.push(m):d(m.w)}),delete u[f])}return c.nodes().forEach(d),l}function s(c){c.edges().forEach(l=>{let u=c.edge(l);if(u.reversed){c.removeEdge(l);let p=u.forwardName;delete u.reversed,delete u.forwardName,c.setEdge(l.w,l.v,u,p)}})}}),gI=wt((n,t)=>{var r=qt();t.exports={run:o,undo:a};function o(s){s.graph().dummyChains=[],s.edges().forEach(c=>i(s,c))}function i(s,c){let l=c.v,u=s.node(l).rank,p=c.w,d=s.node(p).rank,f=c.name,m=s.edge(c),g=m.labelRank;if(d===u+1)return;s.removeEdge(c);let y,b,_;for(_=0,++u;u<d;++_,++u)m.points=[],b={width:0,height:0,edgeLabel:m,edgeObj:c,rank:u},y=r.addDummyNode(s,"edge",b,"_d"),u===g&&(b.width=m.width,b.height=m.height,b.dummy="edge-label",b.labelpos=m.labelpos),s.setEdge(l,y,{weight:m.weight},f),_===0&&s.graph().dummyChains.push(y),l=y;s.setEdge(l,p,{weight:m.weight},f)}function a(s){s.graph().dummyChains.forEach(c=>{let l=s.node(c),u=l.edgeLabel,p;for(s.setEdge(l.edgeObj,u);l.dummy;)p=s.successors(c)[0],s.removeNode(c),u.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(u.x=l.x,u.y=l.y,u.width=l.width,u.height=l.height),c=p,l=s.node(c)})}}),El=wt((n,t)=>{var{applyWithChunking:r}=qt();t.exports={longestPath:o,slack:i};function o(a){var s={};function c(l){var u=a.node(l);if(Object.hasOwn(s,l))return u.rank;s[l]=!0;let p=a.outEdges(l).map(f=>f==null?Number.POSITIVE_INFINITY:c(f.w)-a.edge(f).minlen);var d=r(Math.min,p);return d===Number.POSITIVE_INFINITY&&(d=0),u.rank=d}a.sources().forEach(c)}function i(a,s){return a.node(s.w).rank-a.node(s.v).rank-a.edge(s).minlen}}),Vy=wt((n,t)=>{var r=Yn().Graph,o=El().slack;t.exports=i;function i(l){var u=new r({directed:!1}),p=l.nodes()[0],d=l.nodeCount();u.setNode(p,{});for(var f,m;a(u,l)<d;)f=s(u,l),m=u.hasNode(f.v)?o(l,f):-o(l,f),c(u,l,m);return u}function a(l,u){function p(d){u.nodeEdges(d).forEach(f=>{var m=f.v,g=d===m?f.w:m;!l.hasNode(g)&&!o(u,f)&&(l.setNode(g,{}),l.setEdge(d,g,{}),p(g))})}return l.nodes().forEach(p),l.nodeCount()}function s(l,u){return u.edges().reduce((p,d)=>{let f=Number.POSITIVE_INFINITY;return l.hasNode(d.v)!==l.hasNode(d.w)&&(f=o(u,d)),f<p[0]?[f,d]:p},[Number.POSITIVE_INFINITY,null])[1]}function c(l,u,p){l.nodes().forEach(d=>u.node(d).rank+=p)}}),yI=wt((n,t)=>{var r=Vy(),o=El().slack,i=El().longestPath,a=Yn().alg.preorder,s=Yn().alg.postorder,c=qt().simplify;t.exports=l,l.initLowLimValues=f,l.initCutValues=u,l.calcCutValue=d,l.leaveEdge=g,l.enterEdge=y,l.exchangeEdges=b;function l(N){N=c(N),i(N);var E=r(N);f(E),u(E,N);for(var w,S;w=g(E);)S=y(E,N,w),b(E,N,w,S)}function u(N,E){var w=s(N,N.nodes());w=w.slice(0,w.length-1),w.forEach(S=>p(N,E,S))}function p(N,E,w){var S=N.node(w),I=S.parent;N.edge(w,I).cutvalue=d(N,E,w)}function d(N,E,w){var S=N.node(w),I=S.parent,j=!0,A=E.edge(w,I),x=0;return A||(j=!1,A=E.edge(I,w)),x=A.weight,E.nodeEdges(w).forEach(O=>{var P=O.v===w,R=P?O.w:O.v;if(R!==I){var W=P===j,Z=E.edge(O).weight;if(x+=W?Z:-Z,k(N,w,R)){var X=N.edge(w,R).cutvalue;x+=W?-X:X}}}),x}function f(N,E){arguments.length<2&&(E=N.nodes()[0]),m(N,{},1,E)}function m(N,E,w,S,I){var j=w,A=N.node(S);return E[S]=!0,N.neighbors(S).forEach(x=>{Object.hasOwn(E,x)||(w=m(N,E,w,x,S))}),A.low=j,A.lim=w++,I?A.parent=I:delete A.parent,w}function g(N){return N.edges().find(E=>N.edge(E).cutvalue<0)}function y(N,E,w){var S=w.v,I=w.w;E.hasEdge(S,I)||(S=w.w,I=w.v);var j=N.node(S),A=N.node(I),x=j,O=!1;j.lim>A.lim&&(x=A,O=!0);var P=E.edges().filter(R=>O===C(N,N.node(R.v),x)&&O!==C(N,N.node(R.w),x));return P.reduce((R,W)=>o(E,W)<o(E,R)?W:R)}function b(N,E,w,S){var I=w.v,j=w.w;N.removeEdge(I,j),N.setEdge(S.v,S.w,{}),f(N),u(N,E),_(N,E)}function _(N,E){var w=N.nodes().find(I=>!E.node(I).parent),S=a(N,w);S=S.slice(1),S.forEach(I=>{var j=N.node(I).parent,A=E.edge(I,j),x=!1;A||(A=E.edge(j,I),x=!0),E.node(I).rank=E.node(j).rank+(x?A.minlen:-A.minlen)})}function k(N,E,w){return N.hasEdge(E,w)}function C(N,E,w){return w.low<=E.lim&&E.lim<=w.lim}}),_I=wt((n,t)=>{var r=El(),o=r.longestPath,i=Vy(),a=yI();t.exports=s;function s(p){var d=p.graph().ranker;if(d instanceof Function)return d(p);switch(p.graph().ranker){case"network-simplex":u(p);break;case"tight-tree":l(p);break;case"longest-path":c(p);break;case"none":break;default:u(p)}}var c=o;function l(p){o(p),i(p)}function u(p){a(p)}}),bI=wt((n,t)=>{t.exports=r;function r(a){let s=i(a);a.graph().dummyChains.forEach(c=>{let l=a.node(c),u=l.edgeObj,p=o(a,s,u.v,u.w),d=p.path,f=p.lca,m=0,g=d[m],y=!0;for(;c!==u.w;){if(l=a.node(c),y){for(;(g=d[m])!==f&&a.node(g).maxRank<l.rank;)m++;g===f&&(y=!1)}if(!y){for(;m<d.length-1&&a.node(g=d[m+1]).minRank<=l.rank;)m++;g=d[m]}a.setParent(c,g),c=a.successors(c)[0]}})}function o(a,s,c,l){let u=[],p=[],d=Math.min(s[c].low,s[l].low),f=Math.max(s[c].lim,s[l].lim),m,g;m=c;do m=a.parent(m),u.push(m);while(m&&(s[m].low>d||f>s[m].lim));for(g=m,m=l;(m=a.parent(m))!==g;)p.push(m);return{path:u.concat(p.reverse()),lca:g}}function i(a){let s={},c=0;function l(u){let p=c;a.children(u).forEach(l),s[u]={low:p,lim:c++}}return a.children().forEach(l),s}}),wI=wt((n,t)=>{var r=qt();t.exports={run:o,cleanup:c};function o(l){let u=r.addDummyNode(l,"root",{},"_root"),p=a(l),d=Object.values(p),f=r.applyWithChunking(Math.max,d)-1,m=2*f+1;l.graph().nestingRoot=u,l.edges().forEach(y=>l.edge(y).minlen*=m);let g=s(l)+1;l.children().forEach(y=>i(l,u,m,g,f,p,y)),l.graph().nodeRankFactor=m}function i(l,u,p,d,f,m,g){let y=l.children(g);if(!y.length){g!==u&&l.setEdge(u,g,{weight:0,minlen:p});return}let b=r.addBorderNode(l,"_bt"),_=r.addBorderNode(l,"_bb"),k=l.node(g);l.setParent(b,g),k.borderTop=b,l.setParent(_,g),k.borderBottom=_,y.forEach(C=>{i(l,u,p,d,f,m,C);let N=l.node(C),E=N.borderTop?N.borderTop:C,w=N.borderBottom?N.borderBottom:C,S=N.borderTop?d:2*d,I=E!==w?1:f-m[g]+1;l.setEdge(b,E,{weight:S,minlen:I,nestingEdge:!0}),l.setEdge(w,_,{weight:S,minlen:I,nestingEdge:!0})}),l.parent(g)||l.setEdge(u,b,{weight:0,minlen:f+m[g]})}function a(l){var u={};function p(d,f){var m=l.children(d);m&&m.length&&m.forEach(g=>p(g,f+1)),u[d]=f}return l.children().forEach(d=>p(d,1)),u}function s(l){return l.edges().reduce((u,p)=>u+l.edge(p).weight,0)}function c(l){var u=l.graph();l.removeNode(u.nestingRoot),delete u.nestingRoot,l.edges().forEach(p=>{var d=l.edge(p);d.nestingEdge&&l.removeEdge(p)})}}),kI=wt((n,t)=>{var r=qt();t.exports=o;function o(a){function s(c){let l=a.children(c),u=a.node(c);if(l.length&&l.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let p=u.minRank,d=u.maxRank+1;p<d;++p)i(a,"borderLeft","_bl",c,u,p),i(a,"borderRight","_br",c,u,p)}}a.children().forEach(s)}function i(a,s,c,l,u,p){let d={width:0,height:0,rank:p,borderType:s},f=u[s][p-1],m=r.addDummyNode(a,"border",d,c);u[s][p]=m,a.setParent(m,l),f&&a.setEdge(f,m,{weight:1})}}),CI=wt((n,t)=>{t.exports={adjust:r,undo:o};function r(p){let d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function o(p){let d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(p),(d==="lr"||d==="rl")&&(l(p),i(p))}function i(p){p.nodes().forEach(d=>a(p.node(d))),p.edges().forEach(d=>a(p.edge(d)))}function a(p){let d=p.width;p.width=p.height,p.height=d}function s(p){p.nodes().forEach(d=>c(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(c),Object.hasOwn(f,"y")&&c(f)})}function c(p){p.y=-p.y}function l(p){p.nodes().forEach(d=>u(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(u),Object.hasOwn(f,"x")&&u(f)})}function u(p){let d=p.x;p.x=p.y,p.y=d}}),EI=wt((n,t)=>{var r=qt();t.exports=o;function o(i){let a={},s=i.nodes().filter(d=>!i.children(d).length),c=s.map(d=>i.node(d).rank),l=r.applyWithChunking(Math.max,c),u=r.range(l+1).map(()=>[]);function p(d){if(a[d])return;a[d]=!0;let f=i.node(d);u[f.rank].push(d),i.successors(d).forEach(p)}return s.sort((d,f)=>i.node(d).rank-i.node(f).rank).forEach(p),u}}),NI=wt((n,t)=>{var r=qt().zipObject;t.exports=o;function o(a,s){let c=0;for(let l=1;l<s.length;++l)c+=i(a,s[l-1],s[l]);return c}function i(a,s,c){let l=r(c,c.map((g,y)=>y)),u=s.flatMap(g=>a.outEdges(g).map(y=>({pos:l[y.w],weight:a.edge(y).weight})).sort((y,b)=>y.pos-b.pos)),p=1;for(;p<c.length;)p<<=1;let d=2*p-1;p-=1;let f=new Array(d).fill(0),m=0;return u.forEach(g=>{let y=g.pos+p;f[y]+=g.weight;let b=0;for(;y>0;)y%2&&(b+=f[y+1]),y=y-1>>1,f[y]+=g.weight;m+=g.weight*b}),m}}),SI=wt((n,t)=>{t.exports=r;function r(o,i=[]){return i.map(a=>{let s=o.inEdges(a);if(s.length){let c=s.reduce((l,u)=>{let p=o.edge(u),d=o.node(u.v);return{sum:l.sum+p.weight*d.order,weight:l.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}}),xI=wt((n,t)=>{var r=qt();t.exports=o;function o(s,c){let l={};s.forEach((p,d)=>{let f=l[p.v]={indegree:0,in:[],out:[],vs:[p.v],i:d};p.barycenter!==void 0&&(f.barycenter=p.barycenter,f.weight=p.weight)}),c.edges().forEach(p=>{let d=l[p.v],f=l[p.w];d!==void 0&&f!==void 0&&(f.indegree++,d.out.push(l[p.w]))});let u=Object.values(l).filter(p=>!p.indegree);return i(u)}function i(s){let c=[];function l(p){return d=>{d.merged||(d.barycenter===void 0||p.barycenter===void 0||d.barycenter>=p.barycenter)&&a(p,d)}}function u(p){return d=>{d.in.push(p),--d.indegree===0&&s.push(d)}}for(;s.length;){let p=s.pop();c.push(p),p.in.reverse().forEach(l(p)),p.out.forEach(u(p))}return c.filter(p=>!p.merged).map(p=>r.pick(p,["vs","i","barycenter","weight"]))}function a(s,c){let l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),c.weight&&(l+=c.barycenter*c.weight,u+=c.weight),s.vs=c.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(c.i,s.i),c.merged=!0}}),AI=wt((n,t)=>{var r=qt();t.exports=o;function o(s,c){let l=r.partition(s,b=>Object.hasOwn(b,"barycenter")),u=l.lhs,p=l.rhs.sort((b,_)=>_.i-b.i),d=[],f=0,m=0,g=0;u.sort(a(!!c)),g=i(d,p,g),u.forEach(b=>{g+=b.vs.length,d.push(b.vs),f+=b.barycenter*b.weight,m+=b.weight,g=i(d,p,g)});let y={vs:d.flat(!0)};return m&&(y.barycenter=f/m,y.weight=m),y}function i(s,c,l){let u;for(;c.length&&(u=c[c.length-1]).i<=l;)c.pop(),s.push(u.vs),l++;return l}function a(s){return(c,l)=>c.barycenter<l.barycenter?-1:c.barycenter>l.barycenter?1:s?l.i-c.i:c.i-l.i}}),vI=wt((n,t)=>{var r=SI(),o=xI(),i=AI();t.exports=a;function a(l,u,p,d){let f=l.children(u),m=l.node(u),g=m?m.borderLeft:void 0,y=m?m.borderRight:void 0,b={};g&&(f=f.filter(N=>N!==g&&N!==y));let _=r(l,f);_.forEach(N=>{if(l.children(N.v).length){let E=a(l,N.v,p,d);b[N.v]=E,Object.hasOwn(E,"barycenter")&&c(N,E)}});let k=o(_,p);s(k,b);let C=i(k,d);if(g&&(C.vs=[g,C.vs,y].flat(!0),l.predecessors(g).length)){let N=l.node(l.predecessors(g)[0]),E=l.node(l.predecessors(y)[0]);Object.hasOwn(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+N.order+E.order)/(C.weight+2),C.weight+=2}return C}function s(l,u){l.forEach(p=>{p.vs=p.vs.flatMap(d=>u[d]?u[d].vs:d)})}function c(l,u){l.barycenter!==void 0?(l.barycenter=(l.barycenter*l.weight+u.barycenter*u.weight)/(l.weight+u.weight),l.weight+=u.weight):(l.barycenter=u.barycenter,l.weight=u.weight)}}),II=wt((n,t)=>{var r=Yn().Graph,o=qt();t.exports=i;function i(s,c,l,u){u||(u=s.nodes());let p=a(s),d=new r({compound:!0}).setGraph({root:p}).setDefaultNodeLabel(f=>s.node(f));return u.forEach(f=>{let m=s.node(f),g=s.parent(f);(m.rank===c||m.minRank<=c&&c<=m.maxRank)&&(d.setNode(f),d.setParent(f,g||p),s[l](f).forEach(y=>{let b=y.v===f?y.w:y.v,_=d.edge(b,f),k=_!==void 0?_.weight:0;d.setEdge(b,f,{weight:s.edge(y).weight+k})}),Object.hasOwn(m,"minRank")&&d.setNode(f,{borderLeft:m.borderLeft[c],borderRight:m.borderRight[c]}))}),d}function a(s){for(var c;s.hasNode(c=o.uniqueId("_root")););return c}}),BI=wt((n,t)=>{t.exports=r;function r(o,i,a){let s={},c;a.forEach(l=>{let u=o.parent(l),p,d;for(;u;){if(p=o.parent(u),p?(d=s[p],s[p]=u):(d=c,c=u),d&&d!==u){i.setEdge(d,u);return}u=p}})}}),TI=wt((n,t)=>{var r=EI(),o=NI(),i=vI(),a=II(),s=BI(),c=Yn().Graph,l=qt();t.exports=u;function u(m,g={}){if(typeof g.customOrder=="function"){g.customOrder(m,u);return}let y=l.maxRank(m),b=p(m,l.range(1,y+1),"inEdges"),_=p(m,l.range(y-1,-1,-1),"outEdges"),k=r(m);if(f(m,k),g.disableOptimalOrderHeuristic)return;let C=Number.POSITIVE_INFINITY,N,E=g.constraints||[];for(let w=0,S=0;S<4;++w,++S){d(w%2?b:_,w%4>=2,E),k=l.buildLayerMatrix(m);let I=o(m,k);I<C?(S=0,N=Object.assign({},k),C=I):I===C&&(N=structuredClone(k))}f(m,N)}function p(m,g,y){let b=new Map,_=(k,C)=>{b.has(k)||b.set(k,[]),b.get(k).push(C)};for(let k of m.nodes()){let C=m.node(k);if(typeof C.rank=="number"&&_(C.rank,k),typeof C.minRank=="number"&&typeof C.maxRank=="number")for(let N=C.minRank;N<=C.maxRank;N++)N!==C.rank&&_(N,k)}return g.map(function(k){return a(m,k,y,b.get(k)||[])})}function d(m,g,y){let b=new c;m.forEach(function(_){y.forEach(N=>b.setEdge(N.left,N.right));let k=_.graph().root,C=i(_,k,b,g);C.vs.forEach((N,E)=>_.node(N).order=E),s(_,b,C.vs)})}function f(m,g){Object.values(g).forEach(y=>y.forEach((b,_)=>m.node(b).order=_))}}),OI=wt((n,t)=>{var r=Yn().Graph,o=qt();t.exports={positionX:y,findType1Conflicts:i,findType2Conflicts:a,addConflict:c,hasConflict:l,verticalAlignment:u,horizontalCompaction:p,alignCoordinates:m,findSmallestWidthAlignment:f,balance:g};function i(k,C){let N={};function E(w,S){let I=0,j=0,A=w.length,x=S[S.length-1];return S.forEach((O,P)=>{let R=s(k,O),W=R?k.node(R).order:A;(R||O===x)&&(S.slice(j,P+1).forEach(Z=>{k.predecessors(Z).forEach(X=>{let F=k.node(X),J=F.order;(J<I||W<J)&&!(F.dummy&&k.node(Z).dummy)&&c(N,X,Z)})}),j=P+1,I=W)}),S}return C.length&&C.reduce(E),N}function a(k,C){let N={};function E(S,I,j,A,x){let O;o.range(I,j).forEach(P=>{O=S[P],k.node(O).dummy&&k.predecessors(O).forEach(R=>{let W=k.node(R);W.dummy&&(W.order<A||W.order>x)&&c(N,R,O)})})}function w(S,I){let j=-1,A,x=0;return I.forEach((O,P)=>{if(k.node(O).dummy==="border"){let R=k.predecessors(O);R.length&&(A=k.node(R[0]).order,E(I,x,P,j,A),x=P,j=A)}E(I,x,I.length,A,S.length)}),I}return C.length&&C.reduce(w),N}function s(k,C){if(k.node(C).dummy)return k.predecessors(C).find(N=>k.node(N).dummy)}function c(k,C,N){if(C>N){let w=C;C=N,N=w}let E=k[C];E||(k[C]=E={}),E[N]=!0}function l(k,C,N){if(C>N){let E=C;C=N,N=E}return!!k[C]&&Object.hasOwn(k[C],N)}function u(k,C,N,E){let w={},S={},I={};return C.forEach(j=>{j.forEach((A,x)=>{w[A]=A,S[A]=A,I[A]=x})}),C.forEach(j=>{let A=-1;j.forEach(x=>{let O=E(x);if(O.length){O=O.sort((R,W)=>I[R]-I[W]);let P=(O.length-1)/2;for(let R=Math.floor(P),W=Math.ceil(P);R<=W;++R){let Z=O[R];S[x]===x&&A<I[Z]&&!l(N,x,Z)&&(S[Z]=x,S[x]=w[x]=w[Z],A=I[Z])}}})}),{root:w,align:S}}function p(k,C,N,E,w){let S={},I=d(k,C,N,w),j=w?"borderLeft":"borderRight";function A(P,R){let W=I.nodes().slice(),Z={},X=W.pop();for(;X;){if(Z[X])P(X);else{Z[X]=!0,W.push(X);for(let F of R(X))W.push(F)}X=W.pop()}}function x(P){S[P]=I.inEdges(P).reduce((R,W)=>Math.max(R,S[W.v]+I.edge(W)),0)}function O(P){let R=I.outEdges(P).reduce((Z,X)=>Math.min(Z,S[X.w]-I.edge(X)),Number.POSITIVE_INFINITY),W=k.node(P);R!==Number.POSITIVE_INFINITY&&W.borderType!==j&&(S[P]=Math.max(S[P],R))}return A(x,I.predecessors.bind(I)),A(O,I.successors.bind(I)),Object.keys(E).forEach(P=>S[P]=S[N[P]]),S}function d(k,C,N,E){let w=new r,S=k.graph(),I=b(S.nodesep,S.edgesep,E);return C.forEach(j=>{let A;j.forEach(x=>{let O=N[x];if(w.setNode(O),A){var P=N[A],R=w.edge(P,O);w.setEdge(P,O,Math.max(I(k,x,A),R||0))}A=x})}),w}function f(k,C){return Object.values(C).reduce((N,E)=>{let w=Number.NEGATIVE_INFINITY,S=Number.POSITIVE_INFINITY;Object.entries(E).forEach(([j,A])=>{let x=_(k,j)/2;w=Math.max(A+x,w),S=Math.min(A-x,S)});let I=w-S;return I<N[0]&&(N=[I,E]),N},[Number.POSITIVE_INFINITY,null])[1]}function m(k,C){let N=Object.values(C),E=o.applyWithChunking(Math.min,N),w=o.applyWithChunking(Math.max,N);["u","d"].forEach(S=>{["l","r"].forEach(I=>{let j=S+I,A=k[j];if(A===C)return;let x=Object.values(A),O=E-o.applyWithChunking(Math.min,x);I!=="l"&&(O=w-o.applyWithChunking(Math.max,x)),O&&(k[j]=o.mapValues(A,P=>P+O))})})}function g(k,C){return o.mapValues(k.ul,(N,E)=>{if(C)return k[C.toLowerCase()][E];{let w=Object.values(k).map(S=>S[E]).sort((S,I)=>S-I);return(w[1]+w[2])/2}})}function y(k){let C=o.buildLayerMatrix(k),N=Object.assign(i(k,C),a(k,C)),E={},w;["u","d"].forEach(I=>{w=I==="u"?C:Object.values(C).reverse(),["l","r"].forEach(j=>{j==="r"&&(w=w.map(P=>Object.values(P).reverse()));let A=(I==="u"?k.predecessors:k.successors).bind(k),x=u(k,w,N,A),O=p(k,w,x.root,x.align,j==="r");j==="r"&&(O=o.mapValues(O,P=>-P)),E[I+j]=O})});let S=f(k,E);return m(E,S),g(E,k.graph().align)}function b(k,C,N){return(E,w,S)=>{let I=E.node(w),j=E.node(S),A=0,x;if(A+=I.width/2,Object.hasOwn(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":x=-I.width/2;break;case"r":x=I.width/2;break}if(x&&(A+=N?x:-x),x=0,A+=(I.dummy?C:k)/2,A+=(j.dummy?C:k)/2,A+=j.width/2,Object.hasOwn(j,"labelpos"))switch(j.labelpos.toLowerCase()){case"l":x=j.width/2;break;case"r":x=-j.width/2;break}return x&&(A+=N?x:-x),x=0,A}}function _(k,C){return k.node(C).width}}),PI=wt((n,t)=>{var r=qt(),o=OI().positionX;t.exports=i;function i(s){s=r.asNonCompoundGraph(s),a(s),Object.entries(o(s)).forEach(([c,l])=>s.node(c).x=l)}function a(s){let c=r.buildLayerMatrix(s),l=s.graph().ranksep,u=s.graph().rankalign,p=0;c.forEach(d=>{let f=d.reduce((m,g)=>{let y=s.node(g).height;return m>y?m:y},0);d.forEach(m=>{let g=s.node(m);u==="top"?g.y=p+g.height/2:u==="bottom"?g.y=p+f-g.height/2:g.y=p+f/2}),p+=f+l})}}),VI=wt((n,t)=>{var r=hI(),o=gI(),i=_I(),a=qt().normalizeRanks,s=bI(),c=qt().removeEmptyRanks,l=wI(),u=kI(),p=CI(),d=TI(),f=PI(),m=qt(),g=Yn().Graph;t.exports=y;function y(v,H={}){let oe=H.debugTiming?m.time:m.notime;return oe("layout",()=>{let te=oe(" buildLayoutGraph",()=>A(v));return oe(" runLayout",()=>b(te,oe,H)),oe(" updateInputGraph",()=>_(v,te)),te})}function b(v,H,oe){H(" makeSpaceForEdgeLabels",()=>x(v)),H(" removeSelfEdges",()=>$(v)),H(" acyclic",()=>r.run(v)),H(" nestingGraph.run",()=>l.run(v)),H(" rank",()=>i(m.asNonCompoundGraph(v))),H(" injectEdgeLabelProxies",()=>O(v)),H(" removeEmptyRanks",()=>c(v)),H(" nestingGraph.cleanup",()=>l.cleanup(v)),H(" normalizeRanks",()=>a(v)),H(" assignRankMinMax",()=>P(v)),H(" removeEdgeLabelProxies",()=>R(v)),H(" normalize.run",()=>o.run(v)),H(" parentDummyChains",()=>s(v)),H(" addBorderSegments",()=>u(v)),H(" order",()=>d(v,oe)),H(" insertSelfEdges",()=>q(v)),H(" adjustCoordinateSystem",()=>p.adjust(v)),H(" position",()=>f(v)),H(" positionSelfEdges",()=>K(v)),H(" removeBorderNodes",()=>J(v)),H(" normalize.undo",()=>o.undo(v)),H(" fixupEdgeLabelCoords",()=>X(v)),H(" undoCoordinateSystem",()=>p.undo(v)),H(" translateGraph",()=>W(v)),H(" assignNodeIntersects",()=>Z(v)),H(" reversePoints",()=>F(v)),H(" acyclic.undo",()=>r.undo(v))}function _(v,H){v.nodes().forEach(oe=>{let te=v.node(oe),ge=H.node(oe);te&&(te.x=ge.x,te.y=ge.y,te.order=ge.order,te.rank=ge.rank,H.children(oe).length&&(te.width=ge.width,te.height=ge.height))}),v.edges().forEach(oe=>{let te=v.edge(oe),ge=H.edge(oe);te.points=ge.points,Object.hasOwn(ge,"x")&&(te.x=ge.x,te.y=ge.y)}),v.graph().width=H.graph().width,v.graph().height=H.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],C={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},N=["acyclicer","ranker","rankdir","align","rankalign"],E=["width","height","rank"],w={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},j=["labelpos"];function A(v){let H=new g({multigraph:!0,compound:!0}),oe=M(v.graph());return H.setGraph(Object.assign({},C,ae(oe,k),m.pick(oe,N))),v.nodes().forEach(te=>{let ge=M(v.node(te)),me=ae(ge,E);Object.keys(w).forEach(le=>{me[le]===void 0&&(me[le]=w[le])}),H.setNode(te,me),H.setParent(te,v.parent(te))}),v.edges().forEach(te=>{let ge=M(v.edge(te));H.setEdge(te,Object.assign({},I,ae(ge,S),m.pick(ge,j)))}),H}function x(v){let H=v.graph();H.ranksep/=2,v.edges().forEach(oe=>{let te=v.edge(oe);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(H.rankdir==="TB"||H.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function O(v){v.edges().forEach(H=>{let oe=v.edge(H);if(oe.width&&oe.height){let te=v.node(H.v),ge={rank:(v.node(H.w).rank-te.rank)/2+te.rank,e:H};m.addDummyNode(v,"edge-proxy",ge,"_ep")}})}function P(v){let H=0;v.nodes().forEach(oe=>{let te=v.node(oe);te.borderTop&&(te.minRank=v.node(te.borderTop).rank,te.maxRank=v.node(te.borderBottom).rank,H=Math.max(H,te.maxRank))}),v.graph().maxRank=H}function R(v){v.nodes().forEach(H=>{let oe=v.node(H);oe.dummy==="edge-proxy"&&(v.edge(oe.e).labelRank=oe.rank,v.removeNode(H))})}function W(v){let H=Number.POSITIVE_INFINITY,oe=0,te=Number.POSITIVE_INFINITY,ge=0,me=v.graph(),le=me.marginx||0,he=me.marginy||0;function Oe($e){let Pe=$e.x,qe=$e.y,Ye=$e.width,et=$e.height;H=Math.min(H,Pe-Ye/2),oe=Math.max(oe,Pe+Ye/2),te=Math.min(te,qe-et/2),ge=Math.max(ge,qe+et/2)}v.nodes().forEach($e=>Oe(v.node($e))),v.edges().forEach($e=>{let Pe=v.edge($e);Object.hasOwn(Pe,"x")&&Oe(Pe)}),H-=le,te-=he,v.nodes().forEach($e=>{let Pe=v.node($e);Pe.x-=H,Pe.y-=te}),v.edges().forEach($e=>{let Pe=v.edge($e);Pe.points.forEach(qe=>{qe.x-=H,qe.y-=te}),Object.hasOwn(Pe,"x")&&(Pe.x-=H),Object.hasOwn(Pe,"y")&&(Pe.y-=te)}),me.width=oe-H+le,me.height=ge-te+he}function Z(v){v.edges().forEach(H=>{let oe=v.edge(H),te=v.node(H.v),ge=v.node(H.w),me,le;oe.points?(me=oe.points[0],le=oe.points[oe.points.length-1]):(oe.points=[],me=ge,le=te),oe.points.unshift(m.intersectRect(te,me)),oe.points.push(m.intersectRect(ge,le))})}function X(v){v.edges().forEach(H=>{let oe=v.edge(H);if(Object.hasOwn(oe,"x"))switch((oe.labelpos==="l"||oe.labelpos==="r")&&(oe.width-=oe.labeloffset),oe.labelpos){case"l":oe.x-=oe.width/2+oe.labeloffset;break;case"r":oe.x+=oe.width/2+oe.labeloffset;break}})}function F(v){v.edges().forEach(H=>{let oe=v.edge(H);oe.reversed&&oe.points.reverse()})}function J(v){v.nodes().forEach(H=>{if(v.children(H).length){let oe=v.node(H),te=v.node(oe.borderTop),ge=v.node(oe.borderBottom),me=v.node(oe.borderLeft[oe.borderLeft.length-1]),le=v.node(oe.borderRight[oe.borderRight.length-1]);oe.width=Math.abs(le.x-me.x),oe.height=Math.abs(ge.y-te.y),oe.x=me.x+oe.width/2,oe.y=te.y+oe.height/2}}),v.nodes().forEach(H=>{v.node(H).dummy==="border"&&v.removeNode(H)})}function $(v){v.edges().forEach(H=>{if(H.v===H.w){var oe=v.node(H.v);oe.selfEdges||(oe.selfEdges=[]),oe.selfEdges.push({e:H,label:v.edge(H)}),v.removeEdge(H)}})}function q(v){var H=m.buildLayerMatrix(v);H.forEach(oe=>{var te=0;oe.forEach((ge,me)=>{var le=v.node(ge);le.order=me+te,(le.selfEdges||[]).forEach(he=>{m.addDummyNode(v,"selfedge",{width:he.label.width,height:he.label.height,rank:le.rank,order:me+ ++te,e:he.e,label:he.label},"_se")}),delete le.selfEdges})})}function K(v){v.nodes().forEach(H=>{var oe=v.node(H);if(oe.dummy==="selfedge"){var te=v.node(oe.e.v),ge=te.x+te.width/2,me=te.y,le=oe.x-ge,he=te.height/2;v.setEdge(oe.e,oe.label),v.removeNode(H),oe.label.points=[{x:ge+2*le/3,y:me-he},{x:ge+5*le/6,y:me-he},{x:ge+le,y:me},{x:ge+5*le/6,y:me+he},{x:ge+2*le/3,y:me+he}],oe.label.x=oe.x,oe.label.y=oe.y}})}function ae(v,H){return m.mapValues(m.pick(v,H),Number)}function M(v){var H={};return v&&Object.entries(v).forEach(([oe,te])=>{typeof oe=="string"&&(oe=oe.toLowerCase()),H[oe]=te}),H}}),$I=wt((n,t)=>{var r=qt(),o=Yn().Graph;t.exports={debugOrdering:i};function i(a){let s=r.buildLayerMatrix(a),c=new o({compound:!0,multigraph:!0}).setGraph({});return a.nodes().forEach(l=>{c.setNode(l,{label:l}),c.setParent(l,"layer"+a.node(l).rank)}),a.edges().forEach(l=>c.setEdge(l.v,l.w,{},l.name)),s.forEach((l,u)=>{let p="layer"+u;c.setNode(p,{rank:"same"}),l.reduce((d,f)=>(c.setEdge(d,f,{style:"invis"}),f))}),c}}),RI=wt((n,t)=>{t.exports="2.0.4"}),LI=wt((n,t)=>{t.exports={graphlib:Yn(),layout:VI(),debug:$I(),util:{time:qt().time,notime:qt().notime},version:RI()}});const $y=LI();/*! For license information please see dagre.esm.js.LEGAL.txt */function DI(n){return n.map(({source:t,target:r})=>({source:t,target:r}))}function MI(n){const t=[];for(const r of n)for(const o of r.memberIds)t.push({source:r.ownerId,target:o});return t}function Ry(n,t){return[...DI(n),...MI(t)]}function Nl(n,t){const r=new Map;for(const{source:o,target:i}of n)r.has(o)||r.set(o,[]),r.get(o).push(i),r.has(i)||r.set(i,[]);return t&&(r.has(t.source)||r.set(t.source,[]),r.get(t.source).push(t.target),r.has(t.target)||r.set(t.target,[])),r}function Yd(n){const t=new Set,r=new Set;function o(i){if(r.has(i))return!0;if(t.has(i))return!1;t.add(i),r.add(i);for(const a of n.get(i)??[])if(o(a))return!0;return r.delete(i),!1}for(const i of n.keys())if(o(i))return!0;return!1}function Jd(n,t){const r=n.config;if(!r)return[];const o=r[t];return Array.isArray(o)?o.filter(i=>typeof i=="string"&&qd(i)):[]}function jI({state:n,groupMapById:t,getNodeById:r,history:o}){const i=e.computed(()=>{const x=new Map;for(const O of n.value.groups)for(const P of O.memberIds)x.set(P,{ownerId:O.ownerId,branch:O.branch});return x}),a=e.computed(()=>{const x=new Map;for(const O of n.value.groups)for(const P of O.memberIds)x.set(P,O);return x}),s=e.computed(()=>{const x=new Map;for(const O of n.value.groups)x.has(O.ownerId)||x.set(O.ownerId,[]),x.get(O.ownerId).push(O);return x}),c=e.computed(()=>Ry(n.value.edges,n.value.groups)),l=e.computed(()=>Nl(c.value));function u(x,O){return x?Ia(x.type).includes(O):!1}function p(x,O){if(O===x.id)return!1;const P=r(O);return!(!P||pn(P.type)||P.phase!==x.phase)}function d(x,O){const P=[],R=new Set;for(const W of O)R.has(W)||(R.add(W),p(x,W)&&P.push(W));return P}function f(x,O,P){const R=r(x);return u(R,O)?d(R,P):[]}function m(x,O,P){const R=zd(x.id,O),W=t.value.get(R);P.length>0?W?(W.phase!==x.phase&&(W.phase=x.phase),Gd(W.memberIds,P)||(W.position=void 0,W.dimensions=void 0,W.memberIds=[...P])):n.value.groups.push(Oy(x.id,O,x.phase,P)):W&&(n.value.groups=n.value.groups.filter(Z=>Z.id!==R))}function g(x,O,P,R={}){const W=r(x);if(!u(W,O))return!1;const Z=d(W,P),X=Jd(W,O);if(Gd(X,Z))return!1;const F=W.config??(W.config={});return Z.length>0?F[O]=[...Z]:(delete F[O],Object.keys(F).length===0&&delete W.config),m(W,O,Z),(R.commit??!0)&&o.commit(R.tag),!0}function y(x,O={}){const P=n.value.groups.filter(R=>R.ownerId!==x);return P.length===n.value.groups.length?!1:(n.value.groups=P,(O.commit??!0)&&o.commit(O.tag),!0)}function b(x,O){const P=t.value.get(zd(x,O));if(P)return[...P.memberIds];const R=r(x);return R?Jd(R,O):[]}function _(x){return i.value.get(x)}function k(x){const O=[];let P=a.value.get(x);for(;P;)O.push(P.id),P=a.value.get(P.ownerId);return O}function C(x,O){const P=k(O);if(P.length===0)return!1;const R=new Set(k(x));return R.size===0?!0:P.some(W=>!R.has(W))}function N(x,O){if(x===O)return!0;const P=new Set,R=[O];for(;R.length>0;){const W=R.pop();if(P.has(W))continue;if(P.add(W),W===x)return!0;const Z=l.value.get(W);if(Z)for(const X of Z)P.has(X)||R.push(X)}return!1}function E(x,O,P){const R=r(x);return!(!u(R,O)||!p(R,P)||N(x,P))}function w(x,O,P,R={}){const W=r(x);if(!W||!E(x,O,P))return!1;const Z=Jd(W,O);if(Z.includes(P))return!1;S(P,{commit:!1});const X=[...Z,P];return g(x,O,X,{commit:!1})?((R.commit??!0)&&o.commit(R.tag),!0):!1}function S(x,O={}){const P=_(x);if(!P)return!1;const R=b(P.ownerId,P.branch),W=R.filter(Z=>Z!==x);return W.length===R.length?!1:g(P.ownerId,P.branch,W,O)}function I(x){let O=0;const P=new Set;let R=a.value.get(x);for(;R&&!P.has(R.id);)O+=1,P.add(R.id),R=a.value.get(R.ownerId);return O}function j(x){const O=t.value.get(x);return O?I(O.ownerId):0}function A(x){return x?t.value.has(x):!1}return{memberGroupMap:a,groupsByOwner:s,findMembership:_,getMembers:b,wouldCreateCycle:N,setMembers:g,prepareMembers:f,addMember:w,removeMember:S,clear:y,getNodeDepth:I,getGroupDepth:j,isGroupId:A,isEdgeEnteringGroup:C,canAddMember:E}}function FI(n,t){const{commit:r,undo:o,redo:i,canUndo:a,canRedo:s,clear:c,reset:l,undoStack:u,redoStack:p}=Tt.useManualRefHistory(n,{capacity:t==null?void 0:t.capacity,clone:t==null?void 0:t.clone});let d;function f(C){var N;(N=t==null?void 0:t.onHistoryChange)==null||N.call(t,C,n.value)}function m(C){if(!C){d=void 0,r(),f("commit");return}if(C!=="*"&&d!==C){d=C,r(),f("commit");return}r(),u.value.shift(),f("commit")}function g(){o(),d=void 0,f("undo")}function y(){i(),d=void 0,f("redo")}function b(){c(),d=void 0,f("clear")}function _(){l(),d=void 0,f("reset")}function k(){o(),p.value.shift(),d=void 0,f("revert")}return{canUndo:a,canRedo:s,commit:m,undo:g,redo:y,clear:b,reset:_,revert:k}}function UI(n){var t,r;return((r=(t=n.config)==null?void 0:t.resources)==null?void 0:r.vault)||{}}function KI(n){const{resources:t}=n.config||{};return t!=null&&t.vault?Object.keys(t.vault):[]}function qI(n){const t=Object.entries(n);if(t.length===0)return;const r={};for(const[o,i]of t)r[o]=i;return r}function Ly(n,t){var b,_,k,C,N,E,w;const r=((b=n.config)==null?void 0:b.nodes)??[],o=((_=n.__ui_data)==null?void 0:_.nodes)??[],i=((k=n.__ui_data)==null?void 0:k.groups)??[],a=new Map(o.map(S=>[S.name,S])),s=new Map(i.map(S=>[S.name,S])),c=[],l=[],u=new Map,p=[],d=[],f=new Map,m=S=>{const I=new Set,j=[...S];for(;j.length>0;){const A=j.shift();if(!I.has(A)&&(I.add(A),Kd(A)||(u.get(A).phase="request"),!!f.has(A)))for(const x of f.get(A))I.has(x)||j.push(x)}};let g=!1;for(const S of r){const I=a.get(S.name);!I&&!g&&(g=!0);const j=My({type:S.type,configNode:S,uiNode:I,pluginData:n});c.push(j),u.set(j.name,j)}for(const S of c){const I=Ia(S.type);if(!I.length)continue;const j=S.config;if(j)for(const A of I){const x=j[A];if(!Array.isArray(x)){s.has(kl(S.name,A))&&(g=!0);continue}const O=[];for(const P of x){if(typeof P!="string")continue;const R=u.get(P);R&&!pn(R.type)&&O.push(R.id)}if(O.length){j[A]=O;const P=kl(S.name,A),R=s.get(P),W=R?{position:vr(R.position)}:void 0,Z=Oy(S.id,A,S.phase,O,W);p.push(Z),!R&&!g&&(g=!0)}else delete j[A],s.has(kl(S.name,A))&&(g=!0)}}for(const S of ei)if(!u.has(S)){let I=a.get(S);I||(g||(g=!0),I=dI(S));const j=My({type:S,uiNode:I,pluginData:n});c.push(j),u.set(j.name,j)}for(const S of r)zI(S,d);for(const S of d){const I=u.get(S.source),j=u.get(S.target);if(!I||!j){I||console.warn(`[initEditorState] skip: source "${S.source}" not found`),j||console.warn(`[initEditorState] skip: target "${S.target}" not found`);continue}f.has(S.source)||f.set(S.source,new Set),f.get(S.source).add(S.target),f.has(S.target)||f.set(S.target,new Set),f.get(S.target).add(S.source),l.push({id:ri("edge"),source:I.id,sourceField:(C=Yr(I,"output",S.sourceField))==null?void 0:C.id,target:j.id,targetField:(N=Yr(j,"input",S.targetField))==null?void 0:N.id})}m(["request","service_request"]);let y=null;return(w=(E=n.config)==null?void 0:E.resources)!=null&&w.cache&&(y={...n.config.resources.cache},n.partials&&(y.partial_id=n.partials[0].id)),{nodes:c,edges:l,groups:p,pendingLayout:g?t?"keepHistory":"clearHistory":!1,pendingFitView:!0,...y?{cacheConfig:y}:{}}}function Dy(n){const{type:t,name:r,phase:o,position:i,fields:a,config:s}=n,c=vy(t),l=oi(t);return{id:ri("node"),type:t,name:r??t,phase:o??"request",position:i??{x:0,y:0},expanded:{},fields:{input:Iy((a==null?void 0:a.input)??c.input),output:Iy((a==null?void 0:a.output)??c.output)},hidden:n.hidden||l.hidden,config:s?vr(s):{}}}function GI(n){return pn(n)?n==="request"||n==="service_request"?"request":"response":"request"}function My({type:n,configNode:t,uiNode:r,pluginData:o}){return Dy({type:n,name:t==null?void 0:t.name,phase:(r==null?void 0:r.phase)??GI(n),position:r==null?void 0:r.position,fields:WI({type:n,uiNode:r,configNode:t,pluginData:o}),hidden:r==null?void 0:r.hidden,config:YI({type:n,configNode:t,pluginData:o})})}function HI(n){const{type:t,name:r,input:o,inputs:i,output:a,outputs:s,...c}=n;return vr(c)}function zI(n,t){const r=n.name;if(n.input){const{nodeName:o,fieldName:i}=wl(n.input);o&&t.push({source:o,sourceField:i,target:r})}if(n.inputs)for(const[o,i]of Object.entries(n.inputs)){if(!i)continue;const{nodeName:a,fieldName:s}=wl(i);a&&t.push({source:a,sourceField:s,target:r,targetField:o})}if(n.output){const{nodeName:o,fieldName:i}=wl(n.output);o&&t.push({source:r,target:o,targetField:i})}if(n.outputs)for(const[o,i]of Object.entries(n.outputs)){if(!i)continue;const{nodeName:a,fieldName:s}=wl(i);a&&t.push({source:r,sourceField:o,target:a,targetField:s})}}function WI({type:n,uiNode:t,configNode:r,pluginData:o}){var c,l,u,p;const i=oi(n),a=i==null?void 0:i.io;if(!a)return;const s={};if((c=a.input)!=null&&c.configurable&&(t?s.input=((l=t.fields)==null?void 0:l.input)??[]:r!=null&&r.inputs&&(s.input=Object.keys(r.inputs))),(u=a.output)!=null&&u.configurable){if(t)s.output=((p=t.fields)==null?void 0:p.output)??[];else{const d=new Set;r!=null&&r.outputs&&Object.keys(r.outputs).forEach(f=>d.add(f)),(r==null?void 0:r.type)==="static"&&r.values&&Object.keys(r.values).forEach(f=>d.add(f)),d.size&&(s.output=Array.from(d))}n==="vault"&&(s.output=KI(o))}return Object.keys(s).length?s:void 0}function YI({type:n,configNode:t,pluginData:r}){return n==="vault"?UI(r):t?HI(t):void 0}function JI(n){const t=e.computed(()=>{const d=new Map;return n.value.nodes.forEach(f=>d.set(f.id,f)),d}),r=e.computed(()=>n.value.edges),o=e.computed(()=>n.value.groups),i=e.computed(()=>Ry(r.value,o.value));function a(d){return Nl(i.value,d?{source:d.source,target:d.target}:void 0)}function s(d){const f=t.value.get(d.source),m=t.value.get(d.target);if(!f||!m)return d;const g=By(f,d.sourceField)&&!Hd(f,d.sourceField),y=Hd(m,d.targetField);return g&&y?{source:d.target,sourceField:d.targetField,target:d.source,targetField:d.sourceField}:d}function c(d){const f=s(d),m=[],g=t.value.get(f.source),y=t.value.get(f.target);if(g||m.push("source node not found"),y||m.push("target node not found"),!g||!y)return{ok:!1,errors:m};Hd(g,f.sourceField)||m.push("source handle is not an output field"),By(y,f.targetField)||m.push("target handle is not an input field"),y.name==="request"&&m.push('cannot target "request"'),g.name==="response"&&m.push('cannot source from "response"');const b=r.value.some(C=>C.target===f.target&&!C.targetField),_=r.value.some(C=>C.target===f.target&&!!C.targetField);(b&&f.targetField||_&&!f.targetField)&&m.push("cannot mix whole-node and field-level inputs on same target"),f.targetField&&r.value.some(C=>C.target===f.target&&C.targetField===f.targetField)&&m.push("target field already connected"),!f.targetField&&r.value.some(C=>C.target===f.target&&!C.targetField)&&m.push("target input already taken"),f.source===f.target&&m.push("self-loop not allowed");const k=a({source:f.source,target:f.target});return Yd(k)&&m.push("connection introduces a cycle"),m.length?{ok:!1,errors:m}:{ok:!0}}function l(){const d=[];for(const f of ei)[...t.value.values()].some(m=>m.name===f)||d.push(`missing implicit node "${f}"`);for(const f of r.value){const m=t.value.get(f.source);t.value.get(f.target).name==="request"&&d.push(`edge "${f.id}" targets "request"`),m.name==="response"&&d.push(`edge "${f.id}" sources from "response"`)}return Yd(a())&&d.push("graph contains cycle"),d.length?{ok:!1,errors:d}:{ok:!0}}function u(d){return c(d).ok}function p(d){return!d.source||!d.target?!1:u({source:d.source,sourceField:d.sourceHandle,target:d.target,targetField:d.targetHandle})}return{canonicalizeConnection:s,validateConnection:c,validateGraph:l,isValidConnection:u,isValidVueFlowConnection:p,buildAdjacency:Nl}}const[Xd,XI]=Tt.createInjectionState(function(t,r={}){const o=e.ref(Ly(t)),i=e.ref(),a=e.ref(),s=e.ref(!1),c=e.ref(!1),l=FI(o,{capacity:200,clone:vr,onHistoryChange:ee=>{var se,ue;ee!=="clear"&&((ue=r.onChange)==null||ue.call(r,et(),ye(),ke(),(se=o.value.cacheConfig)==null?void 0:se.partial_id))}}),u=e.ref(!1),p=e.ref(new Set);function d(){o.value.pendingLayout=!1,l.commit("*")}function f(ee=!0){o.value.pendingFitView!==ee&&(o.value.pendingFitView=ee,l.commit("*"))}const m=e.computed(()=>{const ee={request:0,response:0};return o.value.nodes.forEach(se=>{pn(se.type)||ee[se.phase]++}),ee}),g=e.computed(()=>new Map(o.value.nodes.map(ee=>[ee.id,ee]))),y=e.computed(()=>new Map(o.value.nodes.map(ee=>[ee.name,ee]))),b=e.computed(()=>{const ee=new Map,se=new Map;for(const ue of o.value.edges)ee.set(ue.id,ue),se.has(ue.source)||se.set(ue.source,new Set),se.get(ue.source).add(ue.id),se.has(ue.target)||se.set(ue.target,new Set),se.get(ue.target).add(ue.id);return{edgeMapById:ee,edgeIdMapByNodeId:se}}),_=e.computed(()=>b.value.edgeMapById),k=e.computed(()=>b.value.edgeIdMapByNodeId),C=e.computed(()=>new Map(o.value.groups.map(ee=>[ee.id,ee]))),N=e.computed(()=>new Set(o.value.nodes.map(ee=>ee.name))),E=jI({state:o,groupMapById:C,getNodeById:x,history:l}),{canonicalizeConnection:w,validateConnection:S,validateGraph:I,isValidConnection:j,isValidVueFlowConnection:A}=JI(o);function x(ee){return g.value.get(ee)}function O(ee){return y.value.get(ee)}function P(ee){return _.value.get(ee)}function R(ee){if(!k.value.has(ee))return[];const se=[];return k.value.get(ee).forEach(ue=>{const Ee=P(ue);Ee&&se.push(Ee)}),se}function W(ee){return R(ee).filter(se=>se.target===ee)}function Z(ee){return R(ee).filter(se=>se.source===ee)}const X=e.computed(()=>i.value?x(i.value):void 0);function F(ee){i.value=ee}function J(ee){a.value=ee}function $(ee){if(pn(ee.type))throw new Error("[createNode] implicit nodes are fixed.");return Dy({type:ee.type,name:ee.name||(pn(ee.type)?void 0:Ty(ee.type,N.value)),phase:ee.phase,position:ee.position,fields:ee.fields,config:ee.config})}function q(ee,se=!0){const ue=$(ee);if(ue)return o.value.nodes.push(ue),se&&l.commit(),u.value=!0,ue.id}function K(ee,se,ue=!0){const Ee=x(ee);if(!Ee||pn(Ee.type))return;const be={...vr(Ee),id:ri("node"),name:Ty(Ee.name,N.value),position:se??{x:Ee.position.x+20,y:Ee.position.y+20}},xe=Ia(be.type);if(xe.length&&be.config){for(const h of xe)delete be.config[h];Object.keys(be.config).length===0&&delete be.config}return o.value.nodes.push(be),ue&&l.commit(),u.value=!0,be.id}function ae(ee,se=!0){if(!x(ee))return;o.value.edges=o.value.edges.filter(be=>be.source!==ee&&be.target!==ee),E.clear(ee,{commit:!1}),E.removeMember(ee,{commit:!1}),o.value.nodes=o.value.nodes.filter(be=>be.id!==ee),i.value===ee&&(i.value=void 0);const Ee=I();Ee.ok||console.warn("[removeNode] topology invalid:",Ee.errors.join("; ")),se&&l.commit()}function M(ee,se,ue=!0,Ee){const be=x(ee);if(!be)return;if(Kd(be.name)){console.warn("[renameNode] implicit node name is reserved.");return}be.name!==se&&(be.name=se,ue&&l.commit(Ee))}function v(ee,se,ue=!0){const Ee=x(ee);Ee&&(Ee.position={...se},ue&&l.commit())}function H(ee,se,ue=!0){const Ee=C.value.get(ee);if(!Ee)return;const be=Ee.position;be&&be.x===se.x&&be.y===se.y||(Ee.position={...se},ue&&l.commit())}function oe(ee,se,ue=!0){const Ee=C.value.get(ee);if(!Ee)return!1;const be={...se.position},xe={...se.dimensions},h=Ee.position&&Ee.position.x===be.x&&Ee.position.y===be.y,T=Ee.dimensions&&Ee.dimensions.width===xe.width&&Ee.dimensions.height===xe.height;return h&&T?!1:(Ee.position=be,Ee.dimensions=xe,ue&&l.commit(),!0)}function te(ee,se,ue,Ee=!0,be){const xe=x(ee);if(!xe)return;const h=ue??!xe.expanded[se];h!==!!xe.expanded[se]&&(xe.expanded[se]=h,Ee&&l.commit(be??`toggle:${ee}:${se}`))}function ge(ee,se,ue=!0,Ee){const be=x(ee);be&&(be.config=vr(se),ue&&l.commit(Ee))}function me(ee,se,ue,Ee=!0){const be=x(ee);if(!be)return;const xe=be.fields[se];if(xe.some(h=>h.name===ue)){console.warn(`[addField] field "${ue}" already exists on ${se}.`);return}xe.push({id:ri("field"),name:ue}),se==="input"?be.fields.input=xe:be.fields.output=xe,Ee&&l.commit()}function le(ee,se,ue,Ee=!0){const be=x(ee);if(!be)return;const xe=be.fields.input,h=be.fields.output,T=xe.find(G=>G.id===se)??h.find(G=>G.id===se);T&&(T.name=ue,Ee&&l.commit())}function he(ee,se,ue=!0,Ee=!0){const be=x(ee);if(!be)return;const xe=be.fields.input,h=be.fields.output,T=xe.findIndex(re=>re.id===se);T>=0&&xe.splice(T,1);const G=h.findIndex(re=>re.id===se);G>=0&&h.splice(G,1),be.fields.input=xe,be.fields.output=h,ue&&(o.value.edges=o.value.edges.filter(re=>re.sourceField!==se&&re.targetField!==se));const Y=I();Y.ok||console.warn("[removeField] topology invalid:",Y.errors.join("; ")),Ee&&l.commit()}function Oe(ee,se=!0){const ue=w(ee),Ee=S(ue);if(!Ee.ok){console.warn("[connectEdge] invalid connection:",Ee.errors.join("; "));return}const be={id:ri("edge"),...ue};o.value.edges.push(be);const xe=I();if(!xe.ok){o.value.edges.pop(),console.warn("[connectEdge] topology invalid:",xe.errors.join("; "));return}return se&&l.commit(),be.id}function $e(ee,se,ue=!0){Pe(ee,!1),Oe(se,!1),ue&&l.commit()}function Pe(ee,se=!0){const ue=o.value.edges.findIndex(xe=>xe.id===ee);if(ue<0)return;const Ee=o.value.edges[ue];o.value.edges.splice(ue,1);const be=I();if(!be.ok){o.value.edges.splice(ue,0,Ee),console.warn("[disconnectEdge] topology invalid:",be.errors.join("; "));return}se&&l.commit()}function qe(ee,se=!0){const ue=W(ee);for(const Ee of ue)Pe(Ee.id,!1);se&&l.commit()}function Ye(ee,se=!0){const ue=Z(ee);for(const Ee of ue)Pe(Ee.id,!1);se&&l.commit()}function et(){var se,ue,Ee,be,xe;const ee=[];for(const h of o.value.nodes){if(pn(h.type))continue;let T;const G={};let Y;const re={};for(const z of o.value.edges.filter(V=>V.target===h.id)){const V=x(z.source);if(!V)continue;const D=(se=Jr(V,"output",z.sourceField))==null?void 0:se.name,ne=D?`${V.name}.${D}`:V.name,ce=(ue=Jr(h,"input",z.targetField))==null?void 0:ue.name;ce?G[ce]=ne:T===void 0&&(T=ne)}for(const z of o.value.edges.filter(V=>V.source===h.id)){const V=x(z.target);if(!V)continue;const D=V.type;if(!pn(D)||!((Ee=_l[D].io)!=null&&Ee.input))continue;const ne=(be=Jr(V,"input",z.targetField))==null?void 0:be.name,ce=ne?`${V.name}.${ne}`:V.name,Ce=(xe=Jr(h,"output",z.sourceField))==null?void 0:xe.name;Ce?re[Ce]=ce:Y===void 0&&(Y=ce)}const we={...vr(h.config),name:h.name,type:h.type},L=Ia(h.type);if(L.length)for(const z of L){const V=we[z];if(!Array.isArray(V))continue;const D=[];for(const ne of V){const ce=x(ne);ce&&D.push(ce.name)}D.length?we[z]=Array.from(new Set(D)):delete we[z]}Object.keys(G).length>0?we.inputs=G:T!==void 0&&(we.input=T),Object.keys(re).length>0?we.outputs=re:Y!==void 0&&(we.output=Y),ee.push(we)}return ee}function Ve(){return o.value.nodes.map(ee=>vr({name:ee.name,phase:ee.phase,position:{...ee.position},expanded:{...ee.expanded},fields:{input:ee.fields.input.map(se=>se.name),output:ee.fields.output.map(se=>se.name)}}))}function ke(){const ee={},se=O("vault");if(se){const ue=qI(se.config);ue&&Object.keys(ue).length>0&&(ee.vault=ue)}if(o.value.cacheConfig){const{strategy:ue,redis:Ee,memory:be}=o.value.cacheConfig;ee.cache={strategy:ue,redis:Ee,memory:be}}if(Object.keys(ee).length!==0)return ee}function _e(){const ee=[];for(const se of o.value.groups){const ue=x(se.ownerId);if(!ue)continue;const Ee=se.position;Ee&&ee.push({name:kl(ue.name,se.branch),position:{...Ee}})}return ee}function ye(){return{nodes:Ve(),groups:_e()}}function ie(ee,se){se&&l.commit(),o.value=Ly(ee,se),se||l.clear()}return{state:o,selection:i,portalSelection:a,modalOpen:s,skipValidation:u,invalidConfigNodeIds:p,propertiesPanelOpen:c,configNodeCounts:m,nodeMapById:g,nodeMapByName:y,edgeMapById:_,edgeIdMapByNodeId:k,groupMapById:C,getNodeById:x,getNodeByName:O,getEdgeById:P,getEdgesByNodeId:R,getInEdgesByNodeId:W,getOutEdgesByNodeId:Z,selectedNode:X,selectNode:F,selectPortalEdge:J,createNode:$,addNode:q,duplicateNode:K,removeNode:ae,renameNode:M,moveNode:v,moveGroup:H,setGroupLayout:oe,toggleExpanded:te,replaceConfig:ge,branchGroups:E,addField:me,renameField:le,removeField:he,connectEdge:Oe,replaceConnection:$e,disconnectEdge:Pe,disconnectInEdges:qe,disconnectOutEdges:Ye,toConfigNodes:et,toUINodes:Ve,toUIGroups:_e,toUIData:ye,load:ie,commit:l.commit,undo:l.undo,redo:l.redo,canUndo:l.canUndo,canRedo:l.canRedo,clear:l.clear,reset:l.reset,revert:l.revert,isValidConnection:j,isValidVueFlowConnection:A,validateGraph:()=>I(),clearPendingLayout:d,setPendingFitView:f}});function Pt(){const n=XI();if(!n)throw new Error("Editor state is not provided. Ensure you are using provideEditorStore in a parent component.");return n}function ZI(n){const{branchLayout:t,phase:r,layoutOptions:o,nodes:i,edges:a}=n,{findNode:s}=Nt.useVueFlow(),{state:c,branchGroups:l,getNodeById:u,moveNode:p,commit:d}=Pt(),{getNodeDepth:f,isGroupId:m,groupsByOwner:g}=l,{isBranchEdgeId:y,updateGroupLayout:b,translateGroupTree:_,waitForLayoutFlush:k}=t,{viewport:C,padding:N=zr.padding,gaps:E=zr.gaps}=o,{nodes:w=zr.gaps.nodes,edges:S=zr.gaps.edges,ranks:I=zr.gaps.ranks}=E;async function j(O=!0){const P=new Map(i.value.map(v=>[v.id,v.data])),R=new Map,W=new Map,Z=v=>{if(!v)return;let H=W.get(v);return H||(H=s(v),H&&W.set(v,H),H)},X=new Map,F=v=>{let H=X.get(v);return H!==void 0||(H=f(v),X.set(v,H)),H},J=v=>{if(!va(v.data))return v.parentNode;const H=Z(v.data.ownerId);if(!H)throw new Error(`Cannot find owner node '${v.data.ownerId}' for group node '${v.id}' via findNode`);return H.parentNode};for(const v of a.value){if(y(v.id))continue;const H=v.source,oe=v.target;if(m(H)||m(oe))continue;const te=Z(H),ge=Z(oe);if(te){if(!ge)throw new Error(`Cannot find target node '${oe}' for edge '${v.id}' via findNode`)}else throw new Error(`Cannot find source node '${H}' for edge '${v.id}' via findNode`);if(J(te)===J(ge))continue;let me=te,le=ge,he=F(me.id),Oe=F(le.id);for(;he!==Oe;)if(he>Oe){const $e=J(me);if(!$e)throw new Error(`Expected node '${me.id}' to have parent, but it does not`);const Pe=Z($e);if(!Pe)throw new Error(`Cannot find parent node '${$e}' for node '${me.id}' via findNode`);me=Pe,he--}else if(Oe>he){const $e=J(le);if(!$e)throw new Error(`Expected node '${le.id}' to have parent, but it does not`);const Pe=Z($e);if(!Pe)throw new Error(`Cannot find parent node '${$e}' for node '${le.id}' via findNode`);le=Pe,Oe--}for(;he>=0;){const $e=J(me),Pe=J(le);if($e===Pe){R.has(he)||R.set(he,[]),R.get(he).push({v:me.id,w:le.id});break}if($e){if(!Pe){const et=`Expected node '${le.id}' to have parent, but it does not`;throw console.error(et,le),new Error(et)}}else{const et=`Expected node '${me.id}' to have parent, but it does not`;throw console.error(et,me),new Error(et)}const qe=Z($e),Ye=Z(Pe);if(qe){if(!Ye)throw new Error(`Cannot find parent node '${Pe}' for node '${le.id}' via findNode`)}else throw new Error(`Cannot find parent node '${$e}' for node '${me.id}' via findNode`);me=qe,le=Ye,he--,Oe--}}const $=c.value.groups.toSorted((v,H)=>F(H.ownerId)-F(v.ownerId));for(const v of $)A(v.memberIds.reduce((H,oe)=>{const te=u(oe);if(!te)return console.warn(`Cannot find node '${oe}' of group '${v.id}' by getNodeById`),H;if(te.phase!==r)return H;if(te.type==="branch"){const ge=g.value.get(te.id);ge&&H.push(...ge)}return P.delete(te.id),H.push(te),H},[]),{virtualEdges:R.get(F(v.ownerId)),cachedFindNode:Z}),await e.nextTick(),b(v.id,!1),await k();const q=P.values().toArray();for(const v of q){if(va(v)||v.type!=="branch")continue;const H=g.value.get(v.id);H&&q.push(...H)}const{autoNodes:K,leftNode:ae,rightNode:M}=x(q);A(K,{leftNode:ae,rightNode:M,virtualEdges:R.get(0),cachedFindNode:Z}),O&&d()}function A(O,P){var me,le,he,Oe,$e;const{leftNode:R,rightNode:W,virtualEdges:Z,cachedFindNode:X}=P||{},F=R?(X??s)(R.id):void 0,J=W?(X??s)(W.id):void 0;let $;if(O.length>0){$=new $y.graphlib.Graph({multigraph:!0}),$.setGraph({rankdir:r==="request"?"LR":"RL",nodesep:w,edgesep:S,ranksep:I});const Pe=new Set;for(const qe of O){const Ye=(X??s)(qe.id);if(!Ye){console.warn(`Cannot find graph node '${qe.id}' in ${r} phase`);continue}Pe.add(qe.id),va(qe)?$.setNode(qe.id,{...qe.dimensions??Ye.dimensions}):$.setNode(qe.id,{...Ye.dimensions})}for(const qe of a.value)!Pe.has(qe.source)||!Pe.has(qe.target)||$.setEdge(qe.source,qe.target,{points:[]});Z==null||Z.forEach(qe=>$.setEdge(qe,{points:[]})),$y.layout($)}const q=[],K=Pe=>({x:Pe.x-Pe.width/2,y:Pe.y-Pe.height/2,width:Pe.width,height:Pe.height});if(O.length>0){if(!$)throw new Error("Expected dagreGraph to be initialized");for(const Pe of O){const qe=$.node(Pe.id),Ye=K(qe);q.push(Ye),va(Pe)?_(Pe.id,Ye,Ye.x+Wo,Ye.y+Wo):p(Pe.id,{x:Ye.x,y:Ye.y},!1)}}const ae=q.length>0?Py(q):{x:0,y:0,width:0,height:0},M=ae.width,v=ae.height,H=ae.x,oe=ae.x+ae.width,te=Math.max(0,Math.min(e.toValue(C==null?void 0:C.width)??Number.POSITIVE_INFINITY,N1)-M-2*w-(((me=F==null?void 0:F.dimensions)==null?void 0:me.width)??0)-(((le=J==null?void 0:J.dimensions)==null?void 0:le.width)??0)-2*N),ge=ae.y+v/2;R&&p(R.id,{x:H-w-te/2-(((he=F==null?void 0:F.dimensions)==null?void 0:he.width)??0),y:ge-(((Oe=F==null?void 0:F.dimensions)==null?void 0:Oe.height)??0)/2},!1),W&&p(W.id,{x:oe+w+te/2,y:ge-((($e=J==null?void 0:J.dimensions)==null?void 0:$e.height)??0)/2},!1)}function x(O){let P,R;const W=[];for(const Z of O){if(va(Z)){W.push(Z);continue}switch(Z.name){case"request":{if(r!=="request")throw new Error(`Unexpected request node in ${r} phase`);if(P)throw new Error("Duplicated request node in request phase");P=Z;break}case"service_request":{if(r!=="request")throw new Error(`Unexpected service_request node in ${r} phase`);if(R)throw new Error("Duplicated service_request node in request phase");R=Z;break}case"service_response":{if(r!=="response")throw new Error(`Unexpected service_response node in ${r} phase`);if(R)throw new Error("Duplicated service_response node in response phase");R=Z;break}case"response":{if(r!=="response")throw new Error(`Unexpected response node in ${r} phase`);if(P)throw new Error("Duplicated response node in response phase");P=Z;break}default:{W.push(Z);break}}}return{autoNodes:W,leftNode:P,rightNode:R}}return{autoLayout:j}}function QI({phase:n,groupMapById:t,getNodeDepth:r,canAddMember:o,draggingId:i}){const a=e.shallowRef(),s=e.shallowRef();function c(d){a.value=d,s.value=void 0}function l(){a.value&&(a.value=void 0,s.value=void 0)}function u(d){let f;const m=i==null?void 0:i.value;return t.value.forEach(g=>{if(g.phase!==n||m&&qd(m)&&!o(g.ownerId,g.branch,m))return;const y=g.position,b=g.dimensions;if(!y||!b||!(d.x>=y.x&&d.x<=y.x+b.width&&d.y>=y.y&&d.y<=y.y+b.height))return;const k=r(g.ownerId);(!f||k>f.depth)&&(f={depth:k,id:g.id})}),f==null?void 0:f.id}function p(d){if(!a.value){s.value=void 0;return}if(!d){s.value=void 0;return}s.value=u(d)}return{activeGroupId:s,start:c,updateActiveGroup:p,end:l}}function eB({phase:n,readonly:t,flowId:r,draggingId:o}){const{findNode:i}=Nt.useVueFlow(r),a=Pt(),{state:s,groupMapById:c,getNodeById:l,moveNode:u,moveGroup:p,setGroupLayout:d,commit:f,branchGroups:m}=a,{memberGroupMap:g,groupsByOwner:y,getNodeDepth:b,getGroupDepth:_}=m,k=J=>!!J&&J.startsWith("branch:");function C(J){const $=[];for(const q of J.memberIds){const K=l(q);K&&$.push(K)}return $}const N=e.computed(()=>{const J=new Map;return g.value.forEach(($,q)=>{if($.phase!==n||!$.position)return;const K=l(q);K&&(K.phase!==n||K.hidden||J.set(q,$))}),J}),E=e.computed(()=>{const J=new Map;return y.value.forEach(($,q)=>{const K=$.filter(ae=>ae.phase===n);K.length>0&&J.set(q,K)}),J}),w=e.computed(()=>{const J=[];for(const $ of s.value.groups){const q=l($.ownerId);if(!q||q.phase!==n)continue;const K=$.position,ae=$.dimensions;if(!K||!ae)continue;const M=C($).filter(H=>H.phase===n&&!H.hidden),v=_($.id);J.push({id:$.id,type:"group",position:K,width:ae.width,height:ae.height,data:{...$,memberIds:M.map(H=>H.id)},draggable:!t,selectable:!1,zIndex:v*rl+w1})}return J}),S=e.computed(()=>{let J=0;for(const $ of s.value.groups){if($.phase!==n)continue;const q=_($.id);q>J&&(J=q)}return J}),I=e.computed(()=>{const J=[];for(const $ of s.value.groups){if($.phase!==n||!$.position||!$.dimensions)continue;const q=l($.ownerId);if(!q||q.phase!==n||q.hidden||!C($).filter(v=>v.phase===n&&!v.hidden).length)continue;const ae=Math.max(b(q.id),_($.id))+S.value+1,M={id:`branch:${$.id}`,source:q.id,target:$.id,sourceHandle:`branch@${$.branch}`,targetHandle:"input",markerEnd:Nt.MarkerType.ArrowClosed,selectable:!1,focusable:!1,updatable:!1,data:{type:"branch",ownerId:q.id,branch:$.branch,groupId:$.id},zIndex:ae*rl+C1};J.push(M)}return J}),j=new Map,A=new Map;let x;function O(J,$=!0){if(J.phase!==n)return;const q=C(J).filter(H=>H.phase===n&&!H.hidden);if(!q.length)return;const K=[];for(const H of q){const oe=i(H.id),te=oe==null?void 0:oe.dimensions,ge=(te==null?void 0:te.width)??0,me=(te==null?void 0:te.height)??0;if(ge<=0||me<=0)return;K.push({...H.position,width:ge,height:me});const le=y.value.get(H.id)??[];for(const he of le){if(he.phase!==n)continue;const Oe=j.get(he.id),$e=(Oe==null?void 0:Oe.position)??he.position,Pe=(Oe==null?void 0:Oe.dimensions)??he.dimensions;!$e||!Pe||K.push({x:$e.x,y:$e.y,width:Pe.width,height:Pe.height})}}const ae=Py(K),M=ae.width+Wo*2,v=ae.height+Wo*2;return{position:{x:Math.round(ae.x-Wo),y:Math.round(ae.y-Wo)},dimensions:{width:Math.round(M),height:Math.round(v)},commit:$}}function P(){if(j.size===0){x=void 0;return}const J=[];let $=!1;j.forEach((q,K)=>{const ae=d(K,q,!1);J.push({id:K,changed:ae,commit:q.commit}),q.commit&&ae&&!$&&($=!0)}),j.clear(),x=void 0;for(const{id:q,changed:K,commit:ae}of J){if(!K)continue;const M=c.value.get(q);if(!M)continue;const v=N.value.get(M.ownerId);v&&A.set(v.id,{commit:ae})}if(A.size>0){const q=Array.from(A);A.clear();for(const[K,{commit:ae}]of q)W(K,ae)}$&&f("*")}function R(){j.size!==0&&(x||(x=e.nextTick().then(P)))}function W(J,$=!0){const q=c.value.get(J);if(!q)return;const K=O(q,$);K&&(j.set(J,K),R())}function Z(J,$,q,K){const ae=c.value.get(J);if(!ae)return;if(!ae.position){p(J,$,!1),W(J);return}if(q===0&&K===0){p(J,$,!1);return}p(J,$,!1);const M=[J],v=new Set([J]),H=new Set;for(;M.length;){const oe=M.shift(),te=c.value.get(oe);if(!te)continue;const ge=C(te).filter(me=>me.phase===n&&!me.hidden);for(const me of ge){H.has(me.id)||(u(me.id,{x:me.position.x+q,y:me.position.y+K},!1),H.add(me.id));const le=E.value.get(me.id)??[];for(const he of le){if(v.has(he.id))continue;const Oe=c.value.get(he.id);Oe!=null&&Oe.position&&p(he.id,{x:Oe.position.x+q,y:Oe.position.y+K},!1),v.add(he.id),M.push(he.id)}}}}function X(J,$){const q=o==null?void 0:o.value;if(!q)return!1;if(q===J||$.some(K=>q===K))return!0;for(const K of $){const ae=E.value.get(K)??[];if(ae!=null&&ae.some(M=>M.id===q))return!0}return!1}const F=new Map;return e.watch(()=>s.value.groups.filter($=>$.phase===n).map($=>{const q=$.memberIds.map(K=>{var H,oe;const ae=i(K),M=Math.round(((H=ae==null?void 0:ae.dimensions)==null?void 0:H.width)??0),v=Math.round(((oe=ae==null?void 0:ae.dimensions)==null?void 0:oe.height)??0);return`${K}:${M}x${v}`});return{id:$.id,memberIds:$.memberIds,signature:q.join(",")}}),J=>{const $=new Set(J.map(q=>q.id));for(const q of F.keys())$.has(q)||F.delete(q);for(const q of J)X(q.id,q.memberIds)||F.get(q.id)===q.signature||(F.set(q.id,q.signature),W(q.id))},{deep:!0,flush:"post"}),{groupsByOwner:E,memberGroupMap:N,groupNodes:w,branchEdges:I,isBranchEdgeId:k,updateGroupLayout:W,translateGroupTree:Z,getNodeDepth:b,maxGroupDepth:S,waitForLayoutFlush:()=>x??Promise.resolve()}}function tB(n){e.provide(jh,n)}function jy(){return e.inject(jh,void 0)}function Fy(){const n=jy();if(!n)throw new Error("Confirm modal not provided");return n}function nB(n){const{readonly:t,flowId:r}=n,o=Nt.useVueFlow(r),{onNodesChange:i,onEdgesChange:a,onPaneClick:s,findEdge:c}=o,{disconnectEdge:l,commit:u,portalSelection:p,selectPortalEdge:d}=Pt();i(f=>{f.some(m=>m.type==="select"&&"selected"in m&&m.selected)&&d(void 0)}),a(f=>{const m=f.some(y=>y.type==="select"&&"selected"in y&&y.selected),g=p.value?f.some(y=>y.type==="remove"&&y.id===p.value):!1;(m||g)&&d(void 0)}),s(()=>d(void 0)),Tt.useEventListener("keydown",f=>{if(t||f.key!=="Delete"&&f.key!=="Backspace")return;const m=p.value;!m||c(m)||(f.preventDefault(),l(m,!1),d(void 0),u())})}function Uy(n){const t=n.match(/^(input|output)(?:s@(.*))?$/);if(t)return{io:t[1],field:t[2]}}const rB={default:a1,hover:l1,selected:s1};let Ky,Zd;function Sl(n){const t=n.id===Ky?"selected":n.id===Zd?"hover":"default",r=rB[t],{markerEnd:o}=n,i=typeof o=="object"?{...o,color:r}:{type:o,color:r},a=n.zIndex??0,s=t==="selected"?a+2:t==="hover"?a+1:a;return{...n,style:{...n.style,stroke:r,strokeWidth:t==="selected"?1.5:void 0},markerEnd:i,zIndex:s}}const[oB,iB]=Tt.createInjectionState(function(n){const{phase:t,flowId:r,layoutOptions:o,readonly:i}=n,{viewport:a,padding:s=zr.padding,gaps:c=zr.gaps}=o,{nodes:l=zr.gaps.nodes}=c,u=Nt.useVueFlow(r),p=Pt(),d=jy(),f=Dd(),{i18n:{t:m}}=Je(),{findNode:g,fitView:y,deleteKeyCode:b,onNodeDrag:_,onNodeDragStop:k,onConnect:C,onNodesChange:N,onEdgesChange:E,onEdgeUpdate:w,onEdgeMouseEnter:S,onEdgeMouseLeave:I,getNodes:j,setNodes:A,setEdges:x,addSelectedNodes:O,screenToFlowCoordinate:P}=u;b.value=["Delete","Backspace"];const{state:R,commit:W,moveNode:Z,selectNode:X,removeNode:F,getNodeById:J,connectEdge:$,disconnectEdge:q,getInEdgesByNodeId:K,branchGroups:ae,commit:M,reset:v,groupMapById:H}=p,{isGroupId:oe,canAddMember:te}=ae,ge=e.shallowRef(),me=V=>{ge.value=V},le=e.readonly(ge);function he(V,D){const ne=J(V.source),ce=J(V.target);return!!(ne&&ce&&ne.phase===D&&ce.phase===D)}const Oe=eB({phase:t,readonly:i,flowId:r,draggingId:le}),{memberGroupMap:$e,groupNodes:Pe,branchEdges:qe,isBranchEdgeId:Ye,updateGroupLayout:et,translateGroupTree:Ve,getNodeDepth:ke,maxGroupDepth:_e}=Oe,{activeGroupId:ye,start:ie,updateActiveGroup:ee,end:se}=QI({phase:t,groupMapById:H,getNodeDepth:ke,canAddMember:te,draggingId:le}),ue=e.computed(()=>R.value.nodes.filter(V=>V.phase===t&&!V.hidden).map(V=>{const D=$e.value.get(V.id),ne=D==null?void 0:D.position,ce=D==null?void 0:D.dimensions,Ce=D&&ne&&ce?{x:V.position.x-ne.x,y:V.position.y-ne.y}:V.position,Se=ke(V.id),ve=!!(D&&ne&&ce),ze=(ve?Se:0)+_e.value+1;return{id:V.id,type:"flow",position:Ce,data:V,deletable:!i&&!bl(V),parentNode:ve?D.id:void 0,zIndex:ze*rl+E1}})),Ee=e.computed(()=>R.value.edges.filter(V=>he(V,t)).filter(V=>!ae.isEdgeEnteringGroup(V.source,V.target)).filter(V=>{const D=J(V.source),ne=J(V.target);return!(D!=null&&D.hidden)&&!(ne!=null&&ne.hidden)}).map(V=>{const D=J(V.source),ne=J(V.target);if(!D||!ne){const Ce=[];throw D||Ce.push(`source node "${V.source}"`),ne||Ce.push(`target node "${V.target}"`),new Error(`Missing ${Ce.join(" and ")} for edge "${V.id}" in phase "${t}"`)}const ce=Math.max(ke(V.source),ke(V.target))+_e.value+1;return Sl({id:V.id,source:V.source,target:V.target,sourceHandle:V.sourceField?`outputs@${V.sourceField}`:"output",targetHandle:V.targetField?`inputs@${V.targetField}`:"input",markerEnd:Nt.MarkerType.ArrowClosed,data:V,updatable:!i,zIndex:ce*rl+k1})})),be=e.computed(()=>[...qe.value,...Ee.value]),{autoLayout:xe}=ZI({phase:t,layoutOptions:o,branchLayout:Oe,nodes:ue,edges:be});nB({readonly:i,flowId:r}),e.watch([ue,Pe,be],([V,D,ne])=>{A([...D,...V]),x(ne)},{immediate:!0});const h=e.computed(()=>({padding:s/Math.max(e.toValue(a==null?void 0:a.width)??0,e.toValue(a==null?void 0:a.height)??0)}));async function T({source:V,sourceHandle:D,target:ne,targetHandle:ce}){if(!D||!ce)return;const Ce=Uy(D),Se=Uy(ce);if((Ce==null?void 0:Ce.io)==="input"||(Se==null?void 0:Se.io)==="output"||D==="output"&&ce==="output")return;const ve=K(ne);let ze=!1,Ke=!1;const Be=[],Ae=[],Xe=(Se==null?void 0:Se.io)==="input"?ve.filter(xt=>!xt.targetField):ve.filter(xt=>!!xt.targetField);Xe.length>0&&(ze=!0,Xe.forEach(xt=>{Ae.push(Ba(xt,J)),q(xt.id,!1)}));const Lt=(Se==null?void 0:Se.io)==="input"?Se!=null&&Se.field?ve.filter(xt=>xt.targetField===Se.field):ve.filter(xt=>!!xt.targetField):ve.filter(xt=>!xt.targetField);if(Lt.length>0){if(Lt.some(Zt=>Zt.source===V&&Zt.target===ne&&Zt.targetField===(Se==null?void 0:Se.field)&&Zt.sourceField===(Ce==null?void 0:Ce.field)))return;Ke=!0,Lt.forEach(Zt=>{Ae.push(Ba(Zt,J)),q(Zt.id,!1)})}if(!$({source:V,sourceField:Ce==null?void 0:Ce.field,target:ne,targetField:Se==null?void 0:Se.field},!1)){v(),f({message:m("plugins.free-form.datakit.flow_editor.error.invalid_connection"),appearance:"danger"});return}if(Be.push(Wd(V,Ce==null?void 0:Ce.field,ne,Se==null?void 0:Se.field,J)),ze||Ke){if(!d)throw v(),new Error("Expected confirm modal to be provided here when reachable");if(!await d(m(ze?"plugins.free-form.datakit.flow_editor.confirm.message.switch":"plugins.free-form.datakit.flow_editor.confirm.message.override"),Be,Ae)){v();return}}M()}C(T);let G=!1;const Y=()=>{G&&(G=!1,M())};N(V=>{V.filter(ce=>ce.type==="select").filter(ce=>!oe(ce.id)).sort((ce,Ce)=>ce.selected===Ce.selected?0:ce.selected?1:-1).forEach(ce=>{X(ce.selected?ce.id:void 0)});let ne=!1;V.forEach(ce=>{if(ce.type==="remove"){if(oe(ce.id))return;ne=!0,F(ce.id,!1)}}),ne&&!G&&(G=!0,queueMicrotask(Y))}),_(({node:V,event:D})=>{var ve,ze,Ke;if(!V)return;if(oe(V.id)){const Be=V.id;me(Be),ee(void 0);const Ae=H.value.get(Be);if(!Ae)return;const Xe=Ae.position??{...V.position},Lt=V.position.x-Xe.x,ar=V.position.y-Xe.y;Ve(Be,V.position,Lt,ar);const xt=$e.value.get(Ae.ownerId);xt&&et(xt.id,!1);return}const ne=V.id;ie("canvas"),me(ne);const ce=V.parentNode;let Ce={...V.position};if(ce&&oe(ce)){const Be=H.value.get(ce);Be!=null&&Be.position&&(Ce={x:Be.position.x+V.position.x,y:Be.position.y+V.position.y})}if(Z(ne,Ce,!1),!bl(J(ne))){const Be={x:Ce.x,y:Ce.y,width:((ve=V.dimensions)==null?void 0:ve.width)??0,height:((ze=V.dimensions)==null?void 0:ze.height)??0},Ae=D&&"clientX"in D?P({x:D.clientX,y:D.clientY}):void 0,Xe={x:Be.x+Be.width/2,y:Be.y+Be.height/2};ee(Ae??Xe)}const Se=ce&&oe(ce)?ce:(Ke=$e.value.get(ne))==null?void 0:Ke.id;Se&&et(Se,!1)}),k(({node:V})=>{var Se;if(!V)return;if(me(void 0),oe(V.id)){W();return}const D=V.id,ne=V.parentNode;let ce={...V.position};if(ne&&oe(ne)){const ve=H.value.get(ne);ve!=null&&ve.position&&(ce={x:ve.position.x+V.position.x,y:ve.position.y+V.position.y})}Z(D,ce,!1);const Ce=ne&&oe(ne)?ne:(Se=$e.value.get(D))==null?void 0:Se.id;Ce&&et(Ce,!1),Ne(D),se(),W()}),E(V=>{V.filter(ce=>ce.type==="select").sort((ce,Ce)=>ce.selected===Ce.selected?0:ce.selected?1:-1).forEach(ce=>{Ye(ce.id)||(Ky=ce.selected?ce.id:void 0,x(Ce=>Ce.map(Se=>Se.id!==ce.id||!Se.markerEnd?Se:Sl({...Se,zIndex:ce.selected?1:void 0}))))});let ne=!1;V.forEach(ce=>{if(ce.type==="remove"){if(Ye(ce.id))return;ne=!0,q(ce.id,!1)}}),ne&&!G&&(G=!0,queueMicrotask(Y))}),S(({edge:V})=>{Ye(V.id)||(Zd=V.id,x(D=>D.map(ne=>ne.id!==V.id?ne:Sl(ne))))}),I(({edge:V})=>{Ye(V.id)||(Zd=void 0,x(D=>D.map(ne=>ne.id!==V.id?ne:Sl(ne))))}),w(({edge:V,connection:D})=>{Ye(V.id)||(q(V.id,!1),T(D))});function re(V){y({...h.value,...V})}async function we(V){return X(V),new Promise(D=>setTimeout(()=>{const ne=g(V);O(ne?[ne]:[]),D()},0))}function L(V){const D=j.value.filter(({type:Xe})=>Xe!=="group"),ne=D.find(({id:Xe})=>Xe===V);if(!ne)throw new Error(`Node ${V} not found`);const{x:ce,y:Ce}=ne.data.position,{width:Se,height:ve}=ne.dimensions,ze=Ce,Ke=Ce+ve,Be=D.filter(({id:Xe})=>Xe!==V).filter(({data:{position:{y:Xe}},dimensions:{height:Lt}})=>Xe<Ke&&Xe+Lt>ze).map(({data:{position:{x:Xe}},dimensions:{width:Lt}})=>({left:Xe,right:Xe+Lt})).sort((Xe,Lt)=>Xe.left-Lt.left);let Ae=ce+Se+l;for(const{left:Xe,right:Lt}of Be)if(!(Lt<=Ae)){if(Ae+Se<=Xe)return{x:Ae,y:ze};Ae=Math.max(Ae,Lt)+l}return{x:Ae,y:ze}}function de(V){if(!V)return;const D=g(V);if(!D)throw new Error(`Node ${V} not found`);const{position:{x:ne},dimensions:{width:ce}}=D,Ce=ne+ce,{viewport:Se,dimensions:ve,setViewport:ze}=u,{x:Ke,y:Be,zoom:Ae}=Se.value,{width:Xe}=ve.value,Lt=ne*Ae+Ke,ar=Ce*Ae+Ke,xt=Xe-Mh-l;if(ar<=xt)return;let Zt=xt-ar;Lt+Zt<0&&(Zt=-Lt),Zt!==0&&ze({x:Ke+Zt,y:Be,zoom:Ae},{duration:A1})}function Ne(V){if(!ye.value)return!1;const{nodeId:D,branch:ne}=fI(ye.value),ce=ae.addMember(D,ne,V,{commit:!1});return ee(void 0),ce}return{vueFlowStore:u,editorStore:p,readonly:i,nodes:ue,edges:be,selectNode:we,autoLayout:xe,placeToRight:L,scrollRightToReveal:de,fitViewParams:h,fitView:re,groupDrop:{activeGroupId:ye,startPanelDrag:()=>ie("panel"),endPanelDrag:se,updateActiveGroup:ee,attachNodeToActiveGroup:Ne}}});let ii=null;function aB(){var t;if(ii)return ii;if(typeof navigator>"u")return ii="windows";const n=((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(n)?ii="mac":/Linux/i.test(n)&&!/Android/i.test(n)?ii="linux":ii="windows"}const sB={Shift:"⇧",Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Mod:"⌘",Enter:"↩",ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Tab:"⇥",Esc:"⎋",Space:"Space",Delete:"⌫"},lB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Win",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Spacebar",Delete:"Delete"},cB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Super",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Space",Delete:"Delete"};function uB(n,t={}){const r=t.platform??aB(),o=t.joiner??(r==="mac"?"":" + "),i=r==="mac"?sB:r==="linux"?cB:lB;return(Array.isArray(n)?n:n[r]).map(s=>s in i?i[s]:s).join(o)}const dB={key:0,class:"label"},fB={class:"keys"},xl=Me(e.defineComponent({__name:"HotkeyLabel",props:{label:{},keys:{},reverse:{type:Boolean}},setup(n){const t=uB(n.keys);return(r,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["dk-hotkey-label",{reverse:n.reverse}])},[n.label?(e.openBlock(),e.createElementBlock("span",dB,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("kbd",fB,e.toDisplayString(e.unref(t)),1)],2))}}),[["__scopeId","data-v-7ca86b0d"]]),pB=["onClick"],mB={key:0,class:"additional-count"},qy=24,hB=16,Al=Me(e.defineComponent({__name:"NodePortal",props:{expanded:{type:Boolean,default:()=>{}},reversed:{type:Boolean},targets:{}},setup(n){const t=Number.parseFloat(h1)||0,r={target:"body"},{portalSelection:o,selectPortalEdge:i}=Pt(),a=e.ref(!1),s=e.computed(()=>{const g=o.value;return g?n.targets.some(y=>y.edgeId===g):!1}),c=e.computed(()=>n.expanded!==void 0?n.expanded||s.value:a.value||s.value),l=()=>qy*n.targets.length+t*(n.targets.length-1),u=e.computed(()=>({width:c.value?`${l()}px`:"fit-content"})),p=g=>{i(g)},d=g=>o.value===g,f=e.computed(()=>n.targets.map((g,y)=>{const b=(qy+t)*y;return{edgeId:g.edgeId,key:`${g.node.id}-${g.fieldName??"node"}-${y}`,icon:jd(g.node.type).icon,tooltip:g.fieldName?`${g.node.name}.${g.fieldName}`:g.node.name,highlighted:d(g.edgeId),tooltipEl:null,style:y===0?{width:"fit-content",zIndex:n.targets.length}:{position:"absolute",...n.reversed?{left:`${b}px`,transform:c.value?"translateX(0)":`translateX(-${b}px)`}:{right:0,transform:c.value?`translateX(-${b}px)`:"translateX(0)"},zIndex:n.targets.length-y}}})),m=e.computed(()=>Math.max(n.targets.length-1,0));return(g,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-portal",{expanded:c.value,reversed:n.reversed}]),onClick:y[0]||(y[0]=e.withModifiers(()=>{},["stop"])),onDragstart:y[1]||(y[1]=e.withModifiers(()=>{},["stop"])),onMousedown:y[2]||(y[2]=e.withModifiers(()=>{},["stop"])),onMouseenter:y[3]||(y[3]=b=>a.value=!0),onMouseleave:y[4]||(y[4]=b=>a.value=!1)},[e.createElementVNode("div",{class:"target-boxes",style:e.normalizeStyle(u.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(b,_)=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:b.key,class:"target-box-wrapper","kpop-attributes":r,placement:"top",style:e.normalizeStyle(b.style),text:b.tooltip},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["target-box",{highlighted:b.highlighted}]),onClick:e.withModifiers(k=>p(b.edgeId),["stop"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.icon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:hB},null,8,["color"])),_===0&&m.value>0?(e.openBlock(),e.createElementBlock("span",mB," +"+e.toDisplayString(m.value),1)):e.createCommentVNode("",!0)],10,pB)]),_:2},1032,["style","text"]))),128))],4)],34))}}),[["__scopeId","data-v-45ce7484"]]),vl=Me(e.defineComponent({__name:"HandleTwig",props:{color:{},position:{default:()=>Nt.Position.Left},size:{default:()=>Number.parseFloat(Lh)},type:{}},setup(n){e.useCssVars(r=>({v64bbaf90:r.color}));const t=e.computed(()=>({width:`${n.size}px`,minWidth:`${n.size}px`}));return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["handle-twig",[n.type,n.position===e.unref(Nt.Position).Left?"left":"right"]]),style:e.normalizeStyle(t.value)},null,6))}}),[["__scopeId","data-v-74b600f2"]]),Qd=Me(e.defineComponent({__name:"NodeBadge",props:{type:{},size:{},iconOnly:{type:Boolean}},setup(n){e.useCssVars(r=>{var o,i;return{v3b4ea967:(o=t.value.colors)==null?void 0:o.background,v00febd7c:(i=t.value.colors)==null?void 0:i.foreground}});const t=e.computed(()=>jd(n.type));return(r,o)=>{var a;const i=e.resolveComponent("KBadge");return e.openBlock(),e.createBlock(i,{appearance:"neutral",class:e.normalizeClass(["dk-node-badge",{"icon-only":n.iconOnly,"has-colors":!!t.value.colors}]),size:n.size},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(n.type),1)]),_:2},[(a=t.value)!=null&&a.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value.icon)))]),key:"0"}:void 0]),1032,["class","size"])}}}),[["__scopeId","data-v-409d29e5"]]),gB={class:"body"},yB={class:"name"},_B={class:"handle"},bB={class:"handle-label-wrapper"},wB={class:"handle-label-wrapper"},kB={class:"handle-label text"},CB={class:"handle"},EB={class:"handle-label-wrapper"},NB={class:"handle-label-wrapper"},SB={class:"handle-label text"},xB={key:2,class:"branch-handles"},AB={class:"handle-label-wrapper"},vB={class:"handle-label text"},Gy=Me(e.defineComponent({__name:"FlowNode",props:{data:{},error:{type:Boolean},readonly:{type:Boolean}},setup(n){const t=e.useSlots(),{t:r}=jt.createI18n("en-us",Yt),o=iB(),{getInEdgesByNodeId:i,getOutEdgesByNodeId:a,getNodeById:s,toggleExpanded:c,duplicateNode:l,removeNode:u,propertiesPanelOpen:p,branchGroups:d}=Pt(),f=e.computed(()=>oi(n.data.type)),m=e.computed(()=>n.data.fields.input.length>0),g=e.computed(()=>n.data.fields.output.length>0),y=e.computed(()=>m.value&&i(n.data.id).every(K=>K.targetField===void 0)),b=e.computed(()=>g.value&&a(n.data.id).every(K=>K.sourceField===void 0)),_=e.computed(()=>n.data.expanded.input??!1),k=e.computed(()=>n.data.expanded.output??!1),C=e.computed(()=>{var K,ae,M;return((M=(ae=(K=f.value.io)==null?void 0:K.next)==null?void 0:ae.branches)==null?void 0:M.map(({name:v})=>v))??[]}),N=e.computed(()=>C.value.length>0),E=e.computed(()=>d.findMembership(n.data.id)),w=e.computed(()=>{var K,ae;if(n.data.type==="property"){const M=(K=n.data.config)==null?void 0:K.property;return Rd(M)}return(ae=f.value.io)==null?void 0:ae.input}),S=e.computed(()=>{var K,ae;if(n.data.type==="property"){const M=(K=n.data.config)==null?void 0:K.property;return $d(M)}return(ae=f.value.io)==null?void 0:ae.output}),I=e.computed(()=>bl(n.data)),j=e.computed(()=>n.data.phase==="response"),A=e.computed(()=>n.data.phase==="request"?Nt.Position.Left:Nt.Position.Right),x=e.computed(()=>n.data.phase==="request"?Nt.Position.Right:Nt.Position.Left),O=e.computed(()=>n.data.phase==="request"?Nt.Position.Right:Nt.Position.Left),P=e.computed(()=>bl(n.data)?r(`plugins.free-form.datakit.flow_editor.node_types.${n.data.type}.name`):n.data.name),R=e.computed(()=>I.value?n1:r1);function W(K){return K==="input"?j.value:!j.value}function Z(K){const ae=new Map,M=K==="input"?i(n.data.id):a(n.data.id);for(const v of M){const H=s(K==="input"?v.source:v.target);if(!H)continue;if(K==="input"){const le=H.type==="vault",he=H.phase!==n.data.phase,Oe=d.isEdgeEnteringGroup(H.id,n.data.id);if(!(le||he||Oe))continue}else{const le=H.phase!==n.data.phase,he=d.isEdgeEnteringGroup(n.data.id,H.id);if(!(le||he))continue}const oe=K==="input"?v.targetField||"input":v.sourceField||"output";let te;if(K==="input"&&v.sourceField){const le=H.fields.output.find(he=>he.id===v.sourceField);te=le==null?void 0:le.name}else if(K==="output"&&v.targetField){const le=H.fields.input.find(he=>he.id===v.targetField);te=le==null?void 0:le.name}const ge={edgeId:v.id,node:H,fieldName:te},me=ae.get(oe);me?me.push(ge):ae.set(oe,[ge])}return ae}const X=e.computed(()=>Z("input")),F=e.computed(()=>Z("output"));function J(K){!o||o.readonly||K==="input"&&!y.value||K==="output"&&!b.value||c(n.data.id,K)}async function $(){if(!o||o.readonly)return;const K=l(n.data.id,o.placeToRight(n.data.id));await o.selectNode(K),o.scrollRightToReveal(K),p.value=!0}function q(){d.removeMember(n.data.id)}return e.watch(y,K=>{K||c(n.data.id,"input",!0,!0,"*")},{immediate:!0}),e.watch(b,K=>{K||c(n.data.id,"output",!0,!0,"*")},{immediate:!0}),e.watch(()=>n.data.fields.input,(K,ae)=>{en(K,ae)||c(n.data.id,"input",K.length>0,!0,"*")},{deep:!0}),e.watch(()=>n.data.fields.output,(K,ae)=>{en(K,ae)||c(n.data.id,"output",K.length>0,!0,"*")},{deep:!0}),(K,ae)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-flow-node",{reversed:j.value,implicit:I.value,readonly:n.readonly}])},[e.createElementVNode("div",gB,[I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:0,class:"badge",placement:"top",text:n.data.type},{default:e.withCtx(()=>[e.createVNode(Qd,{"icon-only":"",size:"small",type:n.data.type},null,8,["type"])]),_:1},8,["text"])),e.createElementVNode("div",yB,e.toDisplayString(P.value),1),n.error?(e.openBlock(),e.createBlock(e.unref(Re.WarningIcon),{key:1,class:"error-icon",color:`var(--kui-color-text-danger, ${e.unref(Ph)})`,size:16},null,8,["color"])):e.createCommentVNode("",!0),t.actions?e.renderSlot(K.$slots,"actions",{key:2,data:n.data},void 0,!0):I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KDropdown),{key:3,class:"menu",disabled:n.readonly,"kpop-attributes":{offset:"4px",target:"body",popoverClasses:"dk-flow-node-menu"},width:"160",onClick:ae[1]||(ae[1]=e.withModifiers(()=>{},["stop"]))},{items:e.withCtx(()=>[e.createVNode(e.unref(Fe.KDropdownItem),{onClick:$},{default:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).duplicate,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.duplicate")},null,8,["keys","label"])]),_:1}),E.value?(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:0,onClick:q},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KDropdownItem),{danger:"",onClick:ae[0]||(ae[0]=M=>e.unref(u)(n.data.id))},{default:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).delete,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.delete")},null,8,["keys","label"])]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",class:"menu-trigger",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text, ${e.unref(od)})`},null,8,["color"])]),_:1})]),_:1},8,["disabled"]))]),t["before-handles"]?e.renderSlot(K.$slots,"before-handles",{key:0,data:n.data},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["handles",{reversed:j.value}])},[w.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["input-handles",{"has-fields":m.value}])},[e.createElementVNode("div",_B,[e.createVNode(e.unref(Nt.Handle),{id:"input",position:A.value,type:"target"},null,8,["position"]),X.value.has("input")?(e.openBlock(),e.createBlock(Al,{key:0,mode:"input",reversed:W("input"),targets:X.value.get("input")},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",bB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:y.value}]),onClick:ae[2]||(ae[2]=e.withModifiers(M=>J("input"),["stop"]))},[ae[4]||(ae[4]=e.createElementVNode("div",{class:"text"}," inputs ",-1)),m.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Re.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["size"])),_.value?(e.openBlock(),e.createBlock(e.unref(Re.UnfoldLessIcon),{key:1,color:y.value?void 0:`var(--kui-color-text-disabled, ${e.unref($h)})`,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),m.value&&_.value?(e.openBlock(),e.createBlock(vl,{key:0,color:R.value,position:A.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)])]),m.value&&_.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.input,(M,v)=>(e.openBlock(),e.createElementBlock("div",{key:`inputs-${M.id}`,class:"handle indented"},[e.createVNode(e.unref(Nt.Handle),{id:`inputs@${M.id}`,position:A.value,type:"target"},null,8,["id","position"]),X.value.has(M.id)?(e.openBlock(),e.createBlock(Al,{key:0,mode:"input",reversed:W("input"),targets:X.value.get(M.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",wB,[e.createElementVNode("div",kB,e.toDisplayString(M.name),1),e.createVNode(vl,{color:R.value,position:A.value,type:v<n.data.fields.input.length-1?"trident":"corner"},null,8,["color","position","type"])])]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["output-handles",{"has-fields":g.value}])},[e.createElementVNode("div",CB,[e.createElementVNode("div",EB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:b.value}]),onClick:ae[3]||(ae[3]=e.withModifiers(M=>J("output"),["stop"]))},[ae[5]||(ae[5]=e.createElementVNode("div",{class:"text"}," outputs ",-1)),g.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Re.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["size"])),k.value?(e.openBlock(),e.createBlock(e.unref(Re.UnfoldLessIcon),{key:1,color:b.value?void 0:`var(--kui-color-text-disabled, ${e.unref($h)})`,size:`var(--kui-icon-size-20, ${e.unref(nl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),g.value&&k.value?(e.openBlock(),e.createBlock(vl,{key:0,color:R.value,position:x.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(Nt.Handle),{id:"output",position:x.value,type:"source"},null,8,["position"]),F.value.has("output")?(e.openBlock(),e.createBlock(Al,{key:0,mode:"output",reversed:W("output"),targets:F.value.get("output")},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]),g.value&&k.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.output,(M,v)=>(e.openBlock(),e.createElementBlock("div",{key:`outputs-${M.id}`,class:"handle indented"},[e.createElementVNode("div",NB,[e.createElementVNode("div",SB,e.toDisplayString(M.name),1),e.createVNode(vl,{color:R.value,position:x.value,type:v<n.data.fields.output.length-1?"trident":"corner"},null,8,["color","position","type"])]),e.createVNode(e.unref(Nt.Handle),{id:`outputs@${M.id}`,position:x.value,type:"source"},null,8,["id","position"]),F.value.has(M.id)?(e.openBlock(),e.createBlock(Al,{key:0,mode:"output",reversed:W("output"),targets:F.value.get(M.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createElementBlock("div",xB,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,M=>(e.openBlock(),e.createElementBlock("div",{key:`branch-${M}`,class:"handle"},[e.createElementVNode("div",AB,[e.createElementVNode("div",vB,e.toDisplayString(M),1)]),e.createVNode(e.unref(Nt.Handle),{id:`branch@${M}`,connectable:!1,position:O.value,type:"source"},null,8,["id","position"])]))),128))])):e.createCommentVNode("",!0)],2),t["after-handles"]?e.renderSlot(K.$slots,"after-handles",{key:1,data:n.data},void 0,!0):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-1de3b7cb"]]),IB=Me(e.defineComponent({__name:"GroupNode",props:{data:{},active:{type:Boolean}},setup(n){const t=n,r=e.computed(()=>t.data.phase==="response"),o=e.computed(()=>r.value?Nt.Position.Right:Nt.Position.Left);return(i,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-branch-group-node",{reversed:r.value,"drop-target":n.active}])},[e.createVNode(e.unref(Nt.Handle),{id:"input",connectable:!1,position:o.value,type:"target"},null,8,["position"])],2))}}),[["__scopeId","data-v-cf30ffea"]]),ef=Me(e.defineComponent({__name:"FlowCanvas",props:{flowId:{},phase:{},mode:{}},emits:["initialized","nodes-change","node-click"],setup(n,{expose:t,emit:r}){const o=e.useSlots(),i=r,a=e.useTemplateRef("flowCanvas"),s=Tt.useElementBounding(a),{i18n:{t:c}}=Je(),l=e.computed(()=>{const te=n.mode==="edit"||n.mode==="inspect";return{panOnDrag:te?void 0:!1,panOnScroll:te?void 0:!1,zoomOnDoubleClick:te?void 0:!1,zoomOnPinch:te?void 0:!1,zoomOnScroll:te?void 0:!1}}),{vueFlowStore:u,editorStore:p,autoLayout:d,fitViewParams:f,fitView:m,selectNode:g,placeToRight:y,scrollRightToReveal:b,groupDrop:_}=oB({phase:n.phase,flowId:n.flowId,layoutOptions:{viewport:{width:s.width,height:s.height}},readonly:n.mode!=="edit"}),{addNode:k,propertiesPanelOpen:C,invalidConfigNodeIds:N,selectedNode:E,duplicateNode:w,commit:S,selectPortalEdge:I}=p,{screenToFlowCoordinate:j,zoomIn:A,zoomOut:x,viewport:O,maxZoom:P,minZoom:R}=u,{activeGroupId:W,startPanelDrag:Z,endPanelDrag:X,updateActiveGroup:F,attachNodeToActiveGroup:J}=_;function $(te){var me;const ge=(me=te.dataTransfer)==null?void 0:me.types.find(le=>le.startsWith(`${pa}/`));if(ge)return ge.replace(`${pa}/`,"")}function q(te){var ge,me;if(n.mode==="inspect"){if(((ge=te==null?void 0:te.node)==null?void 0:ge.type)==="group")return;i("node-click",te.node.data);return}if(n.mode==="edit"){if(((me=te==null?void 0:te.node)==null?void 0:me.type)==="group"){g(void 0),I(void 0);return}C.value=!0}}function K(te){n.mode==="edit"&&(te.preventDefault(),F(j({x:te.clientX,y:te.clientY})))}function ae(te){var qe;if(n.mode!=="edit")return;const ge=(qe=te.dataTransfer)==null?void 0:qe.getData(pa);if(!ge)return;te.preventDefault();const me=JSON.parse(ge);if(me.action!=="create-node")return;const le=j({x:te.clientX,y:te.clientY}),{type:he,anchor:Oe}=me.data,$e={type:he,phase:n.phase,position:{x:le.x-Oe.offsetX,y:le.y-Oe.offsetY}},Pe=k($e,!1);if(!Pe){X();return}J(Pe),S(),g(Pe),C.value=!0,X()}async function M(){i("initialized"),n.mode==="inspect"&&setTimeout(async()=>{await d(!1),setTimeout(()=>m(),0)},0)}async function v(){await d(),setTimeout(()=>m(),0)}const H=e.computed(()=>{if(n.mode==="preview")return[];const te=[{name:"zoom_in",icon:Re.AddIcon,action:A,disabled:O.value.zoom>=P.value},{name:"zoom_out",icon:Re.RemoveIcon,action:x,disabled:O.value.zoom<=R.value},{name:"fit_view",icon:Re.FullscreenIcon,action:m}];return n.mode==="edit"&&te.push({name:"auto_layout",icon:Re.AutoLayoutIcon,action:v}),te});n.mode==="edit"&&(Tt.useEventListener("dragstart",te=>{$(te)&&Z()}),Tt.useEventListener("dragend",()=>{X()}));async function oe(){const te=E.value;if(n.mode!=="edit"||!te||te.phase!==n.phase)return;const ge=w(te.id,y(te.id));ge&&(await g(ge),C.value=!0,b(ge))}return Oh({enabled:e.computed(()=>!!E.value&&n.mode==="edit"&&E.value.phase===n.phase),duplicate:oe}),t({autoLayout:d,fitView:m}),(te,ge)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowCanvas",ref:a,class:"dk-flow-canvas"},[e.createVNode(e.unref(Nt.VueFlow),e.mergeProps({id:n.flowId,class:["flow",{readonly:n.mode!=="edit",inspect:n.mode==="inspect"}]},l.value,{"connect-on-click":!1,"elements-selectable":n.mode==="edit"||n.mode==="inspect","max-zoom":e.unref(S1),"min-zoom":e.unref(x1),"multi-selection-key-code":null,"nodes-connectable":n.mode==="edit","nodes-draggable":n.mode==="edit",onDragover:K,onDrop:ae,onNodeClick:q,onNodesChange:ge[0]||(ge[0]=me=>i("nodes-change")),onNodesInitialized:M}),{"node-flow":e.withCtx(({data:me})=>[e.createVNode(Gy,{data:me,error:e.unref(N).has(me.id),readonly:n.mode!=="edit"},e.createSlots({_:2},[o["node-before-handles"]?{name:"before-handles",fn:e.withCtx(()=>[e.renderSlot(te.$slots,"node-before-handles",{data:me},void 0,!0)]),key:"0"}:void 0,o["node-actions"]?{name:"actions",fn:e.withCtx(()=>[e.renderSlot(te.$slots,"node-actions",{data:me},void 0,!0)]),key:"1"}:void 0,o["node-after-handles"]?{name:"after-handles",fn:e.withCtx(()=>[e.renderSlot(te.$slots,"node-after-handles",{data:me},void 0,!0)]),key:"2"}:void 0]),1032,["data","error","readonly"])]),"node-group":e.withCtx(({data:me})=>[e.createVNode(IB,{active:e.unref(W)===me.id,data:me},null,8,["active","data"])]),default:e.withCtx(()=>[e.createVNode(e.unref(GC.Background)),e.createVNode(e.unref(Ih.Controls),{"fit-view-params":e.unref(f),position:"bottom-left","show-fit-view":!1,"show-interactive":!1,"show-zoom":!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(H.value,me=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:me.name,placement:"right",text:e.unref(c)(`plugins.free-form.datakit.flow_editor.actions.${me.name}`)},{default:e.withCtx(()=>[e.createVNode(e.unref(Ih.ControlButton),{disabled:me.disabled,onClick:e.withModifiers(me.action,["stop"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(me.icon),{size:18}))]),_:2},1032,["disabled","onClick"])]),_:2},1032,["text"]))),128))]),_:1},8,["fit-view-params"])]),_:3},16,["id","class","elements-selectable","max-zoom","min-zoom","nodes-connectable","nodes-draggable"])],512))}}),[["__scopeId","data-v-11561a7e"]]);function Hy(){const n=["methods","logout_methods"];return{setFieldType:(p,d,f)=>{var m,g,y;if(!(!p||!d||!f))switch(f.type){case"boolean":p[d]={type:Ie.ConfigurationSchemaType.BadgeStatus,...p[d]};break;case"string":f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.Redacted,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break;case"set":((m=f.elements)==null?void 0:m.type)==="string"&&(p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]});break;case"array":n.includes(d)?p[d]={type:Ie.ConfigurationSchemaType.BadgeMethod,...p[d]}:((g=f.elements)==null?void 0:g.type)==="string"?f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.RedactedArray,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]}:((y=f.elements)==null?void 0:y.type)==="record"&&(p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]});break;case"record":p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]};break;default:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break}},convertToDotNotation:p=>p.replace(/-/g,"."),unFlattenObject:p=>{const d={};for(const f in p){const m=f.split(".");m.reduce((g,y,b)=>g[y]||(g[y]=isNaN(m[b+1])?m.length-1===b?p[f]:{}:[]),d)}return d},dismissField:(p,d,f="redis",m=!1)=>{const g=new RegExp("(?<=-redis-).*");if(typeof p!="object"||p===null)return p;f==="redis"?Object.keys(p).forEach(y=>{y.match(g)&&delete p[y]}):m?p[f]=null:delete p[f],Object.assign(p,d)},isObjectEmpty:p=>Object.keys(p).length===0,unsetNullForeignKey:(p,d)=>{["service.id","route.id","consumer.id","consumer_group.id"].indexOf(p)>-1&&d[p]===null&&(delete d[p],d[p.replace(".id","")]=null)},formatPluginFieldLabel:p=>p.replace(/_/g," ").split("-").map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join("-"),getTallestPluginCardHeight:p=>{let d=0;if(p.length)for(let f=0;f<p.length;f++){const m=p[f].$el;d=m.offsetHeight>d?m.offsetHeight:d}return d},getToggleVisibility:(p,d)=>{var f,m;if(p&&d){const g=(m=(f=window==null?void 0:window.getComputedStyle(p))==null?void 0:f.getPropertyValue("grid-template-columns"))==null?void 0:m.split(" ").length;return d>g}return!0}}}var Il=(n=>(n.REDIS_CE="redis-ce",n.REDIS_EE="redis-ee",n))(Il||{});const Bl=["Featured"],tf=[fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.AI,fe.PluginGroup.SECURITY,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.SERVERLESS,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.LOGGING,fe.PluginGroup.DEPLOYMENT,fe.PluginGroup.WEBSOCKET,fe.PluginGroup.MONETIZATION,fe.PluginGroup.CUSTOM_PLUGINS],Tl=[fe.PluginGroup.AI,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.LOGGING,fe.PluginGroup.MONETIZATION,fe.PluginGroup.SECURITY,fe.PluginGroup.SERVERLESS,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.CUSTOM_PLUGINS];var yo=(n=>(n.SERVICE="service_id",n.ROUTE="route_id",n.CONSUMER="consumer_id",n.CONSUMER_GROUP="consumer_group_id",n))(yo||{});const _o=n=>{const t=Object.fromEntries(n.fields.map(r=>Object.entries(r)[0]));return"id"in t||(t.id={}),t},bo={label:"Tags",name:"tags",type:"input",inputType:"text",valueType:"array",valueArrayType:"string",placeholder:"Enter list of tags",help:"An optional set of strings for grouping and filtering, separated by commas.",hint:"e.g. tag1, tag2, tag3"},ai={getColumnFields:_o,tags:bo,id:{label:"ID"},enabled:{label:"Enabled",indexed:!0,type:"boolean"},created_at:{label:"Created"},updated_at:{label:"Last updated"},fields:{arrayItems(n){const t=n.inputAttributes||{};return delete n.inputAttributes,{type:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",newElementButtonLabelClasses:"kong-form-new-element-button-label",inputAttributes:{class:"form-control",style:{minWidth:"200px"},...t},removeElementButtonLabel:"remove",styleClasses:"kong-form-field-wrapper",inputType:"text",valueType:"array",valueArrayType:"string",...n}}}},zy={fields:[{group:{hint:"The arbitrary group name to associate to the consumer."}},{tags:bo}]},BB={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{group:{required:!0,type:"string",hint:"The arbitrary group name to associate to the consumer."}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},Wy={fields:[{username:{}},{password:{inputType:"password"}},{tags:bo}]},TB={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{username:{required:!0,type:"string",unique:!0}},{password:{type:"string",required:!0,encrypted:!0}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},Yy=e.defineComponent({name:"KeyAuthIdentityRealmsBase",__name:"Base",props:e.mergeModels({realms:{}},{modelValue:{default:[{scope:"cp",id:null,region:null}]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=n,r=e.useModel(n,"modelValue"),{i18n:o}=st.useI18n(),{t:i}=o,a={value:"current-cp",label:i("custom_field.key_auth_identity_realms.cp_label"),group:i("custom_field.key_auth_identity_realms.cp_group_label")},s=e.inject(Ze.FORMS_CONFIG),{axiosInstance:c}=Ie.useAxios(s==null?void 0:s.axiosRequestConfig),l=()=>{if((s==null?void 0:s.app)==="konnect"){const g=/\b(us|eu|au|me|in|sg)\b/.exec((s==null?void 0:s.apiBaseUrl)||"");if(g)return{region:g[1]}}return{}},u=e.ref(!0),p=e.ref([a]),d=async()=>{if((s==null?void 0:s.app)==="konnect")try{u.value=!0;let g=`${s==null?void 0:s.apiBaseUrl}/v1/realms`;const y=[];do{const b=await c.get(g);b&&b.data&&b.data.data&&y.push(...b.data.data.map(_=>({value:_.id,label:_.name,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))),g=b.data.meta.next?`${s==null?void 0:s.apiBaseUrl}${b.data.meta.next}`:null}while(g);p.value=[a,...y]}catch(g){console.error("Failed to fetch Konnect realms",g)}finally{u.value=!1}},f=e.computed(()=>r.value.map(g=>g.id||"current-cp")),m=g=>{const y=g.includes("current-cp")?[{scope:"cp",id:null,region:null}]:[],b=r.value.filter(({scope:E})=>E!=="cp").map(({id:E})=>E),_=g.filter(E=>E!=="current-cp"),N=(b.length!==_.length||b.some(E=>!_.includes(E))?_.filter(E=>!b.includes(E)):_).map(E=>({...l(),scope:"realm",id:E}));r.value=[...y,...N]};return e.onMounted(()=>{t.realms===void 0&&d()}),e.watch(()=>t.realms,g=>{g&&(p.value=[a,...g.map(y=>({...y,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))],u.value=!1)},{immediate:!0}),(g,y)=>{const b=e.resolveComponent("KMultiselect");return e.openBlock(),e.createBlock(b,{items:p.value,loading:u.value,"model-value":f.value,"onUpdate:modelValue":m},null,8,["items","loading","model-value"])}}}),OB={class:"field-wrapper"},PB=Me(e.defineComponent({__name:"VfgAdapter",props:{disabled:{type:Boolean},formOptions:{},model:{},schema:{},vfg:{},errors:{},hint:{}},emits:["modelUpdated"],setup(n,{expose:t,emit:r}){const o=n,i=r,{clearValidationErrors:a,value:s}=Ze.composables.useAbstractFields({model:e.toRef(()=>o.model),schema:o.schema,formOptions:o.formOptions,emitModelUpdated:c=>{i("modelUpdated",c.value,c.model)}});return t({clearValidationErrors:a}),(c,l)=>(e.openBlock(),e.createElementBlock("div",OB,[e.createVNode(Yy,{modelValue:e.unref(s),"onUpdate:modelValue":l[0]||(l[0]=u=>e.isRef(s)?s.value=u:null)},null,8,["modelValue"])]))}}),[["__scopeId","data-v-269e85ed"]]),Jy={fields:[{key:{submitWhenNull:!1,hint:`You can optionally set your own unique key to authenticate the
4
4
  client. If missing, it will be generated for you.`,inputType:"password",encrypted:!0}},{tags:bo},{ttl:{help:"Time-to-live (in seconds) value for data"}}]},VB=n=>{var t;return(n==null?void 0:n.app)==="kongManager"?{fieldsToDelete:["config-identity_realms"],shamefullyTransformPayload:({payload:r})=>{(n!=null&&n.credential&&typeof r.ttl!="number"||Number.isNaN(r.ttl))&&(r.ttl=0)}}:{"config-identity_realms":{component:((t=n==null?void 0:n.experimentalRenders)==null?void 0:t.keyAuthIdentityRealms)??!1?e.markRaw(PB):null}}},$B={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{key:{auto:!0,hint:"If left empty, a key will be generated after saving this form.",required:!1,type:"string",encrypted:!0,unique:!0}},{tags:{elements:{type:"string",required:!0},type:"set"}},{ttl:{between:[0,1e8],description:"Time-to-live (in seconds) value for data",type:"number"}}]},Xy={fields:[{username:{hint:"The username to use in the HMAC Signature verification."}},{secret:{inputType:"text",submitWhenNull:!1,hint:`The secret to use in the HMAC Signature verification. Note that
5
5
  if this parameter isn’t provided, Kong will generate a value for you and
6
6
  send it as part of the response body.`}},{tags:bo}]},RB={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{username:{required:!0,type:"string",unique:!0,hint:"The username to use in the HMAC Signature verification."}},{secret:{auto:!0,type:"string",encrypted:!0,hint:"The secret to use in the HMAC Signature verification. Note that if this parameter isn’t provided, Kong will generate a value for you and send it as part of the response body."}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},LB={fields:[{key:{submitWhenNull:!1,hint:`A unique string identifying the credential. If left out, it will
@@ -22,18 +22,18 @@ ${I}`)}if(N.has(w))return;N.add(w),E.push(w);const S=_.dependencies[w];if(S){con
22
22
  `;for(let _=1;_<=c.linesAfter&&!(f+_>=p.length);_++){const k=o(s.buffer,u[f+_],p[f+_],s.position-(u[f]-u[f+_]),y);m+=r.repeat(" ",c.indent)+i((s.line+_+1).toString(),g)+" | "+k.str+`
23
23
  `}return m.replace(/\n$/,"")}t.exports=a}),ln=It((n,t)=>{var r=Ra(),o=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];function a(c){const l={};return c!==null&&Object.keys(c).forEach(function(u){c[u].forEach(function(p){l[String(p)]=u})}),l}function s(c,l){if(l=l||{},Object.keys(l).forEach(function(u){if(o.indexOf(u)===-1)throw new r('Unknown option "'+u+'" is met in definition of "'+c+'" YAML type.')}),this.options=l,this.tag=c,this.kind=l.kind||null,this.resolve=l.resolve||function(){return!0},this.construct=l.construct||function(u){return u},this.instanceOf=l.instanceOf||null,this.predicate=l.predicate||null,this.represent=l.represent||null,this.representName=l.representName||null,this.defaultStyle=l.defaultStyle||null,this.multi=l.multi||!1,this.styleAliases=a(l.styleAliases||null),i.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+c+'" YAML type.')}t.exports=s}),b_=It((n,t)=>{var r=Ra(),o=ln();function i(c,l){const u=[];return c[l].forEach(function(p){let d=u.length;u.forEach(function(f,m){f.tag===p.tag&&f.kind===p.kind&&f.multi===p.multi&&(d=m)}),u[d]=p}),u}function a(){const c={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function l(u){u.multi?(c.multi[u.kind].push(u),c.multi.fallback.push(u)):c[u.kind][u.tag]=c.fallback[u.tag]=u}for(let u=0,p=arguments.length;u<p;u+=1)arguments[u].forEach(l);return c}function s(c){return this.extend(c)}s.prototype.extend=function(l){let u=[],p=[];if(l instanceof o)p.push(l);else if(Array.isArray(l))p=p.concat(l);else if(l&&(Array.isArray(l.implicit)||Array.isArray(l.explicit)))l.implicit&&(u=u.concat(l.implicit)),l.explicit&&(p=p.concat(l.explicit));else throw new r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");u.forEach(function(f){if(!(f instanceof o))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(f.loadKind&&f.loadKind!=="scalar")throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(f.multi)throw new r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),p.forEach(function(f){if(!(f instanceof o))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const d=Object.create(s.prototype);return d.implicit=(this.implicit||[]).concat(u),d.explicit=(this.explicit||[]).concat(p),d.compiledImplicit=i(d,"implicit"),d.compiledExplicit=i(d,"explicit"),d.compiledTypeMap=a(d.compiledImplicit,d.compiledExplicit),d},t.exports=s}),w_=It((n,t)=>{t.exports=new(ln())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}})}),k_=It((n,t)=>{t.exports=new(ln())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}})}),C_=It((n,t)=>{t.exports=new(ln())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}})}),E_=It((n,t)=>{t.exports=new(b_())({explicit:[w_(),k_(),C_()]})}),N_=It((n,t)=>{var r=ln();function o(s){if(s===null)return!0;const c=s.length;return c===1&&s==="~"||c===4&&(s==="null"||s==="Null"||s==="NULL")}function i(){return null}function a(s){return s===null}t.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:o,construct:i,predicate:a,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})}),S_=It((n,t)=>{var r=ln();function o(s){if(s===null)return!1;const c=s.length;return c===4&&(s==="true"||s==="True"||s==="TRUE")||c===5&&(s==="false"||s==="False"||s==="FALSE")}function i(s){return s==="true"||s==="True"||s==="TRUE"}function a(s){return Object.prototype.toString.call(s)==="[object Boolean]"}t.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:o,construct:i,predicate:a,represent:{lowercase:function(s){return s?"true":"false"},uppercase:function(s){return s?"TRUE":"FALSE"},camelcase:function(s){return s?"True":"False"}},defaultStyle:"lowercase"})}),x_=It((n,t)=>{var r=$a(),o=ln();function i(d){return d>=48&&d<=57||d>=65&&d<=70||d>=97&&d<=102}function a(d){return d>=48&&d<=55}function s(d){return d>=48&&d<=57}function c(d){if(d===null)return!1;const f=d.length;let m=0,g=!1;if(!f)return!1;let y=d[m];if((y==="-"||y==="+")&&(y=d[++m]),y==="0"){if(m+1===f)return!0;if(y=d[++m],y==="b"){for(m++;m<f;m++){if(y=d[m],y!=="0"&&y!=="1")return!1;g=!0}return g&&Number.isFinite(l(d))}if(y==="x"){for(m++;m<f;m++){if(!i(d.charCodeAt(m)))return!1;g=!0}return g&&Number.isFinite(l(d))}if(y==="o"){for(m++;m<f;m++){if(!a(d.charCodeAt(m)))return!1;g=!0}return g&&Number.isFinite(l(d))}}for(;m<f;m++){if(!s(d.charCodeAt(m)))return!1;g=!0}return g?Number.isFinite(l(d)):!1}function l(d){let f=d,m=1,g=f[0];if((g==="-"||g==="+")&&(g==="-"&&(m=-1),f=f.slice(1),g=f[0]),f==="0")return 0;if(g==="0"){if(f[1]==="b")return m*parseInt(f.slice(2),2);if(f[1]==="x")return m*parseInt(f.slice(2),16);if(f[1]==="o")return m*parseInt(f.slice(2),8)}return m*parseInt(f,10)}function u(d){return l(d)}function p(d){return Object.prototype.toString.call(d)==="[object Number]"&&d%1===0&&!r.isNegativeZero(d)}t.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:c,construct:u,predicate:p,represent:{binary:function(d){return d>=0?"0b"+d.toString(2):"-0b"+d.toString(2).slice(1)},octal:function(d){return d>=0?"0o"+d.toString(8):"-0o"+d.toString(8).slice(1)},decimal:function(d){return d.toString(10)},hexadecimal:function(d){return d>=0?"0x"+d.toString(16).toUpperCase():"-0x"+d.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})}),A_=It((n,t)=>{var r=$a(),o=ln(),i=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function s(d){return d===null||!i.test(d)?!1:Number.isFinite(parseFloat(d,10))?!0:a.test(d)}function c(d){let f=d.toLowerCase();const m=f[0]==="-"?-1:1;return"+-".indexOf(f[0])>=0&&(f=f.slice(1)),f===".inf"?m===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:f===".nan"?NaN:m*parseFloat(f,10)}var l=/^[-+]?[0-9]+e/;function u(d,f){if(isNaN(d))switch(f){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===d)switch(f){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===d)switch(f){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(d))return"-0.0";const m=d.toString(10);return l.test(m)?m.replace("e",".e"):m}function p(d){return Object.prototype.toString.call(d)==="[object Number]"&&(d%1!==0||r.isNegativeZero(d))}t.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:s,construct:c,predicate:p,represent:u,defaultStyle:"lowercase"})}),v_=It((n,t)=>{t.exports=E_().extend({implicit:[N_(),S_(),x_(),A_()]})}),I_=It((n,t)=>{t.exports=v_()}),B_=It((n,t)=>{var r=ln(),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function a(l){return l===null?!1:o.exec(l)!==null||i.exec(l)!==null}function s(l){let u=0,p=null,d=o.exec(l);if(d===null&&(d=i.exec(l)),d===null)throw new Error("Date resolve error");const f=+d[1],m=+d[2]-1,g=+d[3];if(!d[4])return new Date(Date.UTC(f,m,g));const y=+d[4],b=+d[5],_=+d[6];if(d[7]){for(u=d[7].slice(0,3);u.length<3;)u+="0";u=+u}if(d[9]){const C=+d[10],N=+(d[11]||0);p=(C*60+N)*6e4,d[9]==="-"&&(p=-p)}const k=new Date(Date.UTC(f,m,g,y,b,_,u));return p&&k.setTime(k.getTime()-p),k}function c(l){return l.toISOString()}t.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:a,construct:s,instanceOf:Date,represent:c})}),T_=It((n,t)=>{var r=ln();function o(i){return i==="<<"||i===null}t.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:o})}),O_=It((n,t)=>{var r=ln(),o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
24
24
  \r`;function i(l){if(l===null)return!1;let u=0;const p=l.length,d=o;for(let f=0;f<p;f++){const m=d.indexOf(l.charAt(f));if(!(m>64)){if(m<0)return!1;u+=6}}return u%8===0}function a(l){const u=l.replace(/[\r\n=]/g,""),p=u.length,d=o;let f=0;const m=[];for(let y=0;y<p;y++)y%4===0&&y&&(m.push(f>>16&255),m.push(f>>8&255),m.push(f&255)),f=f<<6|d.indexOf(u.charAt(y));const g=p%4*6;return g===0?(m.push(f>>16&255),m.push(f>>8&255),m.push(f&255)):g===18?(m.push(f>>10&255),m.push(f>>2&255)):g===12&&m.push(f>>4&255),new Uint8Array(m)}function s(l){let u="",p=0;const d=l.length,f=o;for(let g=0;g<d;g++)g%3===0&&g&&(u+=f[p>>18&63],u+=f[p>>12&63],u+=f[p>>6&63],u+=f[p&63]),p=(p<<8)+l[g];const m=d%3;return m===0?(u+=f[p>>18&63],u+=f[p>>12&63],u+=f[p>>6&63],u+=f[p&63]):m===2?(u+=f[p>>10&63],u+=f[p>>4&63],u+=f[p<<2&63],u+=f[64]):m===1&&(u+=f[p>>2&63],u+=f[p<<4&63],u+=f[64],u+=f[64]),u}function c(l){return Object.prototype.toString.call(l)==="[object Uint8Array]"}t.exports=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:i,construct:a,predicate:c,represent:s})}),P_=It((n,t)=>{var r=ln(),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;function a(c){if(c===null)return!0;const l=[],u=c;for(let p=0,d=u.length;p<d;p+=1){const f=u[p];let m=!1;if(i.call(f)!=="[object Object]")return!1;let g;for(g in f)if(o.call(f,g))if(!m)m=!0;else return!1;if(!m)return!1;if(l.indexOf(g)===-1)l.push(g);else return!1}return!0}function s(c){return c!==null?c:[]}t.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:a,construct:s})}),V_=It((n,t)=>{var r=ln(),o=Object.prototype.toString;function i(s){if(s===null)return!0;const c=s,l=new Array(c.length);for(let u=0,p=c.length;u<p;u+=1){const d=c[u];if(o.call(d)!=="[object Object]")return!1;const f=Object.keys(d);if(f.length!==1)return!1;l[u]=[f[0],d[f[0]]]}return!0}function a(s){if(s===null)return[];const c=s,l=new Array(c.length);for(let u=0,p=c.length;u<p;u+=1){const d=c[u],f=Object.keys(d);l[u]=[f[0],d[f[0]]]}return l}t.exports=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:i,construct:a})}),$_=It((n,t)=>{var r=ln(),o=Object.prototype.hasOwnProperty;function i(s){if(s===null)return!0;const c=s;for(const l in c)if(o.call(c,l)&&c[l]!==null)return!1;return!0}function a(s){return s!==null?s:{}}t.exports=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:i,construct:a})}),pf=It((n,t)=>{t.exports=I_().extend({implicit:[B_(),T_()],explicit:[O_(),P_(),V_(),$_()]})}),PO=It((n,t)=>{var r=$a(),o=Ra(),i=OO(),a=pf(),s=Object.prototype.hasOwnProperty,c=1,l=2,u=3,p=4,d=1,f=2,m=3,g=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,y=/[\x85\u2028\u2029]/,b=/[,\[\]{}]/,_=/^(?:!|!!|![0-9A-Za-z-]+!)$/,k=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function C(h){return Object.prototype.toString.call(h)}function N(h){return h===10||h===13}function E(h){return h===9||h===32}function w(h){return h===9||h===32||h===10||h===13}function S(h){return h===44||h===91||h===93||h===123||h===125}function I(h){if(h>=48&&h<=57)return h-48;const T=h|32;return T>=97&&T<=102?T-97+10:-1}function j(h){return h===120?2:h===117?4:h===85?8:0}function A(h){return h>=48&&h<=57?h-48:-1}function x(h){switch(h){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
25
- `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function O(h){return h<=65535?String.fromCharCode(h):String.fromCharCode((h-65536>>10)+55296,(h-65536&1023)+56320)}function P(h,T,G){T==="__proto__"?Object.defineProperty(h,T,{configurable:!0,enumerable:!0,writable:!0,value:G}):h[T]=G}var R=new Array(256),W=new Array(256);for(let h=0;h<256;h++)R[h]=x(h)?1:0,W[h]=x(h);function Z(h,T){this.input=h,this.filename=T.filename||null,this.schema=T.schema||a,this.onWarning=T.onWarning||null,this.legacy=T.legacy||!1,this.json=T.json||!1,this.listener=T.listener||null,this.maxDepth=typeof T.maxDepth=="number"?T.maxDepth:100,this.maxMergeSeqLength=typeof T.maxMergeSeqLength=="number"?T.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=h.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function X(h,T){const G={name:h.filename,buffer:h.input.slice(0,-1),position:h.position,line:h.line,column:h.position-h.lineStart};return G.snippet=i(G),new o(T,G)}function F(h,T){throw X(h,T)}function J(h,T){h.onWarning&&h.onWarning.call(null,X(h,T))}function $(h,T,G){const Y=h.anchorMapTransactions;if(Y.length!==0){const re=Y[Y.length-1];s.call(re,T)||(re[T]={existed:s.call(h.anchorMap,T),value:h.anchorMap[T]})}h.anchorMap[T]=G}function q(h){h.anchorMapTransactions.push(Object.create(null))}function K(h){const T=h.anchorMapTransactions.pop(),G=h.anchorMapTransactions;if(G.length===0)return;const Y=G[G.length-1],re=Object.keys(T);for(let be=0,L=re.length;be<L;be+=1){const de=re[be];s.call(Y,de)||(Y[de]=T[de])}}function ae(h){const T=h.anchorMapTransactions.pop(),G=Object.keys(T);for(let Y=G.length-1;Y>=0;Y-=1){const re=T[G[Y]];re.existed?h.anchorMap[G[Y]]=re.value:delete h.anchorMap[G[Y]]}}function M(h){return{position:h.position,line:h.line,lineStart:h.lineStart,lineIndent:h.lineIndent,firstTabInLine:h.firstTabInLine,tag:h.tag,anchor:h.anchor,kind:h.kind,result:h.result}}function v(h,T){h.position=T.position,h.line=T.line,h.lineStart=T.lineStart,h.lineIndent=T.lineIndent,h.firstTabInLine=T.firstTabInLine,h.tag=T.tag,h.anchor=T.anchor,h.kind=T.kind,h.result=T.result}var H={YAML:function(T,G,Y){T.version!==null&&F(T,"duplication of %YAML directive"),Y.length!==1&&F(T,"YAML directive accepts exactly one argument");const re=/^([0-9]+)\.([0-9]+)$/.exec(Y[0]);re===null&&F(T,"ill-formed argument of the YAML directive");const be=parseInt(re[1],10),L=parseInt(re[2],10);be!==1&&F(T,"unacceptable YAML version of the document"),T.version=Y[0],T.checkLineBreaks=L<2,L!==1&&L!==2&&J(T,"unsupported YAML version of the document")},TAG:function(T,G,Y){let re;Y.length!==2&&F(T,"TAG directive accepts exactly two arguments");const be=Y[0];re=Y[1],_.test(be)||F(T,"ill-formed tag handle (first argument) of the TAG directive"),s.call(T.tagMap,be)&&F(T,'there is a previously declared suffix for "'+be+'" tag handle'),k.test(re)||F(T,"ill-formed tag prefix (second argument) of the TAG directive");try{re=decodeURIComponent(re)}catch{F(T,"tag prefix is malformed: "+re)}T.tagMap[be]=re}};function oe(h,T,G,Y){if(T<G){const re=h.input.slice(T,G);if(Y)for(let be=0,L=re.length;be<L;be+=1){const de=re.charCodeAt(be);de===9||de>=32&&de<=1114111||F(h,"expected valid JSON character")}else g.test(re)&&F(h,"the stream contains non-printable characters");h.result+=re}}function te(h,T,G,Y){r.isObject(G)||F(h,"cannot merge mappings; the provided source object is unacceptable");const re=Object.keys(G);for(let be=0,L=re.length;be<L;be+=1){const de=re[be];s.call(T,de)||(P(T,de,G[de]),Y[de]=!0)}}function ge(h,T,G,Y,re,be,L,de,Ne){if(Array.isArray(re)){re=Array.prototype.slice.call(re);for(let z=0,V=re.length;z<V;z+=1)Array.isArray(re[z])&&F(h,"nested arrays are not supported inside keys"),typeof re=="object"&&C(re[z])==="[object Object]"&&(re[z]="[object Object]")}if(typeof re=="object"&&C(re)==="[object Object]"&&(re="[object Object]"),re=String(re),T===null&&(T={}),Y==="tag:yaml.org,2002:merge")if(Array.isArray(be)){be.length>h.maxMergeSeqLength&&F(h,"merge sequence length exceeded maxMergeSeqLength ("+h.maxMergeSeqLength+")");const z=new Set;for(let V=0,D=be.length;V<D;V+=1){const ne=be[V];z.has(ne)||(z.add(ne),te(h,T,ne,G))}}else te(h,T,be,G);else!h.json&&!s.call(G,re)&&s.call(T,re)&&(h.line=L||h.line,h.lineStart=de||h.lineStart,h.position=Ne||h.position,F(h,"duplicated mapping key")),P(T,re,be),delete G[re];return T}function me(h){const T=h.input.charCodeAt(h.position);T===10?h.position++:T===13?(h.position++,h.input.charCodeAt(h.position)===10&&h.position++):F(h,"a line break is expected"),h.line+=1,h.lineStart=h.position,h.firstTabInLine=-1}function le(h,T,G){let Y=0,re=h.input.charCodeAt(h.position);for(;re!==0;){for(;E(re);)re===9&&h.firstTabInLine===-1&&(h.firstTabInLine=h.position),re=h.input.charCodeAt(++h.position);if(T&&re===35)do re=h.input.charCodeAt(++h.position);while(re!==10&&re!==13&&re!==0);if(N(re))for(me(h),re=h.input.charCodeAt(h.position),Y++,h.lineIndent=0;re===32;)h.lineIndent++,re=h.input.charCodeAt(++h.position);else break}return G!==-1&&Y!==0&&h.lineIndent<G&&J(h,"deficient indentation"),Y}function he(h){let T=h.position,G=h.input.charCodeAt(T);return!!((G===45||G===46)&&G===h.input.charCodeAt(T+1)&&G===h.input.charCodeAt(T+2)&&(T+=3,G=h.input.charCodeAt(T),G===0||w(G)))}function Oe(h,T){T===1?h.result+=" ":T>1&&(h.result+=r.repeat(`
26
- `,T-1))}function $e(h,T,G){let Y,re,be,L,de,Ne;const z=h.kind,V=h.result;let D=h.input.charCodeAt(h.position);if(w(D)||S(D)||D===35||D===38||D===42||D===33||D===124||D===62||D===39||D===34||D===37||D===64||D===96)return!1;if(D===63||D===45){const ne=h.input.charCodeAt(h.position+1);if(w(ne)||G&&S(ne))return!1}for(h.kind="scalar",h.result="",Y=re=h.position,be=!1;D!==0;){if(D===58){const ne=h.input.charCodeAt(h.position+1);if(w(ne)||G&&S(ne))break}else if(D===35){if(w(h.input.charCodeAt(h.position-1)))break}else{if(h.position===h.lineStart&&he(h)||G&&S(D))break;if(N(D))if(L=h.line,de=h.lineStart,Ne=h.lineIndent,le(h,!1,-1),h.lineIndent>=T){be=!0,D=h.input.charCodeAt(h.position);continue}else{h.position=re,h.line=L,h.lineStart=de,h.lineIndent=Ne;break}}be&&(oe(h,Y,re,!1),Oe(h,h.line-L),Y=re=h.position,be=!1),E(D)||(re=h.position+1),D=h.input.charCodeAt(++h.position)}return oe(h,Y,re,!1),h.result?!0:(h.kind=z,h.result=V,!1)}function Pe(h,T){let G,Y,re=h.input.charCodeAt(h.position);if(re!==39)return!1;for(h.kind="scalar",h.result="",h.position++,G=Y=h.position;(re=h.input.charCodeAt(h.position))!==0;)if(re===39)if(oe(h,G,h.position,!0),re=h.input.charCodeAt(++h.position),re===39)G=h.position,h.position++,Y=h.position;else return!0;else N(re)?(oe(h,G,Y,!0),Oe(h,le(h,!1,T)),G=Y=h.position):h.position===h.lineStart&&he(h)?F(h,"unexpected end of the document within a single quoted scalar"):(h.position++,E(re)||(Y=h.position));F(h,"unexpected end of the stream within a single quoted scalar")}function qe(h,T){let G,Y,re,be=h.input.charCodeAt(h.position);if(be!==34)return!1;for(h.kind="scalar",h.result="",h.position++,G=Y=h.position;(be=h.input.charCodeAt(h.position))!==0;){if(be===34)return oe(h,G,h.position,!0),h.position++,!0;if(be===92){if(oe(h,G,h.position,!0),be=h.input.charCodeAt(++h.position),N(be))le(h,!1,T);else if(be<256&&R[be])h.result+=W[be],h.position++;else if((re=j(be))>0){let L=re,de=0;for(;L>0;L--)be=h.input.charCodeAt(++h.position),(re=I(be))>=0?de=(de<<4)+re:F(h,"expected hexadecimal character");h.result+=O(de),h.position++}else F(h,"unknown escape sequence");G=Y=h.position}else N(be)?(oe(h,G,Y,!0),Oe(h,le(h,!1,T)),G=Y=h.position):h.position===h.lineStart&&he(h)?F(h,"unexpected end of the document within a double quoted scalar"):(h.position++,E(be)||(Y=h.position))}F(h,"unexpected end of the stream within a double quoted scalar")}function Ye(h,T){let G=!0,Y,re,be;const L=h.tag;let de;const Ne=h.anchor;let z,V,D,ne;const ce=Object.create(null);let Ce,Se,ve,ze=h.input.charCodeAt(h.position);if(ze===91)z=93,ne=!1,de=[];else if(ze===123)z=125,ne=!0,de={};else return!1;for(h.anchor!==null&&$(h,h.anchor,de),ze=h.input.charCodeAt(++h.position);ze!==0;){if(le(h,!0,T),ze=h.input.charCodeAt(h.position),ze===z)return h.position++,h.tag=L,h.anchor=Ne,h.kind=ne?"mapping":"sequence",h.result=de,!0;G?ze===44&&F(h,"expected the node content, but found ','"):F(h,"missed comma between flow collection entries"),Se=Ce=ve=null,V=D=!1,ze===63&&w(h.input.charCodeAt(h.position+1))&&(V=D=!0,h.position++,le(h,!0,T)),Y=h.line,re=h.lineStart,be=h.position,se(h,T,c,!1,!0),Se=h.tag,Ce=h.result,le(h,!0,T),ze=h.input.charCodeAt(h.position),(D||h.line===Y)&&ze===58&&(V=!0,ze=h.input.charCodeAt(++h.position),le(h,!0,T),se(h,T,c,!1,!0),ve=h.result),ne?ge(h,de,ce,Se,Ce,ve,Y,re,be):V?de.push(ge(h,null,ce,Se,Ce,ve,Y,re,be)):de.push(Ce),le(h,!0,T),ze=h.input.charCodeAt(h.position),ze===44?(G=!0,ze=h.input.charCodeAt(++h.position)):G=!1}F(h,"unexpected end of the stream within a flow collection")}function et(h,T){let G,Y=d,re=!1,be=!1,L=T,de=0,Ne=!1,z,V=h.input.charCodeAt(h.position);if(V===124)G=!1;else if(V===62)G=!0;else return!1;for(h.kind="scalar",h.result="";V!==0;)if(V=h.input.charCodeAt(++h.position),V===43||V===45)d===Y?Y=V===43?m:f:F(h,"repeat of a chomping mode identifier");else if((z=A(V))>=0)z===0?F(h,"bad explicit indentation width of a block scalar; it cannot be less than one"):be?F(h,"repeat of an indentation width identifier"):(L=T+z-1,be=!0);else break;if(E(V)){do V=h.input.charCodeAt(++h.position);while(E(V));if(V===35)do V=h.input.charCodeAt(++h.position);while(!N(V)&&V!==0)}for(;V!==0;){for(me(h),h.lineIndent=0,V=h.input.charCodeAt(h.position);(!be||h.lineIndent<L)&&V===32;)h.lineIndent++,V=h.input.charCodeAt(++h.position);if(!be&&h.lineIndent>L&&(L=h.lineIndent),N(V)){de++;continue}if(!be&&L===0&&F(h,"missing indentation for block scalar"),h.lineIndent<L){Y===m?h.result+=r.repeat(`
25
+ `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function O(h){return h<=65535?String.fromCharCode(h):String.fromCharCode((h-65536>>10)+55296,(h-65536&1023)+56320)}function P(h,T,G){T==="__proto__"?Object.defineProperty(h,T,{configurable:!0,enumerable:!0,writable:!0,value:G}):h[T]=G}var R=new Array(256),W=new Array(256);for(let h=0;h<256;h++)R[h]=x(h)?1:0,W[h]=x(h);function Z(h,T){this.input=h,this.filename=T.filename||null,this.schema=T.schema||a,this.onWarning=T.onWarning||null,this.legacy=T.legacy||!1,this.json=T.json||!1,this.listener=T.listener||null,this.maxDepth=typeof T.maxDepth=="number"?T.maxDepth:100,this.maxMergeSeqLength=typeof T.maxMergeSeqLength=="number"?T.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=h.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function X(h,T){const G={name:h.filename,buffer:h.input.slice(0,-1),position:h.position,line:h.line,column:h.position-h.lineStart};return G.snippet=i(G),new o(T,G)}function F(h,T){throw X(h,T)}function J(h,T){h.onWarning&&h.onWarning.call(null,X(h,T))}function $(h,T,G){const Y=h.anchorMapTransactions;if(Y.length!==0){const re=Y[Y.length-1];s.call(re,T)||(re[T]={existed:s.call(h.anchorMap,T),value:h.anchorMap[T]})}h.anchorMap[T]=G}function q(h){h.anchorMapTransactions.push(Object.create(null))}function K(h){const T=h.anchorMapTransactions.pop(),G=h.anchorMapTransactions;if(G.length===0)return;const Y=G[G.length-1],re=Object.keys(T);for(let we=0,L=re.length;we<L;we+=1){const de=re[we];s.call(Y,de)||(Y[de]=T[de])}}function ae(h){const T=h.anchorMapTransactions.pop(),G=Object.keys(T);for(let Y=G.length-1;Y>=0;Y-=1){const re=T[G[Y]];re.existed?h.anchorMap[G[Y]]=re.value:delete h.anchorMap[G[Y]]}}function M(h){return{position:h.position,line:h.line,lineStart:h.lineStart,lineIndent:h.lineIndent,firstTabInLine:h.firstTabInLine,tag:h.tag,anchor:h.anchor,kind:h.kind,result:h.result}}function v(h,T){h.position=T.position,h.line=T.line,h.lineStart=T.lineStart,h.lineIndent=T.lineIndent,h.firstTabInLine=T.firstTabInLine,h.tag=T.tag,h.anchor=T.anchor,h.kind=T.kind,h.result=T.result}var H={YAML:function(T,G,Y){T.version!==null&&F(T,"duplication of %YAML directive"),Y.length!==1&&F(T,"YAML directive accepts exactly one argument");const re=/^([0-9]+)\.([0-9]+)$/.exec(Y[0]);re===null&&F(T,"ill-formed argument of the YAML directive");const we=parseInt(re[1],10),L=parseInt(re[2],10);we!==1&&F(T,"unacceptable YAML version of the document"),T.version=Y[0],T.checkLineBreaks=L<2,L!==1&&L!==2&&J(T,"unsupported YAML version of the document")},TAG:function(T,G,Y){let re;Y.length!==2&&F(T,"TAG directive accepts exactly two arguments");const we=Y[0];re=Y[1],_.test(we)||F(T,"ill-formed tag handle (first argument) of the TAG directive"),s.call(T.tagMap,we)&&F(T,'there is a previously declared suffix for "'+we+'" tag handle'),k.test(re)||F(T,"ill-formed tag prefix (second argument) of the TAG directive");try{re=decodeURIComponent(re)}catch{F(T,"tag prefix is malformed: "+re)}T.tagMap[we]=re}};function oe(h,T,G,Y){if(T<G){const re=h.input.slice(T,G);if(Y)for(let we=0,L=re.length;we<L;we+=1){const de=re.charCodeAt(we);de===9||de>=32&&de<=1114111||F(h,"expected valid JSON character")}else g.test(re)&&F(h,"the stream contains non-printable characters");h.result+=re}}function te(h,T,G,Y){r.isObject(G)||F(h,"cannot merge mappings; the provided source object is unacceptable");const re=Object.keys(G);for(let we=0,L=re.length;we<L;we+=1){const de=re[we];s.call(T,de)||(P(T,de,G[de]),Y[de]=!0)}}function ge(h,T,G,Y,re,we,L,de,Ne){if(Array.isArray(re)){re=Array.prototype.slice.call(re);for(let z=0,V=re.length;z<V;z+=1)Array.isArray(re[z])&&F(h,"nested arrays are not supported inside keys"),typeof re=="object"&&C(re[z])==="[object Object]"&&(re[z]="[object Object]")}if(typeof re=="object"&&C(re)==="[object Object]"&&(re="[object Object]"),re=String(re),T===null&&(T={}),Y==="tag:yaml.org,2002:merge")if(Array.isArray(we)){we.length>h.maxMergeSeqLength&&F(h,"merge sequence length exceeded maxMergeSeqLength ("+h.maxMergeSeqLength+")");const z=new Set;for(let V=0,D=we.length;V<D;V+=1){const ne=we[V];z.has(ne)||(z.add(ne),te(h,T,ne,G))}}else te(h,T,we,G);else!h.json&&!s.call(G,re)&&s.call(T,re)&&(h.line=L||h.line,h.lineStart=de||h.lineStart,h.position=Ne||h.position,F(h,"duplicated mapping key")),P(T,re,we),delete G[re];return T}function me(h){const T=h.input.charCodeAt(h.position);T===10?h.position++:T===13?(h.position++,h.input.charCodeAt(h.position)===10&&h.position++):F(h,"a line break is expected"),h.line+=1,h.lineStart=h.position,h.firstTabInLine=-1}function le(h,T,G){let Y=0,re=h.input.charCodeAt(h.position);for(;re!==0;){for(;E(re);)re===9&&h.firstTabInLine===-1&&(h.firstTabInLine=h.position),re=h.input.charCodeAt(++h.position);if(T&&re===35)do re=h.input.charCodeAt(++h.position);while(re!==10&&re!==13&&re!==0);if(N(re))for(me(h),re=h.input.charCodeAt(h.position),Y++,h.lineIndent=0;re===32;)h.lineIndent++,re=h.input.charCodeAt(++h.position);else break}return G!==-1&&Y!==0&&h.lineIndent<G&&J(h,"deficient indentation"),Y}function he(h){let T=h.position,G=h.input.charCodeAt(T);return!!((G===45||G===46)&&G===h.input.charCodeAt(T+1)&&G===h.input.charCodeAt(T+2)&&(T+=3,G=h.input.charCodeAt(T),G===0||w(G)))}function Oe(h,T){T===1?h.result+=" ":T>1&&(h.result+=r.repeat(`
26
+ `,T-1))}function $e(h,T,G){let Y,re,we,L,de,Ne;const z=h.kind,V=h.result;let D=h.input.charCodeAt(h.position);if(w(D)||S(D)||D===35||D===38||D===42||D===33||D===124||D===62||D===39||D===34||D===37||D===64||D===96)return!1;if(D===63||D===45){const ne=h.input.charCodeAt(h.position+1);if(w(ne)||G&&S(ne))return!1}for(h.kind="scalar",h.result="",Y=re=h.position,we=!1;D!==0;){if(D===58){const ne=h.input.charCodeAt(h.position+1);if(w(ne)||G&&S(ne))break}else if(D===35){if(w(h.input.charCodeAt(h.position-1)))break}else{if(h.position===h.lineStart&&he(h)||G&&S(D))break;if(N(D))if(L=h.line,de=h.lineStart,Ne=h.lineIndent,le(h,!1,-1),h.lineIndent>=T){we=!0,D=h.input.charCodeAt(h.position);continue}else{h.position=re,h.line=L,h.lineStart=de,h.lineIndent=Ne;break}}we&&(oe(h,Y,re,!1),Oe(h,h.line-L),Y=re=h.position,we=!1),E(D)||(re=h.position+1),D=h.input.charCodeAt(++h.position)}return oe(h,Y,re,!1),h.result?!0:(h.kind=z,h.result=V,!1)}function Pe(h,T){let G,Y,re=h.input.charCodeAt(h.position);if(re!==39)return!1;for(h.kind="scalar",h.result="",h.position++,G=Y=h.position;(re=h.input.charCodeAt(h.position))!==0;)if(re===39)if(oe(h,G,h.position,!0),re=h.input.charCodeAt(++h.position),re===39)G=h.position,h.position++,Y=h.position;else return!0;else N(re)?(oe(h,G,Y,!0),Oe(h,le(h,!1,T)),G=Y=h.position):h.position===h.lineStart&&he(h)?F(h,"unexpected end of the document within a single quoted scalar"):(h.position++,E(re)||(Y=h.position));F(h,"unexpected end of the stream within a single quoted scalar")}function qe(h,T){let G,Y,re,we=h.input.charCodeAt(h.position);if(we!==34)return!1;for(h.kind="scalar",h.result="",h.position++,G=Y=h.position;(we=h.input.charCodeAt(h.position))!==0;){if(we===34)return oe(h,G,h.position,!0),h.position++,!0;if(we===92){if(oe(h,G,h.position,!0),we=h.input.charCodeAt(++h.position),N(we))le(h,!1,T);else if(we<256&&R[we])h.result+=W[we],h.position++;else if((re=j(we))>0){let L=re,de=0;for(;L>0;L--)we=h.input.charCodeAt(++h.position),(re=I(we))>=0?de=(de<<4)+re:F(h,"expected hexadecimal character");h.result+=O(de),h.position++}else F(h,"unknown escape sequence");G=Y=h.position}else N(we)?(oe(h,G,Y,!0),Oe(h,le(h,!1,T)),G=Y=h.position):h.position===h.lineStart&&he(h)?F(h,"unexpected end of the document within a double quoted scalar"):(h.position++,E(we)||(Y=h.position))}F(h,"unexpected end of the stream within a double quoted scalar")}function Ye(h,T){let G=!0,Y,re,we;const L=h.tag;let de;const Ne=h.anchor;let z,V,D,ne;const ce=Object.create(null);let Ce,Se,ve,ze=h.input.charCodeAt(h.position);if(ze===91)z=93,ne=!1,de=[];else if(ze===123)z=125,ne=!0,de={};else return!1;for(h.anchor!==null&&$(h,h.anchor,de),ze=h.input.charCodeAt(++h.position);ze!==0;){if(le(h,!0,T),ze=h.input.charCodeAt(h.position),ze===z)return h.position++,h.tag=L,h.anchor=Ne,h.kind=ne?"mapping":"sequence",h.result=de,!0;G?ze===44&&F(h,"expected the node content, but found ','"):F(h,"missed comma between flow collection entries"),Se=Ce=ve=null,V=D=!1,ze===63&&w(h.input.charCodeAt(h.position+1))&&(V=D=!0,h.position++,le(h,!0,T)),Y=h.line,re=h.lineStart,we=h.position,se(h,T,c,!1,!0),Se=h.tag,Ce=h.result,le(h,!0,T),ze=h.input.charCodeAt(h.position),(D||h.line===Y)&&ze===58&&(V=!0,ze=h.input.charCodeAt(++h.position),le(h,!0,T),se(h,T,c,!1,!0),ve=h.result),ne?ge(h,de,ce,Se,Ce,ve,Y,re,we):V?de.push(ge(h,null,ce,Se,Ce,ve,Y,re,we)):de.push(Ce),le(h,!0,T),ze=h.input.charCodeAt(h.position),ze===44?(G=!0,ze=h.input.charCodeAt(++h.position)):G=!1}F(h,"unexpected end of the stream within a flow collection")}function et(h,T){let G,Y=d,re=!1,we=!1,L=T,de=0,Ne=!1,z,V=h.input.charCodeAt(h.position);if(V===124)G=!1;else if(V===62)G=!0;else return!1;for(h.kind="scalar",h.result="";V!==0;)if(V=h.input.charCodeAt(++h.position),V===43||V===45)d===Y?Y=V===43?m:f:F(h,"repeat of a chomping mode identifier");else if((z=A(V))>=0)z===0?F(h,"bad explicit indentation width of a block scalar; it cannot be less than one"):we?F(h,"repeat of an indentation width identifier"):(L=T+z-1,we=!0);else break;if(E(V)){do V=h.input.charCodeAt(++h.position);while(E(V));if(V===35)do V=h.input.charCodeAt(++h.position);while(!N(V)&&V!==0)}for(;V!==0;){for(me(h),h.lineIndent=0,V=h.input.charCodeAt(h.position);(!we||h.lineIndent<L)&&V===32;)h.lineIndent++,V=h.input.charCodeAt(++h.position);if(!we&&h.lineIndent>L&&(L=h.lineIndent),N(V)){de++;continue}if(!we&&L===0&&F(h,"missing indentation for block scalar"),h.lineIndent<L){Y===m?h.result+=r.repeat(`
27
27
  `,re?1+de:de):Y===d&&re&&(h.result+=`
28
28
  `);break}G?E(V)?(Ne=!0,h.result+=r.repeat(`
29
29
  `,re?1+de:de)):Ne?(Ne=!1,h.result+=r.repeat(`
30
30
  `,de+1)):de===0?re&&(h.result+=" "):h.result+=r.repeat(`
31
31
  `,de):h.result+=r.repeat(`
32
- `,re?1+de:de),re=!0,be=!0,de=0;const D=h.position;for(;!N(V)&&V!==0;)V=h.input.charCodeAt(++h.position);oe(h,D,h.position,!1)}return!0}function Ve(h,T){const G=h.tag,Y=h.anchor,re=[];let be=!1;if(h.firstTabInLine!==-1)return!1;h.anchor!==null&&$(h,h.anchor,re);let L=h.input.charCodeAt(h.position);for(;L!==0&&(h.firstTabInLine!==-1&&(h.position=h.firstTabInLine,F(h,"tab characters must not be used in indentation")),!(L!==45||!w(h.input.charCodeAt(h.position+1))));){if(be=!0,h.position++,le(h,!0,-1)&&h.lineIndent<=T){re.push(null),L=h.input.charCodeAt(h.position);continue}const de=h.line;if(se(h,T,u,!1,!0),re.push(h.result),le(h,!0,-1),L=h.input.charCodeAt(h.position),(h.line===de||h.lineIndent>T)&&L!==0)F(h,"bad indentation of a sequence entry");else if(h.lineIndent<T)break}return be?(h.tag=G,h.anchor=Y,h.kind="sequence",h.result=re,!0):!1}function ke(h,T,G){let Y,re,be,L;const de=h.tag,Ne=h.anchor,z={},V=Object.create(null);let D=null,ne=null,ce=null,Ce=!1,Se=!1;if(h.firstTabInLine!==-1)return!1;h.anchor!==null&&$(h,h.anchor,z);let ve=h.input.charCodeAt(h.position);for(;ve!==0;){!Ce&&h.firstTabInLine!==-1&&(h.position=h.firstTabInLine,F(h,"tab characters must not be used in indentation"));const ze=h.input.charCodeAt(h.position+1),Ke=h.line;if((ve===63||ve===58)&&w(ze))ve===63?(Ce&&(ge(h,z,V,D,ne,null,re,be,L),D=ne=ce=null),Se=!0,Ce=!0,Y=!0):Ce?(Ce=!1,Y=!0):F(h,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),h.position+=1,ve=ze;else{if(re=h.line,be=h.lineStart,L=h.position,!se(h,G,l,!1,!0))break;if(h.line===Ke){for(ve=h.input.charCodeAt(h.position);E(ve);)ve=h.input.charCodeAt(++h.position);if(ve===58)ve=h.input.charCodeAt(++h.position),w(ve)||F(h,"a whitespace character is expected after the key-value separator within a block mapping"),Ce&&(ge(h,z,V,D,ne,null,re,be,L),D=ne=ce=null),Se=!0,Ce=!1,Y=!1,D=h.tag,ne=h.result;else if(Se)F(h,"can not read an implicit mapping pair; a colon is missed");else return h.tag=de,h.anchor=Ne,!0}else if(Se)F(h,"can not read a block mapping entry; a multiline key may not be an implicit key");else return h.tag=de,h.anchor=Ne,!0}if((h.line===Ke||h.lineIndent>T)&&(Ce&&(re=h.line,be=h.lineStart,L=h.position),se(h,T,p,!0,Y)&&(Ce?ne=h.result:ce=h.result),Ce||(ge(h,z,V,D,ne,ce,re,be,L),D=ne=ce=null),le(h,!0,-1),ve=h.input.charCodeAt(h.position)),(h.line===Ke||h.lineIndent>T)&&ve!==0)F(h,"bad indentation of a mapping entry");else if(h.lineIndent<T)break}return Ce&&ge(h,z,V,D,ne,null,re,be,L),Se&&(h.tag=de,h.anchor=Ne,h.kind="mapping",h.result=z),Se}function we(h){let T=!1,G=!1,Y,re,be=h.input.charCodeAt(h.position);if(be!==33)return!1;h.tag!==null&&F(h,"duplication of a tag property"),be=h.input.charCodeAt(++h.position),be===60?(T=!0,be=h.input.charCodeAt(++h.position)):be===33?(G=!0,Y="!!",be=h.input.charCodeAt(++h.position)):Y="!";let L=h.position;if(T){do be=h.input.charCodeAt(++h.position);while(be!==0&&be!==62);h.position<h.length?(re=h.input.slice(L,h.position),be=h.input.charCodeAt(++h.position)):F(h,"unexpected end of the stream within a verbatim tag")}else{for(;be!==0&&!w(be);)be===33&&(G?F(h,"tag suffix cannot contain exclamation marks"):(Y=h.input.slice(L-1,h.position+1),_.test(Y)||F(h,"named tag handle cannot contain such characters"),G=!0,L=h.position+1)),be=h.input.charCodeAt(++h.position);re=h.input.slice(L,h.position),b.test(re)&&F(h,"tag suffix cannot contain flow indicator characters")}re&&!k.test(re)&&F(h,"tag name cannot contain such characters: "+re);try{re=decodeURIComponent(re)}catch{F(h,"tag name is malformed: "+re)}return T?h.tag=re:s.call(h.tagMap,Y)?h.tag=h.tagMap[Y]+re:Y==="!"?h.tag="!"+re:Y==="!!"?h.tag="tag:yaml.org,2002:"+re:F(h,'undeclared tag handle "'+Y+'"'),!0}function ye(h){let T=h.input.charCodeAt(h.position);if(T!==38)return!1;h.anchor!==null&&F(h,"duplication of an anchor property"),T=h.input.charCodeAt(++h.position);const G=h.position;for(;T!==0&&!w(T)&&!S(T);)T=h.input.charCodeAt(++h.position);return h.position===G&&F(h,"name of an anchor node must contain at least one character"),h.anchor=h.input.slice(G,h.position),!0}function ie(h){let T=h.input.charCodeAt(h.position);if(T!==42)return!1;T=h.input.charCodeAt(++h.position);const G=h.position;for(;T!==0&&!w(T)&&!S(T);)T=h.input.charCodeAt(++h.position);h.position===G&&F(h,"name of an alias node must contain at least one character");const Y=h.input.slice(G,h.position);return s.call(h.anchorMap,Y)||F(h,'unidentified alias "'+Y+'"'),h.result=h.anchorMap[Y],le(h,!0,-1),!0}function ee(h,T,G,Y){const re=M(h);return q(h),v(h,T),h.tag=null,h.anchor=null,h.kind=null,h.result=null,ke(h,G,Y)&&h.kind==="mapping"?(K(h),!0):(ae(h),v(h,re),!1)}function se(h,T,G,Y,re){let be,L,de=1,Ne=!1,z=!1,V=null,D,ne,ce;h.depth>=h.maxDepth&&F(h,"nesting exceeded maxDepth ("+h.maxDepth+")"),h.depth+=1,h.listener!==null&&h.listener("open",h),h.tag=null,h.anchor=null,h.kind=null,h.result=null;const Ce=be=L=p===G||u===G;if(Y&&le(h,!0,-1)&&(Ne=!0,h.lineIndent>T?de=1:h.lineIndent===T?de=0:h.lineIndent<T&&(de=-1)),de===1)for(;;){const Se=h.input.charCodeAt(h.position),ve=M(h);if(Ne&&(Se===33&&h.tag!==null||Se===38&&h.anchor!==null)||!we(h)&&!ye(h))break;V===null&&(V=ve),le(h,!0,-1)?(Ne=!0,L=Ce,h.lineIndent>T?de=1:h.lineIndent===T?de=0:h.lineIndent<T&&(de=-1)):L=!1}if(L&&(L=Ne||re),de===1||p===G)if(c===G||l===G?ne=T:ne=T+1,ce=h.position-h.lineStart,de===1)if(L&&(Ve(h,ce)||ke(h,ce,ne))||Ye(h,ne))z=!0;else{const Se=h.input.charCodeAt(h.position);V!==null&&Ce&&!L&&Se!==124&&Se!==62&&ee(h,V,V.position-V.lineStart,ne)||be&&et(h,ne)||Pe(h,ne)||qe(h,ne)?z=!0:ie(h)?(z=!0,(h.tag!==null||h.anchor!==null)&&F(h,"alias node should not have any properties")):$e(h,ne,c===G)&&(z=!0,h.tag===null&&(h.tag="?")),h.anchor!==null&&$(h,h.anchor,h.result)}else de===0&&(z=L&&Ve(h,ce));if(h.tag===null)h.anchor!==null&&$(h,h.anchor,h.result);else if(h.tag==="?"){h.result!==null&&h.kind!=="scalar"&&F(h,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+h.kind+'"');for(let Se=0,ve=h.implicitTypes.length;Se<ve;Se+=1)if(D=h.implicitTypes[Se],D.resolve(h.result)){h.result=D.construct(h.result),h.tag=D.tag,h.anchor!==null&&$(h,h.anchor,h.result);break}}else if(h.tag!=="!"){if(s.call(h.typeMap[h.kind||"fallback"],h.tag))D=h.typeMap[h.kind||"fallback"][h.tag];else{D=null;const Se=h.typeMap.multi[h.kind||"fallback"];for(let ve=0,ze=Se.length;ve<ze;ve+=1)if(h.tag.slice(0,Se[ve].tag.length)===Se[ve].tag){D=Se[ve];break}}D||F(h,"unknown tag !<"+h.tag+">"),h.result!==null&&D.kind!==h.kind&&F(h,"unacceptable node kind for !<"+h.tag+'> tag; it should be "'+D.kind+'", not "'+h.kind+'"'),D.resolve(h.result,h.tag)?(h.result=D.construct(h.result,h.tag),h.anchor!==null&&$(h,h.anchor,h.result)):F(h,"cannot resolve a node with !<"+h.tag+"> explicit tag")}return h.listener!==null&&h.listener("close",h),h.depth-=1,h.tag!==null||h.anchor!==null||z}function ue(h){const T=h.position;let G=!1,Y;for(h.version=null,h.checkLineBreaks=h.legacy,h.tagMap=Object.create(null),h.anchorMap=Object.create(null);(Y=h.input.charCodeAt(h.position))!==0&&(le(h,!0,-1),Y=h.input.charCodeAt(h.position),!(h.lineIndent>0||Y!==37));){G=!0,Y=h.input.charCodeAt(++h.position);let re=h.position;for(;Y!==0&&!w(Y);)Y=h.input.charCodeAt(++h.position);const be=h.input.slice(re,h.position),L=[];for(be.length<1&&F(h,"directive name must not be less than one character in length");Y!==0;){for(;E(Y);)Y=h.input.charCodeAt(++h.position);if(Y===35){do Y=h.input.charCodeAt(++h.position);while(Y!==0&&!N(Y));break}if(N(Y))break;for(re=h.position;Y!==0&&!w(Y);)Y=h.input.charCodeAt(++h.position);L.push(h.input.slice(re,h.position))}Y!==0&&me(h),s.call(H,be)?H[be](h,be,L):J(h,'unknown document directive "'+be+'"')}if(le(h,!0,-1),h.lineIndent===0&&h.input.charCodeAt(h.position)===45&&h.input.charCodeAt(h.position+1)===45&&h.input.charCodeAt(h.position+2)===45?(h.position+=3,le(h,!0,-1)):G&&F(h,"directives end mark is expected"),se(h,h.lineIndent-1,p,!1,!0),le(h,!0,-1),h.checkLineBreaks&&y.test(h.input.slice(T,h.position))&&J(h,"non-ASCII line breaks are interpreted as content"),h.documents.push(h.result),h.position===h.lineStart&&he(h)){h.input.charCodeAt(h.position)===46&&(h.position+=3,le(h,!0,-1));return}h.position<h.length-1&&F(h,"end of the stream or a document separator is expected")}function Ee(h,T){h=String(h),T=T||{},h.length!==0&&(h.charCodeAt(h.length-1)!==10&&h.charCodeAt(h.length-1)!==13&&(h+=`
33
- `),h.charCodeAt(0)===65279&&(h=h.slice(1)));const G=new Z(h,T),Y=h.indexOf("\0");for(Y!==-1&&(G.position=Y,F(G,"null byte is not allowed in input")),G.input+="\0";G.input.charCodeAt(G.position)===32;)G.lineIndent+=1,G.position+=1;for(;G.position<G.length-1;)ue(G);return G.documents}function _e(h,T,G){T!==null&&typeof T=="object"&&typeof G>"u"&&(G=T,T=null);const Y=Ee(h,G);if(typeof T!="function")return Y;for(let re=0,be=Y.length;re<be;re+=1)T(Y[re])}function xe(h,T){const G=Ee(h,T);if(G.length!==0){if(G.length===1)return G[0];throw new o("expected a single document in the stream, but found more")}}t.exports.loadAll=_e,t.exports.load=xe}),VO=It((n,t)=>{var r=$a(),o=Ra(),i=pf(),a=Object.prototype.toString,s=Object.prototype.hasOwnProperty,c=65279,l=9,u=10,p=13,d=32,f=33,m=34,g=35,y=37,b=38,_=39,k=42,C=44,N=45,E=58,w=61,S=62,I=63,j=64,A=91,x=93,O=96,P=123,R=124,W=125,Z={};Z[0]="\\0",Z[7]="\\a",Z[8]="\\b",Z[9]="\\t",Z[10]="\\n",Z[11]="\\v",Z[12]="\\f",Z[13]="\\r",Z[27]="\\e",Z[34]='\\"',Z[92]="\\\\",Z[133]="\\N",Z[160]="\\_",Z[8232]="\\L",Z[8233]="\\P";var X=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],F=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function J(L,de){if(de===null)return{};const Ne={},z=Object.keys(de);for(let V=0,D=z.length;V<D;V+=1){let ne=z[V],ce=String(de[ne]);ne.slice(0,2)==="!!"&&(ne="tag:yaml.org,2002:"+ne.slice(2));const Ce=L.compiledTypeMap.fallback[ne];Ce&&s.call(Ce.styleAliases,ce)&&(ce=Ce.styleAliases[ce]),Ne[ne]=ce}return Ne}function $(L){let de,Ne;const z=L.toString(16).toUpperCase();if(L<=255)de="x",Ne=2;else if(L<=65535)de="u",Ne=4;else if(L<=4294967295)de="U",Ne=8;else throw new o("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+de+r.repeat("0",Ne-z.length)+z}var q=1,K=2;function ae(L){this.schema=L.schema||i,this.indent=Math.max(1,L.indent||2),this.noArrayIndent=L.noArrayIndent||!1,this.skipInvalid=L.skipInvalid||!1,this.flowLevel=r.isNothing(L.flowLevel)?-1:L.flowLevel,this.styleMap=J(this.schema,L.styles||null),this.sortKeys=L.sortKeys||!1,this.lineWidth=L.lineWidth||80,this.noRefs=L.noRefs||!1,this.noCompatMode=L.noCompatMode||!1,this.condenseFlow=L.condenseFlow||!1,this.quotingType=L.quotingType==='"'?K:q,this.forceQuotes=L.forceQuotes||!1,this.replacer=typeof L.replacer=="function"?L.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function M(L,de){const Ne=r.repeat(" ",de);let z=0,V="";const D=L.length;for(;z<D;){let ne;const ce=L.indexOf(`
32
+ `,re?1+de:de),re=!0,we=!0,de=0;const D=h.position;for(;!N(V)&&V!==0;)V=h.input.charCodeAt(++h.position);oe(h,D,h.position,!1)}return!0}function Ve(h,T){const G=h.tag,Y=h.anchor,re=[];let we=!1;if(h.firstTabInLine!==-1)return!1;h.anchor!==null&&$(h,h.anchor,re);let L=h.input.charCodeAt(h.position);for(;L!==0&&(h.firstTabInLine!==-1&&(h.position=h.firstTabInLine,F(h,"tab characters must not be used in indentation")),!(L!==45||!w(h.input.charCodeAt(h.position+1))));){if(we=!0,h.position++,le(h,!0,-1)&&h.lineIndent<=T){re.push(null),L=h.input.charCodeAt(h.position);continue}const de=h.line;if(se(h,T,u,!1,!0),re.push(h.result),le(h,!0,-1),L=h.input.charCodeAt(h.position),(h.line===de||h.lineIndent>T)&&L!==0)F(h,"bad indentation of a sequence entry");else if(h.lineIndent<T)break}return we?(h.tag=G,h.anchor=Y,h.kind="sequence",h.result=re,!0):!1}function ke(h,T,G){let Y,re,we,L;const de=h.tag,Ne=h.anchor,z={},V=Object.create(null);let D=null,ne=null,ce=null,Ce=!1,Se=!1;if(h.firstTabInLine!==-1)return!1;h.anchor!==null&&$(h,h.anchor,z);let ve=h.input.charCodeAt(h.position);for(;ve!==0;){!Ce&&h.firstTabInLine!==-1&&(h.position=h.firstTabInLine,F(h,"tab characters must not be used in indentation"));const ze=h.input.charCodeAt(h.position+1),Ke=h.line;if((ve===63||ve===58)&&w(ze))ve===63?(Ce&&(ge(h,z,V,D,ne,null,re,we,L),D=ne=ce=null),Se=!0,Ce=!0,Y=!0):Ce?(Ce=!1,Y=!0):F(h,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),h.position+=1,ve=ze;else{if(re=h.line,we=h.lineStart,L=h.position,!se(h,G,l,!1,!0))break;if(h.line===Ke){for(ve=h.input.charCodeAt(h.position);E(ve);)ve=h.input.charCodeAt(++h.position);if(ve===58)ve=h.input.charCodeAt(++h.position),w(ve)||F(h,"a whitespace character is expected after the key-value separator within a block mapping"),Ce&&(ge(h,z,V,D,ne,null,re,we,L),D=ne=ce=null),Se=!0,Ce=!1,Y=!1,D=h.tag,ne=h.result;else if(Se)F(h,"can not read an implicit mapping pair; a colon is missed");else return h.tag=de,h.anchor=Ne,!0}else if(Se)F(h,"can not read a block mapping entry; a multiline key may not be an implicit key");else return h.tag=de,h.anchor=Ne,!0}if((h.line===Ke||h.lineIndent>T)&&(Ce&&(re=h.line,we=h.lineStart,L=h.position),se(h,T,p,!0,Y)&&(Ce?ne=h.result:ce=h.result),Ce||(ge(h,z,V,D,ne,ce,re,we,L),D=ne=ce=null),le(h,!0,-1),ve=h.input.charCodeAt(h.position)),(h.line===Ke||h.lineIndent>T)&&ve!==0)F(h,"bad indentation of a mapping entry");else if(h.lineIndent<T)break}return Ce&&ge(h,z,V,D,ne,null,re,we,L),Se&&(h.tag=de,h.anchor=Ne,h.kind="mapping",h.result=z),Se}function _e(h){let T=!1,G=!1,Y,re,we=h.input.charCodeAt(h.position);if(we!==33)return!1;h.tag!==null&&F(h,"duplication of a tag property"),we=h.input.charCodeAt(++h.position),we===60?(T=!0,we=h.input.charCodeAt(++h.position)):we===33?(G=!0,Y="!!",we=h.input.charCodeAt(++h.position)):Y="!";let L=h.position;if(T){do we=h.input.charCodeAt(++h.position);while(we!==0&&we!==62);h.position<h.length?(re=h.input.slice(L,h.position),we=h.input.charCodeAt(++h.position)):F(h,"unexpected end of the stream within a verbatim tag")}else{for(;we!==0&&!w(we);)we===33&&(G?F(h,"tag suffix cannot contain exclamation marks"):(Y=h.input.slice(L-1,h.position+1),_.test(Y)||F(h,"named tag handle cannot contain such characters"),G=!0,L=h.position+1)),we=h.input.charCodeAt(++h.position);re=h.input.slice(L,h.position),b.test(re)&&F(h,"tag suffix cannot contain flow indicator characters")}re&&!k.test(re)&&F(h,"tag name cannot contain such characters: "+re);try{re=decodeURIComponent(re)}catch{F(h,"tag name is malformed: "+re)}return T?h.tag=re:s.call(h.tagMap,Y)?h.tag=h.tagMap[Y]+re:Y==="!"?h.tag="!"+re:Y==="!!"?h.tag="tag:yaml.org,2002:"+re:F(h,'undeclared tag handle "'+Y+'"'),!0}function ye(h){let T=h.input.charCodeAt(h.position);if(T!==38)return!1;h.anchor!==null&&F(h,"duplication of an anchor property"),T=h.input.charCodeAt(++h.position);const G=h.position;for(;T!==0&&!w(T)&&!S(T);)T=h.input.charCodeAt(++h.position);return h.position===G&&F(h,"name of an anchor node must contain at least one character"),h.anchor=h.input.slice(G,h.position),!0}function ie(h){let T=h.input.charCodeAt(h.position);if(T!==42)return!1;T=h.input.charCodeAt(++h.position);const G=h.position;for(;T!==0&&!w(T)&&!S(T);)T=h.input.charCodeAt(++h.position);h.position===G&&F(h,"name of an alias node must contain at least one character");const Y=h.input.slice(G,h.position);return s.call(h.anchorMap,Y)||F(h,'unidentified alias "'+Y+'"'),h.result=h.anchorMap[Y],le(h,!0,-1),!0}function ee(h,T,G,Y){const re=M(h);return q(h),v(h,T),h.tag=null,h.anchor=null,h.kind=null,h.result=null,ke(h,G,Y)&&h.kind==="mapping"?(K(h),!0):(ae(h),v(h,re),!1)}function se(h,T,G,Y,re){let we,L,de=1,Ne=!1,z=!1,V=null,D,ne,ce;h.depth>=h.maxDepth&&F(h,"nesting exceeded maxDepth ("+h.maxDepth+")"),h.depth+=1,h.listener!==null&&h.listener("open",h),h.tag=null,h.anchor=null,h.kind=null,h.result=null;const Ce=we=L=p===G||u===G;if(Y&&le(h,!0,-1)&&(Ne=!0,h.lineIndent>T?de=1:h.lineIndent===T?de=0:h.lineIndent<T&&(de=-1)),de===1)for(;;){const Se=h.input.charCodeAt(h.position),ve=M(h);if(Ne&&(Se===33&&h.tag!==null||Se===38&&h.anchor!==null)||!_e(h)&&!ye(h))break;V===null&&(V=ve),le(h,!0,-1)?(Ne=!0,L=Ce,h.lineIndent>T?de=1:h.lineIndent===T?de=0:h.lineIndent<T&&(de=-1)):L=!1}if(L&&(L=Ne||re),de===1||p===G)if(c===G||l===G?ne=T:ne=T+1,ce=h.position-h.lineStart,de===1)if(L&&(Ve(h,ce)||ke(h,ce,ne))||Ye(h,ne))z=!0;else{const Se=h.input.charCodeAt(h.position);V!==null&&Ce&&!L&&Se!==124&&Se!==62&&ee(h,V,V.position-V.lineStart,ne)||we&&et(h,ne)||Pe(h,ne)||qe(h,ne)?z=!0:ie(h)?(z=!0,(h.tag!==null||h.anchor!==null)&&F(h,"alias node should not have any properties")):$e(h,ne,c===G)&&(z=!0,h.tag===null&&(h.tag="?")),h.anchor!==null&&$(h,h.anchor,h.result)}else de===0&&(z=L&&Ve(h,ce));if(h.tag===null)h.anchor!==null&&$(h,h.anchor,h.result);else if(h.tag==="?"){h.result!==null&&h.kind!=="scalar"&&F(h,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+h.kind+'"');for(let Se=0,ve=h.implicitTypes.length;Se<ve;Se+=1)if(D=h.implicitTypes[Se],D.resolve(h.result)){h.result=D.construct(h.result),h.tag=D.tag,h.anchor!==null&&$(h,h.anchor,h.result);break}}else if(h.tag!=="!"){if(s.call(h.typeMap[h.kind||"fallback"],h.tag))D=h.typeMap[h.kind||"fallback"][h.tag];else{D=null;const Se=h.typeMap.multi[h.kind||"fallback"];for(let ve=0,ze=Se.length;ve<ze;ve+=1)if(h.tag.slice(0,Se[ve].tag.length)===Se[ve].tag){D=Se[ve];break}}D||F(h,"unknown tag !<"+h.tag+">"),h.result!==null&&D.kind!==h.kind&&F(h,"unacceptable node kind for !<"+h.tag+'> tag; it should be "'+D.kind+'", not "'+h.kind+'"'),D.resolve(h.result,h.tag)?(h.result=D.construct(h.result,h.tag),h.anchor!==null&&$(h,h.anchor,h.result)):F(h,"cannot resolve a node with !<"+h.tag+"> explicit tag")}return h.listener!==null&&h.listener("close",h),h.depth-=1,h.tag!==null||h.anchor!==null||z}function ue(h){const T=h.position;let G=!1,Y;for(h.version=null,h.checkLineBreaks=h.legacy,h.tagMap=Object.create(null),h.anchorMap=Object.create(null);(Y=h.input.charCodeAt(h.position))!==0&&(le(h,!0,-1),Y=h.input.charCodeAt(h.position),!(h.lineIndent>0||Y!==37));){G=!0,Y=h.input.charCodeAt(++h.position);let re=h.position;for(;Y!==0&&!w(Y);)Y=h.input.charCodeAt(++h.position);const we=h.input.slice(re,h.position),L=[];for(we.length<1&&F(h,"directive name must not be less than one character in length");Y!==0;){for(;E(Y);)Y=h.input.charCodeAt(++h.position);if(Y===35){do Y=h.input.charCodeAt(++h.position);while(Y!==0&&!N(Y));break}if(N(Y))break;for(re=h.position;Y!==0&&!w(Y);)Y=h.input.charCodeAt(++h.position);L.push(h.input.slice(re,h.position))}Y!==0&&me(h),s.call(H,we)?H[we](h,we,L):J(h,'unknown document directive "'+we+'"')}if(le(h,!0,-1),h.lineIndent===0&&h.input.charCodeAt(h.position)===45&&h.input.charCodeAt(h.position+1)===45&&h.input.charCodeAt(h.position+2)===45?(h.position+=3,le(h,!0,-1)):G&&F(h,"directives end mark is expected"),se(h,h.lineIndent-1,p,!1,!0),le(h,!0,-1),h.checkLineBreaks&&y.test(h.input.slice(T,h.position))&&J(h,"non-ASCII line breaks are interpreted as content"),h.documents.push(h.result),h.position===h.lineStart&&he(h)){h.input.charCodeAt(h.position)===46&&(h.position+=3,le(h,!0,-1));return}h.position<h.length-1&&F(h,"end of the stream or a document separator is expected")}function Ee(h,T){h=String(h),T=T||{},h.length!==0&&(h.charCodeAt(h.length-1)!==10&&h.charCodeAt(h.length-1)!==13&&(h+=`
33
+ `),h.charCodeAt(0)===65279&&(h=h.slice(1)));const G=new Z(h,T),Y=h.indexOf("\0");for(Y!==-1&&(G.position=Y,F(G,"null byte is not allowed in input")),G.input+="\0";G.input.charCodeAt(G.position)===32;)G.lineIndent+=1,G.position+=1;for(;G.position<G.length-1;)ue(G);return G.documents}function be(h,T,G){T!==null&&typeof T=="object"&&typeof G>"u"&&(G=T,T=null);const Y=Ee(h,G);if(typeof T!="function")return Y;for(let re=0,we=Y.length;re<we;re+=1)T(Y[re])}function xe(h,T){const G=Ee(h,T);if(G.length!==0){if(G.length===1)return G[0];throw new o("expected a single document in the stream, but found more")}}t.exports.loadAll=be,t.exports.load=xe}),VO=It((n,t)=>{var r=$a(),o=Ra(),i=pf(),a=Object.prototype.toString,s=Object.prototype.hasOwnProperty,c=65279,l=9,u=10,p=13,d=32,f=33,m=34,g=35,y=37,b=38,_=39,k=42,C=44,N=45,E=58,w=61,S=62,I=63,j=64,A=91,x=93,O=96,P=123,R=124,W=125,Z={};Z[0]="\\0",Z[7]="\\a",Z[8]="\\b",Z[9]="\\t",Z[10]="\\n",Z[11]="\\v",Z[12]="\\f",Z[13]="\\r",Z[27]="\\e",Z[34]='\\"',Z[92]="\\\\",Z[133]="\\N",Z[160]="\\_",Z[8232]="\\L",Z[8233]="\\P";var X=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],F=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function J(L,de){if(de===null)return{};const Ne={},z=Object.keys(de);for(let V=0,D=z.length;V<D;V+=1){let ne=z[V],ce=String(de[ne]);ne.slice(0,2)==="!!"&&(ne="tag:yaml.org,2002:"+ne.slice(2));const Ce=L.compiledTypeMap.fallback[ne];Ce&&s.call(Ce.styleAliases,ce)&&(ce=Ce.styleAliases[ce]),Ne[ne]=ce}return Ne}function $(L){let de,Ne;const z=L.toString(16).toUpperCase();if(L<=255)de="x",Ne=2;else if(L<=65535)de="u",Ne=4;else if(L<=4294967295)de="U",Ne=8;else throw new o("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+de+r.repeat("0",Ne-z.length)+z}var q=1,K=2;function ae(L){this.schema=L.schema||i,this.indent=Math.max(1,L.indent||2),this.noArrayIndent=L.noArrayIndent||!1,this.skipInvalid=L.skipInvalid||!1,this.flowLevel=r.isNothing(L.flowLevel)?-1:L.flowLevel,this.styleMap=J(this.schema,L.styles||null),this.sortKeys=L.sortKeys||!1,this.lineWidth=L.lineWidth||80,this.noRefs=L.noRefs||!1,this.noCompatMode=L.noCompatMode||!1,this.condenseFlow=L.condenseFlow||!1,this.quotingType=L.quotingType==='"'?K:q,this.forceQuotes=L.forceQuotes||!1,this.replacer=typeof L.replacer=="function"?L.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function M(L,de){const Ne=r.repeat(" ",de);let z=0,V="";const D=L.length;for(;z<D;){let ne;const ce=L.indexOf(`
34
34
  `,z);ce===-1?(ne=L.slice(z),z=D):(ne=L.slice(z,ce+1),z=ce+1),ne.length&&ne!==`
35
35
  `&&(V+=Ne),V+=ne}return V}function v(L,de){return`
36
- `+r.repeat(" ",L.indent*de)}function H(L,de){for(let Ne=0,z=L.implicitTypes.length;Ne<z;Ne+=1)if(L.implicitTypes[Ne].resolve(de))return!0;return!1}function oe(L){return L===d||L===l}function te(L){return L>=32&&L<=126||L>=161&&L<=55295&&L!==8232&&L!==8233||L>=57344&&L<=65533&&L!==c||L>=65536&&L<=1114111}function ge(L){return te(L)&&L!==c&&L!==p&&L!==u}function me(L,de,Ne){const z=ge(L),V=z&&!oe(L);return(Ne?z:z&&L!==C&&L!==A&&L!==x&&L!==P&&L!==W)&&L!==g&&!(de===E&&!V)||ge(de)&&!oe(de)&&L===g||de===E&&V}function le(L){return te(L)&&L!==c&&!oe(L)&&L!==N&&L!==I&&L!==E&&L!==C&&L!==A&&L!==x&&L!==P&&L!==W&&L!==g&&L!==b&&L!==k&&L!==f&&L!==R&&L!==w&&L!==S&&L!==_&&L!==m&&L!==y&&L!==j&&L!==O}function he(L){return!oe(L)&&L!==E}function Oe(L,de){const Ne=L.charCodeAt(de);let z;return Ne>=55296&&Ne<=56319&&de+1<L.length&&(z=L.charCodeAt(de+1),z>=56320&&z<=57343)?(Ne-55296)*1024+z-56320+65536:Ne}function $e(L){return/^\n* /.test(L)}var Pe=1,qe=2,Ye=3,et=4,Ve=5;function ke(L,de,Ne,z,V,D,ne,ce){let Ce,Se=0,ve=null,ze=!1,Ke=!1;const Be=z!==-1;let Ae=-1,Xe=le(Oe(L,0))&&he(Oe(L,L.length-1));if(de||ne)for(Ce=0;Ce<L.length;Se>=65536?Ce+=2:Ce++){if(Se=Oe(L,Ce),!te(Se))return Ve;Xe=Xe&&me(Se,ve,ce),ve=Se}else{for(Ce=0;Ce<L.length;Se>=65536?Ce+=2:Ce++){if(Se=Oe(L,Ce),Se===u)ze=!0,Be&&(Ke=Ke||Ce-Ae-1>z&&L[Ae+1]!==" ",Ae=Ce);else if(!te(Se))return Ve;Xe=Xe&&me(Se,ve,ce),ve=Se}Ke=Ke||Be&&Ce-Ae-1>z&&L[Ae+1]!==" "}return!ze&&!Ke?Xe&&!ne&&!V(L)?Pe:D===K?Ve:qe:Ne>9&&$e(L)?Ve:ne?D===K?Ve:qe:Ke?et:Ye}function we(L,de,Ne,z,V){L.dump=function(){if(de.length===0)return L.quotingType===K?'""':"''";if(!L.noCompatMode&&(X.indexOf(de)!==-1||F.test(de)))return L.quotingType===K?'"'+de+'"':"'"+de+"'";const D=L.indent*Math.max(1,Ne),ne=L.lineWidth===-1?-1:Math.max(Math.min(L.lineWidth,40),L.lineWidth-D),ce=z||L.flowLevel>-1&&Ne>=L.flowLevel;function Ce(Se){return H(L,Se)}switch(ke(de,ce,L.indent,ne,Ce,L.quotingType,L.forceQuotes&&!z,V)){case Pe:return de;case qe:return"'"+de.replace(/'/g,"''")+"'";case Ye:return"|"+ye(de,L.indent)+ie(M(de,D));case et:return">"+ye(de,L.indent)+ie(M(ee(de,ne),D));case Ve:return'"'+ue(de)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function ye(L,de){const Ne=$e(L)?String(de):"",z=L[L.length-1]===`
36
+ `+r.repeat(" ",L.indent*de)}function H(L,de){for(let Ne=0,z=L.implicitTypes.length;Ne<z;Ne+=1)if(L.implicitTypes[Ne].resolve(de))return!0;return!1}function oe(L){return L===d||L===l}function te(L){return L>=32&&L<=126||L>=161&&L<=55295&&L!==8232&&L!==8233||L>=57344&&L<=65533&&L!==c||L>=65536&&L<=1114111}function ge(L){return te(L)&&L!==c&&L!==p&&L!==u}function me(L,de,Ne){const z=ge(L),V=z&&!oe(L);return(Ne?z:z&&L!==C&&L!==A&&L!==x&&L!==P&&L!==W)&&L!==g&&!(de===E&&!V)||ge(de)&&!oe(de)&&L===g||de===E&&V}function le(L){return te(L)&&L!==c&&!oe(L)&&L!==N&&L!==I&&L!==E&&L!==C&&L!==A&&L!==x&&L!==P&&L!==W&&L!==g&&L!==b&&L!==k&&L!==f&&L!==R&&L!==w&&L!==S&&L!==_&&L!==m&&L!==y&&L!==j&&L!==O}function he(L){return!oe(L)&&L!==E}function Oe(L,de){const Ne=L.charCodeAt(de);let z;return Ne>=55296&&Ne<=56319&&de+1<L.length&&(z=L.charCodeAt(de+1),z>=56320&&z<=57343)?(Ne-55296)*1024+z-56320+65536:Ne}function $e(L){return/^\n* /.test(L)}var Pe=1,qe=2,Ye=3,et=4,Ve=5;function ke(L,de,Ne,z,V,D,ne,ce){let Ce,Se=0,ve=null,ze=!1,Ke=!1;const Be=z!==-1;let Ae=-1,Xe=le(Oe(L,0))&&he(Oe(L,L.length-1));if(de||ne)for(Ce=0;Ce<L.length;Se>=65536?Ce+=2:Ce++){if(Se=Oe(L,Ce),!te(Se))return Ve;Xe=Xe&&me(Se,ve,ce),ve=Se}else{for(Ce=0;Ce<L.length;Se>=65536?Ce+=2:Ce++){if(Se=Oe(L,Ce),Se===u)ze=!0,Be&&(Ke=Ke||Ce-Ae-1>z&&L[Ae+1]!==" ",Ae=Ce);else if(!te(Se))return Ve;Xe=Xe&&me(Se,ve,ce),ve=Se}Ke=Ke||Be&&Ce-Ae-1>z&&L[Ae+1]!==" "}return!ze&&!Ke?Xe&&!ne&&!V(L)?Pe:D===K?Ve:qe:Ne>9&&$e(L)?Ve:ne?D===K?Ve:qe:Ke?et:Ye}function _e(L,de,Ne,z,V){L.dump=function(){if(de.length===0)return L.quotingType===K?'""':"''";if(!L.noCompatMode&&(X.indexOf(de)!==-1||F.test(de)))return L.quotingType===K?'"'+de+'"':"'"+de+"'";const D=L.indent*Math.max(1,Ne),ne=L.lineWidth===-1?-1:Math.max(Math.min(L.lineWidth,40),L.lineWidth-D),ce=z||L.flowLevel>-1&&Ne>=L.flowLevel;function Ce(Se){return H(L,Se)}switch(ke(de,ce,L.indent,ne,Ce,L.quotingType,L.forceQuotes&&!z,V)){case Pe:return de;case qe:return"'"+de.replace(/'/g,"''")+"'";case Ye:return"|"+ye(de,L.indent)+ie(M(de,D));case et:return">"+ye(de,L.indent)+ie(M(ee(de,ne),D));case Ve:return'"'+ue(de)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function ye(L,de){const Ne=$e(L)?String(de):"",z=L[L.length-1]===`
37
37
  `;return Ne+(z&&(L[L.length-2]===`
38
38
  `||L===`
39
39
  `)?"+":z?"":"-")+`
@@ -44,8 +44,8 @@ ${I}`)}if(N.has(w))return;N.add(w),E.push(w);const S=_.dependencies[w];if(S){con
44
44
  `:"")+se(Ce,de),V=D}return z}function se(L,de){if(L===""||L[0]===" ")return L;const Ne=/ [^ ]/g;let z,V=0,D,ne=0,ce=0,Ce="";for(;z=Ne.exec(L);)ce=z.index,ce-V>de&&(D=ne>V?ne:ce,Ce+=`
45
45
  `+L.slice(V,D),V=D+1),ne=ce;return Ce+=`
46
46
  `,L.length-V>de&&ne>V?Ce+=L.slice(V,ne)+`
47
- `+L.slice(ne+1):Ce+=L.slice(V),Ce.slice(1)}function ue(L){let de="",Ne=0;for(let z=0;z<L.length;Ne>=65536?z+=2:z++){Ne=Oe(L,z);const V=Z[Ne];!V&&te(Ne)?(de+=L[z],Ne>=65536&&(de+=L[z+1])):de+=V||$(Ne)}return de}function Ee(L,de,Ne){let z="";const V=L.tag;for(let D=0,ne=Ne.length;D<ne;D+=1){let ce=Ne[D];L.replacer&&(ce=L.replacer.call(Ne,String(D),ce)),(G(L,de,ce,!1,!1)||typeof ce>"u"&&G(L,de,null,!1,!1))&&(z!==""&&(z+=","+(L.condenseFlow?"":" ")),z+=L.dump)}L.tag=V,L.dump="["+z+"]"}function _e(L,de,Ne,z){let V="";const D=L.tag;for(let ne=0,ce=Ne.length;ne<ce;ne+=1){let Ce=Ne[ne];L.replacer&&(Ce=L.replacer.call(Ne,String(ne),Ce)),(G(L,de+1,Ce,!0,!0,!1,!0)||typeof Ce>"u"&&G(L,de+1,null,!0,!0,!1,!0))&&((!z||V!=="")&&(V+=v(L,de)),L.dump&&u===L.dump.charCodeAt(0)?V+="-":V+="- ",V+=L.dump)}L.tag=D,L.dump=V||"[]"}function xe(L,de,Ne){let z="";const V=L.tag,D=Object.keys(Ne);for(let ne=0,ce=D.length;ne<ce;ne+=1){let Ce="";z!==""&&(Ce+=", "),L.condenseFlow&&(Ce+='"');const Se=D[ne];let ve=Ne[Se];L.replacer&&(ve=L.replacer.call(Ne,Se,ve)),G(L,de,Se,!1,!1)&&(L.dump.length>1024&&(Ce+="? "),Ce+=L.dump+(L.condenseFlow?'"':"")+":"+(L.condenseFlow?"":" "),G(L,de,ve,!1,!1)&&(Ce+=L.dump,z+=Ce))}L.tag=V,L.dump="{"+z+"}"}function h(L,de,Ne,z){let V="";const D=L.tag,ne=Object.keys(Ne);if(L.sortKeys===!0)ne.sort();else if(typeof L.sortKeys=="function")ne.sort(L.sortKeys);else if(L.sortKeys)throw new o("sortKeys must be a boolean or a function");for(let ce=0,Ce=ne.length;ce<Ce;ce+=1){let Se="";(!z||V!=="")&&(Se+=v(L,de));const ve=ne[ce];let ze=Ne[ve];if(L.replacer&&(ze=L.replacer.call(Ne,ve,ze)),!G(L,de+1,ve,!0,!0,!0))continue;const Ke=L.tag!==null&&L.tag!=="?"||L.dump&&L.dump.length>1024;Ke&&(L.dump&&u===L.dump.charCodeAt(0)?Se+="?":Se+="? "),Se+=L.dump,Ke&&(Se+=v(L,de)),G(L,de+1,ze,!0,Ke)&&(L.dump&&u===L.dump.charCodeAt(0)?Se+=":":Se+=": ",Se+=L.dump,V+=Se)}L.tag=D,L.dump=V||"{}"}function T(L,de,Ne){const z=Ne?L.explicitTypes:L.implicitTypes;for(let V=0,D=z.length;V<D;V+=1){const ne=z[V];if((ne.instanceOf||ne.predicate)&&(!ne.instanceOf||typeof de=="object"&&de instanceof ne.instanceOf)&&(!ne.predicate||ne.predicate(de))){if(Ne?ne.multi&&ne.representName?L.tag=ne.representName(de):L.tag=ne.tag:L.tag="?",ne.represent){const ce=L.styleMap[ne.tag]||ne.defaultStyle;let Ce;if(a.call(ne.represent)==="[object Function]")Ce=ne.represent(de,ce);else if(s.call(ne.represent,ce))Ce=ne.represent[ce](de,ce);else throw new o("!<"+ne.tag+'> tag resolver accepts not "'+ce+'" style');L.dump=Ce}return!0}}return!1}function G(L,de,Ne,z,V,D,ne){L.tag=null,L.dump=Ne,T(L,Ne,!1)||T(L,Ne,!0);const ce=a.call(L.dump),Ce=z;z&&(z=L.flowLevel<0||L.flowLevel>de);const Se=ce==="[object Object]"||ce==="[object Array]";let ve,ze;if(Se&&(ve=L.duplicates.indexOf(Ne),ze=ve!==-1),(L.tag!==null&&L.tag!=="?"||ze||L.indent!==2&&de>0)&&(V=!1),ze&&L.usedDuplicates[ve])L.dump="*ref_"+ve;else{if(Se&&ze&&!L.usedDuplicates[ve]&&(L.usedDuplicates[ve]=!0),ce==="[object Object]")z&&Object.keys(L.dump).length!==0?(h(L,de,L.dump,V),ze&&(L.dump="&ref_"+ve+L.dump)):(xe(L,de,L.dump),ze&&(L.dump="&ref_"+ve+" "+L.dump));else if(ce==="[object Array]")z&&L.dump.length!==0?(L.noArrayIndent&&!ne&&de>0?_e(L,de-1,L.dump,V):_e(L,de,L.dump,V),ze&&(L.dump="&ref_"+ve+L.dump)):(Ee(L,de,L.dump),ze&&(L.dump="&ref_"+ve+" "+L.dump));else if(ce==="[object String]")L.tag!=="?"&&we(L,L.dump,de,D,Ce);else{if(ce==="[object Undefined]")return!1;if(L.skipInvalid)return!1;throw new o("unacceptable kind of an object to dump "+ce)}if(L.tag!==null&&L.tag!=="?"){let Ke=encodeURI(L.tag[0]==="!"?L.tag.slice(1):L.tag).replace(/!/g,"%21");L.tag[0]==="!"?Ke="!"+Ke:Ke.slice(0,18)==="tag:yaml.org,2002:"?Ke="!!"+Ke.slice(18):Ke="!<"+Ke+">",L.dump=Ke+" "+L.dump}}return!0}function Y(L,de){const Ne=[],z=[];re(L,Ne,z);const V=z.length;for(let D=0;D<V;D+=1)de.duplicates.push(Ne[z[D]]);de.usedDuplicates=new Array(V)}function re(L,de,Ne){if(L!==null&&typeof L=="object"){const z=de.indexOf(L);if(z!==-1)Ne.indexOf(z)===-1&&Ne.push(z);else if(de.push(L),Array.isArray(L))for(let V=0,D=L.length;V<D;V+=1)re(L[V],de,Ne);else{const V=Object.keys(L);for(let D=0,ne=V.length;D<ne;D+=1)re(L[V[D]],de,Ne)}}}function be(L,de){de=de||{};const Ne=new ae(de);Ne.noRefs||Y(L,Ne);let z=L;return Ne.replacer&&(z=Ne.replacer.call({"":z},"",z)),G(Ne,0,z,!0,!0)?Ne.dump+`
48
- `:""}t.exports.dump=be}),R_=TO(It((n,t)=>{var r=PO(),o=VO();function i(a,s){return function(){throw new Error("Function yaml."+a+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}t.exports.Type=ln(),t.exports.Schema=b_(),t.exports.FAILSAFE_SCHEMA=E_(),t.exports.JSON_SCHEMA=v_(),t.exports.CORE_SCHEMA=I_(),t.exports.DEFAULT_SCHEMA=pf(),t.exports.load=r.load,t.exports.loadAll=r.loadAll,t.exports.dump=o.dump,t.exports.YAMLException=Ra(),t.exports.types={binary:O_(),float:A_(),map:C_(),null:N_(),pairs:V_(),set:$_(),timestamp:B_(),bool:S_(),int:x_(),merge:T_(),omap:P_(),seq:k_(),str:w_()},t.exports.safeLoad=i("safeLoad","load"),t.exports.safeLoadAll=i("safeLoadAll","loadAll"),t.exports.safeDump=i("safeDump","dump")})()),{Type:tq,Schema:nq,FAILSAFE_SCHEMA:rq,JSON_SCHEMA:Eo,CORE_SCHEMA:oq,DEFAULT_SCHEMA:iq,load:aq,loadAll:sq,dump:lq,YAMLException:cq,types:uq,safeLoad:dq,safeLoadAll:fq,safeDump:pq}=R_.default,Rn=R_.default;const $O=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Ir(){return{lenses:[],dispose:()=>{}}}function RO(n,t,r){return{range:t,command:{id:r.copyCommandId,title:typeof r.title=="function"?r.title(n):r.title??`$(copy) Copy UUID ${n.substring(0,8)}...`,arguments:[r.formatValue?r.formatValue(n):n]}}}async function LO(n){const t=n.getLanguageId(),r=n.getAlternativeVersionId();switch(t){case"json":{const o=n.getValue(),{parseIntoJSONContext:i}=await Promise.resolve().then(()=>eU);return i(o,r)}case"yaml":{const o=n.getValue(),{parseIntoYAMLContext:i}=await Promise.resolve().then(()=>nV);return i(o,r)}}return{isDefault:!0,language:t,altVersionId:r}}const mf=new WeakMap,hf=new WeakMap,Dl=new WeakMap;function DO(n){return`${n.getLanguageId()}\0${n.getAlternativeVersionId()}`}async function MO(n){let t=mf.get(n);t||(t=new Map,mf.set(n,t));const r=DO(n);let o=t.get(r);return o||(o=await LO(n),t.set(r,o)),o}async function L_(n){if(Dl.has(n))return Dl.get(n);const t=(async()=>(hf.has(n)||hf.set(n,n.onWillDispose(()=>{jO(n)})),MO(n)))().finally(()=>{Dl.delete(n)});return Dl.set(n,t),t}function jO(n){mf.delete(n),hf.delete(n)}const gf=Symbol.for("yaml.alias"),yf=Symbol.for("yaml.document"),Zr=Symbol.for("yaml.map"),D_=Symbol.for("yaml.pair"),pr=Symbol.for("yaml.scalar"),di=Symbol.for("yaml.seq"),Ln=Symbol.for("yaml.node.type"),fi=n=>!!n&&typeof n=="object"&&n[Ln]===gf,Ml=n=>!!n&&typeof n=="object"&&n[Ln]===yf,pi=n=>!!n&&typeof n=="object"&&n[Ln]===Zr,Mt=n=>!!n&&typeof n=="object"&&n[Ln]===D_,kt=n=>!!n&&typeof n=="object"&&n[Ln]===pr,mi=n=>!!n&&typeof n=="object"&&n[Ln]===di;function Ut(n){if(n&&typeof n=="object")switch(n[Ln]){case Zr:case di:return!0}return!1}function Et(n){if(n&&typeof n=="object")switch(n[Ln]){case gf:case Zr:case pr:case di:return!0}return!1}const M_=n=>(kt(n)||Ut(n))&&!!n.anchor,No=Symbol("break visit"),FO=Symbol("skip children"),La=Symbol("remove node");function hi(n,t){const r=UO(t);Ml(n)?gi(null,n.contents,r,Object.freeze([n]))===La&&(n.contents=null):gi(null,n,r,Object.freeze([]))}hi.BREAK=No,hi.SKIP=FO,hi.REMOVE=La;function gi(n,t,r,o){const i=KO(n,t,r,o);if(Et(i)||Mt(i))return qO(n,o,i),gi(n,i,r,o);if(typeof i!="symbol"){if(Ut(t)){o=Object.freeze(o.concat(t));for(let a=0;a<t.items.length;++a){const s=gi(a,t.items[a],r,o);if(typeof s=="number")a=s-1;else{if(s===No)return No;s===La&&(t.items.splice(a,1),a-=1)}}}else if(Mt(t)){o=Object.freeze(o.concat(t));const a=gi("key",t.key,r,o);if(a===No)return No;a===La&&(t.key=null);const s=gi("value",t.value,r,o);if(s===No)return No;s===La&&(t.value=null)}}return i}function UO(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function KO(n,t,r,o){var i,a,s,c,l;if(typeof r=="function")return r(n,t,o);if(pi(t))return(i=r.Map)==null?void 0:i.call(r,n,t,o);if(mi(t))return(a=r.Seq)==null?void 0:a.call(r,n,t,o);if(Mt(t))return(s=r.Pair)==null?void 0:s.call(r,n,t,o);if(kt(t))return(c=r.Scalar)==null?void 0:c.call(r,n,t,o);if(fi(t))return(l=r.Alias)==null?void 0:l.call(r,n,t,o)}function qO(n,t,r){const o=t[t.length-1];if(Ut(o))o.items[n]=r;else if(Mt(o))n==="key"?o.key=r:o.value=r;else if(Ml(o))o.contents=r;else{const i=fi(o)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const GO={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},HO=n=>n.replace(/[!,[\]{}]/g,t=>GO[t]);class cn{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},cn.defaultYaml,t),this.tags=Object.assign({},cn.defaultTags,r)}clone(){const t=new cn(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new cn(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:cn.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},cn.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:cn.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},cn.defaultTags),this.atNextDocument=!1);const o=t.trim().split(/[ \t]+/),i=o.shift();switch(i){case"%TAG":{if(o.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),o.length<2))return!1;const[a,s]=o;return this.tags[a]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,o.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;const[a]=o;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const s=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}const[,o,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);const a=this.tags[o];if(a)try{return a+decodeURIComponent(i)}catch(s){return r(String(s)),null}return o==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[r,o]of Object.entries(this.tags))if(t.startsWith(o))return r+HO(t.substring(o.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],o=Object.entries(this.tags);let i;if(t&&o.length>0&&Et(t.contents)){const a={};hi(t.contents,(s,c)=>{Et(c)&&c.tag&&(a[c.tag]=!0)}),i=Object.keys(a)}else i=[];for(const[a,s]of o)a==="!!"&&s==="tag:yaml.org,2002:"||(!t||i.some(c=>c.startsWith(s)))&&r.push(`%TAG ${a} ${s}`);return r.join(`
47
+ `+L.slice(ne+1):Ce+=L.slice(V),Ce.slice(1)}function ue(L){let de="",Ne=0;for(let z=0;z<L.length;Ne>=65536?z+=2:z++){Ne=Oe(L,z);const V=Z[Ne];!V&&te(Ne)?(de+=L[z],Ne>=65536&&(de+=L[z+1])):de+=V||$(Ne)}return de}function Ee(L,de,Ne){let z="";const V=L.tag;for(let D=0,ne=Ne.length;D<ne;D+=1){let ce=Ne[D];L.replacer&&(ce=L.replacer.call(Ne,String(D),ce)),(G(L,de,ce,!1,!1)||typeof ce>"u"&&G(L,de,null,!1,!1))&&(z!==""&&(z+=","+(L.condenseFlow?"":" ")),z+=L.dump)}L.tag=V,L.dump="["+z+"]"}function be(L,de,Ne,z){let V="";const D=L.tag;for(let ne=0,ce=Ne.length;ne<ce;ne+=1){let Ce=Ne[ne];L.replacer&&(Ce=L.replacer.call(Ne,String(ne),Ce)),(G(L,de+1,Ce,!0,!0,!1,!0)||typeof Ce>"u"&&G(L,de+1,null,!0,!0,!1,!0))&&((!z||V!=="")&&(V+=v(L,de)),L.dump&&u===L.dump.charCodeAt(0)?V+="-":V+="- ",V+=L.dump)}L.tag=D,L.dump=V||"[]"}function xe(L,de,Ne){let z="";const V=L.tag,D=Object.keys(Ne);for(let ne=0,ce=D.length;ne<ce;ne+=1){let Ce="";z!==""&&(Ce+=", "),L.condenseFlow&&(Ce+='"');const Se=D[ne];let ve=Ne[Se];L.replacer&&(ve=L.replacer.call(Ne,Se,ve)),G(L,de,Se,!1,!1)&&(L.dump.length>1024&&(Ce+="? "),Ce+=L.dump+(L.condenseFlow?'"':"")+":"+(L.condenseFlow?"":" "),G(L,de,ve,!1,!1)&&(Ce+=L.dump,z+=Ce))}L.tag=V,L.dump="{"+z+"}"}function h(L,de,Ne,z){let V="";const D=L.tag,ne=Object.keys(Ne);if(L.sortKeys===!0)ne.sort();else if(typeof L.sortKeys=="function")ne.sort(L.sortKeys);else if(L.sortKeys)throw new o("sortKeys must be a boolean or a function");for(let ce=0,Ce=ne.length;ce<Ce;ce+=1){let Se="";(!z||V!=="")&&(Se+=v(L,de));const ve=ne[ce];let ze=Ne[ve];if(L.replacer&&(ze=L.replacer.call(Ne,ve,ze)),!G(L,de+1,ve,!0,!0,!0))continue;const Ke=L.tag!==null&&L.tag!=="?"||L.dump&&L.dump.length>1024;Ke&&(L.dump&&u===L.dump.charCodeAt(0)?Se+="?":Se+="? "),Se+=L.dump,Ke&&(Se+=v(L,de)),G(L,de+1,ze,!0,Ke)&&(L.dump&&u===L.dump.charCodeAt(0)?Se+=":":Se+=": ",Se+=L.dump,V+=Se)}L.tag=D,L.dump=V||"{}"}function T(L,de,Ne){const z=Ne?L.explicitTypes:L.implicitTypes;for(let V=0,D=z.length;V<D;V+=1){const ne=z[V];if((ne.instanceOf||ne.predicate)&&(!ne.instanceOf||typeof de=="object"&&de instanceof ne.instanceOf)&&(!ne.predicate||ne.predicate(de))){if(Ne?ne.multi&&ne.representName?L.tag=ne.representName(de):L.tag=ne.tag:L.tag="?",ne.represent){const ce=L.styleMap[ne.tag]||ne.defaultStyle;let Ce;if(a.call(ne.represent)==="[object Function]")Ce=ne.represent(de,ce);else if(s.call(ne.represent,ce))Ce=ne.represent[ce](de,ce);else throw new o("!<"+ne.tag+'> tag resolver accepts not "'+ce+'" style');L.dump=Ce}return!0}}return!1}function G(L,de,Ne,z,V,D,ne){L.tag=null,L.dump=Ne,T(L,Ne,!1)||T(L,Ne,!0);const ce=a.call(L.dump),Ce=z;z&&(z=L.flowLevel<0||L.flowLevel>de);const Se=ce==="[object Object]"||ce==="[object Array]";let ve,ze;if(Se&&(ve=L.duplicates.indexOf(Ne),ze=ve!==-1),(L.tag!==null&&L.tag!=="?"||ze||L.indent!==2&&de>0)&&(V=!1),ze&&L.usedDuplicates[ve])L.dump="*ref_"+ve;else{if(Se&&ze&&!L.usedDuplicates[ve]&&(L.usedDuplicates[ve]=!0),ce==="[object Object]")z&&Object.keys(L.dump).length!==0?(h(L,de,L.dump,V),ze&&(L.dump="&ref_"+ve+L.dump)):(xe(L,de,L.dump),ze&&(L.dump="&ref_"+ve+" "+L.dump));else if(ce==="[object Array]")z&&L.dump.length!==0?(L.noArrayIndent&&!ne&&de>0?be(L,de-1,L.dump,V):be(L,de,L.dump,V),ze&&(L.dump="&ref_"+ve+L.dump)):(Ee(L,de,L.dump),ze&&(L.dump="&ref_"+ve+" "+L.dump));else if(ce==="[object String]")L.tag!=="?"&&_e(L,L.dump,de,D,Ce);else{if(ce==="[object Undefined]")return!1;if(L.skipInvalid)return!1;throw new o("unacceptable kind of an object to dump "+ce)}if(L.tag!==null&&L.tag!=="?"){let Ke=encodeURI(L.tag[0]==="!"?L.tag.slice(1):L.tag).replace(/!/g,"%21");L.tag[0]==="!"?Ke="!"+Ke:Ke.slice(0,18)==="tag:yaml.org,2002:"?Ke="!!"+Ke.slice(18):Ke="!<"+Ke+">",L.dump=Ke+" "+L.dump}}return!0}function Y(L,de){const Ne=[],z=[];re(L,Ne,z);const V=z.length;for(let D=0;D<V;D+=1)de.duplicates.push(Ne[z[D]]);de.usedDuplicates=new Array(V)}function re(L,de,Ne){if(L!==null&&typeof L=="object"){const z=de.indexOf(L);if(z!==-1)Ne.indexOf(z)===-1&&Ne.push(z);else if(de.push(L),Array.isArray(L))for(let V=0,D=L.length;V<D;V+=1)re(L[V],de,Ne);else{const V=Object.keys(L);for(let D=0,ne=V.length;D<ne;D+=1)re(L[V[D]],de,Ne)}}}function we(L,de){de=de||{};const Ne=new ae(de);Ne.noRefs||Y(L,Ne);let z=L;return Ne.replacer&&(z=Ne.replacer.call({"":z},"",z)),G(Ne,0,z,!0,!0)?Ne.dump+`
48
+ `:""}t.exports.dump=we}),R_=TO(It((n,t)=>{var r=PO(),o=VO();function i(a,s){return function(){throw new Error("Function yaml."+a+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}t.exports.Type=ln(),t.exports.Schema=b_(),t.exports.FAILSAFE_SCHEMA=E_(),t.exports.JSON_SCHEMA=v_(),t.exports.CORE_SCHEMA=I_(),t.exports.DEFAULT_SCHEMA=pf(),t.exports.load=r.load,t.exports.loadAll=r.loadAll,t.exports.dump=o.dump,t.exports.YAMLException=Ra(),t.exports.types={binary:O_(),float:A_(),map:C_(),null:N_(),pairs:V_(),set:$_(),timestamp:B_(),bool:S_(),int:x_(),merge:T_(),omap:P_(),seq:k_(),str:w_()},t.exports.safeLoad=i("safeLoad","load"),t.exports.safeLoadAll=i("safeLoadAll","loadAll"),t.exports.safeDump=i("safeDump","dump")})()),{Type:tq,Schema:nq,FAILSAFE_SCHEMA:rq,JSON_SCHEMA:Eo,CORE_SCHEMA:oq,DEFAULT_SCHEMA:iq,load:aq,loadAll:sq,dump:lq,YAMLException:cq,types:uq,safeLoad:dq,safeLoadAll:fq,safeDump:pq}=R_.default,Rn=R_.default;const $O=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Ir(){return{lenses:[],dispose:()=>{}}}function RO(n,t,r){return{range:t,command:{id:r.copyCommandId,title:typeof r.title=="function"?r.title(n):r.title??`$(copy) Copy UUID ${n.substring(0,8)}...`,arguments:[r.formatValue?r.formatValue(n):n]}}}async function LO(n){const t=n.getLanguageId(),r=n.getAlternativeVersionId();switch(t){case"json":{const o=n.getValue(),{parseIntoJSONContext:i}=await Promise.resolve().then(()=>eU);return i(o,r)}case"yaml":{const o=n.getValue(),{parseIntoYAMLContext:i}=await Promise.resolve().then(()=>nV);return i(o,r)}}return{isDefault:!0,language:t,altVersionId:r}}const mf=new WeakMap,hf=new WeakMap,Dl=new WeakMap;function DO(n){return`${n.getLanguageId()}\0${n.getAlternativeVersionId()}`}async function MO(n){let t=mf.get(n);t||(t=new Map,mf.set(n,t));const r=DO(n);let o=t.get(r);return o||(o=await LO(n),t.set(r,o)),o}async function L_(n){if(Dl.has(n))return Dl.get(n);const t=(async()=>(hf.has(n)||hf.set(n,n.onWillDispose(()=>{jO(n)})),MO(n)))().finally(()=>{Dl.delete(n)});return Dl.set(n,t),t}function jO(n){mf.delete(n),hf.delete(n)}const gf=Symbol.for("yaml.alias"),yf=Symbol.for("yaml.document"),Zr=Symbol.for("yaml.map"),D_=Symbol.for("yaml.pair"),pr=Symbol.for("yaml.scalar"),di=Symbol.for("yaml.seq"),Ln=Symbol.for("yaml.node.type"),fi=n=>!!n&&typeof n=="object"&&n[Ln]===gf,Ml=n=>!!n&&typeof n=="object"&&n[Ln]===yf,pi=n=>!!n&&typeof n=="object"&&n[Ln]===Zr,Mt=n=>!!n&&typeof n=="object"&&n[Ln]===D_,kt=n=>!!n&&typeof n=="object"&&n[Ln]===pr,mi=n=>!!n&&typeof n=="object"&&n[Ln]===di;function Ut(n){if(n&&typeof n=="object")switch(n[Ln]){case Zr:case di:return!0}return!1}function Et(n){if(n&&typeof n=="object")switch(n[Ln]){case gf:case Zr:case pr:case di:return!0}return!1}const M_=n=>(kt(n)||Ut(n))&&!!n.anchor,No=Symbol("break visit"),FO=Symbol("skip children"),La=Symbol("remove node");function hi(n,t){const r=UO(t);Ml(n)?gi(null,n.contents,r,Object.freeze([n]))===La&&(n.contents=null):gi(null,n,r,Object.freeze([]))}hi.BREAK=No,hi.SKIP=FO,hi.REMOVE=La;function gi(n,t,r,o){const i=KO(n,t,r,o);if(Et(i)||Mt(i))return qO(n,o,i),gi(n,i,r,o);if(typeof i!="symbol"){if(Ut(t)){o=Object.freeze(o.concat(t));for(let a=0;a<t.items.length;++a){const s=gi(a,t.items[a],r,o);if(typeof s=="number")a=s-1;else{if(s===No)return No;s===La&&(t.items.splice(a,1),a-=1)}}}else if(Mt(t)){o=Object.freeze(o.concat(t));const a=gi("key",t.key,r,o);if(a===No)return No;a===La&&(t.key=null);const s=gi("value",t.value,r,o);if(s===No)return No;s===La&&(t.value=null)}}return i}function UO(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function KO(n,t,r,o){var i,a,s,c,l;if(typeof r=="function")return r(n,t,o);if(pi(t))return(i=r.Map)==null?void 0:i.call(r,n,t,o);if(mi(t))return(a=r.Seq)==null?void 0:a.call(r,n,t,o);if(Mt(t))return(s=r.Pair)==null?void 0:s.call(r,n,t,o);if(kt(t))return(c=r.Scalar)==null?void 0:c.call(r,n,t,o);if(fi(t))return(l=r.Alias)==null?void 0:l.call(r,n,t,o)}function qO(n,t,r){const o=t[t.length-1];if(Ut(o))o.items[n]=r;else if(Mt(o))n==="key"?o.key=r:o.value=r;else if(Ml(o))o.contents=r;else{const i=fi(o)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const GO={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},HO=n=>n.replace(/[!,[\]{}]/g,t=>GO[t]);class cn{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},cn.defaultYaml,t),this.tags=Object.assign({},cn.defaultTags,r)}clone(){const t=new cn(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new cn(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:cn.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},cn.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:cn.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},cn.defaultTags),this.atNextDocument=!1);const o=t.trim().split(/[ \t]+/),i=o.shift();switch(i){case"%TAG":{if(o.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),o.length<2))return!1;const[a,s]=o;return this.tags[a]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,o.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;const[a]=o;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const s=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}const[,o,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);const a=this.tags[o];if(a)try{return a+decodeURIComponent(i)}catch(s){return r(String(s)),null}return o==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[r,o]of Object.entries(this.tags))if(t.startsWith(o))return r+HO(t.substring(o.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],o=Object.entries(this.tags);let i;if(t&&o.length>0&&Et(t.contents)){const a={};hi(t.contents,(s,c)=>{Et(c)&&c.tag&&(a[c.tag]=!0)}),i=Object.keys(a)}else i=[];for(const[a,s]of o)a==="!!"&&s==="tag:yaml.org,2002:"||(!t||i.some(c=>c.startsWith(s)))&&r.push(`%TAG ${a} ${s}`);return r.join(`
49
49
  `)}}cn.defaultYaml={explicit:!1,version:"1.2"},cn.defaultTags={"!!":"tag:yaml.org,2002:"};function j_(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function F_(n){const t=new Set;return hi(n,{Value(r,o){o.anchor&&t.add(o.anchor)}}),t}function U_(n,t){for(let r=1;;++r){const o=`${n}${r}`;if(!t.has(o))return o}}function zO(n,t){const r=[],o=new Map;let i=null;return{onAnchor:a=>{r.push(a),i??(i=F_(n));const s=U_(t,i);return i.add(s),s},setAnchors:()=>{for(const a of r){const s=o.get(a);if(typeof s=="object"&&s.anchor&&(kt(s.node)||Ut(s.node)))s.node.anchor=s.anchor;else{const c=new Error("Failed to resolve repeated object (this should not happen)");throw c.source=a,c}}},sourceObjects:o}}function yi(n,t,r,o){if(o&&typeof o=="object")if(Array.isArray(o))for(let i=0,a=o.length;i<a;++i){const s=o[i],c=yi(n,o,String(i),s);c===void 0?delete o[i]:c!==s&&(o[i]=c)}else if(o instanceof Map)for(const i of Array.from(o.keys())){const a=o.get(i),s=yi(n,o,i,a);s===void 0?o.delete(i):s!==a&&o.set(i,s)}else if(o instanceof Set)for(const i of Array.from(o)){const a=yi(n,o,i,i);a===void 0?o.delete(i):a!==i&&(o.delete(i),o.add(a))}else for(const[i,a]of Object.entries(o)){const s=yi(n,o,i,a);s===void 0?delete o[i]:s!==a&&(o[i]=s)}return n.call(t,r,o)}function Dn(n,t,r){if(Array.isArray(n))return n.map((o,i)=>Dn(o,String(i),r));if(n&&typeof n.toJSON=="function"){if(!r||!M_(n))return n.toJSON(t,r);const o={aliasCount:0,count:1,res:void 0};r.anchors.set(n,o),r.onCreate=a=>{o.res=a,delete r.onCreate};const i=n.toJSON(t,r);return r.onCreate&&r.onCreate(i),i}return typeof n=="bigint"&&!(r!=null&&r.keep)?Number(n):n}class _f{constructor(t){Object.defineProperty(this,Ln,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:o,onAnchor:i,reviver:a}={}){if(!Ml(t))throw new TypeError("A document argument is required");const s={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},c=Dn(this,"",s);if(typeof i=="function")for(const{count:l,res:u}of s.anchors.values())i(u,l);return typeof a=="function"?yi(a,{"":c},"",c):c}}class bf extends _f{constructor(t){super(gf),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if((r==null?void 0:r.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let o;r!=null&&r.aliasResolveCache?o=r.aliasResolveCache:(o=[],hi(t,{Node:(a,s)=>{(fi(s)||M_(s))&&o.push(s)}}),r&&(r.aliasResolveCache=o));let i;for(const a of o){if(a===this)break;a.anchor===this.source&&(i=a)}return i}toJSON(t,r){if(!r)return{source:this.source};const{anchors:o,doc:i,maxAliasCount:a}=r,s=this.resolve(i,r);if(!s){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let c=o.get(s);if(c||(Dn(s,null,r),c=o.get(s)),(c==null?void 0:c.res)===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(a>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=jl(i,s,o)),c.count*c.aliasCount>a)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return c.res}toString(t,r,o){const i=`*${this.source}`;if(t){if(j_(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${i} `}return i}}function jl(n,t,r){if(fi(t)){const o=t.resolve(n),i=r&&o&&r.get(o);return i?i.count*i.aliasCount:0}else if(Ut(t)){let o=0;for(const i of t.items){const a=jl(n,i,r);a>o&&(o=a)}return o}else if(Mt(t)){const o=jl(n,t.key,r),i=jl(n,t.value,r);return Math.max(o,i)}return 1}const K_=n=>!n||typeof n!="function"&&typeof n!="object";class nt extends _f{constructor(t){super(pr),this.value=t}toJSON(t,r){return r!=null&&r.keep?this.value:Dn(this.value,t,r)}toString(){return String(this.value)}}nt.BLOCK_FOLDED="BLOCK_FOLDED",nt.BLOCK_LITERAL="BLOCK_LITERAL",nt.PLAIN="PLAIN",nt.QUOTE_DOUBLE="QUOTE_DOUBLE",nt.QUOTE_SINGLE="QUOTE_SINGLE";const WO="tag:yaml.org,2002:";function YO(n,t,r){if(t){const o=r.filter(a=>a.tag===t),i=o.find(a=>!a.format)??o[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return r.find(o=>{var i;return((i=o.identify)==null?void 0:i.call(o,n))&&!o.format})}function Da(n,t,r){var o,i,a;if(Ml(n)&&(n=n.contents),Et(n))return n;if(Mt(n)){const g=(i=(o=r.schema[Zr]).createNode)==null?void 0:i.call(o,r.schema,null,r);return g.items.push(n),g}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());const{aliasDuplicateObjects:s,onAnchor:c,onTagObj:l,schema:u,sourceObjects:p}=r;let d;if(s&&n&&typeof n=="object"){if(d=p.get(n),d)return d.anchor??(d.anchor=c(n)),new bf(d.anchor);d={anchor:null,node:null},p.set(n,d)}t!=null&&t.startsWith("!!")&&(t=WO+t.slice(2));let f=YO(n,t,u.tags);if(!f){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){const g=new nt(n);return d&&(d.node=g),g}f=n instanceof Map?u[Zr]:Symbol.iterator in Object(n)?u[di]:u[Zr]}l&&(l(f),delete r.onTagObj);const m=f!=null&&f.createNode?f.createNode(r.schema,n,r):typeof((a=f==null?void 0:f.nodeClass)==null?void 0:a.from)=="function"?f.nodeClass.from(r.schema,n,r):new nt(n);return t?m.tag=t:f.default||(m.tag=f.tag),d&&(d.node=m),m}function Fl(n,t,r){let o=r;for(let i=t.length-1;i>=0;--i){const a=t[i];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){const s=[];s[a]=o,o=s}else o=new Map([[a,o]])}return Da(o,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}const Ma=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done;class q_ extends _f{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){const r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(o=>Et(o)||Mt(o)?o.clone(t):o),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(Ma(t))this.add(r);else{const[o,...i]=t,a=this.get(o,!0);if(Ut(a))a.addIn(i,r);else if(a===void 0&&this.schema)this.set(o,Fl(this.schema,i,r));else throw new Error(`Expected YAML collection at ${o}. Remaining path: ${i}`)}}deleteIn(t){const[r,...o]=t;if(o.length===0)return this.delete(r);const i=this.get(r,!0);if(Ut(i))return i.deleteIn(o);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}getIn(t,r){const[o,...i]=t,a=this.get(o,!0);return i.length===0?!r&&kt(a)?a.value:a:Ut(a)?a.getIn(i,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!Mt(r))return!1;const o=r.value;return o==null||t&&kt(o)&&o.value==null&&!o.commentBefore&&!o.comment&&!o.tag})}hasIn(t){const[r,...o]=t;if(o.length===0)return this.has(r);const i=this.get(r,!0);return Ut(i)?i.hasIn(o):!1}setIn(t,r){const[o,...i]=t;if(i.length===0)this.set(o,r);else{const a=this.get(o,!0);if(Ut(a))a.setIn(i,r);else if(a===void 0&&this.schema)this.set(o,Fl(this.schema,i,r));else throw new Error(`Expected YAML collection at ${o}. Remaining path: ${i}`)}}}const JO=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function Br(n,t){return/^\n+$/.test(n)?n.substring(1):t?n.replace(/^(?! *$)/gm,t):n}const So=(n,t,r)=>n.endsWith(`
50
50
  `)?Br(r,t):r.includes(`
51
51
  `)?`
@@ -435,8 +435,8 @@ nodes:
435
435
  input: API
436
436
  status: 200
437
437
  `})).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>{const r=n.replace(/^\.\//,"").replace(/\.yaml$/,"");return{id:r,i18nKey:fx(r),code:t}});function Wa(n){return typeof n=="object"&&!Array.isArray(n)&&n!==null}const i$=[{name:"decK",extract(n){try{const t=Rn.load(n);return Wa(t)&&Array.isArray(t.plugins)&&t.plugins.find(o=>Wa(o)&&o.name==="datakit")||null}catch{return null}}},{name:"KIC",extract(n){let t=n;const r=n.match(/echo\s+(?:"([\s\S]*?)"|'([\s\S]*?)')\s*\|\s*kubectl/);r&&(t=r[1]||r[2]);try{const o=Rn.load(t);if(!Wa(o))return null;const i=Wa(o.metadata)?o.metadata:{},a=o.plugin||i.name;return(o.kind==="KongPlugin"||o.kind==="KongClusterPlugin")&&a==="datakit"&&o||null}catch{return null}}},{name:"cURL",extract(n){if(!n.trim().startsWith("curl"))return null;const t=n.match(/(?:--data|-d)\s+(?:'((?:[^'\\]|\\[\s\S])*)'|"((?:[^"\\]|\\[\s\S])*)")/);if(!t)return null;let r=t[1]||t[2];t[2]&&(r=r.replace(/\\(["\\])/g,"$1"));try{const o=JSON.parse(r);return Wa(o)&&o.name==="datakit"&&o||null}catch{return null}}}],a$={class:"dk-code-editor"},s$={class:"examples-content"},zf="YAML Syntax",l$=Me(e.defineComponent({__name:"CodeEditor",props:{editing:{type:Boolean}},emits:["change","error"],setup(n,{expose:t,emit:r}){const{t:o}=jt.createI18n("en-us",Yt),{formData:i,setValue:a}=ft(),s=r,{getMessageFromError:c}=Ie.useErrors(),l=e.shallowRef(null);function u(w){return Rn.dump(e.toRaw(w),{schema:Eo,noArrayIndent:!0})}function p(){return u(Wr(i,["__ui_data"]))}const d=e.shallowRef(p()),f={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};function m(w){const S=w.getModel();S&&(l.value=w,w.onDidChangeModelContent(()=>{try{const I=Rn.load(w.getValue()||"",{schema:Eo,json:!0});if(typeof I!="object"||I===null)return;tl.editor.setModelMarkers(S,zf,[]),a(I),s("change",I)}catch(I){const{message:j,mark:A}=I,{line:x,column:O}=A||{line:0,column:0},P=j.split(`
438
- `)[0],R=[{startLineNumber:x+1,startColumn:O+1,endLineNumber:x+1,endColumn:O+2,message:P,severity:tl.MarkerSeverity.Error,source:zf}];tl.editor.setModelMarkers(S,zf,R),s("error",P)}}),w.onDidPaste(I=>{const j=w.getModel();if(!j)return;const A=j.getValueInRange(I.range);for(const x of i$){const O=x.extract(A);if(O){y.value=O,b.value=x.name,g.value=!0;return}}}),E())}const g=e.shallowRef(!1),y=e.shallowRef(null),b=e.shallowRef("");function _(){g.value=!1,y.value=null,b.value=""}function k(){y.value&&(d.value=u(y.value),_())}function C(w){return o(`plugins.free-form.datakit.examples.${w}`)}function N(w){const S=w.code;try{const I=Rn.load(d.value,{schema:Eo,json:!0}),j=Rn.load(S,{schema:Eo,json:!0});if(typeof I=="object"&&I!==null&&en(I.config,j))return;const A=Wr({...i,config:{...j}},["__ui_data"]);d.value=u(A)}catch(I){s("error",c(I))}E()}function E(){const w=l.value,S=w==null?void 0:w.getModel();!w||!S||(w.setPosition(S.getFullModelRange().getEndPosition()),w.focus())}return t({setExampleCode:N}),(w,S)=>(e.openBlock(),e.createElementBlock("div",a$,[e.createVNode(e.unref(Fe.KAlert),{class:"examples"},{icon:e.withCtx(()=>[e.createVNode(e.unref(Re.SparklesIcon))]),default:e.withCtx(()=>[e.createElementVNode("div",s$,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.description_example"))+" ",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Gb),I=>(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:I.id,appearance:"secondary",size:"small",onClick:j=>N(I)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C(I.i18nKey)),1)]),_:2},1032,["onClick"]))),128))])]),_:1}),e.createVNode(e.unref(ua.MonacoEditor),{ref:"editor",modelValue:d.value,"onUpdate:modelValue":S[0]||(S[0]=I=>d.value=I),appearance:"standalone",class:"editor",language:"yaml",options:f,theme:"light",onReady:m},null,8,["modelValue"]),e.createVNode(e.unref(Fe.KModal),{"action-button-text":e.unref(o)("plugins.free-form.datakit.detected_config_format_confirm"),title:e.unref(o)("plugins.free-form.datakit.detected_config_format_title"),visible:g.value,onCancel:_,onProceed:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.detected_config_format",{format:b.value})),1)]),_:1},8,["action-button-text","title","visible"])]))}}),[["__scopeId","data-v-20217c6a"]]),{t:c$}=jt.createI18n("en-us",Yt),ac=Tt.createGlobalState(()=>{const n=Tt.useLocalStorage("datakit-editor-mode","flow"),t=Tt.useLocalStorage("datakit-editor-sidebar-expanded",!0),r=Tt.useLocalStorage("datakit-editor-response-panel-collapsed",!1);return{editorMode:n,sidePanelExpanded:t,responsePanelCollapsed:r}});function u$({enabled:n,confirm:t}){Nr.onBeforeRouteLeave(()=>e.toValue(n)?t?t():window.confirm(c$("plugins.free-form.datakit.flow_editor.leave_confirm")):!0);const r=o=>{e.toValue(n)&&o.preventDefault()};Tt.useEventListener("beforeunload",r)}const d$={class:"label-content"},f$={class:"count"},p$={class:"label-content"},m$={class:"count"},Hb=.5,Wf=.03,h$=30,Yf=Me(e.defineComponent({__name:"FlowPanels",props:{inactive:{type:Boolean},mode:{},resizable:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Yt),r=e.ref(!1),o=e.ref(!1),{responsePanelCollapsed:i}=ac(),{state:a,configNodeCounts:s,clearPendingLayout:c,setPendingFitView:l,commit:u,clear:p,portalSelection:d}=Pt(),f=e.useId(),m=`${f}-request`,g=`${f}-response`,y=Nt.useVueFlow(m),b=Nt.useVueFlow(g);function _(le,he){const{onPaneClick:Oe,onNodesChange:$e,onEdgesChange:Pe,getSelectedNodes:qe,getSelectedEdges:Ye}=le,{removeSelectedElements:et}=he;function Ve(ke){if(!ke){et();return}ke.some(we=>we.type==="select")&&qe.value.length+Ye.value.length>0&&et()}$e(Ve),Pe(Ve),Oe(()=>Ve())}_(y,b),_(b,y),e.watch(d,le=>{le&&(y.removeSelectedElements(),b.removeSelectedElements())});const k=e.useTemplateRef("flowPanels"),C=e.useTemplateRef("requestLabel"),N=e.useTemplateRef("requestCanvasContainer"),E=e.useTemplateRef("requestFlow"),w=e.useTemplateRef("resizeHandle"),S=e.useTemplateRef("responseLabel"),I=e.useTemplateRef("responseCanvasContainer"),j=e.useTemplateRef("responseFlow"),A=Tt.useElementBounding(k),x=Tt.useElementBounding(C),O=Tt.useElementBounding(N),P=Tt.useElementBounding(w),R=Tt.useElementBounding(S),W=Tt.useElementBounding(I),Z=e.computed(()=>Math.max(h$,A.height.value*Wf)),X=e.computed(()=>A.height.value-x.height.value-P.height.value-R.height.value),F=e.computed(()=>{const le=X.value;return le?Math.max(Wf,Z.value/le):Wf}),J=e.ref(Hb),$=e.computed(()=>`${J.value*100}%`),q=e.computed(()=>`${(1-J.value)*100}%`),K=e.computed(()=>J.value<=F.value),ae=e.computed(()=>1-J.value<=F.value);function M(le,{persist:he=!0}={}){const Oe=Math.min(1,Math.max(0,le));J.value=Oe,he&&n.mode==="edit"&&(i.value=ae.value)}function v(le,he=!0){M(le?1:Hb,{persist:he})}function H(le=!0){M(0,{persist:le})}if(n.mode==="edit"){const le=s.value.response===0,he=i.value;v(le||he,!1)}else e.watch(()=>s.value.response,le=>{v(le===0,!1)},{immediate:!0});const oe=()=>{n.resizable&&(K.value?v(!1):H())},te=()=>{n.resizable&&v(!ae.value)},{isDragging:ge}=Tt.useDraggable(w,{onMove(le){if(!n.resizable)return;const he=Math.max(0,le.y-O.top.value),Oe=Math.min(1,Math.max(0,he/X.value));M(Oe,{persist:!1})},onEnd(){n.resizable&&(O.height.value<Z.value?H():W.height.value<Z.value?v(!0):M(J.value))}});function me(){e.nextTick(()=>{var le,he;(le=E.value)==null||le.fitView(),(he=j.value)==null||he.fitView()})}return e.watch([r,o,()=>a.value.pendingLayout,()=>a.value.pendingFitView],([le,he,Oe,$e])=>{n.inactive||!le||!he||!Oe&&!$e||(Oe&&c(),$e&&l(!1),setTimeout(async()=>{var Pe,qe;Oe&&(await((Pe=E.value)==null?void 0:Pe.autoLayout(!1)),await((qe=j.value)==null?void 0:qe.autoLayout(!1)),u("*"),Oe==="clearHistory"&&p()),$e&&setTimeout(()=>me(),0)},0))}),(le,he)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowPanels",ref:k,class:"flow-panels"},[e.createElementVNode("div",{ref_key:"requestLabel",ref:C,class:e.normalizeClass(["label request",{resizable:n.resizable}]),onClick:oe},[n.resizable?(e.openBlock(),e.createBlock(e.unref(Re.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:K.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",d$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.request"))+" ",1),e.createElementVNode("span",f$,[e.unref(s).request===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).request}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"requestCanvasContainer",ref:N,class:e.normalizeClass(["canvas",{dragging:e.unref(ge)}]),style:e.normalizeStyle({flexBasis:$.value})},[e.createVNode(ef,{ref_key:"requestFlow",ref:E,"flow-id":m,mode:n.mode,phase:"request",onInitialized:he[0]||(he[0]=Oe=>r.value=!0),onNodesChange:he[1]||(he[1]=Oe=>r.value=!1)},null,8,["mode"])],6),e.createElementVNode("div",{ref_key:"resizeHandle",ref:w,class:e.normalizeClass(["resize-handle",{resizable:n.resizable}])},null,2),e.createElementVNode("div",{ref_key:"responseLabel",ref:S,class:e.normalizeClass(["label response",{dragging:e.unref(ge),resizable:n.resizable}]),onClick:te},[n.resizable?(e.openBlock(),e.createBlock(e.unref(Re.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:ae.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",p$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.response"))+" ",1),e.createElementVNode("span",m$,[e.unref(s).response===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).response}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"responseCanvasContainer",ref:I,class:e.normalizeClass(["canvas response",{dragging:e.unref(ge)}]),style:e.normalizeStyle({flexBasis:q.value})},[e.createVNode(ef,{ref_key:"responseFlow",ref:j,"flow-id":g,mode:n.mode,phase:"response",onInitialized:he[2]||(he[2]=Oe=>o.value=!0),onNodesChange:he[3]||(he[3]=Oe=>o.value=!1)},null,8,["mode"])],6)],512))}}),[["__scopeId","data-v-5a4fec80"]]),g$={class:"dk-confirm-modal-body"},y$={class:"connections"},_$=Me(e.defineComponent({__name:"ConflictModal",props:{title:{},message:{},addedConnections:{},removedConnections:{}},emits:["cancel","confirm"],setup(n,{expose:t,emit:r}){const{i18n:{t:o}}=Je(),i=r,a=e.ref(!1),s=e.ref(n.message),c=e.ref(n.addedConnections??[]),l=e.ref(n.removedConnections??[]);let u=null;function p(){a.value=!1,i("cancel"),u==null||u(!1)}function d(){a.value=!1,i("confirm"),u==null||u(!0)}async function f(m,g,y){return s.value=m,c.value=g??[],l.value=y??[],a.value=!0,await new Promise(b=>{u=b})}return t({open:f}),(m,g)=>{const y=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(y,{"action-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.proceed"),"close-on-backdrop-click":"","max-width":"660px",title:n.title??e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.title"),visible:a.value,"z-index":9999,onCancel:p,onProceed:d},{default:e.withCtx(()=>[e.createElementVNode("div",g$,[e.createElementVNode("p",null,e.toDisplayString(s.value),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.message.confirm")),1),e.createElementVNode("div",y$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref(Re.AddIcon),{color:`var(--kui-color-background-success, ${e.unref(o1)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref(Re.RemoveIcon),{color:`var(--kui-color-text-danger, ${e.unref(Ph)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128))])])]),_:1},8,["action-button-text","title","visible"])}}}),[["__scopeId","data-v-e6df03c2"]]),b$={class:"dk-editor-nav"},w$={class:"top"},k$={class:"bottom"},C$=Me(e.defineComponent({__name:"EditorNav",emits:["back"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Yt),o=t,i=[{label:r("plugins.free-form.datakit.flow_editor.return_to_config"),icon:Re.ArrowLeftIcon,onClick:()=>o("back")}],{sidePanelExpanded:a}=ac(),s=e.computed(()=>a.value?r("plugins.free-form.datakit.flow_editor.collapse_panel"):r("plugins.free-form.datakit.flow_editor.expand_panel")),c=e.ref(!1);function l(){a.value=!a.value}return(u,p)=>(e.openBlock(),e.createElementBlock("nav",b$,[e.createElementVNode("div",w$,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(i,({label:d,to:f,icon:m,onClick:g})=>e.createVNode(e.unref(Fe.KTooltip),{key:d,"kpop-attributes":{offset:"10px"},label:d,placement:"right"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:d,appearance:"none",class:"nav-item",icon:"",to:f,onClick:g},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["size"]))]),_:2},1032,["to","onClick"]))]),_:2},1032,["label"])),64))]),e.createElementVNode("div",k$,[e.createElementVNode("div",{class:e.normalizeClass(["side-panel-toggle",{expanded:e.unref(a)}]),onTransitionend:p[0]||(p[0]=e.withModifiers(d=>c.value=!1,["self"])),onTransitionstart:p[1]||(p[1]=e.withModifiers(d=>c.value=!0,["self"]))},[e.createVNode(e.unref(Fe.KTooltip),{label:c.value?void 0:s.value,placement:e.unref(a)?"left":"right"},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none",class:"nav-item nav-item-toggle",icon:"",size:"large",onClick:l},{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createBlock(e.unref(Re.ChevronDoubleLeftIcon),{key:0,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["size"])):(e.openBlock(),e.createBlock(e.unref(Re.ChevronDoubleRightIcon),{key:1,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["size"]))]),_:1})]),_:1},8,["label","placement"])],34)])]))}}),[["__scopeId","data-v-0dcd2605"]]),E$={class:"dk-editor-main"},N$={class:"header"},S$={class:"actions"},x$={class:"settings"},A$={ref:"canvasContainer",class:"body"},v$=Me(e.defineComponent({__name:"EditorMain",setup(n){const{t}=jt.createI18n("en-us",Yt),{modalOpen:r,undo:o,redo:i,canUndo:a,canRedo:s,load:c}=Pt();function l(f){return t(`plugins.free-form.datakit.examples.${f}`)}function u(f){const m=Rn.load(f.code,{schema:Eo,json:!0});if(typeof m!="object"||m===null)return;const g=m,y={config:{...g,nodes:g.nodes??[]}};c(y,!0)}function p(){r.value=!1}Oh({enabled:r,undo:o,redo:i});const d={maxWidth:"300px",zIndex:1e4};return(f,m)=>(e.openBlock(),e.createElementBlock("div",E$,[e.createElementVNode("header",N$,[e.createElementVNode("div",S$,[e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).undo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.undo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(a),icon:"",onClick:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.UndoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).redo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.redo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(s),icon:"",onClick:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.RedoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),m[0]||(m[0]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createElementVNode("div",x$,[e.createVNode(An,{label:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.label"),"label-attributes":{info:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.description"),tooltipAttributes:d},name:"config.debug"},null,8,["label","label-attributes"])]),m[1]||(m[1]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createVNode(e.unref(Fe.KDropdown),{appearance:"tertiary","kpop-attributes":{placement:"bottom-end",target:"body"},"show-caret":"","trigger-text":e.unref(t)("plugins.free-form.datakit.flow_editor.examples"),width:240},{items:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Gb),g=>(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:g.id,onClick:y=>u(g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l(g.i18nKey)),1)]),_:2},1032,["onClick"]))),128))]),_:1},8,["trigger-text"]),e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",target:"_blank",to:"https://developer.konghq.com/plugins/datakit/"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.view_docs"))+" ",1),e.createVNode(e.unref(Re.ExternalLinkIcon))]),_:1}),e.createVNode(e.unref(Fe.KButton),{onClick:p},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.done")),1)]),_:1})])]),e.createElementVNode("div",A$,[e.createVNode(Yf,{mode:"edit",resizable:""})],512)]))}}),[["__scopeId","data-v-1cf532ff"]]),I$=["draggable"],B$={class:"icon"},T$={class:"content"},O$={class:"title"},P$={class:"description"},V$=Me(e.defineComponent({__name:"NodePanelItem",props:{type:{},unsupported:{type:Boolean}},emits:["dragstart"],setup(n,{emit:t}){e.useCssVars(l=>({f502bd0e:e.unref(a),v4b2eb58e:e.unref(s)}));const r=t,{summary:o,icon:i}=yl[n.type],{colors:{background:a,foreground:s}}=cI(yl[n.type].group);function c(l){r("dragstart",l,n.type)}return(l,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-panel-item",{[`node-type-${n.type}`]:!0,unsupported:n.unsupported}]),draggable:!n.unsupported,onDragstart:c},[e.createElementVNode("div",B$,[e.createVNode(e.unref(i),{size:16})]),e.createElementVNode("div",T$,[e.createElementVNode("div",O$,e.toDisplayString(n.type),1),e.createElementVNode("div",P$,e.toDisplayString(e.unref(o)),1)])],42,I$))}}),[["__scopeId","data-v-829422ff"]]),$$={class:"dk-node-panel"},R$={key:0,class:"title"},L$={class:"node-list"},D$={class:"group-title"},M$={class:"group-items"},j$={"aria-hidden":"true",class:"preview",inert:""},F$=Me(e.defineComponent({__name:"NodePanel",props:{hideTitle:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Yt),{createNode:r}=Pt(),o=e.inject(ur.KM_2446_DATAKIT_JWT_NODES,!1),i=e.computed(()=>o?xy:xy.filter(({id:u})=>u!=="authentication")),a=`dk-drag-preview-${e.useId()}`,s=e.shallowRef(),c=e.computed(()=>s.value?[{id:"preview",type:"flow",data:s.value,position:{x:0,y:0}}]:[]),l=async(u,p)=>{var A,x,O;const d=u.currentTarget,{left:f,top:m,width:g,height:y}=d.getBoundingClientRect(),b=u.clientX-f,_=u.clientY-m;s.value=r({type:p}),await e.nextTick();const k=document.querySelector(`#${a}`)||d,C=k.cloneNode(!0);C.classList.add("dk-drag-snapshot");const{offsetWidth:N,offsetHeight:E}=k;Object.assign(C.style,{position:"absolute",top:"-9999px",left:"-9999px",width:`${N}px`,height:`${E}px`}),document.body.appendChild(C);const w=b/g,S=_/y,I={ratioX:w,ratioY:S,offsetX:N*w,offsetY:E*S},j={action:"create-node",data:{type:p,anchor:I}};(A=u.dataTransfer)==null||A.setData(pa,JSON.stringify(j)),(x=u.dataTransfer)==null||x.setData(`${pa}/${p}`,p),(O=u.dataTransfer)==null||O.setDragImage(C,I.offsetX,I.offsetY),requestAnimationFrame(()=>{C.remove(),s.value=void 0})};return(u,p)=>{const d=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",$$,[n.hideTitle?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("h3",R$,[e.createVNode(d,{class:"label",info:e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.description")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.title")),1)]),_:1},8,["info"])])),e.createElementVNode("div",L$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,f=>(e.openBlock(),e.createElementBlock("section",{key:f.id,class:"node-group"},[e.createElementVNode("h4",D$,e.toDisplayString(f.title),1),e.createElementVNode("div",M$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.nodes,m=>(e.openBlock(),e.createBlock(V$,{key:m.type,type:m.type,onDragstart:l},null,8,["type"]))),128))])]))),128))]),e.createElementVNode("div",j$,[e.createVNode(e.unref(Nt.VueFlow),{nodes:c.value},{"node-flow":e.withCtx(f=>[e.createVNode(Gy,{id:a,data:f.data},null,8,["data"])]),_:1},8,["nodes"])])])}}}),[["__scopeId","data-v-f2040974"]]);function U$(){const{addField:n,getNodeByName:t,removeField:r,replaceConfig:o,renameField:i,disconnectOutEdges:a,nodeMapByName:s}=Pt(),c=t("vault");if(!c)throw new Error("no vault node");const l=e.computed(()=>{var g;return((g=s.value.get("vault"))==null?void 0:g.config)||{}});return{formData:e.computed(()=>({vault:{...l.value}})),addVault:(g,y)=>{n(c.id,"output",g,!1);const b={...c.config,[g]:y};o(c.id,b)},removeVault:g=>{const y=Yr(c,"output",g);if(!y)return;const b=c.fields.output.length===1;r(c.id,y.id,!0,!1);const _=Wr(c.config,g);o(c.id,_,!b),b&&a(c.id)},updateVault:(g,y,b=!0)=>{const _={...c.config,[g]:y};o(c.id,_,b)},renameVault:(g,y,b=!0)=>{var N;const _=Yr(c,"output",g);if(!_)return;i(c.id,_.id,y,!1);const k=((N=c.config)==null?void 0:N[g])??"",C={...Wr(c.config,g),[y]:k};o(c.id,C,b)}}}const K$=e.defineComponent({__name:"VaultSecretPicker",props:{secretRef:{type:[String,Boolean]},secretName:{},validateName:{type:Function,default:()=>{}},isEditing:{type:Boolean,default:!1}},emits:["proceed","cancel"],setup(n,{emit:t}){const r=t,{i18n:{t:o}}=st.useI18n(),i=e.inject(Ze.FORMS_CONFIG),a=e.ref(n.secretName||""),s=e.ref(""),c=e.computed(()=>a.value.trim()?n.validateName(a.value.trim(),n.isEditing)===void 0:!1),l=e.computed(()=>!c.value),u=()=>{const m=a.value.trim(),g=n.validateName(m,n.isEditing);return s.value=g||"",g===void 0},p=()=>{s.value="",u()},d=m=>{u()&&r("proceed",{secretRef:m,secretName:a.value.trim()})},f=()=>{a.value="",s.value="",r("cancel")};return e.watch(()=>n.secretName,m=>{a.value=m||"",s.value=""}),(m,g)=>{const y=e.resolveComponent("KInput"),b=e.resolveComponent("KEmptyState");return e.unref(i)?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPicker),{key:0,"additional-disabled":l.value,config:e.unref(i),"proceed-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.proceed_button_text"),setup:n.secretRef,title:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.title"),onCancel:f,onProceed:d},{"form-prefix":e.withCtx(()=>[e.createVNode(y,{"model-value":a.value,"onUpdate:modelValue":[g[0]||(g[0]=_=>a.value=_),p],"data-testid":"vault-secret-picker-secret-name-input",error:!!s.value,"error-message":s.value,label:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.label"),"label-attributes":{info:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.help")},placeholder:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.placeholder"),required:""},null,8,["model-value","error","error-message","label","label-attributes","placeholder"])]),_:1},8,["additional-disabled","config","proceed-button-text","setup","title"])):(e.openBlock(),e.createBlock(b,{key:1,"icon-variant":"error",message:e.unref(o)("plugins.free-form.vault_picker.component_error")},null,8,["message"]))}}}),q$={class:"dk-vault-panel"},G$={class:"title"},H$={class:"vault-list"},z$={key:0,class:"vault-list-item"},W$={class:"vault-list-item-key"},Y$={class:"vault-list-item-key-text"},J$=Me(e.defineComponent({__name:"VaultField",props:{autofocus:{type:Boolean},name:{},labelAttributes:{}},emits:["update","add","remove"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l}=df(e.toRef(r,"name")),u=Gt(e.toRef(r,"name")),p=e.ref(null),d=e.ref(null),f=e.computed(()=>{if(!p.value)return null;const E=l(p.value),w=u.value?u.value.value[p.value]:void 0;return E===void 0||w===void 0?null:{id:p.value,key:E,value:w}}),{i18n:{t:m}}=st.useI18n(),g=e.computed(()=>new Set(i.value.map(([,E])=>E))),y=()=>{if(!u.value)return;const w=a();d.value=w,p.value=w},b=()=>{p.value=null,d.value&&(s(d.value),d.value=null)},_=E=>{if(!f.value)throw new Error("no selected entry");const w=f.value.key,S=w!==E.secretName,I=f.value.value!==E.secretRef,j=S||I;f.value.value=E.secretRef,f.value.key=E.secretName,I&&(u.value.value[f.value.id]=E.secretRef),S&&c(f.value.id,E.secretName),d.value?o("add",E.secretName,E.secretRef):j&&o("update",E.secretName,E.secretRef,S?w:void 0),d.value=null,b()},k=E=>{p.value=E},C=E=>{const w=l(E);s(E),o("remove",w)},N=(E,w)=>{var S;if(!E)return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_required_error");if(g.value.has(E)&&!(w&&E===((S=f.value)==null?void 0:S.key)))return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_exists_error")};return(E,w)=>{var A,x;const S=e.resolveComponent("KButton"),I=e.resolveComponent("KDropdownItem"),j=e.resolveComponent("KDropdown");return e.openBlock(),e.createElementBlock("div",q$,[e.createElementVNode("h3",G$,e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.title")),1),e.createVNode(S,{appearance:"tertiary",class:"add-button",size:"small",onClick:y},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.add_button")),1)]),_:1}),e.createElementVNode("div",H$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),([O,P])=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:O},[P?(e.openBlock(),e.createElementBlock("div",z$,[e.createElementVNode("div",W$,[e.createVNode(e.unref(Re.KeyIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:16},null,8,["color"]),e.createElementVNode("div",Y$,e.toDisplayString(P),1)]),e.createVNode(j,null,{items:e.withCtx(()=>[e.createVNode(I,{onClick:R=>k(O)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1},8,["onClick"]),e.createVNode(I,{danger:"",onClick:R=>C(O)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1},8,["onClick"])]),default:e.withCtx(()=>[e.createVNode(S,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text, ${e.unref(od)})`},null,8,["color"])]),_:1})]),_:2},1024)])):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(K$,{"is-editing":!!p.value&&!d.value,"secret-name":(A=f.value)==null?void 0:A.key,"secret-ref":(x=f.value)==null?void 0:x.value,"validate-name":N,onCancel:b,onProceed:_},null,8,["is-editing","secret-name","secret-ref"])])}}}),[["__scopeId","data-v-a7726f48"]]);function X$(){const{getSchema:n}=ft();return e.computed(()=>{const t=n("config.resources");if(!t)throw new Error("Failed to get resource schema");const r=vr(t);return r.fields.forEach(o=>{const i=Object.keys(o)[0];if(i==="cache"){const a=o[i];o[i]={...a,fields:[...a.fields,{partial_id:{type:"string"}}]},a.fields.forEach(s=>{const c=Object.keys(s)[0];if(c==="redis"){const l=s[c];s[c]={...l},delete s[c].required}})}}),r})}const Z$={key:1},Q$=["innerHTML"],eR={class:"horizontal-container"},Jf=Me(e.defineComponent({__name:"RadioField",props:{labelAttributes:{},multiple:{type:Boolean},items:{},label:{},autofocus:{type:Boolean},name:{}},emits:["update:modelValue"],setup(n,{emit:t}){const r=t,o=e.createPropsRestProxy(n,["name","items"]),{getSelectItems:i}=ft(),a=Gt(e.toRef(()=>n.name)),s=hn(a.path,o),c=e.computed(()=>n.items?n.items:a.path?i(a.path.value):[]),l=u=>{a.value&&(a.value.value=u),r("update:modelValue",u)};return(u,p)=>{var m;const d=e.resolveComponent("KAlert"),f=e.resolveComponent("KLabel");return e.unref(a).error?(e.openBlock(),e.createBlock(d,{key:0,appearance:"danger",message:e.unref(a).error.message},null,8,["message"])):e.withDirectives((e.openBlock(),e.createElementBlock("div",Z$,[e.createVNode(f,e.normalizeProps(e.guardReactiveProps(e.unref(s).labelAttributes)),e.createSlots({default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s).label)+" ",1)]),_:2},[(m=e.unref(s).labelAttributes)!=null&&m.info?{name:"tooltip",fn:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:e.unref(s).labelAttributes.info},null,8,Q$)]),key:"0"}:void 0]),1040),e.createElementVNode("div",eR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,g=>(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),{key:g.value,"model-value":e.unref(a).value.value,"onUpdate:modelValue":[p[0]||(p[0]=y=>e.unref(a).value.value=y),l],"card-orientation":"horizontal",label:g.label,"selected-value":g.value},null,8,["model-value","label","selected-value"]))),128))])],512)),[[e.vShow,!e.unref(a).hide.value]])}}}),[["__scopeId","data-v-7c0483f3"]]),tR={class:"dk-cache-panel"},nR={class:"title"},rR={key:0,class:"cache-item"},oR={class:"cache-item-key"},iR={class:"cache-item-key-text"},aR={class:"dk-resource-cache-form"},sR={key:1},lR={key:2,class:"dk-cache-inline-redis"},cR={key:3,class:"dk-cache-redis-editor"},uR={key:0,class:"redis-editor-error"},dR=Me(e.defineComponent({__name:"CacheField",props:{strategy:{}},emits:["update","remove","cancel"],setup(n,{emit:t}){const r=Rn.dump({host:"127.0.0.1",port:6379},{indent:2}),o=t,{getDefault:i,formData:a}=ft(),s=Gt("cache");if(s.error)throw new Error("No cache schema");const c=e.inject(Ai),l=e.computed(()=>!!c),u=e.shallowRef(""),p=e.ref(""),d=e.ref(!1),{i18n:{t:f}}=st.useI18n(),m=e.computed(()=>{var S,I,j;return g.value==="redis"?l.value?!!((S=a.cache)!=null&&S.partial_id||(I=a.cache)!=null&&I.redis):!!((j=a.cache)!=null&&j.redis)&&!p.value:!0}),g=e.computed(()=>{var S;return(S=s.value.value)==null?void 0:S.strategy}),y=e.computed(()=>{var S;return(S=s.value.value)!=null&&S.redis?Rn.dump(s.value.value.redis,{indent:2,noRefs:!0}):""});e.watch([d,g],([S,I])=>{S&&I==="redis"&&!l.value&&(u.value=y.value||r,p.value="")}),e.watch(u,S=>{var I;if(!l.value&&g.value==="redis")try{const j=Rn.load(S,{json:!0});j&&typeof j=="object"&&(a.cache.redis=j,p.value="")}catch(j){p.value=((I=j.message)==null?void 0:I.split(`
439
- `)[0])||"Invalid YAML"}});const b=()=>{d.value=!0},_=()=>{d.value=!1,o("cancel")},k=()=>{o("remove")},C=()=>{b(),s.value.value||(s.value.value=i("cache"),s.value.value.strategy="memory")},N=()=>{d.value=!1,o("update",a)},E=()=>{var S,I;g.value==="memory"&&((S=a.cache)!=null&&S.partial_id)&&((I=a.cache)==null||delete I.partial_id)};async function w({codeElement:S,language:I,code:j}){S.innerHTML=await zC.codeToHtml(j,{lang:I,theme:"catppuccin-mocha",structure:"inline"})}return(S,I)=>{const j=e.resolveComponent("KButton"),A=e.resolveComponent("KDropdownItem"),x=e.resolveComponent("KDropdown"),O=e.resolveComponent("KLabel"),P=e.resolveComponent("KCodeBlock"),R=e.resolveComponent("KModal");return e.openBlock(),e.createElementBlock("div",tR,[e.createElementVNode("h3",nR,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title")),1),n.strategy?(e.openBlock(),e.createElementBlock("div",rR,[e.createElementVNode("div",oR,[e.createVNode(e.unref(Re.DatabaseIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"]),e.createElementVNode("div",iR,e.toDisplayString(n.strategy),1)]),e.createVNode(x,null,{items:e.withCtx(()=>[e.createVNode(A,{onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1}),e.createVNode(A,{danger:"",onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(j,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text, ${e.unref(od)})`},null,8,["color"])]),_:1})]),_:1})])):(e.openBlock(),e.createBlock(j,{key:1,appearance:"tertiary",class:"add-button",size:"small",onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.add_button")),1)]),_:1})),e.createVNode(R,{"action-button-disabled":!m.value,"action-button-text":e.unref(f)("actions.save"),"max-width":"640px",title:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title"),visible:d.value,onCancel:_,onProceed:N},{default:e.withCtx(()=>{var W,Z;return[e.createElementVNode("div",aR,[e.createVNode(Jf,{items:[{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.memory"),value:"memory"},{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.redis"),value:"redis"}],name:"strategy","onUpdate:modelValue":E},null,8,["items"]),g.value==="memory"?(e.openBlock(),e.createBlock(ot,{key:0,name:"memory.dictionary_name"})):e.createCommentVNode("",!0),g.value==="redis"&&l.value?(e.openBlock(),e.createElementBlock("div",sR,[e.createVNode(O,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.select_redis_configuration")),1)]),_:1}),e.createVNode(e.unref(Bh.RedisConfigurationSelector),{"model-value":(W=e.unref(a).cache)==null?void 0:W.partial_id,"redis-type":"redis-ee","onUpdate:modelValue":I[0]||(I[0]=X=>e.unref(a).cache.partial_id=X)},null,8,["model-value"])])):e.createCommentVNode("",!0),g.value==="redis"&&l.value&&!((Z=e.unref(a).cache)!=null&&Z.partial_id)&&y.value?(e.openBlock(),e.createElementBlock("div",lR,[e.createElementVNode("div",null,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config_preview")),1),e.createVNode(P,{id:"dk-cache-redis-configuration",code:y.value,language:"yaml",theme:"dark",onCodeBlockRender:w},null,8,["code"])])):e.createCommentVNode("",!0),g.value==="redis"&&!l.value?(e.openBlock(),e.createElementBlock("div",cR,[e.createVNode(O,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config")),1)]),_:1}),e.createVNode(e.unref(ua.MonacoEditor),{modelValue:u.value,"onUpdate:modelValue":I[1]||(I[1]=X=>u.value=X),appearance:"standalone",class:"redis-editor",language:"yaml",theme:"light"},null,8,["modelValue"]),p.value?(e.openBlock(),e.createElementBlock("p",uR,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]}),_:1},8,["action-button-disabled","action-button-text","title","visible"])])}}}),[["__scopeId","data-v-6b125ed7"]]),fR={class:"dk-resources-panel"},pR=Me(e.defineComponent({__name:"ResourcesPanel",setup(n){const t=X$(),r=e.ref(0),{addVault:o,removeVault:i,updateVault:a,renameVault:s,formData:c}=U$();function l(y,b,_){_&&_!==y&&s(_,y,!1),a(y,b)}const{state:u,commit:p}=Pt(),d=e.computed(()=>({cache:u.value.cacheConfig}));function f(y){u.value.cacheConfig=y.cache,p()}function m(){u.value.cacheConfig=void 0,p()}function g(){r.value++}return(y,b)=>(e.openBlock(),e.createElementBlock("div",fR,[e.createVNode(Jt,{data:e.unref(c),schema:e.unref(t)},{default:e.withCtx(()=>[e.createVNode(J$,{name:"vault",onAdd:e.unref(o),onRemove:e.unref(i),onUpdate:l},null,8,["onAdd","onRemove"])]),_:1},8,["data","schema"]),b[0]||(b[0]=e.createElementVNode("hr",{class:"dk-resources-divider"},null,-1)),(e.openBlock(),e.createBlock(Jt,{key:`${r.value}`,data:d.value,schema:e.unref(t)},{default:e.withCtx(()=>{var _;return[e.createVNode(dR,{strategy:(_=d.value.cache)==null?void 0:_.strategy,onCancel:g,onRemove:m,onUpdate:f},null,8,["strategy"])]}),_:1},8,["data","schema"]))]))}}),[["__scopeId","data-v-9093c001"]]),mR={class:"header"},hR={class:"title"},gR={class:"body"},yR={class:"panel"},_R=Me(e.defineComponent({__name:"SidePanel",setup(n){const{t}=jt.createI18n("en-us",Yt),{sidePanelExpanded:r}=ac(),{propertiesPanelOpen:o,selectedNode:i}=Pt(),a=e.ref("nodes");function s(){o.value=!1}e.watch(i,l=>{l||s()});const c=e.ref(!1);return e.onMounted(()=>{c.value=!0}),(l,u)=>{const p=e.resolveComponent("KSegmentedControl");return e.openBlock(),e.createElementBlock("aside",{class:e.normalizeClass(["side-panel",{expanded:e.unref(r),inited:c.value}])},[e.createElementVNode("header",mR,[e.createElementVNode("h2",hR,e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.name")),1)]),e.createElementVNode("div",gR,[e.createElementVNode("div",yR,[e.createVNode(p,{modelValue:a.value,"onUpdate:modelValue":u[0]||(u[0]=d=>a.value=d),options:[{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.nodes"),value:"nodes"},{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.resources.title"),value:"resources"}]},null,8,["modelValue","options"]),a.value==="nodes"?(e.openBlock(),e.createBlock(F$,{key:0,class:"node-panel","hide-title":""})):e.createCommentVNode("",!0),a.value==="resources"?(e.openBlock(),e.createBlock(pR,{key:1})):e.createCommentVNode("",!0)])])],2)}}}),[["__scopeId","data-v-9e854e60"]]),bR=e.defineComponent({__name:"HttpMethodField",props:{name:{}},setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Dt,{items:e.unref(nf)([...e.unref(Ny)]),name:n.name},null,8,["items","name"]))}});function wR(n,t){const r=[],o=(i,a)=>{typeof a=="string"&&r.push({nodeName:n.name,path:["nodes",t,...i],value:a})};if("input"in n&&n.input!=null&&o(["input"],n.input),"inputs"in n&&n.inputs&&typeof n.inputs=="object")for(const[i,a]of Object.entries(n.inputs))a!=null&&o(["inputs",i],a);if("output"in n&&n.output!=null&&o(["output"],n.output),"outputs"in n&&n.outputs&&typeof n.outputs=="object")for(const[i,a]of Object.entries(n.outputs))a!=null&&o(["outputs",i],a);return r}function kR(n){const t=n.path[2];return t==="output"||t==="outputs"}function zb(n){if(!n)return!1;for(const t of Object.values(n))if(t!=null)return!0;return!1}function Wb(n,t){const r=n.input!==void 0&&n.input!==null,o=zb(n.inputs);r&&o&&t.addIssue({code:"custom",message:'A node cannot use both "input" and "inputs". Use one or the other.',path:["inputs"]});const i=n.output!==void 0&&n.output!==null,a=zb(n.outputs);i&&a&&t.addIssue({code:"custom",message:'A node cannot use both "output" and "outputs". Use one or the other.',path:["outputs"]})}function Yb(n,t,r){if(!n.nodes)return;const o=n.nodes.map(l=>l.name),i=new Set;o.forEach((l,u)=>{i.has(l)&&r.addIssue({code:"custom",message:`Duplicate node name: "${l}"`,path:["nodes",u,"name"]}),i.add(l)});const a=new Set([...t,...o]),s=new Map,c=new Map;n.nodes.forEach((l,u)=>{for(const p of wR(l,u)){const d=p.value.split(".",1)[0];if(a.has(d)||r.addIssue({code:"custom",message:`Unknown node "${d}" in connection "${p.value}"`,path:p.path}),kR(p)){const f=`${p.nodeName}->${d}`;c.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${p.nodeName}" outputs to "${d}" and "${d}" inputs from "${p.nodeName}". Specify it on one side only.`,path:p.path}):s.set(f,s.get(f)??p.path)}else{const f=`${d}->${p.nodeName}`;s.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${d}" outputs to "${p.nodeName}" and "${p.nodeName}" inputs from "${d}". Specify it on one side only.`,path:p.path}):c.set(f,c.get(f)??p.path)}}})}const CR=Q.z.enum(Cy),ER=Q.z.enum(ei),Jb=n=>ei.includes(n),Xf=Q.z.enum(Ey),Xb=Xf.options;Q.z.union([Xf,CR]);const NR=/^[A-Za-z_][A-Za-z0-9_-]{0,254}$/,sc=Q.z.string().min(1).max(255).regex(NR,"Invalid node name (snake_case / kebab-case only)").refine(n=>!Jb(n),"Name clashes with reserved implicit node").brand(),Zb=Q.z.union([ER,sc]),SR=Q.z.string().min(1).brand(),xR=["then","else"];Q.z.enum(xR);const ct=Q.z.string().min(1).max(255).refine(n=>{if(Zb.safeParse(n).success)return!0;const t=n.match(/^([^.]+)\.([^.]+)$/);if(!t)return!1;const[,r,o]=t;return Zb.safeParse(r).success&&SR.safeParse(o).success},'Invalid connection, expected "NODE" or "NODE.FIELD"').nullish(),AR=Q.z.object({body:ct,headers:ct,http_proxy:ct,https_proxy:ct,proxy_auth_password:ct,proxy_auth_username:ct,query:ct,url:ct}).partial().strict(),vR=Q.z.object({headers:ct,body:ct}).partial().strict(),IR=Q.z.object({data:ct,key:ct,ttl:ct}).partial().strict(),BR=Q.z.object({claims:ct,key:ct}).partial().strict(),TR=Q.z.object({key:ct,token:ct}).partial().strict(),Qb=Q.z.enum(Ny),ew=Q.z.enum(Md),jn=Q.z.object({type:Q.z.string(),name:sc,input:ct,inputs:Q.z.record(Q.z.string().min(1).max(255),ct).nullish(),output:ct,outputs:Q.z.record(Q.z.string().min(1).max(255),ct).nullish()}).loose().superRefine((n,t)=>{Wb(n,t)}),OR=Q.z.object({type:Q.z.string(),name:Q.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"invalid node name",fatal:!1}),Xb.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${Xb.join(", ")}`})}),PR=jn.safeExtend({type:Q.z.literal("call"),method:Qb.default("GET").nullish(),ssl_server_name:Q.z.string().nullish(),ssl_verify:Q.z.boolean().default(!0).nullish(),timeout:Q.z.number().int().min(0).max(2147483646).nullish(),url:Q.z.url().nullish(),inputs:AR.nullish(),outputs:Q.z.object({body:ct,headers:ct,raw_body:ct,status:ct}).partial().nullish()}).strict(),VR=jn.safeExtend({type:Q.z.literal("exit"),status:Q.z.number().int().min(200).max(599).default(200).nullish(),warn_headers_sent:Q.z.boolean().nullish(),inputs:vR.nullish(),output:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),$R=jn.safeExtend({type:Q.z.literal("jq"),jq:Q.z.string().min(1).max(10240),outputs:Q.z.never().nullish()}).strict(),RR=jn.safeExtend({type:Q.z.literal("xml_to_json"),recognize_type:Q.z.boolean().nullish().default(!0),attributes_block_name:Q.z.string().min(1).max(32).nullish(),attributes_name_prefix:Q.z.string().min(1).max(32).nullish(),text_block_name:Q.z.string().min(1).max(32).nullish().default("#text"),text_as_property:Q.z.boolean().nullish().default(!1),xpath:Q.z.string().min(1).max(256).nullish(),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),LR=jn.safeExtend({type:Q.z.literal("json_to_xml"),attributes_block_name:Q.z.string().min(1).max(32).nullish(),attributes_name_prefix:Q.z.string().min(1).max(32).nullish(),root_element_name:Q.z.string().min(1).max(64).nullish(),text_block_name:Q.z.string().min(1).max(32).nullish().default("#text"),inputs:Q.z.record(Q.z.string().min(1).max(255),ct).nullish(),outputs:Q.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),DR=jn.safeExtend({type:Q.z.literal("jwt_decode"),inputs:Q.z.never().nullish(),outputs:Q.z.object({header:ct,payload:ct,signature:ct}).partial().nullish()}).strict(),MR=jn.safeExtend({type:Q.z.literal("jwt_sign"),algorithm:ew,expires_in:Q.z.number().int().min(1).default(300).nullish(),inputs:BR.nullish(),kid:Q.z.string().nullish(),not_before:Q.z.number().int().min(0).default(0).nullish(),outputs:Q.z.object({claims:ct,header:ct,token:ct}).partial().nullish(),static_claims:Q.z.record(Q.z.string(),Q.z.string()).default({}).nullish(),typ:Q.z.string().default("JWT").nullish()}).strict(),jR=jn.safeExtend({type:Q.z.literal("jwt_verify"),allowed_algorithms:Q.z.array(ew).default([]).nullish(),audiences:Q.z.array(Q.z.string()).default([]).nullish(),inputs:TR.nullish(),issuers:Q.z.array(Q.z.string()).default([]).nullish(),leeway:Q.z.number().int().min(0).default(0).nullish(),outputs:Q.z.object({claims:ct,header:ct}).partial().nullish(),required_claims:Q.z.array(Q.z.string()).default([]).nullish(),validate_exp:Q.z.boolean().default(!0).nullish(),validate_nbf:Q.z.boolean().default(!0).nullish()}).strict(),FR=jn.safeExtend({type:Q.z.literal("property"),content_type:Q.z.enum(["application/json","text/plain","application/octet-stream"]).nullish(),property:Q.z.string().min(1).max(255),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),UR=jn.safeExtend({type:Q.z.literal("static"),values:Q.z.record(Q.z.string(),Q.z.unknown()),input:Q.z.never().nullish(),inputs:Q.z.never().nullish()}).strict(),KR=jn.safeExtend({type:Q.z.literal("cache"),bypass_on_error:Q.z.boolean().nullish(),inputs:IR.nullish(),outputs:Q.z.object({data:ct,hit:ct,miss:ct,stored:ct}).partial().nullish(),ttl:Q.z.number().int().gt(0).nullish()}).strict(),qR=jn.safeExtend({type:Q.z.literal("branch"),then:Q.z.array(sc).min(1).max(64).nullish(),else:Q.z.array(sc).min(1).max(64).nullish()}).strict(),GR=OR.pipe(Q.z.discriminatedUnion("type",[PR,VR,$R,RR,LR,DR,MR,jR,FR,UR,KR,qR])),HR=Q.z.record(Q.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),Q.z.string().min(1).max(4095)),zR=Q.z.object({dictionary_name:Q.z.string().nullish().default("kong_db_cache")}),WR=Q.z.object({host:Q.z.string().default("127.0.0.1"),port:Q.z.number().int().min(0).max(65535).default(6379)}),YR=Q.z.object({ip:Q.z.string().default("127.0.0.1"),port:Q.z.number().int().min(0).max(65535).default(6379)}),JR=Q.z.object({host:Q.z.string().nullish().default("127.0.0.1"),port:Q.z.number().int().min(0).max(65535).nullish().default(6379),connect_timeout:Q.z.number().int().min(0).max(2147483646).nullish().default(2e3),send_timeout:Q.z.number().int().min(0).max(2147483646).nullish().default(2e3),read_timeout:Q.z.number().int().min(0).max(2147483646).nullish().default(2e3),username:Q.z.string().nullish(),password:Q.z.string().nullish(),sentinel_username:Q.z.string().nullish(),sentinel_password:Q.z.string().nullish(),database:Q.z.number().int().nullish().default(0),keepalive_pool_size:Q.z.number().int().min(1).max(2147483646).nullish().default(256),keepalive_backlog:Q.z.number().int().min(0).max(2147483646).nullish(),sentinel_master:Q.z.string().nullish(),sentinel_role:Q.z.enum(["master","slave","any"]).nullish(),sentinel_nodes:Q.z.array(WR).min(1,{message:"sentinel_nodes must contain at least 1 item"}).nullish(),cluster_nodes:Q.z.array(YR).min(1,{message:"cluster_nodes must contain at least 1 item"}).nullish(),ssl:Q.z.boolean().default(!1).nullish(),ssl_verify:Q.z.boolean().default(!0).nullish(),server_name:Q.z.string().nullish(),cluster_max_redirections:Q.z.number().int().default(5).nullish(),connection_is_proxied:Q.z.boolean().default(!1).nullish(),cloud_authentication:Q.z.object({auth_provider:Q.z.enum(["aws","azure","gcp"]).nullish(),aws_access_key_id:Q.z.string().nullish(),aws_assume_role_arn:Q.z.string().nullish(),aws_cache_name:Q.z.string().nullish(),aws_is_serverless:Q.z.boolean().default(!0).nullish(),aws_region:Q.z.string().nullish(),aws_role_session_name:Q.z.string().nullish(),aws_secret_access_key:Q.z.string().nullish(),azure_client_id:Q.z.string().nullish(),azure_client_secret:Q.z.string().nullish(),azure_tenant_id:Q.z.string().nullish(),gcp_service_account_json:Q.z.string().nullish()}).nullish(),timeout:Q.z.number().int().nullish(),sentinel_addresses:Q.z.array(Q.z.string()).min(1).nullish(),cluster_addresses:Q.z.array(Q.z.string()).min(1).nullish()}).superRefine((n,t)=>{var l;const r=n.host!==void 0&&n.host!==null,o=n.port!==void 0&&n.port!==null;(r&&!o||!r&&o)&&t.addIssue({code:"custom",message:"host and port must be specified together",path:r?["port"]:["host"]});const i=!!n.sentinel_master,a=!!n.sentinel_role,s=!!((l=n.sentinel_nodes)!=null&&l.length),c=[i,a,s].filter(Boolean).length;c>0&&c<3&&t.addIssue({code:"custom",message:"sentinel_master, sentinel_role and sentinel_nodes must be provided together"}),n.connection_is_proxied===!0&&!r&&t.addIssue({code:"custom",message:"host is required when connection_is_proxied is true (host/port should point to the proxy)",path:["host"]})}),XR=Q.z.object({strategy:Q.z.enum(["memory","redis"]).nullish(),memory:zR,redis:JR}),ZR=Q.z.object({vault:HR.nullish(),cache:XR.nullish()});Q.z.array(Q.z.object({id:Q.z.string()})),Q.z.object({nodes:Q.z.array(GR).min(1,"At least one node is required").max(64),debug:Q.z.boolean().default(!1).nullish(),resources:ZR.nullish()}).strict().superRefine((n,t)=>{Yb(n,ei,t)});const tw=Xf.options,Zf=Q.z.string().min(1).refine(n=>!n.includes("."),"Invalid node name").refine(n=>!Jb(n),"Node name conflicts with reserved implicit node"),yt=Q.z.string().refine(n=>{if(!n||/\s/.test(n))return!1;const t=n.indexOf(".");if(t===-1)return!0;const r=n.slice(0,t),o=n.slice(t+1);return r.length>0&&o.length>0},"Invalid connection"),nw=Q.z.object({body:yt.nullish(),headers:yt.nullish(),query:yt.nullish()}).partial().strict(),rw=Q.z.object({headers:yt.nullish(),body:yt.nullish()}).partial().strict(),ow=Q.z.object({data:yt.nullish(),key:yt.nullish(),ttl:yt.nullish()}).partial().strict(),iw=Q.z.object({claims:yt.nullish(),key:yt.nullish()}).partial().strict(),aw=Q.z.object({key:yt.nullish(),token:yt.nullish()}).partial().strict(),QR={call:nw,exit:rw,cache:ow,jwt_sign:iw,jwt_verify:aw};function e2(n){const t=QR[n];return t?Object.keys(t.shape):null}const Fn=Q.z.object({type:Q.z.string(),name:Zf,input:yt.nullish(),inputs:Q.z.record(Q.z.string(),yt.nullish()).nullish(),output:yt.nullish(),outputs:Q.z.record(Q.z.string(),yt.nullish()).nullish()}).loose().superRefine((n,t)=>{Wb(n,t)}),t2=Q.z.object({type:Q.z.string(),name:Q.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"Invalid node name",fatal:!1}),tw.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${tw.join(", ")}`})}),n2=Fn.safeExtend({type:Q.z.literal("call"),method:Qb.nullish(),ssl_server_name:Q.z.string().nullish(),ssl_verify:Q.z.boolean().nullish(),timeout:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),url:Q.z.string().nullish(),inputs:nw.nullish(),outputs:Q.z.object({body:yt.nullish(),headers:yt.nullish(),status:yt.nullish()}).partial().nullish()}).strict(),r2=Fn.safeExtend({type:Q.z.literal("exit"),status:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),warn_headers_sent:Q.z.boolean().nullish(),inputs:rw.nullish(),output:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),o2=Fn.safeExtend({type:Q.z.literal("jq"),jq:Q.z.string().nullish(),outputs:Q.z.never().nullish()}).strict(),i2=Fn.safeExtend({type:Q.z.literal("xml_to_json"),recognize_type:Q.z.boolean().nullish(),attributes_block_name:Q.z.string().nullish(),attributes_name_prefix:Q.z.string().nullish(),text_block_name:Q.z.string().nullish(),text_as_property:Q.z.boolean().nullish(),xpath:Q.z.string().nullish(),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),a2=Fn.safeExtend({type:Q.z.literal("json_to_xml"),attributes_block_name:Q.z.string().nullish(),attributes_name_prefix:Q.z.string().nullish(),root_element_name:Q.z.string().nullish(),text_block_name:Q.z.string().nullish(),inputs:Q.z.record(Q.z.string(),yt.nullish()).nullish(),outputs:Q.z.never().nullish()}).strict(),s2=Fn.safeExtend({type:Q.z.literal("property"),content_type:Q.z.string().nullish(),property:Q.z.string().nullish(),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),l2=Fn.safeExtend({type:Q.z.literal("static"),values:Q.z.record(Q.z.string(),Q.z.unknown()).nullish(),input:Q.z.never().nullish(),inputs:Q.z.never().nullish()}).strict(),c2=Fn.safeExtend({type:Q.z.literal("cache"),bypass_on_error:Q.z.boolean().nullish(),inputs:ow.nullish(),outputs:Q.z.object({data:yt.nullish(),hit:yt.nullish(),miss:yt.nullish(),stored:yt.nullish()}).partial().nullish(),ttl:Q.z.union([Q.z.number(),Q.z.string()]).nullish()}).strict(),u2=Fn.safeExtend({type:Q.z.literal("jwt_decode"),inputs:Q.z.never().nullish(),outputs:Q.z.object({header:yt.nullish(),payload:yt.nullish(),signature:yt.nullish()}).partial().nullish()}).strict(),d2=Fn.safeExtend({type:Q.z.literal("jwt_sign"),algorithm:Q.z.enum(Md).nullish(),expires_in:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),inputs:iw.nullish(),kid:Q.z.string().nullish(),not_before:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),outputs:Q.z.object({claims:yt.nullish(),header:yt.nullish(),token:yt.nullish()}).partial().nullish(),static_claims:Q.z.record(Q.z.string(),Q.z.string()).nullish(),typ:Q.z.string().nullish()}).strict(),f2=Fn.safeExtend({type:Q.z.literal("jwt_verify"),allowed_algorithms:Q.z.array(Q.z.enum(Md)).nullish(),audiences:Q.z.array(Q.z.string()).nullish(),inputs:aw.nullish(),issuers:Q.z.array(Q.z.string()).nullish(),leeway:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),outputs:Q.z.object({claims:yt.nullish(),header:yt.nullish()}).partial().nullish(),required_claims:Q.z.array(Q.z.string()).nullish(),validate_exp:Q.z.boolean().nullish(),validate_nbf:Q.z.boolean().nullish()}).strict(),p2=Fn.safeExtend({type:Q.z.literal("branch"),then:Q.z.array(Zf).nullish(),else:Q.z.array(Zf).nullish()}).strict(),m2=t2.pipe(Q.z.discriminatedUnion("type",[n2,r2,o2,i2,a2,u2,d2,f2,s2,l2,c2,p2])),h2=Q.z.record(Q.z.string(),Q.z.string()),g2=Q.z.object({dictionary_name:Q.z.string().nullish()}),y2=Q.z.object(),_2=Q.z.object({strategy:Q.z.enum(["memory","redis"]).nullish(),memory:g2.nullish(),redis:y2.nullish()}),b2=Q.z.object({vault:h2.nullish(),cache:_2.nullish()}),sw=Q.z.object({nodes:Q.z.array(m2).nullish(),debug:Q.z.boolean().nullish(),resources:b2.nullish()}).strict().superRefine((n,t)=>{!n||!Array.isArray(n.nodes)||Yb(n,ei,t)}).nullish(),lw=e.defineComponent({__name:"InputsRecordField",props:{name:{},items:{},nodeType:{}},emits:["change:inputs"],setup(n){const{getSchema:t}=ft(),{i18n:r}=Je(),o=e.computed(()=>{const i=t("inputs");if(!i)return[];const a=i.fields.map(c=>Object.keys(c)[0]);if(pn(n.nodeType))return a;const s=e2(n.nodeType);return s===null?a:s.length===0?[]:Pv(a,s)});return(i,a)=>(e.openBlock(),e.createBlock(Ft,{"as-child":"",name:n.name,"reset-label-path":"isolate"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,s=>(e.openBlock(),e.createBlock(Dt,{key:s,clearable:"","enable-filtering":"",items:n.items,name:s,placeholder:e.unref(r).t("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c=>i.$emit("change:inputs",s,c?c.value:null)},e.createSlots({_:2},[i.$slots["item-label"]?{name:"item-label",fn:e.withCtx(c=>[e.renderSlot(i.$slots,"item-label",e.mergeProps({ref_for:!0},c))]),key:"0"}:void 0]),1032,["items","name","placeholder","onChange"]))),128))]),_:3},8,["name"]))}}),w2=["data-testid"],k2={class:"dk-inputs-map-field-entry-body"},C2={class:"dk-inputs-map-field-entry-content"},E2=Me(e.defineComponent({__name:"InputsMapField",props:{name:{},items:{},fieldNameValidator:{},keyOrder:{}},emits:["change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l,field:u}=df(e.toRef(r,"name")),{value:p}=Gt(e.toRef(r,"name")),{i18n:{t:d}}=Je(),f=e.useTemplateRef("root"),m=e.ref(null),g=e.ref({}),y=e.ref({});let b;const _=e.computed(()=>{var x;return(x=r.keyOrder)!=null&&x.length?[...i.value].sort((O,P)=>{const R=r.keyOrder.indexOf(O[1]),W=r.keyOrder.indexOf(P[1]);return(R===-1?1/0:R)-(W===-1?1/0:W)}):i.value});async function k(x,O="key"){var P;f.value&&(await e.nextTick(),(P=f.value.querySelector(`[data-${O}-input="${x}"]`))==null||P.focus())}function C(){const x=a();if(!x)return;y.value[x]="";const O=_.value.findIndex(([,P])=>!P);k(O===-1?_.value.length-1:O),m.value=x}function N(x,O){s(x),delete y.value[x],delete g.value[x],x===m.value&&(m.value=null),O.trim()!==""&&o("remove:field",O)}function E(x){b=y.value[x]??l(x)??""}function w(x,O){const P=O.trim();y.value[x]=P,I(x,P)}function S(x){var P;const O=y.value[x]??l(x)??"";if(I(x,O)){y.value[x]=b,c(x,b),delete g.value[x];return}if(x===m.value){if(O.trim()==="")return;c(x,O),o("add:field",O,((P=p==null?void 0:p.value)==null?void 0:P[x])??null),m.value=null}else c(x,O),o("rename:field",b,O);delete g.value[x],b=O}function I(x,O){delete g.value[x];const P=r.fieldNameValidator("input",b,O);if(P)return g.value[x]=P,P}function j(x){I(x,y.value[x]??l(x)??"")}function A(x,O){if(p!=null&&p.value&&(p.value[x]=O),x===m.value)return;const P=l(x);P&&o("change:inputs",P,O)}return e.watch(i,x=>{const O=new Set(x.map(([P])=>P));Object.keys(y.value).forEach(P=>{O.has(P)?y.value[P]=y.value[P]??l(P)??"":(delete y.value[P],delete g.value[P])}),x.forEach(([P,R])=>{y.value[P]=y.value[P]??R}),m.value&&!O.has(m.value)&&(m.value=null)},{immediate:!0}),e.watch(()=>r.keyOrder,()=>{if(!m.value)return;const x=_.value.findIndex(([O])=>O===m.value);x!==-1&&k(x)}),(x,O)=>{const P=e.resolveComponent("KAlert"),R=e.resolveComponent("KLabel"),W=e.resolveComponent("KInput"),Z=e.resolveComponent("KSelect"),X=e.resolveComponent("KButton");return e.unref(u).error?(e.openBlock(),e.createBlock(P,{key:0,appearance:"danger",message:e.unref(u).error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:f,class:"dk-inputs-map-field"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,([F,J],$)=>{var q;return e.openBlock(),e.createElementBlock("div",{key:F,class:"dk-inputs-map-field-entry","data-testid":`ff-kv-container-${e.unref(u).path.value}.${$}`},[e.createVNode(R,{for:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.label")),1)]),_:1},8,["for"]),e.createElementVNode("div",k2,[e.createElementVNode("div",C2,[e.createVNode(W,{id:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`,class:"ff-kv-field-entry-key","data-key-input":$,"data-testid":`ff-key-${e.unref(u).path.value}.${$}`,error:!!g.value[F],"error-message":g.value[F],"model-value":y.value[F]??J,placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.placeholder"),onBlur:K=>j(F),onChange:K=>S(F),onFocus:K=>E(F),"onUpdate:modelValue":K=>w(F,K)},null,8,["id","data-key-input","data-testid","error","error-message","model-value","placeholder","onBlur","onChange","onFocus","onUpdate:modelValue"]),e.createVNode(Z,{class:"ff-kv-field-entry-value",clearable:"","data-testid":`ff-value-${e.unref(u).path.value}.${$}`,"enable-filtering":"",items:n.items,label:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.source"),"model-value":(q=e.unref(p))==null?void 0:q[F],placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:K=>A(F,(K==null?void 0:K.value)??null)},e.createSlots({_:2},[x.$slots["item-label"]?{name:"item-template",fn:e.withCtx(({item:K})=>[e.renderSlot(x.$slots,"item-label",e.mergeProps({ref_for:!0},K),void 0,!0)]),key:"0"}:void 0]),1032,["data-testid","items","label","model-value","placeholder","onChange"])]),e.createVNode(X,{appearance:"tertiary",class:"dk-inputs-map-field-remove-btn","data-testid":`ff-kv-remove-btn-${e.unref(u).path.value}.${$}`,icon:"",onClick:K=>N(F,J)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.CloseIcon))]),_:1},8,["data-testid","onClick"])])],8,w2)}),128)),e.createVNode(X,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${e.unref(u).path.value}`,disabled:!!m.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-43dcb370"]]),N2={class:"dk-source-item"},lc=Me(e.defineComponent({__name:"SourceItem",props:{item:{}},setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock("span",N2,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(jd)(n.item.type).icon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["color","size"])),e.createTextVNode(" "+e.toDisplayString(n.item.label),1)]))}}),[["__scopeId","data-v-d9aa16eb"]]),S2={key:1,class:"dk-inputs-field-or"},vn=Me(e.defineComponent({__name:"InputsField",props:{items:{},fieldNames:{},fieldNameValidator:{},nodeType:{}},emits:["change:input","change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=t,{getSchema:o}=ft(),{i18n:{t:i}}=Je(),a=e.computed(()=>o("inputs")),s=e.computed(()=>a.value?a.value.type==="record"?lw:E2:null);function c(f){r("change:input",f?f.value:null)}function l(f,m){r("add:field",f,m)}function u(f,m){r("change:inputs",f,m)}function p(f){r("remove:field",f)}function d(f,m){r("rename:field",f,m)}return(f,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(Fe.KLabel),{class:"dk-inputs-field-h1",info:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.tooltip")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.label")),1)]),_:1},8,["info"]),e.unref(o)("input")?(e.openBlock(),e.createBlock(Dt,{key:0,class:"dk-inputs-field-h2",clearable:"","enable-filtering":"",items:n.items,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.input"),"label-attributes":{info:void 0},name:"input",placeholder:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c},{"item-label":e.withCtx(g=>[e.renderSlot(f.$slots,"item-label",e.normalizeProps(e.guardReactiveProps(g)),()=>[e.createVNode(lc,{item:g},null,8,["item"])],!0)]),_:3},8,["items","label","placeholder"])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",S2,[e.createElementVNode("span",null,e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.or")),1)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(Fe.KLabel),{key:2,class:"dk-inputs-field-h2 dk-margin-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.fields")),1)]),_:1})):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(s),e.mergeProps({key:3,items:n.items,"key-order":n.fieldNames,name:"inputs"},s.value===lw?{nodeType:n.nodeType}:{fieldNameValidator:n.fieldNameValidator},{"onAdd:field":l,"onChange:inputs":u,"onRemove:field":p,"onRename:field":d}),{"item-label":e.withCtx(g=>[e.createVNode(lc,{item:g},null,8,["item"])]),_:1},16,["items","key-order"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-4f1ce4e7"]]),x2={},A2={class:"dk-node-form-divider"};function v2(n,t){return e.openBlock(),e.createElementBlock("hr",A2)}const Qn=Me(x2,[["render",v2],["__scopeId","data-v-35ed58be"]]),I2={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{query:{description:"HTTP request query",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"},B2={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"};function T2(n){const t=Number(n);return!isNaN(t)&&isFinite(t)}function gn(...n){return function(r){for(const o of n){const i=o(r);if(i)return i}}}function vo(n){const{i18n:{t}}=Je(),r=()=>n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_empty",n):"Field is required";return function(i){if(i==null||typeof i=="string"&&i.trim()==="")return r()}}function cw(n,t){const{i18n:{t:r}}=Je();return function(i){if(i!=null)switch(n){case"identifier":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_identifier_format",t):"Invalid identifier format";return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(i)?void 0:a()}case"url":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_url_format"):"Invalid URL format";try{new URL(i);return}catch{return a()}}default:return}}}function Or(n=0,t=1/0,r){const{i18n:{t:o}}=Je();return function(a){if(a!=null&&typeof a=="string"&&(a.length<n||a.length>t))return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.string_len_range",{fieldName:r.fieldName,minLength:n,maxLength:t}):`Value must be between ${n} and ${t} characters`}}function uw(n){const{i18n:{t}}=Je();return function(o){if(!T2(o))return n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_number",n):"Value must be a number"}}function vi(n,t){const{i18n:{t:r}}=Je();return function(i){if(i==null)return;const a=uw(t)(i);if(a)return a;const s=Number(i);switch(n){case"float":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_float",t):"Invalid float format";return Number.isFinite(s)?void 0:c()}case"integer":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_integer",t):"Invalid integer format";return Number.isInteger(s)?void 0:c()}default:return}}}function Ii(n=-1/0,t=1/0,r){const{i18n:{t:o}}=Je();return function(a){if(a==null)return;const s=uw(r)(a);if(s)return s;const c=Number(a);if(c<n||c>t)return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.number_range",{fieldName:r.fieldName,min:n,max:t}):`Value must be between ${n} and ${t}`}}function O2(n,t){const{state:r}=Pt(),{i18n:{t:o}}=Je();return function(a){if(r.value.nodes.some(s=>s.name===a&&s.id!==n))return t?typeof t=="string"?t:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",t):"Name must be unique."}}function P2(n,t,r){const{i18n:{t:o}}=Je();return function(a){if(!t)return;if(r?t.fields[n].some(c=>c.name===a&&c.id!==r):t.fields[n].some(c=>c.name===a)){const c=o(n==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name");return o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",{fieldName:c})}}}function V2(){const{i18n:{t:n}}=Je();return function(r){if(Kd(r))return n("plugins.free-form.datakit.flow_editor.node_properties.errors.reserved_node_name",{nodeName:r})}}function dw(n){const{i18n:{t}}=Je(),r={fieldName:t("plugins.free-form.datakit.flow_editor.node_properties.name")};return gn(vo(r),cw("identifier",r),V2(),O2(n,r))}function $2(n){const{i18n:{t}}=Je(),{getNodeById:r}=Pt();return function(i,a,s){const c={fieldName:t(i==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name")};return gn(vo(c),P2(i,r(n),s))(a)}}function R2(n){const t=e.ref({}),r=e.computed(()=>Object.values(t.value).every(s=>!s)),o={};Object.keys(n).forEach(s=>{const c=n[s],l=d=>{const f=typeof d=="function"?d():d,m=c(f);return t.value[s]=m,m},u=()=>{t.value[s]=void 0},p=d=>(u(),l(d));o[s]={handleChange:p,handleBlur:p,validate:p,isValid:e.computed(()=>t.value[s]===void 0),error:e.computed(()=>t.value[s])}});function i(){t.value={}}function a(s){var c;for(const l of Object.keys(n)){const u=s[l],p=typeof u=="function"?u():u;(c=o[l])==null||c.validate(p)}return t.value}return{isValid:r,errorMap:t,fields:o,clearErrors:i,validate:a}}function Pr(n){const{validationConfig:t,getValidationData:r,toggleNodeValid:o}=n,{skipValidation:i}=Pt(),a=e.computed(()=>typeof t=="function"?t():t),s=e.computed(()=>R2(a.value)),c=e.computed(()=>s.value.fields),l=e.computed(()=>s.value.isValid.value);function u(){const d=r(),f=s.value.validate(d),m={};for(const g in a.value)m[g]=f[g];return m}function p(d,f){const m=()=>{const y=r(),b=c.value[d];b&&b.handleBlur(y[d])},g=()=>{f==null||f();const y=r(),b=c.value[d];b&&b.handleChange(y[d])};return e.computed(()=>{const y=c.value[d];return{validate:m,update:g,error:y?!y.isValid.value:!1,errorMessage:y?y.error.value??"":""}})}return e.onMounted(()=>{i.value?i.value=!1:u()}),e.onBeforeUnmount(async()=>{try{const d=u(),f=Object.values(d).filter(Boolean).length>0;o(!f)}catch{}}),e.watch(()=>l.value,o,{immediate:!0}),{fields:c.value,isValid:l,validateAll:u,createFieldHandler:p}}function yn(n,t){const{state:r,renameNode:o,getNodeById:i,addField:a,renameField:s,removeField:c,replaceConfig:l,disconnectEdge:u,connectEdge:p,invalidConfigNodeIds:d,commit:f,revert:m}=Pt(),{i18n:{t:g}}=Je(),y=Fy(),b=e.computed(()=>{const F=i(n);if(!F)throw new Error("Node not existed");return F}),_=e.computed(()=>{const J=r.value.edges.filter($=>$.target===n).reduce(($,q)=>{var H,oe;const K=i(q.source),ae=(H=Jr(K,"output",q.sourceField))==null?void 0:H.id,M=(oe=Jr(b.value,"input",q.targetField))==null?void 0:oe.name,v=K.id+(ae?`.${ae}`:"");return M?$.inputs={...$.inputs,[M]:v}:$.input=v,$},{});return b.value.fields.input.forEach($=>{J.inputs||(J.inputs={}),J.inputs[$.name]||(J.inputs[$.name]=null)}),{...b.value.config,...J,name:b.value.name}}),k=F=>{o(n,F??"",!0,`${n}:rename`)},C=(F,J=!0)=>{if(!t)throw new Error("getFormValue is not defined");const $=Wr(t(),["name","input","inputs"]),q=F?`update:${n}:${F}`:void 0;l(n,$,J,q)},N=(F,J)=>{const $=Yr(b.value,F,J);if(!$)throw new Error(`Field with name "${J}" not found in node "${b.value.name}"`);return $},E=(F,J,$)=>{const q=!!$;a(n,F,J,!q),q&&A(J,$)},w=(F,J,$)=>{const q=N(F,J).id;s(n,q,$)},S=(F,J)=>{const $=N(F,J).id;c(n,$)},I=e.computed(()=>r.value.edges.filter(F=>F.target===n&&!F.targetField)[0]),j=e.computed(()=>r.value.edges.filter(F=>F.target===n&&F.targetField)),A=async(F,J)=>{const $=J==null,q=N("input",F).id;if($){const me=j.value.find(le=>le.targetField===q);me&&u(me.id);return}const{nodeId:K,fieldId:ae}=Ay(J),M=N("input",F).id,v=[];I.value&&(v.push(Ba(I.value,i)),u(I.value.id,!1));const H=j.value.find(me=>me.targetField===q);H&&(v.push(Ba(H,i)),u(H.id,!1)),p({source:K,sourceField:ae,target:n,targetField:M},!1);const oe=Wd(K,ae,n,M,i),te=v[0]&&oe?v[0][1]===oe[1]:!1;if(f(),te||v.length===0)return;await y(g("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[oe],v)||m()},x=async F=>{if(F==null){I.value&&u(I.value.id);return}const $=[];for(const v of j.value)$.push(Ba(v,i)),u(v.id,!1);I.value&&u(I.value.id,!1);const{nodeId:q,fieldId:K}=Ay(F);p({source:q,sourceField:K,target:n,targetField:void 0},!1);const ae=Wd(q,K,n,void 0,i);if(f(),$.length===0)return;await y(g("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[ae],$)||m()},O=F=>{const J=[...r.value.edges,{source:F,target:n}];return Yd(Nl(J))},P=e.computed(()=>{var J,$;const F=[];for(const q of r.value.nodes)if((J=oi(q.type).io)!=null&&J.output&&q.fields.output&&q.id!==n&&!(q.type==="property"&&!$d(($=q.config)==null?void 0:$.property))&&!O(q.id)&&!(b.value.phase==="request"&&q.phase==="response")&&!(q.type==="vault"&&q.fields.output.length===0)){F.push({value:q.id,label:q.name,type:q.type});for(const ae of q.fields.output)F.push({value:`${q.id}.${ae.id}`,label:`${q.name}.${ae.name}`,type:q.type})}return F}),R=e.computed(()=>b.value.fields.input.map(F=>F.name)||[]);function W(F){d.value.delete(n),F||d.value.add(n)}const Z=$2(n);function X(F,J,$){const q=i(n);if(!q)throw new Error("Node not found when validating field name");const K=Yr(q,F,J);return Z(F,$,K==null?void 0:K.id)}return{formData:_,inputOptions:P,inputEdge:I,inputsEdges:j,inputsFieldNames:R,currentNode:b,setName:k,setConfig:C,addField:E,renameFieldByName:w,removeFieldByName:S,setInputs:A,setInput:x,nameValidator:dw(n),fieldNameValidator:X,toggleNodeValid:W}}function _n(n){const{getSchema:t}=ft();return e.computed(()=>{if(pn(n))switch(n){case"response":return B2;case"service_request":return I2}try{const o=t().fields.find(u=>ml(u,"config"));if(!o)throw new Error("Config field not found in schema.");const a=o.config.fields.find(u=>ml(u,"nodes"));if(!a)throw new Error("Nodes field not found in config schema.");const l=a.nodes.elements.subschema_definitions[n];if(!l)throw new Error(`Subschema "${n}" not found in the schema.`);return l}catch(r){throw new Error(`Failed to get subschema "${n}": ${r.message}`)}})}const Un=e.defineComponent({__name:"NameField",props:{name:{},validate:{type:Function}},emits:["update"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=Je(),a=e.ref(r.name),s=e.computed(()=>{const p=r.validate(a.value.trim());return p===void 0?"":p});let c=a.value.trim();function l(){if(s.value){a.value=c;return}o("update",a.value.trim())}function u(){c=a.value.trim()}return e.watch(()=>r.name,p=>{p!==a.value&&(a.value=p)}),(p,d)=>{const f=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(f,{"model-value":a.value,"onUpdate:modelValue":d[0]||(d[0]=m=>a.value=m),"data-1p-ignore":"",error:!!s.value,"error-message":s.value,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.name"),required:"",onChange:l,onFocus:u},null,8,["model-value","error","error-message","label"])}}}),L2=e.defineComponent({__name:"NodeFormCall",props:{nodeId:{}},setup(n){const{i18n:{t}}=Je(),r=e.useTemplateRef("form"),o=_n("call"),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>r.value.getValue()),{createFieldHandler:g}=Pr({validationConfig:{url:gn(vo({fieldName:"URL"}),cw("url",{fieldName:"URL"})),timeout:gn(vi("integer"),Ii(0,2147483646))},getValidationData:()=>({url:i.value.url,timeout:i.value.timeout}),toggleNodeValid:f}),y=g("url",()=>s("url")),b=g("timeout",()=>s("timeout"));return(_,k)=>{const C=e.resolveComponent("KLabel");return e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(C,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(tt,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"url",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(bR,{name:"method",onUpdate:k[0]||(k[0]=N=>e.unref(s)())}),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"timeout",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tt,{name:"ssl_server_name","onUpdate:modelValue":k[1]||(k[1]=N=>e.unref(s)("ssl_server_name"))}),e.createVNode(An,{name:"ssl_verify","onUpdate:modelValue":k[2]||(k[2]=N=>e.unref(s)("ssl_verify"))}),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"call","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),D2=e.defineComponent({__name:"NodeFormServiceRequest",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("service_request"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=yn(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(vn,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"service_request","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),M2=e.defineComponent({__name:"NodeFormResponse",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("response"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=yn(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(vn,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"response","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),j2=e.defineComponent({__name:"NodeFormJq",props:{nodeId:{}},setup(n){const{i18n:{t},i18nT:r}=Je(),o=e.useTemplateRef("form"),i=_n("jq"),{formData:a,setName:s,setConfig:c,inputOptions:l,setInputs:u,setInput:p,addField:d,removeFieldByName:f,renameFieldByName:m,inputsFieldNames:g,nameValidator:y,toggleNodeValid:b,fieldNameValidator:_}=yn(n.nodeId,()=>o.value.getValue());function k(I,j){d("input",I,j)}function C(I){f("input",I)}function N(I,j){m("input",I,j)}const E=t("plugins.free-form.datakit.flow_editor.node_properties.jq.label"),{createFieldHandler:w}=Pr({validationConfig:{jq:gn(vo({fieldName:E}),Or(1,10240,{fieldName:E}))},getValidationData:()=>({jq:a.value.jq}),toggleNodeValid:b}),S=w("jq",()=>c("jq"));return(I,j)=>{const A=e.resolveComponent("KLabel"),x=e.resolveComponent("KExternalLink");return e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(a),schema:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(a).name,validate:e.unref(y),onUpdate:e.unref(s)},null,8,["name","validate","onUpdate"]),e.createVNode(A,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(tt,{autosize:"",error:e.unref(S).error,"error-message":e.unref(S).errorMessage,label:e.unref(E),"label-attributes":{},multiline:"",name:"jq",resizable:"",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},{help:e.withCtx(()=>[e.createVNode(e.unref(r),{keypath:"plugins.free-form.datakit.flow_editor.node_properties.jq.help"},{link:e.withCtx(()=>[e.createVNode(x,{"hide-icon":"",href:e.unref(Ha).jqlang},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(Ha).jqlang),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["error","error-message","label","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(_),"field-names":e.unref(g),items:e.unref(l),"node-type":"jq","onAdd:field":k,"onChange:input":e.unref(p),"onChange:inputs":e.unref(u),"onRemove:field":C,"onRename:field":N},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),F2=Me(e.defineComponent({__name:"OutputValueField",props:{fieldNameValidator:{},keyOrder:{}},emits:["change:value","add:field","rename:field","remove:field"],setup(n,{emit:t}){const r=n,o=t,i=e.ref({}),{value:a,...s}=Gt("values"),{i18n:c}=Je(),l=e.useTemplateRef("root"),u=e.ref([]),p=e.ref(null);let d="",f=a==null?void 0:a.value;function m(){return hl("ff-kv-field-")}function g(A,x,O){const P=O.indexOf(A),R=O.indexOf(x);return P===-1&&R===-1?0:P===-1?1:R===-1?-1:P-R}function y(A,x){if(!A)return[];const O=Object.entries(A).map(([P,R])=>({id:m(),key:P,value:R}));return x!=null&&x.length&&O.sort((P,R)=>g(P.key,R.key,x)),O}function b(){const A={id:m(),key:"",value:""};return u.value.push(A),A}function _(A){const x=u.value.findIndex(O=>O.id===A);x!==-1&&u.value.splice(x,1)}u.value=y(a==null?void 0:a.value,r.keyOrder);async function k(A,x="key"){var O;l.value&&(await e.nextTick(),(O=l.value.querySelector(`[data-${x}-input="${A}"]`))==null||O.focus())}function C(){const A=b(),x=u.value.findIndex(({key:O})=>!O);k(x===-1?u.value.length-1:x),p.value=A}function N(A){var x;A.id===((x=p.value)==null?void 0:x.id)&&(p.value=null),_(A.id),A.key.trim()!==""&&o("remove:field",A.key)}function E(A){d=A.key}function w(A){var x;if(I(A)){A.key=d,delete i.value[A.id];return}if(A.id===((x=p.value)==null?void 0:x.id)){if(A.key.trim()==="")return;p.value=null,o("add:field",A.key,A.value)}else o("rename:field",d,A.key);d=A.key}function S(A,x){var P;if(x.id===((P=p.value)==null?void 0:P.id))return;const O=A.target.value.trim();o("change:value",x.key,O)}function I(A){delete i.value[A.id];const x=r.fieldNameValidator("output",d,A.key);if(x)return i.value[A.id]=x,x}function j(A){I(A)}return e.watch(()=>a==null?void 0:a.value,A=>{var Z;if(en(A,f))return;f=A;const x=p.value,O=new Map(u.value.filter(X=>X.key).map(X=>[X.key,X])),P=[],R=A??{};((Z=r.keyOrder)!=null&&Z.length?Object.keys(R).sort((X,F)=>g(X,F,r.keyOrder)):Object.keys(R)).forEach(X=>{const F=O.get(X);if(F){F.value=R[X],P.push(F);return}P.push({id:m(),key:X,value:R[X]})}),x&&!P.some(X=>X.id===x.id)&&P.push(x),u.value=P},{deep:!0}),(A,x)=>{const O=e.resolveComponent("KAlert"),P=e.resolveComponent("KLabel"),R=e.resolveComponent("KButton"),W=e.resolveComponent("KInput"),Z=e.resolveComponent("KCard");return s.error?(e.openBlock(),e.createBlock(O,{key:0,appearance:"danger",message:s.error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:l,class:"dk-output-value-field"},[e.createVNode(P,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.label")),1)]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(X,F)=>(e.openBlock(),e.createBlock(Z,{key:X.id,class:"dk-output-value-field-entry","data-testid":`ff-kv-container-${s.path.value}.${F}`},{actions:e.withCtx(()=>[e.createVNode(R,{appearance:"none","data-testid":`ff-kv-remove-btn-${s.path.value}.${F}`,icon:"",onClick:J=>N(X)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.CloseIcon))]),_:1},8,["data-testid","onClick"])]),default:e.withCtx(()=>[e.createVNode(W,{id:`ff-kv-entry-key-${s.path.value}.${F}`,modelValue:X.key,"onUpdate:modelValue":[J=>X.key=J,J=>I(X)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":F,"data-testid":`ff-key-${s.path.value}.${F}`,error:!!i.value[X.id],"error-message":i.value[X.id],label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name"),required:"",onBlur:J=>j(X),onChange:J=>w(X),onFocus:J=>E(X)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","label","onBlur","onChange","onFocus"]),e.createVNode(W,{modelValue:X.value,"onUpdate:modelValue":J=>X.value=J,modelModifiers:{trim:!0},class:"ff-kv-field-entry-value","data-testid":`ff-value-${s.path.value}.${F}`,label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value"),onChange:J=>S(J,X)},null,8,["modelValue","onUpdate:modelValue","data-testid","label","onChange"])]),_:2},1032,["data-testid"]))),128)),e.createVNode(R,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${s.path.value}`,disabled:!!p.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-3970c2c0"]]);function U2(n){const t={};for(const[r,o]of Object.entries(n))typeof o=="object"&&o!==null?t[r]=JSON.stringify(o):t[r]=String(o);return t}function cc(n){const t={};for(const[r,o]of Object.entries(n))if(o!=null){t[r]=o;try{o==="null"?t[r]=null:(o==="true"||o==="false"||/^-?\d+(\.\d+)?$/.test(o)||o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]"))&&(t[r]=JSON.parse(o))}catch{}}return t}function K2(n,t,r){const o={};for(const i of Object.keys(n))i===t?o[r]=n[t]:o[i]=n[i];return o}const q2=e.defineComponent({__name:"NodeFormStatic",props:{nodeId:{}},setup(n){const{renameNode:t,getOutEdgesByNodeId:r,addField:o,renameField:i,removeField:a,replaceConfig:s,getNodeById:c}=Pt(),{fieldNameValidator:l}=yn(n.nodeId),u=_n("static"),p=dw(n.nodeId),d=e.computed(()=>c(n.nodeId)),f=e.computed(()=>{var C;return((C=d.value)==null?void 0:C.fields.output.map(N=>N.name))||[]});function m(C){if(!d.value)throw new Error("No current node");t(d.value.id,C??"")}const g=e.computed(()=>{var j;if(!d.value)return{};const C=((j=d.value.config)==null?void 0:j.values)??{},N={},E=r(d.value.id).map(A=>A.sourceField).filter(Boolean).map(A=>Jr(d.value,"output",A)).map(A=>A==null?void 0:A.name).filter(Boolean),w=d.value.fields.output.map(A=>A.name),S=Object.keys(C);return new Set([...S,...E,...w]).forEach(A=>{if(A in C){N[A]=C[A];return}N[A]=""}),{name:d.value.name,values:U2(N)}});function y(C,N){if(!d.value)throw new Error("No selected node");const E=N!==void 0;if(o(n.nodeId,"output",C,!E),E){const w={values:cc({...g.value.values,[C]:N})};s(n.nodeId,w)}}function b(C,N){if(!d.value)throw new Error("No selected node");const E=Yr(d.value,"output",C);if(!E)throw new Error("No field found to rename");const w={values:cc(K2(g.value.values??{},C,N))};s(n.nodeId,w,!1),i(n.nodeId,E.id,N)}function _(C){var w;if(!d.value)throw new Error("No selected node");const N=Yr(d.value,"output",C);if(!N)throw new Error("No field found to delete");a((w=d.value)==null?void 0:w.id,N.id,!0,!1);const E={values:cc({...g.value.values})};delete E.values[C],s(n.nodeId,E)}function k(C,N){if(!d.value)throw new Error("No selected node");const E={...g.value.values};E[C]=N;const w={values:cc(E)};s(n.nodeId,w)}return(C,N)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:g.value,schema:e.unref(u)},{default:e.withCtx(()=>{var E;return[e.createVNode(Un,{name:((E=d.value)==null?void 0:E.name)??"",validate:e.unref(p),onUpdate:m},null,8,["name","validate"]),e.createVNode(F2,{"field-name-validator":e.unref(l),"key-order":f.value,"onAdd:field":y,"onChange:value":k,"onRemove:field":_,"onRename:field":b},null,8,["field-name-validator","key-order"])]}),_:1},8,["data","schema"]))}}),G2={class:"dk-kong-property-item"},H2={class:"property-type"},z2={class:"property-badges"},W2=Me(e.defineComponent({__name:"PropertiesField",props:{validators:{}},emits:["update:model-value","update:property-key"],setup(n,{emit:t}){const{i18n:{t:r}}=Je(),o=n,i=t,{formData:a}=ft(),s=e.ref(Sa(a.property)),c=e.computed(()=>xa(a.property)),l=e.ref(Vd(a.property)),u=e.computed(()=>a.property??""),p=e.computed(()=>Object.entries(go).map(([m])=>{var b;const g=xa(m)?(b=a.property)==null?void 0:b.startsWith(m.replace(Zo,"")):a.property===m;return{label:g&&l.value?m.replace(Zo,l.value):m,value:m,selected:g}}));function d(m){const g=gl.find(y=>{var b;return(b=a.property)==null?void 0:b.startsWith(y)});g&&(a.property=g+m,o.validators.key.handleChange(a.property),i("update:property-key",a.property))}function f(m){s.value!==Sa(m==null?void 0:m.value)&&(a.property=(m==null?void 0:m.value)||null,s.value=Sa(a.property),o.validators.property.handleBlur(()=>a.property),i("update:model-value",a.property))}return e.watch(()=>a.property,m=>{l.value=Vd(m),s.value=Sa(m)}),(m,g)=>{const y=e.resolveComponent("KBadge"),b=e.resolveComponent("KSelect"),_=e.resolveComponent("KInput");return e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(b,{key:u.value,"enable-filtering":"",error:!n.validators.property.isValid.value,help:n.validators.property.error.value,items:p.value,label:"Property","label-attributes":{maxWidth:"300px",placement:"top",info:"The property name to get/set"},required:"",onBlur:g[0]||(g[0]=k=>n.validators.property.handleBlur(()=>e.unref(a).property)),onChange:f},{"item-template":e.withCtx(({item:k})=>[e.createElementVNode("div",G2,[e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(k.label),1),e.createElementVNode("div",H2,e.toDisplayString(e.unref(go)[k.value].dataType),1)]),e.createElementVNode("div",z2,[e.unref(go)[k.value].readable?(e.openBlock(),e.createBlock(y,{key:0,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.get")),1)]),_:1})):e.createCommentVNode("",!0),e.unref(go)[k.value].writable?(e.openBlock(),e.createBlock(y,{key:1,appearance:"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.set")),1)]),_:1})):e.createCommentVNode("",!0)])])]),_:1},8,["error","help","items"])),c.value?(e.openBlock(),e.createBlock(_,{key:0,"model-value":l.value,"onUpdate:modelValue":[g[1]||(g[1]=k=>l.value=k),d],error:!n.validators.key.isValid.value,"error-message":n.validators.key.error.value,label:"key",required:"",onBlur:g[2]||(g[2]=k=>n.validators.key.handleBlur(()=>e.unref(a).property))},null,8,["model-value","error","error-message"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-3e7fee25"]]),Y2=e.defineComponent({__name:"NodeFormProperty",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),{selectedNode:r,disconnectInEdges:o,disconnectOutEdges:i}=Pt(),a=_n("property"),{formData:s,setName:c,setConfig:l,inputOptions:u,setInputs:p,setInput:d,inputsFieldNames:f,nameValidator:m,toggleNodeValid:g,fieldNameValidator:y}=yn(n.nodeId,()=>t.value.getValue()),b=e.computed(()=>Rd(s.value.property));function _(C){var E;const N=(E=r.value)==null?void 0:E.id;if(!N)throw new Error("Expected selectedNode to be defined");$d(C)||i(N,!1),Rd(C)||o(N,!1),l()}const{fields:k}=Pr({validationConfig:()=>({property:vo({fieldName:"Property"}),key:xa(s.value.property)?vo({fieldName:"Key"}):()=>{}}),getValidationData:()=>({property:s.value.property,key:Vd(s.value.property)}),toggleNodeValid:g});return(C,N)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(s),schema:e.unref(a)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(s).name,validate:e.unref(m),onUpdate:e.unref(c)},null,8,["name","validate","onUpdate"]),e.createVNode(Dt,{name:"content_type",onUpdate:N[0]||(N[0]=E=>e.unref(l)())}),e.createVNode(W2,{validators:e.unref(k),"onUpdate:modelValue":_,"onUpdate:propertyKey":N[1]||(N[1]=E=>e.unref(l)("property-key"))},null,8,["validators"]),b.value?(e.openBlock(),e.createBlock(Qn,{key:0})):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createBlock(vn,{key:1,"field-name-validator":e.unref(y),"field-names":e.unref(f),items:e.unref(u),"node-type":"property","onChange:input":e.unref(d),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])):e.createCommentVNode("",!0)]),_:1},8,["data","schema"]))}}),J2=e.defineComponent({__name:"NodeFormExit",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("exit"),{formData:o,setName:i,setConfig:a,inputOptions:s,setInputs:c,setInput:l,inputsFieldNames:u,nameValidator:p,toggleNodeValid:d,fieldNameValidator:f}=yn(n.nodeId,()=>t.value.getValue()),{createFieldHandler:m}=Pr({validationConfig:{status:gn(vi("integer",{fieldName:"Status"}),Ii(200,599,{fieldName:"Status"}))},getValidationData:()=>({status:o.value.status}),toggleNodeValid:d}),g=m("status",()=>a("status"));return(y,b)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(o).name,validate:e.unref(p),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(Ht,{error:e.unref(g).error,"error-message":e.unref(g).errorMessage,name:"status",onBlur:e.unref(g).validate,"onUpdate:modelValue":e.unref(g).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(An,{name:"warn_headers_sent","onUpdate:modelValue":b[0]||(b[0]=_=>e.unref(a)())}),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(f),"field-names":e.unref(u),items:e.unref(s),"node-type":"exit","onChange:input":e.unref(l),"onChange:inputs":e.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}});function X2(n){const t=yn(n),{state:r,getNodeById:o,branchGroups:i,commit:a}=Pt(),{i18n:{t:s}}=Je(),c=Fy(),l=Dd(),u=e.computed(()=>{var C;const _={...t.formData.value},k=Ia(((C=t.currentNode.value)==null?void 0:C.type)||"branch");for(const N of k)(!(N in _)||_[N]==null)&&(_[N]=[]);return _});function p(_,k,C){const N=o(_),E=o(C),w=N?`${N.name}.${k}`:`${_}.${k}`,S=E?E.name:C;return[w,S]}function d(_){return(_==null?[]:Array.isArray(_)?_:[_]).filter(k=>qd(k))}function f(_,k){return i.wouldCreateCycle(_,k)?(l({message:s("plugins.free-form.datakit.flow_editor.error.branch_cycle"),appearance:"danger"}),!0):!1}function m(_,k,C){const N=[],E=[],w=[];for(const S of C){const I=i.findMembership(S);if(!I||I.ownerId===_&&I.branch===k)continue;const j=i.getMembers(I.ownerId,I.branch).filter(A=>A!==S);w.push({ownerId:I.ownerId,branch:I.branch,members:j}),N.push(p(_,k,S)),E.push(p(I.ownerId,I.branch,S))}return{conflictUpdates:w,addedAssignments:N,removedAssignments:E}}function g(_,k,C,N){let E=!1;for(const w of N)E=i.setMembers(w.ownerId,w.branch,w.members,{commit:!1})||E;return E=i.setMembers(_,k,C,{commit:!1})||E,E}async function y(_,k){const C=t.currentNode.value,N=d(k),E=i.prepareMembers(C.id,_,N),w=i.getMembers(C.id,_);if(Gd(w,E))return!0;const S=E.filter(O=>!w.includes(O));for(const O of S)if(f(C.id,O))return!1;const{conflictUpdates:I,addedAssignments:j,removedAssignments:A}=m(C.id,_,S);return I.length>0&&!await c(s("plugins.free-form.datakit.flow_editor.confirm.message.branch_replace"),j,A)?!1:(g(C.id,_,E,I)&&a(),!0)}const b=e.computed(()=>{const _=t.currentNode.value;return!_||!i?[]:r.value.nodes.filter(k=>k.id!==n&&!pn(k.type)&&k.phase===_.phase&&!i.wouldCreateCycle(_.id,k.id)).map(k=>({value:k.id,label:k.name,type:k.type}))});return{...t,formData:u,branchOptions:b,updateBranchMembers:y}}const Z2=e.defineComponent({__name:"NodeFormBranch",props:{nodeId:{}},setup(n){const{i18n:{t}}=Je(),r=_n("branch"),o=e.ref(0),{formData:i,setName:a,inputOptions:s,branchOptions:c,nameValidator:l,setInput:u,setInputs:p,inputsFieldNames:d,fieldNameValidator:f,updateBranchMembers:m}=X2(n.nodeId);async function g(y,b){await m(y,b)||(o.value+=1)}return(y,b)=>(e.openBlock(),e.createBlock(Jt,{key:o.value,data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(l),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"then",onUpdate:b[0]||(b[0]=_=>g("then",_))},{"item-label":e.withCtx(_=>[e.createVNode(lc,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"else",onUpdate:b[1]||(b[1]=_=>g("else",_))},{"item-label":e.withCtx(_=>[e.createVNode(lc,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(f),"field-names":e.unref(d),items:e.unref(s),"node-type":"branch","onChange:input":e.unref(u),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),Q2=e.defineComponent({__name:"NodeFormCache",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("cache"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>t.value.getValue()),{createFieldHandler:g}=Pr({validationConfig:()=>({ttl:gn(vi("integer",{fieldName:"TTL"}),Ii(1,1/0,{fieldName:"TTL"}))}),getValidationData:()=>({ttl:i.value.ttl}),toggleNodeValid:f}),y=g("ttl",()=>s("ttl"));return(b,_)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(An,{name:"bypass_on_error","onUpdate:modelValue":_[0]||(_[0]=k=>e.unref(s)("bypass_on_error"))}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"ttl",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"cache","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),eL=e.defineComponent({__name:"NodeFormXmlToJson",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("xml_to_json"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>t.value.getValue()),g=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),y=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:b}=Pr({validationConfig:()=>({attributes_block_name:gn(()=>y()?void 0:g,I=>{if(I)return Or(1,32,{fieldName:"Attributes block name"})(I)}),attributes_name_prefix:gn(()=>y()?void 0:g,I=>{if(I)return Or(1,32,{fieldName:"Attributes name prefix"})(I)}),text_block_name:Or(1,32,{fieldName:"Text block name"}),xpath:Or(1,256,{fieldName:"XPath"})}),getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,text_block_name:i.value.text_block_name,xpath:i.value.xpath}),toggleNodeValid:f}),_=b("attributes_block_name",()=>s("attributes_block_name")),k=b("attributes_name_prefix",()=>s("attributes_name_prefix")),C=b("text_block_name",()=>s("text_block_name")),N=b("xpath",()=>s("xpath")),E=()=>{_.value.validate(),k.value.validate()},w=()=>{_.value.update(),k.value.validate()},S=()=>{k.value.update(),_.value.validate()};return(I,j)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(An,{name:"recognize_type","onUpdate:modelValue":j[0]||(j[0]=A=>e.unref(s)("recognize_type"))}),e.createVNode(tt,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"attributes_block_name",onBlur:E,"onUpdate:modelValue":w},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(k).error,"error-message":e.unref(k).errorMessage,name:"attributes_name_prefix",onBlur:E,"onUpdate:modelValue":S},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(C).error,"error-message":e.unref(C).errorMessage,name:"text_block_name",onBlur:e.unref(C).validate,"onUpdate:modelValue":e.unref(C).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(An,{name:"text_as_property","onUpdate:modelValue":j[1]||(j[1]=A=>e.unref(s)("text_as_property"))}),e.createVNode(tt,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"xpath",onBlur:e.unref(N).validate,"onUpdate:modelValue":e.unref(N).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"xml_to_json","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),tL=e.defineComponent({__name:"NodeFormJsonToXml",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("json_to_xml"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,addField:p,removeFieldByName:d,renameFieldByName:f,inputsFieldNames:m,nameValidator:g,toggleNodeValid:y,fieldNameValidator:b}=yn(n.nodeId,()=>t.value.getValue()),_=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),k=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:C}=Pr({validationConfig:{attributes_block_name:gn(()=>k()?void 0:_,Or(1,32,{fieldName:"Attributes block name"})),attributes_name_prefix:gn(()=>k()?void 0:_,Or(1,32,{fieldName:"Attributes name prefix"})),root_element_name:Or(1,64,{fieldName:"Root element name"}),text_block_name:Or(1,32,{fieldName:"Text block name"})},getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,root_element_name:i.value.root_element_name,text_block_name:i.value.text_block_name}),toggleNodeValid:y}),N=C("attributes_block_name",()=>s("attributes_block_name")),E=C("attributes_name_prefix",()=>s("attributes_name_prefix")),w=C("root_element_name",()=>s("root_element_name")),S=C("text_block_name",()=>s("text_block_name"));function I(){N.value.validate(),E.value.validate()}function j(){N.value.update(),E.value.validate()}function A(){E.value.update(),N.value.validate()}function x(R,W){p("input",R,W)}function O(R){d("input",R)}function P(R,W){f("input",R,W)}return(R,W)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(g),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(tt,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"attributes_block_name",onBlur:I,"onUpdate:modelValue":j},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(E).error,"error-message":e.unref(E).errorMessage,name:"attributes_name_prefix",onBlur:I,"onUpdate:modelValue":A},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(w).error,"error-message":e.unref(w).errorMessage,name:"root_element_name",onBlur:e.unref(w).validate,"onUpdate:modelValue":e.unref(w).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tt,{error:e.unref(S).error,"error-message":e.unref(S).errorMessage,name:"text_block_name",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(b),"field-names":e.unref(m),items:e.unref(c),"node-type":"json_to_xml","onAdd:field":x,"onChange:input":e.unref(u),"onChange:inputs":e.unref(l),"onRemove:field":O,"onRename:field":P},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),nL=e.defineComponent({__name:"NodeFormJwtDecode",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("jwt_decode"),{formData:o,setName:i,inputOptions:a,setInputs:s,setInput:c,inputsFieldNames:l,nameValidator:u,fieldNameValidator:p}=yn(n.nodeId,()=>t.value.getValue());return(d,f)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(o).name,validate:e.unref(u),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(p),"field-names":e.unref(l),items:e.unref(a),"node-type":"jwt_decode","onChange:input":e.unref(c),"onChange:inputs":e.unref(s)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),rL=e.defineComponent({__name:"NodeFormJwtSign",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("jwt_sign"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>{const k={...t.value.getValue()};return(!k.static_claims||Object.keys(k.static_claims).length===0)&&delete k.static_claims,k}),{createFieldHandler:g}=Pr({validationConfig:{algorithm:vo({fieldName:"Algorithm"}),expires_in:gn(vi("integer",{fieldName:"Expires in"}),Ii(1,1/0,{fieldName:"Expires in"})),not_before:gn(vi("integer",{fieldName:"Not before"}),Ii(0,1/0,{fieldName:"Not before"}))},getValidationData:()=>({algorithm:i.value.algorithm,expires_in:i.value.expires_in,not_before:i.value.not_before}),toggleNodeValid:f}),y=g("algorithm",()=>s("algorithm")),b=g("expires_in",()=>s("expires_in")),_=g("not_before",()=>s("not_before"));return(k,C)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",name:"algorithm",onUpdate:e.unref(y).update},null,8,["onUpdate"]),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"expires_in",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Ht,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"not_before",onBlur:e.unref(_).validate,"onUpdate:modelValue":e.unref(_).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tt,{name:"kid","onUpdate:modelValue":C[0]||(C[0]=N=>e.unref(s)("kid"))}),e.createVNode(tt,{name:"typ","onUpdate:modelValue":C[1]||(C[1]=N=>e.unref(s)("typ"))}),e.createVNode(fr,{label:e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.jwt.static_claims.label"),name:"static_claims",onLegacyValueChange:C[2]||(C[2]=N=>e.unref(s)("static_claims"))},null,8,["label"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_sign","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),oL=e.defineComponent({__name:"NodeFormJwtVerify",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("jwt_verify"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>t.value.getValue()),{createFieldHandler:g}=Pr({validationConfig:{leeway:gn(vi("integer",{fieldName:"Leeway"}),Ii(0,1/0,{fieldName:"Leeway"}))},getValidationData:()=>({leeway:i.value.leeway}),toggleNodeValid:f}),y=g("leeway",()=>s("leeway"));return(b,_)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",multiple:"",name:"allowed_algorithms",onUpdate:_[0]||(_[0]=k=>e.unref(s)("allowed_algorithms"))}),e.createVNode(dr,{name:"issuers",onAdd:_[2]||(_[2]=k=>e.unref(s)("issuers")),onRemove:_[3]||(_[3]=k=>e.unref(s)("issuers"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(tt,{autofocus:C,name:k,"onUpdate:modelValue":_[1]||(_[1]=N=>e.unref(s)("issuers"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(dr,{name:"audiences",onAdd:_[5]||(_[5]=k=>e.unref(s)("audiences")),onRemove:_[6]||(_[6]=k=>e.unref(s)("audiences"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(tt,{autofocus:C,name:k,"onUpdate:modelValue":_[4]||(_[4]=N=>e.unref(s)("audiences"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(dr,{name:"required_claims",onAdd:_[8]||(_[8]=k=>e.unref(s)("required_claims")),onRemove:_[9]||(_[9]=k=>e.unref(s)("required_claims"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(tt,{autofocus:C,name:k,"onUpdate:modelValue":_[7]||(_[7]=N=>e.unref(s)("required_claims"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"leeway",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(An,{name:"validate_exp","onUpdate:modelValue":_[10]||(_[10]=k=>e.unref(s)("validate_exp"))}),e.createVNode(An,{name:"validate_nbf","onUpdate:modelValue":_[11]||(_[11]=k=>e.unref(s)("validate_nbf"))}),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_verify","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),iL=["innerHTML"],aL={key:1,class:"branch-note"},sL={class:"branch-label"},lL={class:"branch-text"},cL=e.defineComponent({__name:"NodePropertiesPanel",props:{maxWidth:{default:`${Mh}px`},offsetTop:{default:`${b1}px`},visible:{type:Boolean},nodeId:{}},emits:["close"],setup(n){const{t}=jt.createI18n("en-us",Yt),{getNodeById:r,branchGroups:o}=Pt(),i=e.computed(()=>n.nodeId&&r(n.nodeId)),a=e.computed(()=>{if(n.nodeId)return o.findMembership(n.nodeId)}),s=e.computed(()=>{if(!a.value)return"";const u=r(a.value.ownerId);return u?`${u.name}.${a.value.branch}`:""});function c(){n.nodeId&&o.removeMember(n.nodeId)}const l=e.computed(()=>{var u;switch((u=i.value)==null?void 0:u.type){case"call":return L2;case"service_request":return D2;case"response":return M2;case"jq":return j2;case"static":return q2;case"property":return Y2;case"exit":return J2;case"branch":return Z2;case"cache":return Q2;case"xml_to_json":return eL;case"json_to_xml":return tL;case"jwt_decode":return nL;case"jwt_sign":return rL;case"jwt_verify":return oL;default:return null}});return(u,p)=>(e.openBlock(),e.createBlock(e.unref(Fe.KSlideout),{class:"dk-node-properties-panel","close-on-blur":!1,"has-overlay":!1,"max-width":n.maxWidth,"offset-top":n.offsetTop,visible:n.visible,"z-index":e.unref(_1),onClose:p[0]||(p[0]=d=>u.$emit("close"))},e.createSlots({default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dk-node-properties-panel-desc",innerHTML:e.unref(ni)(i.value.type)},null,8,iL)):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("div",aL,[e.createElementVNode("span",sL,[e.createVNode(e.unref(Re.ArrowSplitIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["color","size"]),e.createElementVNode("span",lL,e.toDisplayString(s.value),1)]),e.createVNode(e.unref(Fe.KTooltip),{placement:"top",text:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none","aria-label":e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch"),class:"remove-branch",icon:"",size:"small",onClick:c},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.TrashIcon))]),_:1},8,["aria-label"])]),_:1},8,["text"])])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createBlock(e.unref(l),{key:n.nodeId,class:"dk-node-properties-panel-form","node-id":n.nodeId},null,8,["node-id"])):e.createCommentVNode("",!0)]),_:2},[i.value?{name:"title",fn:e.withCtx(()=>[e.createVNode(Qd,{type:i.value.type},null,8,["type"])]),key:"0"}:void 0]),1032,["max-width","offset-top","visible","z-index"]))}}),uL=Me(cL,[["__scopeId","data-v-32602117"]]),dL={class:"dk-editor-content"},fL={class:"main"},pL=Me(e.defineComponent({__name:"EditorContent",setup(n){const{propertiesPanelOpen:t,selectedNode:r}=Pt();function o(){t.value=!1}e.watch(r,a=>{a||o()});const i=e.ref(!1);return e.onMounted(()=>{i.value=!0}),(a,s)=>{var c;return e.openBlock(),e.createElementBlock("div",dL,[e.createVNode(e.unref(_R)),e.createElementVNode("div",fL,[e.createVNode(v$)]),e.createVNode(uL,{"node-id":(c=e.unref(r))==null?void 0:c.id,visible:e.unref(t),onClose:o},null,8,["node-id","visible"])])}}}),[["__scopeId","data-v-66331c5c"]]),mL={key:0,class:"dk-editor-modal"},hL=Me(e.defineComponent({__name:"EditorModal",props:{open:{type:Boolean},openModifiers:{}},emits:["update:open"],setup(n){e.useCssVars(c=>({v0a30a280:`${e.unref(y1)}px`,aee7cc1c:`${e.unref(Dh)}px`}));const t=e.useModel(n,"open"),r=e.ref(!1),o=e.useTemplateRef("confirm-modal"),{clear:i}=Pt();tB(async(...c)=>{r.value=!0;const l=await o.value.open(...c);return r.value=!1,l});const a=Tt.useScrollLock(document);e.watch(t,c=>{a.value=!!c,c||i()},{immediate:!0});function s(){t.value=!1}return(c,l)=>t.value?(e.openBlock(),e.createElementBlock("div",mL,[e.createVNode(C$,{class:"nav",onBack:s}),e.createVNode(pL,{ref:"content",class:"content",tabindex:"0"},null,512),e.createVNode(_$,{ref:"confirm-modal"},null,512)])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-82b03578"]]),gL={class:"dk-flow-editor"},yL={class:"flow-panels-container"},_L={class:"overlay"},bL=Me(e.defineComponent({__name:"FlowEditor",props:{isEditing:{type:Boolean}},emits:["change","error"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Yt),{formData:o,setValue:i,getValue:a}=ft(),s=t;function c(p,d,f,m){const g={...o.config,nodes:p};f!==void 0&&(g.resources=f);const y={...o.__ui_data,...d},b={...o,config:g,__ui_data:y};m!=null?b.partials=[{id:m}]:b.partials&&(b.partials=null),i(b),s("change",g,y)}const{modalOpen:l,setPendingFitView:u}=Xd(a(),{onChange:c,isEditing:n.isEditing});return e.watch(l,()=>{u(!0)},{flush:"post"}),u$({enabled:l}),(p,d)=>{const f=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",gL,[e.createElementVNode("div",yL,[e.createVNode(Yf,{inactive:e.unref(l),mode:"preview"},null,8,["inactive"]),e.createElementVNode("div",_L,[e.createVNode(f,{appearance:"secondary",class:"button-open-editor",onClick:d[0]||(d[0]=m=>l.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.cta"))+" ",1),e.createVNode(e.unref(Re.ExpandIcon))]),_:1})])]),e.createVNode(hL,{open:e.unref(l),"onUpdate:open":d[1]||(d[1]=m=>e.isRef(l)?l.value=m:null)},null,8,["open"])])}}}),[["__scopeId","data-v-575018ff"]]),wL=["innerHTML"],kL={class:"dk-option-label"},CL=["innerHTML"],EL=it({component:Me(e.defineComponent({inheritAttrs:!1,__name:"DatakitForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const{t}=jt.createI18n("en-us",Yt),r=n,o=e.useAttrs(),i=e.inject(Ze.FORMS_CONFIG),a=e.ref(!1);e.onMounted(()=>{a.value=!!document.querySelector("#plugin-form-page-actions")});const{editorMode:s}=ac(),c=e.computed(()=>i.app!=="konnect"||p.value===!1?"code":s.value),l=e.computed(()=>i.app==="kongManager"?"code":c.value==="flow"?"form":"code"),u={flow:Re.DesignIcon,code:Re.CodeblockIcon},p=e.ref(!0),d=e.ref(""),f=e.computed(()=>{const E=[{label:t("plugins.free-form.datakit.flow_editor.mode"),value:"flow"},{label:t("plugins.free-form.datakit.code_editor.mode"),value:"code"}];return E[0].disabled=!p.value,E}),m=e.computed(()=>{switch(c.value){case"code":return t("plugins.free-form.datakit.description_code");case"flow":return t("plugins.free-form.datakit.description_flow");default:return""}}),g=e.computed(()=>p.value?"":t("plugins.free-form.datakit.flow_editor.disabled_tooltip",{reason:d.value,code:E=>`<code>${xv(E)}</code>`}));e.watch(c,()=>{var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})});function y(){var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})}function b(){y()}function _(E){return E.map(w=>typeof w=="number"?`[${w}]`:E.length&&typeof w=="string"&&w.includes(".")?`["${w}"]`:`.${w}`).join("").replace(/^\./,"")}function k(E){return E.issues.map(w=>`${_(w.path)} - ${w.message}`).join("; ")}function C(E){if(y(),i.app!=="konnect")return;const w=E==null?void 0:E.config,{success:S,error:I}=sw.safeParse(w);d.value=S||!I?"":k(I),p.value=S}function N(E){var w;d.value=E,p.value=!1,(w=r.onValidityChange)==null||w.call(r,{model:"config",valid:!1,error:E})}return(E,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i).app==="konnect"?(e.openBlock(),e.createBlock(e.Teleport,{key:0,disabled:!a.value,to:"#plugin-form-page-actions"},[e.createVNode(e.unref(Fe.KSegmentedControl),{"data-testid":"datakit-editor-mode-switcher","model-value":c.value,options:f.value,"onUpdate:modelValue":w[0]||(w[0]=S=>s.value=S)},{"option-label":e.withCtx(({option:S})=>[e.createVNode(e.unref(Fe.KTooltip),{disabled:p.value||S.value!=="flow"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:g.value},null,8,wL)]),default:e.withCtx(()=>[e.createElementVNode("div",kL,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u[S.value]))),e.createTextVNode(" "+e.toDisplayString(S.label),1)])]),_:2},1032,["disabled"])]),_:1},8,["model-value","options"])],8,["disabled"])):e.createCommentVNode("",!0),e.createVNode(Zn,e.mergeProps({...e.unref(o),...r},{class:"dk-form","editor-mode":l.value,"hide-editor-mode-switcher":""}),{"code-editor":e.withCtx(()=>[e.createVNode(l$,{class:"code-editor",editing:r.isEditing,onChange:C,onError:N},null,8,["editing"])]),"plugin-config-title":e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.mode")),1)]),"plugin-config-description":e.withCtx(()=>[e.createElementVNode("span",{innerHTML:m.value},null,8,CL)]),default:e.withCtx(()=>[c.value==="flow"?(e.openBlock(),e.createBlock(bL,{key:0,"is-editing":r.isEditing,onChange:b},null,8,["is-editing"])):e.createCommentVNode("",!0)]),_:1},16,["editor-mode"])],64))}}),[["__scopeId","data-v-99d4e7f0"]])}),NL=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.functions.*",component:tt,propsOverrides:n=>({...n,multiline:!0,rows:3})}]}),SL=it({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),xL=it({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),AL=it({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),vL=it({experimental:!0}),fw=e.defineComponent({inheritAttrs:!1,__name:"KeysetField",props:{name:{},scope:{}},setup(n){const t=n,{i18n:{t:r}}=Je(),o=e.inject(Ze.FORMS_CONFIG),i=e.computed(()=>(o==null?void 0:o.app)==="konnect"),{formData:a,config:s}=ft();function c(f){const m=`config.${f}`,g=uf(f);return s.value.transformLabel?s.value.transformLabel(g,m):g}function l(f){if(typeof f!="string"||!f)return!1;try{const m=new URL(f);return(m.protocol==="http:"||m.protocol==="https:")&&!!m.host}catch{return!1}}const u=e.computed(()=>{if(!i.value)return{hasError:!1,message:""};const f=a.config,m=f==null?void 0:f[`${t.scope}_token_signing`],g=f==null?void 0:f[`${t.scope}_token_upstream_header`];if(!m)return{hasError:!1,message:""};if(typeof g!="string"||g==="")return{hasError:!1,message:""};const y=f==null?void 0:f[`${t.scope}_token_keyset`];return l(y)?{hasError:!1,message:""}:{hasError:!0,message:r("plugins.free-form.jwt-signer.keyset_url_required",{signingField:c(`${t.scope}_token_signing`),headerField:c(`${t.scope}_token_upstream_header`)})}}),p=e.computed(()=>u.value.hasError),d=e.computed(()=>u.value.message);return(f,m)=>(e.openBlock(),e.createBlock(tt,e.mergeProps(f.$attrs,{error:p.value,"error-message":d.value,name:n.name}),null,16,["error","error-message","name"]))}}),IL=it({component:e.defineComponent({__name:"JwtSignerForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r={bundles:[["config.access_token_signing","config.access_token_upstream_header","config.access_token_keyset"],["config.channel_token_signing","config.channel_token_upstream_header","config.channel_token_keyset"]]},o=e.useSlots();return e.provide(Ze.AUTOFILL_SLOT,o==null?void 0:o[Ze.AUTOFILL_SLOT_NAME]),(i,a)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"render-rules":r}),{"field-renderers":e.withCtx(()=>[e.createVNode($t,{match:({path:s})=>s==="config.access_token_keyset"},{default:e.withCtx(s=>[e.createVNode(fw,e.mergeProps(s,{scope:"access"}),null,16)]),_:1},8,["match"]),e.createVNode($t,{match:({path:s})=>s==="config.channel_token_keyset"},{default:e.withCtx(s=>[e.createVNode(fw,e.mergeProps(s,{scope:"channel"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(jb)]),_:1},16))}})}),BL=it({experimental:!0}),TL=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),OL=it({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),PL=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),VL=it({experimental:!0,component:qb,fieldRenderers:[{match:({path:n})=>n==="config.identity_realms",component:Ub},{match:"config.anonymous",component:tt,propsOverrides:{placeholder:"e.g., 00000000-0000-0000-0000-000000000001"}},{match:"config.realm",component:tt,propsOverrides:{placeholder:"e.g., my-api"}}]}),$L={class:"ff-collapsible-section"},RL={class:"ff-collapsible-section-header"},LL={class:"ff-collapsible-section-header-toggle"},DL={key:0,class:"ff-collapsible-section-content"},ML={key:0,class:"ff-collapsible-section-indent-guide"},Qf=Me(e.defineComponent({__name:"CollapsibleSection",props:e.mergeModels({label:{}},{expanded:{type:Boolean,default:!0},expandedModifiers:{}}),emits:["update:expanded"],setup(n){const t=e.useModel(n,"expanded");return(r,o)=>(e.openBlock(),e.createElementBlock("div",$L,[e.createElementVNode("header",RL,[e.createElementVNode("div",LL,[e.createElementVNode("button",{class:"ff-collapsible-section-toggle-btn",type:"button",onClick:o[0]||(o[0]=e.withModifiers(i=>t.value=!t.value,["prevent","stop"]))},[e.createVNode(e.unref(Re.ChevronRightIcon),{class:e.normalizeClass(["ff-collapsible-section-toggle-btn-trigger-icon",{"collapse-expanded":t.value}]),decorative:"",size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["class","size"])]),e.createVNode(e.unref(Fe.KLabel),{class:"ff-collapsible-section-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.label),1)]),_:1})])]),e.createVNode(Ll,null,{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",DL,[e.renderSlot(r.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)]),_:3}),t.value?(e.openBlock(),e.createElementBlock("div",ML)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-39f2a44b"]]),jL={class:"ff-mb-subject"},FL={class:"ff-mb-attributes"},UL={class:"ff-metering-billing-inline-row"},KL={class:"ff-mb-queue"},qL=it({experimental:!0,component:Me(e.defineComponent({__name:"MeteringAndBillingForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Je(),i=e.inject(Ze.FORMS_CONFIG),a=e.computed(()=>{const p=i==null?void 0:i.geoApiServerUrl,d=p?new URL(p).hostname.split(".")[0]:null;return d?`https://${d}.api.konghq.com/v3/openmeter/events`:"https://{{region}}.api.konghq.com/v3/openmeter/events"}),s={hasValue:p=>!!p&&Object.keys(p).length>0,prepareFormData:p=>{var d;return t.isEditing?p:(i==null?void 0:i.app)==="konnect"&&!((d=p==null?void 0:p.config)!=null&&d.ingest_endpoint)?{...p,config:{...p==null?void 0:p.config,ingest_endpoint:a.value}}:p}},c=e.ref(!0),l=e.ref(!0),u=e.ref(!0);return(p,d)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"form-config":s,"plugin-config-description":e.unref(o)("plugins.free-form.metering-and-billing.sections.plugin_config.description")}),{"field-renderers":e.withCtx(()=>[e.createVNode($t,{match:({path:f})=>f==="config.meter_api_requests"},{default:e.withCtx(f=>[e.createVNode(An,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_api_requests.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.meter_ai_token_usage"},{default:e.withCtx(f=>[e.createVNode(An,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_ai_token_usage.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.ssl_verify"},{default:e.withCtx(f=>[e.createVNode(An,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.description"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.label")}),null,16,["description","label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.subject.look_up_value_in"},{default:e.withCtx(f=>[e.createVNode(Dt,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.label")}),null,16,["help","label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.subject.field"},{default:e.withCtx(f=>[e.createVNode(tt,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.label"),placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.placeholder")}),null,16,["help","label","placeholder"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.timeout"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.timeout.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.keepalive"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.keepalive.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.max_coalescing_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_coalescing_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.initial_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.initial_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.max_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.max_retry_time"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_time.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".look_up_value_in")},{default:e.withCtx(f=>[e.createVNode(tt,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.look_up_value_in.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".event_property_name")},{default:e.withCtx(f=>[e.createVNode(tt,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.event_property_name.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(Qf,{expanded:c.value,"onUpdate:expanded":d[0]||(d[0]=f=>c.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.metering.title")},{default:e.withCtx(()=>[e.createVNode(ot,{name:"config.meter_api_requests"}),e.createVNode(ot,{name:"config.meter_ai_token_usage"})]),_:1},8,["expanded","label"]),e.createElementVNode("div",jL,[e.createVNode(Ft,{label:e.unref(o)("plugins.free-form.metering-and-billing.sections.subject.title"),name:"config.subject","render-rules":{dependencies:{field:["look_up_value_in",["query","header"]]}},"reset-label-path":"reset"},null,8,["label"])]),e.createVNode(Qf,{expanded:l.value,"onUpdate:expanded":d[1]||(d[1]=f=>l.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.title")},{default:e.withCtx(()=>[e.createElementVNode("div",FL,[e.createVNode(dr,{"hide-label":"",name:"config.attributes"})])]),_:1},8,["expanded","label"]),e.createVNode(Qf,{expanded:u.value,"onUpdate:expanded":d[2]||(d[2]=f=>u.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.ingestion.title")},{default:e.withCtx(()=>[e.createVNode(tt,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.ingest_endpoint.help"),name:"config.ingest_endpoint"},null,8,["help"]),e.createVNode(ot,{name:"config.api_token"}),e.createVNode(ot,{name:"config.ssl_verify"}),e.createElementVNode("div",UL,[e.createVNode(ot,{name:"config.timeout"}),e.createVNode(ot,{name:"config.keepalive"})])]),_:1},8,["expanded","label"]),e.createVNode(za,{class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[e.createElementVNode("div",KL,[e.createVNode(e.unref(Fe.KLabel),{class:"ff-mb-queue-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.metering-and-billing.sections.queue.title")),1)]),_:1}),e.createVNode(Ft,{"as-child":"",name:"config.queue","reset-label-path":"reset"})])]),_:1})]),_:1},16,["plugin-config-description"]))}}),[["__scopeId","data-v-78972733"]])}),GL=it({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),HL=it({experimental:!0}),zL=it({experimental:!0,fieldRenderers:[{match:"config.access_logs.custom_attributes_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),WL=it({experimental:!0}),YL=it({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}},fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),JL=it({experimental:!0,fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),XL={class:"rla-form-request-limits-subtitle"},ZL={class:"rla-form-request-limits-content"},QL={class:"rla-form-window-type"},eD={class:"rla-form-request-limits-items"},tD={class:"rla-form-request-limits-row"},nD=["id"],rD={class:"rla-form-request-limits-actions"},oD={key:0,class:"rla-form-request-limits-examples"},iD={class:"rla-form-request-limits-examples-badges"},ep="config.window_type",aD=Me(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{i18n:{t}}=Je(),{formData:r,getSelectItems:o,getSchema:i}=ft(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=cf("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(ep))==null?void 0:b.default,p=e.computed(()=>ka(r,ep)),d=e.computed(()=>o(ep).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},g=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"rla-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"rla-form-request-limits-title",for:"rla-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",XL,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",ZL,[e.createElementVNode("div",QL,[e.createVNode(Jf,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",eD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,j)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,j)},[e.createVNode(C,{for:`rla-form-request-limits-item-${j}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:j+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",tD,[e.createElementVNode("legend",{id:`rla-form-request-limits-item-${j}-legend`,class:"rla-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${j}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${j}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,nD),e.createElementVNode("div",rD,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),g.value.length>0?(e.openBlock(),e.createElementBlock("div",oD,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",iD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(I,j)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${j}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${j}`?"info":"decorative",class:"rla-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${j}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-1fac872b"]]),sD={id:"rla-form-error-legend",class:"rla-form-error-inputs"},lD=Me(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{i18n:{t}}=Je();return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"rla-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",sD,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(tt,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-7b36f1f7"]]),cD=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=ft(),r=e.inject(Ze.FORMS_CONFIG),o=e.inject(Ai),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(Ll,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(Gf,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),uD=e.defineComponent({__name:"ConfigForm",setup(n){const{getSchema:t}=ft();return(r,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ft,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(ot,{name:"identifier"}),e.createVNode(aD),e.createVNode(lD)]),_:1}),e.createVNode(za,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(Dt,{multiple:!0,name:"config.compound_identifier"}),e.unref(t)("config.counter_key")?(e.openBlock(),e.createBlock(ot,{key:0,name:"config.counter_key"})):e.createCommentVNode("",!0),e.createVNode(ot,{name:"config.sync_rate"}),e.createVNode(ot,{name:"config.namespace"}),e.createVNode(ot,{name:"config.strategy"}),e.createVNode(cD),e.createVNode(ot,{name:"config.dictionary_name"}),e.createVNode(ot,{name:"config.lock_dictionary_name"}),e.createVNode(ot,{name:"config.hide_client_headers"}),e.createVNode(ot,{name:"config.retry_after_jitter_max"}),e.createVNode(ot,{name:"config.header_name"}),e.createVNode(ot,{name:"config.path"}),e.createVNode(ot,{name:"config.throttling"}),e.createVNode(ot,{name:"config.enforce_consumer_groups"}),e.createVNode(ot,{name:"config.consumer_groups"}),e.createVNode(ot,{name:"config.disable_penalty"})]),_:1})],64))}}),dD=it({experimental:!0,component:e.defineComponent({__name:"RateLimitingAdvancedForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(uD)]),_:1},16))}})}),fD=it({experimental:!0,renderRules:{bundles:[["config.policy","config.redis"]],dependencies:{"config.redis":["config.policy","redis"]}}}),pD="__request_callout_";function pw(){return hl(pD)}const Ya="_callout_id",mD=e.defineComponent({__name:"CalloutForm",props:{index:{},fieldName:{}},setup(n){const t=n,{formData:r}=ft(),o=e.computed(()=>{const{callouts:s}=r.config;return s==null?[]:s.filter(({name:c})=>{var l;return c&&c!==((l=s[t.index])==null?void 0:l.name)})}),i=e.computed(()=>o.value.map(({[Ya]:s,name:c})=>({value:s,label:c}))),a=e.computed(()=>r.config.callouts[t.index]);return e.watch(i,()=>{a.value.depends_on=a.value.depends_on.filter(s=>i.value.some(c=>c.value===s))}),(s,c)=>(e.openBlock(),e.createBlock(Ft,{name:n.fieldName},{depends_on:e.withCtx(l=>[e.createVNode(Dt,e.mergeProps(l,{items:i.value,multiple:"",required:!1}),null,16,["items"])]),request:e.withCtx(l=>[e.createVNode(Ft,e.mergeProps(l,{"fields-order":["url","method","headers","query","body","http_opts","error","by_lua"]}),{method:e.withCtx(u=>[e.createVNode(Dt,e.mergeProps(u,{items:e.unref(nf)(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"])}),null,16,["items"])]),_:1},16)]),_:1},8,["name"]))}}),hD=e.defineComponent({__name:"CalloutsForm",setup(n){const{formData:t}=ft();function r(){const o=t.config.callouts[t.config.callouts.length-1];o&&(o[Ya]=pw())}return(o,i)=>(e.openBlock(),e.createBlock(dr,{appearance:"tabs","item-label":a=>a.name||"New callout",name:"callouts",required:"","sticky-tabs":"",onAdd:r},{item:e.withCtx(({index:a,fieldName:s})=>[e.createVNode(mD,{"field-name":s,index:a},null,8,["field-name","index"])]),_:1},8,["item-label"]))}}),gD=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Ft,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(hD),e.createVNode(Ft,{appearance:"card","fields-order":["headers","query","body","by_lua"],name:"upstream"}),e.createVNode(Ft,{appearance:"card",name:"cache"},{redis:e.withCtx(o=>[e.createVNode(Ft,e.mergeProps(o,{"fields-order":["host","port","connection_is_proxied","database","username","password","sentinel_master","sentinel_role","sentinel_nodes","sentinel_username","sentinel_password","cluster_nodes","cluster_max_redirections","ssl","ssl_verify","server_name","keepalive_backlog","keepalive_pool_size","read_timeout","send_timeout","connect_timeout"]}),null,16)]),_:2},1024)]),_:1}))}}),yD=it({component:Me(e.defineComponent({__name:"RequestCalloutForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Je();function i(l,u=!1){return l.reduce((p,{[Ya]:d,name:f})=>(u?p[f]=d:p[d]=f,p),{})}function a(l){var p;const u=Ea(l);if((p=u.config)!=null&&p.callouts){const{callouts:d}=u.config;d.forEach(m=>{m.request.body.custom=m.request.body.custom??{},m[Ya]=pw()});const f=i(d,!0);d.forEach(m=>{m.depends_on=m.depends_on.map(g=>f[g])})}return u}const s={hasValue:l=>!!l&&Object.keys(l).length>0,prepareFormData:a};function c(l,u){var f;if(!l)return;const p=Ea(l);if(!((f=p.config)!=null&&f.callouts)){t.onFormChange(p,u);return}const d=i(p.config.callouts);p.config.callouts=p.config.callouts.map(m=>{const{[Ya]:g,depends_on:y,...b}=m;return{depends_on:y.map(_=>d[_]).filter(_=>_!=null),...b}}),t.onFormChange(p,u)}return(l,u)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"form-config":s,"on-form-change":c}),{"field-renderers":e.withCtx(()=>[e.createVNode($t,{match:({path:p})=>p.endsWith("by_lua")},{default:e.withCtx(p=>[e.createVNode(tt,e.mergeProps(p,{autosize:"",class:"rc-code",multiline:"",placeholder:e.unref(o)("plugins.free-form.request-callout.by_lua_placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:p})=>["cluster_nodes","sentinel_nodes"].some(d=>p.endsWith(d))},{default:e.withCtx(p=>[e.createVNode(dr,e.mergeProps(p,{appearance:"card"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(gD)]),_:1},16))}}),[["__scopeId","data-v-dc955662"]])}),_D=it({experimental:!0}),bD=it({experimental:!0}),wD=it({experimental:!0,fieldRenderers:[{match:({path:n,genericPath:t})=>n==="config.replace.body"||t==="config.transform.functions.*"||t.endsWith(".json.*"),component:tt,propsOverrides:{multiline:!0,rows:3}}]}),kD=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n.endsWith(".json.*"),component:tt,propsOverrides:{multiline:!0,rows:3}}]}),CD=it({experimental:!0}),ED={class:"sp-form-request-limits-subtitle"},ND={class:"sp-form-request-limits-content"},SD={class:"sp-form-window-type"},xD={class:"sp-form-request-limits-items"},AD={class:"sp-form-request-limits-row"},vD=["id"],ID={class:"sp-form-request-limits-actions"},BD={key:0,class:"sp-form-request-limits-examples"},TD={class:"sp-form-request-limits-examples-badges"},tp="config.window_type",OD=Me(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{t}=jt.createI18n("en-us",Yt),{formData:r,getSelectItems:o,getSchema:i}=ft(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=cf("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(tp))==null?void 0:b.default,p=e.computed(()=>ka(r,tp)),d=e.computed(()=>o(tp).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},g=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"sp-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"sp-form-request-limits-title",for:"sp-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",ED,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",ND,[e.createElementVNode("div",SD,[e.createVNode(Jf,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",xD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,j)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,j)},[e.createVNode(C,{for:`sp-form-request-limits-item-${j}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:j+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",AD,[e.createElementVNode("legend",{id:`sp-form-request-limits-item-${j}-legend`,class:"sp-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${j}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${j}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,vD),e.createElementVNode("div",ID,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),g.value.length>0?(e.openBlock(),e.createElementBlock("div",BD,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",TD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(I,j)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${j}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${j}`?"info":"decorative",class:"sp-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${j}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-e12d9c9f"]]),PD={id:"sp-form-error-legend",class:"sp-form-error-inputs"},VD=Me(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{t}=jt.createI18n("en-us",Yt);return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"sp-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",PD,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(tt,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-0796e152"]]),$D=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=ft(),r=e.inject(Ze.FORMS_CONFIG),o=e.inject(Ai),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(Ll,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(Gf,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),RD=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ft,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(OD),e.createVNode(VD)]),_:1}),e.createVNode(za,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(ot,{name:"config.dictionary_name"}),e.createVNode(ot,{name:"config.lock_dictionary_name"}),e.createVNode(ot,{name:"config.strategy"}),e.createVNode($D),e.createVNode(ot,{name:"config.namespace"}),e.createVNode(ot,{name:"config.hide_client_headers"}),e.createVNode(ot,{name:"config.disable_penalty"}),e.createVNode(ot,{name:"config.retry_after_jitter_max"}),e.createVNode(ot,{name:"config.sync_rate"})]),_:1})],64))}}),LD=it({experimental:!0,component:e.defineComponent({__name:"ServiceProtectionForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(RD)]),_:1},16))}})}),DD=it({experimental:!0}),MD=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.flow.functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),jD=it({experimental:!0,fieldRenderers:[{match:"config.message.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),FD=it({experimental:!0,fieldRenderers:[{match:"config.message.functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),UD=it({experimental:!0,renderRules:{bundles:[["config.cache.strategy","config.cache.redis"]],dependencies:{"config.cache.redis":["config.cache.strategy","redis"]}},fieldRenderers:[{match:"config.behavior.idp_error_response_body_template",component:tt,propsOverrides:{multiline:!0,rows:4}}]}),KD=Object.assign({"../plugins/acl/index.ts":MV,"../plugins/ai-custom-guardrail.ts":jV,"../plugins/ai-mcp-proxy/index.ts":FV,"../plugins/aws-lambda.ts":UV,"../plugins/basic-auth/index.ts":e$,"../plugins/confluent-consume.ts":t$,"../plugins/confluent.ts":n$,"../plugins/correlation-id.ts":r$,"../plugins/cors.ts":o$,"../plugins/datakit/index.ts":EL,"../plugins/exit-transformer.ts":NL,"../plugins/file-log.ts":SL,"../plugins/header-cert-auth.ts":xL,"../plugins/http-log.ts":AL,"../plugins/jwe-decrypt.ts":vL,"../plugins/jwt-signer/index.ts":IL,"../plugins/jwt.ts":BL,"../plugins/kafka-consume.ts":TL,"../plugins/kafka-log.ts":OL,"../plugins/kafka-upstream.ts":PL,"../plugins/key-auth/index.ts":VL,"../plugins/metering-and-billing/index.ts":qL,"../plugins/mtls-auth.ts":GL,"../plugins/oauth2.ts":HL,"../plugins/opentelemetry.ts":zL,"../plugins/prometheus.ts":WL,"../plugins/proxy-cache-advanced.ts":YL,"../plugins/proxy-cache.ts":JL,"../plugins/rate-limiting-advanced/index.ts":dD,"../plugins/rate-limiting.ts":fD,"../plugins/request-callout/index.ts":yD,"../plugins/request-transformer-advanced.ts":_D,"../plugins/request-transformer.ts":bD,"../plugins/response-transformer-advanced.ts":wD,"../plugins/response-transformer.ts":kD,"../plugins/route-transformer-advanced.ts":CD,"../plugins/service-protection/index.ts":LD,"../plugins/session.ts":DD,"../plugins/solace-consume.ts":MD,"../plugins/solace-log.ts":jD,"../plugins/solace-upstream.ts":FD,"../plugins/upstream-oauth.ts":UD});function qD(n){const t=n.match(/\.\.\/plugins\/(.+?)(?:\/index)?\.ts$/);if(!t)throw new Error(`Unable to derive plugin name from path: ${n}`);const[,r]=t;return r}function GD(n){const t={},r=new Map;for(const[o,i]of Object.entries(n)){const a=qD(o);if(r.has(a))throw new Error(`Duplicate plugin config for "${a}": ${r.get(a)} and ${o}`);r.set(a,o),t[a]={...i,component:i.component,experimental:i.experimental??!1,fieldRenderers:i.fieldRenderers??[]}}return t}const np=GD(KD);function mw(n){return np[n]}function hw(n,t){const r=mw(n);if(r&&!(r.experimental&&!t.includes(n)))return r.component}function gw(n,t,r){return r==="freeform"?!0:r==="vfg"?!1:!!hw(n,t)}function HD(){return Object.entries(np).filter(([,n])=>n.experimental).map(([n])=>n).sort((n,t)=>n.localeCompare(t))}function rp(){return e.inject(Ld,[])}function zD(n){const t=new Set(HD()),r=n.filter(i=>t.has(i)),o=n.filter(i=>!t.has(i));return o.length>0&&console.warn(`[entities-plugins] Ignoring unknown experimental free-form plugins: ${o.join(", ")}`),r}function WD(n){e.provide(Ld,zD(n))}function YD(){const n=rp();return{shouldUseFreeForm:(t,r)=>gw(t,n,r),getFreeFormComponent:t=>hw(t,n)}}function yw(n){var o,i;if(!n)return;if(!n.token_exchange)return n;if((Array.isArray((o=n.token_exchange.request)==null?void 0:o.audience)&&n.token_exchange.request.audience.length===0||n.token_exchange.request&&!n.token_exchange.request.audience)&&(n.token_exchange.request.audience=null),(Array.isArray((i=n.token_exchange.request)==null?void 0:i.scopes)&&n.token_exchange.request.scopes.length===0||n.token_exchange.request&&!n.token_exchange.request.scopes)&&(n.token_exchange.request.scopes=null),[{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1},subject_token_issuers:null},{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1}},{cache:{},request:{audience:null,scopes:null}}].some(a=>en(n.token_exchange,a)))return n.token_exchange=null,n;const r=n.token_exchange.subject_token_issuers;return r&&r.forEach(a=>{en(a.conditions,{})&&(a.conditions=null),a.conditions&&Object.values(a.conditions).every(s=>Array.isArray(s)&&s.length===0)&&(a.conditions=null)}),n}const _w=n=>{const t=n==null?void 0:n.proof_of_possession_mtls_from_header;if(!t)return;if(!Array.isArray(t.ca_certificates)||t.ca_certificates.length===0){n.proof_of_possession_mtls_from_header=null;return}en(t,{allow_partial_chain:!1,cert_cache_ttl:6e4,certificate_header_format:"url_encoded",http_timeout:3e4,revocation_check_mode:"IGNORE_CA_ERROR",secure_source:!0,ssl_verify:!0})&&(n.proof_of_possession_mtls_from_header=null)},JD={shamefullyTransformPayload(n){return yw(n.payload.config),_w(n.payload.config),n}},XD={shamefullyTransformPayload(n){var t,r,o,i,a;if(!((r=(t=n.payload.config)==null?void 0:t.access_logs)!=null&&r.custom_attributes_by_lua))return n;if(en((i=(o=n.payload.config)==null?void 0:o.access_logs)==null?void 0:i.custom_attributes_by_lua,{})){const s=(a=n.payload.config)==null?void 0:a.access_logs;s&&(s.custom_attributes_by_lua=null)}return n}},ZD={shamefullyTransformPayload(n){var r,o;const t=(o=(r=n.payload.config)==null?void 0:r.v2_strategies)==null?void 0:o.openid_connect;return Array.isArray(t)&&t.forEach(i=>{yw(i.config),_w(i.config)}),n}},QD={shamefullyTransformPayload(n){var r;return!n.payload.config||!((r=n.payload.config)!=null&&r.token_exchange)||[{cache:{enabled:!0,ttl:3600},client_auth:"client_secret_basic",enabled:!1,request:{actor_token_source:"none",actor_token_type:"urn:ietf:params:oauth:token-type:access_token",audience:null,requested_token_type:"urn:ietf:params:oauth:token-type:access_token",scopes:null,subject_token_type:"urn:ietf:params:oauth:token-type:access_token"}}].some(o=>{var i;return en((i=n.payload.config)==null?void 0:i.token_exchange,o)})&&(n.payload.config.token_exchange=null),n}},eM=(n,t)=>{const r=n.model.startsWith("config-"),o=t.model.startsWith("config-");return r&&!o?1:!r&&o?-1:0},bw=(n,t)=>(n.order??0)-(t.order??0),ww=(n,t)=>eM(n,t)||bw(n,t)||n.model.localeCompare(t.model),tM=n=>{const{capitalize:t}=Ie.useStringHelpers(),{convertToDotNotation:r}=Hy(),{i18n:{t:o}}=Je(),i=rp(),a={"application-registration":{overwriteDefault:!0,formSchema:{...WB}},datadog:{...YB},"exit-transformer":{...JB},"upstream-tls":{"config-trusted_certificates":{type:"textArea",valueType:"array",rows:4,help:"A comma separated list of certificate values"}},statsd:{...cT},"statsd-advanced":{...uT},"route-by-header":{...iT},"ai-prompt-decorator":{...KB},"ai-prompt-template":{...qB},"ai-proxy-advanced":{...GB},"ai-rag-injector":{...HB},"ai-llm-as-judge":{...zB},"vault-auth":{...fT},"oas-validation":{...eT},mocking:{...QB},"rate-limiting":{...Pl},"rate-limiting-advanced":(n==null?void 0:n.app)==="kongManager"?{"config-consumer_groups":Pl["config-consumer_groups"]}:{...Pl},"graphql-rate-limiting-advanced":{...XB},"injection-protection":{...ZB},"response-ratelimiting":{...Pl},"pre-function":{...n_},"post-function":{...n_},"request-transformer-advanced":{...rT},"response-transformer":{...r_},"response-transformer-advanced":{...oT},zipkin:{...kT},"upstream-oauth":{...dT},saml:{...aT},"kafka-upstream":{...gT},"solace-consume":{...sT},"solace-upstream":{...lT},"key-auth":VB(n),"key-auth-enc":jB(n),confluent:{...yT},"confluent-consume":{..._T},"kafka-consume":{...bT},"kafka-log":{...wT},"openid-connect":{...JD},opentelemetry:{...XD},"konnect-application-auth":{...ZD},"ai-mcp-oauth2":{...QD}},s=()=>["created_at","updated_at","id","_isCustomPlugin","_sourcePlugin","_supported_redis_partial_type","_redis_partial_path"],c=(w,S,I,j)=>{let A={};(S||w)&&(A=S||(w.fields?w.fields:w));const x=s().concat(w.blacklist?w.blacklist:[]),O=Object.keys(A).filter(q=>!x.includes(q)),P=O.indexOf("comparator");P>-1&&O.splice(P,1);let R={fields:[]};const W={};O.forEach(q=>{u(A[q],q,A,W,R,I)});const Z=W.name,X=w._sourcePlugin||Z,F=$n[X],J=[],$=q=>{const K=["cluster-cache"];for(const ae of K)if(q.model.includes(ae))return!1;return new RegExp("(?<=-redis-).*").test(q.model)};if(R._supported_redis_partial_type=w._supported_redis_partial_type,R._redis_partial_path=w._redis_partial_path,Ze.getSharedFormName(X)||gw(X,i,j)||F!=null&&F.useLegacyForm||n!=null&&n.credential){if(F!=null&&F.useLegacyForm&&(n!=null&&n.enableRedisPartial)&&w._supported_redis_partial_type){for(const q of R.fields)if($(q)){J.push(q);continue}R.fields=R.fields.filter(q=>!$(q)),J.length&&R.fields.push({id:"_redis",fields:J,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path})}R.fields.sort((q,K)=>(q.order=q.order||0,K.order=K.order||0,q.order-K.order))}else{const q=[],K=[],ae=[],M=[],v={};if(F!=null&&F.fieldRules){const te=[...F.fieldRules.atLeastOneOf??[],...F.fieldRules.onlyOneOf??[],...F.fieldRules.mutuallyRequired??[]];if(F.fieldRules.onlyOneOfMutuallyRequired)for(const ge of F.fieldRules.onlyOneOfMutuallyRequired)te.push(...ge);for(const ge of te)for(const me of ge)v[me.replace(/-/g,"_").replace(/\./g,"-")]=!1}for(const te of R.fields){if(n!=null&&n.enableRedisPartial&&w._supported_redis_partial_type&&$(te)){M.push(te);continue}if(te.pinned){q.push(te);continue}if(te.required||v[te.model]!==void 0){v[te.model]===!1&&(v[te.model]=!0),K.push(te);continue}ae.push(te)}M.length&&ae.push({id:"_redis",fields:M,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path,order:-1});const H=Object.entries(v).filter(([,te])=>!te).map(([te])=>te.replace(/-/g,".").replace(/_/g,"-"));H.length>0&&console.warn(`Unknown checked fields for plugin ${Z}: ${H.join(", ")}`);const oe=[];q.length>0&&oe.push({fields:q.sort(bw)}),(K.length>0||ae.length>0)&&oe.push({fields:K.sort(ww),collapsible:{title:o("plugins.form.grouping.plugin_configuration.title"),description:o("plugins.form.grouping.plugin_configuration.description"),nestedCollapsible:{fields:ae.sort(ww),triggerLabel:{expand:o("plugins.form.grouping.advanced_parameters.view"),collapse:o("plugins.form.grouping.advanced_parameters.hide")}}},slots:{beforeContent:"plugin-config-before-content",emptyState:"plugin-config-empty-state"}}),R={groups:oe}}return{schema:R,model:W,options:{noneSelectedText:"Nothing Selected...",helpAsHtml:!0}}},l=w=>Array.isArray(w.default)||w.default!=null&&typeof w.default!="object"&&w.default!=="function",u=(w,S,I,j,A,x)=>{const O=l(w);return j[S]=O?w.default:null,w.id=S,w.model=S,w.fields&&w.type==="record"?d(w,S,I,j,A,x):(I[S]=w,N(w,j),x&&x[S]&&p(I[S],x[S]),A.fields.push(w)),I},p=(w,S)=>(S&&(Object.assign(w,S),S.label&&(w.label=S.label)),w),d=(w,S,I,j,A,x)=>{w.fields.forEach(O=>{Object.keys(O).forEach(P=>{const R=O[P];I=u(R,S+"-"+P,I,j,A,x)})})},f=(w,S)=>{w.type="input",w.inputType="hidden",w.styleClasses="kong-form-hidden-field-wrapper";const I=n==null?void 0:n.entityId;S[w.model]=I?{id:I}:null},m=w=>{w.type="input",w.inputType="number",w.between&&w.between.length===2&&(w.min=w.between[0],w.max=w.between[1])},g=w=>{Object.prototype.hasOwnProperty.call(w,"one_of")?(w.type="select",w.values=w.one_of,w.selectOptions={hideNoneSelectedText:!0}):(w.type="input",w.inputType="text")},y=w=>{w.type="checkbox",w.default=!0,w.required=!1},b=w=>{if(w.type="object-advanced",w.values.type==="array"){const{type:S}=w.values.elements||{};w.schema={fields:[{schema:{fields:[{...dt,model:w.model,valueArrayType:S==="integer"?"number":S||"string",inputAttributes:{...dt.inputAttributes,type:S==="integer"?"number":"text",inputMode:S==="integer"?"numeric":"text"}}]}}]}}else w.values.fields&&(w.schema={fields:[{type:"object",model:"object",schema:{fields:w.values.fields.map(S=>{const I=Object.keys(S)[0];return{model:I,type:"input",label:t(I),placeholder:I,inputType:S[I].type}})}}]})},_=w=>w.fields.reduce((S,I)=>(I.fields&&I.fields.forEach(j=>{S[j.model]=j}),I.model&&(S[I.model]=I),S),{}),k=(w,S)=>{if(!Ze.customFields.includes(w.model))return;const I=_(w);Ze.customFields.forEach(j=>{Object.keys(I).forEach(A=>{const x=l(I[A]);S[A]=x?I[A].default:null}),delete S[j]})},C=(w,S)=>w.inputType==="hidden"?"":r(w.label||S.replace(/_/g," ")),N=(w,S)=>{switch(k(w,S),w.type){case"foreign":f(w,S);break;case"number":m(w),w.attributes={step:"any"};break;case"integer":m(w);break;case"string":g(w);break;case"boolean":y(w);break;case"map":b(w);break}w.inputType==="foreign"&&f(w,S),w.label=C(w,w.model)};function E(w,S){if(S==null||S.type&&S.type!=="record"||typeof w!="object"||w==null)return w;const I={};for(const j of S.fields){const A=Object.keys(j)[0],x=j[A];x.type==="record"?I[A]=E(w[A],x):x.type==="array"&&Array.isArray(w[A])&&x.elements.type==="record"?I[A]=w[A].map(O=>E(O,x.elements)):I[A]=w[A]}return I}return{buildFormSchema:u,parseSchema:c,customSchemas:a,typedefs:ai,pruneRecord:E}},uc=Symbol("customPluginType"),nM=1e3,rM=20,kw=5e3,Cw=(n,t=nM)=>{const r=/^[a-z][a-z\d+.-]*:/i.test(n),o=new URL(n,"http://localhost");return o.searchParams.has("size")||o.searchParams.set("size",`${t}`),r?o.toString():`${o.pathname}${o.search}${o.hash}`},dc=async(n,t,r)=>{const o=[];let i=Cw(t),a=null,s=0;for(;i&&s<rM&&o.length<kw&&i!==a;){a=i;const l=(await n.get(i,{signal:r})).data;Array.isArray(l==null?void 0:l.data)&&o.push(...l.data),i=l!=null&&l.next?Cw(l.next):null,s+=1}return o.slice(0,kw)};function oM(n){const{axiosInstance:t,apiBaseUrl:r}=n,o=()=>{if(n.app!=="konnect")throw new Error("Installed custom plugin APIs are only available for Konnect")},i=(b,_)=>{let k=`${r}${b}`;return n.app==="konnect"&&(k=k.replace(/{controlPlaneId}/gi,n.controlPlaneId)),k=k.replace(/{pluginId}/gi,_??"").replace(/\/{workspace}/gi,n.workspace?`/${n.workspace}`:""),k},a=async b=>{o();const _=i(Qe.customPlugin.konnect.installed.edit,b),{data:k}=await t.get(_);return k},s=async b=>{o();const _=i(Qe.customPlugin.konnect.installed.create),{data:k}=await t.post(_,b);return k},c=async(b,_)=>{o();const k=i(Qe.customPlugin.konnect.installed.edit,b),{data:C}=await t.put(k,_);return C},l=async b=>{const _=i(Qe.customPlugin[n.app].streamed.edit,b),{data:k}=await t.get(_);return k},u=async b=>{const _=i(Qe.customPlugin[n.app].streamed.create),{data:k}=await t.post(_,b);return k},p=async(b,_)=>{const k=i(Qe.customPlugin[n.app].streamed.edit,b),C=n.app==="konnect"?"put":"patch",{data:N}=await t[C](k,_);return N},d=async b=>{const{aliasName:_,priority:k,sourcePlugin:C}=b,N=i(Qe.customPlugin[n.app].cloned.create),{data:E}=await t.post(N,{name:_,ref:C,priority:k});return E},f=async(b,_)=>{const{aliasName:k,priority:C,sourcePlugin:N}=_,E=i(Qe.customPlugin[n.app].cloned.edit,b),w=n.app==="konnect"?"put":"patch",{data:S}=await t[w](E,{ref:N,priority:C,name:k});return S},m=async b=>{const _=i(Qe.customPlugin[n.app].cloned.edit,b),{data:k}=await t.get(_);return k};return{getInstalledPlugin:a,createInstalledPlugin:s,updateInstalledPlugin:c,getStreamedPlugin:l,createStreamedPlugin:u,updateStreamedPlugin:p,getPluginByUnknownType:async b=>{var _,k,C;if(n.app==="konnect")try{const N=await a(b);return Object.assign(N,{[uc]:"installed"})}catch(N){if(zo.isAxiosError(N)&&((_=N.response)==null?void 0:_.status)!==404)throw N}try{const N=await l(b);return Object.assign(N,{[uc]:"streamed"})}catch(N){if(zo.isAxiosError(N)&&((k=N.response)==null?void 0:k.status)!==404)throw N}try{const N=await m(b);return Object.assign(N,{[uc]:"cloned"})}catch(N){if(zo.isAxiosError(N)&&((C=N.response)==null?void 0:C.status)!==404)throw N}return null},getPluginType:b=>b[uc],getClonedPlugin:m,createClonedPlugin:d,updateClonedPlugin:f}}const st={useI18n:Je,usePluginMetaData:e_,usePluginHelpers:Hy,useSchemas:tM,useExperimentalFreeForms:rp,useProvideExperimentalFreeForms:WD,useFreeFormResolver:YD,useCustomPluginApi:oM},Ew=n=>{var r,o,i,a;const t=n==null?void 0:n.response;return(t==null?void 0:t.status)===400&&(((o=(r=t.data)==null?void 0:r.message)==null?void 0:o.includes("plugin schema is currently in use"))||((i=t.data)==null?void 0:i.code)===19||((a=t.data)==null?void 0:a.name)==="referenced by others")},iM={class:"kong-ui-entities-custom-plugin-form"},aM={class:"plugin-type-radios"},sM={class:"compare-table-wrapper"},lM={class:"compare-table"},cM={key:0,scope:"col"},uM={key:1,scope:"col"},dM={key:2,scope:"col"},fM={scope:"row"},pM={key:0},mM={key:1},hM={key:2},gM={scope:"row"},yM={key:0},_M={class:"compare-list"},bM={key:1},wM={class:"compare-list"},kM={key:2},CM={scope:"row"},EM={key:0},NM={key:1},SM={key:2},xM={scope:"row"},AM={key:0},vM={key:1},IM={key:2},BM={scope:"row"},TM={key:0},OM={key:1},PM={key:2},VM={class:"plugin-modules-section"},$M={class:"plugin-select-item"},RM={class:"plugin-select-item"},LM={key:1},DM=1*1024*1024,MM=Me(e.defineComponent({__name:"CustomPluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!n.app||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&!n.workspace||!n.cancelRoute||!n.successRoute)},pluginName:{type:String,default:""},unsupportedTypes:{type:Array,default:()=>[]}},emits:["update","error","loading"],setup(n,{emit:t}){var me;const r=["acl","datakit","file-log","http-log","ip-restriction","key-auth","opa","openid-connect","post-function","pre-function","request-transformer-advanced","request-transformer","response-transformer-advanced","response-transformer","route-by-header","tcp-log"],o=["installed","streamed","cloned"],i=n,a=t,{i18n:{t:s},i18nT:c}=st.useI18n(),l=Nr.useRouter(),{getMessageFromError:u}=Ie.useErrors(),{axiosInstance:p}=Ie.useAxios((me=i.config)==null?void 0:me.axiosRequestConfig),{createInstalledPlugin:d,updateInstalledPlugin:f,createStreamedPlugin:m,updateStreamedPlugin:g,getPluginType:y,getPluginByUnknownType:b,createClonedPlugin:_,updateClonedPlugin:k}=st.useCustomPluginApi({axiosInstance:p,apiBaseUrl:i.config.apiBaseUrl,controlPlaneId:i.config.controlPlaneId,app:i.config.app,workspace:i.config.workspace});e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,e.ref(!0));const C=e.ref(null),N=(le,he)=>{const Oe=i.config.workspace??"",$e=i.config.app==="konnect"?i.config.controlPlaneId:"";return`${i.config.apiBaseUrl}${le}`.replace(/{controlPlaneId}/gi,$e).replace(/{pluginId}/gi,he??"").replace(/\/\{workspace\}/gi,Oe?`/${Oe}`:"")},E=e.computed(()=>{const le=$.fields.pluginType;if(!le)return"";const he=j.value?i.pluginName:void 0,Oe=he?"edit":"create";if(i.config.app==="konnect"){if(le==="installed")return N(Qe.customPlugin.konnect.installed[Oe],he);if(le==="streamed")return N(Qe.customPlugin.konnect.streamed[Oe],he);if(le==="cloned")return N(Qe.customPlugin.konnect.cloned[Oe],he)}else{if(le==="streamed")return N(Qe.customPlugin.kongManager.streamed[Oe],he);if(le==="cloned")return N(Qe.customPlugin.kongManager.cloned[Oe],he)}return""}),w=e.computed(()=>j.value?$.fields.pluginType==="cloned"?i.config.app==="konnect"?"put":"patch":i.config.app==="kongManager"&&$.fields.pluginType==="streamed"?"patch":"put":"post"),S=e.computed(()=>{switch($.fields.pluginType){case"installed":return Ie.SupportedEntityType.PluginSchema;case"streamed":return Ie.SupportedEntityType.CustomPlugin;case"cloned":return Ie.SupportedEntityType.ClonedPlugin;default:return Ie.SupportedEntityType.Plugin}}),I=e.computed(()=>{switch($.fields.pluginType){case"installed":return{lua_schema:$.fields.schemaContent};case"streamed":return{name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent};case"cloned":return{ref:$.fields.sourcePlugin,name:$.fields.aliasName,...$.fields.priority?{priority:parseInt($.fields.priority,10)}:{}};default:return{}}}),j=e.computed(()=>!!i.pluginName),A=e.ref(!1),x=e.ref(""),O=e.computed(()=>new Set(i.unsupportedTypes)),P=e.computed(()=>o.filter(le=>!O.value.has(le))),R=e.computed(()=>!j.value&&P.value.length===0),W=e.computed(()=>!j.value&&P.value.length>1),Z=()=>P.value[0]??null,X=le=>P.value.includes(le),F=le=>{if(j.value||!W.value){const he=le-1;return($.fields.pluginType==="installed"?1:2)>1?he:void 0}return le},J=e.ref(!0),$=e.reactive({fields:{pluginType:Z(),schemaContent:"",handlerContent:"",name:"",sourcePlugin:"",aliasName:"",priority:""},readonly:!1,errorMessage:""});let q="";e.watch(P,le=>{j.value||(!$.fields.pluginType||!le.includes($.fields.pluginType))&&($.fields.pluginType=le[0]??null)},{immediate:!0}),e.watch(()=>$.fields.pluginType,()=>{j.value||($.fields.schemaContent="",$.fields.handlerContent="",$.fields.name="",$.fields.sourcePlugin="",$.fields.aliasName="",$.fields.priority="")});const{getDisplayName:K}=e_(),ae=e.computed(()=>{var $e;const le=(($e=i.config)==null?void 0:$e.clonablePlugins)??r;if(le.length===0)return[];const he={};le.forEach(Pe=>{const qe=$n[Pe],Ye=qe==null?void 0:qe.group;Ye?(he[Ye]||(he[Ye]=[]),he[Ye].push({label:K(Pe),value:Pe})):console.warn(`Plugin ${Pe} is missing metadata group and will be shown without grouping.`)});const Oe=[];return Object.keys(he).sort().forEach(Pe=>{Oe.push({label:Pe,items:he[Pe]})}),Oe}),M=e.computed(()=>{if(R.value||!$.fields.pluginType)return!1;switch($.fields.pluginType){case"installed":return $.fields.schemaContent.length>0;case"streamed":return $.fields.schemaContent.length>0&&$.fields.handlerContent.length>0&&$.fields.name.trim().length>0;case"cloned":return!!$.fields.sourcePlugin&&$.fields.aliasName.trim().length>0;default:return!1}}),v=le=>new Promise((he,Oe)=>{const $e=new FileReader;$e.onload=Pe=>{var Ye;const qe=(Ye=Pe.target)==null?void 0:Ye.result;typeof qe=="string"?he(qe):Oe(new Error("Failed to read file as text"))},$e.onerror=Oe,$e.readAsText(le)}),H=async(le,he)=>{const Oe=he[0];if(Oe){if(Oe.size>DM){$.errorMessage=s("custom_plugin_form.errors.file_too_large");return}try{const $e=await v(Oe);le==="schema"?$.fields.schemaContent=$e:$.fields.handlerContent=$e}catch{$.errorMessage=s("custom_plugin_form.errors.file_read_error"),le==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""}}},oe=le=>{le==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""},te=()=>{l.push(i.config.cancelRoute)};e.onMounted(async()=>{if(i.pluginName){A.value=!0,a("loading",!0);try{const le=await b(i.pluginName);if(!le){x.value=s("custom_plugin_form.errors.plugin_not_found"),a("error",new Error(x.value));return}const he=y(le);if($.fields.pluginType=he,he==="installed")$.fields.schemaContent=le.item.lua_schema;else if(he==="streamed"){const{name:Oe,schema:$e,handler:Pe}=le;$.fields.name=Oe,$.fields.schemaContent=$e,$.fields.handlerContent=Pe}else if(he==="cloned"){const{ref:Oe,name:$e,priority:Pe}=le;$.fields.aliasName=$e,$.fields.sourcePlugin=Oe,$.fields.priority=Pe!==null?String(Pe):"",q=$e}else x.value=s("custom_plugin_form.errors.unsupported_plugin_type",{type:he}),a("error",new Error(x.value))}catch(le){x.value=u(le),a("error",le)}finally{A.value=!1,a("loading",!1)}}});const ge=async()=>{$.errorMessage="",$.readonly=!0;try{const le=$.fields.pluginType;if(!le)return;if(le==="installed"){const he={lua_schema:$.fields.schemaContent},Oe=j.value?await f(i.pluginName,he):await d(he);a("update",Oe)}else if(le==="streamed"){const he={name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent},Oe=j.value?await g(i.pluginName,he):await m(he);a("update",Oe)}else{const he=j.value?await k(q,{aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0}):await _({aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0});a("update",{pluginType:"cloned",sourcePlugin:he.ref,aliasName:he.name,priority:he.priority??void 0})}l.push(i.config.successRoute)}catch(le){$.errorMessage=Ew(le)?s("delete.plugin_schema_in_use_message"):u(le),a("error",le)}finally{$.readonly=!1}};return(le,he)=>{const Oe=e.resolveComponent("KSkeleton"),$e=e.resolveComponent("KEmptyState"),Pe=e.resolveComponent("KRadio"),qe=e.resolveComponent("KCollapse"),Ye=e.resolveComponent("KFileUpload"),et=e.resolveComponent("KLabel"),Ve=e.resolveComponent("KAlert"),ke=e.resolveComponent("KSelect"),we=e.resolveComponent("KInput"),ye=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",iM,[e.createVNode(e.unref(Ie.EntityBaseForm),{ref_key:"entityBaseFormRef",ref:C,"can-submit":M.value,config:n.config,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":$.errorMessage,"form-fields":I.value,"is-readonly":$.readonly,"slideout-deck-entity-type":S.value,"slideout-fetch-url":E.value,"slideout-request-method":w.value,onCancel:te,onSubmit:ge},{"form-actions":e.withCtx(()=>[A.value||x.value||R.value?(e.openBlock(),e.createElementBlock("span",LM)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(ye,{appearance:"primary","data-testid":"custom-plugin-form-submit",disabled:!M.value||$.readonly,type:"submit"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.save")),1)]),_:1},8,["disabled"]),e.createVNode(ye,{appearance:"secondary","data-testid":"custom-plugin-form-cancel",disabled:$.readonly,onClick:te},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.cancel")),1)]),_:1},8,["disabled"]),e.createVNode(ye,{appearance:"tertiary","data-testid":"custom-plugin-form-view-configuration",onClick:he[14]||(he[14]=ie=>{var ee;return(ee=C.value)==null?void 0:ee.viewConfig()})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.view_configuration")),1)]),_:1})],64))]),default:e.withCtx(()=>[A.value?(e.openBlock(),e.createBlock(Oe,{key:0,type:"form"})):x.value?(e.openBlock(),e.createBlock($e,{key:1,"action-button-visible":!1,"data-testid":"custom-plugin-form-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(x.value),1)]),_:1})):R.value?(e.openBlock(),e.createBlock($e,{key:2,"action-button-visible":!1,"data-testid":"custom-plugin-form-unsupported-types-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(s)("custom_plugin_form.errors.no_supported_types")),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[W.value?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:0,class:"custom-plugin-form-steps",step:1,title:e.unref(s)("custom_plugin_form.step1.title")},{default:e.withCtx(()=>[e.createElementVNode("div",aM,[X("installed")?(e.openBlock(),e.createBlock(Pe,{key:0,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[0]||(he[0]=ie=>$.fields.pluginType=ie),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-installed",description:e.unref(s)("custom_plugin_form.step1.types.installed.description"),label:e.unref(s)("custom_plugin_form.step1.types.installed.label"),"selected-value":"installed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createBlock(Pe,{key:1,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[1]||(he[1]=ie=>$.fields.pluginType=ie),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-streamed",description:e.unref(s)("custom_plugin_form.step1.types.streamed.description"),label:e.unref(s)("custom_plugin_form.step1.types.streamed.label"),"selected-value":"streamed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createBlock(Pe,{key:2,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[2]||(he[2]=ie=>$.fields.pluginType=ie),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-cloned",description:e.unref(s)("custom_plugin_form.step1.types.cloned.description"),label:e.unref(s)("custom_plugin_form.step1.types.cloned.label"),"selected-value":"cloned"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0)]),e.createVNode(qe,{modelValue:J.value,"onUpdate:modelValue":he[3]||(he[3]=ie=>J.value=ie),class:"custom-plugin-form-compare-collapse","data-testid":"compare-deployment-options","trigger-alignment":"leading","trigger-label":e.unref(s)("custom_plugin_form.step1.compare_trigger")},{default:e.withCtx(()=>[e.createElementVNode("div",sM,[e.createElementVNode("table",lM,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[he[15]||(he[15]=e.createElementVNode("th",{scope:"col"},null,-1)),X("installed")?(e.openBlock(),e.createElementBlock("th",cM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.installed")),1)):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("th",uM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.streamed")),1)):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("th",dM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.cloned")),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("tbody",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",fM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",pM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.installed")),1)):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",mM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.streamed")),1)):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",hM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",gM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",yM,[e.createElementVNode("ul",_M,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.schema")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.additional")),1)])])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",bM,[e.createElementVNode("ul",wM,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.schema")),1)])])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",kM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",CM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",EM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.installed")),1)):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",NM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.streamed")),1)):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",SM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",xM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",AM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",vM,[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step1.compare_table.rows.sandboxing.streamed"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(Ha).customPluginSandboxing},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.streamed_link")),1)]),_:1},8,["href"])]),_:1})])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",IM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",BM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.data_plane_reload.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",TM,[e.createVNode(e.unref(Re.CheckCircleIcon),{color:`var(--kui-color-text-success, ${e.unref(Rh)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",OM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",PM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)])])])])]),_:1},8,["modelValue","trigger-label"])]),_:1},8,["title"])):e.createCommentVNode("",!0),$.fields.pluginType==="installed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:1,class:"custom-plugin-form-steps",step:F(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(Ye,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:j.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!j.value,onFileAdded:he[4]||(he[4]=ie=>H("schema",ie)),onFileRemoved:he[5]||(he[5]=ie=>oe("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createElementVNode("div",VM,[e.createVNode(et,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step2_files.plugin_modules.label")),1)]),_:1}),e.createVNode(Ve,{appearance:"warning",message:e.unref(s)("custom_plugin_form.step2_files.plugin_modules.alert")},null,8,["message"])])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:2,class:"custom-plugin-form-steps",step:F(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(Ye,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:j.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!j.value,onFileAdded:he[6]||(he[6]=ie=>H("schema",ie)),onFileRemoved:he[7]||(he[7]=ie=>oe("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createVNode(Ye,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.handler_file.button_text"),"data-testid":"custom-plugin-handler-upload",help:e.unref(s)("custom_plugin_form.step2_files.handler_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.handler_file.label"),placeholder:j.value&&$.fields.handlerContent?e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder"),required:!j.value,onFileAdded:he[8]||(he[8]=ie=>H("handler",ie)),onFileRemoved:he[9]||(he[9]=ie=>oe("handler"))},null,8,["button-text","help","label","placeholder","required"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:3,class:"custom-plugin-form-steps",step:F(2),title:e.unref(s)("custom_plugin_form.step2_clone.title")},{default:e.withCtx(()=>[e.createVNode(ke,{modelValue:$.fields.sourcePlugin,"onUpdate:modelValue":he[10]||(he[10]=ie=>$.fields.sourcePlugin=ie),"data-testid":"custom-plugin-clone-select","enable-filtering":"",items:ae.value,label:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.label"),placeholder:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.placeholder"),required:""},{"item-template":e.withCtx(({item:ie})=>[e.createElementVNode("div",$M,[e.createVNode(e.unref(Er.PluginIcon),{name:String(ie.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(ie.label),1)])]),"selected-item-template":e.withCtx(({item:ie})=>[e.createElementVNode("div",RM,[e.createVNode(e.unref(Er.PluginIcon),{name:String(ie.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(ie.label),1)])]),_:1},8,["modelValue","items","label","placeholder"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:4,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:F(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(we,{modelValue:$.fields.name,"onUpdate:modelValue":he[11]||(he[11]=ie=>$.fields.name=ie),modelModifiers:{trim:!0},"data-testid":"custom-plugin-name",help:e.unref(s)("custom_plugin_form.step3.name.help"),label:e.unref(s)("custom_plugin_form.step3.name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:5,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:F(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(we,{modelValue:$.fields.aliasName,"onUpdate:modelValue":he[12]||(he[12]=ie=>$.fields.aliasName=ie),modelModifiers:{trim:!0},"data-testid":"custom-plugin-alias-name",help:e.unref(s)("custom_plugin_form.step3.alias_name.help"),label:e.unref(s)("custom_plugin_form.step3.alias_name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.alias_name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"]),e.createVNode(we,{modelValue:$.fields.priority,"onUpdate:modelValue":he[13]||(he[13]=ie=>$.fields.priority=ie),modelModifiers:{trim:!0},"data-testid":"custom-plugin-priority",label:e.unref(s)("custom_plugin_form.step3.priority.label"),"label-attributes":{info:e.unref(s)("custom_plugin_form.step3.priority.tooltip")},readonly:$.readonly,type:"number"},{help:e.withCtx(()=>[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step3.priority.help.text"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(Ha).pluginPriority},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step3.priority.help.link")),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["modelValue","label","label-attributes","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0)],64))]),_:1},8,["can-submit","config","entity-type","error-message","form-fields","is-readonly","slideout-deck-entity-type","slideout-fetch-url","slideout-request-method"])])}}}),[["__scopeId","data-v-0c1e017a"]]),jM=(n,t)=>({type:"array",valueType:"string",valueArrayType:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",validator:"array",styleClasses:"kong-form-field-wrapper",newElementButtonLabel:"+ Add",newElementButtonLabelClasses:"kong-form-new-element-button-label",items:{type:"select",values:n,selectOptions:{hideNoneSelectedText:!0},...(t==null?void 0:t[0])!=null?{default:t[0]}:{}}}),FM={class:"referable-field-item"},UM=24,Nw=Me(e.defineComponent({__name:"ReferableFieldItem",props:{field:{},isLast:{type:Boolean}},setup(n){const t=n,{formatPluginFieldLabel:r}=st.usePluginHelpers(),o=e.computed(()=>t.field.replace(/\./g,"-")),i=e.computed(()=>t.field.replace(/^[cC]onfig\./,"").split(".").map(s=>r(s)).join(".")),a=()=>{if(!o.value)return;const s=`label[for="${o.value}"]`,c=document.querySelector(s)||document.getElementById(o.value);if(!c)return;const l=Math.max(0,c.getBoundingClientRect().top+window.scrollY-UM),u=()=>{var p;(p=c.click)==null||p.call(c)};window.addEventListener("scrollend",u,{once:!0}),window.scrollTo({top:l,behavior:"smooth"})};return(s,c)=>(e.openBlock(),e.createElementBlock("span",FM,[e.createElementVNode("span",{class:"referable-field-link",role:"button",tabindex:"0",onClick:a},e.toDisplayString(i.value),1),n.isLast?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(", ")],64))]))}}),[["__scopeId","data-v-949a9ea1"]]),KM={key:0},qM=Me(e.defineComponent({__name:"PluginFieldRuleAlerts",props:{rules:{}},setup(n){const t=n,{i18n:{t:r},i18nT:o}=st.useI18n(),i=e.computed(()=>{const a=[];if(t.rules.atLeastOneOf)for(const s of t.rules.atLeastOneOf)a.push({key:"plugins.form.field_rules.at_least_one_of",fields:s});if(t.rules.onlyOneOf)for(const s of t.rules.onlyOneOf)a.push({key:"plugins.form.field_rules.only_one_of",fields:s});if(t.rules.mutuallyRequired)for(const s of t.rules.mutuallyRequired)a.push({key:"plugins.form.field_rules.mutually_required",fields:s});return a});return(a,s)=>{const c=e.resolveComponent("KAlert");return e.openBlock(),e.createBlock(c,{class:"plugin-field-rule-alerts"},{default:e.withCtx(()=>[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,({key:l,fields:u},p)=>(e.openBlock(),e.createElementBlock("li",{key:`simple-alert-${p}`},[e.createVNode(e.unref(o),{keypath:l},{parameters:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u,(d,f)=>(e.openBlock(),e.createBlock(Nw,{key:`alert-field-${d}`,field:d,"is-last":f===u.length-1},null,8,["field","is-last"]))),128))]),_:2},1032,["keypath"])]))),128)),t.rules.onlyOneOfMutuallyRequired&&t.rules.onlyOneOfMutuallyRequired.length>0?(e.openBlock(),e.createElementBlock("li",KM,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rules.onlyOneOfMutuallyRequired,(l,u)=>(e.openBlock(),e.createElementBlock("div",{key:`only-one-mutually-alert-${u}`},[e.createElementVNode("div",null,e.toDisplayString(e.unref(r)("plugins.form.field_rules.only_one_of_mutually_required")),1),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,(p,d)=>(e.openBlock(),e.createElementBlock("li",{key:`only-one-mutually-alert-${u}-combination-${d}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,(f,m)=>(e.openBlock(),e.createBlock(Nw,{key:`only-one-mutually-field-${f}`,field:f,"is-last":m===p.length-1},null,8,["field","is-last"]))),128))]))),128))])]))),128))])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-5f9ff453"]]);function GM(n){if(n.length===0)return"";if(n.length===1){const i=mn(n[0]);return gt(...i.slice(0,-1))}const t=n.map(i=>mn(i)),r=Math.min(...t.map(i=>i.length)),o=[];for(let i=0;i<r-1;i++){const a=t[0][i];if(t.every(s=>s[i]===a))o.push(a);else break}return gt(...o)}function op(n){return"at_least_one_of"in n?n.at_least_one_of:"mutually_required"in n?n.mutually_required:"mutually_exclusive"in n?n.mutually_exclusive:null}function HM(n,t){if(!t)return n;const r=t+Pa;return n.map(o=>o.startsWith(r)?o.slice(r.length):o)}function zM(n,t){const r=op(n),o=HM(r,t);return"at_least_one_of"in n?{at_least_one_of:o}:"mutually_required"in n?{mutually_required:o}:{mutually_exclusive:o}}function WM(n){const t=[],r=new Map;for(const o of n){const i=op(o);if(!i){t.push(o);continue}const a=GM(i);if(!a){t.push(o);continue}const s=zM(o,a);r.has(a)||r.set(a,[]),r.get(a).push(s)}return{keep:t,move:r}}function YM(n,t,r){const o=mn(t);let i=n;for(const a of o){const s=i.fields.find(l=>Object.keys(l)[0]===a);if(!s)return;const c=s[a];if(c.type!=="record")return;i=c}i.entity_checks=[...i.entity_checks||[],...r]}function Sw(n){var t;if((t=n.entity_checks)!=null&&t.length){const{keep:r,move:o}=WM(n.entity_checks);n.entity_checks=r.length?r:void 0;for(const[i,a]of o)YM(n,i,a)}for(const r of n.fields){const o=Object.values(r)[0];o.type==="record"&&Sw(o)}}function JM(n){const t=JSON.parse(JSON.stringify(n)),r={fields:t.fields};return Sw(r),t.fields=r.fields,t}function XM(n,t){const r=$n[n];if(!r||!r.fieldRules)return t;const o=ZM(r.fieldRules),i={...t};return i.fields=i.fields.map(a=>{if(Object.keys(a)[0]==="config"){const c=a.config.entity_checks||[],l=d=>{const m=[...op(d)??[]].slice().sort();return`${Object.keys(d)[0]}:${m.join(",")}`},u=new Set(c.map(l)),p=o.filter(d=>{const f=l(d);return u.has(f)?!1:(u.add(f),!0)});return{config:{...a.config,entity_checks:[...c,...p]}}}return a}),i}function ZM(n){const t=[],r=o=>o.startsWith("config.")?o.substring(7):o;return n.atLeastOneOf&&n.atLeastOneOf.forEach(o=>{t.push({at_least_one_of:o.map(r)})}),n.onlyOneOf&&n.onlyOneOf.forEach(o=>{t.push({mutually_exclusive:o.map(r)})}),n.mutuallyRequired&&n.mutuallyRequired.forEach(o=>{t.push({mutually_required:o.map(r)})}),n.onlyOneOfMutuallyRequired&&n.onlyOneOfMutuallyRequired.forEach(o=>{if(o.forEach(i=>{t.push({mutually_required:i.map(r)})}),o.length>1)for(let i=0;i<o.length;i++)for(let a=i+1;a<o.length;a++){const s=o[i].map(r),c=o[a].map(r);s.forEach(l=>{c.forEach(u=>{t.push({mutually_exclusive:[l,u]})})})}}),t}const QM={class:"kong-ui-entities-plugin-form"},ej={key:1,class:"entity-form"},tj={class:"plugin-config-empty-state"},nj=Me(e.defineComponent({__name:"PluginEntityForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},entityMap:{type:Object,default:()=>({})},record:{type:Object,default:()=>({})},schema:{type:Object,default:()=>({})},rawSchema:{type:Object,default:()=>({})},editing:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},enableRedisPartial:{type:Boolean,default:!1},engine:{type:String,required:!1,default:void 0},developer:{type:Boolean,default:!1}},emits:["loading","model-updated","showNewPartialModal","globalAction","click:learn-more","click:create-entity","validity-change"],setup(n,{emit:t}){var et,Ve;const r=t,o=n,i=e.computed(()=>{if(o.config.app!=="konnect")return!1;const ke=o.config;return!!ke.isKonnectManagedRedisEnabled&&ke.isCloudGateway===!0}),a=e.inject(ur.KM_2306_CONDITION_FIELD_314,!1),s=e.inject(ur.KHCP_20393_IDENTITY_PRINCIPALS_UI,!1),{axiosInstance:c}=Ie.useAxios((et=o.config)==null?void 0:et.axiosRequestConfig),{parseSchema:l}=st.useSchemas({entityId:((Ve=o.entityMap.focusedEntity)==null?void 0:Ve.id)||void 0,credential:o.credential,enableRedisPartial:o.enableRedisPartial,experimentalRenders:o.config.app==="konnect"?o.config.experimentalRenders:void 0}),{convertToDotNotation:u,unFlattenObject:p,dismissField:d,isObjectEmpty:f,unsetNullForeignKey:m}=st.usePluginHelpers(),{shouldUseFreeForm:g,getFreeFormComponent:y}=st.useFreeFormResolver(),b=e.inject(Ie.PLUGIN_FORM_LAYOUT_STATE),_=ke=>{b&&(b.value=ke)},{objectsAreEqual:k}=Ie.useHelpers(),{i18n:{t:C}}=Je(),N=ke=>{let we=ke;return o.config.app==="konnect"&&(we=we.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||"")),we.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")},E=(ke,we)=>{let ye=`${o.config.apiBaseUrl}${Qe.form[o.config.app].entityGetOne}`;return ye=N(ye),ye=ye.replace(/{entity}/gi,ke),ye=ye.replace(/{id}/gi,we),ye},w=ke=>{let we=`${o.config.apiBaseUrl}${Qe.form[o.config.app].entityGetAll}`;return we=N(we),we=we.replace(/{entity}/gi,ke),we},S=(ke,we,ye)=>{const ie=E(ke,we);return c.get(ie,ye)},I=(ke,we)=>{const ye=w(ke);return o.config.app==="konnect"?c.get(ye).then(ie=>{const{data:{data:ee}}=ie;if(delete we.size,delete we.offset,ee.length&&Object.keys(we).length===1){const se=Object.keys(we)[0],ue=ee.filter(Ee=>Ee[se]?!!Ee[se].toLowerCase().includes(we[se].toLowerCase()):!1);ie.data.data=ue}return ie}):c.get(ye,{params:we})},j=(ke,we,ye)=>{const ie=w(ke);if(o.config.app==="konnect"){const{size:ee,offset:se,...ue}=we;if(ke==="consumer_groups")return c.get(ie,{params:{size:1e3},signal:ye}).then(_e=>{const{data:{data:xe}}=_e;if(xe.length&&Object.keys(ue).length===1){const h=Object.keys(ue)[0],T=xe.filter(G=>G[h]?!!G[h].toLowerCase().includes(ue[h].toLowerCase()):!1);_e.data.data=T}return _e});const Ee={size:ee,offset:se};for(const _e of Object.keys(ue))Ee.filter={[_e]:{contains:ue[_e]}};return c.get(ie,{params:Ee,signal:ye})}return c.get(ie,{params:we,signal:ye})},A=(ke,we=50)=>{const ye=w(ke);return c.get(ye,{params:{size:we}})};e.provide(Ze.FORMS_API_KEY,{getOne:S,getAll:I,getAllV2:j,peek:A}),e.provide(Ze.FORMS_CONFIG,o.config);const x=e.ref(""),O=e.ref(),P=e.shallowRef(),R=e.ref(null),W=e.ref({}),Z=e.reactive({}),X=e.reactive({}),F=e.computed(()=>{var ke;return(ke=R.value)==null?void 0:ke.options}),J=e.computed(()=>{const ke=XM(X.name,o.rawSchema);return JM(ke)}),$=e.ref(!1),q=e.ref(),K=(ke,we)=>{$.value=ke??"",q.value=we},ae=ke=>{var we;(we=q.value)==null||we.call(q,ke),$.value=!1},M=ke=>{var ye;if(!ke){O.value=void 0,P.value=void 0,x.value="",_(!1);return}const we=((ye=o.schema)==null?void 0:ye._sourcePlugin)||ke;O.value=mw(we),P.value=g(we,o.engine)?y(we)??Hf:void 0,x.value=Ze.getSharedFormName(we),_(!!P.value)},v=ke=>{var Ee,_e;const we={...o.schema},ye=X,ie=Z,ee=Object.keys(ye),se={};if(!f(W.value))for(let xe=0;xe<((_e=(Ee=W.value)==null?void 0:Ee.fields)==null?void 0:_e.length);xe++)we[W.value.fields[xe].model]=W.value.fields[xe];Ze.customFields.forEach(xe=>{we[xe]&&(we[xe].fields.forEach(h=>{h.fields&&h.fields.forEach(T=>{we[T.model]=T}),h.model&&(we[h.model]=h)}),delete we[xe])}),ee.forEach(xe=>{var Ne;if(!we[xe]){xe==="partials"&&(se[xe]=ye[xe]);return}const h=we[xe];let T=ye[xe];const G=ie[xe],Y=Array.isArray(T)?"array":typeof T,re=h?h.valueType:null,be=h?h.valueArrayType:null,L=h?h.transform:null;if(T==null&&G==null&&!h.submitWhenNull)return;if(h){if(re&&Y!==re)switch(re){case"array":Y==="string"&&T.length&&(T=T.split(",").map(z=>{if(z=z.trim(),be==="string")return String(z);if(be==="number")return Number(z);if(be==="boolean"){if(typeof z=="string")return z.toLowerCase()==="true"||z==="1";if(typeof z=="number")return z===1}return z})),(!T||!T.length)&&(T=h.submitWhenNull?null:[]);break;case"number":h.referenceable!==!0&&(T=Number(T));break;case"boolean":Y==="string"&&(T=T.toLowerCase()==="true"||T==="1"),Y==="number"&&(T=T===1);break;case"string":T=T==null?"":String(T);break}else re==="array"&&(!T||!T.length?T=h.submitWhenNull?null:[]:((Ne=h.inputAttributes)==null?void 0:Ne.type)==="number"&&(T=T.map(z=>Number(z))));if(h.type==="array"&&h.nestedFields){const z=V=>{Object.keys(V).forEach(D=>{V[D]&&typeof V[D]=="object"&&!Array.isArray(V[D])&&V[D]!==null?z(V[D]):(V[D]===void 0||V[D]===null||typeof V[D]=="number"&&isNaN(V[D])||typeof V[D]=="string"&&V[D].trim().length===0)&&delete V[D]})};T&&typeof T=="object"&&z(T)}h.type==="object-advanced"&&h.fields&&T!==null&&(Object.entries(T).length===0?T=null:Object.keys(T).forEach(z=>{Array.isArray(T[z])||(T[z]=T[z].split(","))}))}let de=u(xe);if(h.fieldNameHasDashes){const[z,...V]=de.split(".").reverse();de=[z.replace(/_/g,"-"),...V].reverse().join(".")}if(re==="object-expand"){let z;[de,z]=de.split(".");let V={};se[de]&&(V=se[de]),V[z]=T,T=V}G!==void 0&&T===""&&T!==G?se[de]=re==="object"?{}:null:h.type==="checklist"&&T===""?se[de]=[]:T!==""&&(se[de]=T),se[de]=L?L(T):se[de],m(de,se)});const ue=p(se);if(P.value){if(ke&&ke.length)for(const xe of ke)delete ue[xe];Object.assign(ue,$e.value)}return ue},H=(ke,we={})=>{d(X,we,ke,o.editing),r("model-updated",{model:X,originalModel:Z,data:v()})},oe=(ke,we)=>{var ee;const ye={[we]:ke};typeof((ee=o.schema[we])==null?void 0:ee.modelTransformer)=="function"&&(ye[we]=o.schema[we].modelTransformer(ke));const ie=Object.assign({},X,ye);Object.assign(X,ie),r("model-updated",{model:X,originalModel:Z,data:v()})},te=ke=>{r("validity-change",ke)},ge=(ke,we)=>{Object.keys(ke).forEach(ye=>{var Ee,_e;let ie=we?`${we}-${ye}`:ye,ee=o.schema[ie];if(!ee){const xe=we?`${we}-${ye.replace(/-/g,"_")}`:ye.replace(/-/g,"_");(Ee=o.schema[xe])!=null&&Ee.fieldNameHasDashes&&(ie=xe,ee=o.schema[ie]),we&&((_e=o.schema[we])==null?void 0:_e.keyFromObject)===ye&&(ie=we,ee=o.schema[ie])}const se=ke[ye],ue=typeof se;if(ee&&ee.type==="object-advanced"&&!se){X[ie]={},Z[ie]={};return}if(Array.isArray(se)){X[ie]=JSON.parse(JSON.stringify(se)),Z[ie]=JSON.parse(JSON.stringify(se));return}if(ue==="object"&&se&&!se.length)return ge(se,ie);if(ue==="object"&&se&&se.length&&ee.type==="input"){X[ie]=se.join(", "),Z[ie]=se.join(", ");return}X[ie]=se,Z[ie]=se}),r("model-updated",{model:X,originalModel:Z,data:v()})},me=(ke,we)=>{if(!we)return ke;if(Array.isArray(ke)){const ee=we.elements;return ee?ke.map(se=>me(se,ee)):ke}if(!ke||typeof ke!="object")return ke;if(we.type==="map"&&we.values){const ee=we.values,se={};for(const ue of Object.keys(ke))se[ue]=me(ke[ue],ee);return se}if(!Array.isArray(we.fields))return ke;const ye=new Map;for(const ee of we.fields){const se=ee&&Object.keys(ee)[0];se&&ye.set(se,ee[se])}const ie={};for(const ee of Object.keys(ke)){const se=ye.get(ee);se&&(ie[ee]=me(ke[ee],se))}return ie},le=()=>{var ye;const ke=(ye=o.rawSchema)==null?void 0:ye.fields;if(!Array.isArray(ke))return;const we=ke.find(ie=>ie==null?void 0:ie.config);return we==null?void 0:we.config},he=new Set(["datakit"]),Oe=e.computed(()=>{var ke;return((ke=o.schema)==null?void 0:ke._sourcePlugin)||X.name}),$e=e.shallowRef(o.record),Pe=(ke,we)=>{const ye=he.has(Oe.value)?ke:{...ke,config:me(ke.config,le())};$e.value=ye;const ie={...X};for(const ee of we||[])delete ie[ee];r("model-updated",{model:{...ie,...ye},originalModel:Z,data:v(we)})},qe=e.ref(!0),Ye=()=>{var ke;if(o.record&&o.schema&&(ge({enabled:o.record.enabled??!0,...o.record.instance_name&&{instance_name:o.record.instance_name||""},...a&&o.record.condition!=null&&{condition:o.record.condition},...o.record.protocols&&{protocols:o.record.protocols},...o.record.tags&&{tags:o.record.tags}}),o.credential?((o.record.consumer_id||o.record.consumer)&&ge({consumer_id:o.record.consumer_id||o.record.consumer}),ge(o.record)):o.record.config&&((o.record.consumer_id||o.record.consumer||o.record.service_id||o.record.service||o.record.route_id||o.record.route||o.record.consumer_group_id||o.record.consumer_group)&&ge({service_id:o.record.service_id||o.record.service,route_id:o.record.route_id||o.record.route,consumer_id:o.record.consumer_id||o.record.consumer,consumer_group_id:o.record.consumer_group_id||o.record.consumer_group}),o.record.partials&&H("redis",{partials:o.record.partials}),P.value?Pe(o.record):ge(o.record.config,"config"))),Object.keys(o.entityMap).length&&!o.entityMap.global&&o.schema){const we={};for(const ye in o.entityMap){const ie=o.entityMap[ye].id,ee=o.entityMap[ye].idField,se=ee==="consumer_group_id"?"consumer_group-id":JSON.parse(JSON.stringify(ee).replace("_","-"));Object.prototype.hasOwnProperty.call(X,se)&&(we[se]=ie)}ge(we)}if((ke=o.entityMap.consumer)!=null&&ke.id&&o.schema&&o.credential){const we={};Object.prototype.hasOwnProperty.call(X,"consumer")&&(we.consumer=o.entityMap.consumer.id),ge(we)}qe.value=!1};return e.watch(qe,ke=>{r("loading",ke)}),e.watch(()=>o.schema,(ke,we)=>{var ie,ee;if(k(ke||{},we||{}))return;const ye=l(ke,void 0,void 0,o.engine);Object.assign(X,ye.model),W.value={fields:(ee=(ie=W.value)==null?void 0:ie.fields)==null?void 0:ee.map(se=>({...se,disabled:se.disabled||!1}))},Object.assign(Z,JSON.parse(JSON.stringify(ye.model))),M(ye.model.name),Ye()},{immediate:!0,deep:!0}),e.onBeforeMount(()=>{var ke,we,ye,ie;R.value=l(o.schema,void 0,void 0,o.engine),Object.assign(X,((ke=R.value)==null?void 0:ke.model)||{}),W.value=((we=R.value)==null?void 0:we.schema)||{},M((ie=(ye=R.value)==null?void 0:ye.model)==null?void 0:ie.name),Ye()}),e.onBeforeUnmount(()=>{_(!1)}),(ke,we)=>{var ie,ee,se;const ye=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",QM,[qe.value?(e.openBlock(),e.createBlock(ye,{key:0,type:"form"})):X.id&&n.editing||!n.editing?(e.openBlock(),e.createElementBlock("div",ej,[P.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P.value),{key:0,developer:n.developer,"field-renderers":(ie=O.value)==null?void 0:ie.fieldRenderers,"form-model":X,"form-schema":W.value,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:n.record,"on-form-change":Pe,"on-validity-change":te,"plugin-name":X.name,"render-rules":(ee=O.value)==null?void 0:ee.renderRules,schema:J.value,"onClick:createEntity":we[0]||(we[0]=ue=>ke.$emit("click:create-entity",ue)),"onClick:learnMore":we[1]||(we[1]=ue=>ke.$emit("click:learn-more",ue)),onGlobalAction:we[2]||(we[2]=(ue,Ee)=>ke.$emit("globalAction",ue,Ee))},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(Ze.AUTOFILL_SLOT_NAME),fn:e.withCtx(ue=>[ue.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPickerProvider),e.mergeProps({key:0},ue,{onOpen:K}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["developer","field-renderers","form-model","form-schema","is-editing","is-konnect-managed-redis-enabled","model","plugin-name","render-rules","schema"])):x.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Ze.sharedForms)[x.value]),{key:1,"enable-redis-partial":n.enableRedisPartial,"form-model":X,"form-options":F.value,"form-schema":W.value,"identity-principals-ui-enabled":e.unref(s),"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,"on-model-updated":oe,"on-partial-toggled":H,"show-new-partial-modal":ue=>ke.$emit("showNewPartialModal",ue)},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(Ze.AUTOFILL_SLOT_NAME),fn:e.withCtx(ue=>[ue.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPickerProvider),e.mergeProps({key:0},ue,{onOpen:K}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["enable-redis-partial","form-model","form-options","form-schema","identity-principals-ui-enabled","is-editing","is-konnect-managed-redis-enabled","show-new-partial-modal"])):(e.openBlock(),e.createBlock(e.unref(Ze.VueFormGenerator),{key:2,"enable-redis-partial":n.enableRedisPartial,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:X,options:F.value,schema:W.value,onModelUpdated:oe,onPartialToggled:H,onRefreshModel:v,onShowNewPartialModal:we[3]||(we[3]=ue=>ke.$emit("showNewPartialModal",ue))},e.createSlots({"plugin-config-empty-state":e.withCtx(()=>[e.createElementVNode("div",tj,e.toDisplayString(e.unref(C)("plugins.form.grouping.plugin_configuration.empty")),1)]),_:2},[(se=e.unref($n)[X.name])!=null&&se.fieldRules&&(o.config.isNewOtelSchema||X.name!=="opentelemetry")?{name:"plugin-config-before-content",fn:e.withCtx(()=>[e.createVNode(qM,{rules:e.unref($n)[X.name].fieldRules},null,8,["rules"])]),key:"0"}:void 0,n.enableVaultSecretPicker?{name:e.unref(Ze.AUTOFILL_SLOT_NAME),fn:e.withCtx(ue=>[ue.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPickerProvider),e.mergeProps({key:0},ue,{onOpen:K}),null,16)):e.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["enable-redis-partial","is-editing","is-konnect-managed-redis-enabled","model","options","schema"]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(da.VaultSecretPicker),{config:o.config,setup:$.value,onCancel:we[4]||(we[4]=()=>$.value=!1),onProceed:ae},null,8,["config","setup"])],64)}}}),[["__scopeId","data-v-4c91d036"]]),rj={key:1},oj=e.defineComponent({__name:"PluginFormActionsWrapper",props:{teleportTarget:{type:String,default:""}},setup(n){return(t,r)=>n.teleportTarget?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:n.teleportTarget},[e.renderSlot(t.$slots,"default")],8,["to"])):(e.openBlock(),e.createElementBlock("div",rj,[e.renderSlot(t.$slots,"default")]))}}),ij={key:0},aj={class:"plugin-form-actions"},sj={key:0,class:"button-customize-deck-wrapper"},lj=Me(e.defineComponent({__name:"PluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},pluginType:{type:String,required:!0},pluginId:{type:String,default:null},hideScopeSelection:{type:Boolean,default:!1},disableScopeSelection:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},developer:{type:Boolean,default:!1},isWizardStep:{type:Boolean,default:!1},actionsTeleportTarget:{type:String,default:""},noCardWrapper:{type:Boolean,default:!1},hideViewConfigAction:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},schema:{type:Object,default:null},enableRedisPartial:{type:Boolean,default:!1},scopedEntitiesPermissions:{type:Object,default:null},engine:{type:String,required:!1,default:void 0}},emits:["cancel","error:fetch-schema","error","loading","update","model-updated","showNewPartialModal","globalAction","click:learn-more","click:create-entity"],setup(n,{emit:t}){var de,Ne;const r=e.inject(ur.KM_2306_CONDITION_FIELD_314,!1),o=e.inject(ur.KM_2485_CLONED_PLUGINS,!1),i=e.ref(!1);e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,i);const a=t,s=n,c=Nr.useRouter(),{i18n:{t:l}}=st.useI18n(),{customSchemas:u,typedefs:p}=st.useSchemas({app:s.config.app,credential:s.credential,experimentalRenders:s.config.app==="konnect"?s.config.experimentalRenders:void 0}),{formatPluginFieldLabel:d}=st.usePluginHelpers(),{shouldUseFreeForm:f}=st.useFreeFormResolver(),{getMessageFromError:m}=Ie.useErrors(),{capitalize:g}=Ie.useStringHelpers(),{objectsAreEqual:y}=Ie.useHelpers(),{axiosInstance:b}=Ie.useAxios((de=s.config)==null?void 0:de.axiosRequestConfig),{getClonedPlugin:_}=st.useCustomPluginApi({axiosInstance:Ie.useAxios({...((Ne=s.config)==null?void 0:Ne.axiosRequestConfig)??{},konnect:{bypassGlobal404Handler:!0}}).axiosInstance,apiBaseUrl:s.config.apiBaseUrl,app:s.config.app,workspace:s.config.workspace,controlPlaneId:s.config.controlPlaneId}),k=e.ref(!1),C=e.computed(()=>!!s.pluginId),N=e.computed(()=>s.pluginId?Ie.EntityBaseFormType.Edit:Ie.EntityBaseFormType.Create),E=e.ref(void 0),w=e.ref(void 0),S=e.computed(()=>!!(s.credential&&s.config.entityId)),I=e.ref(void 0),j=e.ref({}),A=e.ref(),x=e.ref(),O=e.inject(ur.KM_2503_CUSTOM_PLUGIN_FREEFORM,!1),P=e.ref(null),R=e.computed(()=>P.value!==null),W=e.computed(()=>R.value&&P.value?P.value:s.pluginType),Z=e.computed(()=>{if(s.engine)return s.engine;if(!(!O||!_e.value))return R.value&&P.value?f(P.value)?"freeform":"vfg":"freeform"});e.provide(Ai,{redisType:A,redisPath:x,isEditing:C.value});const X=[];e.provide(Kb,z=>(X.push(z),()=>{const V=X.indexOf(z);V!==-1&&X.splice(V,1)}));const F=e.ref(!1),{isDeckEnabled:J,deckCustomizationOptions:$,deckCalloutPreferenceKey:q}=Ie.useBaseFormDeckOptions(()=>s.config,Ie.SupportedEntityType.Plugin),K=e.ref(!1),ae=e.reactive({enabled:!0,protocols:[],tags:[]}),M=e.reactive({fields:{enabled:!0,protocols:[],tags:[]},isReadonly:!1,clientErrorMessage:"",serverErrorMessage:""}),v=e.ref([{title:l("view_configuration.json"),hash:"#json"},{title:l("view_configuration.yaml"),hash:"#yaml"}]);s.config.app==="konnect"&&v.value.splice(1,0,{title:l("view_configuration.terraform"),hash:"#terraform"}),J.value&&v.value.push({title:l("view_configuration.deck"),hash:"#deck"});const H=e.ref(v.value[0].hash),oe=e.ref(""),te=e.computed(()=>{var V;if(S.value){let D=Qe.form[s.config.app].credential[N.value];return D=D.replace(/{resourceEndpoint}/gi,he.value),D}let z;return s.config.entityType&&s.config.entityId?z=Qe.form[s.config.app].edit.forEntity.replace(/{entityType}/gi,s.config.entityType).replace(/{entityId}/gi,s.config.entityId):z=Qe.form[s.config.app].edit.all,s.config.app==="konnect"&&((V=$n[s.pluginType])!=null&&V.useUIData)?`${z}?__ui_data=true`:z}),ge=()=>{k.value=!k.value},me=e.computed(()=>{var Ce,Se,ve,ze,Ke,Be,Ae,Xe;const z=s.config.entityType==="consumers"&&s.config.entityId||((Se=(Ce=I.value)==null?void 0:Ce.consumer)==null?void 0:Se.id),V=s.config.entityType==="consumer_groups"&&s.config.entityId||((ze=(ve=I.value)==null?void 0:ve.consumer_group)==null?void 0:ze.id),D=s.config.entityType==="services"&&s.config.entityId||((Be=(Ke=I.value)==null?void 0:Ke.service)==null?void 0:Be.id),ne=s.config.entityType==="routes"&&s.config.entityId||((Xe=(Ae=I.value)==null?void 0:Ae.route)==null?void 0:Xe.id);if(!(z||V||D||ne))return{global:{entity:fe.PluginScope.GLOBAL,entityEndpoint:"plugins"}};const ce={};return D&&(ce.service={entity:fe.PluginScope.SERVICE,entityEndpoint:"services",id:D,idField:yo.SERVICE}),ne&&(ce.route={entity:fe.PluginScope.ROUTE,entityEndpoint:"routes",id:ne,idField:yo.ROUTE}),z&&(ce.consumer={entity:fe.PluginScope.CONSUMER,entityEndpoint:"consumers",id:z,idField:yo.CONSUMER}),V&&(ce.consumer_group={entity:fe.PluginScope.CONSUMER_GROUP,entityEndpoint:"consumer_groups",id:V,idField:yo.CONSUMER_GROUP}),s.config.entityType&&(ce.focusedEntity={entity:fe.PluginScope[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()],entityEndpoint:s.config.entityType,id:s.config.entityId,idField:yo[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()]}),ce}),le=e.reactive({name:{default:s.pluginType,type:"input",inputType:"hidden",styleClasses:"d-none hidden-field",pinned:!0},enabled:{type:"switch",model:"enabled",label:l("plugins.form.fields.enabled.label"),textOn:l("plugins.form.fields.enabled.on_text"),textOff:l("plugins.form.fields.enabled.off_text"),styleClasses:"field-switch hide-label",default:!0,pinned:!0},selectionGroup:{type:s.hideScopeSelection&&(s.hideScopeSelection||N.value===Ie.EntityBaseFormType.Create&&s.config.entityId)?"foreign":"selectionGroup",disabled:s.disableScopeSelection,inputType:"hidden",styleClasses:"hide-label",fields:[{label:l("plugins.form.scoping.global.label"),description:l("plugins.form.scoping.global.help")}],pinned:!0},protocols:{id:"protocols",default:[],help:l("plugins.form.fields.protocols.help"),label:l("plugins.form.fields.protocols.label"),required:!0,styleClasses:"plugin-protocols-select",type:"multiselect",values:[{label:"grpc",value:"grpc"},{label:"grpcs",value:"grpcs"},{label:"http",value:"http"},{label:"https",value:"https"},{label:"tcp",value:"tcp"},{label:"tls",value:"tls"},{label:"tls_passthrough",value:"tls_passthrough"},{label:"udp",value:"udp"},{label:"ws",value:"ws"},{label:"wss",value:"wss"}]},instance_name:{default:"",type:"input",label:l("plugins.form.fields.instance_name.label"),inputType:"text",help:l("plugins.form.fields.instance_name.help")},tags:p.tags,...r?{condition:{default:"",type:"input",label:l("plugins.form.fields.condition.label"),inputType:"text",help:l("plugins.form.fields.condition.tooltip"),placeholder:l("plugins.form.fields.condition.placeholder")}}:{}}),he=e.computed(()=>{var D;const z=s.developer?"developers":"consumers",V=((D=si[s.pluginType])==null?void 0:D.endpoint)||"/plugins";return`${z}/${s.config.entityId}${s.developer?"/credentials":""}${V}`}),Oe=z=>{const V=Array.from(new Set(z.map(D=>typeof D)));return V.length>1?"string":V[0]},$e=(z,V,D,ne)=>{var ve,ze;let ce=V&&V.fields||[];const Ce=u[W.value],Se=(ze=(ve=si[s.pluginType])==null?void 0:ve.schema)==null?void 0:ze.fields;return Array.isArray(ce)&&(ce=ce.reduce((Ke,Be)=>{const Ae=Object.keys(Be)[0];return Ae.match(/-/g)?Ke[Ae.replace(/-/g,"_")]={...Be[Ae],fieldNameHasDashes:!0}:Ke[Ae]=Be[Ae],Ke},{})),Object.keys(ce).sort().forEach(Ke=>{var Lt,ar,xt,Zt,Xs,Zs,Qs;const Be=ce[Ke];Be.type==="set"&&!(f(s.pluginType,Z.value)&&Be.elements.one_of)&&(Be.type="array");const Ae=z?`${z}-${Ke}`:`${Ke}`;if((Lt=Ce==null?void 0:Ce.fieldsToDelete)!=null&&Lt.includes(Ae)){by(D,Ae);return}if(Object.prototype.hasOwnProperty.call(Be,"overwrite")||Be.hidden)return;if(Be.type==="table")return $e(Ae,Be.schema,D);if(Be.fields)return ne&&Be.type==="record"?(D[Ae]={type:"object",model:Ke,schema:{fields:Object.values($e(Ae,Be,{},!0))}},D):$e(Ae,Be,D);if(D[Ae]={id:Ae,model:Ke},D[Ae].type=Be.type==="boolean"?"checkbox":"input",D[Ae].required=Be.required,D[Ae].referenceable=Be.referenceable,Ae.startsWith("config-"))if(!ne&&Be.type==="array"&&(oe.value=Ae),ne&&oe.value&&Ae.startsWith(oe.value)){const ut=Ae.slice(oe.value.length+1);D[Ae].label=ut.split("-").map(d).join(".")}else D[Ae].label=d(Ae);if((z==="config"||z.startsWith("config-"))&&(ar=ce[Ke])!=null&&ar.description&&(D[Ae].help=el.marked.parse(ce[Ke].description,{mangle:!1,headerIds:!1})),Be.type==="map"){if(D[Ae].type="object-advanced",D[Ae].values=Be.values,Be.values.type==="array"){const{type:ut}=Be.values.elements||{};D[Ae].schema={fields:[{schema:{fields:[{...dt,model:Ae,valueArrayType:ut==="integer"?"number":ut||"string",inputAttributes:{...dt.inputAttributes,type:ut==="integer"?"number":"text",inputMode:ut==="integer"?"numeric":"text"}}]}}]}}else Be.values.fields&&(D[Ae].schema={fields:[{type:"object",model:"object",schema:{fields:Be.values.fields.map(ut=>{const Qt=Object.keys(ut)[0];return{model:Qt,type:"input",label:g(Qt),placeholder:Qt,inputType:ut[Qt].type}})}}]});return D}if(Be.enum&&Be.type==="array"&&(D[Ae].type="checklist",D[Ae].values=Be.enum,D[Ae].multi=!0,D[Ae].multiSelect=!0),Be.one_of&&Be.type!=="array"&&(D[Ae].type="select",D[Ae].values=Be.one_of,D[Ae].selectOptions={noneSelectedText:l("plugins.form.no_selection")}),Be.elements&&Be.type==="array"){const ut=Be.elements;if(D[Ae].referenceable=ut.referenceable,D[Ae].elements=ut,["string","integer","number"].includes(ut.type)&&!ut.one_of){const{id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On}=D[Ae],{inputAttributes:Hn,...vh}=JSON.parse(JSON.stringify(dt));Hn.type=ut.type==="string"?"text":"number",D[Ae]={id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,inputAttributes:Hn,...vh}}else if(["string","integer","number"].includes(ut.type)&&ut.one_of){if(ne){const{id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On}=D[Ae];D[Ae]={id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,...jM(ut.one_of,Be.default)}}}else if(ut.type==="array"){const{id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,elements:Hn}=D[Ae],{inputAttributes:vh,...Z8}=JSON.parse(JSON.stringify(dt));D[Ae]={id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,elements:Hn,inputAttributes:vh,...Z8}}}if(Be.hint&&(D[Ae].hint=Be.hint),Ce&&!Ce.overwriteDefault&&Object.keys(Ce).forEach(ut=>{if(ut===Ae){const{help:Qt,label:At,hint:ht,values:lt,referenceable:Ct,elements:_t}=D[Ae],{help:On,...Hn}=Ce[ut];D[Ae]={help:Qt,label:At,hint:ht,values:lt,referenceable:Ct,elements:_t,...Hn},typeof On=="string"&&(D[Ae].help=el.marked.parse(On,{mangle:!1,headerIds:!1}))}}),Be.type==="array"&&((xt=Be.elements)==null?void 0:xt.type)==="record"&&Array.isArray(Be.elements.fields)){let ut={};for(const At of Be.elements.fields)ut={...ut,...At};const Qt=(Zs=(Xs=(Zt=D[Ae])==null?void 0:Zt.items)==null?void 0:Xs.schema)==null?void 0:Zs.fields;if(Array.isArray(Qt))for(const At of D[Ae].items.schema.fields){const ht=(Qs=ut[At.model])==null?void 0:Qs.description;At.help===void 0&&typeof ht=="string"&&(At.help=el.marked.parse(ht,{mangle:!1,headerIds:!1}))}if(Qt||(D[Ae].type="array",D[Ae].newElementButtonLabelClasses="kong-form-new-element-button-label",D[Ae].fieldClasses="array-card-container-wrapper",D[Ae].itemContainerComponent="FieldArrayCardContainer",D[Ae].items={type:"object",schema:{fields:Object.values($e(Ae,Be.elements,{},!0))}},D[Ae].items.schema.fields.forEach(At=>{var ht,lt;for(const Ct of Be.elements.fields){const _t=Object.keys(Ct)[0],On=((lt=(ht=At.id)==null?void 0:ht.split)==null?void 0:lt.call(ht,"-"))??[];if(On[On.length-1]===_t){At.model=_t,At.label=d(_t);break}}}),Be.elements.type==="record"&&(D[Ae].nestedFields=!0)),!D[Ae].nestedFields)D[Ae].items.default=()=>Be.elements.fields.reduce((At,ht)=>{const lt=Object.keys(ht)[0];return At[lt]=ht[lt].default,At},{});else{const At=(ht,lt)=>{if(ht.type==="object"){ht.model&&(lt[ht.model]={});for(const Ct of ht.schema.fields)At(Ct,ht.model?lt[ht.model]:lt)}else ht.model&&(lt[ht.model]=ht.default)};D[Ae].items.default=()=>{const ht={};return At(D[Ae].items,ht),ht}}}if(S.value&&Se){for(let ut=0;ut<Se.length;ut++)if(Se[ut][Ae]){D[Ae]={...D[Ae],...Se[ut][Ae]};break}}if(Be.required&&Be.type!=="boolean"&&(D[Ae].required=!0,D[Ae].selectOptions={hideNoneSelectedText:!0}),Be.required&&Be.type==="boolean"&&(D[Ae].default=Be.default??!1),Be.default!=null&&typeof Be.default!="object"&&Be.default!=="function"&&(D[Ae].default=Be.default),D[Ae].type==="input"){["string","number"].includes(typeof D[Ae].default)&&s.config.app==="konnect"&&(D[Ae].placeholder=`Default: ${D[Ae].default===""?"<empty string>":D[Ae].default}`);const{type:ut}=Be.elements||{};ut&&(D[Ae].valueArrayType=ut==="integer"?"number":ut),D[Ae].inputType=Be.type==="array"||Be.type==="string"?Be.encrypted?"password":"text":Be.type}let Xe="string";Be.enum?Xe=Oe(Be.enum):Be.type==="boolean"?Xe="boolean":Be.type==="number"||Be.type==="integer"?(Xe="number",D[Ae].inputType="number"):Be.type==="array"?(Xe="array",D[Ae].default=Be.default,Be.len_min>0&&(D[Ae].submitWhenNull=!0)):Be.type==="foreign"?Xe="object":Be.default&&Array.isArray(Be.default)?(Xe="array",D[Ae].valueArrayType=Oe(Be.default)):Be.default&&(Xe=typeof Be.default),D[Ae].valueType=Xe,Be.fieldNameHasDashes&&(D[Ae].fieldNameHasDashes=!0)}),D},Pe=()=>{var Xe,Lt,ar,xt,Zt,Xs,Zs,Qs,ut,Qt,At,ht;const z=R.value&&P.value?P.value:s.pluginType,V=((Xe=$n[z])==null?void 0:Xe.scope.includes(fe.PluginScope.SERVICE))??!0,D=((Lt=$n[z])==null?void 0:Lt.scope.includes(fe.PluginScope.ROUTE))??!0,ne=((ar=$n[z])==null?void 0:ar.scope.includes(fe.PluginScope.CONSUMER))??!0,ce=s.config.disableConsumerGroupScope?!1:((xt=$n[z])==null?void 0:xt.scope.includes(fe.PluginScope.CONSUMER_GROUP))??!0,Ce=s.config.entityType==="consumers"&&!!s.config.entityId||!!((Xs=(Zt=I.value)==null?void 0:Zt.consumer)!=null&&Xs.id),Se=s.config.entityType==="consumer_groups"&&!!s.config.entityId||!!((Qs=(Zs=I.value)==null?void 0:Zs.consumer_group)!=null&&Qs.id),ve=s.config.entityType==="services"&&!!s.config.entityId||!!((Qt=(ut=I.value)==null?void 0:ut.service)!=null&&Qt.id),ze=s.config.entityType==="routes"&&!!s.config.entityId||!!((ht=(At=I.value)==null?void 0:At.route)!=null&&ht.id),Ke=[],Be=(lt,Ct,_t)=>lt?l("plugins.form.disable_source_scope_change",{scope:_t}):Ct?l("plugins.form.disable_data_retrieving",{scope:_t}):"",Ae=lt=>{var Ct,_t;return((_t=(Ct=s.scopedEntitiesPermissions)==null?void 0:Ct[lt])==null?void 0:_t.canRetrieve)===!1};if(V){const lt=Ae("service"),Ct="services",_t=ve&&s.disableScopeSelection;Ke.push({id:"service-id",model:"service-id",label:l("plugins.form.scoping.gateway_service.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",labelField:"name",entity:Ct,inputValues:{fields:["name","id"]},help:l("plugins.form.scoping.gateway_service.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(D){const lt=Ae("route"),Ct="routes",_t=ze&&s.disableScopeSelection;Ke.push({id:"route-id",model:"route-id",label:l("plugins.form.scoping.route.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Ct,labelField:"name",inputValues:{fields:["name","id"],primaryField:"id"},help:l("plugins.form.scoping.route.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(ne){const lt=Ae("consumer"),Ct="consumers",_t=Ce&&s.disableScopeSelection;Ke.push({model:"consumer-id",label:l("plugins.form.scoping.consumer.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Ct,labelField:"username",inputValues:{fields:["username","custom_id","id"],primaryField:"username"},help:l("plugins.form.scoping.consumer.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(ce){const lt=Ae("consumer_group"),Ct="consumer_groups",_t=Se&&s.disableScopeSelection;Ke.push({model:"consumer_group-id",label:l("plugins.form.scoping.consumer_group.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Ct,entityDataKey:"consumer_group",labelField:"name",inputValues:{fields:["name","id"],primaryField:"name"},help:l("plugins.form.scoping.consumer_group.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(Ke.length){const lt=[...V?["service"]:[],...D?["route"]:[],...ne?["consumer"]:[],...ce?["consumer_group"]:[]],_t=lt.splice(lt.length-2,2).map(Hn=>l(Hn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Hn}.plural`)).join(`${lt.length>0?",":""} and/or `),On=["Specific",[...lt.length>0?[lt.map(Hn=>l(Hn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Hn}.plural`)).join(", ")]:[],_t].join(", ")].join(" ");le.selectionGroup.fields.push({label:l("plugins.form.scoping.label"),description:On,fields:[]}),le.selectionGroup.fields[1].fields=Ke}u[W.value]&&u[W.value].overwriteDefault&&Object.hasOwnProperty.call(u[W.value],"formSchema")&&Object.assign(le,u[W.value].formSchema)},qe=e.computed(()=>!y(M.fields,ae,!0)),Ye=e.computed(()=>!re.value&&!K.value&&(N.value===Ie.EntityBaseFormType.Create||qe.value)),et=e.ref(!1),Ve=e.ref(),ke=z=>{s.credential&&z.password&&(z.password=""),M.fields.id=(z==null?void 0:z.id)||void 0,Ve.value=z==null?void 0:z.ordering,Object.assign(ae,M.fields),I.value=z,et.value=!0},we=e.ref({}),ye=z=>{var V;M.fields=z.model,M.fields.id=((V=I.value)==null?void 0:V.id)||void 0,Object.assign(ae,z.originalModel),we.value=z.data,s.isWizardStep&&a("model-updated",{model:M.fields,data:z.data,resourceEndpoint:he.value})},ie=e.ref(new Map),ee=e.computed(()=>[M.clientErrorMessage,M.serverErrorMessage].filter(Boolean).join("; ")),se=z=>{z.valid?ie.value.delete(z.model):ie.value.set(z.model,z.error),M.clientErrorMessage=[...ie.value.entries()].map(([V,D])=>`${V}: ${typeof D=="string"?D:m(D)}`).join("; "),M.clientErrorMessage&&(M.serverErrorMessage="")};e.watch([me,et],(z,V)=>{const D=z[0]!==V[0],ne=z[1],ce=V[1];if(!S.value&&N.value===Ie.EntityBaseFormType.Edit&&(D||ne&&ne!==ce)){const Ce=$e("config",j.value,le);_e.value&&(Ce._isCustomPlugin=!0),R.value&&P.value&&(Ce._sourcePlugin=P.value),A.value&&(Ce._supported_redis_partial_type=A.value),w.value=Ce}},{deep:!0});const ue=()=>{s.config.cancelRoute?c.push(s.config.cancelRoute):a("cancel")},Ee=e.computed(()=>{const z=s.config.entityType&&s.config.entityId&&!s.developer,V=S.value?Qe.form[s.config.app].credential[N.value]:Qe.form[s.config.app][N.value][z?"forEntity":"all"];let D=`${s.config.apiBaseUrl}${V}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D=D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:""),D=D.replace(/{resourceEndpoint}/gi,he.value),D=D.replace(/{id}/gi,s.pluginId??""),D=D.replace(/{entityType}/gi,s.config.entityType||""),D=D.replace(/{entityId}/gi,s.config.entityId||""),D}),_e=e.computed(()=>!Object.keys($n).includes(s.pluginType)),xe=e.computed(()=>{const z=we.value;if(S.value){for(const V in fe.PluginScope){const D=fe.PluginScope[V];z[D]&&!z[D].id&&(z[D]={id:s.config.entityId})}delete z.created_at}return we.value.partials&&x.value&&by(z,x.value),z}),h=e.computed(()=>{const{__ui_data:z,...V}={...xe.value};return V}),T=async()=>{if(X.every(z=>z())&&!M.clientErrorMessage&&!s.isWizardStep)try{M.isReadonly=!0;let z;const V=JSON.parse(JSON.stringify(xe.value)),D=u[W.value];typeof(D==null?void 0:D.shamefullyTransformPayload)=="function"&&D.shamefullyTransformPayload({originalModel:ae,model:M.fields,payload:V,schema:w.value}),N.value==="create"?z=await b.post(Ee.value,V):N.value==="edit"&&(z=s.config.app==="konnect"||A.value&&V.partials?await b.put(Ee.value,Object.assign({ordering:Ve.value},V)):await b.patch(Ee.value,V)),Object.assign(ae,M.fields),a("update",z==null?void 0:z.data)}catch(z){M.serverErrorMessage=m(z),a("error",z)}finally{M.isReadonly=!1}},G=e.computed(()=>{var ne;const z=S.value?(ne=si[s.pluginType])==null?void 0:ne.schemaEndpoint:s.pluginType,V=S.value?Qe.form[s.config.app].credentialSchema:Qe.form[s.config.app].pluginSchema;let D=`${s.config.apiBaseUrl}${V}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:"").replace(/{plugin}/gi,z)}),Y=e.ref(""),re=e.ref(!1),be=e.ref("");e.onBeforeMount(async()=>{var z,V,D,ne;re.value=!0;try{if(S.value&&s.config.app==="konnect"){const ce=(z=si[s.pluginType])==null?void 0:z.schemaEndpoint,Ce=UB[ce];Y.value=ce,w.value=$e("",Ce,{}),re.value=!1}else{const ce=o&&_e.value,Ce=s.schema?Promise.resolve(s.schema):b.get(G.value).then(ve=>ve.data),[Se]=await Promise.all([Ce,ce?L(s.pluginType):Promise.resolve()]);if(E.value=Se,Se)if(S.value)w.value=$e("",Se,{}),re.value=!1;else{const ve=Se.fields.find(Ke=>Ke.config);j.value=ve?ve.config:Se,Se.supported_partials&&(A.value=Object.keys(Se.supported_partials).find(Ke=>[Il.REDIS_CE,Il.REDIS_EE].includes(Ke)),x.value=(V=Se.supported_partials[A.value])==null?void 0:V[0]),Pe();const ze=(D=Se.fields.find(Ke=>Ke.protocols))==null?void 0:D.protocols;if(ze){const{default:Ke=[],elements:Be={}}=ze;le.protocols.default=Ke,le.protocols.placeholder=s.config.app==="konnect"?l("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:Ke.join(", ")}):l("plugins.form.fields.protocols.placeholder"),(ne=Be.one_of)!=null&&ne.length&&(le.protocols.values=Be.one_of.map(Ae=>({label:Ae,value:Ae})))}if(et.value||N.value===Ie.EntityBaseFormType.Create){const Ke=$e("config",j.value,le);A.value&&(Ke._supported_redis_partial_type=A.value),_e.value&&(Ke._isCustomPlugin=!0),R.value&&P.value&&(Ke._sourcePlugin=P.value),w.value=Ke}}}}catch(ce){console.error(ce),be.value=m(ce),a("error:fetch-schema",ce)}finally{re.value=!1}});async function L(z){var V;try{const D=await _(z);P.value=(D==null?void 0:D.ref)??null}catch(D){if(zo.isAxiosError(D)&&((V=D.response)==null?void 0:V.status)===404)return;throw D}}return(z,V)=>{const D=e.resolveComponent("KSkeleton"),ne=e.resolveComponent("KEmptyState"),ce=e.resolveComponent("KButton"),Ce=e.resolveComponent("KTabs"),Se=e.resolveComponent("KSlideout");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["kong-ui-entities-plugin-form-container",{"new-form-layout":i.value}])},[re.value?(e.openBlock(),e.createBlock(D,{key:0,type:"form"})):be.value?(e.openBlock(),e.createBlock(ne,{key:1,"action-button-visible":!1,"data-testid":"plugin-form-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(l)("errors.load_schema")),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseForm),{key:2,"can-submit":Ye.value,config:n.config,"edit-id":n.pluginId,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":ee.value,"fetch-url":te.value,"form-fields":xe.value,"is-readonly":M.isReadonly,"no-validate":"","wrapper-component":n.noCardWrapper?"div":void 0,onCancel:ue,"onFetch:error":V[6]||(V[6]=ve=>z.$emit("error",ve)),"onFetch:success":ke,onLoading:V[7]||(V[7]=ve=>z.$emit("loading",ve))},{"form-actions":e.withCtx(()=>[n.isWizardStep?(e.openBlock(),e.createElementBlock("div",ij)):(e.openBlock(),e.createBlock(oj,{key:1,"teleport-target":n.actionsTeleportTarget},{default:e.withCtx(()=>[e.createElementVNode("div",aj,[n.hideViewConfigAction?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(ce,{key:0,appearance:"tertiary","data-testid":`plugin-${C.value?"edit":"create"}-form-view-configuration`,onClick:V[5]||(V[5]=ve=>ge())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.view_configuration")),1)]),_:1},8,["data-testid"])),e.createVNode(ce,{appearance:"secondary",class:"form-action-button","data-testid":`plugin-${C.value?"edit":"create"}-form-cancel`,disabled:M.isReadonly,onClick:ue},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.cancel")),1)]),_:1},8,["data-testid","disabled"]),e.createVNode(ce,{appearance:"primary","data-testid":`plugin-${C.value?"edit":"create"}-form-submit`,disabled:!Ye.value||M.isReadonly,type:"submit",onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.save")),1)]),_:1},8,["data-testid","disabled"])])]),_:1},8,["teleport-target"]))]),default:e.withCtx(()=>[e.createElementVNode("form",{hidden:"",onSubmit:T},null,32),e.createVNode(nj,{config:n.config,credential:S.value,developer:n.developer,editing:N.value===e.unref(Ie.EntityBaseFormType).Edit,"enable-redis-partial":n.enableRedisPartial,"enable-vault-secret-picker":s.enableVaultSecretPicker,engine:Z.value,"entity-map":me.value,"raw-schema":E.value,record:I.value,schema:w.value,"onClick:createEntity":V[0]||(V[0]=ve=>z.$emit("click:create-entity",ve)),"onClick:learnMore":V[1]||(V[1]=ve=>z.$emit("click:learn-more",ve)),onGlobalAction:V[2]||(V[2]=(ve,ze)=>z.$emit("globalAction",ve,ze)),onLoading:V[3]||(V[3]=ve=>K.value=ve),onModelUpdated:ye,onShowNewPartialModal:V[4]||(V[4]=ve=>z.$emit("showNewPartialModal",ve)),onValidityChange:se},null,8,["config","credential","developer","editing","enable-redis-partial","enable-vault-secret-picker","engine","entity-map","raw-schema","record","schema"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly","wrapper-component"])),e.createVNode(Se,{"close-on-blur":!1,"data-testid":"form-view-configuration-slideout","has-overlay":!1,"offset-top":60,title:e.unref(l)("view_configuration.title"),visible:k.value,onClose:ge},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(l)("view_configuration.message")),1),e.createVNode(Ce,{modelValue:H.value,"onUpdate:modelValue":V[11]||(V[11]=ve=>H.value=ve),"data-testid":"form-view-configuration-slideout-tabs",tabs:v.value},{json:e.withCtx(()=>[e.createVNode(e.unref(Ie.JsonCodeBlock),{config:n.config,"entity-record":h.value,"fetcher-url":Ee.value,"request-method":s.pluginId?"put":"post"},null,8,["config","entity-record","fetcher-url","request-method"])]),yaml:e.withCtx(()=>[e.createVNode(e.unref(Ie.YamlCodeBlock),{"deck-callout-preference-key":e.unref(J)?e.unref(q):void 0,"entity-record":h.value,"onDeckCallout:clickCta":V[8]||(V[8]=ve=>H.value="#deck")},null,8,["deck-callout-preference-key","entity-record"])]),terraform:e.withCtx(()=>[e.createVNode(e.unref(Ie.TerraformCodeBlock),{"credential-type":Y.value,"entity-record":h.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin},null,8,["credential-type","entity-record","entity-type"])]),deck:e.withCtx(()=>[e.unref($)?(e.openBlock(),e.createElementBlock("div",sj,[e.createVNode(ce,{appearance:"secondary",class:"button-customize-deck",onClick:V[9]||(V[9]=ve=>F.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("plugins.form.button_deck_customize")),1)]),_:1})])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.DeckCodeBlock),{app:n.config.app,"control-plane-name":n.config.app==="konnect"?n.config.controlPlaneName:void 0,"customization-options":e.unref($),"entity-record":h.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"geo-api-server-url":n.config.app==="konnect"?n.config.geoApiServerUrl:void 0,"is-customization-modal-visible":F.value,"kong-admin-api-url":n.config.app==="kongManager"?n.config.apiBaseUrl:void 0,workspace:n.config.workspace||void 0,onCustomizationClose:V[10]||(V[10]=ve=>F.value=!1)},null,8,["app","control-plane-name","customization-options","entity-record","entity-type","geo-api-server-url","is-customization-modal-visible","kong-admin-api-url","workspace"])]),_:1},8,["modelValue","tabs"])]),_:1},8,["title","visible"])],2)}}}),[["__scopeId","data-v-08254428"]]),cj={class:"kong-ui-entities-plugins-list"},uj={class:"button-row"},dj={class:"name-cell-wrapper"},fj={class:"info-wrapper"},pj={key:0,class:"info-name"},mj={key:1,class:"info-name"},hj={key:2,class:"info-type"},gj={key:1},yj=Me(e.defineComponent({__name:"PluginList",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.createRoute||!n.getViewRoute||!n.getEditRoute||!n.getConfigureDynamicOrderingRoute||n.app==="kongManager"&&!n.isExactMatch&&!n.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canToggle:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},canRetrieveScopedEntity:{type:Function,required:!1,default:async()=>!0},canConfigureDynamicOrdering:{type:Function,required:!1,default:async()=>!0},title:{type:String,default:""},titleTag:{type:String,default:"h2"},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","toggle-enabled"],setup(n,{emit:t}){var Ye,et;const r=st.usePluginMetaData(),o=t,i=n,{i18n:{t:a}}=st.useI18n(),s=Nr.useRouter(),{axiosInstance:c}=Ie.useAxios((Ye=i.config)==null?void 0:Ye.axiosRequestConfig),{hasRecords:l,handleStateChange:u}=Ie.useTableState(()=>C.value),p=e.computed(()=>l.value&&i.config.app==="konnect"),d=e.computed(()=>!!i.config.entityId),f=e.computed(()=>{var Ve;return((Ve=i.config)==null?void 0:Ve.entityType)==="consumers"}),m=e.computed(()=>{var Ve;return((Ve=i.config)==null?void 0:Ve.entityType)==="consumer_groups"}),g=i.config.app==="konnect"||Ie.useGatewayFeatureSupported({gatewayInfo:i.config.gatewayInfo,supportedRange:{enterprise:["3.0"]}}),y=e.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),b={name:{label:a("plugins.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};(et=i.config)!=null&&et.entityId||(b.appliedTo={label:a("plugins.list.table_headers.applied_to"),sortable:!1}),b.enabled={label:a("plugins.list.table_headers.enabled"),searchable:!0,sortable:!0},g&&(b.ordering={label:a("plugins.list.table_headers.ordering"),sortable:!0}),b.tags={label:a("plugins.list.table_headers.tags"),sortable:!1};const _=b,k=e.computed(()=>{var ke,we,ye,ie;let Ve=i.config.entityType?`${i.config.apiBaseUrl}${Qe.list[i.config.app].forEntity}`:`${i.config.apiBaseUrl}${Qe.list[i.config.app].all}`;return i.config.app==="konnect"&&(Ve=Ve.replace(/{controlPlaneId}/gi,((ke=i.config)==null?void 0:ke.controlPlaneId)||"")),Ve.replace(/\/{workspace}/gi,(we=i.config)!=null&&we.workspace?`/${i.config.workspace}`:"").replace(/{entityType}/gi,((ye=i.config)==null?void 0:ye.entityType)||"").replace(/{entityId}/gi,((ie=i.config)==null?void 0:ie.entityId)||"")}),C=e.ref(""),N=e.computed(()=>i.config.app==="konnect"||i.config.isExactMatch?{isExactMatch:!0,fields:{name:b.name,id:{label:a("plugins.list.table_headers.id"),sortable:!0}},placeholder:a(`search.placeholder.${i.config.isExactMatch?"exact":i.config.app}`)}:{isExactMatch:!1,fields:{enabled:{...b.enabled,label:a("search.filter.field.enabled")},name:b.name,instance_name:{label:a("plugins.list.table_headers.instance_name"),searchable:!0}},schema:i.config.filterSchema}),{fetcher:E,fetcherState:w,fetcherCacheKey:S}=Ie.useFetcher(e.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),k),I=()=>{C.value=""},j=()=>{S.value++},A=e.ref(null),x=Ve=>{var we,ye,ie,ee;const ke=[];return((we=Ve.route)!=null&&we.id||Ve.route_id)&&ke.push({type:"route",badgeText:a("plugins.list.table_headers.applied_to_badges.route")}),((ye=Ve.service)!=null&&ye.id||Ve.service_id)&&ke.push({type:"service",badgeText:a("plugins.list.table_headers.applied_to_badges.service")}),((ie=Ve.consumer)!=null&&ie.id||Ve.consumer_id)&&ke.push({type:"consumer",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer")}),((ee=Ve.consumer_group)!=null&&ee.id||Ve.consumer_group_id)&&ke.push({type:"consumer_group",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer_group")}),ke.length?ke:[{type:null,badgeText:a("plugins.list.table_headers.applied_to_badges.global")}]},O=async(Ve,ke)=>{var we;return Ve===null?!1:await((we=i.canRetrieveScopedEntity)==null?void 0:we.call(i,Ve,ke.id))},P=(Ve,ke)=>{var ye,ie,ee,se,ue;let we=null;switch(Ve){case"route":we=(ye=ke.route)==null?void 0:ye.id;break;case"service":we=(ie=ke.service)==null?void 0:ie.id;break;case"consumer":we=(ee=ke.consumer)==null?void 0:ee.id;break;case"consumer_group":we=(se=ke.consumer_group)==null?void 0:se.id;break}we&&((ue=i.config)!=null&&ue.getScopedEntityViewRoute)&&s.push(i.config.getScopedEntityViewRoute(Ve,we))},R=e.ref(!1),W=e.ref(null),Z=e.computed(()=>{const Ve={action:"disable",id:"",name:""};if(W.value){const{enabled:ke,id:we,name:ye}=W.value;Ve.action=ke?"disable":"enable",Ve.id=we,Ve.name=r.getDisplayName(ye)||we}return Ve}),X=Ve=>{R.value=!0,W.value=Ve},F=()=>{R.value=!1,W.value=null},J=async()=>{var ye,ie,ee,se,ue,Ee,_e,xe;if(!await((ye=i.canEdit)==null?void 0:ye.call(i,W.value))||!W.value)return;let ke=`${i.config.apiBaseUrl}${(ue=Qe.item[i.config.app])==null?void 0:ue[(ie=i.config)!=null&&ie.entityType?"forEntity":"all"].replace(/{entityType}/gi,((ee=i.config)==null?void 0:ee.entityType)||"").replace(/{entityId}/gi,((se=i.config)==null?void 0:se.entityId)||"")}`.replace(/{id}/gi,W.value.id||"");i.config.app==="konnect"&&(ke=ke.replace(/{controlPlaneId}/gi,((Ee=i.config)==null?void 0:Ee.controlPlaneId)||"")),ke=ke.replace(/\/{workspace}/gi,(_e=i.config)!=null&&_e.workspace?`/${i.config.workspace}`:"");const we=!W.value.enabled;try{const h=(xe=i.config)==null?void 0:xe.app;let T;C.value&&h==="konnect"&&(T=await c.get(ke));const{data:G}=h==="konnect"?await c.put(ke,{...(T==null?void 0:T.data)||W.value,enabled:we},{timeout:12e4}):await c.patch(ke,{...W.value,enabled:we},{timeout:12e4});o("toggle-enabled",we,G),W.value.enabled=we}catch(h){o("error",h)}},$=async(Ve,ke)=>{const we=Ve.id;if(!await ke(we)){o("copy:error",{entity:Ve,field:"id",message:a("errors.copy")});return}o("copy:success",{entity:Ve,field:"id",message:a("copy.success",{val:we})})},q=async(Ve,ke)=>{const we=JSON.stringify(Ve);if(!await ke(we)){o("copy:error",{entity:Ve,message:a("errors.copy")});return}o("copy:success",{entity:Ve,message:a("copy.success_brief")})},K=async Ve=>{var we;await((we=i.canRetrieve)==null?void 0:we.call(i,Ve))&&s.push(i.config.getViewRoute(Ve))},ae=Ve=>({label:a("actions.view"),to:i.config.getViewRoute(Ve)}),M=Ve=>({label:a("actions.edit"),to:i.config.getEditRoute(Ve)}),v=Ve=>({label:a("actions.configure_dynamic_ordering"),to:i.config.getConfigureDynamicOrderingRoute(Ve)}),H=e.ref(void 0),oe=e.ref(!1),te=e.ref(!1),ge=e.ref(""),me=Ie.useDeleteUrlBuilder(i.config,k.value),le=Ve=>{H.value=Ve,oe.value=!0},he=()=>{oe.value=!1},Oe=async()=>{var Ve,ke,we;if((Ve=H.value)!=null&&Ve.id){te.value=!0;try{await c.delete(me(H.value.id)),te.value=!1,oe.value=!1,S.value++,o("delete:success",H.value)}catch(ye){ge.value=((we=(ke=ye.response)==null?void 0:ke.data)==null?void 0:we.message)||ye.message||a("errors.delete"),o("error",ye)}finally{te.value=!1}}},$e=()=>{s.push(i.config.createRoute)};e.watch(w,Ve=>{var ke,we,ye;if(Ve.status===Ie.FetcherStatus.Error){A.value={title:a("errors.general")},(ye=(we=(ke=Ve.error)==null?void 0:ke.response)==null?void 0:we.data)!=null&&ye.message&&(A.value.message=Ve.error.response.data.message),o("error",Ve.error);return}A.value=null});const Pe=e.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${a("plugins.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:a("plugins.title")}),qe=e.ref(!1);return e.onBeforeMount(async()=>{qe.value=await i.canCreate(),qe.value&&(Pe.value.title=a("plugins.list.empty_state.title"),Pe.value.ctaText=a("actions.create"))}),(Ve,ke)=>{const we=e.resolveComponent("KButton"),ye=e.resolveComponent("KEmptyState"),ie=e.resolveComponent("KBadge"),ee=e.resolveComponent("KTruncate"),se=e.resolveComponent("KInputSwitch"),ue=e.resolveComponent("KDropdownItem"),Ee=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",cj,[e.createVNode(e.unref(Ie.EntityBaseTable),{"cache-identifier":n.cacheIdentifier,"disable-sorting":y.value,"empty-state-options":Pe.value,"enable-entity-actions":"","error-message":A.value,fetcher:e.unref(E),"fetcher-cache-key":e.unref(S),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-plugins-list",query:C.value,"table-headers":e.unref(_),title:n.title,"title-tag":n.titleTag,onClearSearchInput:I,"onClick:row":ke[4]||(ke[4]=_e=>K(_e)),onSort:j,onState:e.unref(u)},e.createSlots({"toolbar-filter":e.withCtx(()=>[e.createVNode(e.unref(Ie.EntityFilter),{modelValue:C.value,"onUpdate:modelValue":ke[0]||(ke[0]=_e=>C.value=_e),config:N.value},null,8,["modelValue","config"])]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!n.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createElementVNode("div",uj,[!d.value&&p.value?(e.openBlock(),e.createBlock(we,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"plugins-learn-more-button",icon:"",onClick:ke[1]||(ke[1]=_e=>Ve.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.BookIcon),{decorative:""})]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canCreate()},{default:e.withCtx(()=>[e.createVNode(we,{appearance:"primary","data-testid":"toolbar-add-plugin",size:n.useActionOutside?"medium":"large",to:n.config.createRoute},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.toolbar_actions.new_plugin")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:e.withCtx(({row:_e})=>[e.createElementVNode("div",dj,[e.createVNode(e.unref(Er.PluginIcon),{class:"plugin-icon",name:_e.name,size:24},null,8,["name"]),e.createElementVNode("div",fj,[_e.instance_name?(e.openBlock(),e.createElementBlock("span",pj,e.toDisplayString(_e.instance_name),1)):(e.openBlock(),e.createElementBlock("span",mj,e.toDisplayString(e.unref(r).getDisplayName(_e.name)),1)),_e.instance_name?(e.openBlock(),e.createElementBlock("span",hj,e.toDisplayString(e.unref(r).getDisplayName(_e.name)),1)):e.createCommentVNode("",!0)])])]),appliedTo:e.withCtx(({row:_e})=>[x(_e).length>0?(e.openBlock(),e.createBlock(ee,{key:0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x(_e),xe=>(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:xe.badgeText,"auth-function":()=>O(xe.type,_e),"force-show":""},{default:e.withCtx(({isAllowed:h})=>[e.createVNode(ie,{class:e.normalizeClass(h||"disabled"),onClick:e.withModifiers(T=>h&&xe.type&&P(xe.type,_e),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(xe.badgeText),1)]),_:2},1032,["class","onClick"])]),_:2},1032,["auth-function"]))),128))]),_:2},1024)):(e.openBlock(),e.createElementBlock("span",gj,"-"))]),enabled:e.withCtx(({row:_e})=>[e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":async()=>!!(await n.canEdit(_e)&&await n.canToggle(_e)),"force-show":""},{default:e.withCtx(({isAllowed:xe})=>{var h,T;return[e.createElementVNode("div",{onClick:ke[3]||(ke[3]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(se,{disabled:!xe,"disabled-tooltip-text":!xe&&((T=(h=n.config).getToggleDisabledTooltip)==null?void 0:T.call(h,_e))||void 0,"model-value":_e.enabled,onClick:e.withModifiers(G=>xe&&X(_e),["stop","prevent"])},null,8,["disabled","disabled-tooltip-text","model-value","onClick"])])]}),_:2},1032,["auth-function"])]),ordering:e.withCtx(({rowValue:_e})=>[e.createVNode(ie,{appearance:e.unref(hy)(_e)?"info":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(hy)(_e)?e.unref(a)("plugins.list.table_headers.ordering_badge.static"):e.unref(a)("plugins.list.table_headers.ordering_badge.dynamic")),1)]),_:2},1032,["appearance"])]),tags:e.withCtx(({rowValue:_e})=>[e.createVNode(e.unref(Ie.TableTags),{tags:_e},null,8,["tags"])]),actions:e.withCtx(({row:_e})=>[e.createVNode(Ee,null,{default:e.withCtx(({copyToClipboard:xe})=>[e.createVNode(ue,{"data-testid":"action-entity-copy-id",onClick:h=>$(_e,xe)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_id")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(Ee,null,{default:e.withCtx(({copyToClipboard:xe})=>[e.createVNode(ue,{"data-testid":"action-entity-copy-json",onClick:h=>q(_e,xe)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_json")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canRetrieve(_e)},{default:e.withCtx(()=>[e.createVNode(ue,{"data-testid":"action-entity-view","has-divider":"",item:ae(_e)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canEdit(_e)},{default:e.withCtx(()=>[e.createVNode(ue,{"data-testid":"action-entity-edit",item:M(_e)},null,8,["item"])]),_:2},1032,["auth-function"]),!f.value&&!m.value&&e.unref(g)?(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:0,"auth-function":()=>n.canConfigureDynamicOrdering(_e)},{default:e.withCtx(()=>[v(_e)?(e.openBlock(),e.createBlock(ue,{key:0,"data-testid":"action-entity-config-dyn-order",item:v(_e)},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["auth-function"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canDelete(_e)},{default:e.withCtx(()=>[e.createVNode(ue,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:xe=>le(_e)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!C.value&&n.config.app==="konnect"?{name:"empty-state",fn:e.withCtx(()=>{var _e;return[e.createVNode(ye,{"data-testid":n.config.entityId?"nested-plugins-entity-empty-state":"plugins-entity-empty-state","icon-background":"",message:e.unref(a)("plugins.list.empty_state_v2.description"),title:e.unref(a)("plugins.list.empty_state_v2.title")},e.createSlots({icon:e.withCtx(()=>[e.createVNode(e.unref(Re.PlugIcon),{decorative:""})]),action:e.withCtx(()=>[qe.value?(e.openBlock(),e.createBlock(we,{key:0,"data-testid":"entity-create-button",onClick:$e},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.create_cta")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(we,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:ke[2]||(ke[2]=xe=>Ve.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(_e=n.config)!=null&&_e.isControlPlaneGroup?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["data-testid","message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","title","title-tag","onState"]),e.createVNode(e.unref(Ie.EntityToggleModal),{action:Z.value.action,"entity-id":Z.value.id,"entity-name":Z.value.name,"entity-type":e.unref(a)("glossary.plugin"),"on-confirm":J,visible:R.value,onCancel:F,onProceed:F},null,8,["action","entity-id","entity-name","entity-type","visible"]),e.createVNode(e.unref(Ie.EntityDeleteModal),{"action-pending":te.value,description:e.unref(a)("delete.description"),"entity-name":H.value&&(H.value.instance_name||H.value.name||H.value.id),"entity-type":e.unref(Ie.EntityTypes).Plugin,error:ge.value,title:e.unref(a)("delete.title"),visible:oe.value,onCancel:he,onProceed:Oe},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-88f8302b"]]),_j={class:"plugin-select-card-wrapper"},bj=["data-testid"],wj={class:"plugin-card-header"},kj={class:"plugin-card-title"},Cj={key:0,class:"plugin-card-actions"},Ej=["data-testid","title"],Nj={key:0,class:"plugin-card-text"},Sj={key:0,class:"custom-plugin-badges"},xj=["title"],ip=Me(e.defineComponent({__name:"PluginSelectCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},plugin:{type:Object,required:!0},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Nr.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!E.value||N.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?o.canDeleteClonedPlugin:o.canDeleteCustomPlugin),f=e.computed(()=>p.value?o.canEditClonedPlugin:o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),g=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(E.value&&!N.value&&m.value&&o.navigateOnClick&&(y.value||g.value))),_=()=>{i.push(o.config.getCreateRoute(o.plugin.id))},k=()=>{o.navigateOnClick?_():C()},C=()=>{r("plugin-clicked",o.plugin)},N=e.computed(()=>o.plugin.id==="custom-plugin-create"),E=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),w=()=>{E.value&&r("custom-plugin-delete")},S=(j,A)=>{const x=o.config;typeof x.getCustomEditRoute=="function"&&i.push(x.getCustomEditRoute(j,A))},I=()=>{if(!l.value&&E.value){const j=o.config;N.value&&j.createCustomRoute?i.push(j.createCustomRoute):E.value&&_()}};return(j,A)=>{const x=e.resolveComponent("KButton"),O=e.resolveComponent("KDropdownItem"),P=e.resolveComponent("KDropdownMenu"),R=e.resolveComponent("KBadge"),W=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",_j,[e.createVNode(W,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createElementVNode("a",{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,role:"button",onClick:A[1]||(A[1]=Z=>l.value||E.value?void 0:k())},[e.createElementVNode("div",wj,[e.createElementVNode("div",kj,[e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!E.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",Cj,[e.createVNode(P,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150"},{default:e.withCtx(()=>[e.createVNode(x,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[g.value?(e.openBlock(),e.createBlock(O,{key:0,"data-testid":"edit-plugin-schema",onClick:A[0]||(A[0]=e.withModifiers(Z=>S(n.plugin.name,n.plugin.customPluginType),["stop"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(O,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":g.value,onClick:e.withModifiers(w,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["plugin-card-body",{"custom-plugin":E.value}]),"data-testid":n.plugin.name,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip"),onClick:I},[e.createVNode(e.unref(Er.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),n.plugin.description||c.value.length?(e.openBlock(),e.createElementBlock("div",Nj,[c.value.length?(e.openBlock(),e.createElementBlock("div",Sj,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,Z=>(e.openBlock(),e.createBlock(R,{key:Z,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Z),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),n.plugin.description?(e.openBlock(),e.createElementBlock("p",{key:1,class:"plugin-card-text",title:n.plugin.description},e.toDisplayString(n.plugin.description),9,xj)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,Ej),e.createElementVNode("div",{class:"plugin-card-footer",onClick:I},e.toDisplayString(N.value?e.unref(a)("actions.create_custom"):n.plugin.exists?e.unref(a)("actions.enabled"):e.unref(a)("actions.enable")),1)],10,bj)]),_:1},8,["text"])])}}}),[["__scopeId","data-v-23ad176e"]]),fc=Me(e.defineComponent({__name:"DeleteCustomPluginSchemaModal",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app))},plugin:{type:Object,required:!0}},emits:["closed","proceed"],setup(n,{emit:t}){var m;const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getMessageFromError:a}=Ie.useErrors(),{axiosInstance:s}=Ie.useAxios((m=r.config)==null?void 0:m.axiosRequestConfig),c=e.computed(()=>{var g;return p.value?i("delete.plugin_schema_in_use_title"):i("delete.title",{name:((g=r.plugin)==null?void 0:g.name)||i("delete.custom_plugin")})}),l=e.ref(!1),u=e.ref(""),p=e.ref(!1),d=e.computed(()=>{const g=r.plugin.customPluginType;if(r.config.app==="konnect"){const y=g==="streaming"?Qe.select[r.config.app].streamingCustomPluginItem:g==="cloned"?Qe.customPlugin[r.config.app].cloned.edit:Qe.select[r.config.app].schemaCustomPluginItem;return`${r.config.apiBaseUrl}${y}`.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"").replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{pluginId}/gi,r.plugin.id)}if(r.config.app==="kongManager"&&g&&g!=="schema"){const y=g==="cloned"?Qe.customPlugin[r.config.app].cloned.edit:Qe.customPlugin[r.config.app].streamed.edit;return`${r.config.apiBaseUrl}${y}`.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{pluginId}/gi,r.plugin.id)}return null}),f=async()=>{var g;if(l.value=!0,u.value="",!((g=r.plugin)!=null&&g.name)){l.value=!1;return}try{d.value&&await s.delete(d.value),o("proceed")}catch(y){Ew(y)?p.value=!0:u.value=a(y)}finally{l.value=!1}};return(g,y)=>{const b=e.resolveComponent("KAlert"),_=e.resolveComponent("KButton"),k=e.resolveComponent("KModal");return!p.value&&n.plugin?(e.openBlock(),e.createBlock(e.unref(Ie.EntityDeleteModal),{key:0,"action-pending":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",description:e.unref(i)("delete.description_custom"),"entity-name":n.plugin.name,"entity-type":e.unref(Ie.EntityTypes).Plugin,error:u.value,"need-confirm":"",title:c.value,visible:"",onCancel:y[0]||(y[0]=C=>g.$emit("closed")),onProceed:f},null,8,["action-pending","description","entity-name","entity-type","error","title"])):n.plugin?(e.openBlock(),e.createBlock(k,{key:1,"action-button-disabled":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",title:c.value,visible:"",onCancel:y[2]||(y[2]=C=>g.$emit("closed"))},{default:e.withCtx(()=>[e.createVNode(b,{appearance:"danger",message:e.unref(i)("delete.plugin_schema_in_use_message")},null,8,["message"])]),"footer-actions":e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(_,{appearance:"tertiary",class:"cancel-button","data-testid":"delete-custom-plugin-form-cancel",onClick:y[1]||(y[1]=C=>g.$emit("closed"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.cancel")),1)]),_:1})])]),_:1},8,["action-button-disabled","title"])):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-627c76f8"]]),Aj={class:"custom-plugins-grid"},vj={class:"empty-state-title"},Ij={class:"empty-state-description"},ap=310,Bj=Me(e.defineComponent({__name:"PluginCustomGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canCreateCustomPlugin:{type:Boolean,default:!1},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getTallestPluginCardHeight:a,getToggleVisibility:s}=st.usePluginHelpers(),c=e.ref(!0),l=E=>{o("plugin-clicked",E)},u=e.computed(()=>{const E=JSON.parse(JSON.stringify(r.pluginList))[fe.PluginGroup.CUSTOM_PLUGINS]||[];return r.canCreateCustomPlugin&&r.navigateOnClick&&r.config.createCustomRoute?[{id:"custom-plugin-create",name:i("plugins.select.tabs.custom.create.name"),available:!0,group:fe.PluginGroup.CUSTOM_PLUGINS,description:i("plugins.select.tabs.custom.create.description")}].concat(E):E}),p=e.ref(!1),d=e.ref(null),f=E=>{p.value=!0,d.value={id:E.id,name:E.name,customPluginType:E.customPluginType}},m=E=>{var w;E&&(o("revalidate"),o("delete:success",((w=d.value)==null?void 0:w.name)||"")),p.value=!1,d.value=null},g=e.ref(ap),y=e.ref(null),b=e.ref(null),_=e.computed(()=>c.value?{overflowY:"hidden",maxHeight:`${g.value}px`}:{}),k=e.ref(!1),C=()=>{g.value=Math.max(a(b.value),ap),N()},N=()=>{var E,w;(E=b.value)!=null&&E.length&&(k.value=s(y.value,(w=b.value)==null?void 0:w.length))};return e.onMounted(async()=>{await e.nextTick(),g.value=Math.max(a(b.value),ap),N(),window==null||window.addEventListener("resize",C)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",C)}),(E,w)=>{const S=e.resolveComponent("KEmptyState"),I=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock("div",Aj,[u.value.length?(e.openBlock(),e.createBlock(I,{key:1,modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=j=>c.value=j),class:"custom-plugins-collapse","data-testid":`${e.unref(fe.PluginGroup).CUSTOM_PLUGINS}-collapse`,title:e.unref(fe.PluginGroup).CUSTOM_PLUGINS,"trigger-label":c.value?e.unref(i)("plugins.select.view_more"):e.unref(i)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:y,class:"plugin-card-container",style:e.normalizeStyle(_.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(j,A)=>(e.openBlock(),e.createBlock(ip,{key:`plugin-card-${A}`,ref_for:!0,ref_key:"pluginCardRef",ref:b,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:j,onCustomPluginDelete:x=>f(j),onPluginClicked:l},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete"]))),128))],4)]),_:2},[k.value?void 0:{name:"trigger",fn:e.withCtx(()=>[w[2]||(w[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])):(e.openBlock(),e.createBlock(S,{key:0,"action-button-visible":!1,class:"custom-plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",vj,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",Ij,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_description")),1)]),_:1})),p.value&&d.value?(e.openBlock(),e.createBlock(fc,{key:2,config:n.config,plugin:d.value,onClosed:m,onProceed:w[1]||(w[1]=j=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-909f4d5f"]]),sp=310,xw=Me(e.defineComponent({__name:"PluginSelectGroup",props:e.mergeModels({config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},name:{type:String,required:!0},plugins:{type:Array,required:!0},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:e.mergeModels(["plugin-clicked","delete:success"],["update:modelValue"]),setup(n,{emit:t}){const r=e.useModel(n,"modelValue"),o=n,i=t,{i18n:{t:a}}=st.useI18n(),{getTallestPluginCardHeight:s,getToggleVisibility:c}=st.usePluginHelpers(),l=e.ref(sp),u=e.ref(null),p=e.ref(null),d=e.computed(()=>r.value?{overflowY:"hidden",maxHeight:`${l.value}px`}:{}),f=e.ref(!1),m=e.ref(!1),g=e.ref(null),y=C=>{m.value=!0,g.value={id:C.id,name:C.name,customPluginType:C.customPluginType}},b=C=>{var N;C&&i("delete:success",((N=g.value)==null?void 0:N.name)||""),m.value=!1,g.value=null},_=()=>{l.value=Math.max(s(p.value),sp),k()},k=()=>{var C,N;(C=p.value)!=null&&C.length&&(f.value=c(u.value,(N=p.value)==null?void 0:N.length))};return e.onMounted(async()=>{await e.nextTick(),l.value=Math.max(s(p.value),sp),k(),window==null||window.addEventListener("resize",_)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",_)}),(C,N)=>{const E=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(E,{modelValue:r.value,"onUpdate:modelValue":N[0]||(N[0]=w=>r.value=w),class:"plugins-collapse","data-testid":`${o.name}-collapse`,title:o.name,"trigger-label":r.value?e.unref(a)("plugins.select.view_more"):e.unref(a)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:u,class:"plugin-card-container",style:e.normalizeStyle(d.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.plugins,w=>(e.openBlock(),e.createBlock(ip,{key:`plugin-card-${w.id}`,ref_for:!0,ref_key:"pluginCardRef",ref:p,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:w,onCustomPluginDelete:S=>y(w),onPluginClicked:S=>i("plugin-clicked",w)},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete","onPluginClicked"]))),128))],4)]),_:2},[f.value?void 0:{name:"trigger",fn:e.withCtx(()=>[N[2]||(N[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"]),m.value&&g.value?(e.openBlock(),e.createBlock(fc,{key:0,config:n.config,plugin:g.value,onClosed:b,onProceed:N[1]||(N[1]=w=>b(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-7f683497"]]),Tj={class:"plugin-select-grid"},Oj={class:"empty-state-title"},Pj={class:"empty-state-description"},lp=e.defineComponent({__name:"PluginSelectGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},highlightedPlugins:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""},hideHighlightedPlugins:{type:Boolean,default:!1}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),a=e.ref(!1),s=e.ref(tf.reduce((u,p)=>(u[p]=!1,u),{})),c=u=>{o("plugin-clicked",u)},l=e.computed(()=>{const u=JSON.parse(JSON.stringify(r.pluginList));return r.config.app==="konnect"&&delete u[fe.PluginGroup.CUSTOM_PLUGINS],u});return(u,p)=>{const d=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",Tj,[Object.keys(l.value).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(d,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",Oj,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",Pj,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),!r.hideHighlightedPlugins&&r.highlightedPlugins.length>0?(e.openBlock(),e.createBlock(xw,{key:1,modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=f=>a.value=f),"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:r.highlightedPluginsTitle||e.unref(i)("plugins.select.highlighted_plugins.title"),"navigate-on-click":n.navigateOnClick,plugins:r.highlightedPlugins,"onDelete:success":p[1]||(p[1]=f=>o("delete:success",f)),onPluginClicked:p[2]||(p[2]=f=>c(f))},null,8,["modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(tf),f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[l.value[f]?(e.openBlock(),e.createElementBlock("div",{key:f},[e.createVNode(xw,{modelValue:s.value[f],"onUpdate:modelValue":m=>s.value[f]=m,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:f,"navigate-on-click":n.navigateOnClick,plugins:l.value[f]||[],"onDelete:success":p[3]||(p[3]=m=>o("delete:success",m)),onPluginClicked:p[4]||(p[4]=m=>c(m))},null,8,["modelValue","onUpdate:modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])])):e.createCommentVNode("",!0)],64))),256))])}}}),Vj={class:"kong-ui-entities-plugin-select-form"},$j={class:"plugins-filter-input-container"},Rj={key:0},Lj={key:3,"aria-live":"polite",class:"plugins-results-container"},Dj={"data-testid":"kong-tab"},Mj={class:"tab-description"},jj={"data-testid":"custom-tab"},Fj={class:"tab-description"},Uj={key:1},Kj=Me(e.defineComponent({__name:"PluginSelect",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="kongManager"&&!n.workspace||n.app==="konnect"&&(!n.controlPlaneId||n.workspace)||!n.getCreateRoute)},customPluginSupport:{type:[String,Array],default:"none"},canCreateCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteCustomPlugin:{type:Function,required:!1,default:async()=>!0},canReadCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteClonedPlugin:{type:Function,required:!1},canReadClonedPlugin:{type:Function,required:!1,default:async()=>!0},canEditCustomPlugin:{type:Function,required:!1,default:async()=>!0},canEditClonedPlugin:{type:Function,required:!1},navigateOnClick:{type:Boolean,default:!0},availableOnServer:{type:Boolean,default:!0},ignoredPlugins:{type:Array,default:()=>[]},disabledPlugins:{type:Object,default:()=>({})},highlightedPluginIds:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var ye;const r=n,o=t,i=Nr.useRoute(),a=Nr.useRouter(),{i18n:{t:s}}=st.useI18n(),{pluginMetaData:c}=st.usePluginMetaData(),{getMessageFromError:l}=Ie.useErrors(),{sortAlpha:u,objectsAreEqual:p}=Ie.useHelpers(),d=e.ref(""),f=e.ref(!0),m=e.ref(!1),g=e.ref(""),y=e.ref(""),b=e.ref([]),_=e.ref([]),k=e.ref([]),C=e.ref({}),N=e.ref([]),E=e.ref(null),w=e.ref(!1),{axiosInstance:S}=Ie.useAxios((ye=r.config)==null?void 0:ye.axiosRequestConfig),I=ie=>ie==="none"||ie==="disabled"?new Set:new Set(Array.isArray(ie)?ie:[ie]),j=e.computed(()=>I(r.customPluginSupport)),A=e.computed(()=>[...j.value].sort().join("|")),x=e.computed(()=>r.customPluginSupport==="disabled"),O=e.computed(()=>x.value||j.value.size>0),P=e.computed(()=>j.value.has("streaming")),R=e.computed(()=>j.value.has("cloned")),W=ie=>zo.isAxiosError(ie)&&ie.code==="ERR_CANCELED",Z=ie=>l(ie).toLowerCase().includes("requires a license"),X=e.computed(()=>C.value?Object.entries(C.value).filter(([ie])=>ie!==fe.PluginGroup.CUSTOM_PLUGINS).reduce((ie,[,ee])=>{for(const se of ee??[])ie[se.id]=se;return ie},{}):{}),F=e.computed(()=>{var se;if(!C.value)return{};const ie=d.value.toLowerCase(),ee=JSON.parse(JSON.stringify(C.value));for(const ue in C.value){const Ee=((se=C.value[ue])==null?void 0:se.filter(_e=>{var xe,h;return _e.name.toLowerCase().includes(ie)||_e.id.toLowerCase().includes(ie)||_e.group.toLowerCase().includes(ie)||((xe=_e.clonedFromRef)==null?void 0:xe.toLowerCase().includes(ie))||((h=_e.customPluginType)==null?void 0:h.toLowerCase().includes(ie))}))||[];Ee.length?ee[ue]=Ee:delete ee[ue]}return ee}),J=e.computed(()=>r.highlightedPluginIds.reduce((ie,ee)=>{const se=X.value[ee];return se&&ie.push(se),ie},[])),$=e.computed(()=>Object.keys(F.value).length>0),q=e.computed(()=>Object.keys(C.value).length>0&&!$.value),K=e.computed(()=>r.config.app!=="konnect"||!O.value?[]:[{hash:"#kong",title:s("plugins.select.tabs.kong.title")},{hash:"#custom",title:s("plugins.select.tabs.custom.title"),disabled:x.value}]),ae=e.computed(()=>{var ee;let ie=K.value.length&&((i==null?void 0:i.hash)||((ee=K.value[0])==null?void 0:ee.hash))||"";return ie==="#custom"&&x.value&&(ie="#kong"),ie}),M=()=>{const ie=new Map(k.value.map(ue=>[ue.name,ue])),ee=new Set(_.value.map(ue=>ue.name)),se=new Set([...ee,...ie.keys()]);return[...new Set([...Object.keys({...r.availableOnServer?{}:c}),...b.value,...se])].filter(ue=>!r.ignoredPlugins.includes(ue)).filter(ue=>{if(!r.config.entityType)return ue;const Ee=ie.has(ue)?ie.get(ue).ref:ue;return r.config.entityType==="services"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.SERVICE)||r.config.entityType==="routes"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.ROUTE)||r.config.entityType==="consumer_groups"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.CONSUMER_GROUP)||r.config.entityType==="consumers"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.CONSUMER)?!1:ue}).reduce((ue,Ee)=>{var re;const _e=c[Ee]&&c[Ee].name||Ee,xe=ie.get(Ee),h=ee.has(Ee),T={...c[Ee],id:Ee,name:_e,available:b.value.includes(Ee)||!!xe||h,disabledMessage:"",group:((re=c[Ee])==null?void 0:re.group)||fe.PluginGroup.CUSTOM_PLUGINS};T.group===fe.PluginGroup.CUSTOM_PLUGINS&&(xe?(T.customPluginType="cloned",T.clonedFromRef=xe.ref):h?T.customPluginType="streaming":T.customPluginType="schema"),r.disabledPlugins&&(T.disabledMessage=r.disabledPlugins[Ee]);const G=T.group||s("plugins.select.misc_plugins");let Y=ue[G];return Y||(Y=[]),Y.push(T),Y.sort(u("name")),ue[G]=Y,ue},{})},v=e.computed(()=>{var ee;let ie=`${r.config.apiBaseUrl}${Qe.select[r.config.app].availablePlugins}`;if(r.config.app==="konnect")ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"");else if(r.config.app==="kongManager"&&((ee=r.config.gatewayInfo)==null?void 0:ee.edition)==="community")return`${r.config.apiBaseUrl}${Qe.select[r.config.app].availablePluginsForOss}`;return ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}),H=e.computed(()=>{if(P.value){let ie=`${r.config.apiBaseUrl}${Qe.select[r.config.app].streamingCustomPlugins}`;return r.config.app==="konnect"&&(ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),oe=e.computed(()=>{if(R.value){let ie=`${r.config.apiBaseUrl}${Qe.select[r.config.app].clonedPlugins}`;return r.config.app==="konnect"&&(ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),te=e.computed(()=>{if(r.config.entityType&&r.config.entityId){let ie=`${r.config.apiBaseUrl}${Qe.list[r.config.app].forEntity}`;return r.config.app==="konnect"&&(ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{entityType}/gi,r.config.entityType||"").replace(/{entityId}/gi,r.config.entityId||"")}return""}),ge=ie=>{a.replace({hash:ie,query:i.query})};e.watch(()=>r.disabledPlugins,(ie,ee)=>{!p(ie,ee)&&!f.value&&(C.value=M())}),e.watch(()=>r.ignoredPlugins,(ie,ee)=>{!p(ie,ee)&&!f.value&&(C.value=M())}),e.watch(f,ie=>{o("loading",ie)});const me=async ie=>{if(!te.value){N.value=[];return}try{const{data:{data:ee}}=await S.get(te.value,{signal:ie});ee!=null&&ee.length&&(N.value=ee.reduce((se,ue)=>(ue.name&&se.push(ue.name),se),[]))}catch(ee){W(ee)||(N.value=[])}},le=async ie=>{const ee=[];H.value&&qe.value&&ee.push(dc(S,H.value,ie).then(se=>{_.value=se}).catch(se=>{W(se)||y.value||(y.value=l(se)??s("plugins.select.tabs.custom.fetch_error"))})),oe.value&&Ve.value&&ee.push(dc(S,oe.value,ie).then(se=>{k.value=se}).catch(se=>{if(W(se))return;const ue=Z(se);(ue||!y.value)&&(y.value=ue?s("plugins.select.tabs.custom.license_required"):l(se)??s("plugins.select.tabs.custom.fetch_error"))})),ee.push(me(ie)),await Promise.allSettled(ee)},he=async()=>{var ie,ee;(ie=E.value)==null||ie.abort(),E.value=new AbortController,f.value=!0,m.value=!1,g.value="",y.value="",b.value=[],_.value=[],k.value=[],N.value=[];try{const{data:se}=await S.get(v.value,{signal:E.value.signal});if(r.config.app==="konnect"){const{names:ue}=se;b.value=ue||[]}else if(r.config.app==="kongManager"){const{plugins:{available_on_server:ue}}=se;b.value=ue?Object.keys(ue):[]}await le(E.value.signal),C.value=M()}catch(se){W(se)||(m.value=!0,g.value=l(se))}finally{(ee=E.value)!=null&&ee.signal.aborted||(f.value=!1)}},Oe=e.ref(!1),$e=e.ref(!1),Pe=e.ref(!1),qe=e.ref(!1),Ye=e.ref(!1),et=e.ref(!1),Ve=e.ref(!1),ke=ie=>{_.value=_.value.filter(ee=>ee.name!==ie),k.value=k.value.filter(ee=>ee.name!==ie),C.value=M(),o("delete-custom:success",ie)};e.onBeforeMount(async()=>{const[ie,ee,se,ue,Ee,_e,xe]=await Promise.all([r.canCreateCustomPlugin(),r.canEditCustomPlugin(),r.canDeleteCustomPlugin(),r.canReadCustomPlugin(),r.canEditClonedPlugin?r.canEditClonedPlugin():Promise.resolve(null),r.canDeleteClonedPlugin?r.canDeleteClonedPlugin():Promise.resolve(null),r.canReadClonedPlugin()]);Oe.value=ie,$e.value=ee,Pe.value=se,qe.value=ue,Ye.value=Ee??ee,et.value=_e??se,Ve.value=xe});const we=e.useTemplateRef("filter-input");return e.onMounted(async()=>{var ie,ee;w.value=!0,(ee=(ie=we.value)==null?void 0:ie.input)==null||ee.focus(),await he()}),e.watch(()=>{var ie;return[r.config.app==="konnect"?r.config.controlPlaneId:void 0,r.config.workspace,r.config.entityType,r.config.entityId,r.config.app==="kongManager"?(ie=r.config.gatewayInfo)==null?void 0:ie.edition:void 0,A.value,x.value]},async()=>{w.value&&await he()}),e.onBeforeUnmount(()=>{var ie;(ie=E.value)==null||ie.abort()}),(ie,ee)=>{const se=e.resolveComponent("KInput"),ue=e.resolveComponent("KSkeletonBox"),Ee=e.resolveComponent("KSkeleton"),_e=e.resolveComponent("KEmptyState"),xe=e.resolveComponent("KTooltip"),h=e.resolveComponent("KAlert"),T=e.resolveComponent("KTabs");return e.openBlock(),e.createElementBlock("div",Vj,[e.createElementVNode("div",$j,[e.createVNode(se,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":ee[0]||(ee[0]=G=>d.value=G),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter",placeholder:e.unref(s)("search.placeholder.select"),type:"search"},null,8,["modelValue","placeholder"])]),f.value?(e.openBlock(),e.createElementBlock("section",Rj,[e.createVNode(ue,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(Ee,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):m.value?(e.openBlock(),e.createBlock(_e,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(g.value),1)]),_:1})):q.value&&d.value?(e.openBlock(),e.createBlock(_e,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(s)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",Lj,[K.value.length?(e.openBlock(),e.createBlock(T,{key:0,modelValue:ae.value,"onUpdate:modelValue":ee[3]||(ee[3]=G=>ae.value=G),"data-testid":"plugins-tabs",tabs:K.value,onChange:ge},e.createSlots({kong:e.withCtx(()=>[e.createElementVNode("div",Dj,[e.createElementVNode("p",Mj,e.toDisplayString(e.unref(s)("plugins.select.tabs.kong.description")),1),e.createVNode(lp,{"can-delete-cloned-plugin":et.value,"can-delete-custom-plugin":Pe.value,"can-edit-cloned-plugin":Ye.value,"can-edit-custom-plugin":$e.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":J.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":F.value,"onDelete:success":ke,onPluginClicked:ee[1]||(ee[1]=G=>ie.$emit("plugin-clicked",G))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])])]),custom:e.withCtx(()=>[e.createElementVNode("div",jj,[e.renderSlot(ie.$slots,"before-custom-tab-content",{},void 0,!0),e.createElementVNode("p",Fj,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.description")),1),y.value?(e.openBlock(),e.createBlock(h,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(Bj,{"can-create-custom-plugin":Oe.value,"can-delete-cloned-plugin":et.value,"can-delete-custom-plugin":Pe.value,"can-edit-cloned-plugin":Ye.value,"can-edit-custom-plugin":$e.value,config:n.config,"navigate-on-click":n.navigateOnClick,"plugin-list":F.value,"onDelete:success":ke,onPluginClicked:ee[2]||(ee[2]=G=>ie.$emit("plugin-clicked",G))},null,8,["can-create-custom-plugin","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin-list"])])]),_:2},[x.value?{name:"custom-anchor",fn:e.withCtx(()=>[e.createVNode(xe,{"max-width":"300",text:e.unref(s)("plugins.select.tabs.custom.disabled_tooltip")},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.title")),1)]),_:1},8,["text"])]),key:"0"}:void 0]),1032,["modelValue","tabs"])):(e.openBlock(),e.createElementBlock("div",Uj,[y.value?(e.openBlock(),e.createBlock(h,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(lp,{"can-delete-cloned-plugin":et.value,"can-delete-custom-plugin":Pe.value,"can-edit-cloned-plugin":Ye.value,"can-edit-custom-plugin":$e.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":J.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":F.value,"onDelete:success":ke,onPluginClicked:ee[4]||(ee[4]=G=>ie.$emit("plugin-clicked",G))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])]))]))])}}}),[["__scopeId","data-v-70fb1e81"]]),qj={class:"plugin-select-card-wrapper","data-testid":"plugin-catalog-card-wrapper"},Gj={class:"plugin-card-header"},Hj={class:"plugin-card-title"},zj={key:0,class:"plugin-card-actions"},Wj=["data-testid","title"],Yj={key:0},Jj=["title"],Xj={class:"plugin-card-footer"},Zj={class:"plugin-card-footer-extra"},Qj={key:0,class:"custom-plugin-badges"},eF=Me(e.defineComponent({__name:"PluginCatalogCard",props:{config:{},plugin:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Nr.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!C.value||k.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin),f=e.computed(()=>p.value?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),g=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(C.value&&!k.value&&m.value&&(y.value||g.value))),_=e.computed(()=>l.value?{}:C.value&&k.value&&o.config.createCustomRoute?o.config.createCustomRoute:o.config.getCreateRoute(o.plugin.id)),k=e.computed(()=>o.plugin.id==="custom-plugin-create"),C=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),N=()=>{C.value&&r("custom-plugin-delete")},E=(w,S)=>{typeof o.config.getCustomEditRoute=="function"&&i.push(o.config.getCustomEditRoute(w,S))};return(w,S)=>{const I=e.resolveComponent("KButton"),j=e.resolveComponent("KDropdownItem"),A=e.resolveComponent("KDropdownMenu"),x=e.resolveComponent("KBadge"),O=e.resolveComponent("RouterLink"),P=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",qj,[e.createVNode(P,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createVNode(O,{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,to:_.value},{default:e.withCtx(()=>[e.createElementVNode("div",Gj,[e.createElementVNode("div",Hj,[e.createVNode(e.unref(Er.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!C.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",zj,[e.createVNode(A,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150",onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop","prevent"]))},{default:e.withCtx(()=>[e.createVNode(I,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[g.value?(e.openBlock(),e.createBlock(j,{key:0,"data-testid":"edit-plugin-schema",onClick:S[0]||(S[0]=e.withModifiers(R=>E(n.plugin.name,n.plugin.customPluginType),["stop","prevent"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(j,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":g.value,onClick:e.withModifiers(N,["stop","prevent"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"plugin-card-body","data-testid":`${n.plugin.id}-card-body`,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip")},[n.plugin.description?(e.openBlock(),e.createElementBlock("div",Yj,[e.createElementVNode("div",{title:n.plugin.description},e.toDisplayString(n.plugin.description),9,Jj)])):e.createCommentVNode("",!0)],8,Wj),e.createElementVNode("div",Xj,[e.createElementVNode("div",null,e.toDisplayString(k.value?e.unref(a)("actions.create_custom"):e.unref(a)("actions.configure")),1),e.createElementVNode("div",Zj,[c.value.length?(e.openBlock(),e.createElementBlock("div",Qj,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,R=>(e.openBlock(),e.createBlock(x,{key:R,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(R),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"footer-extra",{},void 0,!0)])])]),_:3},8,["class","data-testid","to"])]),_:3},8,["text"])])}}}),[["__scopeId","data-v-5eb0b917"]]),tF=["data-testid"],nF={class:"group-icon-wrapper"},rF={class:"group-title-text"},oF=["data-testid"],iF=["data-testid"],Aw=Me(e.defineComponent({__name:"PluginCatalogGroup",props:{config:{},name:{},plugins:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean},showAllCard:{type:Boolean}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=e.computed(()=>{switch(r.name){case fe.PluginGroup.FEATURED:return Re.PopularIcon;case fe.PluginGroup.AI:return Re.BotIcon;case fe.PluginGroup.ANALYTICS_AND_MONITORING:return Re.AnalyticsIcon;case fe.PluginGroup.AUTHENTICATION:return Re.LockIcon;case fe.PluginGroup.LOGGING:return Re.ServiceDocumentIcon;case fe.PluginGroup.MONETIZATION:return Re.MoneyIcon;case fe.PluginGroup.SECURITY:return Re.SecurityIcon;case fe.PluginGroup.SERVERLESS:return Re.RuntimeServerlessIcon;case fe.PluginGroup.TRAFFIC_CONTROL:return Re.TrafficIcon;case fe.PluginGroup.TRANSFORMATIONS:return Re.TransformationIcon;case fe.PluginGroup.DEPLOYMENT:return Re.DeployIcon;case fe.PluginGroup.CUSTOM_PLUGINS:return Re.CodeblockIcon;default:return null}}),i=t,{i18n:{t:a}}=st.useI18n(),s=e.ref(!1),c=e.computed(()=>r.showAllCard?r.plugins:!s.value&&r.plugins.length>9?r.plugins.slice(0,8):r.plugins),l=e.computed(()=>!r.showAllCard&&!s.value&&r.plugins.length>9);function u(){s.value=!0}const p=e.ref(!1),d=e.ref(null),f=g=>{p.value=!0,d.value={id:g.id,name:g.name,group:g.group,customPluginType:g.customPluginType}},m=g=>{var y,b,_;g&&(i("revalidate"),i("delete:success",{name:((y=d.value)==null?void 0:y.name)||"",group:(b=d.value)==null?void 0:b.group,customPluginType:(_=d.value)==null?void 0:_.customPluginType})),p.value=!1,d.value=null};return(g,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.name?(e.openBlock(),e.createElementBlock("div",{key:0,class:"group-title","data-testid":`plugin-group-${n.name}-title`},[e.createElementVNode("div",nF,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{color:`var(--kui-color-text-decorative-purple, ${e.unref(Vh)})`},null,8,["color"]))]),e.createElementVNode("span",rF,e.toDisplayString(n.name),1)],8,tF)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"plugin-card-container","data-testid":`plugin-group-${n.name}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,b=>(e.openBlock(),e.createBlock(eF,{key:`plugin-card-${b.id}`,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugin:b,onCustomPluginDelete:_=>f(b),onPluginClicked:_=>i("plugin-clicked",b)},e.createSlots({_:2},[b.gatewayVersion&&e.unref(hT)(e.unref(fe.GATEWAY_VERSION_TIMESTAMP_MAP)[b.gatewayVersion])?{name:"footer-extra",fn:e.withCtx(()=>[e.createElementVNode("span",{class:"plugin-card-new-badge","data-testid":`plugin-card-${b.id}-new-badge`},e.toDisplayString(e.unref(a)("labels.new")),9,iF)]),key:"0"}:void 0]),1032,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin","onCustomPluginDelete","onPluginClicked"]))),128)),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"show-all-plugin-card",onClick:u},e.toDisplayString(e.unref(a)("plugins.select.show_all")),1)):e.createCommentVNode("",!0)],8,oF),p.value&&d.value?(e.openBlock(),e.createBlock(fc,{key:1,config:n.config,plugin:d.value,onClosed:m,onProceed:y[0]||(y[0]=b=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-f9a9a47c"]]),aF={class:"plugin-select-grid"},sF={class:"empty-state-title"},lF={class:"empty-state-description"},cF={key:1},uF=Me(e.defineComponent({__name:"PluginCatalogGrid",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=Bl.concat(Tl),o=t,{i18n:{t:i}}=st.useI18n(),a=s=>{o("plugin-clicked",s)};return(s,c)=>{var u;const l=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",aF,[Object.keys(n.pluginList||[]).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(l,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",sF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",lF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),p=>{var d;return e.openBlock(),e.createElementBlock(e.Fragment,null,[(d=n.pluginList)!=null&&d[p]?(e.openBlock(),e.createElementBlock("div",{key:p},[e.createVNode(Aw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:p,plugins:n.pluginList[p]||[],"onDelete:success":c[0]||(c[0]=f=>o("delete:success",f)),onPluginClicked:c[1]||(c[1]=f=>a(f))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","plugins"])])):e.createCommentVNode("",!0)],64)}),256)),(u=n.pluginList)!=null&&u["Query Result"]?(e.openBlock(),e.createElementBlock("div",cF,[e.createVNode(Aw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugins:n.pluginList["Query Result"]||[],"show-all-card":"","onDelete:success":c[2]||(c[2]=p=>o("delete:success",p)),onPluginClicked:c[3]||(c[3]=p=>a(p))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugins"])])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-e3bf3819"]]),dF={class:"plugin-name-cell","data-testid":"plugin-catalog-list-view-name"},fF=["title"],pF=["title"],mF={class:"plugin-action-cell","data-testid":"plugin-catalog-list-view-action"},hF={key:0,class:"plugin-more-action-cell","data-testid":"plugin-catalog-list-view-more-actions"},gF=Me(e.defineComponent({__name:"PluginCatalogListView",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["revalidate","delete:success"],setup(n,{emit:t}){const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=A=>A.customPluginType==="cloned"&&A.clonedFromRef?i("plugins.select.cloned_from_badge",{link:A.clonedFromRef}):A.customPluginType==="streaming"?i("plugins.select.streamed_custom_badge"):A.customPluginType?i("plugins.select.installed_custom_badge"):"",s=e.computed(()=>w.value.some(A=>C(A.plugin))),c=e.computed(()=>{const A=[{key:"name",label:i("plugins.select.list.table_headers.name"),sortable:!0},{key:"description",label:i("plugins.select.list.table_headers.description")},{key:"action",hideLabel:!0}];return s.value&&A.push({key:"more-actions",hideLabel:!0}),A}),l=e.computed(()=>{if(!o.pluginList)return[];const A=Object.values(o.pluginList).flat();return Array.from(new Map(A.map(O=>[O.id,O])).values()).map(O=>({id:O.id,name:O.name,description:O.description,badge:a(O),plugin:O}))}),u=e.ref(0),p=e.ref(10),d=e.ref(1),f=e.ref(l.value),m=e.ref(!1),g=e.ref(null),y=A=>A.customPluginType==="cloned"&&A.clonedFromRef?A.clonedFromRef:A.id,b=A=>(A==null?void 0:A.customPluginType)==="cloned",_=A=>!(A!=null&&A.customPluginType)||o.config.app==="kongManager"&&A.customPluginType==="schema"?!1:b(A)?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin,k=A=>!(A!=null&&A.customPluginType)||typeof o.config.getCustomEditRoute!="function"||o.config.app==="kongManager"&&A.customPluginType==="schema"?!1:b(A)?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin,C=A=>_(A)||k(A),N=A=>{m.value=!0,g.value={id:A.id,name:A.name,group:A.group,customPluginType:A.customPluginType}},E=A=>{var x,O,P;A&&(r("revalidate"),r("delete:success",{name:((x=g.value)==null?void 0:x.name)||"",group:(O=g.value)==null?void 0:O.group,customPluginType:(P=g.value)==null?void 0:P.customPluginType})),m.value=!1,g.value=null},w=e.computed(()=>{const A=f.value.length,x=Math.max(1,Math.ceil(A/p.value)),P=(Math.min(d.value,x)-1)*p.value;return f.value.slice(P,P+p.value)});e.watch(l,()=>{f.value=[...l.value],d.value=1,u.value++});const S=({page:A})=>{d.value=A},I=({pageSize:A})=>{p.value=A},j=A=>{const{sortColumnKey:x,sortColumnOrder:O}=A;x==="name"&&(f.value=[...f.value].sort((P,R)=>{const W=(P[x]||"").toLowerCase(),Z=(R[x]||"").toLowerCase();return W<Z?O==="asc"?-1:1:W>Z?O==="asc"?1:-1:0}))};return(A,x)=>{const O=e.resolveComponent("KBadge"),P=e.resolveComponent("KButton"),R=e.resolveComponent("KDropdownItem"),W=e.resolveComponent("KDropdown"),Z=e.resolveComponent("KTableView"),X=e.resolveComponent("KCard");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(X,{"data-testid":"plugin-catalog-list-view-card"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(Z,{key:u.value,class:"plugin-catalog-table","client-sort":"",data:w.value,"data-testid":"plugin-catalog-list-view-table",headers:c.value,"pagination-attributes":{totalCount:l.value.length,currentPage:d.value,initialPageSize:p.value,pageSizes:[10,25,50]},"resize-columns":"","row-key":"id",onPageChange:S,onPageSizeChange:I,onSort:j},{name:e.withCtx(({row:F})=>[e.createElementVNode("span",dF,[e.createVNode(e.unref(Er.PluginIcon),{"data-testid":`plugin-catalog-list-view-${F.plugin.id}-icon`,name:y(F.plugin),size:20},null,8,["data-testid","name"]),e.createElementVNode("span",{class:"plugin-name-text","data-testid":"plugin-catalog-list-view-name-text",title:F.name},e.toDisplayString(F.name),9,fF),F.badge?(e.openBlock(),e.createBlock(O,{key:0,appearance:"info",class:"plugin-name-badge","data-testid":"plugin-catalog-list-view-custom-badge"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(F.badge),1)]),_:2},1024)):e.createCommentVNode("",!0)])]),description:e.withCtx(({row:F})=>[e.createElementVNode("span",{class:"plugin-description-cell","data-testid":"plugin-catalog-list-view-description",title:F.description},e.toDisplayString(F.description),9,pF)]),action:e.withCtx(({row:F})=>[e.createElementVNode("div",mF,[e.createVNode(P,{appearance:"tertiary","data-testid":"plugin-catalog-list-view-configure-btn",size:"small",to:o.config.getCreateRoute(F.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.configure")),1)]),_:1},8,["to"])])]),"more-actions":e.withCtx(({row:F})=>[C(F.plugin)?(e.openBlock(),e.createElementBlock("div",hF,[e.createVNode(W,{appearance:"tertiary",class:"actions-trigger","data-testid":"plugin-catalog-list-view-more-actions-button",icon:"",size:"small"},{items:e.withCtx(()=>{var J,$;return[k(F.plugin)?(e.openBlock(),e.createBlock(R,{key:0,"data-testid":"edit-plugin-schema",item:{label:e.unref(i)("actions.edit"),to:($=(J=n.config).getCustomEditRoute)==null?void 0:$.call(J,F.plugin.name,F.plugin.customPluginType)}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.edit")),1)]),_:1},8,["item"])):e.createCommentVNode("",!0),_(F.plugin)?(e.openBlock(),e.createBlock(R,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":k(F.plugin),onClick:()=>N(F.plugin)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.delete")),1)]),_:1},8,["has-divider","onClick"])):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])]),_:2},1024)])):e.createCommentVNode("",!0)]),_:1},8,["data","headers","pagination-attributes"]))]),_:1}),m.value&&g.value?(e.openBlock(),e.createBlock(fc,{key:0,config:n.config,plugin:g.value,onClosed:E,onProceed:x[0]||(x[0]=F=>E(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-986d34db"]]),yF={class:"plugin-catalog","data-testid":"plugin-catalog"},_F={class:"plugin-filter","data-testid":"plugin-filter"},bF={class:"plugin-filter-title"},wF={class:"featured-title"},kF={class:"plugin-featured-filter"},CF=["data-testid"],EF={class:"group-title"},NF={class:"plugin-type-filter"},SF=["data-testid"],xF={class:"plugins-container"},AF={class:"plugins-filter-input-container"},vF={class:"icon-container"},IF={key:0},BF={key:3,"aria-live":"polite",class:"plugins-results-container"},TF=Me(e.defineComponent({__name:"PluginCatalog",props:{config:{},disabledPlugins:{},highlightedPluginIds:{},customPluginSupport:{default:"none"},availableOnServer:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Function,default:async()=>!0},canReadCustomPlugin:{type:Function,default:async()=>!0},canEditCustomPlugin:{type:Function,default:async()=>!0},canDeleteClonedPlugin:{},canReadClonedPlugin:{type:Function,default:async()=>!0},canEditClonedPlugin:{}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var we;const r=t,{i18n:{t:o}}=st.useI18n(),{pluginMetaData:i}=st.usePluginMetaData(),{getMessageFromError:a}=Ie.useErrors(),{sortAlpha:s,objectsAreEqual:c}=Ie.useHelpers(),l=n,{axiosInstance:u}=Ie.useAxios((we=l.config)==null?void 0:we.axiosRequestConfig),p=e.useTemplateRef("filter-input"),d=e.ref(""),f=e.ref(!1),m=e.ref(!1),g=e.ref(Object.fromEntries(Bl.concat(Tl).map(ye=>[ye,!1]))),y=e.ref(!0),b=e.ref(!1),_=e.ref(""),k=e.ref(""),C=e.ref([]),N=e.ref([]),E=e.ref([]),w=e.ref({}),S=e.ref([]),I=e.ref(!1),j=e.ref(null),A=e.ref(!1),x=e.computed(()=>I.value?Re.GridIcon:Re.ListIcon),O=e.inject(ur.KM_2485_CLONED_PLUGINS,!1),P=e.computed(()=>e.unref(O)),R=ye=>ye==="none"||ye==="disabled"?new Set:new Set(Array.isArray(ye)?ye:[ye]),W=e.computed(()=>R(l.customPluginSupport)),Z=e.computed(()=>[...W.value].sort().join("|")),X=e.computed(()=>W.value.has("streaming")),F=e.computed(()=>P.value&&W.value.has("cloned")),J=ye=>zo.isAxiosError(ye)&&ye.code==="ERR_CANCELED",$=ye=>a(ye).toLowerCase().includes("requires a license"),q=e.computed(()=>{var ie;let ye=`${l.config.apiBaseUrl}${Qe.select[l.config.app].availablePlugins}`;if(l.config.app==="konnect")ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"");else if(l.config.app==="kongManager"&&((ie=l.config.gatewayInfo)==null?void 0:ie.edition)==="community")return`${l.config.apiBaseUrl}${Qe.select[l.config.app].availablePluginsForOss}`;return ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}),K=e.computed(()=>{if(X.value){let ye=`${l.config.apiBaseUrl}${Qe.select[l.config.app].streamingCustomPlugins}`;return l.config.app==="konnect"&&(ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),ae=e.computed(()=>{if(F.value){let ye=`${l.config.apiBaseUrl}${Qe.select[l.config.app].clonedPlugins}`;return l.config.app==="konnect"&&(ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),M=e.computed(()=>{if(l.config.entityType&&l.config.entityId){let ye=`${l.config.apiBaseUrl}${Qe.list[l.config.app].forEntity}`;return l.config.app==="konnect"&&(ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"").replace(/{entityType}/gi,l.config.entityType||"").replace(/{entityId}/gi,l.config.entityId||"")}return""}),v=e.computed(()=>{var _e;if(!w.value)return{};const ye=Object.entries(g.value).filter(([,xe])=>xe).map(([xe])=>xe);let ie={};ye.length===0&&(ie=w.value),ye.forEach(xe=>{w.value[xe]&&(ie[xe]=w.value[xe])});const ee=d.value.toLowerCase();if(!ee)return ie;const se=JSON.parse(JSON.stringify(ie));for(const xe in ie){const h=((_e=ie[xe])==null?void 0:_e.filter(T=>[T.name.toLowerCase(),T.id.toLowerCase()].some(Y=>mT(ee,Y).length===ee.length)))||[];h.length?se[xe]=h:delete se[xe]}const ue=Object.values(se).flat().filter(xe=>!!xe),Ee=Array.from(ue.reduce((xe,h)=>(xe.has(h.id)||xe.set(h.id,h),xe),new Map).values());return Ee.length?{"Query Result":Ee}:{}}),H=e.computed(()=>Object.keys(v.value).length>0),oe=e.computed(()=>Object.keys(w.value).length>0&&!H.value),te=()=>{Object.keys(g.value).forEach(ye=>{g.value[ye]=!1})},ge=()=>{const ye=new Map(E.value.map(ue=>[ue.name,ue])),ie=new Set(N.value.map(ue=>ue.name)),ee=new Set([...ie,...ye.keys()]),se=[...new Set([...Object.keys({...l.availableOnServer?{}:i}),...C.value,...ee])].filter(ue=>{if(!l.config.entityType)return ue;const Ee=ye.has(ue)?ye.get(ue).ref:ue;return l.config.entityType==="services"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.SERVICE)||l.config.entityType==="routes"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.ROUTE)||l.config.entityType==="consumer_groups"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.CONSUMER_GROUP)||l.config.entityType==="consumers"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.CONSUMER)?!1:ue}).reduce((ue,Ee)=>{var re;const _e=i[Ee]&&i[Ee].name||Ee,xe=ye.get(Ee),h=ie.has(Ee),T={...i[Ee],id:Ee,name:_e,available:C.value.includes(Ee)||!!xe||h,disabledMessage:"",group:((re=i[Ee])==null?void 0:re.group)||fe.PluginGroup.CUSTOM_PLUGINS};T.group===fe.PluginGroup.CUSTOM_PLUGINS&&(xe?(T.customPluginType="cloned",T.clonedFromRef=xe.ref):h?T.customPluginType="streaming":T.customPluginType="schema"),l.disabledPlugins&&(T.disabledMessage=l.disabledPlugins[Ee]);const G=T.group||o("plugins.select.misc_plugins");let Y=ue[G];return Y||(Y=[]),Y.push(T),Y.sort(s("name")),ue[G]=Y,ue},{});if(l.highlightedPluginIds&&l.highlightedPluginIds.length>0){const ue=new Set(Object.values(se).flat().map(_e=>_e==null?void 0:_e.id)),Ee=l.highlightedPluginIds.flatMap(_e=>{var h;const xe=i[_e];return!xe||!ue.has(_e)?[]:{...xe,id:_e,name:xe.name||_e,available:C.value.includes(_e),disabledMessage:((h=l.disabledPlugins)==null?void 0:h[_e])||"",group:xe.group||fe.PluginGroup.CUSTOM_PLUGINS}}).filter(Boolean);Ee.length>0&&(se[fe.PluginGroup.FEATURED]=Ee)}return se};e.watch(()=>l.disabledPlugins,(ye,ie)=>{!c(ye||{},ie||{})&&!y.value&&(w.value=ge())}),e.watch(y,ye=>{r("loading",ye)});const me=e.ref(!1),le=e.ref(!1),he=e.ref(!1),Oe=e.ref(!1),$e=e.ref(!1),Pe=e.ref(!1),qe=async()=>{try{const[ye,ie,ee,se,ue,Ee]=await Promise.all([l.canEditCustomPlugin(),l.canDeleteCustomPlugin(),l.canReadCustomPlugin(),l.canEditClonedPlugin?l.canEditClonedPlugin():Promise.resolve(null),l.canDeleteClonedPlugin?l.canDeleteClonedPlugin():Promise.resolve(null),l.canReadClonedPlugin()]);me.value=ye,le.value=ie,he.value=ee,Oe.value=se??ye,$e.value=ue??ie,Pe.value=Ee}catch{me.value=!1,le.value=!1,he.value=!1,Oe.value=!1,$e.value=!1,Pe.value=!1}},Ye=async ye=>{if(!M.value){S.value=[];return}try{const{data:{data:ie}}=await u.get(M.value,{signal:ye});ie!=null&&ie.length&&(S.value=ie.reduce((ee,se)=>(se.name&&ee.push(se.name),ee),[]))}catch(ie){J(ie)||(S.value=[])}},et=async ye=>{const ie=[];K.value&&he.value&&ie.push(dc(u,K.value,ye).then(ee=>{N.value=ee}).catch(ee=>{J(ee)||k.value||(k.value=a(ee)??o("plugins.select.tabs.custom.fetch_error"))})),ae.value&&Pe.value&&ie.push(dc(u,ae.value,ye).then(ee=>{E.value=ee}).catch(ee=>{if(J(ee))return;const se=$(ee);(se||!k.value)&&(k.value=se?o("plugins.select.tabs.custom.license_required"):a(ee)??o("plugins.select.tabs.custom.fetch_error"))})),ie.push(Ye(ye)),await Promise.allSettled(ie)},Ve=async()=>{var ie;(ie=j.value)==null||ie.abort();const ye=new AbortController;j.value=ye,y.value=!0,b.value=!1,_.value="",k.value="",C.value=[],N.value=[],E.value=[],S.value=[];try{const{data:ee}=await u.get(q.value,{signal:ye.signal});if(l.config.app==="konnect"){const{names:se}=ee;C.value=se||[]}else if(l.config.app==="kongManager"){const{plugins:{available_on_server:se}}=ee;C.value=se?Object.keys(se):[]}await et(ye.signal),w.value=ge()}catch(ee){J(ee)||(b.value=!0,_.value=a(ee))}finally{j.value===ye&&!ye.signal.aborted&&(y.value=!1)}},ke=async({name:ye})=>{ye&&(r("delete-custom:success",ye),await Ve())};return e.onMounted(async()=>{var ye,ie;A.value=!0,(ie=(ye=p.value)==null?void 0:ye.input)==null||ie.focus(),await qe(),await Ve()}),e.watch(()=>{var ye;return[l.config.app==="konnect"?l.config.controlPlaneId:void 0,l.config.workspace,l.config.entityType,l.config.entityId,l.config.app==="kongManager"?(ye=l.config.gatewayInfo)==null?void 0:ye.edition:void 0,Z.value,P.value]},async()=>{A.value&&(await qe(),await Ve())}),e.onBeforeUnmount(()=>{var ye;(ye=j.value)==null||ye.abort()}),(ye,ie)=>{const ee=e.resolveComponent("KButton"),se=e.resolveComponent("KCheckbox"),ue=e.resolveComponent("KBadge"),Ee=e.resolveComponent("KCollapse"),_e=e.resolveComponent("KInput"),xe=e.resolveComponent("KSkeletonBox"),h=e.resolveComponent("KSkeleton"),T=e.resolveComponent("KEmptyState"),G=e.resolveComponent("KAlert");return e.openBlock(),e.createElementBlock("div",yF,[e.createElementVNode("div",_F,[e.createElementVNode("div",bF,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.title"))+" ",1),e.createVNode(ee,{appearance:"tertiary",class:"clear-selection","data-testid":"clear-filter-selection",disabled:!Object.values(g.value).some(Y=>Y),onClick:te},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.clear")),1)]),_:1},8,["disabled"])]),e.createVNode(Ee,{modelValue:f.value,"onUpdate:modelValue":ie[0]||(ie[0]=Y=>f.value=Y)},{title:e.withCtx(()=>[e.createElementVNode("div",wF,e.toDisplayString(e.unref(o)("plugins.select.filter.featured")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",kF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Bl),Y=>(e.openBlock(),e.createElementBlock("div",{key:Y,class:"plugin-filter-item","data-testid":`plugin-filter-item-${Y}`},[e.createVNode(se,{modelValue:g.value[Y],"onUpdate:modelValue":re=>g.value[Y]=re,label:Y},null,8,["modelValue","onUpdate:modelValue","label"]),e.createVNode(ue,{appearance:"neutral"},{default:e.withCtx(()=>{var re,be;return[e.createTextVNode(e.toDisplayString(((be=(re=w.value)==null?void 0:re[Y])==null?void 0:be.length)||0),1)]}),_:2},1024)],8,CF))),128))])]),_:1},8,["modelValue"]),e.createVNode(Ee,{modelValue:m.value,"onUpdate:modelValue":ie[1]||(ie[1]=Y=>m.value=Y)},{title:e.withCtx(()=>[e.createElementVNode("div",EF,e.toDisplayString(e.unref(o)("plugins.select.filter.type")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",NF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Tl),Y=>(e.openBlock(),e.createElementBlock("div",{key:Y,class:"plugin-filter-item","data-testid":`plugin-filter-item-${Y}`},[e.createVNode(se,{modelValue:g.value[Y],"onUpdate:modelValue":re=>g.value[Y]=re,"data-testid":`plugin-filter-checkbox-${Y}`,label:Y},null,8,["modelValue","onUpdate:modelValue","data-testid","label"]),e.createVNode(ue,{appearance:"neutral","data-testid":`plugin-filter-count-${Y}`},{default:e.withCtx(()=>{var re,be;return[e.createTextVNode(e.toDisplayString(((be=(re=w.value)==null?void 0:re[Y])==null?void 0:be.length)||0),1)]}),_:2},1032,["data-testid"])],8,SF))),128))])]),_:1},8,["modelValue"])]),e.createElementVNode("div",xF,[e.createElementVNode("div",AF,[e.createVNode(_e,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":ie[2]||(ie[2]=Y=>d.value=Y),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter-input",placeholder:e.unref(o)("search.placeholder.search_plugins"),type:"search"},null,8,["modelValue","placeholder"]),e.createElementVNode("div",vF,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.value),{class:"plugins-filter-icon",color:`var(--kui-icon-color-primary, ${e.unref(m1)})`,onClick:ie[3]||(ie[3]=Y=>I.value=!I.value)},null,8,["color"]))])]),y.value?(e.openBlock(),e.createElementBlock("section",IF,[e.createVNode(xe,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(h,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):b.value?(e.openBlock(),e.createBlock(T,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(_.value),1)]),_:1})):oe.value&&d.value?(e.openBlock(),e.createBlock(T,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(o)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",BF,[k.value?(e.openBlock(),e.createBlock(G,{key:0,appearance:"warning",class:"custom-plugins-warning",message:k.value},null,8,["message"])):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createBlock(gF,{key:1,"can-delete-cloned-plugin":$e.value,"can-delete-custom-plugin":le.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":me.value,config:n.config,"plugin-list":v.value,"onDelete:success":ke},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"])):(e.openBlock(),e.createBlock(uF,{key:2,"can-delete-cloned-plugin":$e.value,"can-delete-custom-plugin":le.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":me.value,config:n.config,"plugin-list":v.value,"onDelete:success":ke,onPluginClicked:ie[4]||(ie[4]=Y=>ye.$emit("plugin-clicked",Y))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"]))]))])])}}}),[["__scopeId","data-v-6f778468"]]),OF={key:1,class:"datakit-config-card-canvas"},PF={class:"config-card-details-label","data-testid":"datakit-configuration-label"},VF={class:"config-card-details-value datakit-canvas-container","data-testid":"datakit-configuration-canvas"},$F={class:"canvas-wrapper"},RF=Me(e.defineComponent({__name:"DatakitConfigCardCanvas",props:{pluginData:{},item:{}},setup(n){const t=e.computed(()=>{var r;return sw.safeParse((r=n.pluginData)==null?void 0:r.config).success});return Xd(n.pluginData),(r,o)=>{const i=e.resolveComponent("KLabel");return t.value?(e.openBlock(),e.createElementBlock("div",OF,[e.createElementVNode("div",PF,[e.createVNode(i,null,{default:e.withCtx(()=>[...o[0]||(o[0]=[e.createElementVNode("span",{class:"label-content"}," Nodes ",-1)])]),_:1})]),e.createElementVNode("div",VF,[e.createElementVNode("div",$F,[e.createVNode(Yf,{class:"datakit-flow-panels",mode:"view",resizable:""})])])])):(e.openBlock(),e.createBlock(e.unref(Ie.ConfigCardItem),{key:0,item:n.item},null,8,["item"]))}}}),[["__scopeId","data-v-9a3ef1ac"]]),LF={class:"kong-ui-entity-plugin-config-card"},DF={class:"name-cell-wrapper"},MF={class:"info-name"},jF={key:0},FF={key:0},UF={key:0},KF={key:0},qF={key:0},cp="config",GF=Me(e.defineComponent({__name:"PluginConfigCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string"||!n.entityId||!n.pluginType)},configCardDoc:{type:String,default:"",required:!1},showIdAsLink:{type:Boolean,default:!1},hideTitle:{type:Boolean,default:!1},scopedEntityType:{type:String,required:!1,default:""},scopedEntityId:{type:String,required:!1,default:null},expandPartial:{type:Boolean,default:!0}},emits:["loading","fetch:error","error:fetch-schema","fetch:success","navigation-click"],setup(n,{emit:t}){var N;const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=st.usePluginMetaData(),{setFieldType:s}=st.usePluginHelpers(),{getPropValue:c}=Ie.useHelpers(),l=e.computed(()=>{var w;let E=(w=Qe.item[o.config.app])==null?void 0:w[o.scopedEntityType?"forEntity":"all"].replace(/{entityType}/gi,o.scopedEntityType).replace(/{entityId}/gi,o.scopedEntityId??"").concat(o.expandPartial?"?expand_partials=true":"");if(o.config.app==="konnect"){const S=o.expandPartial?"&":"?";E=E.concat(`${S}__ui_data=true`)}return E}),u=e.computed(()=>{var S,I;const E={},w=((S=_.value)==null?void 0:S.fields)||[];for(let j=0;j<w.length;j++){const A=_.value.fields[j],x=(I=Object.keys(A))==null?void 0:I[0];s(E,x,A[x])}return{...E,instance_name:{section:Ie.ConfigurationSchemaSection.Basic,order:1.5},consumer:{label:i("plugins.fields.consumer"),section:Ie.ConfigurationSchemaSection.Basic,order:6},route:{label:i("plugins.fields.route"),section:Ie.ConfigurationSchemaSection.Basic,order:6},service:{label:i("plugins.fields.service"),section:Ie.ConfigurationSchemaSection.Basic,order:6},consumer_group:{label:i("plugins.fields.consumer_group"),section:Ie.ConfigurationSchemaSection.Basic,order:6},protocols:{type:Ie.ConfigurationSchemaType.BadgeTag,section:Ie.ConfigurationSchemaSection.Basic,order:7}}}),p=e.computed(()=>{var w,S,I;if(!((w=_.value)!=null&&w.fields))return[];const E=(S=_.value.fields)==null?void 0:S.find(j=>{var x;return((x=Object.keys(j))==null?void 0:x[0])===cp});return((I=E==null?void 0:E[cp])==null?void 0:I.fields)||[]}),d=e.computed(()=>{var w,S;const E={};if(!p.value)return E;for(let I=0;I<((w=p.value)==null?void 0:w.length);I++){const j=p.value[I],A=(S=Object.keys(j))==null?void 0:S[0],x=j[A];x.required&&(E[A]={order:1}),s(E,A,x)}return E}),f=E=>{var S;const w=(S=a.pluginMetaData[o.config.pluginType])==null?void 0:S.scope;return w?Object.fromEntries(Object.entries(E).filter(([I,j])=>j?!0:!(I==="service"&&!w.includes(fe.PluginScope.SERVICE)||I==="route"&&!w.includes(fe.PluginScope.ROUTE)||I==="consumer"&&!w.includes(fe.PluginScope.CONSUMER)||I==="consumer_group"&&!w.includes(fe.PluginScope.CONSUMER_GROUP)))):E},m=E=>Wr(E,"__ui_data"),{getMessageFromError:g}=Ie.useErrors(),{axiosInstance:y}=Ie.useAxios((N=o.config)==null?void 0:N.axiosRequestConfig),b=e.computed(()=>{var w,S;let E=`${o.config.apiBaseUrl}${Qe.form[o.config.app].pluginSchema}`;return o.config.app==="konnect"&&(E=E.replace(/{controlPlaneId}/gi,((w=o.config)==null?void 0:w.controlPlaneId)||"")),E.replace(/\/{workspace}/gi,(S=o.config)!=null&&S.workspace?`/${o.config.workspace}`:"").replace(/{plugin}/gi,o.config.pluginType)}),_=e.ref({});Ie.useSchemaProvider(_);const k=e.ref(!1),C=e.ref("");return e.onBeforeMount(async()=>{k.value=!0;try{const{data:E}=await y.get(b.value);_.value=E}catch(E){C.value=g(E),r("error:fetch-schema",E)}finally{k.value=!1}}),(E,w)=>{const S=e.resolveComponent("KSkeleton"),I=e.resolveComponent("KEmptyState"),j=e.resolveComponent("KCopy");return e.openBlock(),e.createElementBlock("div",LF,[k.value?(e.openBlock(),e.createBlock(S,{key:0,"data-testid":"plugin-config-card-loader","table-columns":2,type:"table"})):C.value?(e.openBlock(),e.createBlock(I,{key:1,"data-testid":"plugin-config-card-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(C.value),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseConfigCard),{key:2,"code-block-record-formatter":m,config:n.config,"config-card-doc":n.configCardDoc,"config-schema":u.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"fetch-url":l.value,"hide-title":n.hideTitle,"plugin-config-key":cp,"plugin-config-schema":d.value,"record-resolver":f,"onFetch:error":w[0]||(w[0]=A=>E.$emit("fetch:error",A)),"onFetch:success":w[1]||(w[1]=A=>E.$emit("fetch:success",A)),onLoading:w[2]||(w[2]=A=>E.$emit("loading",A))},e.createSlots({name:e.withCtx(A=>[e.createElementVNode("div",DF,[e.createVNode(e.unref(Er.PluginIcon),{class:"plugin-icon",name:e.unref(c)("rowValue",A),size:24},null,8,["name"]),e.createElementVNode("span",MF,e.toDisplayString(e.unref(a).getDisplayName(e.unref(c)("rowValue",A))),1)])]),consumer:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"consumer")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"consumer-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",jF,"–"))]),route:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"route")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"route-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",FF,"–"))]),service:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"service")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"service-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",UF,"–"))]),consumer_group:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"consumer_group")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"consumer-group-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",KF,"–"))]),partials:e.withCtx(A=>{var x,O,P,R,W,Z,X,F,J;return[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:(O=(x=e.unref(c)("rowValue",A))==null?void 0:x[0])==null?void 0:O.id,value:((R=(P=e.unref(c)("rowValue",A))==null?void 0:P[0])==null?void 0:R.id)+((Z=(W=e.unref(c)("rowValue",A))==null?void 0:W[0])!=null&&Z.name?"/"+((F=(X=e.unref(c)("rowValue",A))==null?void 0:X[0])==null?void 0:F.name):""),type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>{var $,q;return E.$emit("navigation-click",(q=($=e.unref(c)("rowValue",A))==null?void 0:$[0])==null?void 0:q.id,"partial")}},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"partial-copy-uuid",text:(J=e.unref(c)("rowValue",A))==null?void 0:J[0].id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",qF,"–"))]}),_:2},[n.config.pluginType==="datakit"&&n.config.app==="konnect"?{name:"config-card-item-nodes",fn:e.withCtx(A=>[e.createVNode(RF,{item:A.row,"plugin-data":A.record},null,8,["item","plugin-data"])]),key:"0"}:void 0]),1032,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title","plugin-config-schema"]))])}}}),[["__scopeId","data-v-03dcf2b4"]]),{usePluginMetaData:HF,useProvideExperimentalFreeForms:zF}=st;function WF(n,t=!1){const r=n.length;let o=0,i="",a=0,s=16,c=0,l=0,u=0,p=0,d=0;function f(C,N){let E=0,w=0;for(;E<C;){let S=n.charCodeAt(o);if(S>=48&&S<=57)w=w*16+S-48;else if(S>=65&&S<=70)w=w*16+S-65+10;else if(S>=97&&S<=102)w=w*16+S-97+10;else break;o++,E++}return E<C&&(w=-1),w}function m(C){o=C,i="",a=0,s=16,d=0}function g(){let C=o;if(n.charCodeAt(o)===48)o++;else for(o++;o<n.length&&Bi(n.charCodeAt(o));)o++;if(o<n.length&&n.charCodeAt(o)===46)if(o++,o<n.length&&Bi(n.charCodeAt(o)))for(o++;o<n.length&&Bi(n.charCodeAt(o));)o++;else return d=3,n.substring(C,o);let N=o;if(o<n.length&&(n.charCodeAt(o)===69||n.charCodeAt(o)===101))if(o++,(o<n.length&&n.charCodeAt(o)===43||n.charCodeAt(o)===45)&&o++,o<n.length&&Bi(n.charCodeAt(o))){for(o++;o<n.length&&Bi(n.charCodeAt(o));)o++;N=o}else d=3;return n.substring(C,N)}function y(){let C="",N=o;for(;;){if(o>=r){C+=n.substring(N,o),d=2;break}const E=n.charCodeAt(o);if(E===34){C+=n.substring(N,o),o++;break}if(E===92){if(C+=n.substring(N,o),o++,o>=r){d=2;break}switch(n.charCodeAt(o++)){case 34:C+='"';break;case 92:C+="\\";break;case 47:C+="/";break;case 98:C+="\b";break;case 102:C+="\f";break;case 110:C+=`
438
+ `)[0],R=[{startLineNumber:x+1,startColumn:O+1,endLineNumber:x+1,endColumn:O+2,message:P,severity:tl.MarkerSeverity.Error,source:zf}];tl.editor.setModelMarkers(S,zf,R),s("error",P)}}),w.onDidPaste(I=>{const j=w.getModel();if(!j)return;const A=j.getValueInRange(I.range);for(const x of i$){const O=x.extract(A);if(O){y.value=O,b.value=x.name,g.value=!0;return}}}),E())}const g=e.shallowRef(!1),y=e.shallowRef(null),b=e.shallowRef("");function _(){g.value=!1,y.value=null,b.value=""}function k(){y.value&&(d.value=u(y.value),_())}function C(w){return o(`plugins.free-form.datakit.examples.${w}`)}function N(w){const S=w.code;try{const I=Rn.load(d.value,{schema:Eo,json:!0}),j=Rn.load(S,{schema:Eo,json:!0});if(typeof I=="object"&&I!==null&&en(I.config,j))return;const A=Wr({...i,config:{...j}},["__ui_data"]);d.value=u(A)}catch(I){s("error",c(I))}E()}function E(){const w=l.value,S=w==null?void 0:w.getModel();!w||!S||(w.setPosition(S.getFullModelRange().getEndPosition()),w.focus())}return t({setExampleCode:N}),(w,S)=>(e.openBlock(),e.createElementBlock("div",a$,[e.createVNode(e.unref(Fe.KAlert),{class:"examples"},{icon:e.withCtx(()=>[e.createVNode(e.unref(Re.SparklesIcon))]),default:e.withCtx(()=>[e.createElementVNode("div",s$,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.description_example"))+" ",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Gb),I=>(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:I.id,appearance:"secondary",size:"small",onClick:j=>N(I)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C(I.i18nKey)),1)]),_:2},1032,["onClick"]))),128))])]),_:1}),e.createVNode(e.unref(ua.MonacoEditor),{ref:"editor",modelValue:d.value,"onUpdate:modelValue":S[0]||(S[0]=I=>d.value=I),appearance:"standalone",class:"editor",language:"yaml",options:f,theme:"light",onReady:m},null,8,["modelValue"]),e.createVNode(e.unref(Fe.KModal),{"action-button-text":e.unref(o)("plugins.free-form.datakit.detected_config_format_confirm"),title:e.unref(o)("plugins.free-form.datakit.detected_config_format_title"),visible:g.value,onCancel:_,onProceed:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.detected_config_format",{format:b.value})),1)]),_:1},8,["action-button-text","title","visible"])]))}}),[["__scopeId","data-v-20217c6a"]]),{t:c$}=jt.createI18n("en-us",Yt),ac=Tt.createGlobalState(()=>{const n=Tt.useLocalStorage("datakit-editor-mode","flow"),t=Tt.useLocalStorage("datakit-editor-sidebar-expanded",!0),r=Tt.useLocalStorage("datakit-editor-response-panel-collapsed",!1);return{editorMode:n,sidePanelExpanded:t,responsePanelCollapsed:r}});function u$({enabled:n,confirm:t}){Nr.onBeforeRouteLeave(()=>e.toValue(n)?t?t():window.confirm(c$("plugins.free-form.datakit.flow_editor.leave_confirm")):!0);const r=o=>{e.toValue(n)&&o.preventDefault()};Tt.useEventListener("beforeunload",r)}const d$={class:"label-content"},f$={class:"count"},p$={class:"label-content"},m$={class:"count"},Hb=.5,Wf=.03,h$=30,Yf=Me(e.defineComponent({__name:"FlowPanels",props:{inactive:{type:Boolean},mode:{},resizable:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Yt),r=e.ref(!1),o=e.ref(!1),{responsePanelCollapsed:i}=ac(),{state:a,configNodeCounts:s,clearPendingLayout:c,setPendingFitView:l,commit:u,clear:p,portalSelection:d}=Pt(),f=e.useId(),m=`${f}-request`,g=`${f}-response`,y=Nt.useVueFlow(m),b=Nt.useVueFlow(g);function _(le,he){const{onPaneClick:Oe,onNodesChange:$e,onEdgesChange:Pe,getSelectedNodes:qe,getSelectedEdges:Ye}=le,{removeSelectedElements:et}=he;function Ve(ke){if(!ke){et();return}ke.some(_e=>_e.type==="select")&&qe.value.length+Ye.value.length>0&&et()}$e(Ve),Pe(Ve),Oe(()=>Ve())}_(y,b),_(b,y),e.watch(d,le=>{le&&(y.removeSelectedElements(),b.removeSelectedElements())});const k=e.useTemplateRef("flowPanels"),C=e.useTemplateRef("requestLabel"),N=e.useTemplateRef("requestCanvasContainer"),E=e.useTemplateRef("requestFlow"),w=e.useTemplateRef("resizeHandle"),S=e.useTemplateRef("responseLabel"),I=e.useTemplateRef("responseCanvasContainer"),j=e.useTemplateRef("responseFlow"),A=Tt.useElementBounding(k),x=Tt.useElementBounding(C),O=Tt.useElementBounding(N),P=Tt.useElementBounding(w),R=Tt.useElementBounding(S),W=Tt.useElementBounding(I),Z=e.computed(()=>Math.max(h$,A.height.value*Wf)),X=e.computed(()=>A.height.value-x.height.value-P.height.value-R.height.value),F=e.computed(()=>{const le=X.value;return le?Math.max(Wf,Z.value/le):Wf}),J=e.ref(Hb),$=e.computed(()=>`${J.value*100}%`),q=e.computed(()=>`${(1-J.value)*100}%`),K=e.computed(()=>J.value<=F.value),ae=e.computed(()=>1-J.value<=F.value);function M(le,{persist:he=!0}={}){const Oe=Math.min(1,Math.max(0,le));J.value=Oe,he&&n.mode==="edit"&&(i.value=ae.value)}function v(le,he=!0){M(le?1:Hb,{persist:he})}function H(le=!0){M(0,{persist:le})}if(n.mode==="edit"){const le=s.value.response===0,he=i.value;v(le||he,!1)}else e.watch(()=>s.value.response,le=>{v(le===0,!1)},{immediate:!0});const oe=()=>{n.resizable&&(K.value?v(!1):H())},te=()=>{n.resizable&&v(!ae.value)},{isDragging:ge}=Tt.useDraggable(w,{onMove(le){if(!n.resizable)return;const he=Math.max(0,le.y-O.top.value),Oe=Math.min(1,Math.max(0,he/X.value));M(Oe,{persist:!1})},onEnd(){n.resizable&&(O.height.value<Z.value?H():W.height.value<Z.value?v(!0):M(J.value))}});function me(){e.nextTick(()=>{var le,he;(le=E.value)==null||le.fitView(),(he=j.value)==null||he.fitView()})}return e.watch([r,o,()=>a.value.pendingLayout,()=>a.value.pendingFitView],([le,he,Oe,$e])=>{n.inactive||!le||!he||!Oe&&!$e||(Oe&&c(),$e&&l(!1),setTimeout(async()=>{var Pe,qe;Oe&&(await((Pe=E.value)==null?void 0:Pe.autoLayout(!1)),await((qe=j.value)==null?void 0:qe.autoLayout(!1)),u("*"),Oe==="clearHistory"&&p()),$e&&setTimeout(()=>me(),0)},0))}),(le,he)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowPanels",ref:k,class:"flow-panels"},[e.createElementVNode("div",{ref_key:"requestLabel",ref:C,class:e.normalizeClass(["label request",{resizable:n.resizable}]),onClick:oe},[n.resizable?(e.openBlock(),e.createBlock(e.unref(Re.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:K.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",d$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.request"))+" ",1),e.createElementVNode("span",f$,[e.unref(s).request===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).request}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"requestCanvasContainer",ref:N,class:e.normalizeClass(["canvas",{dragging:e.unref(ge)}]),style:e.normalizeStyle({flexBasis:$.value})},[e.createVNode(ef,{ref_key:"requestFlow",ref:E,"flow-id":m,mode:n.mode,phase:"request",onInitialized:he[0]||(he[0]=Oe=>r.value=!0),onNodesChange:he[1]||(he[1]=Oe=>r.value=!1)},null,8,["mode"])],6),e.createElementVNode("div",{ref_key:"resizeHandle",ref:w,class:e.normalizeClass(["resize-handle",{resizable:n.resizable}])},null,2),e.createElementVNode("div",{ref_key:"responseLabel",ref:S,class:e.normalizeClass(["label response",{dragging:e.unref(ge),resizable:n.resizable}]),onClick:te},[n.resizable?(e.openBlock(),e.createBlock(e.unref(Re.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:ae.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",p$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.response"))+" ",1),e.createElementVNode("span",m$,[e.unref(s).response===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).response}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"responseCanvasContainer",ref:I,class:e.normalizeClass(["canvas response",{dragging:e.unref(ge)}]),style:e.normalizeStyle({flexBasis:q.value})},[e.createVNode(ef,{ref_key:"responseFlow",ref:j,"flow-id":g,mode:n.mode,phase:"response",onInitialized:he[2]||(he[2]=Oe=>o.value=!0),onNodesChange:he[3]||(he[3]=Oe=>o.value=!1)},null,8,["mode"])],6)],512))}}),[["__scopeId","data-v-5a4fec80"]]),g$={class:"dk-confirm-modal-body"},y$={class:"connections"},_$=Me(e.defineComponent({__name:"ConflictModal",props:{title:{},message:{},addedConnections:{},removedConnections:{}},emits:["cancel","confirm"],setup(n,{expose:t,emit:r}){const{i18n:{t:o}}=Je(),i=r,a=e.ref(!1),s=e.ref(n.message),c=e.ref(n.addedConnections??[]),l=e.ref(n.removedConnections??[]);let u=null;function p(){a.value=!1,i("cancel"),u==null||u(!1)}function d(){a.value=!1,i("confirm"),u==null||u(!0)}async function f(m,g,y){return s.value=m,c.value=g??[],l.value=y??[],a.value=!0,await new Promise(b=>{u=b})}return t({open:f}),(m,g)=>{const y=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(y,{"action-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.proceed"),"close-on-backdrop-click":"","max-width":"660px",title:n.title??e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.title"),visible:a.value,"z-index":9999,onCancel:p,onProceed:d},{default:e.withCtx(()=>[e.createElementVNode("div",g$,[e.createElementVNode("p",null,e.toDisplayString(s.value),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.message.confirm")),1),e.createElementVNode("div",y$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref(Re.AddIcon),{color:`var(--kui-color-background-success, ${e.unref(o1)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref(Re.RemoveIcon),{color:`var(--kui-color-text-danger, ${e.unref(Ph)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128))])])]),_:1},8,["action-button-text","title","visible"])}}}),[["__scopeId","data-v-e6df03c2"]]),b$={class:"dk-editor-nav"},w$={class:"top"},k$={class:"bottom"},C$=Me(e.defineComponent({__name:"EditorNav",emits:["back"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Yt),o=t,i=[{label:r("plugins.free-form.datakit.flow_editor.return_to_config"),icon:Re.ArrowLeftIcon,onClick:()=>o("back")}],{sidePanelExpanded:a}=ac(),s=e.computed(()=>a.value?r("plugins.free-form.datakit.flow_editor.collapse_panel"):r("plugins.free-form.datakit.flow_editor.expand_panel")),c=e.ref(!1);function l(){a.value=!a.value}return(u,p)=>(e.openBlock(),e.createElementBlock("nav",b$,[e.createElementVNode("div",w$,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(i,({label:d,to:f,icon:m,onClick:g})=>e.createVNode(e.unref(Fe.KTooltip),{key:d,"kpop-attributes":{offset:"10px"},label:d,placement:"right"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:d,appearance:"none",class:"nav-item",icon:"",to:f,onClick:g},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["size"]))]),_:2},1032,["to","onClick"]))]),_:2},1032,["label"])),64))]),e.createElementVNode("div",k$,[e.createElementVNode("div",{class:e.normalizeClass(["side-panel-toggle",{expanded:e.unref(a)}]),onTransitionend:p[0]||(p[0]=e.withModifiers(d=>c.value=!1,["self"])),onTransitionstart:p[1]||(p[1]=e.withModifiers(d=>c.value=!0,["self"]))},[e.createVNode(e.unref(Fe.KTooltip),{label:c.value?void 0:s.value,placement:e.unref(a)?"left":"right"},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none",class:"nav-item nav-item-toggle",icon:"",size:"large",onClick:l},{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createBlock(e.unref(Re.ChevronDoubleLeftIcon),{key:0,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["size"])):(e.openBlock(),e.createBlock(e.unref(Re.ChevronDoubleRightIcon),{key:1,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["size"]))]),_:1})]),_:1},8,["label","placement"])],34)])]))}}),[["__scopeId","data-v-0dcd2605"]]),E$={class:"dk-editor-main"},N$={class:"header"},S$={class:"actions"},x$={class:"settings"},A$={ref:"canvasContainer",class:"body"},v$=Me(e.defineComponent({__name:"EditorMain",setup(n){const{t}=jt.createI18n("en-us",Yt),{modalOpen:r,undo:o,redo:i,canUndo:a,canRedo:s,load:c}=Pt();function l(f){return t(`plugins.free-form.datakit.examples.${f}`)}function u(f){const m=Rn.load(f.code,{schema:Eo,json:!0});if(typeof m!="object"||m===null)return;const g=m,y={config:{...g,nodes:g.nodes??[]}};c(y,!0)}function p(){r.value=!1}Oh({enabled:r,undo:o,redo:i});const d={maxWidth:"300px",zIndex:1e4};return(f,m)=>(e.openBlock(),e.createElementBlock("div",E$,[e.createElementVNode("header",N$,[e.createElementVNode("div",S$,[e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).undo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.undo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(a),icon:"",onClick:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.UndoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode(xl,{keys:e.unref(ol).redo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.redo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(s),icon:"",onClick:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.RedoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),m[0]||(m[0]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createElementVNode("div",x$,[e.createVNode(An,{label:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.label"),"label-attributes":{info:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.description"),tooltipAttributes:d},name:"config.debug"},null,8,["label","label-attributes"])]),m[1]||(m[1]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createVNode(e.unref(Fe.KDropdown),{appearance:"tertiary","kpop-attributes":{placement:"bottom-end",target:"body"},"show-caret":"","trigger-text":e.unref(t)("plugins.free-form.datakit.flow_editor.examples"),width:240},{items:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Gb),g=>(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:g.id,onClick:y=>u(g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l(g.i18nKey)),1)]),_:2},1032,["onClick"]))),128))]),_:1},8,["trigger-text"]),e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",target:"_blank",to:"https://developer.konghq.com/plugins/datakit/"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.view_docs"))+" ",1),e.createVNode(e.unref(Re.ExternalLinkIcon))]),_:1}),e.createVNode(e.unref(Fe.KButton),{onClick:p},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.done")),1)]),_:1})])]),e.createElementVNode("div",A$,[e.createVNode(Yf,{mode:"edit",resizable:""})],512)]))}}),[["__scopeId","data-v-1cf532ff"]]),I$=["draggable"],B$={class:"icon"},T$={class:"content"},O$={class:"title"},P$={class:"description"},V$=Me(e.defineComponent({__name:"NodePanelItem",props:{type:{},unsupported:{type:Boolean}},emits:["dragstart"],setup(n,{emit:t}){e.useCssVars(l=>({f502bd0e:e.unref(a),v4b2eb58e:e.unref(s)}));const r=t,{summary:o,icon:i}=yl[n.type],{colors:{background:a,foreground:s}}=cI(yl[n.type].group);function c(l){r("dragstart",l,n.type)}return(l,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-panel-item",{[`node-type-${n.type}`]:!0,unsupported:n.unsupported}]),draggable:!n.unsupported,onDragstart:c},[e.createElementVNode("div",B$,[e.createVNode(e.unref(i),{size:16})]),e.createElementVNode("div",T$,[e.createElementVNode("div",O$,e.toDisplayString(n.type),1),e.createElementVNode("div",P$,e.toDisplayString(e.unref(o)),1)])],42,I$))}}),[["__scopeId","data-v-829422ff"]]),$$={class:"dk-node-panel"},R$={key:0,class:"title"},L$={class:"node-list"},D$={class:"group-title"},M$={class:"group-items"},j$={"aria-hidden":"true",class:"preview",inert:""},F$=Me(e.defineComponent({__name:"NodePanel",props:{hideTitle:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Yt),{createNode:r}=Pt(),o=e.inject(ur.KM_2446_DATAKIT_JWT_NODES,!1),i=e.computed(()=>o?xy:xy.filter(({id:u})=>u!=="authentication")),a=`dk-drag-preview-${e.useId()}`,s=e.shallowRef(),c=e.computed(()=>s.value?[{id:"preview",type:"flow",data:s.value,position:{x:0,y:0}}]:[]),l=async(u,p)=>{var A,x,O;const d=u.currentTarget,{left:f,top:m,width:g,height:y}=d.getBoundingClientRect(),b=u.clientX-f,_=u.clientY-m;s.value=r({type:p}),await e.nextTick();const k=document.querySelector(`#${a}`)||d,C=k.cloneNode(!0);C.classList.add("dk-drag-snapshot");const{offsetWidth:N,offsetHeight:E}=k;Object.assign(C.style,{position:"absolute",top:"-9999px",left:"-9999px",width:`${N}px`,height:`${E}px`}),document.body.appendChild(C);const w=b/g,S=_/y,I={ratioX:w,ratioY:S,offsetX:N*w,offsetY:E*S},j={action:"create-node",data:{type:p,anchor:I}};(A=u.dataTransfer)==null||A.setData(pa,JSON.stringify(j)),(x=u.dataTransfer)==null||x.setData(`${pa}/${p}`,p),(O=u.dataTransfer)==null||O.setDragImage(C,I.offsetX,I.offsetY),requestAnimationFrame(()=>{C.remove(),s.value=void 0})};return(u,p)=>{const d=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",$$,[n.hideTitle?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("h3",R$,[e.createVNode(d,{class:"label",info:e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.description")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.title")),1)]),_:1},8,["info"])])),e.createElementVNode("div",L$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,f=>(e.openBlock(),e.createElementBlock("section",{key:f.id,class:"node-group"},[e.createElementVNode("h4",D$,e.toDisplayString(f.title),1),e.createElementVNode("div",M$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.nodes,m=>(e.openBlock(),e.createBlock(V$,{key:m.type,type:m.type,onDragstart:l},null,8,["type"]))),128))])]))),128))]),e.createElementVNode("div",j$,[e.createVNode(e.unref(Nt.VueFlow),{nodes:c.value},{"node-flow":e.withCtx(f=>[e.createVNode(Gy,{id:a,data:f.data},null,8,["data"])]),_:1},8,["nodes"])])])}}}),[["__scopeId","data-v-f2040974"]]);function U$(){const{addField:n,getNodeByName:t,removeField:r,replaceConfig:o,renameField:i,disconnectOutEdges:a,nodeMapByName:s}=Pt(),c=t("vault");if(!c)throw new Error("no vault node");const l=e.computed(()=>{var g;return((g=s.value.get("vault"))==null?void 0:g.config)||{}});return{formData:e.computed(()=>({vault:{...l.value}})),addVault:(g,y)=>{n(c.id,"output",g,!1);const b={...c.config,[g]:y};o(c.id,b)},removeVault:g=>{const y=Yr(c,"output",g);if(!y)return;const b=c.fields.output.length===1;r(c.id,y.id,!0,!1);const _=Wr(c.config,g);o(c.id,_,!b),b&&a(c.id)},updateVault:(g,y,b=!0)=>{const _={...c.config,[g]:y};o(c.id,_,b)},renameVault:(g,y,b=!0)=>{var N;const _=Yr(c,"output",g);if(!_)return;i(c.id,_.id,y,!1);const k=((N=c.config)==null?void 0:N[g])??"",C={...Wr(c.config,g),[y]:k};o(c.id,C,b)}}}const K$=e.defineComponent({__name:"VaultSecretPicker",props:{secretRef:{type:[String,Boolean]},secretName:{},validateName:{type:Function,default:()=>{}},isEditing:{type:Boolean,default:!1}},emits:["proceed","cancel"],setup(n,{emit:t}){const r=t,{i18n:{t:o}}=st.useI18n(),i=e.inject(Ze.FORMS_CONFIG),a=e.ref(n.secretName||""),s=e.ref(""),c=e.computed(()=>a.value.trim()?n.validateName(a.value.trim(),n.isEditing)===void 0:!1),l=e.computed(()=>!c.value),u=()=>{const m=a.value.trim(),g=n.validateName(m,n.isEditing);return s.value=g||"",g===void 0},p=()=>{s.value="",u()},d=m=>{u()&&r("proceed",{secretRef:m,secretName:a.value.trim()})},f=()=>{a.value="",s.value="",r("cancel")};return e.watch(()=>n.secretName,m=>{a.value=m||"",s.value=""}),(m,g)=>{const y=e.resolveComponent("KInput"),b=e.resolveComponent("KEmptyState");return e.unref(i)?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPicker),{key:0,"additional-disabled":l.value,config:e.unref(i),"proceed-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.proceed_button_text"),setup:n.secretRef,title:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.title"),onCancel:f,onProceed:d},{"form-prefix":e.withCtx(()=>[e.createVNode(y,{"model-value":a.value,"onUpdate:modelValue":[g[0]||(g[0]=_=>a.value=_),p],"data-testid":"vault-secret-picker-secret-name-input",error:!!s.value,"error-message":s.value,label:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.label"),"label-attributes":{info:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.help")},placeholder:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.placeholder"),required:""},null,8,["model-value","error","error-message","label","label-attributes","placeholder"])]),_:1},8,["additional-disabled","config","proceed-button-text","setup","title"])):(e.openBlock(),e.createBlock(b,{key:1,"icon-variant":"error",message:e.unref(o)("plugins.free-form.vault_picker.component_error")},null,8,["message"]))}}}),q$={class:"dk-vault-panel"},G$={class:"title"},H$={class:"vault-list"},z$={key:0,class:"vault-list-item"},W$={class:"vault-list-item-key"},Y$={class:"vault-list-item-key-text"},J$=Me(e.defineComponent({__name:"VaultField",props:{autofocus:{type:Boolean},name:{},labelAttributes:{}},emits:["update","add","remove"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l}=df(e.toRef(r,"name")),u=Gt(e.toRef(r,"name")),p=e.ref(null),d=e.ref(null),f=e.computed(()=>{if(!p.value)return null;const E=l(p.value),w=u.value?u.value.value[p.value]:void 0;return E===void 0||w===void 0?null:{id:p.value,key:E,value:w}}),{i18n:{t:m}}=st.useI18n(),g=e.computed(()=>new Set(i.value.map(([,E])=>E))),y=()=>{if(!u.value)return;const w=a();d.value=w,p.value=w},b=()=>{p.value=null,d.value&&(s(d.value),d.value=null)},_=E=>{if(!f.value)throw new Error("no selected entry");const w=f.value.key,S=w!==E.secretName,I=f.value.value!==E.secretRef,j=S||I;f.value.value=E.secretRef,f.value.key=E.secretName,I&&(u.value.value[f.value.id]=E.secretRef),S&&c(f.value.id,E.secretName),d.value?o("add",E.secretName,E.secretRef):j&&o("update",E.secretName,E.secretRef,S?w:void 0),d.value=null,b()},k=E=>{p.value=E},C=E=>{const w=l(E);s(E),o("remove",w)},N=(E,w)=>{var S;if(!E)return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_required_error");if(g.value.has(E)&&!(w&&E===((S=f.value)==null?void 0:S.key)))return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_exists_error")};return(E,w)=>{var A,x;const S=e.resolveComponent("KButton"),I=e.resolveComponent("KDropdownItem"),j=e.resolveComponent("KDropdown");return e.openBlock(),e.createElementBlock("div",q$,[e.createElementVNode("h3",G$,e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.title")),1),e.createVNode(S,{appearance:"tertiary",class:"add-button",size:"small",onClick:y},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.add_button")),1)]),_:1}),e.createElementVNode("div",H$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),([O,P])=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:O},[P?(e.openBlock(),e.createElementBlock("div",z$,[e.createElementVNode("div",W$,[e.createVNode(e.unref(Re.KeyIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:16},null,8,["color"]),e.createElementVNode("div",Y$,e.toDisplayString(P),1)]),e.createVNode(j,null,{items:e.withCtx(()=>[e.createVNode(I,{onClick:R=>k(O)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1},8,["onClick"]),e.createVNode(I,{danger:"",onClick:R=>C(O)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1},8,["onClick"])]),default:e.withCtx(()=>[e.createVNode(S,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text, ${e.unref(od)})`},null,8,["color"])]),_:1})]),_:2},1024)])):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(K$,{"is-editing":!!p.value&&!d.value,"secret-name":(A=f.value)==null?void 0:A.key,"secret-ref":(x=f.value)==null?void 0:x.value,"validate-name":N,onCancel:b,onProceed:_},null,8,["is-editing","secret-name","secret-ref"])])}}}),[["__scopeId","data-v-a7726f48"]]);function X$(){const{getSchema:n}=ft();return e.computed(()=>{const t=n("config.resources");if(!t)throw new Error("Failed to get resource schema");const r=vr(t);return r.fields.forEach(o=>{const i=Object.keys(o)[0];if(i==="cache"){const a=o[i];o[i]={...a,fields:[...a.fields,{partial_id:{type:"string"}}]},a.fields.forEach(s=>{const c=Object.keys(s)[0];if(c==="redis"){const l=s[c];s[c]={...l},delete s[c].required}})}}),r})}const Z$={key:1},Q$=["innerHTML"],eR={class:"horizontal-container"},Jf=Me(e.defineComponent({__name:"RadioField",props:{labelAttributes:{},multiple:{type:Boolean},items:{},label:{},autofocus:{type:Boolean},name:{}},emits:["update:modelValue"],setup(n,{emit:t}){const r=t,o=e.createPropsRestProxy(n,["name","items"]),{getSelectItems:i}=ft(),a=Gt(e.toRef(()=>n.name)),s=hn(a.path,o),c=e.computed(()=>n.items?n.items:a.path?i(a.path.value):[]),l=u=>{a.value&&(a.value.value=u),r("update:modelValue",u)};return(u,p)=>{var m;const d=e.resolveComponent("KAlert"),f=e.resolveComponent("KLabel");return e.unref(a).error?(e.openBlock(),e.createBlock(d,{key:0,appearance:"danger",message:e.unref(a).error.message},null,8,["message"])):e.withDirectives((e.openBlock(),e.createElementBlock("div",Z$,[e.createVNode(f,e.normalizeProps(e.guardReactiveProps(e.unref(s).labelAttributes)),e.createSlots({default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s).label)+" ",1)]),_:2},[(m=e.unref(s).labelAttributes)!=null&&m.info?{name:"tooltip",fn:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:e.unref(s).labelAttributes.info},null,8,Q$)]),key:"0"}:void 0]),1040),e.createElementVNode("div",eR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,g=>(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),{key:g.value,"model-value":e.unref(a).value.value,"onUpdate:modelValue":[p[0]||(p[0]=y=>e.unref(a).value.value=y),l],"card-orientation":"horizontal",label:g.label,"selected-value":g.value},null,8,["model-value","label","selected-value"]))),128))])],512)),[[e.vShow,!e.unref(a).hide.value]])}}}),[["__scopeId","data-v-7c0483f3"]]),tR={class:"dk-cache-panel"},nR={class:"title"},rR={key:0,class:"cache-item"},oR={class:"cache-item-key"},iR={class:"cache-item-key-text"},aR={class:"dk-resource-cache-form"},sR={key:1},lR={key:2,class:"dk-cache-inline-redis"},cR={key:3,class:"dk-cache-redis-editor"},uR={key:0,class:"redis-editor-error"},dR=Me(e.defineComponent({__name:"CacheField",props:{strategy:{}},emits:["update","remove","cancel"],setup(n,{emit:t}){const r=Rn.dump({host:"127.0.0.1",port:6379},{indent:2}),o=t,{getDefault:i,formData:a}=ft(),s=Gt("cache");if(s.error)throw new Error("No cache schema");const c=e.inject(Ai),l=e.computed(()=>!!c),u=e.shallowRef(""),p=e.ref(""),d=e.ref(!1),{i18n:{t:f}}=st.useI18n(),m=e.computed(()=>{var S,I,j;return g.value==="redis"?l.value?!!((S=a.cache)!=null&&S.partial_id||(I=a.cache)!=null&&I.redis):!!((j=a.cache)!=null&&j.redis)&&!p.value:!0}),g=e.computed(()=>{var S;return(S=s.value.value)==null?void 0:S.strategy}),y=e.computed(()=>{var S;return(S=s.value.value)!=null&&S.redis?Rn.dump(s.value.value.redis,{indent:2,noRefs:!0}):""});e.watch([d,g],([S,I])=>{S&&I==="redis"&&!l.value&&(u.value=y.value||r,p.value="")}),e.watch(u,S=>{var I;if(!l.value&&g.value==="redis")try{const j=Rn.load(S,{json:!0});j&&typeof j=="object"&&(a.cache.redis=j,p.value="")}catch(j){p.value=((I=j.message)==null?void 0:I.split(`
439
+ `)[0])||"Invalid YAML"}});const b=()=>{d.value=!0},_=()=>{d.value=!1,o("cancel")},k=()=>{o("remove")},C=()=>{b(),s.value.value||(s.value.value=i("cache"),s.value.value.strategy="memory")},N=()=>{d.value=!1,o("update",a)},E=()=>{var S,I;g.value==="memory"&&((S=a.cache)!=null&&S.partial_id)&&((I=a.cache)==null||delete I.partial_id)};async function w({codeElement:S,language:I,code:j}){S.innerHTML=await zC.codeToHtml(j,{lang:I,theme:"catppuccin-mocha",structure:"inline"})}return(S,I)=>{const j=e.resolveComponent("KButton"),A=e.resolveComponent("KDropdownItem"),x=e.resolveComponent("KDropdown"),O=e.resolveComponent("KLabel"),P=e.resolveComponent("KCodeBlock"),R=e.resolveComponent("KModal");return e.openBlock(),e.createElementBlock("div",tR,[e.createElementVNode("h3",nR,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title")),1),n.strategy?(e.openBlock(),e.createElementBlock("div",rR,[e.createElementVNode("div",oR,[e.createVNode(e.unref(Re.DatabaseIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"]),e.createElementVNode("div",iR,e.toDisplayString(n.strategy),1)]),e.createVNode(x,null,{items:e.withCtx(()=>[e.createVNode(A,{onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1}),e.createVNode(A,{danger:"",onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(j,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text, ${e.unref(od)})`},null,8,["color"])]),_:1})]),_:1})])):(e.openBlock(),e.createBlock(j,{key:1,appearance:"tertiary",class:"add-button",size:"small",onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.add_button")),1)]),_:1})),e.createVNode(R,{"action-button-disabled":!m.value,"action-button-text":e.unref(f)("actions.save"),"max-width":"640px",title:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title"),visible:d.value,onCancel:_,onProceed:N},{default:e.withCtx(()=>{var W,Z;return[e.createElementVNode("div",aR,[e.createVNode(Jf,{items:[{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.memory"),value:"memory"},{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.redis"),value:"redis"}],name:"strategy","onUpdate:modelValue":E},null,8,["items"]),g.value==="memory"?(e.openBlock(),e.createBlock(ot,{key:0,name:"memory.dictionary_name"})):e.createCommentVNode("",!0),g.value==="redis"&&l.value?(e.openBlock(),e.createElementBlock("div",sR,[e.createVNode(O,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.select_redis_configuration")),1)]),_:1}),e.createVNode(e.unref(Bh.RedisConfigurationSelector),{"model-value":(W=e.unref(a).cache)==null?void 0:W.partial_id,"redis-type":"redis-ee","onUpdate:modelValue":I[0]||(I[0]=X=>e.unref(a).cache.partial_id=X)},null,8,["model-value"])])):e.createCommentVNode("",!0),g.value==="redis"&&l.value&&!((Z=e.unref(a).cache)!=null&&Z.partial_id)&&y.value?(e.openBlock(),e.createElementBlock("div",lR,[e.createElementVNode("div",null,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config_preview")),1),e.createVNode(P,{id:"dk-cache-redis-configuration",code:y.value,language:"yaml",theme:"dark",onCodeBlockRender:w},null,8,["code"])])):e.createCommentVNode("",!0),g.value==="redis"&&!l.value?(e.openBlock(),e.createElementBlock("div",cR,[e.createVNode(O,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config")),1)]),_:1}),e.createVNode(e.unref(ua.MonacoEditor),{modelValue:u.value,"onUpdate:modelValue":I[1]||(I[1]=X=>u.value=X),appearance:"standalone",class:"redis-editor",language:"yaml",theme:"light"},null,8,["modelValue"]),p.value?(e.openBlock(),e.createElementBlock("p",uR,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]}),_:1},8,["action-button-disabled","action-button-text","title","visible"])])}}}),[["__scopeId","data-v-6b125ed7"]]),fR={class:"dk-resources-panel"},pR=Me(e.defineComponent({__name:"ResourcesPanel",setup(n){const t=X$(),r=e.ref(0),{addVault:o,removeVault:i,updateVault:a,renameVault:s,formData:c}=U$();function l(y,b,_){_&&_!==y&&s(_,y,!1),a(y,b)}const{state:u,commit:p}=Pt(),d=e.computed(()=>({cache:u.value.cacheConfig}));function f(y){u.value.cacheConfig=y.cache,p()}function m(){u.value.cacheConfig=void 0,p()}function g(){r.value++}return(y,b)=>(e.openBlock(),e.createElementBlock("div",fR,[e.createVNode(Jt,{data:e.unref(c),schema:e.unref(t)},{default:e.withCtx(()=>[e.createVNode(J$,{name:"vault",onAdd:e.unref(o),onRemove:e.unref(i),onUpdate:l},null,8,["onAdd","onRemove"])]),_:1},8,["data","schema"]),b[0]||(b[0]=e.createElementVNode("hr",{class:"dk-resources-divider"},null,-1)),(e.openBlock(),e.createBlock(Jt,{key:`${r.value}`,data:d.value,schema:e.unref(t)},{default:e.withCtx(()=>{var _;return[e.createVNode(dR,{strategy:(_=d.value.cache)==null?void 0:_.strategy,onCancel:g,onRemove:m,onUpdate:f},null,8,["strategy"])]}),_:1},8,["data","schema"]))]))}}),[["__scopeId","data-v-9093c001"]]),mR={class:"header"},hR={class:"title"},gR={class:"body"},yR={class:"panel"},_R=Me(e.defineComponent({__name:"SidePanel",setup(n){const{t}=jt.createI18n("en-us",Yt),{sidePanelExpanded:r}=ac(),{propertiesPanelOpen:o,selectedNode:i}=Pt(),a=e.ref("nodes");function s(){o.value=!1}e.watch(i,l=>{l||s()});const c=e.ref(!1);return e.onMounted(()=>{c.value=!0}),(l,u)=>{const p=e.resolveComponent("KSegmentedControl");return e.openBlock(),e.createElementBlock("aside",{class:e.normalizeClass(["side-panel",{expanded:e.unref(r),inited:c.value}])},[e.createElementVNode("header",mR,[e.createElementVNode("h2",hR,e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.name")),1)]),e.createElementVNode("div",gR,[e.createElementVNode("div",yR,[e.createVNode(p,{modelValue:a.value,"onUpdate:modelValue":u[0]||(u[0]=d=>a.value=d),options:[{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.nodes"),value:"nodes"},{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.resources.title"),value:"resources"}]},null,8,["modelValue","options"]),a.value==="nodes"?(e.openBlock(),e.createBlock(F$,{key:0,class:"node-panel","hide-title":""})):e.createCommentVNode("",!0),a.value==="resources"?(e.openBlock(),e.createBlock(pR,{key:1})):e.createCommentVNode("",!0)])])],2)}}}),[["__scopeId","data-v-9e854e60"]]),bR=e.defineComponent({__name:"HttpMethodField",props:{name:{}},setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Dt,{items:e.unref(nf)([...e.unref(Ny)]),name:n.name},null,8,["items","name"]))}});function wR(n,t){const r=[],o=(i,a)=>{typeof a=="string"&&r.push({nodeName:n.name,path:["nodes",t,...i],value:a})};if("input"in n&&n.input!=null&&o(["input"],n.input),"inputs"in n&&n.inputs&&typeof n.inputs=="object")for(const[i,a]of Object.entries(n.inputs))a!=null&&o(["inputs",i],a);if("output"in n&&n.output!=null&&o(["output"],n.output),"outputs"in n&&n.outputs&&typeof n.outputs=="object")for(const[i,a]of Object.entries(n.outputs))a!=null&&o(["outputs",i],a);return r}function kR(n){const t=n.path[2];return t==="output"||t==="outputs"}function zb(n){if(!n)return!1;for(const t of Object.values(n))if(t!=null)return!0;return!1}function Wb(n,t){const r=n.input!==void 0&&n.input!==null,o=zb(n.inputs);r&&o&&t.addIssue({code:"custom",message:'A node cannot use both "input" and "inputs". Use one or the other.',path:["inputs"]});const i=n.output!==void 0&&n.output!==null,a=zb(n.outputs);i&&a&&t.addIssue({code:"custom",message:'A node cannot use both "output" and "outputs". Use one or the other.',path:["outputs"]})}function Yb(n,t,r){if(!n.nodes)return;const o=n.nodes.map(l=>l.name),i=new Set;o.forEach((l,u)=>{i.has(l)&&r.addIssue({code:"custom",message:`Duplicate node name: "${l}"`,path:["nodes",u,"name"]}),i.add(l)});const a=new Set([...t,...o]),s=new Map,c=new Map;n.nodes.forEach((l,u)=>{for(const p of wR(l,u)){const d=p.value.split(".",1)[0];if(a.has(d)||r.addIssue({code:"custom",message:`Unknown node "${d}" in connection "${p.value}"`,path:p.path}),kR(p)){const f=`${p.nodeName}->${d}`;c.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${p.nodeName}" outputs to "${d}" and "${d}" inputs from "${p.nodeName}". Specify it on one side only.`,path:p.path}):s.set(f,s.get(f)??p.path)}else{const f=`${d}->${p.nodeName}`;s.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${d}" outputs to "${p.nodeName}" and "${p.nodeName}" inputs from "${d}". Specify it on one side only.`,path:p.path}):c.set(f,c.get(f)??p.path)}}})}const CR=Q.z.enum(Cy),ER=Q.z.enum(ei),Jb=n=>ei.includes(n),Xf=Q.z.enum(Ey),Xb=Xf.options;Q.z.union([Xf,CR]);const NR=/^[A-Za-z_][A-Za-z0-9_-]{0,254}$/,sc=Q.z.string().min(1).max(255).regex(NR,"Invalid node name (snake_case / kebab-case only)").refine(n=>!Jb(n),"Name clashes with reserved implicit node").brand(),Zb=Q.z.union([ER,sc]),SR=Q.z.string().min(1).brand(),xR=["then","else"];Q.z.enum(xR);const ct=Q.z.string().min(1).max(255).refine(n=>{if(Zb.safeParse(n).success)return!0;const t=n.match(/^([^.]+)\.([^.]+)$/);if(!t)return!1;const[,r,o]=t;return Zb.safeParse(r).success&&SR.safeParse(o).success},'Invalid connection, expected "NODE" or "NODE.FIELD"').nullish(),AR=Q.z.object({body:ct,headers:ct,http_proxy:ct,https_proxy:ct,proxy_auth_password:ct,proxy_auth_username:ct,query:ct,url:ct}).partial().strict(),vR=Q.z.object({headers:ct,body:ct}).partial().strict(),IR=Q.z.object({data:ct,key:ct,ttl:ct}).partial().strict(),BR=Q.z.object({claims:ct,key:ct}).partial().strict(),TR=Q.z.object({key:ct,token:ct}).partial().strict(),Qb=Q.z.enum(Ny),ew=Q.z.enum(Md),jn=Q.z.object({type:Q.z.string(),name:sc,input:ct,inputs:Q.z.record(Q.z.string().min(1).max(255),ct).nullish(),output:ct,outputs:Q.z.record(Q.z.string().min(1).max(255),ct).nullish()}).loose().superRefine((n,t)=>{Wb(n,t)}),OR=Q.z.object({type:Q.z.string(),name:Q.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"invalid node name",fatal:!1}),Xb.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${Xb.join(", ")}`})}),PR=jn.safeExtend({type:Q.z.literal("call"),method:Qb.default("GET").nullish(),ssl_server_name:Q.z.string().nullish(),ssl_verify:Q.z.boolean().default(!0).nullish(),timeout:Q.z.number().int().min(0).max(2147483646).nullish(),url:Q.z.url().nullish(),inputs:AR.nullish(),outputs:Q.z.object({body:ct,headers:ct,raw_body:ct,status:ct}).partial().nullish()}).strict(),VR=jn.safeExtend({type:Q.z.literal("exit"),status:Q.z.number().int().min(200).max(599).default(200).nullish(),warn_headers_sent:Q.z.boolean().nullish(),inputs:vR.nullish(),output:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),$R=jn.safeExtend({type:Q.z.literal("jq"),jq:Q.z.string().min(1).max(10240),outputs:Q.z.never().nullish()}).strict(),RR=jn.safeExtend({type:Q.z.literal("xml_to_json"),recognize_type:Q.z.boolean().nullish().default(!0),attributes_block_name:Q.z.string().min(1).max(32).nullish(),attributes_name_prefix:Q.z.string().min(1).max(32).nullish(),text_block_name:Q.z.string().min(1).max(32).nullish().default("#text"),text_as_property:Q.z.boolean().nullish().default(!1),xpath:Q.z.string().min(1).max(256).nullish(),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),LR=jn.safeExtend({type:Q.z.literal("json_to_xml"),attributes_block_name:Q.z.string().min(1).max(32).nullish(),attributes_name_prefix:Q.z.string().min(1).max(32).nullish(),root_element_name:Q.z.string().min(1).max(64).nullish(),text_block_name:Q.z.string().min(1).max(32).nullish().default("#text"),inputs:Q.z.record(Q.z.string().min(1).max(255),ct).nullish(),outputs:Q.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),DR=jn.safeExtend({type:Q.z.literal("jwt_decode"),inputs:Q.z.never().nullish(),outputs:Q.z.object({header:ct,payload:ct,signature:ct}).partial().nullish()}).strict(),MR=jn.safeExtend({type:Q.z.literal("jwt_sign"),algorithm:ew,expires_in:Q.z.number().int().min(1).default(300).nullish(),inputs:BR.nullish(),kid:Q.z.string().nullish(),not_before:Q.z.number().int().min(0).default(0).nullish(),outputs:Q.z.object({claims:ct,header:ct,token:ct}).partial().nullish(),static_claims:Q.z.record(Q.z.string(),Q.z.string()).default({}).nullish(),typ:Q.z.string().default("JWT").nullish()}).strict(),jR=jn.safeExtend({type:Q.z.literal("jwt_verify"),allowed_algorithms:Q.z.array(ew).default([]).nullish(),audiences:Q.z.array(Q.z.string()).default([]).nullish(),inputs:TR.nullish(),issuers:Q.z.array(Q.z.string()).default([]).nullish(),leeway:Q.z.number().int().min(0).default(0).nullish(),outputs:Q.z.object({claims:ct,header:ct}).partial().nullish(),required_claims:Q.z.array(Q.z.string()).default([]).nullish(),validate_exp:Q.z.boolean().default(!0).nullish(),validate_nbf:Q.z.boolean().default(!0).nullish()}).strict(),FR=jn.safeExtend({type:Q.z.literal("property"),content_type:Q.z.enum(["application/json","text/plain","application/octet-stream"]).nullish(),property:Q.z.string().min(1).max(255),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),UR=jn.safeExtend({type:Q.z.literal("static"),values:Q.z.record(Q.z.string(),Q.z.unknown()),input:Q.z.never().nullish(),inputs:Q.z.never().nullish()}).strict(),KR=jn.safeExtend({type:Q.z.literal("cache"),bypass_on_error:Q.z.boolean().nullish(),inputs:IR.nullish(),outputs:Q.z.object({data:ct,hit:ct,miss:ct,stored:ct}).partial().nullish(),ttl:Q.z.number().int().gt(0).nullish()}).strict(),qR=jn.safeExtend({type:Q.z.literal("branch"),then:Q.z.array(sc).min(1).max(64).nullish(),else:Q.z.array(sc).min(1).max(64).nullish()}).strict(),GR=OR.pipe(Q.z.discriminatedUnion("type",[PR,VR,$R,RR,LR,DR,MR,jR,FR,UR,KR,qR])),HR=Q.z.record(Q.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),Q.z.string().min(1).max(4095)),zR=Q.z.object({dictionary_name:Q.z.string().nullish().default("kong_db_cache")}),WR=Q.z.object({host:Q.z.string().default("127.0.0.1"),port:Q.z.number().int().min(0).max(65535).default(6379)}),YR=Q.z.object({ip:Q.z.string().default("127.0.0.1"),port:Q.z.number().int().min(0).max(65535).default(6379)}),JR=Q.z.object({host:Q.z.string().nullish().default("127.0.0.1"),port:Q.z.number().int().min(0).max(65535).nullish().default(6379),connect_timeout:Q.z.number().int().min(0).max(2147483646).nullish().default(2e3),send_timeout:Q.z.number().int().min(0).max(2147483646).nullish().default(2e3),read_timeout:Q.z.number().int().min(0).max(2147483646).nullish().default(2e3),username:Q.z.string().nullish(),password:Q.z.string().nullish(),sentinel_username:Q.z.string().nullish(),sentinel_password:Q.z.string().nullish(),database:Q.z.number().int().nullish().default(0),keepalive_pool_size:Q.z.number().int().min(1).max(2147483646).nullish().default(256),keepalive_backlog:Q.z.number().int().min(0).max(2147483646).nullish(),sentinel_master:Q.z.string().nullish(),sentinel_role:Q.z.enum(["master","slave","any"]).nullish(),sentinel_nodes:Q.z.array(WR).min(1,{message:"sentinel_nodes must contain at least 1 item"}).nullish(),cluster_nodes:Q.z.array(YR).min(1,{message:"cluster_nodes must contain at least 1 item"}).nullish(),ssl:Q.z.boolean().default(!1).nullish(),ssl_verify:Q.z.boolean().default(!0).nullish(),server_name:Q.z.string().nullish(),cluster_max_redirections:Q.z.number().int().default(5).nullish(),connection_is_proxied:Q.z.boolean().default(!1).nullish(),cloud_authentication:Q.z.object({auth_provider:Q.z.enum(["aws","azure","gcp"]).nullish(),aws_access_key_id:Q.z.string().nullish(),aws_assume_role_arn:Q.z.string().nullish(),aws_cache_name:Q.z.string().nullish(),aws_is_serverless:Q.z.boolean().default(!0).nullish(),aws_region:Q.z.string().nullish(),aws_role_session_name:Q.z.string().nullish(),aws_secret_access_key:Q.z.string().nullish(),azure_client_id:Q.z.string().nullish(),azure_client_secret:Q.z.string().nullish(),azure_tenant_id:Q.z.string().nullish(),gcp_service_account_json:Q.z.string().nullish()}).nullish(),timeout:Q.z.number().int().nullish(),sentinel_addresses:Q.z.array(Q.z.string()).min(1).nullish(),cluster_addresses:Q.z.array(Q.z.string()).min(1).nullish()}).superRefine((n,t)=>{var l;const r=n.host!==void 0&&n.host!==null,o=n.port!==void 0&&n.port!==null;(r&&!o||!r&&o)&&t.addIssue({code:"custom",message:"host and port must be specified together",path:r?["port"]:["host"]});const i=!!n.sentinel_master,a=!!n.sentinel_role,s=!!((l=n.sentinel_nodes)!=null&&l.length),c=[i,a,s].filter(Boolean).length;c>0&&c<3&&t.addIssue({code:"custom",message:"sentinel_master, sentinel_role and sentinel_nodes must be provided together"}),n.connection_is_proxied===!0&&!r&&t.addIssue({code:"custom",message:"host is required when connection_is_proxied is true (host/port should point to the proxy)",path:["host"]})}),XR=Q.z.object({strategy:Q.z.enum(["memory","redis"]).nullish(),memory:zR,redis:JR}),ZR=Q.z.object({vault:HR.nullish(),cache:XR.nullish()});Q.z.array(Q.z.object({id:Q.z.string()})),Q.z.object({nodes:Q.z.array(GR).min(1,"At least one node is required").max(64),debug:Q.z.boolean().default(!1).nullish(),resources:ZR.nullish()}).strict().superRefine((n,t)=>{Yb(n,ei,t)});const tw=Xf.options,Zf=Q.z.string().min(1).refine(n=>!n.includes("."),"Invalid node name").refine(n=>!Jb(n),"Node name conflicts with reserved implicit node"),yt=Q.z.string().refine(n=>{if(!n||/\s/.test(n))return!1;const t=n.indexOf(".");if(t===-1)return!0;const r=n.slice(0,t),o=n.slice(t+1);return r.length>0&&o.length>0},"Invalid connection"),nw=Q.z.object({body:yt.nullish(),headers:yt.nullish(),query:yt.nullish()}).partial().strict(),rw=Q.z.object({headers:yt.nullish(),body:yt.nullish()}).partial().strict(),ow=Q.z.object({data:yt.nullish(),key:yt.nullish(),ttl:yt.nullish()}).partial().strict(),iw=Q.z.object({claims:yt.nullish(),key:yt.nullish()}).partial().strict(),aw=Q.z.object({key:yt.nullish(),token:yt.nullish()}).partial().strict(),QR={call:nw,exit:rw,cache:ow,jwt_sign:iw,jwt_verify:aw};function e2(n){const t=QR[n];return t?Object.keys(t.shape):null}const Fn=Q.z.object({type:Q.z.string(),name:Zf,input:yt.nullish(),inputs:Q.z.record(Q.z.string(),yt.nullish()).nullish(),output:yt.nullish(),outputs:Q.z.record(Q.z.string(),yt.nullish()).nullish()}).loose().superRefine((n,t)=>{Wb(n,t)}),t2=Q.z.object({type:Q.z.string(),name:Q.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"Invalid node name",fatal:!1}),tw.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${tw.join(", ")}`})}),n2=Fn.safeExtend({type:Q.z.literal("call"),method:Qb.nullish(),ssl_server_name:Q.z.string().nullish(),ssl_verify:Q.z.boolean().nullish(),timeout:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),url:Q.z.string().nullish(),inputs:nw.nullish(),outputs:Q.z.object({body:yt.nullish(),headers:yt.nullish(),status:yt.nullish()}).partial().nullish()}).strict(),r2=Fn.safeExtend({type:Q.z.literal("exit"),status:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),warn_headers_sent:Q.z.boolean().nullish(),inputs:rw.nullish(),output:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),o2=Fn.safeExtend({type:Q.z.literal("jq"),jq:Q.z.string().nullish(),outputs:Q.z.never().nullish()}).strict(),i2=Fn.safeExtend({type:Q.z.literal("xml_to_json"),recognize_type:Q.z.boolean().nullish(),attributes_block_name:Q.z.string().nullish(),attributes_name_prefix:Q.z.string().nullish(),text_block_name:Q.z.string().nullish(),text_as_property:Q.z.boolean().nullish(),xpath:Q.z.string().nullish(),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),a2=Fn.safeExtend({type:Q.z.literal("json_to_xml"),attributes_block_name:Q.z.string().nullish(),attributes_name_prefix:Q.z.string().nullish(),root_element_name:Q.z.string().nullish(),text_block_name:Q.z.string().nullish(),inputs:Q.z.record(Q.z.string(),yt.nullish()).nullish(),outputs:Q.z.never().nullish()}).strict(),s2=Fn.safeExtend({type:Q.z.literal("property"),content_type:Q.z.string().nullish(),property:Q.z.string().nullish(),inputs:Q.z.never().nullish(),outputs:Q.z.never().nullish()}).strict(),l2=Fn.safeExtend({type:Q.z.literal("static"),values:Q.z.record(Q.z.string(),Q.z.unknown()).nullish(),input:Q.z.never().nullish(),inputs:Q.z.never().nullish()}).strict(),c2=Fn.safeExtend({type:Q.z.literal("cache"),bypass_on_error:Q.z.boolean().nullish(),inputs:ow.nullish(),outputs:Q.z.object({data:yt.nullish(),hit:yt.nullish(),miss:yt.nullish(),stored:yt.nullish()}).partial().nullish(),ttl:Q.z.union([Q.z.number(),Q.z.string()]).nullish()}).strict(),u2=Fn.safeExtend({type:Q.z.literal("jwt_decode"),inputs:Q.z.never().nullish(),outputs:Q.z.object({header:yt.nullish(),payload:yt.nullish(),signature:yt.nullish()}).partial().nullish()}).strict(),d2=Fn.safeExtend({type:Q.z.literal("jwt_sign"),algorithm:Q.z.enum(Md).nullish(),expires_in:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),inputs:iw.nullish(),kid:Q.z.string().nullish(),not_before:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),outputs:Q.z.object({claims:yt.nullish(),header:yt.nullish(),token:yt.nullish()}).partial().nullish(),static_claims:Q.z.record(Q.z.string(),Q.z.string()).nullish(),typ:Q.z.string().nullish()}).strict(),f2=Fn.safeExtend({type:Q.z.literal("jwt_verify"),allowed_algorithms:Q.z.array(Q.z.enum(Md)).nullish(),audiences:Q.z.array(Q.z.string()).nullish(),inputs:aw.nullish(),issuers:Q.z.array(Q.z.string()).nullish(),leeway:Q.z.union([Q.z.number(),Q.z.string()]).nullish(),outputs:Q.z.object({claims:yt.nullish(),header:yt.nullish()}).partial().nullish(),required_claims:Q.z.array(Q.z.string()).nullish(),validate_exp:Q.z.boolean().nullish(),validate_nbf:Q.z.boolean().nullish()}).strict(),p2=Fn.safeExtend({type:Q.z.literal("branch"),then:Q.z.array(Zf).nullish(),else:Q.z.array(Zf).nullish()}).strict(),m2=t2.pipe(Q.z.discriminatedUnion("type",[n2,r2,o2,i2,a2,u2,d2,f2,s2,l2,c2,p2])),h2=Q.z.record(Q.z.string(),Q.z.string()),g2=Q.z.object({dictionary_name:Q.z.string().nullish()}),y2=Q.z.object(),_2=Q.z.object({strategy:Q.z.enum(["memory","redis"]).nullish(),memory:g2.nullish(),redis:y2.nullish()}),b2=Q.z.object({vault:h2.nullish(),cache:_2.nullish()}),sw=Q.z.object({nodes:Q.z.array(m2).nullish(),debug:Q.z.boolean().nullish(),resources:b2.nullish()}).strict().superRefine((n,t)=>{!n||!Array.isArray(n.nodes)||Yb(n,ei,t)}).nullish(),lw=e.defineComponent({__name:"InputsRecordField",props:{name:{},items:{},nodeType:{}},emits:["change:inputs"],setup(n){const{getSchema:t}=ft(),{i18n:r}=Je(),o=e.computed(()=>{const i=t("inputs");if(!i)return[];const a=i.fields.map(c=>Object.keys(c)[0]);if(pn(n.nodeType))return a;const s=e2(n.nodeType);return s===null?a:s.length===0?[]:Pv(a,s)});return(i,a)=>(e.openBlock(),e.createBlock(Ft,{"as-child":"",name:n.name,"reset-label-path":"isolate"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,s=>(e.openBlock(),e.createBlock(Dt,{key:s,clearable:"","enable-filtering":"",items:n.items,name:s,placeholder:e.unref(r).t("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c=>i.$emit("change:inputs",s,c?c.value:null)},e.createSlots({_:2},[i.$slots["item-label"]?{name:"item-label",fn:e.withCtx(c=>[e.renderSlot(i.$slots,"item-label",e.mergeProps({ref_for:!0},c))]),key:"0"}:void 0]),1032,["items","name","placeholder","onChange"]))),128))]),_:3},8,["name"]))}}),w2=["data-testid"],k2={class:"dk-inputs-map-field-entry-body"},C2={class:"dk-inputs-map-field-entry-content"},E2=Me(e.defineComponent({__name:"InputsMapField",props:{name:{},items:{},fieldNameValidator:{},keyOrder:{}},emits:["change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l,field:u}=df(e.toRef(r,"name")),{value:p}=Gt(e.toRef(r,"name")),{i18n:{t:d}}=Je(),f=e.useTemplateRef("root"),m=e.ref(null),g=e.ref({}),y=e.ref({});let b;const _=e.computed(()=>{var x;return(x=r.keyOrder)!=null&&x.length?[...i.value].sort((O,P)=>{const R=r.keyOrder.indexOf(O[1]),W=r.keyOrder.indexOf(P[1]);return(R===-1?1/0:R)-(W===-1?1/0:W)}):i.value});async function k(x,O="key"){var P;f.value&&(await e.nextTick(),(P=f.value.querySelector(`[data-${O}-input="${x}"]`))==null||P.focus())}function C(){const x=a();if(!x)return;y.value[x]="";const O=_.value.findIndex(([,P])=>!P);k(O===-1?_.value.length-1:O),m.value=x}function N(x,O){s(x),delete y.value[x],delete g.value[x],x===m.value&&(m.value=null),O.trim()!==""&&o("remove:field",O)}function E(x){b=y.value[x]??l(x)??""}function w(x,O){const P=O.trim();y.value[x]=P,I(x,P)}function S(x){var P;const O=y.value[x]??l(x)??"";if(I(x,O)){y.value[x]=b,c(x,b),delete g.value[x];return}if(x===m.value){if(O.trim()==="")return;c(x,O),o("add:field",O,((P=p==null?void 0:p.value)==null?void 0:P[x])??null),m.value=null}else c(x,O),o("rename:field",b,O);delete g.value[x],b=O}function I(x,O){delete g.value[x];const P=r.fieldNameValidator("input",b,O);if(P)return g.value[x]=P,P}function j(x){I(x,y.value[x]??l(x)??"")}function A(x,O){if(p!=null&&p.value&&(p.value[x]=O),x===m.value)return;const P=l(x);P&&o("change:inputs",P,O)}return e.watch(i,x=>{const O=new Set(x.map(([P])=>P));Object.keys(y.value).forEach(P=>{O.has(P)?y.value[P]=y.value[P]??l(P)??"":(delete y.value[P],delete g.value[P])}),x.forEach(([P,R])=>{y.value[P]=y.value[P]??R}),m.value&&!O.has(m.value)&&(m.value=null)},{immediate:!0}),e.watch(()=>r.keyOrder,()=>{if(!m.value)return;const x=_.value.findIndex(([O])=>O===m.value);x!==-1&&k(x)}),(x,O)=>{const P=e.resolveComponent("KAlert"),R=e.resolveComponent("KLabel"),W=e.resolveComponent("KInput"),Z=e.resolveComponent("KSelect"),X=e.resolveComponent("KButton");return e.unref(u).error?(e.openBlock(),e.createBlock(P,{key:0,appearance:"danger",message:e.unref(u).error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:f,class:"dk-inputs-map-field"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,([F,J],$)=>{var q;return e.openBlock(),e.createElementBlock("div",{key:F,class:"dk-inputs-map-field-entry","data-testid":`ff-kv-container-${e.unref(u).path.value}.${$}`},[e.createVNode(R,{for:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.label")),1)]),_:1},8,["for"]),e.createElementVNode("div",k2,[e.createElementVNode("div",C2,[e.createVNode(W,{id:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`,class:"ff-kv-field-entry-key","data-key-input":$,"data-testid":`ff-key-${e.unref(u).path.value}.${$}`,error:!!g.value[F],"error-message":g.value[F],"model-value":y.value[F]??J,placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.placeholder"),onBlur:K=>j(F),onChange:K=>S(F),onFocus:K=>E(F),"onUpdate:modelValue":K=>w(F,K)},null,8,["id","data-key-input","data-testid","error","error-message","model-value","placeholder","onBlur","onChange","onFocus","onUpdate:modelValue"]),e.createVNode(Z,{class:"ff-kv-field-entry-value",clearable:"","data-testid":`ff-value-${e.unref(u).path.value}.${$}`,"enable-filtering":"",items:n.items,label:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.source"),"model-value":(q=e.unref(p))==null?void 0:q[F],placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:K=>A(F,(K==null?void 0:K.value)??null)},e.createSlots({_:2},[x.$slots["item-label"]?{name:"item-template",fn:e.withCtx(({item:K})=>[e.renderSlot(x.$slots,"item-label",e.mergeProps({ref_for:!0},K),void 0,!0)]),key:"0"}:void 0]),1032,["data-testid","items","label","model-value","placeholder","onChange"])]),e.createVNode(X,{appearance:"tertiary",class:"dk-inputs-map-field-remove-btn","data-testid":`ff-kv-remove-btn-${e.unref(u).path.value}.${$}`,icon:"",onClick:K=>N(F,J)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.CloseIcon))]),_:1},8,["data-testid","onClick"])])],8,w2)}),128)),e.createVNode(X,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${e.unref(u).path.value}`,disabled:!!m.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-43dcb370"]]),N2={class:"dk-source-item"},lc=Me(e.defineComponent({__name:"SourceItem",props:{item:{}},setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock("span",N2,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(jd)(n.item.type).icon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["color","size"])),e.createTextVNode(" "+e.toDisplayString(n.item.label),1)]))}}),[["__scopeId","data-v-d9aa16eb"]]),S2={key:1,class:"dk-inputs-field-or"},vn=Me(e.defineComponent({__name:"InputsField",props:{items:{},fieldNames:{},fieldNameValidator:{},nodeType:{}},emits:["change:input","change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=t,{getSchema:o}=ft(),{i18n:{t:i}}=Je(),a=e.computed(()=>o("inputs")),s=e.computed(()=>a.value?a.value.type==="record"?lw:E2:null);function c(f){r("change:input",f?f.value:null)}function l(f,m){r("add:field",f,m)}function u(f,m){r("change:inputs",f,m)}function p(f){r("remove:field",f)}function d(f,m){r("rename:field",f,m)}return(f,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(Fe.KLabel),{class:"dk-inputs-field-h1",info:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.tooltip")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.label")),1)]),_:1},8,["info"]),e.unref(o)("input")?(e.openBlock(),e.createBlock(Dt,{key:0,class:"dk-inputs-field-h2",clearable:"","enable-filtering":"",items:n.items,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.input"),"label-attributes":{info:void 0},name:"input",placeholder:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c},{"item-label":e.withCtx(g=>[e.renderSlot(f.$slots,"item-label",e.normalizeProps(e.guardReactiveProps(g)),()=>[e.createVNode(lc,{item:g},null,8,["item"])],!0)]),_:3},8,["items","label","placeholder"])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",S2,[e.createElementVNode("span",null,e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.or")),1)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(Fe.KLabel),{key:2,class:"dk-inputs-field-h2 dk-margin-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.fields")),1)]),_:1})):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(s),e.mergeProps({key:3,items:n.items,"key-order":n.fieldNames,name:"inputs"},s.value===lw?{nodeType:n.nodeType}:{fieldNameValidator:n.fieldNameValidator},{"onAdd:field":l,"onChange:inputs":u,"onRemove:field":p,"onRename:field":d}),{"item-label":e.withCtx(g=>[e.createVNode(lc,{item:g},null,8,["item"])]),_:1},16,["items","key-order"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-4f1ce4e7"]]),x2={},A2={class:"dk-node-form-divider"};function v2(n,t){return e.openBlock(),e.createElementBlock("hr",A2)}const Qn=Me(x2,[["render",v2],["__scopeId","data-v-35ed58be"]]),I2={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{query:{description:"HTTP request query",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"},B2={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"};function T2(n){const t=Number(n);return!isNaN(t)&&isFinite(t)}function gn(...n){return function(r){for(const o of n){const i=o(r);if(i)return i}}}function vo(n){const{i18n:{t}}=Je(),r=()=>n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_empty",n):"Field is required";return function(i){if(i==null||typeof i=="string"&&i.trim()==="")return r()}}function cw(n,t){const{i18n:{t:r}}=Je();return function(i){if(i!=null)switch(n){case"identifier":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_identifier_format",t):"Invalid identifier format";return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(i)?void 0:a()}case"url":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_url_format"):"Invalid URL format";try{new URL(i);return}catch{return a()}}default:return}}}function Or(n=0,t=1/0,r){const{i18n:{t:o}}=Je();return function(a){if(a!=null&&typeof a=="string"&&(a.length<n||a.length>t))return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.string_len_range",{fieldName:r.fieldName,minLength:n,maxLength:t}):`Value must be between ${n} and ${t} characters`}}function uw(n){const{i18n:{t}}=Je();return function(o){if(!T2(o))return n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_number",n):"Value must be a number"}}function vi(n,t){const{i18n:{t:r}}=Je();return function(i){if(i==null)return;const a=uw(t)(i);if(a)return a;const s=Number(i);switch(n){case"float":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_float",t):"Invalid float format";return Number.isFinite(s)?void 0:c()}case"integer":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_integer",t):"Invalid integer format";return Number.isInteger(s)?void 0:c()}default:return}}}function Ii(n=-1/0,t=1/0,r){const{i18n:{t:o}}=Je();return function(a){if(a==null)return;const s=uw(r)(a);if(s)return s;const c=Number(a);if(c<n||c>t)return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.number_range",{fieldName:r.fieldName,min:n,max:t}):`Value must be between ${n} and ${t}`}}function O2(n,t){const{state:r}=Pt(),{i18n:{t:o}}=Je();return function(a){if(r.value.nodes.some(s=>s.name===a&&s.id!==n))return t?typeof t=="string"?t:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",t):"Name must be unique."}}function P2(n,t,r){const{i18n:{t:o}}=Je();return function(a){if(!t)return;if(r?t.fields[n].some(c=>c.name===a&&c.id!==r):t.fields[n].some(c=>c.name===a)){const c=o(n==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name");return o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",{fieldName:c})}}}function V2(){const{i18n:{t:n}}=Je();return function(r){if(Kd(r))return n("plugins.free-form.datakit.flow_editor.node_properties.errors.reserved_node_name",{nodeName:r})}}function dw(n){const{i18n:{t}}=Je(),r={fieldName:t("plugins.free-form.datakit.flow_editor.node_properties.name")};return gn(vo(r),cw("identifier",r),V2(),O2(n,r))}function $2(n){const{i18n:{t}}=Je(),{getNodeById:r}=Pt();return function(i,a,s){const c={fieldName:t(i==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name")};return gn(vo(c),P2(i,r(n),s))(a)}}function R2(n){const t=e.ref({}),r=e.computed(()=>Object.values(t.value).every(s=>!s)),o={};Object.keys(n).forEach(s=>{const c=n[s],l=d=>{const f=typeof d=="function"?d():d,m=c(f);return t.value[s]=m,m},u=()=>{t.value[s]=void 0},p=d=>(u(),l(d));o[s]={handleChange:p,handleBlur:p,validate:p,isValid:e.computed(()=>t.value[s]===void 0),error:e.computed(()=>t.value[s])}});function i(){t.value={}}function a(s){var c;for(const l of Object.keys(n)){const u=s[l],p=typeof u=="function"?u():u;(c=o[l])==null||c.validate(p)}return t.value}return{isValid:r,errorMap:t,fields:o,clearErrors:i,validate:a}}function Pr(n){const{validationConfig:t,getValidationData:r,toggleNodeValid:o}=n,{skipValidation:i}=Pt(),a=e.computed(()=>typeof t=="function"?t():t),s=e.computed(()=>R2(a.value)),c=e.computed(()=>s.value.fields),l=e.computed(()=>s.value.isValid.value);function u(){const d=r(),f=s.value.validate(d),m={};for(const g in a.value)m[g]=f[g];return m}function p(d,f){const m=()=>{const y=r(),b=c.value[d];b&&b.handleBlur(y[d])},g=()=>{f==null||f();const y=r(),b=c.value[d];b&&b.handleChange(y[d])};return e.computed(()=>{const y=c.value[d];return{validate:m,update:g,error:y?!y.isValid.value:!1,errorMessage:y?y.error.value??"":""}})}return e.onMounted(()=>{i.value?i.value=!1:u()}),e.onBeforeUnmount(async()=>{try{const d=u(),f=Object.values(d).filter(Boolean).length>0;o(!f)}catch{}}),e.watch(()=>l.value,o,{immediate:!0}),{fields:c.value,isValid:l,validateAll:u,createFieldHandler:p}}function yn(n,t){const{state:r,renameNode:o,getNodeById:i,addField:a,renameField:s,removeField:c,replaceConfig:l,disconnectEdge:u,connectEdge:p,invalidConfigNodeIds:d,commit:f,revert:m}=Pt(),{i18n:{t:g}}=Je(),y=Fy(),b=e.computed(()=>{const F=i(n);if(!F)throw new Error("Node not existed");return F}),_=e.computed(()=>{const J=r.value.edges.filter($=>$.target===n).reduce(($,q)=>{var H,oe;const K=i(q.source),ae=(H=Jr(K,"output",q.sourceField))==null?void 0:H.id,M=(oe=Jr(b.value,"input",q.targetField))==null?void 0:oe.name,v=K.id+(ae?`.${ae}`:"");return M?$.inputs={...$.inputs,[M]:v}:$.input=v,$},{});return b.value.fields.input.forEach($=>{J.inputs||(J.inputs={}),J.inputs[$.name]||(J.inputs[$.name]=null)}),{...b.value.config,...J,name:b.value.name}}),k=F=>{o(n,F??"",!0,`${n}:rename`)},C=(F,J=!0)=>{if(!t)throw new Error("getFormValue is not defined");const $=Wr(t(),["name","input","inputs"]),q=F?`update:${n}:${F}`:void 0;l(n,$,J,q)},N=(F,J)=>{const $=Yr(b.value,F,J);if(!$)throw new Error(`Field with name "${J}" not found in node "${b.value.name}"`);return $},E=(F,J,$)=>{const q=!!$;a(n,F,J,!q),q&&A(J,$)},w=(F,J,$)=>{const q=N(F,J).id;s(n,q,$)},S=(F,J)=>{const $=N(F,J).id;c(n,$)},I=e.computed(()=>r.value.edges.filter(F=>F.target===n&&!F.targetField)[0]),j=e.computed(()=>r.value.edges.filter(F=>F.target===n&&F.targetField)),A=async(F,J)=>{const $=J==null,q=N("input",F).id;if($){const me=j.value.find(le=>le.targetField===q);me&&u(me.id);return}const{nodeId:K,fieldId:ae}=Ay(J),M=N("input",F).id,v=[];I.value&&(v.push(Ba(I.value,i)),u(I.value.id,!1));const H=j.value.find(me=>me.targetField===q);H&&(v.push(Ba(H,i)),u(H.id,!1)),p({source:K,sourceField:ae,target:n,targetField:M},!1);const oe=Wd(K,ae,n,M,i),te=v[0]&&oe?v[0][1]===oe[1]:!1;if(f(),te||v.length===0)return;await y(g("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[oe],v)||m()},x=async F=>{if(F==null){I.value&&u(I.value.id);return}const $=[];for(const v of j.value)$.push(Ba(v,i)),u(v.id,!1);I.value&&u(I.value.id,!1);const{nodeId:q,fieldId:K}=Ay(F);p({source:q,sourceField:K,target:n,targetField:void 0},!1);const ae=Wd(q,K,n,void 0,i);if(f(),$.length===0)return;await y(g("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[ae],$)||m()},O=F=>{const J=[...r.value.edges,{source:F,target:n}];return Yd(Nl(J))},P=e.computed(()=>{var J,$;const F=[];for(const q of r.value.nodes)if((J=oi(q.type).io)!=null&&J.output&&q.fields.output&&q.id!==n&&!(q.type==="property"&&!$d(($=q.config)==null?void 0:$.property))&&!O(q.id)&&!(b.value.phase==="request"&&q.phase==="response")&&!(q.type==="vault"&&q.fields.output.length===0)){F.push({value:q.id,label:q.name,type:q.type});for(const ae of q.fields.output)F.push({value:`${q.id}.${ae.id}`,label:`${q.name}.${ae.name}`,type:q.type})}return F}),R=e.computed(()=>b.value.fields.input.map(F=>F.name)||[]);function W(F){d.value.delete(n),F||d.value.add(n)}const Z=$2(n);function X(F,J,$){const q=i(n);if(!q)throw new Error("Node not found when validating field name");const K=Yr(q,F,J);return Z(F,$,K==null?void 0:K.id)}return{formData:_,inputOptions:P,inputEdge:I,inputsEdges:j,inputsFieldNames:R,currentNode:b,setName:k,setConfig:C,addField:E,renameFieldByName:w,removeFieldByName:S,setInputs:A,setInput:x,nameValidator:dw(n),fieldNameValidator:X,toggleNodeValid:W}}function _n(n){const{getSchema:t}=ft();return e.computed(()=>{if(pn(n))switch(n){case"response":return B2;case"service_request":return I2}try{const o=t().fields.find(u=>ml(u,"config"));if(!o)throw new Error("Config field not found in schema.");const a=o.config.fields.find(u=>ml(u,"nodes"));if(!a)throw new Error("Nodes field not found in config schema.");const l=a.nodes.elements.subschema_definitions[n];if(!l)throw new Error(`Subschema "${n}" not found in the schema.`);return l}catch(r){throw new Error(`Failed to get subschema "${n}": ${r.message}`)}})}const Un=e.defineComponent({__name:"NameField",props:{name:{},validate:{type:Function}},emits:["update"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=Je(),a=e.ref(r.name),s=e.computed(()=>{const p=r.validate(a.value.trim());return p===void 0?"":p});let c=a.value.trim();function l(){if(s.value){a.value=c;return}o("update",a.value.trim())}function u(){c=a.value.trim()}return e.watch(()=>r.name,p=>{p!==a.value&&(a.value=p)}),(p,d)=>{const f=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(f,{"model-value":a.value,"onUpdate:modelValue":d[0]||(d[0]=m=>a.value=m),"data-1p-ignore":"",error:!!s.value,"error-message":s.value,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.name"),required:"",onChange:l,onFocus:u},null,8,["model-value","error","error-message","label"])}}}),L2=e.defineComponent({__name:"NodeFormCall",props:{nodeId:{}},setup(n){const{i18n:{t}}=Je(),r=e.useTemplateRef("form"),o=_n("call"),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>r.value.getValue()),{createFieldHandler:g}=Pr({validationConfig:{url:gn(vo({fieldName:"URL"}),cw("url",{fieldName:"URL"})),timeout:gn(vi("integer"),Ii(0,2147483646))},getValidationData:()=>({url:i.value.url,timeout:i.value.timeout}),toggleNodeValid:f}),y=g("url",()=>s("url")),b=g("timeout",()=>s("timeout"));return(_,k)=>{const C=e.resolveComponent("KLabel");return e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(C,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(tt,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"url",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(bR,{name:"method",onUpdate:k[0]||(k[0]=N=>e.unref(s)())}),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"timeout",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tt,{name:"ssl_server_name","onUpdate:modelValue":k[1]||(k[1]=N=>e.unref(s)("ssl_server_name"))}),e.createVNode(An,{name:"ssl_verify","onUpdate:modelValue":k[2]||(k[2]=N=>e.unref(s)("ssl_verify"))}),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"call","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),D2=e.defineComponent({__name:"NodeFormServiceRequest",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("service_request"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=yn(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(vn,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"service_request","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),M2=e.defineComponent({__name:"NodeFormResponse",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("response"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=yn(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(vn,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"response","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),j2=e.defineComponent({__name:"NodeFormJq",props:{nodeId:{}},setup(n){const{i18n:{t},i18nT:r}=Je(),o=e.useTemplateRef("form"),i=_n("jq"),{formData:a,setName:s,setConfig:c,inputOptions:l,setInputs:u,setInput:p,addField:d,removeFieldByName:f,renameFieldByName:m,inputsFieldNames:g,nameValidator:y,toggleNodeValid:b,fieldNameValidator:_}=yn(n.nodeId,()=>o.value.getValue());function k(I,j){d("input",I,j)}function C(I){f("input",I)}function N(I,j){m("input",I,j)}const E=t("plugins.free-form.datakit.flow_editor.node_properties.jq.label"),{createFieldHandler:w}=Pr({validationConfig:{jq:gn(vo({fieldName:E}),Or(1,10240,{fieldName:E}))},getValidationData:()=>({jq:a.value.jq}),toggleNodeValid:b}),S=w("jq",()=>c("jq"));return(I,j)=>{const A=e.resolveComponent("KLabel"),x=e.resolveComponent("KExternalLink");return e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(a),schema:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(a).name,validate:e.unref(y),onUpdate:e.unref(s)},null,8,["name","validate","onUpdate"]),e.createVNode(A,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(tt,{autosize:"",error:e.unref(S).error,"error-message":e.unref(S).errorMessage,label:e.unref(E),"label-attributes":{},multiline:"",name:"jq",resizable:"",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},{help:e.withCtx(()=>[e.createVNode(e.unref(r),{keypath:"plugins.free-form.datakit.flow_editor.node_properties.jq.help"},{link:e.withCtx(()=>[e.createVNode(x,{"hide-icon":"",href:e.unref(Ha).jqlang},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(Ha).jqlang),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["error","error-message","label","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(_),"field-names":e.unref(g),items:e.unref(l),"node-type":"jq","onAdd:field":k,"onChange:input":e.unref(p),"onChange:inputs":e.unref(u),"onRemove:field":C,"onRename:field":N},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),F2=Me(e.defineComponent({__name:"OutputValueField",props:{fieldNameValidator:{},keyOrder:{}},emits:["change:value","add:field","rename:field","remove:field"],setup(n,{emit:t}){const r=n,o=t,i=e.ref({}),{value:a,...s}=Gt("values"),{i18n:c}=Je(),l=e.useTemplateRef("root"),u=e.ref([]),p=e.ref(null);let d="",f=a==null?void 0:a.value;function m(){return hl("ff-kv-field-")}function g(A,x,O){const P=O.indexOf(A),R=O.indexOf(x);return P===-1&&R===-1?0:P===-1?1:R===-1?-1:P-R}function y(A,x){if(!A)return[];const O=Object.entries(A).map(([P,R])=>({id:m(),key:P,value:R}));return x!=null&&x.length&&O.sort((P,R)=>g(P.key,R.key,x)),O}function b(){const A={id:m(),key:"",value:""};return u.value.push(A),A}function _(A){const x=u.value.findIndex(O=>O.id===A);x!==-1&&u.value.splice(x,1)}u.value=y(a==null?void 0:a.value,r.keyOrder);async function k(A,x="key"){var O;l.value&&(await e.nextTick(),(O=l.value.querySelector(`[data-${x}-input="${A}"]`))==null||O.focus())}function C(){const A=b(),x=u.value.findIndex(({key:O})=>!O);k(x===-1?u.value.length-1:x),p.value=A}function N(A){var x;A.id===((x=p.value)==null?void 0:x.id)&&(p.value=null),_(A.id),A.key.trim()!==""&&o("remove:field",A.key)}function E(A){d=A.key}function w(A){var x;if(I(A)){A.key=d,delete i.value[A.id];return}if(A.id===((x=p.value)==null?void 0:x.id)){if(A.key.trim()==="")return;p.value=null,o("add:field",A.key,A.value)}else o("rename:field",d,A.key);d=A.key}function S(A,x){var P;if(x.id===((P=p.value)==null?void 0:P.id))return;const O=A.target.value.trim();o("change:value",x.key,O)}function I(A){delete i.value[A.id];const x=r.fieldNameValidator("output",d,A.key);if(x)return i.value[A.id]=x,x}function j(A){I(A)}return e.watch(()=>a==null?void 0:a.value,A=>{var Z;if(en(A,f))return;f=A;const x=p.value,O=new Map(u.value.filter(X=>X.key).map(X=>[X.key,X])),P=[],R=A??{};((Z=r.keyOrder)!=null&&Z.length?Object.keys(R).sort((X,F)=>g(X,F,r.keyOrder)):Object.keys(R)).forEach(X=>{const F=O.get(X);if(F){F.value=R[X],P.push(F);return}P.push({id:m(),key:X,value:R[X]})}),x&&!P.some(X=>X.id===x.id)&&P.push(x),u.value=P},{deep:!0}),(A,x)=>{const O=e.resolveComponent("KAlert"),P=e.resolveComponent("KLabel"),R=e.resolveComponent("KButton"),W=e.resolveComponent("KInput"),Z=e.resolveComponent("KCard");return s.error?(e.openBlock(),e.createBlock(O,{key:0,appearance:"danger",message:s.error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:l,class:"dk-output-value-field"},[e.createVNode(P,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.label")),1)]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(X,F)=>(e.openBlock(),e.createBlock(Z,{key:X.id,class:"dk-output-value-field-entry","data-testid":`ff-kv-container-${s.path.value}.${F}`},{actions:e.withCtx(()=>[e.createVNode(R,{appearance:"none","data-testid":`ff-kv-remove-btn-${s.path.value}.${F}`,icon:"",onClick:J=>N(X)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.CloseIcon))]),_:1},8,["data-testid","onClick"])]),default:e.withCtx(()=>[e.createVNode(W,{id:`ff-kv-entry-key-${s.path.value}.${F}`,modelValue:X.key,"onUpdate:modelValue":[J=>X.key=J,J=>I(X)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":F,"data-testid":`ff-key-${s.path.value}.${F}`,error:!!i.value[X.id],"error-message":i.value[X.id],label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name"),required:"",onBlur:J=>j(X),onChange:J=>w(X),onFocus:J=>E(X)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","label","onBlur","onChange","onFocus"]),e.createVNode(W,{modelValue:X.value,"onUpdate:modelValue":J=>X.value=J,modelModifiers:{trim:!0},class:"ff-kv-field-entry-value","data-testid":`ff-value-${s.path.value}.${F}`,label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value"),onChange:J=>S(J,X)},null,8,["modelValue","onUpdate:modelValue","data-testid","label","onChange"])]),_:2},1032,["data-testid"]))),128)),e.createVNode(R,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${s.path.value}`,disabled:!!p.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-3970c2c0"]]);function U2(n){const t={};for(const[r,o]of Object.entries(n))typeof o=="object"&&o!==null?t[r]=JSON.stringify(o):t[r]=String(o);return t}function cc(n){const t={};for(const[r,o]of Object.entries(n))if(o!=null){t[r]=o;try{o==="null"?t[r]=null:(o==="true"||o==="false"||/^-?\d+(\.\d+)?$/.test(o)||o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]"))&&(t[r]=JSON.parse(o))}catch{}}return t}function K2(n,t,r){const o={};for(const i of Object.keys(n))i===t?o[r]=n[t]:o[i]=n[i];return o}const q2=e.defineComponent({__name:"NodeFormStatic",props:{nodeId:{}},setup(n){const{renameNode:t,getOutEdgesByNodeId:r,addField:o,renameField:i,removeField:a,replaceConfig:s,getNodeById:c}=Pt(),{fieldNameValidator:l}=yn(n.nodeId),u=_n("static"),p=dw(n.nodeId),d=e.computed(()=>c(n.nodeId)),f=e.computed(()=>{var C;return((C=d.value)==null?void 0:C.fields.output.map(N=>N.name))||[]});function m(C){if(!d.value)throw new Error("No current node");t(d.value.id,C??"")}const g=e.computed(()=>{var j;if(!d.value)return{};const C=((j=d.value.config)==null?void 0:j.values)??{},N={},E=r(d.value.id).map(A=>A.sourceField).filter(Boolean).map(A=>Jr(d.value,"output",A)).map(A=>A==null?void 0:A.name).filter(Boolean),w=d.value.fields.output.map(A=>A.name),S=Object.keys(C);return new Set([...S,...E,...w]).forEach(A=>{if(A in C){N[A]=C[A];return}N[A]=""}),{name:d.value.name,values:U2(N)}});function y(C,N){if(!d.value)throw new Error("No selected node");const E=N!==void 0;if(o(n.nodeId,"output",C,!E),E){const w={values:cc({...g.value.values,[C]:N})};s(n.nodeId,w)}}function b(C,N){if(!d.value)throw new Error("No selected node");const E=Yr(d.value,"output",C);if(!E)throw new Error("No field found to rename");const w={values:cc(K2(g.value.values??{},C,N))};s(n.nodeId,w,!1),i(n.nodeId,E.id,N)}function _(C){var w;if(!d.value)throw new Error("No selected node");const N=Yr(d.value,"output",C);if(!N)throw new Error("No field found to delete");a((w=d.value)==null?void 0:w.id,N.id,!0,!1);const E={values:cc({...g.value.values})};delete E.values[C],s(n.nodeId,E)}function k(C,N){if(!d.value)throw new Error("No selected node");const E={...g.value.values};E[C]=N;const w={values:cc(E)};s(n.nodeId,w)}return(C,N)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:g.value,schema:e.unref(u)},{default:e.withCtx(()=>{var E;return[e.createVNode(Un,{name:((E=d.value)==null?void 0:E.name)??"",validate:e.unref(p),onUpdate:m},null,8,["name","validate"]),e.createVNode(F2,{"field-name-validator":e.unref(l),"key-order":f.value,"onAdd:field":y,"onChange:value":k,"onRemove:field":_,"onRename:field":b},null,8,["field-name-validator","key-order"])]}),_:1},8,["data","schema"]))}}),G2={class:"dk-kong-property-item"},H2={class:"property-type"},z2={class:"property-badges"},W2=Me(e.defineComponent({__name:"PropertiesField",props:{validators:{}},emits:["update:model-value","update:property-key"],setup(n,{emit:t}){const{i18n:{t:r}}=Je(),o=n,i=t,{formData:a}=ft(),s=e.ref(Sa(a.property)),c=e.computed(()=>xa(a.property)),l=e.ref(Vd(a.property)),u=e.computed(()=>a.property??""),p=e.computed(()=>Object.entries(go).map(([m])=>{var b;const g=xa(m)?(b=a.property)==null?void 0:b.startsWith(m.replace(Zo,"")):a.property===m;return{label:g&&l.value?m.replace(Zo,l.value):m,value:m,selected:g}}));function d(m){const g=gl.find(y=>{var b;return(b=a.property)==null?void 0:b.startsWith(y)});g&&(a.property=g+m,o.validators.key.handleChange(a.property),i("update:property-key",a.property))}function f(m){s.value!==Sa(m==null?void 0:m.value)&&(a.property=(m==null?void 0:m.value)||null,s.value=Sa(a.property),o.validators.property.handleBlur(()=>a.property),i("update:model-value",a.property))}return e.watch(()=>a.property,m=>{l.value=Vd(m),s.value=Sa(m)}),(m,g)=>{const y=e.resolveComponent("KBadge"),b=e.resolveComponent("KSelect"),_=e.resolveComponent("KInput");return e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(b,{key:u.value,"enable-filtering":"",error:!n.validators.property.isValid.value,help:n.validators.property.error.value,items:p.value,label:"Property","label-attributes":{maxWidth:"300px",placement:"top",info:"The property name to get/set"},required:"",onBlur:g[0]||(g[0]=k=>n.validators.property.handleBlur(()=>e.unref(a).property)),onChange:f},{"item-template":e.withCtx(({item:k})=>[e.createElementVNode("div",G2,[e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(k.label),1),e.createElementVNode("div",H2,e.toDisplayString(e.unref(go)[k.value].dataType),1)]),e.createElementVNode("div",z2,[e.unref(go)[k.value].readable?(e.openBlock(),e.createBlock(y,{key:0,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.get")),1)]),_:1})):e.createCommentVNode("",!0),e.unref(go)[k.value].writable?(e.openBlock(),e.createBlock(y,{key:1,appearance:"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.set")),1)]),_:1})):e.createCommentVNode("",!0)])])]),_:1},8,["error","help","items"])),c.value?(e.openBlock(),e.createBlock(_,{key:0,"model-value":l.value,"onUpdate:modelValue":[g[1]||(g[1]=k=>l.value=k),d],error:!n.validators.key.isValid.value,"error-message":n.validators.key.error.value,label:"key",required:"",onBlur:g[2]||(g[2]=k=>n.validators.key.handleBlur(()=>e.unref(a).property))},null,8,["model-value","error","error-message"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-3e7fee25"]]),Y2=e.defineComponent({__name:"NodeFormProperty",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),{selectedNode:r,disconnectInEdges:o,disconnectOutEdges:i}=Pt(),a=_n("property"),{formData:s,setName:c,setConfig:l,inputOptions:u,setInputs:p,setInput:d,inputsFieldNames:f,nameValidator:m,toggleNodeValid:g,fieldNameValidator:y}=yn(n.nodeId,()=>t.value.getValue()),b=e.computed(()=>Rd(s.value.property));function _(C){var E;const N=(E=r.value)==null?void 0:E.id;if(!N)throw new Error("Expected selectedNode to be defined");$d(C)||i(N,!1),Rd(C)||o(N,!1),l()}const{fields:k}=Pr({validationConfig:()=>({property:vo({fieldName:"Property"}),key:xa(s.value.property)?vo({fieldName:"Key"}):()=>{}}),getValidationData:()=>({property:s.value.property,key:Vd(s.value.property)}),toggleNodeValid:g});return(C,N)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(s),schema:e.unref(a)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(s).name,validate:e.unref(m),onUpdate:e.unref(c)},null,8,["name","validate","onUpdate"]),e.createVNode(Dt,{name:"content_type",onUpdate:N[0]||(N[0]=E=>e.unref(l)())}),e.createVNode(W2,{validators:e.unref(k),"onUpdate:modelValue":_,"onUpdate:propertyKey":N[1]||(N[1]=E=>e.unref(l)("property-key"))},null,8,["validators"]),b.value?(e.openBlock(),e.createBlock(Qn,{key:0})):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createBlock(vn,{key:1,"field-name-validator":e.unref(y),"field-names":e.unref(f),items:e.unref(u),"node-type":"property","onChange:input":e.unref(d),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])):e.createCommentVNode("",!0)]),_:1},8,["data","schema"]))}}),J2=e.defineComponent({__name:"NodeFormExit",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("exit"),{formData:o,setName:i,setConfig:a,inputOptions:s,setInputs:c,setInput:l,inputsFieldNames:u,nameValidator:p,toggleNodeValid:d,fieldNameValidator:f}=yn(n.nodeId,()=>t.value.getValue()),{createFieldHandler:m}=Pr({validationConfig:{status:gn(vi("integer",{fieldName:"Status"}),Ii(200,599,{fieldName:"Status"}))},getValidationData:()=>({status:o.value.status}),toggleNodeValid:d}),g=m("status",()=>a("status"));return(y,b)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(o).name,validate:e.unref(p),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(Ht,{error:e.unref(g).error,"error-message":e.unref(g).errorMessage,name:"status",onBlur:e.unref(g).validate,"onUpdate:modelValue":e.unref(g).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(An,{name:"warn_headers_sent","onUpdate:modelValue":b[0]||(b[0]=_=>e.unref(a)())}),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(f),"field-names":e.unref(u),items:e.unref(s),"node-type":"exit","onChange:input":e.unref(l),"onChange:inputs":e.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}});function X2(n){const t=yn(n),{state:r,getNodeById:o,branchGroups:i,commit:a}=Pt(),{i18n:{t:s}}=Je(),c=Fy(),l=Dd(),u=e.computed(()=>{var C;const _={...t.formData.value},k=Ia(((C=t.currentNode.value)==null?void 0:C.type)||"branch");for(const N of k)(!(N in _)||_[N]==null)&&(_[N]=[]);return _});function p(_,k,C){const N=o(_),E=o(C),w=N?`${N.name}.${k}`:`${_}.${k}`,S=E?E.name:C;return[w,S]}function d(_){return(_==null?[]:Array.isArray(_)?_:[_]).filter(k=>qd(k))}function f(_,k){return i.wouldCreateCycle(_,k)?(l({message:s("plugins.free-form.datakit.flow_editor.error.branch_cycle"),appearance:"danger"}),!0):!1}function m(_,k,C){const N=[],E=[],w=[];for(const S of C){const I=i.findMembership(S);if(!I||I.ownerId===_&&I.branch===k)continue;const j=i.getMembers(I.ownerId,I.branch).filter(A=>A!==S);w.push({ownerId:I.ownerId,branch:I.branch,members:j}),N.push(p(_,k,S)),E.push(p(I.ownerId,I.branch,S))}return{conflictUpdates:w,addedAssignments:N,removedAssignments:E}}function g(_,k,C,N){let E=!1;for(const w of N)E=i.setMembers(w.ownerId,w.branch,w.members,{commit:!1})||E;return E=i.setMembers(_,k,C,{commit:!1})||E,E}async function y(_,k){const C=t.currentNode.value,N=d(k),E=i.prepareMembers(C.id,_,N),w=i.getMembers(C.id,_);if(Gd(w,E))return!0;const S=E.filter(O=>!w.includes(O));for(const O of S)if(f(C.id,O))return!1;const{conflictUpdates:I,addedAssignments:j,removedAssignments:A}=m(C.id,_,S);return I.length>0&&!await c(s("plugins.free-form.datakit.flow_editor.confirm.message.branch_replace"),j,A)?!1:(g(C.id,_,E,I)&&a(),!0)}const b=e.computed(()=>{const _=t.currentNode.value;return!_||!i?[]:r.value.nodes.filter(k=>k.id!==n&&!pn(k.type)&&k.phase===_.phase&&!i.wouldCreateCycle(_.id,k.id)).map(k=>({value:k.id,label:k.name,type:k.type}))});return{...t,formData:u,branchOptions:b,updateBranchMembers:y}}const Z2=e.defineComponent({__name:"NodeFormBranch",props:{nodeId:{}},setup(n){const{i18n:{t}}=Je(),r=_n("branch"),o=e.ref(0),{formData:i,setName:a,inputOptions:s,branchOptions:c,nameValidator:l,setInput:u,setInputs:p,inputsFieldNames:d,fieldNameValidator:f,updateBranchMembers:m}=X2(n.nodeId);async function g(y,b){await m(y,b)||(o.value+=1)}return(y,b)=>(e.openBlock(),e.createBlock(Jt,{key:o.value,data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(l),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"then",onUpdate:b[0]||(b[0]=_=>g("then",_))},{"item-label":e.withCtx(_=>[e.createVNode(lc,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"else",onUpdate:b[1]||(b[1]=_=>g("else",_))},{"item-label":e.withCtx(_=>[e.createVNode(lc,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(f),"field-names":e.unref(d),items:e.unref(s),"node-type":"branch","onChange:input":e.unref(u),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),Q2=e.defineComponent({__name:"NodeFormCache",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("cache"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>t.value.getValue()),{createFieldHandler:g}=Pr({validationConfig:()=>({ttl:gn(vi("integer",{fieldName:"TTL"}),Ii(1,1/0,{fieldName:"TTL"}))}),getValidationData:()=>({ttl:i.value.ttl}),toggleNodeValid:f}),y=g("ttl",()=>s("ttl"));return(b,_)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(An,{name:"bypass_on_error","onUpdate:modelValue":_[0]||(_[0]=k=>e.unref(s)("bypass_on_error"))}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"ttl",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"cache","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),eL=e.defineComponent({__name:"NodeFormXmlToJson",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("xml_to_json"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>t.value.getValue()),g=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),y=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:b}=Pr({validationConfig:()=>({attributes_block_name:gn(()=>y()?void 0:g,I=>{if(I)return Or(1,32,{fieldName:"Attributes block name"})(I)}),attributes_name_prefix:gn(()=>y()?void 0:g,I=>{if(I)return Or(1,32,{fieldName:"Attributes name prefix"})(I)}),text_block_name:Or(1,32,{fieldName:"Text block name"}),xpath:Or(1,256,{fieldName:"XPath"})}),getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,text_block_name:i.value.text_block_name,xpath:i.value.xpath}),toggleNodeValid:f}),_=b("attributes_block_name",()=>s("attributes_block_name")),k=b("attributes_name_prefix",()=>s("attributes_name_prefix")),C=b("text_block_name",()=>s("text_block_name")),N=b("xpath",()=>s("xpath")),E=()=>{_.value.validate(),k.value.validate()},w=()=>{_.value.update(),k.value.validate()},S=()=>{k.value.update(),_.value.validate()};return(I,j)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(An,{name:"recognize_type","onUpdate:modelValue":j[0]||(j[0]=A=>e.unref(s)("recognize_type"))}),e.createVNode(tt,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"attributes_block_name",onBlur:E,"onUpdate:modelValue":w},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(k).error,"error-message":e.unref(k).errorMessage,name:"attributes_name_prefix",onBlur:E,"onUpdate:modelValue":S},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(C).error,"error-message":e.unref(C).errorMessage,name:"text_block_name",onBlur:e.unref(C).validate,"onUpdate:modelValue":e.unref(C).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(An,{name:"text_as_property","onUpdate:modelValue":j[1]||(j[1]=A=>e.unref(s)("text_as_property"))}),e.createVNode(tt,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"xpath",onBlur:e.unref(N).validate,"onUpdate:modelValue":e.unref(N).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"xml_to_json","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),tL=e.defineComponent({__name:"NodeFormJsonToXml",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("json_to_xml"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,addField:p,removeFieldByName:d,renameFieldByName:f,inputsFieldNames:m,nameValidator:g,toggleNodeValid:y,fieldNameValidator:b}=yn(n.nodeId,()=>t.value.getValue()),_=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),k=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:C}=Pr({validationConfig:{attributes_block_name:gn(()=>k()?void 0:_,Or(1,32,{fieldName:"Attributes block name"})),attributes_name_prefix:gn(()=>k()?void 0:_,Or(1,32,{fieldName:"Attributes name prefix"})),root_element_name:Or(1,64,{fieldName:"Root element name"}),text_block_name:Or(1,32,{fieldName:"Text block name"})},getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,root_element_name:i.value.root_element_name,text_block_name:i.value.text_block_name}),toggleNodeValid:y}),N=C("attributes_block_name",()=>s("attributes_block_name")),E=C("attributes_name_prefix",()=>s("attributes_name_prefix")),w=C("root_element_name",()=>s("root_element_name")),S=C("text_block_name",()=>s("text_block_name"));function I(){N.value.validate(),E.value.validate()}function j(){N.value.update(),E.value.validate()}function A(){E.value.update(),N.value.validate()}function x(R,W){p("input",R,W)}function O(R){d("input",R)}function P(R,W){f("input",R,W)}return(R,W)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(g),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(tt,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"attributes_block_name",onBlur:I,"onUpdate:modelValue":j},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(E).error,"error-message":e.unref(E).errorMessage,name:"attributes_name_prefix",onBlur:I,"onUpdate:modelValue":A},null,8,["error","error-message"]),e.createVNode(tt,{error:e.unref(w).error,"error-message":e.unref(w).errorMessage,name:"root_element_name",onBlur:e.unref(w).validate,"onUpdate:modelValue":e.unref(w).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tt,{error:e.unref(S).error,"error-message":e.unref(S).errorMessage,name:"text_block_name",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(b),"field-names":e.unref(m),items:e.unref(c),"node-type":"json_to_xml","onAdd:field":x,"onChange:input":e.unref(u),"onChange:inputs":e.unref(l),"onRemove:field":O,"onRename:field":P},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),nL=e.defineComponent({__name:"NodeFormJwtDecode",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("jwt_decode"),{formData:o,setName:i,inputOptions:a,setInputs:s,setInput:c,inputsFieldNames:l,nameValidator:u,fieldNameValidator:p}=yn(n.nodeId,()=>t.value.getValue());return(d,f)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(o).name,validate:e.unref(u),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(p),"field-names":e.unref(l),items:e.unref(a),"node-type":"jwt_decode","onChange:input":e.unref(c),"onChange:inputs":e.unref(s)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),rL=e.defineComponent({__name:"NodeFormJwtSign",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("jwt_sign"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>{const k={...t.value.getValue()};return(!k.static_claims||Object.keys(k.static_claims).length===0)&&delete k.static_claims,k}),{createFieldHandler:g}=Pr({validationConfig:{algorithm:vo({fieldName:"Algorithm"}),expires_in:gn(vi("integer",{fieldName:"Expires in"}),Ii(1,1/0,{fieldName:"Expires in"})),not_before:gn(vi("integer",{fieldName:"Not before"}),Ii(0,1/0,{fieldName:"Not before"}))},getValidationData:()=>({algorithm:i.value.algorithm,expires_in:i.value.expires_in,not_before:i.value.not_before}),toggleNodeValid:f}),y=g("algorithm",()=>s("algorithm")),b=g("expires_in",()=>s("expires_in")),_=g("not_before",()=>s("not_before"));return(k,C)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",name:"algorithm",onUpdate:e.unref(y).update},null,8,["onUpdate"]),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"expires_in",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Ht,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"not_before",onBlur:e.unref(_).validate,"onUpdate:modelValue":e.unref(_).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tt,{name:"kid","onUpdate:modelValue":C[0]||(C[0]=N=>e.unref(s)("kid"))}),e.createVNode(tt,{name:"typ","onUpdate:modelValue":C[1]||(C[1]=N=>e.unref(s)("typ"))}),e.createVNode(fr,{label:e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.jwt.static_claims.label"),name:"static_claims",onLegacyValueChange:C[2]||(C[2]=N=>e.unref(s)("static_claims"))},null,8,["label"]),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_sign","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),oL=e.defineComponent({__name:"NodeFormJwtVerify",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=_n("jwt_verify"),{i18n:{t:o}}=Je(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=yn(n.nodeId,()=>t.value.getValue()),{createFieldHandler:g}=Pr({validationConfig:{leeway:gn(vi("integer",{fieldName:"Leeway"}),Ii(0,1/0,{fieldName:"Leeway"}))},getValidationData:()=>({leeway:i.value.leeway}),toggleNodeValid:f}),y=g("leeway",()=>s("leeway"));return(b,_)=>(e.openBlock(),e.createBlock(Jt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Un,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",multiple:"",name:"allowed_algorithms",onUpdate:_[0]||(_[0]=k=>e.unref(s)("allowed_algorithms"))}),e.createVNode(dr,{name:"issuers",onAdd:_[2]||(_[2]=k=>e.unref(s)("issuers")),onRemove:_[3]||(_[3]=k=>e.unref(s)("issuers"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(tt,{autofocus:C,name:k,"onUpdate:modelValue":_[1]||(_[1]=N=>e.unref(s)("issuers"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(dr,{name:"audiences",onAdd:_[5]||(_[5]=k=>e.unref(s)("audiences")),onRemove:_[6]||(_[6]=k=>e.unref(s)("audiences"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(tt,{autofocus:C,name:k,"onUpdate:modelValue":_[4]||(_[4]=N=>e.unref(s)("audiences"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(dr,{name:"required_claims",onAdd:_[8]||(_[8]=k=>e.unref(s)("required_claims")),onRemove:_[9]||(_[9]=k=>e.unref(s)("required_claims"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(tt,{autofocus:C,name:k,"onUpdate:modelValue":_[7]||(_[7]=N=>e.unref(s)("required_claims"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"leeway",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(An,{name:"validate_exp","onUpdate:modelValue":_[10]||(_[10]=k=>e.unref(s)("validate_exp"))}),e.createVNode(An,{name:"validate_nbf","onUpdate:modelValue":_[11]||(_[11]=k=>e.unref(s)("validate_nbf"))}),e.createVNode(Qn),e.createVNode(vn,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_verify","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),iL=["innerHTML"],aL={key:1,class:"branch-note"},sL={class:"branch-label"},lL={class:"branch-text"},cL=e.defineComponent({__name:"NodePropertiesPanel",props:{maxWidth:{default:`${Mh}px`},offsetTop:{default:`${b1}px`},visible:{type:Boolean},nodeId:{}},emits:["close"],setup(n){const{t}=jt.createI18n("en-us",Yt),{getNodeById:r,branchGroups:o}=Pt(),i=e.computed(()=>n.nodeId&&r(n.nodeId)),a=e.computed(()=>{if(n.nodeId)return o.findMembership(n.nodeId)}),s=e.computed(()=>{if(!a.value)return"";const u=r(a.value.ownerId);return u?`${u.name}.${a.value.branch}`:""});function c(){n.nodeId&&o.removeMember(n.nodeId)}const l=e.computed(()=>{var u;switch((u=i.value)==null?void 0:u.type){case"call":return L2;case"service_request":return D2;case"response":return M2;case"jq":return j2;case"static":return q2;case"property":return Y2;case"exit":return J2;case"branch":return Z2;case"cache":return Q2;case"xml_to_json":return eL;case"json_to_xml":return tL;case"jwt_decode":return nL;case"jwt_sign":return rL;case"jwt_verify":return oL;default:return null}});return(u,p)=>(e.openBlock(),e.createBlock(e.unref(Fe.KSlideout),{class:"dk-node-properties-panel","close-on-blur":!1,"has-overlay":!1,"max-width":n.maxWidth,"offset-top":n.offsetTop,visible:n.visible,"z-index":e.unref(_1),onClose:p[0]||(p[0]=d=>u.$emit("close"))},e.createSlots({default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dk-node-properties-panel-desc",innerHTML:e.unref(ni)(i.value.type)},null,8,iL)):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("div",aL,[e.createElementVNode("span",sL,[e.createVNode(e.unref(Re.ArrowSplitIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-40, ${e.unref(fa)})`},null,8,["color","size"]),e.createElementVNode("span",lL,e.toDisplayString(s.value),1)]),e.createVNode(e.unref(Fe.KTooltip),{placement:"top",text:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none","aria-label":e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch"),class:"remove-branch",icon:"",size:"small",onClick:c},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.TrashIcon))]),_:1},8,["aria-label"])]),_:1},8,["text"])])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createBlock(e.unref(l),{key:n.nodeId,class:"dk-node-properties-panel-form","node-id":n.nodeId},null,8,["node-id"])):e.createCommentVNode("",!0)]),_:2},[i.value?{name:"title",fn:e.withCtx(()=>[e.createVNode(Qd,{type:i.value.type},null,8,["type"])]),key:"0"}:void 0]),1032,["max-width","offset-top","visible","z-index"]))}}),uL=Me(cL,[["__scopeId","data-v-32602117"]]),dL={class:"dk-editor-content"},fL={class:"main"},pL=Me(e.defineComponent({__name:"EditorContent",setup(n){const{propertiesPanelOpen:t,selectedNode:r}=Pt();function o(){t.value=!1}e.watch(r,a=>{a||o()});const i=e.ref(!1);return e.onMounted(()=>{i.value=!0}),(a,s)=>{var c;return e.openBlock(),e.createElementBlock("div",dL,[e.createVNode(e.unref(_R)),e.createElementVNode("div",fL,[e.createVNode(v$)]),e.createVNode(uL,{"node-id":(c=e.unref(r))==null?void 0:c.id,visible:e.unref(t),onClose:o},null,8,["node-id","visible"])])}}}),[["__scopeId","data-v-66331c5c"]]),mL={key:0,class:"dk-editor-modal"},hL=Me(e.defineComponent({__name:"EditorModal",props:{open:{type:Boolean},openModifiers:{}},emits:["update:open"],setup(n){e.useCssVars(c=>({v0a30a280:`${e.unref(y1)}px`,aee7cc1c:`${e.unref(Dh)}px`}));const t=e.useModel(n,"open"),r=e.ref(!1),o=e.useTemplateRef("confirm-modal"),{clear:i}=Pt();tB(async(...c)=>{r.value=!0;const l=await o.value.open(...c);return r.value=!1,l});const a=Tt.useScrollLock(document);e.watch(t,c=>{a.value=!!c,c||i()},{immediate:!0});function s(){t.value=!1}return(c,l)=>t.value?(e.openBlock(),e.createElementBlock("div",mL,[e.createVNode(C$,{class:"nav",onBack:s}),e.createVNode(pL,{ref:"content",class:"content",tabindex:"0"},null,512),e.createVNode(_$,{ref:"confirm-modal"},null,512)])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-82b03578"]]),gL={class:"dk-flow-editor"},yL={class:"flow-panels-container"},_L={class:"overlay"},bL=Me(e.defineComponent({__name:"FlowEditor",props:{isEditing:{type:Boolean}},emits:["change","error"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Yt),{formData:o,setValue:i,getValue:a}=ft(),s=t;function c(p,d,f,m){const g={...o.config,nodes:p};f!==void 0&&(g.resources=f);const y={...o.__ui_data,...d},b={...o,config:g,__ui_data:y};m!=null?b.partials=[{id:m}]:b.partials&&(b.partials=null),i(b),s("change",g,y)}const{modalOpen:l,setPendingFitView:u}=Xd(a(),{onChange:c,isEditing:n.isEditing});return e.watch(l,()=>{u(!0)},{flush:"post"}),u$({enabled:l}),(p,d)=>{const f=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",gL,[e.createElementVNode("div",yL,[e.createVNode(Yf,{inactive:e.unref(l),mode:"preview"},null,8,["inactive"]),e.createElementVNode("div",_L,[e.createVNode(f,{appearance:"secondary",class:"button-open-editor",onClick:d[0]||(d[0]=m=>l.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.cta"))+" ",1),e.createVNode(e.unref(Re.ExpandIcon))]),_:1})])]),e.createVNode(hL,{open:e.unref(l),"onUpdate:open":d[1]||(d[1]=m=>e.isRef(l)?l.value=m:null)},null,8,["open"])])}}}),[["__scopeId","data-v-575018ff"]]),wL=["innerHTML"],kL={class:"dk-option-label"},CL=["innerHTML"],EL=it({component:Me(e.defineComponent({inheritAttrs:!1,__name:"DatakitForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const{t}=jt.createI18n("en-us",Yt),r=n,o=e.useAttrs(),i=e.inject(Ze.FORMS_CONFIG),a=e.ref(!1);e.onMounted(()=>{a.value=!!document.querySelector("#plugin-form-page-actions")});const{editorMode:s}=ac(),c=e.computed(()=>i.app!=="konnect"||p.value===!1?"code":s.value),l=e.computed(()=>i.app==="kongManager"?"code":c.value==="flow"?"form":"code"),u={flow:Re.DesignIcon,code:Re.CodeblockIcon},p=e.ref(!0),d=e.ref(""),f=e.computed(()=>{const E=[{label:t("plugins.free-form.datakit.flow_editor.mode"),value:"flow"},{label:t("plugins.free-form.datakit.code_editor.mode"),value:"code"}];return E[0].disabled=!p.value,E}),m=e.computed(()=>{switch(c.value){case"code":return t("plugins.free-form.datakit.description_code");case"flow":return t("plugins.free-form.datakit.description_flow");default:return""}}),g=e.computed(()=>p.value?"":t("plugins.free-form.datakit.flow_editor.disabled_tooltip",{reason:d.value,code:E=>`<code>${xv(E)}</code>`}));e.watch(c,()=>{var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})});function y(){var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})}function b(){y()}function _(E){return E.map(w=>typeof w=="number"?`[${w}]`:E.length&&typeof w=="string"&&w.includes(".")?`["${w}"]`:`.${w}`).join("").replace(/^\./,"")}function k(E){return E.issues.map(w=>`${_(w.path)} - ${w.message}`).join("; ")}function C(E){if(y(),i.app!=="konnect")return;const w=E==null?void 0:E.config,{success:S,error:I}=sw.safeParse(w);d.value=S||!I?"":k(I),p.value=S}function N(E){var w;d.value=E,p.value=!1,(w=r.onValidityChange)==null||w.call(r,{model:"config",valid:!1,error:E})}return(E,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i).app==="konnect"?(e.openBlock(),e.createBlock(e.Teleport,{key:0,disabled:!a.value,to:"#plugin-form-page-actions"},[e.createVNode(e.unref(Fe.KSegmentedControl),{"data-testid":"datakit-editor-mode-switcher","model-value":c.value,options:f.value,"onUpdate:modelValue":w[0]||(w[0]=S=>s.value=S)},{"option-label":e.withCtx(({option:S})=>[e.createVNode(e.unref(Fe.KTooltip),{disabled:p.value||S.value!=="flow"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:g.value},null,8,wL)]),default:e.withCtx(()=>[e.createElementVNode("div",kL,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u[S.value]))),e.createTextVNode(" "+e.toDisplayString(S.label),1)])]),_:2},1032,["disabled"])]),_:1},8,["model-value","options"])],8,["disabled"])):e.createCommentVNode("",!0),e.createVNode(Zn,e.mergeProps({...e.unref(o),...r},{class:"dk-form","editor-mode":l.value,"hide-editor-mode-switcher":""}),{"code-editor":e.withCtx(()=>[e.createVNode(l$,{class:"code-editor",editing:r.isEditing,onChange:C,onError:N},null,8,["editing"])]),"plugin-config-title":e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.mode")),1)]),"plugin-config-description":e.withCtx(()=>[e.createElementVNode("span",{innerHTML:m.value},null,8,CL)]),default:e.withCtx(()=>[c.value==="flow"?(e.openBlock(),e.createBlock(bL,{key:0,"is-editing":r.isEditing,onChange:b},null,8,["is-editing"])):e.createCommentVNode("",!0)]),_:1},16,["editor-mode"])],64))}}),[["__scopeId","data-v-99d4e7f0"]])}),NL=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.functions.*",component:tt,propsOverrides:n=>({...n,multiline:!0,rows:3})}]}),SL=it({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),xL=it({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),AL=it({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),vL=it({experimental:!0}),fw=e.defineComponent({inheritAttrs:!1,__name:"KeysetField",props:{name:{},scope:{}},setup(n){const t=n,{i18n:{t:r}}=Je(),o=e.inject(Ze.FORMS_CONFIG),i=e.computed(()=>(o==null?void 0:o.app)==="konnect"),{formData:a,config:s}=ft();function c(f){const m=`config.${f}`,g=uf(f);return s.value.transformLabel?s.value.transformLabel(g,m):g}function l(f){if(typeof f!="string"||!f)return!1;try{const m=new URL(f);return(m.protocol==="http:"||m.protocol==="https:")&&!!m.host}catch{return!1}}const u=e.computed(()=>{if(!i.value)return{hasError:!1,message:""};const f=a.config,m=f==null?void 0:f[`${t.scope}_token_signing`],g=f==null?void 0:f[`${t.scope}_token_upstream_header`];if(!m)return{hasError:!1,message:""};if(typeof g!="string"||g==="")return{hasError:!1,message:""};const y=f==null?void 0:f[`${t.scope}_token_keyset`];return l(y)?{hasError:!1,message:""}:{hasError:!0,message:r("plugins.free-form.jwt-signer.keyset_url_required",{signingField:c(`${t.scope}_token_signing`),headerField:c(`${t.scope}_token_upstream_header`)})}}),p=e.computed(()=>u.value.hasError),d=e.computed(()=>u.value.message);return(f,m)=>(e.openBlock(),e.createBlock(tt,e.mergeProps(f.$attrs,{error:p.value,"error-message":d.value,name:n.name}),null,16,["error","error-message","name"]))}}),IL=it({component:e.defineComponent({__name:"JwtSignerForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r={bundles:[["config.access_token_signing","config.access_token_upstream_header","config.access_token_keyset"],["config.channel_token_signing","config.channel_token_upstream_header","config.channel_token_keyset"]]},o=e.useSlots();return e.provide(Ze.AUTOFILL_SLOT,o==null?void 0:o[Ze.AUTOFILL_SLOT_NAME]),(i,a)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"render-rules":r}),{"field-renderers":e.withCtx(()=>[e.createVNode($t,{match:({path:s})=>s==="config.access_token_keyset"},{default:e.withCtx(s=>[e.createVNode(fw,e.mergeProps(s,{scope:"access"}),null,16)]),_:1},8,["match"]),e.createVNode($t,{match:({path:s})=>s==="config.channel_token_keyset"},{default:e.withCtx(s=>[e.createVNode(fw,e.mergeProps(s,{scope:"channel"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(jb)]),_:1},16))}})}),BL=it({experimental:!0}),TL=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),OL=it({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),PL=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),VL=it({experimental:!0,component:qb,fieldRenderers:[{match:({path:n})=>n==="config.identity_realms",component:Ub},{match:"config.anonymous",component:tt,propsOverrides:{placeholder:"e.g., 00000000-0000-0000-0000-000000000001"}},{match:"config.realm",component:tt,propsOverrides:{placeholder:"e.g., my-api"}}]}),$L={class:"ff-collapsible-section"},RL={class:"ff-collapsible-section-header"},LL={class:"ff-collapsible-section-header-toggle"},DL={key:0,class:"ff-collapsible-section-content"},ML={key:0,class:"ff-collapsible-section-indent-guide"},Qf=Me(e.defineComponent({__name:"CollapsibleSection",props:e.mergeModels({label:{}},{expanded:{type:Boolean,default:!0},expandedModifiers:{}}),emits:["update:expanded"],setup(n){const t=e.useModel(n,"expanded");return(r,o)=>(e.openBlock(),e.createElementBlock("div",$L,[e.createElementVNode("header",RL,[e.createElementVNode("div",LL,[e.createElementVNode("button",{class:"ff-collapsible-section-toggle-btn",type:"button",onClick:o[0]||(o[0]=e.withModifiers(i=>t.value=!t.value,["prevent","stop"]))},[e.createVNode(e.unref(Re.ChevronRightIcon),{class:e.normalizeClass(["ff-collapsible-section-toggle-btn-trigger-icon",{"collapse-expanded":t.value}]),decorative:"",size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["class","size"])]),e.createVNode(e.unref(Fe.KLabel),{class:"ff-collapsible-section-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.label),1)]),_:1})])]),e.createVNode(Ll,null,{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",DL,[e.renderSlot(r.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)]),_:3}),t.value?(e.openBlock(),e.createElementBlock("div",ML)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-39f2a44b"]]),jL={class:"ff-mb-subject"},FL={class:"ff-mb-attributes"},UL={class:"ff-metering-billing-inline-row"},KL={class:"ff-mb-queue"},qL=it({experimental:!0,component:Me(e.defineComponent({__name:"MeteringAndBillingForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Je(),i=e.inject(Ze.FORMS_CONFIG),a=e.computed(()=>{const p=i==null?void 0:i.geoApiServerUrl,d=p?new URL(p).hostname.split(".")[0]:null;return d?`https://${d}.api.konghq.com/v3/openmeter/events`:"https://{{region}}.api.konghq.com/v3/openmeter/events"}),s={hasValue:p=>!!p&&Object.keys(p).length>0,prepareFormData:p=>{var d;return t.isEditing?p:(i==null?void 0:i.app)==="konnect"&&!((d=p==null?void 0:p.config)!=null&&d.ingest_endpoint)?{...p,config:{...p==null?void 0:p.config,ingest_endpoint:a.value}}:p}},c=e.ref(!0),l=e.ref(!0),u=e.ref(!0);return(p,d)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"form-config":s,"plugin-config-description":e.unref(o)("plugins.free-form.metering-and-billing.sections.plugin_config.description")}),{"field-renderers":e.withCtx(()=>[e.createVNode($t,{match:({path:f})=>f==="config.meter_api_requests"},{default:e.withCtx(f=>[e.createVNode(An,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_api_requests.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.meter_ai_token_usage"},{default:e.withCtx(f=>[e.createVNode(An,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_ai_token_usage.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.ssl_verify"},{default:e.withCtx(f=>[e.createVNode(An,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.description"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.label")}),null,16,["description","label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.subject.look_up_value_in"},{default:e.withCtx(f=>[e.createVNode(Dt,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.label")}),null,16,["help","label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.subject.field"},{default:e.withCtx(f=>[e.createVNode(tt,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.label"),placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.placeholder")}),null,16,["help","label","placeholder"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.timeout"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.timeout.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.keepalive"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.keepalive.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.max_coalescing_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_coalescing_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.initial_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.initial_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.max_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f==="config.queue.max_retry_time"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_time.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".look_up_value_in")},{default:e.withCtx(f=>[e.createVNode(tt,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.look_up_value_in.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".event_property_name")},{default:e.withCtx(f=>[e.createVNode(tt,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.event_property_name.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(Qf,{expanded:c.value,"onUpdate:expanded":d[0]||(d[0]=f=>c.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.metering.title")},{default:e.withCtx(()=>[e.createVNode(ot,{name:"config.meter_api_requests"}),e.createVNode(ot,{name:"config.meter_ai_token_usage"})]),_:1},8,["expanded","label"]),e.createElementVNode("div",jL,[e.createVNode(Ft,{label:e.unref(o)("plugins.free-form.metering-and-billing.sections.subject.title"),name:"config.subject","render-rules":{dependencies:{field:["look_up_value_in",["query","header"]]}},"reset-label-path":"reset"},null,8,["label"])]),e.createVNode(Qf,{expanded:l.value,"onUpdate:expanded":d[1]||(d[1]=f=>l.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.title")},{default:e.withCtx(()=>[e.createElementVNode("div",FL,[e.createVNode(dr,{"hide-label":"",name:"config.attributes"})])]),_:1},8,["expanded","label"]),e.createVNode(Qf,{expanded:u.value,"onUpdate:expanded":d[2]||(d[2]=f=>u.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.ingestion.title")},{default:e.withCtx(()=>[e.createVNode(tt,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.ingest_endpoint.help"),name:"config.ingest_endpoint"},null,8,["help"]),e.createVNode(ot,{name:"config.api_token"}),e.createVNode(ot,{name:"config.ssl_verify"}),e.createElementVNode("div",UL,[e.createVNode(ot,{name:"config.timeout"}),e.createVNode(ot,{name:"config.keepalive"})])]),_:1},8,["expanded","label"]),e.createVNode(za,{class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[e.createElementVNode("div",KL,[e.createVNode(e.unref(Fe.KLabel),{class:"ff-mb-queue-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.metering-and-billing.sections.queue.title")),1)]),_:1}),e.createVNode(Ft,{"as-child":"",name:"config.queue","reset-label-path":"reset"})])]),_:1})]),_:1},16,["plugin-config-description"]))}}),[["__scopeId","data-v-78972733"]])}),GL=it({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),HL=it({experimental:!0}),zL=it({experimental:!0,fieldRenderers:[{match:"config.access_logs.custom_attributes_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),WL=it({experimental:!0}),YL=it({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}},fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),JL=it({experimental:!0,fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),XL={class:"rla-form-request-limits-subtitle"},ZL={class:"rla-form-request-limits-content"},QL={class:"rla-form-window-type"},eD={class:"rla-form-request-limits-items"},tD={class:"rla-form-request-limits-row"},nD=["id"],rD={class:"rla-form-request-limits-actions"},oD={key:0,class:"rla-form-request-limits-examples"},iD={class:"rla-form-request-limits-examples-badges"},ep="config.window_type",aD=Me(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{i18n:{t}}=Je(),{formData:r,getSelectItems:o,getSchema:i}=ft(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=cf("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(ep))==null?void 0:b.default,p=e.computed(()=>ka(r,ep)),d=e.computed(()=>o(ep).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},g=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"rla-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"rla-form-request-limits-title",for:"rla-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",XL,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",ZL,[e.createElementVNode("div",QL,[e.createVNode(Jf,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",eD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,j)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,j)},[e.createVNode(C,{for:`rla-form-request-limits-item-${j}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:j+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",tD,[e.createElementVNode("legend",{id:`rla-form-request-limits-item-${j}-legend`,class:"rla-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${j}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${j}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,nD),e.createElementVNode("div",rD,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),g.value.length>0?(e.openBlock(),e.createElementBlock("div",oD,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",iD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(I,j)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${j}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${j}`?"info":"decorative",class:"rla-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${j}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-1fac872b"]]),sD={id:"rla-form-error-legend",class:"rla-form-error-inputs"},lD=Me(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{i18n:{t}}=Je();return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"rla-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",sD,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(tt,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-7b36f1f7"]]),cD=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=ft(),r=e.inject(Ze.FORMS_CONFIG),o=e.inject(Ai),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(Ll,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(Gf,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),uD=e.defineComponent({__name:"ConfigForm",setup(n){const{getSchema:t}=ft();return(r,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ft,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(ot,{name:"identifier"}),e.createVNode(aD),e.createVNode(lD)]),_:1}),e.createVNode(za,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(Dt,{multiple:!0,name:"config.compound_identifier"}),e.unref(t)("config.counter_key")?(e.openBlock(),e.createBlock(ot,{key:0,name:"config.counter_key"})):e.createCommentVNode("",!0),e.createVNode(ot,{name:"config.sync_rate"}),e.createVNode(ot,{name:"config.namespace"}),e.createVNode(ot,{name:"config.strategy"}),e.createVNode(cD),e.createVNode(ot,{name:"config.dictionary_name"}),e.createVNode(ot,{name:"config.lock_dictionary_name"}),e.createVNode(ot,{name:"config.hide_client_headers"}),e.createVNode(ot,{name:"config.retry_after_jitter_max"}),e.createVNode(ot,{name:"config.header_name"}),e.createVNode(ot,{name:"config.path"}),e.createVNode(ot,{name:"config.throttling"}),e.createVNode(ot,{name:"config.enforce_consumer_groups"}),e.createVNode(ot,{name:"config.consumer_groups"}),e.createVNode(ot,{name:"config.disable_penalty"})]),_:1})],64))}}),dD=it({experimental:!0,component:e.defineComponent({__name:"RateLimitingAdvancedForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(uD)]),_:1},16))}})}),fD=it({experimental:!0,renderRules:{bundles:[["config.policy","config.redis"]],dependencies:{"config.redis":["config.policy","redis"]}}}),pD="__request_callout_";function pw(){return hl(pD)}const Ya="_callout_id",mD=e.defineComponent({__name:"CalloutForm",props:{index:{},fieldName:{}},setup(n){const t=n,{formData:r}=ft(),o=e.computed(()=>{const{callouts:s}=r.config;return s==null?[]:s.filter(({name:c})=>{var l;return c&&c!==((l=s[t.index])==null?void 0:l.name)})}),i=e.computed(()=>o.value.map(({[Ya]:s,name:c})=>({value:s,label:c}))),a=e.computed(()=>r.config.callouts[t.index]);return e.watch(i,()=>{a.value.depends_on=a.value.depends_on.filter(s=>i.value.some(c=>c.value===s))}),(s,c)=>(e.openBlock(),e.createBlock(Ft,{name:n.fieldName},{depends_on:e.withCtx(l=>[e.createVNode(Dt,e.mergeProps(l,{items:i.value,multiple:"",required:!1}),null,16,["items"])]),request:e.withCtx(l=>[e.createVNode(Ft,e.mergeProps(l,{"fields-order":["url","method","headers","query","body","http_opts","error","by_lua"]}),{method:e.withCtx(u=>[e.createVNode(Dt,e.mergeProps(u,{items:e.unref(nf)(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"])}),null,16,["items"])]),_:1},16)]),_:1},8,["name"]))}}),hD=e.defineComponent({__name:"CalloutsForm",setup(n){const{formData:t}=ft();function r(){const o=t.config.callouts[t.config.callouts.length-1];o&&(o[Ya]=pw())}return(o,i)=>(e.openBlock(),e.createBlock(dr,{appearance:"tabs","item-label":a=>a.name||"New callout",name:"callouts",required:"","sticky-tabs":"",onAdd:r},{item:e.withCtx(({index:a,fieldName:s})=>[e.createVNode(mD,{"field-name":s,index:a},null,8,["field-name","index"])]),_:1},8,["item-label"]))}}),gD=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Ft,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(hD),e.createVNode(Ft,{appearance:"card","fields-order":["headers","query","body","by_lua"],name:"upstream"}),e.createVNode(Ft,{appearance:"card",name:"cache"},{redis:e.withCtx(o=>[e.createVNode(Ft,e.mergeProps(o,{"fields-order":["host","port","connection_is_proxied","database","username","password","sentinel_master","sentinel_role","sentinel_nodes","sentinel_username","sentinel_password","cluster_nodes","cluster_max_redirections","ssl","ssl_verify","server_name","keepalive_backlog","keepalive_pool_size","read_timeout","send_timeout","connect_timeout"]}),null,16)]),_:2},1024)]),_:1}))}}),yD=it({component:Me(e.defineComponent({__name:"RequestCalloutForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Je();function i(l,u=!1){return l.reduce((p,{[Ya]:d,name:f})=>(u?p[f]=d:p[d]=f,p),{})}function a(l){var p;const u=Ea(l);if((p=u.config)!=null&&p.callouts){const{callouts:d}=u.config;d.forEach(m=>{m.request.body.custom=m.request.body.custom??{},m[Ya]=pw()});const f=i(d,!0);d.forEach(m=>{m.depends_on=m.depends_on.map(g=>f[g])})}return u}const s={hasValue:l=>!!l&&Object.keys(l).length>0,prepareFormData:a};function c(l,u){var f;if(!l)return;const p=Ea(l);if(!((f=p.config)!=null&&f.callouts)){t.onFormChange(p,u);return}const d=i(p.config.callouts);p.config.callouts=p.config.callouts.map(m=>{const{[Ya]:g,depends_on:y,...b}=m;return{depends_on:y.map(_=>d[_]).filter(_=>_!=null),...b}}),t.onFormChange(p,u)}return(l,u)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"form-config":s,"on-form-change":c}),{"field-renderers":e.withCtx(()=>[e.createVNode($t,{match:({path:p})=>p.endsWith("by_lua")},{default:e.withCtx(p=>[e.createVNode(tt,e.mergeProps(p,{autosize:"",class:"rc-code",multiline:"",placeholder:e.unref(o)("plugins.free-form.request-callout.by_lua_placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode($t,{match:({path:p})=>["cluster_nodes","sentinel_nodes"].some(d=>p.endsWith(d))},{default:e.withCtx(p=>[e.createVNode(dr,e.mergeProps(p,{appearance:"card"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(gD)]),_:1},16))}}),[["__scopeId","data-v-dc955662"]])}),_D=it({experimental:!0}),bD=it({experimental:!0}),wD=it({experimental:!0,fieldRenderers:[{match:({path:n,genericPath:t})=>n==="config.replace.body"||t==="config.transform.functions.*"||t.endsWith(".json.*"),component:tt,propsOverrides:{multiline:!0,rows:3}}]}),kD=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n.endsWith(".json.*"),component:tt,propsOverrides:{multiline:!0,rows:3}}]}),CD=it({experimental:!0}),ED={class:"sp-form-request-limits-subtitle"},ND={class:"sp-form-request-limits-content"},SD={class:"sp-form-window-type"},xD={class:"sp-form-request-limits-items"},AD={class:"sp-form-request-limits-row"},vD=["id"],ID={class:"sp-form-request-limits-actions"},BD={key:0,class:"sp-form-request-limits-examples"},TD={class:"sp-form-request-limits-examples-badges"},tp="config.window_type",OD=Me(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{t}=jt.createI18n("en-us",Yt),{formData:r,getSelectItems:o,getSchema:i}=ft(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=cf("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(tp))==null?void 0:b.default,p=e.computed(()=>ka(r,tp)),d=e.computed(()=>o(tp).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},g=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"sp-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"sp-form-request-limits-title",for:"sp-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",ED,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",ND,[e.createElementVNode("div",SD,[e.createVNode(Jf,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",xD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,j)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,j)},[e.createVNode(C,{for:`sp-form-request-limits-item-${j}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:j+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",AD,[e.createElementVNode("legend",{id:`sp-form-request-limits-item-${j}-legend`,class:"sp-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${j}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${j}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,vD),e.createElementVNode("div",ID,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(j)},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),g.value.length>0?(e.openBlock(),e.createElementBlock("div",BD,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",TD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(I,j)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${j}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${j}`?"info":"decorative",class:"sp-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${j}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-e12d9c9f"]]),PD={id:"sp-form-error-legend",class:"sp-form-error-inputs"},VD=Me(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{t}=jt.createI18n("en-us",Yt);return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"sp-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",PD,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(tt,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-0796e152"]]),$D=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=ft(),r=e.inject(Ze.FORMS_CONFIG),o=e.inject(Ai),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(Ll,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(Gf,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),RD=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ft,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(OD),e.createVNode(VD)]),_:1}),e.createVNode(za,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(ot,{name:"config.dictionary_name"}),e.createVNode(ot,{name:"config.lock_dictionary_name"}),e.createVNode(ot,{name:"config.strategy"}),e.createVNode($D),e.createVNode(ot,{name:"config.namespace"}),e.createVNode(ot,{name:"config.hide_client_headers"}),e.createVNode(ot,{name:"config.disable_penalty"}),e.createVNode(ot,{name:"config.retry_after_jitter_max"}),e.createVNode(ot,{name:"config.sync_rate"})]),_:1})],64))}}),LD=it({experimental:!0,component:e.defineComponent({__name:"ServiceProtectionForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(Ze.AUTOFILL_SLOT,r==null?void 0:r[Ze.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(Zn,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(RD)]),_:1},16))}})}),DD=it({experimental:!0}),MD=it({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.flow.functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),jD=it({experimental:!0,fieldRenderers:[{match:"config.message.custom_fields_by_lua",component:fr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),FD=it({experimental:!0,fieldRenderers:[{match:"config.message.functions.*",component:tt,propsOverrides:{multiline:!0,rows:3}}]}),UD=it({experimental:!0,renderRules:{bundles:[["config.cache.strategy","config.cache.redis"]],dependencies:{"config.cache.redis":["config.cache.strategy","redis"]}},fieldRenderers:[{match:"config.behavior.idp_error_response_body_template",component:tt,propsOverrides:{multiline:!0,rows:4}}]}),KD=Object.assign({"../plugins/acl/index.ts":MV,"../plugins/ai-custom-guardrail.ts":jV,"../plugins/ai-mcp-proxy/index.ts":FV,"../plugins/aws-lambda.ts":UV,"../plugins/basic-auth/index.ts":e$,"../plugins/confluent-consume.ts":t$,"../plugins/confluent.ts":n$,"../plugins/correlation-id.ts":r$,"../plugins/cors.ts":o$,"../plugins/datakit/index.ts":EL,"../plugins/exit-transformer.ts":NL,"../plugins/file-log.ts":SL,"../plugins/header-cert-auth.ts":xL,"../plugins/http-log.ts":AL,"../plugins/jwe-decrypt.ts":vL,"../plugins/jwt-signer/index.ts":IL,"../plugins/jwt.ts":BL,"../plugins/kafka-consume.ts":TL,"../plugins/kafka-log.ts":OL,"../plugins/kafka-upstream.ts":PL,"../plugins/key-auth/index.ts":VL,"../plugins/metering-and-billing/index.ts":qL,"../plugins/mtls-auth.ts":GL,"../plugins/oauth2.ts":HL,"../plugins/opentelemetry.ts":zL,"../plugins/prometheus.ts":WL,"../plugins/proxy-cache-advanced.ts":YL,"../plugins/proxy-cache.ts":JL,"../plugins/rate-limiting-advanced/index.ts":dD,"../plugins/rate-limiting.ts":fD,"../plugins/request-callout/index.ts":yD,"../plugins/request-transformer-advanced.ts":_D,"../plugins/request-transformer.ts":bD,"../plugins/response-transformer-advanced.ts":wD,"../plugins/response-transformer.ts":kD,"../plugins/route-transformer-advanced.ts":CD,"../plugins/service-protection/index.ts":LD,"../plugins/session.ts":DD,"../plugins/solace-consume.ts":MD,"../plugins/solace-log.ts":jD,"../plugins/solace-upstream.ts":FD,"../plugins/upstream-oauth.ts":UD});function qD(n){const t=n.match(/\.\.\/plugins\/(.+?)(?:\/index)?\.ts$/);if(!t)throw new Error(`Unable to derive plugin name from path: ${n}`);const[,r]=t;return r}function GD(n){const t={},r=new Map;for(const[o,i]of Object.entries(n)){const a=qD(o);if(r.has(a))throw new Error(`Duplicate plugin config for "${a}": ${r.get(a)} and ${o}`);r.set(a,o),t[a]={...i,component:i.component,experimental:i.experimental??!1,fieldRenderers:i.fieldRenderers??[]}}return t}const np=GD(KD);function mw(n){return np[n]}function hw(n,t){const r=mw(n);if(r&&!(r.experimental&&!t.includes(n)))return r.component}function gw(n,t,r){return r==="freeform"?!0:r==="vfg"?!1:!!hw(n,t)}function HD(){return Object.entries(np).filter(([,n])=>n.experimental).map(([n])=>n).sort((n,t)=>n.localeCompare(t))}function rp(){return e.inject(Ld,[])}function zD(n){const t=new Set(HD()),r=n.filter(i=>t.has(i)),o=n.filter(i=>!t.has(i));return o.length>0&&console.warn(`[entities-plugins] Ignoring unknown experimental free-form plugins: ${o.join(", ")}`),r}function WD(n){e.provide(Ld,zD(n))}function YD(){const n=rp();return{shouldUseFreeForm:(t,r)=>gw(t,n,r),getFreeFormComponent:t=>hw(t,n)}}function yw(n){var o,i;if(!n)return;if(!n.token_exchange)return n;if((Array.isArray((o=n.token_exchange.request)==null?void 0:o.audience)&&n.token_exchange.request.audience.length===0||n.token_exchange.request&&!n.token_exchange.request.audience)&&(n.token_exchange.request.audience=null),(Array.isArray((i=n.token_exchange.request)==null?void 0:i.scopes)&&n.token_exchange.request.scopes.length===0||n.token_exchange.request&&!n.token_exchange.request.scopes)&&(n.token_exchange.request.scopes=null),[{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1},subject_token_issuers:null},{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1}},{cache:{},request:{audience:null,scopes:null}}].some(a=>en(n.token_exchange,a)))return n.token_exchange=null,n;const r=n.token_exchange.subject_token_issuers;return r&&r.forEach(a=>{en(a.conditions,{})&&(a.conditions=null),a.conditions&&Object.values(a.conditions).every(s=>Array.isArray(s)&&s.length===0)&&(a.conditions=null)}),n}const _w=n=>{const t=n==null?void 0:n.proof_of_possession_mtls_from_header;if(!t)return;if(!Array.isArray(t.ca_certificates)||t.ca_certificates.length===0){n.proof_of_possession_mtls_from_header=null;return}en(t,{allow_partial_chain:!1,cert_cache_ttl:6e4,certificate_header_format:"url_encoded",http_timeout:3e4,revocation_check_mode:"IGNORE_CA_ERROR",secure_source:!0,ssl_verify:!0})&&(n.proof_of_possession_mtls_from_header=null)},JD={shamefullyTransformPayload(n){return yw(n.payload.config),_w(n.payload.config),n}},XD={shamefullyTransformPayload(n){var t,r,o,i,a;if(!((r=(t=n.payload.config)==null?void 0:t.access_logs)!=null&&r.custom_attributes_by_lua))return n;if(en((i=(o=n.payload.config)==null?void 0:o.access_logs)==null?void 0:i.custom_attributes_by_lua,{})){const s=(a=n.payload.config)==null?void 0:a.access_logs;s&&(s.custom_attributes_by_lua=null)}return n}},ZD={shamefullyTransformPayload(n){var r,o;const t=(o=(r=n.payload.config)==null?void 0:r.v2_strategies)==null?void 0:o.openid_connect;return Array.isArray(t)&&t.forEach(i=>{yw(i.config),_w(i.config)}),n}},QD={shamefullyTransformPayload(n){var r;return!n.payload.config||!((r=n.payload.config)!=null&&r.token_exchange)||[{cache:{enabled:!0,ttl:3600},client_auth:"client_secret_basic",enabled:!1,request:{actor_token_source:"none",actor_token_type:"urn:ietf:params:oauth:token-type:access_token",audience:null,requested_token_type:"urn:ietf:params:oauth:token-type:access_token",scopes:null,subject_token_type:"urn:ietf:params:oauth:token-type:access_token"}}].some(o=>{var i;return en((i=n.payload.config)==null?void 0:i.token_exchange,o)})&&(n.payload.config.token_exchange=null),n}},eM=(n,t)=>{const r=n.model.startsWith("config-"),o=t.model.startsWith("config-");return r&&!o?1:!r&&o?-1:0},bw=(n,t)=>(n.order??0)-(t.order??0),ww=(n,t)=>eM(n,t)||bw(n,t)||n.model.localeCompare(t.model),tM=n=>{const{capitalize:t}=Ie.useStringHelpers(),{convertToDotNotation:r}=Hy(),{i18n:{t:o}}=Je(),i=rp(),a={"application-registration":{overwriteDefault:!0,formSchema:{...WB}},datadog:{...YB},"exit-transformer":{...JB},"upstream-tls":{"config-trusted_certificates":{type:"textArea",valueType:"array",rows:4,help:"A comma separated list of certificate values"}},statsd:{...cT},"statsd-advanced":{...uT},"route-by-header":{...iT},"ai-prompt-decorator":{...KB},"ai-prompt-template":{...qB},"ai-proxy-advanced":{...GB},"ai-rag-injector":{...HB},"ai-llm-as-judge":{...zB},"vault-auth":{...fT},"oas-validation":{...eT},mocking:{...QB},"rate-limiting":{...Pl},"rate-limiting-advanced":(n==null?void 0:n.app)==="kongManager"?{"config-consumer_groups":Pl["config-consumer_groups"]}:{...Pl},"graphql-rate-limiting-advanced":{...XB},"injection-protection":{...ZB},"response-ratelimiting":{...Pl},"pre-function":{...n_},"post-function":{...n_},"request-transformer-advanced":{...rT},"response-transformer":{...r_},"response-transformer-advanced":{...oT},zipkin:{...kT},"upstream-oauth":{...dT},saml:{...aT},"kafka-upstream":{...gT},"solace-consume":{...sT},"solace-upstream":{...lT},"key-auth":VB(n),"key-auth-enc":jB(n),confluent:{...yT},"confluent-consume":{..._T},"kafka-consume":{...bT},"kafka-log":{...wT},"openid-connect":{...JD},opentelemetry:{...XD},"konnect-application-auth":{...ZD},"ai-mcp-oauth2":{...QD}},s=()=>["created_at","updated_at","id","_isCustomPlugin","_sourcePlugin","_supported_redis_partial_type","_redis_partial_path"],c=(w,S,I,j)=>{let A={};(S||w)&&(A=S||(w.fields?w.fields:w));const x=s().concat(w.blacklist?w.blacklist:[]),O=Object.keys(A).filter(q=>!x.includes(q)),P=O.indexOf("comparator");P>-1&&O.splice(P,1);let R={fields:[]};const W={};O.forEach(q=>{u(A[q],q,A,W,R,I)});const Z=W.name,X=w._sourcePlugin||Z,F=$n[X],J=[],$=q=>{const K=["cluster-cache"];for(const ae of K)if(q.model.includes(ae))return!1;return new RegExp("(?<=-redis-).*").test(q.model)};if(R._supported_redis_partial_type=w._supported_redis_partial_type,R._redis_partial_path=w._redis_partial_path,Ze.getSharedFormName(X)||gw(X,i,j)||F!=null&&F.useLegacyForm||n!=null&&n.credential){if(F!=null&&F.useLegacyForm&&(n!=null&&n.enableRedisPartial)&&w._supported_redis_partial_type){for(const q of R.fields)if($(q)){J.push(q);continue}R.fields=R.fields.filter(q=>!$(q)),J.length&&R.fields.push({id:"_redis",fields:J,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path})}R.fields.sort((q,K)=>(q.order=q.order||0,K.order=K.order||0,q.order-K.order))}else{const q=[],K=[],ae=[],M=[],v={};if(F!=null&&F.fieldRules){const te=[...F.fieldRules.atLeastOneOf??[],...F.fieldRules.onlyOneOf??[],...F.fieldRules.mutuallyRequired??[]];if(F.fieldRules.onlyOneOfMutuallyRequired)for(const ge of F.fieldRules.onlyOneOfMutuallyRequired)te.push(...ge);for(const ge of te)for(const me of ge)v[me.replace(/-/g,"_").replace(/\./g,"-")]=!1}for(const te of R.fields){if(n!=null&&n.enableRedisPartial&&w._supported_redis_partial_type&&$(te)){M.push(te);continue}if(te.pinned){q.push(te);continue}if(te.required||v[te.model]!==void 0){v[te.model]===!1&&(v[te.model]=!0),K.push(te);continue}ae.push(te)}M.length&&ae.push({id:"_redis",fields:M,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path,order:-1});const H=Object.entries(v).filter(([,te])=>!te).map(([te])=>te.replace(/-/g,".").replace(/_/g,"-"));H.length>0&&console.warn(`Unknown checked fields for plugin ${Z}: ${H.join(", ")}`);const oe=[];q.length>0&&oe.push({fields:q.sort(bw)}),(K.length>0||ae.length>0)&&oe.push({fields:K.sort(ww),collapsible:{title:o("plugins.form.grouping.plugin_configuration.title"),description:o("plugins.form.grouping.plugin_configuration.description"),nestedCollapsible:{fields:ae.sort(ww),triggerLabel:{expand:o("plugins.form.grouping.advanced_parameters.view"),collapse:o("plugins.form.grouping.advanced_parameters.hide")}}},slots:{beforeContent:"plugin-config-before-content",emptyState:"plugin-config-empty-state"}}),R={groups:oe}}return{schema:R,model:W,options:{noneSelectedText:"Nothing Selected...",helpAsHtml:!0}}},l=w=>Array.isArray(w.default)||w.default!=null&&typeof w.default!="object"&&w.default!=="function",u=(w,S,I,j,A,x)=>{const O=l(w);return j[S]=O?w.default:null,w.id=S,w.model=S,w.fields&&w.type==="record"?d(w,S,I,j,A,x):(I[S]=w,N(w,j),x&&x[S]&&p(I[S],x[S]),A.fields.push(w)),I},p=(w,S)=>(S&&(Object.assign(w,S),S.label&&(w.label=S.label)),w),d=(w,S,I,j,A,x)=>{w.fields.forEach(O=>{Object.keys(O).forEach(P=>{const R=O[P];I=u(R,S+"-"+P,I,j,A,x)})})},f=(w,S)=>{w.type="input",w.inputType="hidden",w.styleClasses="kong-form-hidden-field-wrapper";const I=n==null?void 0:n.entityId;S[w.model]=I?{id:I}:null},m=w=>{w.type="input",w.inputType="number",w.between&&w.between.length===2&&(w.min=w.between[0],w.max=w.between[1])},g=w=>{Object.prototype.hasOwnProperty.call(w,"one_of")?(w.type="select",w.values=w.one_of,w.selectOptions={hideNoneSelectedText:!0}):(w.type="input",w.inputType="text")},y=w=>{w.type="checkbox",w.default=!0,w.required=!1},b=w=>{if(w.type="object-advanced",w.values.type==="array"){const{type:S}=w.values.elements||{};w.schema={fields:[{schema:{fields:[{...dt,model:w.model,valueArrayType:S==="integer"?"number":S||"string",inputAttributes:{...dt.inputAttributes,type:S==="integer"?"number":"text",inputMode:S==="integer"?"numeric":"text"}}]}}]}}else w.values.fields&&(w.schema={fields:[{type:"object",model:"object",schema:{fields:w.values.fields.map(S=>{const I=Object.keys(S)[0];return{model:I,type:"input",label:t(I),placeholder:I,inputType:S[I].type}})}}]})},_=w=>w.fields.reduce((S,I)=>(I.fields&&I.fields.forEach(j=>{S[j.model]=j}),I.model&&(S[I.model]=I),S),{}),k=(w,S)=>{if(!Ze.customFields.includes(w.model))return;const I=_(w);Ze.customFields.forEach(j=>{Object.keys(I).forEach(A=>{const x=l(I[A]);S[A]=x?I[A].default:null}),delete S[j]})},C=(w,S)=>w.inputType==="hidden"?"":r(w.label||S.replace(/_/g," ")),N=(w,S)=>{switch(k(w,S),w.type){case"foreign":f(w,S);break;case"number":m(w),w.attributes={step:"any"};break;case"integer":m(w);break;case"string":g(w);break;case"boolean":y(w);break;case"map":b(w);break}w.inputType==="foreign"&&f(w,S),w.label=C(w,w.model)};function E(w,S){if(S==null||S.type&&S.type!=="record"||typeof w!="object"||w==null)return w;const I={};for(const j of S.fields){const A=Object.keys(j)[0],x=j[A];x.type==="record"?I[A]=E(w[A],x):x.type==="array"&&Array.isArray(w[A])&&x.elements.type==="record"?I[A]=w[A].map(O=>E(O,x.elements)):I[A]=w[A]}return I}return{buildFormSchema:u,parseSchema:c,customSchemas:a,typedefs:ai,pruneRecord:E}},uc=Symbol("customPluginType"),nM=1e3,rM=20,kw=5e3,Cw=(n,t=nM)=>{const r=/^[a-z][a-z\d+.-]*:/i.test(n),o=new URL(n,"http://localhost");return o.searchParams.has("size")||o.searchParams.set("size",`${t}`),r?o.toString():`${o.pathname}${o.search}${o.hash}`},dc=async(n,t,r)=>{const o=[];let i=Cw(t),a=null,s=0;for(;i&&s<rM&&o.length<kw&&i!==a;){a=i;const l=(await n.get(i,{signal:r})).data;Array.isArray(l==null?void 0:l.data)&&o.push(...l.data),i=l!=null&&l.next?Cw(l.next):null,s+=1}return o.slice(0,kw)};function oM(n){const{axiosInstance:t,apiBaseUrl:r}=n,o=()=>{if(n.app!=="konnect")throw new Error("Installed custom plugin APIs are only available for Konnect")},i=(b,_)=>{let k=`${r}${b}`;return n.app==="konnect"&&(k=k.replace(/{controlPlaneId}/gi,n.controlPlaneId)),k=k.replace(/{pluginId}/gi,_??"").replace(/\/{workspace}/gi,n.workspace?`/${n.workspace}`:""),k},a=async b=>{o();const _=i(Qe.customPlugin.konnect.installed.edit,b),{data:k}=await t.get(_);return k},s=async b=>{o();const _=i(Qe.customPlugin.konnect.installed.create),{data:k}=await t.post(_,b);return k},c=async(b,_)=>{o();const k=i(Qe.customPlugin.konnect.installed.edit,b),{data:C}=await t.put(k,_);return C},l=async b=>{const _=i(Qe.customPlugin[n.app].streamed.edit,b),{data:k}=await t.get(_);return k},u=async b=>{const _=i(Qe.customPlugin[n.app].streamed.create),{data:k}=await t.post(_,b);return k},p=async(b,_)=>{const k=i(Qe.customPlugin[n.app].streamed.edit,b),C=n.app==="konnect"?"put":"patch",{data:N}=await t[C](k,_);return N},d=async b=>{const{aliasName:_,priority:k,sourcePlugin:C}=b,N=i(Qe.customPlugin[n.app].cloned.create),{data:E}=await t.post(N,{name:_,ref:C,priority:k});return E},f=async(b,_)=>{const{aliasName:k,priority:C,sourcePlugin:N}=_,E=i(Qe.customPlugin[n.app].cloned.edit,b),w=n.app==="konnect"?"put":"patch",{data:S}=await t[w](E,{ref:N,priority:C,name:k});return S},m=async b=>{const _=i(Qe.customPlugin[n.app].cloned.edit,b),{data:k}=await t.get(_);return k};return{getInstalledPlugin:a,createInstalledPlugin:s,updateInstalledPlugin:c,getStreamedPlugin:l,createStreamedPlugin:u,updateStreamedPlugin:p,getPluginByUnknownType:async b=>{var _,k,C;if(n.app==="konnect")try{const N=await a(b);return Object.assign(N,{[uc]:"installed"})}catch(N){if(zo.isAxiosError(N)&&((_=N.response)==null?void 0:_.status)!==404)throw N}try{const N=await l(b);return Object.assign(N,{[uc]:"streamed"})}catch(N){if(zo.isAxiosError(N)&&((k=N.response)==null?void 0:k.status)!==404)throw N}try{const N=await m(b);return Object.assign(N,{[uc]:"cloned"})}catch(N){if(zo.isAxiosError(N)&&((C=N.response)==null?void 0:C.status)!==404)throw N}return null},getPluginType:b=>b[uc],getClonedPlugin:m,createClonedPlugin:d,updateClonedPlugin:f}}const st={useI18n:Je,usePluginMetaData:e_,usePluginHelpers:Hy,useSchemas:tM,useExperimentalFreeForms:rp,useProvideExperimentalFreeForms:WD,useFreeFormResolver:YD,useCustomPluginApi:oM},Ew=n=>{var r,o,i,a;const t=n==null?void 0:n.response;return(t==null?void 0:t.status)===400&&(((o=(r=t.data)==null?void 0:r.message)==null?void 0:o.includes("plugin schema is currently in use"))||((i=t.data)==null?void 0:i.code)===19||((a=t.data)==null?void 0:a.name)==="referenced by others")},iM={class:"kong-ui-entities-custom-plugin-form"},aM={class:"plugin-type-radios"},sM={class:"compare-table-wrapper"},lM={class:"compare-table"},cM={key:0,scope:"col"},uM={key:1,scope:"col"},dM={key:2,scope:"col"},fM={scope:"row"},pM={key:0},mM={key:1},hM={key:2},gM={scope:"row"},yM={key:0},_M={class:"compare-list"},bM={key:1},wM={class:"compare-list"},kM={key:2},CM={scope:"row"},EM={key:0},NM={key:1},SM={key:2},xM={scope:"row"},AM={key:0},vM={key:1},IM={key:2},BM={scope:"row"},TM={key:0},OM={key:1},PM={key:2},VM={class:"plugin-modules-section"},$M={class:"plugin-select-item"},RM={class:"plugin-select-item"},LM={key:1},DM=1*1024*1024,MM=Me(e.defineComponent({__name:"CustomPluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!n.app||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&!n.workspace||!n.cancelRoute||!n.successRoute)},pluginName:{type:String,default:""},unsupportedTypes:{type:Array,default:()=>[]}},emits:["update","error","loading"],setup(n,{emit:t}){var me;const r=["acl","datakit","file-log","http-log","ip-restriction","key-auth","opa","openid-connect","post-function","pre-function","request-transformer-advanced","request-transformer","response-transformer-advanced","response-transformer","route-by-header","tcp-log"],o=["installed","streamed","cloned"],i=n,a=t,{i18n:{t:s},i18nT:c}=st.useI18n(),l=Nr.useRouter(),{getMessageFromError:u}=Ie.useErrors(),{axiosInstance:p}=Ie.useAxios((me=i.config)==null?void 0:me.axiosRequestConfig),{createInstalledPlugin:d,updateInstalledPlugin:f,createStreamedPlugin:m,updateStreamedPlugin:g,getPluginType:y,getPluginByUnknownType:b,createClonedPlugin:_,updateClonedPlugin:k}=st.useCustomPluginApi({axiosInstance:p,apiBaseUrl:i.config.apiBaseUrl,controlPlaneId:i.config.controlPlaneId,app:i.config.app,workspace:i.config.workspace});e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,e.ref(!0));const C=e.ref(null),N=(le,he)=>{const Oe=i.config.workspace??"",$e=i.config.app==="konnect"?i.config.controlPlaneId:"";return`${i.config.apiBaseUrl}${le}`.replace(/{controlPlaneId}/gi,$e).replace(/{pluginId}/gi,he??"").replace(/\/\{workspace\}/gi,Oe?`/${Oe}`:"")},E=e.computed(()=>{const le=$.fields.pluginType;if(!le)return"";const he=j.value?i.pluginName:void 0,Oe=he?"edit":"create";if(i.config.app==="konnect"){if(le==="installed")return N(Qe.customPlugin.konnect.installed[Oe],he);if(le==="streamed")return N(Qe.customPlugin.konnect.streamed[Oe],he);if(le==="cloned")return N(Qe.customPlugin.konnect.cloned[Oe],he)}else{if(le==="streamed")return N(Qe.customPlugin.kongManager.streamed[Oe],he);if(le==="cloned")return N(Qe.customPlugin.kongManager.cloned[Oe],he)}return""}),w=e.computed(()=>j.value?$.fields.pluginType==="cloned"?i.config.app==="konnect"?"put":"patch":i.config.app==="kongManager"&&$.fields.pluginType==="streamed"?"patch":"put":"post"),S=e.computed(()=>{switch($.fields.pluginType){case"installed":return Ie.SupportedEntityType.PluginSchema;case"streamed":return Ie.SupportedEntityType.CustomPlugin;case"cloned":return Ie.SupportedEntityType.ClonedPlugin;default:return Ie.SupportedEntityType.Plugin}}),I=e.computed(()=>{switch($.fields.pluginType){case"installed":return{lua_schema:$.fields.schemaContent};case"streamed":return{name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent};case"cloned":return{ref:$.fields.sourcePlugin,name:$.fields.aliasName,...$.fields.priority?{priority:parseInt($.fields.priority,10)}:{}};default:return{}}}),j=e.computed(()=>!!i.pluginName),A=e.ref(!1),x=e.ref(""),O=e.computed(()=>new Set(i.unsupportedTypes)),P=e.computed(()=>o.filter(le=>!O.value.has(le))),R=e.computed(()=>!j.value&&P.value.length===0),W=e.computed(()=>!j.value&&P.value.length>1),Z=()=>P.value[0]??null,X=le=>P.value.includes(le),F=le=>{if(j.value||!W.value){const he=le-1;return($.fields.pluginType==="installed"?1:2)>1?he:void 0}return le},J=e.ref(!0),$=e.reactive({fields:{pluginType:Z(),schemaContent:"",handlerContent:"",name:"",sourcePlugin:"",aliasName:"",priority:""},readonly:!1,errorMessage:""});let q="";e.watch(P,le=>{j.value||(!$.fields.pluginType||!le.includes($.fields.pluginType))&&($.fields.pluginType=le[0]??null)},{immediate:!0}),e.watch(()=>$.fields.pluginType,()=>{j.value||($.fields.schemaContent="",$.fields.handlerContent="",$.fields.name="",$.fields.sourcePlugin="",$.fields.aliasName="",$.fields.priority="")});const{getDisplayName:K}=e_(),ae=e.computed(()=>{var $e;const le=(($e=i.config)==null?void 0:$e.clonablePlugins)??r;if(le.length===0)return[];const he={};le.forEach(Pe=>{const qe=$n[Pe],Ye=qe==null?void 0:qe.group;Ye?(he[Ye]||(he[Ye]=[]),he[Ye].push({label:K(Pe),value:Pe})):console.warn(`Plugin ${Pe} is missing metadata group and will be shown without grouping.`)});const Oe=[];return Object.keys(he).sort().forEach(Pe=>{Oe.push({label:Pe,items:he[Pe]})}),Oe}),M=e.computed(()=>{if(R.value||!$.fields.pluginType)return!1;switch($.fields.pluginType){case"installed":return $.fields.schemaContent.length>0;case"streamed":return $.fields.schemaContent.length>0&&$.fields.handlerContent.length>0&&$.fields.name.trim().length>0;case"cloned":return!!$.fields.sourcePlugin&&$.fields.aliasName.trim().length>0;default:return!1}}),v=le=>new Promise((he,Oe)=>{const $e=new FileReader;$e.onload=Pe=>{var Ye;const qe=(Ye=Pe.target)==null?void 0:Ye.result;typeof qe=="string"?he(qe):Oe(new Error("Failed to read file as text"))},$e.onerror=Oe,$e.readAsText(le)}),H=async(le,he)=>{const Oe=he[0];if(Oe){if(Oe.size>DM){$.errorMessage=s("custom_plugin_form.errors.file_too_large");return}try{const $e=await v(Oe);le==="schema"?$.fields.schemaContent=$e:$.fields.handlerContent=$e}catch{$.errorMessage=s("custom_plugin_form.errors.file_read_error"),le==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""}}},oe=le=>{le==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""},te=()=>{l.push(i.config.cancelRoute)};e.onMounted(async()=>{if(i.pluginName){A.value=!0,a("loading",!0);try{const le=await b(i.pluginName);if(!le){x.value=s("custom_plugin_form.errors.plugin_not_found"),a("error",new Error(x.value));return}const he=y(le);if($.fields.pluginType=he,he==="installed")$.fields.schemaContent=le.item.lua_schema;else if(he==="streamed"){const{name:Oe,schema:$e,handler:Pe}=le;$.fields.name=Oe,$.fields.schemaContent=$e,$.fields.handlerContent=Pe}else if(he==="cloned"){const{ref:Oe,name:$e,priority:Pe}=le;$.fields.aliasName=$e,$.fields.sourcePlugin=Oe,$.fields.priority=Pe!==null?String(Pe):"",q=$e}else x.value=s("custom_plugin_form.errors.unsupported_plugin_type",{type:he}),a("error",new Error(x.value))}catch(le){x.value=u(le),a("error",le)}finally{A.value=!1,a("loading",!1)}}});const ge=async()=>{$.errorMessage="",$.readonly=!0;try{const le=$.fields.pluginType;if(!le)return;if(le==="installed"){const he={lua_schema:$.fields.schemaContent},Oe=j.value?await f(i.pluginName,he):await d(he);a("update",Oe)}else if(le==="streamed"){const he={name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent},Oe=j.value?await g(i.pluginName,he):await m(he);a("update",Oe)}else{const he=j.value?await k(q,{aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0}):await _({aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0});a("update",{pluginType:"cloned",sourcePlugin:he.ref,aliasName:he.name,priority:he.priority??void 0})}l.push(i.config.successRoute)}catch(le){$.errorMessage=Ew(le)?s("delete.plugin_schema_in_use_message"):u(le),a("error",le)}finally{$.readonly=!1}};return(le,he)=>{const Oe=e.resolveComponent("KSkeleton"),$e=e.resolveComponent("KEmptyState"),Pe=e.resolveComponent("KRadio"),qe=e.resolveComponent("KCollapse"),Ye=e.resolveComponent("KFileUpload"),et=e.resolveComponent("KLabel"),Ve=e.resolveComponent("KAlert"),ke=e.resolveComponent("KSelect"),_e=e.resolveComponent("KInput"),ye=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",iM,[e.createVNode(e.unref(Ie.EntityBaseForm),{ref_key:"entityBaseFormRef",ref:C,"can-submit":M.value,config:n.config,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":$.errorMessage,"form-fields":I.value,"is-readonly":$.readonly,"slideout-deck-entity-type":S.value,"slideout-fetch-url":E.value,"slideout-request-method":w.value,onCancel:te,onSubmit:ge},{"form-actions":e.withCtx(()=>[A.value||x.value||R.value?(e.openBlock(),e.createElementBlock("span",LM)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(ye,{appearance:"primary","data-testid":"custom-plugin-form-submit",disabled:!M.value||$.readonly,type:"submit"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.save")),1)]),_:1},8,["disabled"]),e.createVNode(ye,{appearance:"secondary","data-testid":"custom-plugin-form-cancel",disabled:$.readonly,onClick:te},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.cancel")),1)]),_:1},8,["disabled"]),e.createVNode(ye,{appearance:"tertiary","data-testid":"custom-plugin-form-view-configuration",onClick:he[14]||(he[14]=ie=>{var ee;return(ee=C.value)==null?void 0:ee.viewConfig()})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.view_configuration")),1)]),_:1})],64))]),default:e.withCtx(()=>[A.value?(e.openBlock(),e.createBlock(Oe,{key:0,type:"form"})):x.value?(e.openBlock(),e.createBlock($e,{key:1,"action-button-visible":!1,"data-testid":"custom-plugin-form-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(x.value),1)]),_:1})):R.value?(e.openBlock(),e.createBlock($e,{key:2,"action-button-visible":!1,"data-testid":"custom-plugin-form-unsupported-types-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(s)("custom_plugin_form.errors.no_supported_types")),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[W.value?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:0,class:"custom-plugin-form-steps",step:1,title:e.unref(s)("custom_plugin_form.step1.title")},{default:e.withCtx(()=>[e.createElementVNode("div",aM,[X("installed")?(e.openBlock(),e.createBlock(Pe,{key:0,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[0]||(he[0]=ie=>$.fields.pluginType=ie),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-installed",description:e.unref(s)("custom_plugin_form.step1.types.installed.description"),label:e.unref(s)("custom_plugin_form.step1.types.installed.label"),"selected-value":"installed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createBlock(Pe,{key:1,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[1]||(he[1]=ie=>$.fields.pluginType=ie),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-streamed",description:e.unref(s)("custom_plugin_form.step1.types.streamed.description"),label:e.unref(s)("custom_plugin_form.step1.types.streamed.label"),"selected-value":"streamed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createBlock(Pe,{key:2,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[2]||(he[2]=ie=>$.fields.pluginType=ie),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-cloned",description:e.unref(s)("custom_plugin_form.step1.types.cloned.description"),label:e.unref(s)("custom_plugin_form.step1.types.cloned.label"),"selected-value":"cloned"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0)]),e.createVNode(qe,{modelValue:J.value,"onUpdate:modelValue":he[3]||(he[3]=ie=>J.value=ie),class:"custom-plugin-form-compare-collapse","data-testid":"compare-deployment-options","trigger-alignment":"leading","trigger-label":e.unref(s)("custom_plugin_form.step1.compare_trigger")},{default:e.withCtx(()=>[e.createElementVNode("div",sM,[e.createElementVNode("table",lM,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[he[15]||(he[15]=e.createElementVNode("th",{scope:"col"},null,-1)),X("installed")?(e.openBlock(),e.createElementBlock("th",cM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.installed")),1)):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("th",uM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.streamed")),1)):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("th",dM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.cloned")),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("tbody",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",fM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",pM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.installed")),1)):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",mM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.streamed")),1)):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",hM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",gM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",yM,[e.createElementVNode("ul",_M,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.schema")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.additional")),1)])])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",bM,[e.createElementVNode("ul",wM,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.schema")),1)])])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",kM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",CM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",EM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.installed")),1)):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",NM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.streamed")),1)):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",SM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",xM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",AM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",vM,[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step1.compare_table.rows.sandboxing.streamed"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(Ha).customPluginSandboxing},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.streamed_link")),1)]),_:1},8,["href"])]),_:1})])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",IM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",BM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.data_plane_reload.header")),1),X("installed")?(e.openBlock(),e.createElementBlock("td",TM,[e.createVNode(e.unref(Re.CheckCircleIcon),{color:`var(--kui-color-text-success, ${e.unref(Rh)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),X("streamed")?(e.openBlock(),e.createElementBlock("td",OM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),X("cloned")?(e.openBlock(),e.createElementBlock("td",PM,[e.createVNode(e.unref(Re.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)])])])])]),_:1},8,["modelValue","trigger-label"])]),_:1},8,["title"])):e.createCommentVNode("",!0),$.fields.pluginType==="installed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:1,class:"custom-plugin-form-steps",step:F(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(Ye,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:j.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!j.value,onFileAdded:he[4]||(he[4]=ie=>H("schema",ie)),onFileRemoved:he[5]||(he[5]=ie=>oe("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createElementVNode("div",VM,[e.createVNode(et,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step2_files.plugin_modules.label")),1)]),_:1}),e.createVNode(Ve,{appearance:"warning",message:e.unref(s)("custom_plugin_form.step2_files.plugin_modules.alert")},null,8,["message"])])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:2,class:"custom-plugin-form-steps",step:F(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(Ye,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:j.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!j.value,onFileAdded:he[6]||(he[6]=ie=>H("schema",ie)),onFileRemoved:he[7]||(he[7]=ie=>oe("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createVNode(Ye,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.handler_file.button_text"),"data-testid":"custom-plugin-handler-upload",help:e.unref(s)("custom_plugin_form.step2_files.handler_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.handler_file.label"),placeholder:j.value&&$.fields.handlerContent?e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder"),required:!j.value,onFileAdded:he[8]||(he[8]=ie=>H("handler",ie)),onFileRemoved:he[9]||(he[9]=ie=>oe("handler"))},null,8,["button-text","help","label","placeholder","required"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:3,class:"custom-plugin-form-steps",step:F(2),title:e.unref(s)("custom_plugin_form.step2_clone.title")},{default:e.withCtx(()=>[e.createVNode(ke,{modelValue:$.fields.sourcePlugin,"onUpdate:modelValue":he[10]||(he[10]=ie=>$.fields.sourcePlugin=ie),"data-testid":"custom-plugin-clone-select","enable-filtering":"",items:ae.value,label:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.label"),placeholder:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.placeholder"),required:""},{"item-template":e.withCtx(({item:ie})=>[e.createElementVNode("div",$M,[e.createVNode(e.unref(Er.PluginIcon),{name:String(ie.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(ie.label),1)])]),"selected-item-template":e.withCtx(({item:ie})=>[e.createElementVNode("div",RM,[e.createVNode(e.unref(Er.PluginIcon),{name:String(ie.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(ie.label),1)])]),_:1},8,["modelValue","items","label","placeholder"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:4,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:F(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(_e,{modelValue:$.fields.name,"onUpdate:modelValue":he[11]||(he[11]=ie=>$.fields.name=ie),modelModifiers:{trim:!0},"data-testid":"custom-plugin-name",help:e.unref(s)("custom_plugin_form.step3.name.help"),label:e.unref(s)("custom_plugin_form.step3.name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:5,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:F(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(_e,{modelValue:$.fields.aliasName,"onUpdate:modelValue":he[12]||(he[12]=ie=>$.fields.aliasName=ie),modelModifiers:{trim:!0},"data-testid":"custom-plugin-alias-name",help:e.unref(s)("custom_plugin_form.step3.alias_name.help"),label:e.unref(s)("custom_plugin_form.step3.alias_name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.alias_name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"]),e.createVNode(_e,{modelValue:$.fields.priority,"onUpdate:modelValue":he[13]||(he[13]=ie=>$.fields.priority=ie),modelModifiers:{trim:!0},"data-testid":"custom-plugin-priority",label:e.unref(s)("custom_plugin_form.step3.priority.label"),"label-attributes":{info:e.unref(s)("custom_plugin_form.step3.priority.tooltip")},readonly:$.readonly,type:"number"},{help:e.withCtx(()=>[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step3.priority.help.text"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(Ha).pluginPriority},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step3.priority.help.link")),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["modelValue","label","label-attributes","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0)],64))]),_:1},8,["can-submit","config","entity-type","error-message","form-fields","is-readonly","slideout-deck-entity-type","slideout-fetch-url","slideout-request-method"])])}}}),[["__scopeId","data-v-0c1e017a"]]),jM=(n,t)=>({type:"array",valueType:"string",valueArrayType:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",validator:"array",styleClasses:"kong-form-field-wrapper",newElementButtonLabel:"+ Add",newElementButtonLabelClasses:"kong-form-new-element-button-label",items:{type:"select",values:n,selectOptions:{hideNoneSelectedText:!0},...(t==null?void 0:t[0])!=null?{default:t[0]}:{}}}),FM={class:"referable-field-item"},UM=24,Nw=Me(e.defineComponent({__name:"ReferableFieldItem",props:{field:{},isLast:{type:Boolean}},setup(n){const t=n,{formatPluginFieldLabel:r}=st.usePluginHelpers(),o=e.computed(()=>t.field.replace(/\./g,"-")),i=e.computed(()=>t.field.replace(/^[cC]onfig\./,"").split(".").map(s=>r(s)).join(".")),a=()=>{if(!o.value)return;const s=`label[for="${o.value}"]`,c=document.querySelector(s)||document.getElementById(o.value);if(!c)return;const l=Math.max(0,c.getBoundingClientRect().top+window.scrollY-UM),u=()=>{var p;(p=c.click)==null||p.call(c)};window.addEventListener("scrollend",u,{once:!0}),window.scrollTo({top:l,behavior:"smooth"})};return(s,c)=>(e.openBlock(),e.createElementBlock("span",FM,[e.createElementVNode("span",{class:"referable-field-link",role:"button",tabindex:"0",onClick:a},e.toDisplayString(i.value),1),n.isLast?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(", ")],64))]))}}),[["__scopeId","data-v-949a9ea1"]]),KM={key:0},qM=Me(e.defineComponent({__name:"PluginFieldRuleAlerts",props:{rules:{}},setup(n){const t=n,{i18n:{t:r},i18nT:o}=st.useI18n(),i=e.computed(()=>{const a=[];if(t.rules.atLeastOneOf)for(const s of t.rules.atLeastOneOf)a.push({key:"plugins.form.field_rules.at_least_one_of",fields:s});if(t.rules.onlyOneOf)for(const s of t.rules.onlyOneOf)a.push({key:"plugins.form.field_rules.only_one_of",fields:s});if(t.rules.mutuallyRequired)for(const s of t.rules.mutuallyRequired)a.push({key:"plugins.form.field_rules.mutually_required",fields:s});return a});return(a,s)=>{const c=e.resolveComponent("KAlert");return e.openBlock(),e.createBlock(c,{class:"plugin-field-rule-alerts"},{default:e.withCtx(()=>[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,({key:l,fields:u},p)=>(e.openBlock(),e.createElementBlock("li",{key:`simple-alert-${p}`},[e.createVNode(e.unref(o),{keypath:l},{parameters:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u,(d,f)=>(e.openBlock(),e.createBlock(Nw,{key:`alert-field-${d}`,field:d,"is-last":f===u.length-1},null,8,["field","is-last"]))),128))]),_:2},1032,["keypath"])]))),128)),t.rules.onlyOneOfMutuallyRequired&&t.rules.onlyOneOfMutuallyRequired.length>0?(e.openBlock(),e.createElementBlock("li",KM,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rules.onlyOneOfMutuallyRequired,(l,u)=>(e.openBlock(),e.createElementBlock("div",{key:`only-one-mutually-alert-${u}`},[e.createElementVNode("div",null,e.toDisplayString(e.unref(r)("plugins.form.field_rules.only_one_of_mutually_required")),1),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,(p,d)=>(e.openBlock(),e.createElementBlock("li",{key:`only-one-mutually-alert-${u}-combination-${d}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,(f,m)=>(e.openBlock(),e.createBlock(Nw,{key:`only-one-mutually-field-${f}`,field:f,"is-last":m===p.length-1},null,8,["field","is-last"]))),128))]))),128))])]))),128))])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-5f9ff453"]]);function GM(n){if(n.length===0)return"";if(n.length===1){const i=mn(n[0]);return gt(...i.slice(0,-1))}const t=n.map(i=>mn(i)),r=Math.min(...t.map(i=>i.length)),o=[];for(let i=0;i<r-1;i++){const a=t[0][i];if(t.every(s=>s[i]===a))o.push(a);else break}return gt(...o)}function op(n){return"at_least_one_of"in n?n.at_least_one_of:"mutually_required"in n?n.mutually_required:"mutually_exclusive"in n?n.mutually_exclusive:null}function HM(n,t){if(!t)return n;const r=t+Pa;return n.map(o=>o.startsWith(r)?o.slice(r.length):o)}function zM(n,t){const r=op(n),o=HM(r,t);return"at_least_one_of"in n?{at_least_one_of:o}:"mutually_required"in n?{mutually_required:o}:{mutually_exclusive:o}}function WM(n){const t=[],r=new Map;for(const o of n){const i=op(o);if(!i){t.push(o);continue}const a=GM(i);if(!a){t.push(o);continue}const s=zM(o,a);r.has(a)||r.set(a,[]),r.get(a).push(s)}return{keep:t,move:r}}function YM(n,t,r){const o=mn(t);let i=n;for(const a of o){const s=i.fields.find(l=>Object.keys(l)[0]===a);if(!s)return;const c=s[a];if(c.type!=="record")return;i=c}i.entity_checks=[...i.entity_checks||[],...r]}function Sw(n){var t;if((t=n.entity_checks)!=null&&t.length){const{keep:r,move:o}=WM(n.entity_checks);n.entity_checks=r.length?r:void 0;for(const[i,a]of o)YM(n,i,a)}for(const r of n.fields){const o=Object.values(r)[0];o.type==="record"&&Sw(o)}}function JM(n){const t=JSON.parse(JSON.stringify(n)),r={fields:t.fields};return Sw(r),t.fields=r.fields,t}function XM(n,t){const r=$n[n];if(!r||!r.fieldRules)return t;const o=ZM(r.fieldRules),i={...t};return i.fields=i.fields.map(a=>{if(Object.keys(a)[0]==="config"){const c=a.config.entity_checks||[],l=d=>{const m=[...op(d)??[]].slice().sort();return`${Object.keys(d)[0]}:${m.join(",")}`},u=new Set(c.map(l)),p=o.filter(d=>{const f=l(d);return u.has(f)?!1:(u.add(f),!0)});return{config:{...a.config,entity_checks:[...c,...p]}}}return a}),i}function ZM(n){const t=[],r=o=>o.startsWith("config.")?o.substring(7):o;return n.atLeastOneOf&&n.atLeastOneOf.forEach(o=>{t.push({at_least_one_of:o.map(r)})}),n.onlyOneOf&&n.onlyOneOf.forEach(o=>{t.push({mutually_exclusive:o.map(r)})}),n.mutuallyRequired&&n.mutuallyRequired.forEach(o=>{t.push({mutually_required:o.map(r)})}),n.onlyOneOfMutuallyRequired&&n.onlyOneOfMutuallyRequired.forEach(o=>{if(o.forEach(i=>{t.push({mutually_required:i.map(r)})}),o.length>1)for(let i=0;i<o.length;i++)for(let a=i+1;a<o.length;a++){const s=o[i].map(r),c=o[a].map(r);s.forEach(l=>{c.forEach(u=>{t.push({mutually_exclusive:[l,u]})})})}}),t}const QM={class:"kong-ui-entities-plugin-form"},ej={key:1,class:"entity-form"},tj={class:"plugin-config-empty-state"},nj=Me(e.defineComponent({__name:"PluginEntityForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},entityMap:{type:Object,default:()=>({})},record:{type:Object,default:()=>({})},schema:{type:Object,default:()=>({})},rawSchema:{type:Object,default:()=>({})},editing:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},enableRedisPartial:{type:Boolean,default:!1},engine:{type:String,required:!1,default:void 0},developer:{type:Boolean,default:!1}},emits:["loading","model-updated","showNewPartialModal","globalAction","click:learn-more","click:create-entity","validity-change"],setup(n,{emit:t}){var et,Ve;const r=t,o=n,i=e.computed(()=>{if(o.config.app!=="konnect")return!1;const ke=o.config;return!!ke.isKonnectManagedRedisEnabled&&ke.isCloudGateway===!0}),a=e.inject(ur.KM_2306_CONDITION_FIELD_314,!1),s=e.inject(ur.KHCP_20393_IDENTITY_PRINCIPALS_UI,!1),{axiosInstance:c}=Ie.useAxios((et=o.config)==null?void 0:et.axiosRequestConfig),{parseSchema:l}=st.useSchemas({entityId:((Ve=o.entityMap.focusedEntity)==null?void 0:Ve.id)||void 0,credential:o.credential,enableRedisPartial:o.enableRedisPartial,experimentalRenders:o.config.app==="konnect"?o.config.experimentalRenders:void 0}),{convertToDotNotation:u,unFlattenObject:p,dismissField:d,isObjectEmpty:f,unsetNullForeignKey:m}=st.usePluginHelpers(),{shouldUseFreeForm:g,getFreeFormComponent:y}=st.useFreeFormResolver(),b=e.inject(Ie.PLUGIN_FORM_LAYOUT_STATE),_=ke=>{b&&(b.value=ke)},{objectsAreEqual:k}=Ie.useHelpers(),{i18n:{t:C}}=Je(),N=ke=>{let _e=ke;return o.config.app==="konnect"&&(_e=_e.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||"")),_e.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")},E=(ke,_e)=>{let ye=`${o.config.apiBaseUrl}${Qe.form[o.config.app].entityGetOne}`;return ye=N(ye),ye=ye.replace(/{entity}/gi,ke),ye=ye.replace(/{id}/gi,_e),ye},w=ke=>{let _e=`${o.config.apiBaseUrl}${Qe.form[o.config.app].entityGetAll}`;return _e=N(_e),_e=_e.replace(/{entity}/gi,ke),_e},S=(ke,_e,ye)=>{const ie=E(ke,_e);return c.get(ie,ye)},I=(ke,_e)=>{const ye=w(ke);return o.config.app==="konnect"?c.get(ye).then(ie=>{const{data:{data:ee}}=ie;if(delete _e.size,delete _e.offset,ee.length&&Object.keys(_e).length===1){const se=Object.keys(_e)[0],ue=ee.filter(Ee=>Ee[se]?!!Ee[se].toLowerCase().includes(_e[se].toLowerCase()):!1);ie.data.data=ue}return ie}):c.get(ye,{params:_e})},j=(ke,_e,ye)=>{const ie=w(ke);if(o.config.app==="konnect"){const{size:ee,offset:se,...ue}=_e;if(ke==="consumer_groups")return c.get(ie,{params:{size:1e3},signal:ye}).then(be=>{const{data:{data:xe}}=be;if(xe.length&&Object.keys(ue).length===1){const h=Object.keys(ue)[0],T=xe.filter(G=>G[h]?!!G[h].toLowerCase().includes(ue[h].toLowerCase()):!1);be.data.data=T}return be});const Ee={size:ee,offset:se};for(const be of Object.keys(ue))Ee.filter={[be]:{contains:ue[be]}};return c.get(ie,{params:Ee,signal:ye})}return c.get(ie,{params:_e,signal:ye})},A=(ke,_e=50)=>{const ye=w(ke);return c.get(ye,{params:{size:_e}})};e.provide(Ze.FORMS_API_KEY,{getOne:S,getAll:I,getAllV2:j,peek:A}),e.provide(Ze.FORMS_CONFIG,o.config);const x=e.ref(""),O=e.ref(),P=e.shallowRef(),R=e.ref(null),W=e.ref({}),Z=e.reactive({}),X=e.reactive({}),F=e.computed(()=>{var ke;return(ke=R.value)==null?void 0:ke.options}),J=e.computed(()=>{const ke=XM(X.name,o.rawSchema);return JM(ke)}),$=e.ref(!1),q=e.ref(),K=(ke,_e)=>{$.value=ke??"",q.value=_e},ae=ke=>{var _e;(_e=q.value)==null||_e.call(q,ke),$.value=!1},M=ke=>{var ye;if(!ke){O.value=void 0,P.value=void 0,x.value="",_(!1);return}const _e=((ye=o.schema)==null?void 0:ye._sourcePlugin)||ke;O.value=mw(_e),P.value=g(_e,o.engine)?y(_e)??Hf:void 0,x.value=Ze.getSharedFormName(_e),_(!!P.value)},v=ke=>{var Ee,be;const _e={...o.schema},ye=X,ie=Z,ee=Object.keys(ye),se={};if(!f(W.value))for(let xe=0;xe<((be=(Ee=W.value)==null?void 0:Ee.fields)==null?void 0:be.length);xe++)_e[W.value.fields[xe].model]=W.value.fields[xe];Ze.customFields.forEach(xe=>{_e[xe]&&(_e[xe].fields.forEach(h=>{h.fields&&h.fields.forEach(T=>{_e[T.model]=T}),h.model&&(_e[h.model]=h)}),delete _e[xe])}),ee.forEach(xe=>{var Ne;if(!_e[xe]){xe==="partials"&&(se[xe]=ye[xe]);return}const h=_e[xe];let T=ye[xe];const G=ie[xe],Y=Array.isArray(T)?"array":typeof T,re=h?h.valueType:null,we=h?h.valueArrayType:null,L=h?h.transform:null;if(T==null&&G==null&&!h.submitWhenNull)return;if(h){if(re&&Y!==re)switch(re){case"array":Y==="string"&&T.length&&(T=T.split(",").map(z=>{if(z=z.trim(),we==="string")return String(z);if(we==="number")return Number(z);if(we==="boolean"){if(typeof z=="string")return z.toLowerCase()==="true"||z==="1";if(typeof z=="number")return z===1}return z})),(!T||!T.length)&&(T=h.submitWhenNull?null:[]);break;case"number":h.referenceable!==!0&&(T=Number(T));break;case"boolean":Y==="string"&&(T=T.toLowerCase()==="true"||T==="1"),Y==="number"&&(T=T===1);break;case"string":T=T==null?"":String(T);break}else re==="array"&&(!T||!T.length?T=h.submitWhenNull?null:[]:((Ne=h.inputAttributes)==null?void 0:Ne.type)==="number"&&(T=T.map(z=>Number(z))));if(h.type==="array"&&h.nestedFields){const z=V=>{Object.keys(V).forEach(D=>{V[D]&&typeof V[D]=="object"&&!Array.isArray(V[D])&&V[D]!==null?z(V[D]):(V[D]===void 0||V[D]===null||typeof V[D]=="number"&&isNaN(V[D])||typeof V[D]=="string"&&V[D].trim().length===0)&&delete V[D]})};T&&typeof T=="object"&&z(T)}h.type==="object-advanced"&&h.fields&&T!==null&&(Object.entries(T).length===0?T=null:Object.keys(T).forEach(z=>{Array.isArray(T[z])||(T[z]=T[z].split(","))}))}let de=u(xe);if(h.fieldNameHasDashes){const[z,...V]=de.split(".").reverse();de=[z.replace(/_/g,"-"),...V].reverse().join(".")}if(re==="object-expand"){let z;[de,z]=de.split(".");let V={};se[de]&&(V=se[de]),V[z]=T,T=V}G!==void 0&&T===""&&T!==G?se[de]=re==="object"?{}:null:h.type==="checklist"&&T===""?se[de]=[]:T!==""&&(se[de]=T),se[de]=L?L(T):se[de],m(de,se)});const ue=p(se);if(P.value){if(ke&&ke.length)for(const xe of ke)delete ue[xe];Object.assign(ue,$e.value)}return ue},H=(ke,_e={})=>{d(X,_e,ke,o.editing),r("model-updated",{model:X,originalModel:Z,data:v()})},oe=(ke,_e)=>{var ee;const ye={[_e]:ke};typeof((ee=o.schema[_e])==null?void 0:ee.modelTransformer)=="function"&&(ye[_e]=o.schema[_e].modelTransformer(ke));const ie=Object.assign({},X,ye);Object.assign(X,ie),r("model-updated",{model:X,originalModel:Z,data:v()})},te=ke=>{r("validity-change",ke)},ge=(ke,_e)=>{Object.keys(ke).forEach(ye=>{var Ee,be;let ie=_e?`${_e}-${ye}`:ye,ee=o.schema[ie];if(!ee){const xe=_e?`${_e}-${ye.replace(/-/g,"_")}`:ye.replace(/-/g,"_");(Ee=o.schema[xe])!=null&&Ee.fieldNameHasDashes&&(ie=xe,ee=o.schema[ie]),_e&&((be=o.schema[_e])==null?void 0:be.keyFromObject)===ye&&(ie=_e,ee=o.schema[ie])}const se=ke[ye],ue=typeof se;if(ee&&ee.type==="object-advanced"&&!se){X[ie]={},Z[ie]={};return}if(Array.isArray(se)){X[ie]=JSON.parse(JSON.stringify(se)),Z[ie]=JSON.parse(JSON.stringify(se));return}if(ue==="object"&&se&&!se.length)return ge(se,ie);if(ue==="object"&&se&&se.length&&ee.type==="input"){X[ie]=se.join(", "),Z[ie]=se.join(", ");return}X[ie]=se,Z[ie]=se}),r("model-updated",{model:X,originalModel:Z,data:v()})},me=(ke,_e)=>{if(!_e)return ke;if(Array.isArray(ke)){const ee=_e.elements;return ee?ke.map(se=>me(se,ee)):ke}if(!ke||typeof ke!="object")return ke;if(_e.type==="map"&&_e.values){const ee=_e.values,se={};for(const ue of Object.keys(ke))se[ue]=me(ke[ue],ee);return se}if(!Array.isArray(_e.fields))return ke;const ye=new Map;for(const ee of _e.fields){const se=ee&&Object.keys(ee)[0];se&&ye.set(se,ee[se])}const ie={};for(const ee of Object.keys(ke)){const se=ye.get(ee);se&&(ie[ee]=me(ke[ee],se))}return ie},le=()=>{var ye;const ke=(ye=o.rawSchema)==null?void 0:ye.fields;if(!Array.isArray(ke))return;const _e=ke.find(ie=>ie==null?void 0:ie.config);return _e==null?void 0:_e.config},he=new Set(["datakit"]),Oe=e.computed(()=>{var ke;return((ke=o.schema)==null?void 0:ke._sourcePlugin)||X.name}),$e=e.shallowRef(o.record),Pe=(ke,_e)=>{const ye=he.has(Oe.value)?ke:{...ke,config:me(ke.config,le())};$e.value=ye;const ie={...X};for(const ee of _e||[])delete ie[ee];r("model-updated",{model:{...ie,...ye},originalModel:Z,data:v(_e)})},qe=e.ref(!0),Ye=()=>{var ke;if(o.record&&o.schema&&(ge({enabled:o.record.enabled??!0,...o.record.instance_name&&{instance_name:o.record.instance_name||""},...a&&o.record.condition!=null&&{condition:o.record.condition},...o.record.protocols&&{protocols:o.record.protocols},...o.record.tags&&{tags:o.record.tags}}),o.credential?((o.record.consumer_id||o.record.consumer)&&ge({consumer_id:o.record.consumer_id||o.record.consumer}),ge(o.record)):o.record.config&&((o.record.consumer_id||o.record.consumer||o.record.service_id||o.record.service||o.record.route_id||o.record.route||o.record.consumer_group_id||o.record.consumer_group)&&ge({service_id:o.record.service_id||o.record.service,route_id:o.record.route_id||o.record.route,consumer_id:o.record.consumer_id||o.record.consumer,consumer_group_id:o.record.consumer_group_id||o.record.consumer_group}),o.record.partials&&H("redis",{partials:o.record.partials}),P.value?Pe(o.record):ge(o.record.config,"config"))),Object.keys(o.entityMap).length&&!o.entityMap.global&&o.schema){const _e={};for(const ye in o.entityMap){const ie=o.entityMap[ye].id,ee=o.entityMap[ye].idField,se=ee==="consumer_group_id"?"consumer_group-id":JSON.parse(JSON.stringify(ee).replace("_","-"));Object.prototype.hasOwnProperty.call(X,se)&&(_e[se]=ie)}ge(_e)}if((ke=o.entityMap.consumer)!=null&&ke.id&&o.schema&&o.credential){const _e={};Object.prototype.hasOwnProperty.call(X,"consumer")&&(_e.consumer=o.entityMap.consumer.id),ge(_e)}qe.value=!1};return e.watch(qe,ke=>{r("loading",ke)}),e.watch(()=>o.schema,(ke,_e)=>{var ie,ee;if(k(ke||{},_e||{}))return;const ye=l(ke,void 0,void 0,o.engine);Object.assign(X,ye.model),W.value={fields:(ee=(ie=W.value)==null?void 0:ie.fields)==null?void 0:ee.map(se=>({...se,disabled:se.disabled||!1}))},Object.assign(Z,JSON.parse(JSON.stringify(ye.model))),M(ye.model.name),Ye()},{immediate:!0,deep:!0}),e.onBeforeMount(()=>{var ke,_e,ye,ie;R.value=l(o.schema,void 0,void 0,o.engine),Object.assign(X,((ke=R.value)==null?void 0:ke.model)||{}),W.value=((_e=R.value)==null?void 0:_e.schema)||{},M((ie=(ye=R.value)==null?void 0:ye.model)==null?void 0:ie.name),Ye()}),e.onBeforeUnmount(()=>{_(!1)}),(ke,_e)=>{var ie,ee,se;const ye=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",QM,[qe.value?(e.openBlock(),e.createBlock(ye,{key:0,type:"form"})):X.id&&n.editing||!n.editing?(e.openBlock(),e.createElementBlock("div",ej,[P.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P.value),{key:0,developer:n.developer,"field-renderers":(ie=O.value)==null?void 0:ie.fieldRenderers,"form-model":X,"form-schema":W.value,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:n.record,"on-form-change":Pe,"on-validity-change":te,"plugin-name":X.name,"render-rules":(ee=O.value)==null?void 0:ee.renderRules,schema:J.value,"onClick:createEntity":_e[0]||(_e[0]=ue=>ke.$emit("click:create-entity",ue)),"onClick:learnMore":_e[1]||(_e[1]=ue=>ke.$emit("click:learn-more",ue)),onGlobalAction:_e[2]||(_e[2]=(ue,Ee)=>ke.$emit("globalAction",ue,Ee))},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(Ze.AUTOFILL_SLOT_NAME),fn:e.withCtx(ue=>[ue.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPickerProvider),e.mergeProps({key:0},ue,{onOpen:K}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["developer","field-renderers","form-model","form-schema","is-editing","is-konnect-managed-redis-enabled","model","plugin-name","render-rules","schema"])):x.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Ze.sharedForms)[x.value]),{key:1,"enable-redis-partial":n.enableRedisPartial,"form-model":X,"form-options":F.value,"form-schema":W.value,"identity-principals-ui-enabled":e.unref(s),"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,"on-model-updated":oe,"on-partial-toggled":H,"show-new-partial-modal":ue=>ke.$emit("showNewPartialModal",ue),"onClick:createEntity":_e[3]||(_e[3]=ue=>ke.$emit("click:create-entity",ue)),"onClick:learnMore":_e[4]||(_e[4]=ue=>ke.$emit("click:learn-more",ue))},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(Ze.AUTOFILL_SLOT_NAME),fn:e.withCtx(ue=>[ue.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPickerProvider),e.mergeProps({key:0},ue,{onOpen:K}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["enable-redis-partial","form-model","form-options","form-schema","identity-principals-ui-enabled","is-editing","is-konnect-managed-redis-enabled","show-new-partial-modal"])):(e.openBlock(),e.createBlock(e.unref(Ze.VueFormGenerator),{key:2,"enable-redis-partial":n.enableRedisPartial,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:X,options:F.value,schema:W.value,onModelUpdated:oe,onPartialToggled:H,onRefreshModel:v,onShowNewPartialModal:_e[5]||(_e[5]=ue=>ke.$emit("showNewPartialModal",ue))},e.createSlots({"plugin-config-empty-state":e.withCtx(()=>[e.createElementVNode("div",tj,e.toDisplayString(e.unref(C)("plugins.form.grouping.plugin_configuration.empty")),1)]),_:2},[(se=e.unref($n)[X.name])!=null&&se.fieldRules&&(o.config.isNewOtelSchema||X.name!=="opentelemetry")?{name:"plugin-config-before-content",fn:e.withCtx(()=>[e.createVNode(qM,{rules:e.unref($n)[X.name].fieldRules},null,8,["rules"])]),key:"0"}:void 0,n.enableVaultSecretPicker?{name:e.unref(Ze.AUTOFILL_SLOT_NAME),fn:e.withCtx(ue=>[ue.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(da.VaultSecretPickerProvider),e.mergeProps({key:0},ue,{onOpen:K}),null,16)):e.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["enable-redis-partial","is-editing","is-konnect-managed-redis-enabled","model","options","schema"]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(da.VaultSecretPicker),{config:o.config,setup:$.value,onCancel:_e[6]||(_e[6]=()=>$.value=!1),onProceed:ae},null,8,["config","setup"])],64)}}}),[["__scopeId","data-v-b10596ae"]]),rj={key:1},oj=e.defineComponent({__name:"PluginFormActionsWrapper",props:{teleportTarget:{type:String,default:""}},setup(n){return(t,r)=>n.teleportTarget?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:n.teleportTarget},[e.renderSlot(t.$slots,"default")],8,["to"])):(e.openBlock(),e.createElementBlock("div",rj,[e.renderSlot(t.$slots,"default")]))}}),ij={key:0},aj={class:"plugin-form-actions"},sj={key:0,class:"button-customize-deck-wrapper"},lj=Me(e.defineComponent({__name:"PluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},pluginType:{type:String,required:!0},pluginId:{type:String,default:null},hideScopeSelection:{type:Boolean,default:!1},disableScopeSelection:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},developer:{type:Boolean,default:!1},isWizardStep:{type:Boolean,default:!1},actionsTeleportTarget:{type:String,default:""},noCardWrapper:{type:Boolean,default:!1},hideViewConfigAction:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},schema:{type:Object,default:null},enableRedisPartial:{type:Boolean,default:!1},scopedEntitiesPermissions:{type:Object,default:null},engine:{type:String,required:!1,default:void 0}},emits:["cancel","error:fetch-schema","error","loading","update","model-updated","showNewPartialModal","globalAction","click:create-entity","click:learn-more"],setup(n,{emit:t}){var de,Ne;const r=e.inject(ur.KM_2306_CONDITION_FIELD_314,!1),o=e.inject(ur.KM_2485_CLONED_PLUGINS,!1),i=e.ref(!1);e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,i);const a=t,s=n,c=Nr.useRouter(),{i18n:{t:l}}=st.useI18n(),{customSchemas:u,typedefs:p}=st.useSchemas({app:s.config.app,credential:s.credential,experimentalRenders:s.config.app==="konnect"?s.config.experimentalRenders:void 0}),{formatPluginFieldLabel:d}=st.usePluginHelpers(),{shouldUseFreeForm:f}=st.useFreeFormResolver(),{getMessageFromError:m}=Ie.useErrors(),{capitalize:g}=Ie.useStringHelpers(),{objectsAreEqual:y}=Ie.useHelpers(),{axiosInstance:b}=Ie.useAxios((de=s.config)==null?void 0:de.axiosRequestConfig),{getClonedPlugin:_}=st.useCustomPluginApi({axiosInstance:Ie.useAxios({...((Ne=s.config)==null?void 0:Ne.axiosRequestConfig)??{},konnect:{bypassGlobal404Handler:!0}}).axiosInstance,apiBaseUrl:s.config.apiBaseUrl,app:s.config.app,workspace:s.config.workspace,controlPlaneId:s.config.controlPlaneId}),k=e.ref(!1),C=e.computed(()=>!!s.pluginId),N=e.computed(()=>s.pluginId?Ie.EntityBaseFormType.Edit:Ie.EntityBaseFormType.Create),E=e.ref(void 0),w=e.ref(void 0),S=e.computed(()=>!!(s.credential&&s.config.entityId)),I=e.ref(void 0),j=e.ref({}),A=e.ref(),x=e.ref(),O=e.inject(ur.KM_2503_CUSTOM_PLUGIN_FREEFORM,!1),P=e.ref(null),R=e.computed(()=>P.value!==null),W=e.computed(()=>R.value&&P.value?P.value:s.pluginType),Z=e.computed(()=>{if(s.engine)return s.engine;if(!(!O||!be.value))return R.value&&P.value?f(P.value)?"freeform":"vfg":"freeform"});e.provide(Ai,{redisType:A,redisPath:x,isEditing:C.value});const X=[];e.provide(Kb,z=>(X.push(z),()=>{const V=X.indexOf(z);V!==-1&&X.splice(V,1)}));const F=e.ref(!1),{isDeckEnabled:J,deckCustomizationOptions:$,deckCalloutPreferenceKey:q}=Ie.useBaseFormDeckOptions(()=>s.config,Ie.SupportedEntityType.Plugin),K=e.ref(!1),ae=e.reactive({enabled:!0,protocols:[],tags:[]}),M=e.reactive({fields:{enabled:!0,protocols:[],tags:[]},isReadonly:!1,clientErrorMessage:"",serverErrorMessage:""}),v=e.ref([{title:l("view_configuration.json"),hash:"#json"},{title:l("view_configuration.yaml"),hash:"#yaml"}]);s.config.app==="konnect"&&v.value.splice(1,0,{title:l("view_configuration.terraform"),hash:"#terraform"}),J.value&&v.value.push({title:l("view_configuration.deck"),hash:"#deck"});const H=e.ref(v.value[0].hash),oe=e.ref(""),te=e.computed(()=>{var V;if(S.value){let D=Qe.form[s.config.app].credential[N.value];return D=D.replace(/{resourceEndpoint}/gi,he.value),D}let z;return s.config.entityType&&s.config.entityId?z=Qe.form[s.config.app].edit.forEntity.replace(/{entityType}/gi,s.config.entityType).replace(/{entityId}/gi,s.config.entityId):z=Qe.form[s.config.app].edit.all,s.config.app==="konnect"&&((V=$n[s.pluginType])!=null&&V.useUIData)?`${z}?__ui_data=true`:z}),ge=()=>{k.value=!k.value},me=e.computed(()=>{var Ce,Se,ve,ze,Ke,Be,Ae,Xe;const z=s.config.entityType==="consumers"&&s.config.entityId||((Se=(Ce=I.value)==null?void 0:Ce.consumer)==null?void 0:Se.id),V=s.config.entityType==="consumer_groups"&&s.config.entityId||((ze=(ve=I.value)==null?void 0:ve.consumer_group)==null?void 0:ze.id),D=s.config.entityType==="services"&&s.config.entityId||((Be=(Ke=I.value)==null?void 0:Ke.service)==null?void 0:Be.id),ne=s.config.entityType==="routes"&&s.config.entityId||((Xe=(Ae=I.value)==null?void 0:Ae.route)==null?void 0:Xe.id);if(!(z||V||D||ne))return{global:{entity:fe.PluginScope.GLOBAL,entityEndpoint:"plugins"}};const ce={};return D&&(ce.service={entity:fe.PluginScope.SERVICE,entityEndpoint:"services",id:D,idField:yo.SERVICE}),ne&&(ce.route={entity:fe.PluginScope.ROUTE,entityEndpoint:"routes",id:ne,idField:yo.ROUTE}),z&&(ce.consumer={entity:fe.PluginScope.CONSUMER,entityEndpoint:"consumers",id:z,idField:yo.CONSUMER}),V&&(ce.consumer_group={entity:fe.PluginScope.CONSUMER_GROUP,entityEndpoint:"consumer_groups",id:V,idField:yo.CONSUMER_GROUP}),s.config.entityType&&(ce.focusedEntity={entity:fe.PluginScope[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()],entityEndpoint:s.config.entityType,id:s.config.entityId,idField:yo[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()]}),ce}),le=e.reactive({name:{default:s.pluginType,type:"input",inputType:"hidden",styleClasses:"d-none hidden-field",pinned:!0},enabled:{type:"switch",model:"enabled",label:l("plugins.form.fields.enabled.label"),textOn:l("plugins.form.fields.enabled.on_text"),textOff:l("plugins.form.fields.enabled.off_text"),styleClasses:"field-switch hide-label",default:!0,pinned:!0},selectionGroup:{type:s.hideScopeSelection&&(s.hideScopeSelection||N.value===Ie.EntityBaseFormType.Create&&s.config.entityId)?"foreign":"selectionGroup",disabled:s.disableScopeSelection,inputType:"hidden",styleClasses:"hide-label",fields:[{label:l("plugins.form.scoping.global.label"),description:l("plugins.form.scoping.global.help")}],pinned:!0},protocols:{id:"protocols",default:[],help:l("plugins.form.fields.protocols.help"),label:l("plugins.form.fields.protocols.label"),required:!0,styleClasses:"plugin-protocols-select",type:"multiselect",values:[{label:"grpc",value:"grpc"},{label:"grpcs",value:"grpcs"},{label:"http",value:"http"},{label:"https",value:"https"},{label:"tcp",value:"tcp"},{label:"tls",value:"tls"},{label:"tls_passthrough",value:"tls_passthrough"},{label:"udp",value:"udp"},{label:"ws",value:"ws"},{label:"wss",value:"wss"}]},instance_name:{default:"",type:"input",label:l("plugins.form.fields.instance_name.label"),inputType:"text",help:l("plugins.form.fields.instance_name.help")},tags:p.tags,...r?{condition:{default:"",type:"input",label:l("plugins.form.fields.condition.label"),inputType:"text",help:l("plugins.form.fields.condition.tooltip"),placeholder:l("plugins.form.fields.condition.placeholder")}}:{}}),he=e.computed(()=>{var D;const z=s.developer?"developers":"consumers",V=((D=si[s.pluginType])==null?void 0:D.endpoint)||"/plugins";return`${z}/${s.config.entityId}${s.developer?"/credentials":""}${V}`}),Oe=z=>{const V=Array.from(new Set(z.map(D=>typeof D)));return V.length>1?"string":V[0]},$e=(z,V,D,ne)=>{var ve,ze;let ce=V&&V.fields||[];const Ce=u[W.value],Se=(ze=(ve=si[s.pluginType])==null?void 0:ve.schema)==null?void 0:ze.fields;return Array.isArray(ce)&&(ce=ce.reduce((Ke,Be)=>{const Ae=Object.keys(Be)[0];return Ae.match(/-/g)?Ke[Ae.replace(/-/g,"_")]={...Be[Ae],fieldNameHasDashes:!0}:Ke[Ae]=Be[Ae],Ke},{})),Object.keys(ce).sort().forEach(Ke=>{var Lt,ar,xt,Zt,Xs,Zs,Qs;const Be=ce[Ke];Be.type==="set"&&!(f(s.pluginType,Z.value)&&Be.elements.one_of)&&(Be.type="array");const Ae=z?`${z}-${Ke}`:`${Ke}`;if((Lt=Ce==null?void 0:Ce.fieldsToDelete)!=null&&Lt.includes(Ae)){by(D,Ae);return}if(Object.prototype.hasOwnProperty.call(Be,"overwrite")||Be.hidden)return;if(Be.type==="table")return $e(Ae,Be.schema,D);if(Be.fields)return ne&&Be.type==="record"?(D[Ae]={type:"object",model:Ke,schema:{fields:Object.values($e(Ae,Be,{},!0))}},D):$e(Ae,Be,D);if(D[Ae]={id:Ae,model:Ke},D[Ae].type=Be.type==="boolean"?"checkbox":"input",D[Ae].required=Be.required,D[Ae].referenceable=Be.referenceable,Ae.startsWith("config-"))if(!ne&&Be.type==="array"&&(oe.value=Ae),ne&&oe.value&&Ae.startsWith(oe.value)){const ut=Ae.slice(oe.value.length+1);D[Ae].label=ut.split("-").map(d).join(".")}else D[Ae].label=d(Ae);if((z==="config"||z.startsWith("config-"))&&(ar=ce[Ke])!=null&&ar.description&&(D[Ae].help=el.marked.parse(ce[Ke].description,{mangle:!1,headerIds:!1})),Be.type==="map"){if(D[Ae].type="object-advanced",D[Ae].values=Be.values,Be.values.type==="array"){const{type:ut}=Be.values.elements||{};D[Ae].schema={fields:[{schema:{fields:[{...dt,model:Ae,valueArrayType:ut==="integer"?"number":ut||"string",inputAttributes:{...dt.inputAttributes,type:ut==="integer"?"number":"text",inputMode:ut==="integer"?"numeric":"text"}}]}}]}}else Be.values.fields&&(D[Ae].schema={fields:[{type:"object",model:"object",schema:{fields:Be.values.fields.map(ut=>{const Qt=Object.keys(ut)[0];return{model:Qt,type:"input",label:g(Qt),placeholder:Qt,inputType:ut[Qt].type}})}}]});return D}if(Be.enum&&Be.type==="array"&&(D[Ae].type="checklist",D[Ae].values=Be.enum,D[Ae].multi=!0,D[Ae].multiSelect=!0),Be.one_of&&Be.type!=="array"&&(D[Ae].type="select",D[Ae].values=Be.one_of,D[Ae].selectOptions={noneSelectedText:l("plugins.form.no_selection")}),Be.elements&&Be.type==="array"){const ut=Be.elements;if(D[Ae].referenceable=ut.referenceable,D[Ae].elements=ut,["string","integer","number"].includes(ut.type)&&!ut.one_of){const{id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On}=D[Ae],{inputAttributes:Hn,...vh}=JSON.parse(JSON.stringify(dt));Hn.type=ut.type==="string"?"text":"number",D[Ae]={id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,inputAttributes:Hn,...vh}}else if(["string","integer","number"].includes(ut.type)&&ut.one_of){if(ne){const{id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On}=D[Ae];D[Ae]={id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,...jM(ut.one_of,Be.default)}}}else if(ut.type==="array"){const{id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,elements:Hn}=D[Ae],{inputAttributes:vh,...Z8}=JSON.parse(JSON.stringify(dt));D[Ae]={id:Qt,help:At,label:ht,hint:lt,values:Ct,referenceable:_t,model:On,elements:Hn,inputAttributes:vh,...Z8}}}if(Be.hint&&(D[Ae].hint=Be.hint),Ce&&!Ce.overwriteDefault&&Object.keys(Ce).forEach(ut=>{if(ut===Ae){const{help:Qt,label:At,hint:ht,values:lt,referenceable:Ct,elements:_t}=D[Ae],{help:On,...Hn}=Ce[ut];D[Ae]={help:Qt,label:At,hint:ht,values:lt,referenceable:Ct,elements:_t,...Hn},typeof On=="string"&&(D[Ae].help=el.marked.parse(On,{mangle:!1,headerIds:!1}))}}),Be.type==="array"&&((xt=Be.elements)==null?void 0:xt.type)==="record"&&Array.isArray(Be.elements.fields)){let ut={};for(const At of Be.elements.fields)ut={...ut,...At};const Qt=(Zs=(Xs=(Zt=D[Ae])==null?void 0:Zt.items)==null?void 0:Xs.schema)==null?void 0:Zs.fields;if(Array.isArray(Qt))for(const At of D[Ae].items.schema.fields){const ht=(Qs=ut[At.model])==null?void 0:Qs.description;At.help===void 0&&typeof ht=="string"&&(At.help=el.marked.parse(ht,{mangle:!1,headerIds:!1}))}if(Qt||(D[Ae].type="array",D[Ae].newElementButtonLabelClasses="kong-form-new-element-button-label",D[Ae].fieldClasses="array-card-container-wrapper",D[Ae].itemContainerComponent="FieldArrayCardContainer",D[Ae].items={type:"object",schema:{fields:Object.values($e(Ae,Be.elements,{},!0))}},D[Ae].items.schema.fields.forEach(At=>{var ht,lt;for(const Ct of Be.elements.fields){const _t=Object.keys(Ct)[0],On=((lt=(ht=At.id)==null?void 0:ht.split)==null?void 0:lt.call(ht,"-"))??[];if(On[On.length-1]===_t){At.model=_t,At.label=d(_t);break}}}),Be.elements.type==="record"&&(D[Ae].nestedFields=!0)),!D[Ae].nestedFields)D[Ae].items.default=()=>Be.elements.fields.reduce((At,ht)=>{const lt=Object.keys(ht)[0];return At[lt]=ht[lt].default,At},{});else{const At=(ht,lt)=>{if(ht.type==="object"){ht.model&&(lt[ht.model]={});for(const Ct of ht.schema.fields)At(Ct,ht.model?lt[ht.model]:lt)}else ht.model&&(lt[ht.model]=ht.default)};D[Ae].items.default=()=>{const ht={};return At(D[Ae].items,ht),ht}}}if(S.value&&Se){for(let ut=0;ut<Se.length;ut++)if(Se[ut][Ae]){D[Ae]={...D[Ae],...Se[ut][Ae]};break}}if(Be.required&&Be.type!=="boolean"&&(D[Ae].required=!0,D[Ae].selectOptions={hideNoneSelectedText:!0}),Be.required&&Be.type==="boolean"&&(D[Ae].default=Be.default??!1),Be.default!=null&&typeof Be.default!="object"&&Be.default!=="function"&&(D[Ae].default=Be.default),D[Ae].type==="input"){["string","number"].includes(typeof D[Ae].default)&&s.config.app==="konnect"&&(D[Ae].placeholder=`Default: ${D[Ae].default===""?"<empty string>":D[Ae].default}`);const{type:ut}=Be.elements||{};ut&&(D[Ae].valueArrayType=ut==="integer"?"number":ut),D[Ae].inputType=Be.type==="array"||Be.type==="string"?Be.encrypted?"password":"text":Be.type}let Xe="string";Be.enum?Xe=Oe(Be.enum):Be.type==="boolean"?Xe="boolean":Be.type==="number"||Be.type==="integer"?(Xe="number",D[Ae].inputType="number"):Be.type==="array"?(Xe="array",D[Ae].default=Be.default,Be.len_min>0&&(D[Ae].submitWhenNull=!0)):Be.type==="foreign"?Xe="object":Be.default&&Array.isArray(Be.default)?(Xe="array",D[Ae].valueArrayType=Oe(Be.default)):Be.default&&(Xe=typeof Be.default),D[Ae].valueType=Xe,Be.fieldNameHasDashes&&(D[Ae].fieldNameHasDashes=!0)}),D},Pe=()=>{var Xe,Lt,ar,xt,Zt,Xs,Zs,Qs,ut,Qt,At,ht;const z=R.value&&P.value?P.value:s.pluginType,V=((Xe=$n[z])==null?void 0:Xe.scope.includes(fe.PluginScope.SERVICE))??!0,D=((Lt=$n[z])==null?void 0:Lt.scope.includes(fe.PluginScope.ROUTE))??!0,ne=((ar=$n[z])==null?void 0:ar.scope.includes(fe.PluginScope.CONSUMER))??!0,ce=s.config.disableConsumerGroupScope?!1:((xt=$n[z])==null?void 0:xt.scope.includes(fe.PluginScope.CONSUMER_GROUP))??!0,Ce=s.config.entityType==="consumers"&&!!s.config.entityId||!!((Xs=(Zt=I.value)==null?void 0:Zt.consumer)!=null&&Xs.id),Se=s.config.entityType==="consumer_groups"&&!!s.config.entityId||!!((Qs=(Zs=I.value)==null?void 0:Zs.consumer_group)!=null&&Qs.id),ve=s.config.entityType==="services"&&!!s.config.entityId||!!((Qt=(ut=I.value)==null?void 0:ut.service)!=null&&Qt.id),ze=s.config.entityType==="routes"&&!!s.config.entityId||!!((ht=(At=I.value)==null?void 0:At.route)!=null&&ht.id),Ke=[],Be=(lt,Ct,_t)=>lt?l("plugins.form.disable_source_scope_change",{scope:_t}):Ct?l("plugins.form.disable_data_retrieving",{scope:_t}):"",Ae=lt=>{var Ct,_t;return((_t=(Ct=s.scopedEntitiesPermissions)==null?void 0:Ct[lt])==null?void 0:_t.canRetrieve)===!1};if(V){const lt=Ae("service"),Ct="services",_t=ve&&s.disableScopeSelection;Ke.push({id:"service-id",model:"service-id",label:l("plugins.form.scoping.gateway_service.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",labelField:"name",entity:Ct,inputValues:{fields:["name","id"]},help:l("plugins.form.scoping.gateway_service.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(D){const lt=Ae("route"),Ct="routes",_t=ze&&s.disableScopeSelection;Ke.push({id:"route-id",model:"route-id",label:l("plugins.form.scoping.route.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Ct,labelField:"name",inputValues:{fields:["name","id"],primaryField:"id"},help:l("plugins.form.scoping.route.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(ne){const lt=Ae("consumer"),Ct="consumers",_t=Ce&&s.disableScopeSelection;Ke.push({model:"consumer-id",label:l("plugins.form.scoping.consumer.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Ct,labelField:"username",inputValues:{fields:["username","custom_id","id"],primaryField:"username"},help:l("plugins.form.scoping.consumer.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(ce){const lt=Ae("consumer_group"),Ct="consumer_groups",_t=Se&&s.disableScopeSelection;Ke.push({model:"consumer_group-id",label:l("plugins.form.scoping.consumer_group.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Ct,entityDataKey:"consumer_group",labelField:"name",inputValues:{fields:["name","id"],primaryField:"name"},help:l("plugins.form.scoping.consumer_group.help"),disabled:_t||lt,disabledTooltip:Be(_t,lt,Ct)})}if(Ke.length){const lt=[...V?["service"]:[],...D?["route"]:[],...ne?["consumer"]:[],...ce?["consumer_group"]:[]],_t=lt.splice(lt.length-2,2).map(Hn=>l(Hn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Hn}.plural`)).join(`${lt.length>0?",":""} and/or `),On=["Specific",[...lt.length>0?[lt.map(Hn=>l(Hn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Hn}.plural`)).join(", ")]:[],_t].join(", ")].join(" ");le.selectionGroup.fields.push({label:l("plugins.form.scoping.label"),description:On,fields:[]}),le.selectionGroup.fields[1].fields=Ke}u[W.value]&&u[W.value].overwriteDefault&&Object.hasOwnProperty.call(u[W.value],"formSchema")&&Object.assign(le,u[W.value].formSchema)},qe=e.computed(()=>!y(M.fields,ae,!0)),Ye=e.computed(()=>!re.value&&!K.value&&(N.value===Ie.EntityBaseFormType.Create||qe.value)),et=e.ref(!1),Ve=e.ref(),ke=z=>{s.credential&&z.password&&(z.password=""),M.fields.id=(z==null?void 0:z.id)||void 0,Ve.value=z==null?void 0:z.ordering,Object.assign(ae,M.fields),I.value=z,et.value=!0},_e=e.ref({}),ye=z=>{var V;M.fields=z.model,M.fields.id=((V=I.value)==null?void 0:V.id)||void 0,Object.assign(ae,z.originalModel),_e.value=z.data,s.isWizardStep&&a("model-updated",{model:M.fields,data:z.data,resourceEndpoint:he.value})},ie=e.ref(new Map),ee=e.computed(()=>[M.clientErrorMessage,M.serverErrorMessage].filter(Boolean).join("; ")),se=z=>{z.valid?ie.value.delete(z.model):ie.value.set(z.model,z.error),M.clientErrorMessage=[...ie.value.entries()].map(([V,D])=>`${V}: ${typeof D=="string"?D:m(D)}`).join("; "),M.clientErrorMessage&&(M.serverErrorMessage="")};e.watch([me,et],(z,V)=>{const D=z[0]!==V[0],ne=z[1],ce=V[1];if(!S.value&&N.value===Ie.EntityBaseFormType.Edit&&(D||ne&&ne!==ce)){const Ce=$e("config",j.value,le);be.value&&(Ce._isCustomPlugin=!0),R.value&&P.value&&(Ce._sourcePlugin=P.value),A.value&&(Ce._supported_redis_partial_type=A.value),w.value=Ce}},{deep:!0});const ue=()=>{s.config.cancelRoute?c.push(s.config.cancelRoute):a("cancel")},Ee=e.computed(()=>{const z=s.config.entityType&&s.config.entityId&&!s.developer,V=S.value?Qe.form[s.config.app].credential[N.value]:Qe.form[s.config.app][N.value][z?"forEntity":"all"];let D=`${s.config.apiBaseUrl}${V}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D=D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:""),D=D.replace(/{resourceEndpoint}/gi,he.value),D=D.replace(/{id}/gi,s.pluginId??""),D=D.replace(/{entityType}/gi,s.config.entityType||""),D=D.replace(/{entityId}/gi,s.config.entityId||""),D}),be=e.computed(()=>!Object.keys($n).includes(s.pluginType)),xe=e.computed(()=>{const z=_e.value;if(S.value){for(const V in fe.PluginScope){const D=fe.PluginScope[V];z[D]&&!z[D].id&&(z[D]={id:s.config.entityId})}delete z.created_at}return _e.value.partials&&x.value&&by(z,x.value),z}),h=e.computed(()=>{const{__ui_data:z,...V}={...xe.value};return V}),T=async()=>{if(X.every(z=>z())&&!M.clientErrorMessage&&!s.isWizardStep)try{M.isReadonly=!0;let z;const V=JSON.parse(JSON.stringify(xe.value)),D=u[W.value];typeof(D==null?void 0:D.shamefullyTransformPayload)=="function"&&D.shamefullyTransformPayload({originalModel:ae,model:M.fields,payload:V,schema:w.value}),N.value==="create"?z=await b.post(Ee.value,V):N.value==="edit"&&(z=s.config.app==="konnect"||A.value&&V.partials?await b.put(Ee.value,Object.assign({ordering:Ve.value},V)):await b.patch(Ee.value,V)),Object.assign(ae,M.fields),a("update",z==null?void 0:z.data)}catch(z){M.serverErrorMessage=m(z),a("error",z)}finally{M.isReadonly=!1}},G=e.computed(()=>{var ne;const z=S.value?(ne=si[s.pluginType])==null?void 0:ne.schemaEndpoint:s.pluginType,V=S.value?Qe.form[s.config.app].credentialSchema:Qe.form[s.config.app].pluginSchema;let D=`${s.config.apiBaseUrl}${V}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:"").replace(/{plugin}/gi,z)}),Y=e.ref(""),re=e.ref(!1),we=e.ref("");e.onBeforeMount(async()=>{var z,V,D,ne;re.value=!0;try{if(S.value&&s.config.app==="konnect"){const ce=(z=si[s.pluginType])==null?void 0:z.schemaEndpoint,Ce=UB[ce];Y.value=ce,w.value=$e("",Ce,{}),re.value=!1}else{const ce=o&&be.value,Ce=s.schema?Promise.resolve(s.schema):b.get(G.value).then(ve=>ve.data),[Se]=await Promise.all([Ce,ce?L(s.pluginType):Promise.resolve()]);if(E.value=Se,Se)if(S.value)w.value=$e("",Se,{}),re.value=!1;else{const ve=Se.fields.find(Ke=>Ke.config);j.value=ve?ve.config:Se,Se.supported_partials&&(A.value=Object.keys(Se.supported_partials).find(Ke=>[Il.REDIS_CE,Il.REDIS_EE].includes(Ke)),x.value=(V=Se.supported_partials[A.value])==null?void 0:V[0]),Pe();const ze=(D=Se.fields.find(Ke=>Ke.protocols))==null?void 0:D.protocols;if(ze){const{default:Ke=[],elements:Be={}}=ze;le.protocols.default=Ke,le.protocols.placeholder=s.config.app==="konnect"?l("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:Ke.join(", ")}):l("plugins.form.fields.protocols.placeholder"),(ne=Be.one_of)!=null&&ne.length&&(le.protocols.values=Be.one_of.map(Ae=>({label:Ae,value:Ae})))}if(et.value||N.value===Ie.EntityBaseFormType.Create){const Ke=$e("config",j.value,le);A.value&&(Ke._supported_redis_partial_type=A.value),be.value&&(Ke._isCustomPlugin=!0),R.value&&P.value&&(Ke._sourcePlugin=P.value),w.value=Ke}}}}catch(ce){console.error(ce),we.value=m(ce),a("error:fetch-schema",ce)}finally{re.value=!1}});async function L(z){var V;try{const D=await _(z);P.value=(D==null?void 0:D.ref)??null}catch(D){if(zo.isAxiosError(D)&&((V=D.response)==null?void 0:V.status)===404)return;throw D}}return(z,V)=>{const D=e.resolveComponent("KSkeleton"),ne=e.resolveComponent("KEmptyState"),ce=e.resolveComponent("KButton"),Ce=e.resolveComponent("KTabs"),Se=e.resolveComponent("KSlideout");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["kong-ui-entities-plugin-form-container",{"new-form-layout":i.value}])},[re.value?(e.openBlock(),e.createBlock(D,{key:0,type:"form"})):we.value?(e.openBlock(),e.createBlock(ne,{key:1,"action-button-visible":!1,"data-testid":"plugin-form-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(l)("errors.load_schema")),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseForm),{key:2,"can-submit":Ye.value,config:n.config,"edit-id":n.pluginId,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":ee.value,"fetch-url":te.value,"form-fields":xe.value,"is-readonly":M.isReadonly,"no-validate":"","wrapper-component":n.noCardWrapper?"div":void 0,onCancel:ue,"onFetch:error":V[6]||(V[6]=ve=>z.$emit("error",ve)),"onFetch:success":ke,onLoading:V[7]||(V[7]=ve=>z.$emit("loading",ve))},{"form-actions":e.withCtx(()=>[n.isWizardStep?(e.openBlock(),e.createElementBlock("div",ij)):(e.openBlock(),e.createBlock(oj,{key:1,"teleport-target":n.actionsTeleportTarget},{default:e.withCtx(()=>[e.createElementVNode("div",aj,[n.hideViewConfigAction?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(ce,{key:0,appearance:"tertiary","data-testid":`plugin-${C.value?"edit":"create"}-form-view-configuration`,onClick:V[5]||(V[5]=ve=>ge())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.view_configuration")),1)]),_:1},8,["data-testid"])),e.createVNode(ce,{appearance:"secondary",class:"form-action-button","data-testid":`plugin-${C.value?"edit":"create"}-form-cancel`,disabled:M.isReadonly,onClick:ue},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.cancel")),1)]),_:1},8,["data-testid","disabled"]),e.createVNode(ce,{appearance:"primary","data-testid":`plugin-${C.value?"edit":"create"}-form-submit`,disabled:!Ye.value||M.isReadonly,type:"submit",onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.save")),1)]),_:1},8,["data-testid","disabled"])])]),_:1},8,["teleport-target"]))]),default:e.withCtx(()=>[e.createElementVNode("form",{hidden:"",onSubmit:T},null,32),e.createVNode(nj,{config:n.config,credential:S.value,developer:n.developer,editing:N.value===e.unref(Ie.EntityBaseFormType).Edit,"enable-redis-partial":n.enableRedisPartial,"enable-vault-secret-picker":s.enableVaultSecretPicker,engine:Z.value,"entity-map":me.value,"raw-schema":E.value,record:I.value,schema:w.value,"onClick:createEntity":V[0]||(V[0]=ve=>z.$emit("click:create-entity",ve)),"onClick:learnMore":V[1]||(V[1]=ve=>z.$emit("click:learn-more",ve)),onGlobalAction:V[2]||(V[2]=(ve,ze)=>z.$emit("globalAction",ve,ze)),onLoading:V[3]||(V[3]=ve=>K.value=ve),onModelUpdated:ye,onShowNewPartialModal:V[4]||(V[4]=ve=>z.$emit("showNewPartialModal",ve)),onValidityChange:se},null,8,["config","credential","developer","editing","enable-redis-partial","enable-vault-secret-picker","engine","entity-map","raw-schema","record","schema"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly","wrapper-component"])),e.createVNode(Se,{"close-on-blur":!1,"data-testid":"form-view-configuration-slideout","has-overlay":!1,"offset-top":60,title:e.unref(l)("view_configuration.title"),visible:k.value,onClose:ge},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(l)("view_configuration.message")),1),e.createVNode(Ce,{modelValue:H.value,"onUpdate:modelValue":V[11]||(V[11]=ve=>H.value=ve),"data-testid":"form-view-configuration-slideout-tabs",tabs:v.value},{json:e.withCtx(()=>[e.createVNode(e.unref(Ie.JsonCodeBlock),{config:n.config,"entity-record":h.value,"fetcher-url":Ee.value,"request-method":s.pluginId?"put":"post"},null,8,["config","entity-record","fetcher-url","request-method"])]),yaml:e.withCtx(()=>[e.createVNode(e.unref(Ie.YamlCodeBlock),{"deck-callout-preference-key":e.unref(J)?e.unref(q):void 0,"entity-record":h.value,"onDeckCallout:clickCta":V[8]||(V[8]=ve=>H.value="#deck")},null,8,["deck-callout-preference-key","entity-record"])]),terraform:e.withCtx(()=>[e.createVNode(e.unref(Ie.TerraformCodeBlock),{"credential-type":Y.value,"entity-record":h.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin},null,8,["credential-type","entity-record","entity-type"])]),deck:e.withCtx(()=>[e.unref($)?(e.openBlock(),e.createElementBlock("div",sj,[e.createVNode(ce,{appearance:"secondary",class:"button-customize-deck",onClick:V[9]||(V[9]=ve=>F.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("plugins.form.button_deck_customize")),1)]),_:1})])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.DeckCodeBlock),{app:n.config.app,"control-plane-name":n.config.app==="konnect"?n.config.controlPlaneName:void 0,"customization-options":e.unref($),"entity-record":h.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"geo-api-server-url":n.config.app==="konnect"?n.config.geoApiServerUrl:void 0,"is-customization-modal-visible":F.value,"kong-admin-api-url":n.config.app==="kongManager"?n.config.apiBaseUrl:void 0,workspace:n.config.workspace||void 0,onCustomizationClose:V[10]||(V[10]=ve=>F.value=!1)},null,8,["app","control-plane-name","customization-options","entity-record","entity-type","geo-api-server-url","is-customization-modal-visible","kong-admin-api-url","workspace"])]),_:1},8,["modelValue","tabs"])]),_:1},8,["title","visible"])],2)}}}),[["__scopeId","data-v-aefa9b20"]]),cj={class:"kong-ui-entities-plugins-list"},uj={class:"button-row"},dj={class:"name-cell-wrapper"},fj={class:"info-wrapper"},pj={key:0,class:"info-name"},mj={key:1,class:"info-name"},hj={key:2,class:"info-type"},gj={key:1},yj=Me(e.defineComponent({__name:"PluginList",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.createRoute||!n.getViewRoute||!n.getEditRoute||!n.getConfigureDynamicOrderingRoute||n.app==="kongManager"&&!n.isExactMatch&&!n.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canToggle:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},canRetrieveScopedEntity:{type:Function,required:!1,default:async()=>!0},canConfigureDynamicOrdering:{type:Function,required:!1,default:async()=>!0},title:{type:String,default:""},titleTag:{type:String,default:"h2"},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","toggle-enabled"],setup(n,{emit:t}){var Ye,et;const r=st.usePluginMetaData(),o=t,i=n,{i18n:{t:a}}=st.useI18n(),s=Nr.useRouter(),{axiosInstance:c}=Ie.useAxios((Ye=i.config)==null?void 0:Ye.axiosRequestConfig),{hasRecords:l,handleStateChange:u}=Ie.useTableState(()=>C.value),p=e.computed(()=>l.value&&i.config.app==="konnect"),d=e.computed(()=>!!i.config.entityId),f=e.computed(()=>{var Ve;return((Ve=i.config)==null?void 0:Ve.entityType)==="consumers"}),m=e.computed(()=>{var Ve;return((Ve=i.config)==null?void 0:Ve.entityType)==="consumer_groups"}),g=i.config.app==="konnect"||Ie.useGatewayFeatureSupported({gatewayInfo:i.config.gatewayInfo,supportedRange:{enterprise:["3.0"]}}),y=e.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),b={name:{label:a("plugins.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};(et=i.config)!=null&&et.entityId||(b.appliedTo={label:a("plugins.list.table_headers.applied_to"),sortable:!1}),b.enabled={label:a("plugins.list.table_headers.enabled"),searchable:!0,sortable:!0},g&&(b.ordering={label:a("plugins.list.table_headers.ordering"),sortable:!0}),b.tags={label:a("plugins.list.table_headers.tags"),sortable:!1};const _=b,k=e.computed(()=>{var ke,_e,ye,ie;let Ve=i.config.entityType?`${i.config.apiBaseUrl}${Qe.list[i.config.app].forEntity}`:`${i.config.apiBaseUrl}${Qe.list[i.config.app].all}`;return i.config.app==="konnect"&&(Ve=Ve.replace(/{controlPlaneId}/gi,((ke=i.config)==null?void 0:ke.controlPlaneId)||"")),Ve.replace(/\/{workspace}/gi,(_e=i.config)!=null&&_e.workspace?`/${i.config.workspace}`:"").replace(/{entityType}/gi,((ye=i.config)==null?void 0:ye.entityType)||"").replace(/{entityId}/gi,((ie=i.config)==null?void 0:ie.entityId)||"")}),C=e.ref(""),N=e.computed(()=>i.config.app==="konnect"||i.config.isExactMatch?{isExactMatch:!0,fields:{name:b.name,id:{label:a("plugins.list.table_headers.id"),sortable:!0}},placeholder:a(`search.placeholder.${i.config.isExactMatch?"exact":i.config.app}`)}:{isExactMatch:!1,fields:{enabled:{...b.enabled,label:a("search.filter.field.enabled")},name:b.name,instance_name:{label:a("plugins.list.table_headers.instance_name"),searchable:!0}},schema:i.config.filterSchema}),{fetcher:E,fetcherState:w,fetcherCacheKey:S}=Ie.useFetcher(e.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),k),I=()=>{C.value=""},j=()=>{S.value++},A=e.ref(null),x=Ve=>{var _e,ye,ie,ee;const ke=[];return((_e=Ve.route)!=null&&_e.id||Ve.route_id)&&ke.push({type:"route",badgeText:a("plugins.list.table_headers.applied_to_badges.route")}),((ye=Ve.service)!=null&&ye.id||Ve.service_id)&&ke.push({type:"service",badgeText:a("plugins.list.table_headers.applied_to_badges.service")}),((ie=Ve.consumer)!=null&&ie.id||Ve.consumer_id)&&ke.push({type:"consumer",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer")}),((ee=Ve.consumer_group)!=null&&ee.id||Ve.consumer_group_id)&&ke.push({type:"consumer_group",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer_group")}),ke.length?ke:[{type:null,badgeText:a("plugins.list.table_headers.applied_to_badges.global")}]},O=async(Ve,ke)=>{var _e;return Ve===null?!1:await((_e=i.canRetrieveScopedEntity)==null?void 0:_e.call(i,Ve,ke.id))},P=(Ve,ke)=>{var ye,ie,ee,se,ue;let _e=null;switch(Ve){case"route":_e=(ye=ke.route)==null?void 0:ye.id;break;case"service":_e=(ie=ke.service)==null?void 0:ie.id;break;case"consumer":_e=(ee=ke.consumer)==null?void 0:ee.id;break;case"consumer_group":_e=(se=ke.consumer_group)==null?void 0:se.id;break}_e&&((ue=i.config)!=null&&ue.getScopedEntityViewRoute)&&s.push(i.config.getScopedEntityViewRoute(Ve,_e))},R=e.ref(!1),W=e.ref(null),Z=e.computed(()=>{const Ve={action:"disable",id:"",name:""};if(W.value){const{enabled:ke,id:_e,name:ye}=W.value;Ve.action=ke?"disable":"enable",Ve.id=_e,Ve.name=r.getDisplayName(ye)||_e}return Ve}),X=Ve=>{R.value=!0,W.value=Ve},F=()=>{R.value=!1,W.value=null},J=async()=>{var ye,ie,ee,se,ue,Ee,be,xe;if(!await((ye=i.canEdit)==null?void 0:ye.call(i,W.value))||!W.value)return;let ke=`${i.config.apiBaseUrl}${(ue=Qe.item[i.config.app])==null?void 0:ue[(ie=i.config)!=null&&ie.entityType?"forEntity":"all"].replace(/{entityType}/gi,((ee=i.config)==null?void 0:ee.entityType)||"").replace(/{entityId}/gi,((se=i.config)==null?void 0:se.entityId)||"")}`.replace(/{id}/gi,W.value.id||"");i.config.app==="konnect"&&(ke=ke.replace(/{controlPlaneId}/gi,((Ee=i.config)==null?void 0:Ee.controlPlaneId)||"")),ke=ke.replace(/\/{workspace}/gi,(be=i.config)!=null&&be.workspace?`/${i.config.workspace}`:"");const _e=!W.value.enabled;try{const h=(xe=i.config)==null?void 0:xe.app;let T;C.value&&h==="konnect"&&(T=await c.get(ke));const{data:G}=h==="konnect"?await c.put(ke,{...(T==null?void 0:T.data)||W.value,enabled:_e},{timeout:12e4}):await c.patch(ke,{...W.value,enabled:_e},{timeout:12e4});o("toggle-enabled",_e,G),W.value.enabled=_e}catch(h){o("error",h)}},$=async(Ve,ke)=>{const _e=Ve.id;if(!await ke(_e)){o("copy:error",{entity:Ve,field:"id",message:a("errors.copy")});return}o("copy:success",{entity:Ve,field:"id",message:a("copy.success",{val:_e})})},q=async(Ve,ke)=>{const _e=JSON.stringify(Ve);if(!await ke(_e)){o("copy:error",{entity:Ve,message:a("errors.copy")});return}o("copy:success",{entity:Ve,message:a("copy.success_brief")})},K=async Ve=>{var _e;await((_e=i.canRetrieve)==null?void 0:_e.call(i,Ve))&&s.push(i.config.getViewRoute(Ve))},ae=Ve=>({label:a("actions.view"),to:i.config.getViewRoute(Ve)}),M=Ve=>({label:a("actions.edit"),to:i.config.getEditRoute(Ve)}),v=Ve=>({label:a("actions.configure_dynamic_ordering"),to:i.config.getConfigureDynamicOrderingRoute(Ve)}),H=e.ref(void 0),oe=e.ref(!1),te=e.ref(!1),ge=e.ref(""),me=Ie.useDeleteUrlBuilder(i.config,k.value),le=Ve=>{H.value=Ve,oe.value=!0},he=()=>{oe.value=!1},Oe=async()=>{var Ve,ke,_e;if((Ve=H.value)!=null&&Ve.id){te.value=!0;try{await c.delete(me(H.value.id)),te.value=!1,oe.value=!1,S.value++,o("delete:success",H.value)}catch(ye){ge.value=((_e=(ke=ye.response)==null?void 0:ke.data)==null?void 0:_e.message)||ye.message||a("errors.delete"),o("error",ye)}finally{te.value=!1}}},$e=()=>{s.push(i.config.createRoute)};e.watch(w,Ve=>{var ke,_e,ye;if(Ve.status===Ie.FetcherStatus.Error){A.value={title:a("errors.general")},(ye=(_e=(ke=Ve.error)==null?void 0:ke.response)==null?void 0:_e.data)!=null&&ye.message&&(A.value.message=Ve.error.response.data.message),o("error",Ve.error);return}A.value=null});const Pe=e.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${a("plugins.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:a("plugins.title")}),qe=e.ref(!1);return e.onBeforeMount(async()=>{qe.value=await i.canCreate(),qe.value&&(Pe.value.title=a("plugins.list.empty_state.title"),Pe.value.ctaText=a("actions.create"))}),(Ve,ke)=>{const _e=e.resolveComponent("KButton"),ye=e.resolveComponent("KEmptyState"),ie=e.resolveComponent("KBadge"),ee=e.resolveComponent("KTruncate"),se=e.resolveComponent("KInputSwitch"),ue=e.resolveComponent("KDropdownItem"),Ee=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",cj,[e.createVNode(e.unref(Ie.EntityBaseTable),{"cache-identifier":n.cacheIdentifier,"disable-sorting":y.value,"empty-state-options":Pe.value,"enable-entity-actions":"","error-message":A.value,fetcher:e.unref(E),"fetcher-cache-key":e.unref(S),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-plugins-list",query:C.value,"table-headers":e.unref(_),title:n.title,"title-tag":n.titleTag,onClearSearchInput:I,"onClick:row":ke[4]||(ke[4]=be=>K(be)),onSort:j,onState:e.unref(u)},e.createSlots({"toolbar-filter":e.withCtx(()=>[e.createVNode(e.unref(Ie.EntityFilter),{modelValue:C.value,"onUpdate:modelValue":ke[0]||(ke[0]=be=>C.value=be),config:N.value},null,8,["modelValue","config"])]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!n.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createElementVNode("div",uj,[!d.value&&p.value?(e.openBlock(),e.createBlock(_e,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"plugins-learn-more-button",icon:"",onClick:ke[1]||(ke[1]=be=>Ve.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.BookIcon),{decorative:""})]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canCreate()},{default:e.withCtx(()=>[e.createVNode(_e,{appearance:"primary","data-testid":"toolbar-add-plugin",size:n.useActionOutside?"medium":"large",to:n.config.createRoute},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.toolbar_actions.new_plugin")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:e.withCtx(({row:be})=>[e.createElementVNode("div",dj,[e.createVNode(e.unref(Er.PluginIcon),{class:"plugin-icon",name:be.name,size:24},null,8,["name"]),e.createElementVNode("div",fj,[be.instance_name?(e.openBlock(),e.createElementBlock("span",pj,e.toDisplayString(be.instance_name),1)):(e.openBlock(),e.createElementBlock("span",mj,e.toDisplayString(e.unref(r).getDisplayName(be.name)),1)),be.instance_name?(e.openBlock(),e.createElementBlock("span",hj,e.toDisplayString(e.unref(r).getDisplayName(be.name)),1)):e.createCommentVNode("",!0)])])]),appliedTo:e.withCtx(({row:be})=>[x(be).length>0?(e.openBlock(),e.createBlock(ee,{key:0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x(be),xe=>(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:xe.badgeText,"auth-function":()=>O(xe.type,be),"force-show":""},{default:e.withCtx(({isAllowed:h})=>[e.createVNode(ie,{class:e.normalizeClass(h||"disabled"),onClick:e.withModifiers(T=>h&&xe.type&&P(xe.type,be),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(xe.badgeText),1)]),_:2},1032,["class","onClick"])]),_:2},1032,["auth-function"]))),128))]),_:2},1024)):(e.openBlock(),e.createElementBlock("span",gj,"-"))]),enabled:e.withCtx(({row:be})=>[e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":async()=>!!(await n.canEdit(be)&&await n.canToggle(be)),"force-show":""},{default:e.withCtx(({isAllowed:xe})=>{var h,T;return[e.createElementVNode("div",{onClick:ke[3]||(ke[3]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(se,{disabled:!xe,"disabled-tooltip-text":!xe&&((T=(h=n.config).getToggleDisabledTooltip)==null?void 0:T.call(h,be))||void 0,"model-value":be.enabled,onClick:e.withModifiers(G=>xe&&X(be),["stop","prevent"])},null,8,["disabled","disabled-tooltip-text","model-value","onClick"])])]}),_:2},1032,["auth-function"])]),ordering:e.withCtx(({rowValue:be})=>[e.createVNode(ie,{appearance:e.unref(hy)(be)?"info":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(hy)(be)?e.unref(a)("plugins.list.table_headers.ordering_badge.static"):e.unref(a)("plugins.list.table_headers.ordering_badge.dynamic")),1)]),_:2},1032,["appearance"])]),tags:e.withCtx(({rowValue:be})=>[e.createVNode(e.unref(Ie.TableTags),{tags:be},null,8,["tags"])]),actions:e.withCtx(({row:be})=>[e.createVNode(Ee,null,{default:e.withCtx(({copyToClipboard:xe})=>[e.createVNode(ue,{"data-testid":"action-entity-copy-id",onClick:h=>$(be,xe)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_id")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(Ee,null,{default:e.withCtx(({copyToClipboard:xe})=>[e.createVNode(ue,{"data-testid":"action-entity-copy-json",onClick:h=>q(be,xe)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_json")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canRetrieve(be)},{default:e.withCtx(()=>[e.createVNode(ue,{"data-testid":"action-entity-view","has-divider":"",item:ae(be)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canEdit(be)},{default:e.withCtx(()=>[e.createVNode(ue,{"data-testid":"action-entity-edit",item:M(be)},null,8,["item"])]),_:2},1032,["auth-function"]),!f.value&&!m.value&&e.unref(g)?(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:0,"auth-function":()=>n.canConfigureDynamicOrdering(be)},{default:e.withCtx(()=>[v(be)?(e.openBlock(),e.createBlock(ue,{key:0,"data-testid":"action-entity-config-dyn-order",item:v(be)},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["auth-function"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canDelete(be)},{default:e.withCtx(()=>[e.createVNode(ue,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:xe=>le(be)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!C.value&&n.config.app==="konnect"?{name:"empty-state",fn:e.withCtx(()=>{var be;return[e.createVNode(ye,{"data-testid":n.config.entityId?"nested-plugins-entity-empty-state":"plugins-entity-empty-state","icon-background":"",message:e.unref(a)("plugins.list.empty_state_v2.description"),title:e.unref(a)("plugins.list.empty_state_v2.title")},e.createSlots({icon:e.withCtx(()=>[e.createVNode(e.unref(Re.PlugIcon),{decorative:""})]),action:e.withCtx(()=>[qe.value?(e.openBlock(),e.createBlock(_e,{key:0,"data-testid":"entity-create-button",onClick:$e},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.create_cta")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(_e,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:ke[2]||(ke[2]=xe=>Ve.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(be=n.config)!=null&&be.isControlPlaneGroup?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["data-testid","message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","title","title-tag","onState"]),e.createVNode(e.unref(Ie.EntityToggleModal),{action:Z.value.action,"entity-id":Z.value.id,"entity-name":Z.value.name,"entity-type":e.unref(a)("glossary.plugin"),"on-confirm":J,visible:R.value,onCancel:F,onProceed:F},null,8,["action","entity-id","entity-name","entity-type","visible"]),e.createVNode(e.unref(Ie.EntityDeleteModal),{"action-pending":te.value,description:e.unref(a)("delete.description"),"entity-name":H.value&&(H.value.instance_name||H.value.name||H.value.id),"entity-type":e.unref(Ie.EntityTypes).Plugin,error:ge.value,title:e.unref(a)("delete.title"),visible:oe.value,onCancel:he,onProceed:Oe},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-88f8302b"]]),_j={class:"plugin-select-card-wrapper"},bj=["data-testid"],wj={class:"plugin-card-header"},kj={class:"plugin-card-title"},Cj={key:0,class:"plugin-card-actions"},Ej=["data-testid","title"],Nj={key:0,class:"plugin-card-text"},Sj={key:0,class:"custom-plugin-badges"},xj=["title"],ip=Me(e.defineComponent({__name:"PluginSelectCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},plugin:{type:Object,required:!0},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Nr.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!E.value||N.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?o.canDeleteClonedPlugin:o.canDeleteCustomPlugin),f=e.computed(()=>p.value?o.canEditClonedPlugin:o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),g=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(E.value&&!N.value&&m.value&&o.navigateOnClick&&(y.value||g.value))),_=()=>{i.push(o.config.getCreateRoute(o.plugin.id))},k=()=>{o.navigateOnClick?_():C()},C=()=>{r("plugin-clicked",o.plugin)},N=e.computed(()=>o.plugin.id==="custom-plugin-create"),E=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),w=()=>{E.value&&r("custom-plugin-delete")},S=(j,A)=>{const x=o.config;typeof x.getCustomEditRoute=="function"&&i.push(x.getCustomEditRoute(j,A))},I=()=>{if(!l.value&&E.value){const j=o.config;N.value&&j.createCustomRoute?i.push(j.createCustomRoute):E.value&&_()}};return(j,A)=>{const x=e.resolveComponent("KButton"),O=e.resolveComponent("KDropdownItem"),P=e.resolveComponent("KDropdownMenu"),R=e.resolveComponent("KBadge"),W=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",_j,[e.createVNode(W,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createElementVNode("a",{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,role:"button",onClick:A[1]||(A[1]=Z=>l.value||E.value?void 0:k())},[e.createElementVNode("div",wj,[e.createElementVNode("div",kj,[e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!E.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",Cj,[e.createVNode(P,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150"},{default:e.withCtx(()=>[e.createVNode(x,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[g.value?(e.openBlock(),e.createBlock(O,{key:0,"data-testid":"edit-plugin-schema",onClick:A[0]||(A[0]=e.withModifiers(Z=>S(n.plugin.name,n.plugin.customPluginType),["stop"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(O,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":g.value,onClick:e.withModifiers(w,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["plugin-card-body",{"custom-plugin":E.value}]),"data-testid":n.plugin.name,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip"),onClick:I},[e.createVNode(e.unref(Er.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),n.plugin.description||c.value.length?(e.openBlock(),e.createElementBlock("div",Nj,[c.value.length?(e.openBlock(),e.createElementBlock("div",Sj,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,Z=>(e.openBlock(),e.createBlock(R,{key:Z,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Z),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),n.plugin.description?(e.openBlock(),e.createElementBlock("p",{key:1,class:"plugin-card-text",title:n.plugin.description},e.toDisplayString(n.plugin.description),9,xj)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,Ej),e.createElementVNode("div",{class:"plugin-card-footer",onClick:I},e.toDisplayString(N.value?e.unref(a)("actions.create_custom"):n.plugin.exists?e.unref(a)("actions.enabled"):e.unref(a)("actions.enable")),1)],10,bj)]),_:1},8,["text"])])}}}),[["__scopeId","data-v-23ad176e"]]),fc=Me(e.defineComponent({__name:"DeleteCustomPluginSchemaModal",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app))},plugin:{type:Object,required:!0}},emits:["closed","proceed"],setup(n,{emit:t}){var m;const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getMessageFromError:a}=Ie.useErrors(),{axiosInstance:s}=Ie.useAxios((m=r.config)==null?void 0:m.axiosRequestConfig),c=e.computed(()=>{var g;return p.value?i("delete.plugin_schema_in_use_title"):i("delete.title",{name:((g=r.plugin)==null?void 0:g.name)||i("delete.custom_plugin")})}),l=e.ref(!1),u=e.ref(""),p=e.ref(!1),d=e.computed(()=>{const g=r.plugin.customPluginType;if(r.config.app==="konnect"){const y=g==="streaming"?Qe.select[r.config.app].streamingCustomPluginItem:g==="cloned"?Qe.customPlugin[r.config.app].cloned.edit:Qe.select[r.config.app].schemaCustomPluginItem;return`${r.config.apiBaseUrl}${y}`.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"").replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{pluginId}/gi,r.plugin.id)}if(r.config.app==="kongManager"&&g&&g!=="schema"){const y=g==="cloned"?Qe.customPlugin[r.config.app].cloned.edit:Qe.customPlugin[r.config.app].streamed.edit;return`${r.config.apiBaseUrl}${y}`.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{pluginId}/gi,r.plugin.id)}return null}),f=async()=>{var g;if(l.value=!0,u.value="",!((g=r.plugin)!=null&&g.name)){l.value=!1;return}try{d.value&&await s.delete(d.value),o("proceed")}catch(y){Ew(y)?p.value=!0:u.value=a(y)}finally{l.value=!1}};return(g,y)=>{const b=e.resolveComponent("KAlert"),_=e.resolveComponent("KButton"),k=e.resolveComponent("KModal");return!p.value&&n.plugin?(e.openBlock(),e.createBlock(e.unref(Ie.EntityDeleteModal),{key:0,"action-pending":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",description:e.unref(i)("delete.description_custom"),"entity-name":n.plugin.name,"entity-type":e.unref(Ie.EntityTypes).Plugin,error:u.value,"need-confirm":"",title:c.value,visible:"",onCancel:y[0]||(y[0]=C=>g.$emit("closed")),onProceed:f},null,8,["action-pending","description","entity-name","entity-type","error","title"])):n.plugin?(e.openBlock(),e.createBlock(k,{key:1,"action-button-disabled":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",title:c.value,visible:"",onCancel:y[2]||(y[2]=C=>g.$emit("closed"))},{default:e.withCtx(()=>[e.createVNode(b,{appearance:"danger",message:e.unref(i)("delete.plugin_schema_in_use_message")},null,8,["message"])]),"footer-actions":e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(_,{appearance:"tertiary",class:"cancel-button","data-testid":"delete-custom-plugin-form-cancel",onClick:y[1]||(y[1]=C=>g.$emit("closed"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.cancel")),1)]),_:1})])]),_:1},8,["action-button-disabled","title"])):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-627c76f8"]]),Aj={class:"custom-plugins-grid"},vj={class:"empty-state-title"},Ij={class:"empty-state-description"},ap=310,Bj=Me(e.defineComponent({__name:"PluginCustomGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canCreateCustomPlugin:{type:Boolean,default:!1},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getTallestPluginCardHeight:a,getToggleVisibility:s}=st.usePluginHelpers(),c=e.ref(!0),l=E=>{o("plugin-clicked",E)},u=e.computed(()=>{const E=JSON.parse(JSON.stringify(r.pluginList))[fe.PluginGroup.CUSTOM_PLUGINS]||[];return r.canCreateCustomPlugin&&r.navigateOnClick&&r.config.createCustomRoute?[{id:"custom-plugin-create",name:i("plugins.select.tabs.custom.create.name"),available:!0,group:fe.PluginGroup.CUSTOM_PLUGINS,description:i("plugins.select.tabs.custom.create.description")}].concat(E):E}),p=e.ref(!1),d=e.ref(null),f=E=>{p.value=!0,d.value={id:E.id,name:E.name,customPluginType:E.customPluginType}},m=E=>{var w;E&&(o("revalidate"),o("delete:success",((w=d.value)==null?void 0:w.name)||"")),p.value=!1,d.value=null},g=e.ref(ap),y=e.ref(null),b=e.ref(null),_=e.computed(()=>c.value?{overflowY:"hidden",maxHeight:`${g.value}px`}:{}),k=e.ref(!1),C=()=>{g.value=Math.max(a(b.value),ap),N()},N=()=>{var E,w;(E=b.value)!=null&&E.length&&(k.value=s(y.value,(w=b.value)==null?void 0:w.length))};return e.onMounted(async()=>{await e.nextTick(),g.value=Math.max(a(b.value),ap),N(),window==null||window.addEventListener("resize",C)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",C)}),(E,w)=>{const S=e.resolveComponent("KEmptyState"),I=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock("div",Aj,[u.value.length?(e.openBlock(),e.createBlock(I,{key:1,modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=j=>c.value=j),class:"custom-plugins-collapse","data-testid":`${e.unref(fe.PluginGroup).CUSTOM_PLUGINS}-collapse`,title:e.unref(fe.PluginGroup).CUSTOM_PLUGINS,"trigger-label":c.value?e.unref(i)("plugins.select.view_more"):e.unref(i)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:y,class:"plugin-card-container",style:e.normalizeStyle(_.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(j,A)=>(e.openBlock(),e.createBlock(ip,{key:`plugin-card-${A}`,ref_for:!0,ref_key:"pluginCardRef",ref:b,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:j,onCustomPluginDelete:x=>f(j),onPluginClicked:l},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete"]))),128))],4)]),_:2},[k.value?void 0:{name:"trigger",fn:e.withCtx(()=>[w[2]||(w[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])):(e.openBlock(),e.createBlock(S,{key:0,"action-button-visible":!1,class:"custom-plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",vj,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",Ij,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_description")),1)]),_:1})),p.value&&d.value?(e.openBlock(),e.createBlock(fc,{key:2,config:n.config,plugin:d.value,onClosed:m,onProceed:w[1]||(w[1]=j=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-909f4d5f"]]),sp=310,xw=Me(e.defineComponent({__name:"PluginSelectGroup",props:e.mergeModels({config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},name:{type:String,required:!0},plugins:{type:Array,required:!0},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:e.mergeModels(["plugin-clicked","delete:success"],["update:modelValue"]),setup(n,{emit:t}){const r=e.useModel(n,"modelValue"),o=n,i=t,{i18n:{t:a}}=st.useI18n(),{getTallestPluginCardHeight:s,getToggleVisibility:c}=st.usePluginHelpers(),l=e.ref(sp),u=e.ref(null),p=e.ref(null),d=e.computed(()=>r.value?{overflowY:"hidden",maxHeight:`${l.value}px`}:{}),f=e.ref(!1),m=e.ref(!1),g=e.ref(null),y=C=>{m.value=!0,g.value={id:C.id,name:C.name,customPluginType:C.customPluginType}},b=C=>{var N;C&&i("delete:success",((N=g.value)==null?void 0:N.name)||""),m.value=!1,g.value=null},_=()=>{l.value=Math.max(s(p.value),sp),k()},k=()=>{var C,N;(C=p.value)!=null&&C.length&&(f.value=c(u.value,(N=p.value)==null?void 0:N.length))};return e.onMounted(async()=>{await e.nextTick(),l.value=Math.max(s(p.value),sp),k(),window==null||window.addEventListener("resize",_)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",_)}),(C,N)=>{const E=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(E,{modelValue:r.value,"onUpdate:modelValue":N[0]||(N[0]=w=>r.value=w),class:"plugins-collapse","data-testid":`${o.name}-collapse`,title:o.name,"trigger-label":r.value?e.unref(a)("plugins.select.view_more"):e.unref(a)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:u,class:"plugin-card-container",style:e.normalizeStyle(d.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.plugins,w=>(e.openBlock(),e.createBlock(ip,{key:`plugin-card-${w.id}`,ref_for:!0,ref_key:"pluginCardRef",ref:p,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:w,onCustomPluginDelete:S=>y(w),onPluginClicked:S=>i("plugin-clicked",w)},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete","onPluginClicked"]))),128))],4)]),_:2},[f.value?void 0:{name:"trigger",fn:e.withCtx(()=>[N[2]||(N[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"]),m.value&&g.value?(e.openBlock(),e.createBlock(fc,{key:0,config:n.config,plugin:g.value,onClosed:b,onProceed:N[1]||(N[1]=w=>b(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-7f683497"]]),Tj={class:"plugin-select-grid"},Oj={class:"empty-state-title"},Pj={class:"empty-state-description"},lp=e.defineComponent({__name:"PluginSelectGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},highlightedPlugins:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""},hideHighlightedPlugins:{type:Boolean,default:!1}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),a=e.ref(!1),s=e.ref(tf.reduce((u,p)=>(u[p]=!1,u),{})),c=u=>{o("plugin-clicked",u)},l=e.computed(()=>{const u=JSON.parse(JSON.stringify(r.pluginList));return r.config.app==="konnect"&&delete u[fe.PluginGroup.CUSTOM_PLUGINS],u});return(u,p)=>{const d=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",Tj,[Object.keys(l.value).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(d,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",Oj,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",Pj,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),!r.hideHighlightedPlugins&&r.highlightedPlugins.length>0?(e.openBlock(),e.createBlock(xw,{key:1,modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=f=>a.value=f),"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:r.highlightedPluginsTitle||e.unref(i)("plugins.select.highlighted_plugins.title"),"navigate-on-click":n.navigateOnClick,plugins:r.highlightedPlugins,"onDelete:success":p[1]||(p[1]=f=>o("delete:success",f)),onPluginClicked:p[2]||(p[2]=f=>c(f))},null,8,["modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(tf),f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[l.value[f]?(e.openBlock(),e.createElementBlock("div",{key:f},[e.createVNode(xw,{modelValue:s.value[f],"onUpdate:modelValue":m=>s.value[f]=m,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:f,"navigate-on-click":n.navigateOnClick,plugins:l.value[f]||[],"onDelete:success":p[3]||(p[3]=m=>o("delete:success",m)),onPluginClicked:p[4]||(p[4]=m=>c(m))},null,8,["modelValue","onUpdate:modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])])):e.createCommentVNode("",!0)],64))),256))])}}}),Vj={class:"kong-ui-entities-plugin-select-form"},$j={class:"plugins-filter-input-container"},Rj={key:0},Lj={key:3,"aria-live":"polite",class:"plugins-results-container"},Dj={"data-testid":"kong-tab"},Mj={class:"tab-description"},jj={"data-testid":"custom-tab"},Fj={class:"tab-description"},Uj={key:1},Kj=Me(e.defineComponent({__name:"PluginSelect",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="kongManager"&&!n.workspace||n.app==="konnect"&&(!n.controlPlaneId||n.workspace)||!n.getCreateRoute)},customPluginSupport:{type:[String,Array],default:"none"},canCreateCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteCustomPlugin:{type:Function,required:!1,default:async()=>!0},canReadCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteClonedPlugin:{type:Function,required:!1},canReadClonedPlugin:{type:Function,required:!1,default:async()=>!0},canEditCustomPlugin:{type:Function,required:!1,default:async()=>!0},canEditClonedPlugin:{type:Function,required:!1},navigateOnClick:{type:Boolean,default:!0},availableOnServer:{type:Boolean,default:!0},ignoredPlugins:{type:Array,default:()=>[]},disabledPlugins:{type:Object,default:()=>({})},highlightedPluginIds:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var ye;const r=n,o=t,i=Nr.useRoute(),a=Nr.useRouter(),{i18n:{t:s}}=st.useI18n(),{pluginMetaData:c}=st.usePluginMetaData(),{getMessageFromError:l}=Ie.useErrors(),{sortAlpha:u,objectsAreEqual:p}=Ie.useHelpers(),d=e.ref(""),f=e.ref(!0),m=e.ref(!1),g=e.ref(""),y=e.ref(""),b=e.ref([]),_=e.ref([]),k=e.ref([]),C=e.ref({}),N=e.ref([]),E=e.ref(null),w=e.ref(!1),{axiosInstance:S}=Ie.useAxios((ye=r.config)==null?void 0:ye.axiosRequestConfig),I=ie=>ie==="none"||ie==="disabled"?new Set:new Set(Array.isArray(ie)?ie:[ie]),j=e.computed(()=>I(r.customPluginSupport)),A=e.computed(()=>[...j.value].sort().join("|")),x=e.computed(()=>r.customPluginSupport==="disabled"),O=e.computed(()=>x.value||j.value.size>0),P=e.computed(()=>j.value.has("streaming")),R=e.computed(()=>j.value.has("cloned")),W=ie=>zo.isAxiosError(ie)&&ie.code==="ERR_CANCELED",Z=ie=>l(ie).toLowerCase().includes("requires a license"),X=e.computed(()=>C.value?Object.entries(C.value).filter(([ie])=>ie!==fe.PluginGroup.CUSTOM_PLUGINS).reduce((ie,[,ee])=>{for(const se of ee??[])ie[se.id]=se;return ie},{}):{}),F=e.computed(()=>{var se;if(!C.value)return{};const ie=d.value.toLowerCase(),ee=JSON.parse(JSON.stringify(C.value));for(const ue in C.value){const Ee=((se=C.value[ue])==null?void 0:se.filter(be=>{var xe,h;return be.name.toLowerCase().includes(ie)||be.id.toLowerCase().includes(ie)||be.group.toLowerCase().includes(ie)||((xe=be.clonedFromRef)==null?void 0:xe.toLowerCase().includes(ie))||((h=be.customPluginType)==null?void 0:h.toLowerCase().includes(ie))}))||[];Ee.length?ee[ue]=Ee:delete ee[ue]}return ee}),J=e.computed(()=>r.highlightedPluginIds.reduce((ie,ee)=>{const se=X.value[ee];return se&&ie.push(se),ie},[])),$=e.computed(()=>Object.keys(F.value).length>0),q=e.computed(()=>Object.keys(C.value).length>0&&!$.value),K=e.computed(()=>r.config.app!=="konnect"||!O.value?[]:[{hash:"#kong",title:s("plugins.select.tabs.kong.title")},{hash:"#custom",title:s("plugins.select.tabs.custom.title"),disabled:x.value}]),ae=e.computed(()=>{var ee;let ie=K.value.length&&((i==null?void 0:i.hash)||((ee=K.value[0])==null?void 0:ee.hash))||"";return ie==="#custom"&&x.value&&(ie="#kong"),ie}),M=()=>{const ie=new Map(k.value.map(ue=>[ue.name,ue])),ee=new Set(_.value.map(ue=>ue.name)),se=new Set([...ee,...ie.keys()]);return[...new Set([...Object.keys({...r.availableOnServer?{}:c}),...b.value,...se])].filter(ue=>!r.ignoredPlugins.includes(ue)).filter(ue=>{if(!r.config.entityType)return ue;const Ee=ie.has(ue)?ie.get(ue).ref:ue;return r.config.entityType==="services"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.SERVICE)||r.config.entityType==="routes"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.ROUTE)||r.config.entityType==="consumer_groups"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.CONSUMER_GROUP)||r.config.entityType==="consumers"&&c[Ee]&&!c[Ee].scope.includes(fe.PluginScope.CONSUMER)?!1:ue}).reduce((ue,Ee)=>{var re;const be=c[Ee]&&c[Ee].name||Ee,xe=ie.get(Ee),h=ee.has(Ee),T={...c[Ee],id:Ee,name:be,available:b.value.includes(Ee)||!!xe||h,disabledMessage:"",group:((re=c[Ee])==null?void 0:re.group)||fe.PluginGroup.CUSTOM_PLUGINS};T.group===fe.PluginGroup.CUSTOM_PLUGINS&&(xe?(T.customPluginType="cloned",T.clonedFromRef=xe.ref):h?T.customPluginType="streaming":T.customPluginType="schema"),r.disabledPlugins&&(T.disabledMessage=r.disabledPlugins[Ee]);const G=T.group||s("plugins.select.misc_plugins");let Y=ue[G];return Y||(Y=[]),Y.push(T),Y.sort(u("name")),ue[G]=Y,ue},{})},v=e.computed(()=>{var ee;let ie=`${r.config.apiBaseUrl}${Qe.select[r.config.app].availablePlugins}`;if(r.config.app==="konnect")ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"");else if(r.config.app==="kongManager"&&((ee=r.config.gatewayInfo)==null?void 0:ee.edition)==="community")return`${r.config.apiBaseUrl}${Qe.select[r.config.app].availablePluginsForOss}`;return ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}),H=e.computed(()=>{if(P.value){let ie=`${r.config.apiBaseUrl}${Qe.select[r.config.app].streamingCustomPlugins}`;return r.config.app==="konnect"&&(ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),oe=e.computed(()=>{if(R.value){let ie=`${r.config.apiBaseUrl}${Qe.select[r.config.app].clonedPlugins}`;return r.config.app==="konnect"&&(ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),te=e.computed(()=>{if(r.config.entityType&&r.config.entityId){let ie=`${r.config.apiBaseUrl}${Qe.list[r.config.app].forEntity}`;return r.config.app==="konnect"&&(ie=ie.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),ie.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{entityType}/gi,r.config.entityType||"").replace(/{entityId}/gi,r.config.entityId||"")}return""}),ge=ie=>{a.replace({hash:ie,query:i.query})};e.watch(()=>r.disabledPlugins,(ie,ee)=>{!p(ie,ee)&&!f.value&&(C.value=M())}),e.watch(()=>r.ignoredPlugins,(ie,ee)=>{!p(ie,ee)&&!f.value&&(C.value=M())}),e.watch(f,ie=>{o("loading",ie)});const me=async ie=>{if(!te.value){N.value=[];return}try{const{data:{data:ee}}=await S.get(te.value,{signal:ie});ee!=null&&ee.length&&(N.value=ee.reduce((se,ue)=>(ue.name&&se.push(ue.name),se),[]))}catch(ee){W(ee)||(N.value=[])}},le=async ie=>{const ee=[];H.value&&qe.value&&ee.push(dc(S,H.value,ie).then(se=>{_.value=se}).catch(se=>{W(se)||y.value||(y.value=l(se)??s("plugins.select.tabs.custom.fetch_error"))})),oe.value&&Ve.value&&ee.push(dc(S,oe.value,ie).then(se=>{k.value=se}).catch(se=>{if(W(se))return;const ue=Z(se);(ue||!y.value)&&(y.value=ue?s("plugins.select.tabs.custom.license_required"):l(se)??s("plugins.select.tabs.custom.fetch_error"))})),ee.push(me(ie)),await Promise.allSettled(ee)},he=async()=>{var ie,ee;(ie=E.value)==null||ie.abort(),E.value=new AbortController,f.value=!0,m.value=!1,g.value="",y.value="",b.value=[],_.value=[],k.value=[],N.value=[];try{const{data:se}=await S.get(v.value,{signal:E.value.signal});if(r.config.app==="konnect"){const{names:ue}=se;b.value=ue||[]}else if(r.config.app==="kongManager"){const{plugins:{available_on_server:ue}}=se;b.value=ue?Object.keys(ue):[]}await le(E.value.signal),C.value=M()}catch(se){W(se)||(m.value=!0,g.value=l(se))}finally{(ee=E.value)!=null&&ee.signal.aborted||(f.value=!1)}},Oe=e.ref(!1),$e=e.ref(!1),Pe=e.ref(!1),qe=e.ref(!1),Ye=e.ref(!1),et=e.ref(!1),Ve=e.ref(!1),ke=ie=>{_.value=_.value.filter(ee=>ee.name!==ie),k.value=k.value.filter(ee=>ee.name!==ie),C.value=M(),o("delete-custom:success",ie)};e.onBeforeMount(async()=>{const[ie,ee,se,ue,Ee,be,xe]=await Promise.all([r.canCreateCustomPlugin(),r.canEditCustomPlugin(),r.canDeleteCustomPlugin(),r.canReadCustomPlugin(),r.canEditClonedPlugin?r.canEditClonedPlugin():Promise.resolve(null),r.canDeleteClonedPlugin?r.canDeleteClonedPlugin():Promise.resolve(null),r.canReadClonedPlugin()]);Oe.value=ie,$e.value=ee,Pe.value=se,qe.value=ue,Ye.value=Ee??ee,et.value=be??se,Ve.value=xe});const _e=e.useTemplateRef("filter-input");return e.onMounted(async()=>{var ie,ee;w.value=!0,(ee=(ie=_e.value)==null?void 0:ie.input)==null||ee.focus(),await he()}),e.watch(()=>{var ie;return[r.config.app==="konnect"?r.config.controlPlaneId:void 0,r.config.workspace,r.config.entityType,r.config.entityId,r.config.app==="kongManager"?(ie=r.config.gatewayInfo)==null?void 0:ie.edition:void 0,A.value,x.value]},async()=>{w.value&&await he()}),e.onBeforeUnmount(()=>{var ie;(ie=E.value)==null||ie.abort()}),(ie,ee)=>{const se=e.resolveComponent("KInput"),ue=e.resolveComponent("KSkeletonBox"),Ee=e.resolveComponent("KSkeleton"),be=e.resolveComponent("KEmptyState"),xe=e.resolveComponent("KTooltip"),h=e.resolveComponent("KAlert"),T=e.resolveComponent("KTabs");return e.openBlock(),e.createElementBlock("div",Vj,[e.createElementVNode("div",$j,[e.createVNode(se,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":ee[0]||(ee[0]=G=>d.value=G),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter",placeholder:e.unref(s)("search.placeholder.select"),type:"search"},null,8,["modelValue","placeholder"])]),f.value?(e.openBlock(),e.createElementBlock("section",Rj,[e.createVNode(ue,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(Ee,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):m.value?(e.openBlock(),e.createBlock(be,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(g.value),1)]),_:1})):q.value&&d.value?(e.openBlock(),e.createBlock(be,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(s)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",Lj,[K.value.length?(e.openBlock(),e.createBlock(T,{key:0,modelValue:ae.value,"onUpdate:modelValue":ee[3]||(ee[3]=G=>ae.value=G),"data-testid":"plugins-tabs",tabs:K.value,onChange:ge},e.createSlots({kong:e.withCtx(()=>[e.createElementVNode("div",Dj,[e.createElementVNode("p",Mj,e.toDisplayString(e.unref(s)("plugins.select.tabs.kong.description")),1),e.createVNode(lp,{"can-delete-cloned-plugin":et.value,"can-delete-custom-plugin":Pe.value,"can-edit-cloned-plugin":Ye.value,"can-edit-custom-plugin":$e.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":J.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":F.value,"onDelete:success":ke,onPluginClicked:ee[1]||(ee[1]=G=>ie.$emit("plugin-clicked",G))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])])]),custom:e.withCtx(()=>[e.createElementVNode("div",jj,[e.renderSlot(ie.$slots,"before-custom-tab-content",{},void 0,!0),e.createElementVNode("p",Fj,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.description")),1),y.value?(e.openBlock(),e.createBlock(h,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(Bj,{"can-create-custom-plugin":Oe.value,"can-delete-cloned-plugin":et.value,"can-delete-custom-plugin":Pe.value,"can-edit-cloned-plugin":Ye.value,"can-edit-custom-plugin":$e.value,config:n.config,"navigate-on-click":n.navigateOnClick,"plugin-list":F.value,"onDelete:success":ke,onPluginClicked:ee[2]||(ee[2]=G=>ie.$emit("plugin-clicked",G))},null,8,["can-create-custom-plugin","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin-list"])])]),_:2},[x.value?{name:"custom-anchor",fn:e.withCtx(()=>[e.createVNode(xe,{"max-width":"300",text:e.unref(s)("plugins.select.tabs.custom.disabled_tooltip")},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.title")),1)]),_:1},8,["text"])]),key:"0"}:void 0]),1032,["modelValue","tabs"])):(e.openBlock(),e.createElementBlock("div",Uj,[y.value?(e.openBlock(),e.createBlock(h,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(lp,{"can-delete-cloned-plugin":et.value,"can-delete-custom-plugin":Pe.value,"can-edit-cloned-plugin":Ye.value,"can-edit-custom-plugin":$e.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":J.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":F.value,"onDelete:success":ke,onPluginClicked:ee[4]||(ee[4]=G=>ie.$emit("plugin-clicked",G))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])]))]))])}}}),[["__scopeId","data-v-70fb1e81"]]),qj={class:"plugin-select-card-wrapper","data-testid":"plugin-catalog-card-wrapper"},Gj={class:"plugin-card-header"},Hj={class:"plugin-card-title"},zj={key:0,class:"plugin-card-actions"},Wj=["data-testid","title"],Yj={key:0},Jj=["title"],Xj={class:"plugin-card-footer"},Zj={class:"plugin-card-footer-extra"},Qj={key:0,class:"custom-plugin-badges"},eF=Me(e.defineComponent({__name:"PluginCatalogCard",props:{config:{},plugin:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Nr.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!C.value||k.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin),f=e.computed(()=>p.value?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),g=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(C.value&&!k.value&&m.value&&(y.value||g.value))),_=e.computed(()=>l.value?{}:C.value&&k.value&&o.config.createCustomRoute?o.config.createCustomRoute:o.config.getCreateRoute(o.plugin.id)),k=e.computed(()=>o.plugin.id==="custom-plugin-create"),C=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),N=()=>{C.value&&r("custom-plugin-delete")},E=(w,S)=>{typeof o.config.getCustomEditRoute=="function"&&i.push(o.config.getCustomEditRoute(w,S))};return(w,S)=>{const I=e.resolveComponent("KButton"),j=e.resolveComponent("KDropdownItem"),A=e.resolveComponent("KDropdownMenu"),x=e.resolveComponent("KBadge"),O=e.resolveComponent("RouterLink"),P=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",qj,[e.createVNode(P,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createVNode(O,{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,to:_.value},{default:e.withCtx(()=>[e.createElementVNode("div",Gj,[e.createElementVNode("div",Hj,[e.createVNode(e.unref(Er.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!C.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",zj,[e.createVNode(A,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150",onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop","prevent"]))},{default:e.withCtx(()=>[e.createVNode(I,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[g.value?(e.openBlock(),e.createBlock(j,{key:0,"data-testid":"edit-plugin-schema",onClick:S[0]||(S[0]=e.withModifiers(R=>E(n.plugin.name,n.plugin.customPluginType),["stop","prevent"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(j,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":g.value,onClick:e.withModifiers(N,["stop","prevent"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"plugin-card-body","data-testid":`${n.plugin.id}-card-body`,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip")},[n.plugin.description?(e.openBlock(),e.createElementBlock("div",Yj,[e.createElementVNode("div",{title:n.plugin.description},e.toDisplayString(n.plugin.description),9,Jj)])):e.createCommentVNode("",!0)],8,Wj),e.createElementVNode("div",Xj,[e.createElementVNode("div",null,e.toDisplayString(k.value?e.unref(a)("actions.create_custom"):e.unref(a)("actions.configure")),1),e.createElementVNode("div",Zj,[c.value.length?(e.openBlock(),e.createElementBlock("div",Qj,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,R=>(e.openBlock(),e.createBlock(x,{key:R,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(R),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"footer-extra",{},void 0,!0)])])]),_:3},8,["class","data-testid","to"])]),_:3},8,["text"])])}}}),[["__scopeId","data-v-5eb0b917"]]),tF=["data-testid"],nF={class:"group-icon-wrapper"},rF={class:"group-title-text"},oF=["data-testid"],iF=["data-testid"],Aw=Me(e.defineComponent({__name:"PluginCatalogGroup",props:{config:{},name:{},plugins:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean},showAllCard:{type:Boolean}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=e.computed(()=>{switch(r.name){case fe.PluginGroup.FEATURED:return Re.PopularIcon;case fe.PluginGroup.AI:return Re.BotIcon;case fe.PluginGroup.ANALYTICS_AND_MONITORING:return Re.AnalyticsIcon;case fe.PluginGroup.AUTHENTICATION:return Re.LockIcon;case fe.PluginGroup.LOGGING:return Re.ServiceDocumentIcon;case fe.PluginGroup.MONETIZATION:return Re.MoneyIcon;case fe.PluginGroup.SECURITY:return Re.SecurityIcon;case fe.PluginGroup.SERVERLESS:return Re.RuntimeServerlessIcon;case fe.PluginGroup.TRAFFIC_CONTROL:return Re.TrafficIcon;case fe.PluginGroup.TRANSFORMATIONS:return Re.TransformationIcon;case fe.PluginGroup.DEPLOYMENT:return Re.DeployIcon;case fe.PluginGroup.CUSTOM_PLUGINS:return Re.CodeblockIcon;default:return null}}),i=t,{i18n:{t:a}}=st.useI18n(),s=e.ref(!1),c=e.computed(()=>r.showAllCard?r.plugins:!s.value&&r.plugins.length>9?r.plugins.slice(0,8):r.plugins),l=e.computed(()=>!r.showAllCard&&!s.value&&r.plugins.length>9);function u(){s.value=!0}const p=e.ref(!1),d=e.ref(null),f=g=>{p.value=!0,d.value={id:g.id,name:g.name,group:g.group,customPluginType:g.customPluginType}},m=g=>{var y,b,_;g&&(i("revalidate"),i("delete:success",{name:((y=d.value)==null?void 0:y.name)||"",group:(b=d.value)==null?void 0:b.group,customPluginType:(_=d.value)==null?void 0:_.customPluginType})),p.value=!1,d.value=null};return(g,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.name?(e.openBlock(),e.createElementBlock("div",{key:0,class:"group-title","data-testid":`plugin-group-${n.name}-title`},[e.createElementVNode("div",nF,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{color:`var(--kui-color-text-decorative-purple, ${e.unref(Vh)})`},null,8,["color"]))]),e.createElementVNode("span",rF,e.toDisplayString(n.name),1)],8,tF)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"plugin-card-container","data-testid":`plugin-group-${n.name}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,b=>(e.openBlock(),e.createBlock(eF,{key:`plugin-card-${b.id}`,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugin:b,onCustomPluginDelete:_=>f(b),onPluginClicked:_=>i("plugin-clicked",b)},e.createSlots({_:2},[b.gatewayVersion&&e.unref(hT)(e.unref(fe.GATEWAY_VERSION_TIMESTAMP_MAP)[b.gatewayVersion])?{name:"footer-extra",fn:e.withCtx(()=>[e.createElementVNode("span",{class:"plugin-card-new-badge","data-testid":`plugin-card-${b.id}-new-badge`},e.toDisplayString(e.unref(a)("labels.new")),9,iF)]),key:"0"}:void 0]),1032,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin","onCustomPluginDelete","onPluginClicked"]))),128)),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"show-all-plugin-card",onClick:u},e.toDisplayString(e.unref(a)("plugins.select.show_all")),1)):e.createCommentVNode("",!0)],8,oF),p.value&&d.value?(e.openBlock(),e.createBlock(fc,{key:1,config:n.config,plugin:d.value,onClosed:m,onProceed:y[0]||(y[0]=b=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-f9a9a47c"]]),aF={class:"plugin-select-grid"},sF={class:"empty-state-title"},lF={class:"empty-state-description"},cF={key:1},uF=Me(e.defineComponent({__name:"PluginCatalogGrid",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=Bl.concat(Tl),o=t,{i18n:{t:i}}=st.useI18n(),a=s=>{o("plugin-clicked",s)};return(s,c)=>{var u;const l=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",aF,[Object.keys(n.pluginList||[]).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(l,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",sF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",lF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),p=>{var d;return e.openBlock(),e.createElementBlock(e.Fragment,null,[(d=n.pluginList)!=null&&d[p]?(e.openBlock(),e.createElementBlock("div",{key:p},[e.createVNode(Aw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:p,plugins:n.pluginList[p]||[],"onDelete:success":c[0]||(c[0]=f=>o("delete:success",f)),onPluginClicked:c[1]||(c[1]=f=>a(f))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","plugins"])])):e.createCommentVNode("",!0)],64)}),256)),(u=n.pluginList)!=null&&u["Query Result"]?(e.openBlock(),e.createElementBlock("div",cF,[e.createVNode(Aw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugins:n.pluginList["Query Result"]||[],"show-all-card":"","onDelete:success":c[2]||(c[2]=p=>o("delete:success",p)),onPluginClicked:c[3]||(c[3]=p=>a(p))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugins"])])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-e3bf3819"]]),dF={class:"plugin-name-cell","data-testid":"plugin-catalog-list-view-name"},fF=["title"],pF=["title"],mF={class:"plugin-action-cell","data-testid":"plugin-catalog-list-view-action"},hF={key:0,class:"plugin-more-action-cell","data-testid":"plugin-catalog-list-view-more-actions"},gF=Me(e.defineComponent({__name:"PluginCatalogListView",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["revalidate","delete:success"],setup(n,{emit:t}){const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=A=>A.customPluginType==="cloned"&&A.clonedFromRef?i("plugins.select.cloned_from_badge",{link:A.clonedFromRef}):A.customPluginType==="streaming"?i("plugins.select.streamed_custom_badge"):A.customPluginType?i("plugins.select.installed_custom_badge"):"",s=e.computed(()=>w.value.some(A=>C(A.plugin))),c=e.computed(()=>{const A=[{key:"name",label:i("plugins.select.list.table_headers.name"),sortable:!0},{key:"description",label:i("plugins.select.list.table_headers.description")},{key:"action",hideLabel:!0}];return s.value&&A.push({key:"more-actions",hideLabel:!0}),A}),l=e.computed(()=>{if(!o.pluginList)return[];const A=Object.values(o.pluginList).flat();return Array.from(new Map(A.map(O=>[O.id,O])).values()).map(O=>({id:O.id,name:O.name,description:O.description,badge:a(O),plugin:O}))}),u=e.ref(0),p=e.ref(10),d=e.ref(1),f=e.ref(l.value),m=e.ref(!1),g=e.ref(null),y=A=>A.customPluginType==="cloned"&&A.clonedFromRef?A.clonedFromRef:A.id,b=A=>(A==null?void 0:A.customPluginType)==="cloned",_=A=>!(A!=null&&A.customPluginType)||o.config.app==="kongManager"&&A.customPluginType==="schema"?!1:b(A)?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin,k=A=>!(A!=null&&A.customPluginType)||typeof o.config.getCustomEditRoute!="function"||o.config.app==="kongManager"&&A.customPluginType==="schema"?!1:b(A)?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin,C=A=>_(A)||k(A),N=A=>{m.value=!0,g.value={id:A.id,name:A.name,group:A.group,customPluginType:A.customPluginType}},E=A=>{var x,O,P;A&&(r("revalidate"),r("delete:success",{name:((x=g.value)==null?void 0:x.name)||"",group:(O=g.value)==null?void 0:O.group,customPluginType:(P=g.value)==null?void 0:P.customPluginType})),m.value=!1,g.value=null},w=e.computed(()=>{const A=f.value.length,x=Math.max(1,Math.ceil(A/p.value)),P=(Math.min(d.value,x)-1)*p.value;return f.value.slice(P,P+p.value)});e.watch(l,()=>{f.value=[...l.value],d.value=1,u.value++});const S=({page:A})=>{d.value=A},I=({pageSize:A})=>{p.value=A},j=A=>{const{sortColumnKey:x,sortColumnOrder:O}=A;x==="name"&&(f.value=[...f.value].sort((P,R)=>{const W=(P[x]||"").toLowerCase(),Z=(R[x]||"").toLowerCase();return W<Z?O==="asc"?-1:1:W>Z?O==="asc"?1:-1:0}))};return(A,x)=>{const O=e.resolveComponent("KBadge"),P=e.resolveComponent("KButton"),R=e.resolveComponent("KDropdownItem"),W=e.resolveComponent("KDropdown"),Z=e.resolveComponent("KTableView"),X=e.resolveComponent("KCard");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(X,{"data-testid":"plugin-catalog-list-view-card"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(Z,{key:u.value,class:"plugin-catalog-table","client-sort":"",data:w.value,"data-testid":"plugin-catalog-list-view-table",headers:c.value,"pagination-attributes":{totalCount:l.value.length,currentPage:d.value,initialPageSize:p.value,pageSizes:[10,25,50]},"resize-columns":"","row-key":"id",onPageChange:S,onPageSizeChange:I,onSort:j},{name:e.withCtx(({row:F})=>[e.createElementVNode("span",dF,[e.createVNode(e.unref(Er.PluginIcon),{"data-testid":`plugin-catalog-list-view-${F.plugin.id}-icon`,name:y(F.plugin),size:20},null,8,["data-testid","name"]),e.createElementVNode("span",{class:"plugin-name-text","data-testid":"plugin-catalog-list-view-name-text",title:F.name},e.toDisplayString(F.name),9,fF),F.badge?(e.openBlock(),e.createBlock(O,{key:0,appearance:"info",class:"plugin-name-badge","data-testid":"plugin-catalog-list-view-custom-badge"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(F.badge),1)]),_:2},1024)):e.createCommentVNode("",!0)])]),description:e.withCtx(({row:F})=>[e.createElementVNode("span",{class:"plugin-description-cell","data-testid":"plugin-catalog-list-view-description",title:F.description},e.toDisplayString(F.description),9,pF)]),action:e.withCtx(({row:F})=>[e.createElementVNode("div",mF,[e.createVNode(P,{appearance:"tertiary","data-testid":"plugin-catalog-list-view-configure-btn",size:"small",to:o.config.getCreateRoute(F.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.configure")),1)]),_:1},8,["to"])])]),"more-actions":e.withCtx(({row:F})=>[C(F.plugin)?(e.openBlock(),e.createElementBlock("div",hF,[e.createVNode(W,{appearance:"tertiary",class:"actions-trigger","data-testid":"plugin-catalog-list-view-more-actions-button",icon:"",size:"small"},{items:e.withCtx(()=>{var J,$;return[k(F.plugin)?(e.openBlock(),e.createBlock(R,{key:0,"data-testid":"edit-plugin-schema",item:{label:e.unref(i)("actions.edit"),to:($=(J=n.config).getCustomEditRoute)==null?void 0:$.call(J,F.plugin.name,F.plugin.customPluginType)}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.edit")),1)]),_:1},8,["item"])):e.createCommentVNode("",!0),_(F.plugin)?(e.openBlock(),e.createBlock(R,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":k(F.plugin),onClick:()=>N(F.plugin)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.delete")),1)]),_:1},8,["has-divider","onClick"])):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createVNode(e.unref(Re.MoreIcon),{color:`var(--kui-color-text-neutral, ${e.unref(sr)})`,size:`var(--kui-icon-size-30, ${e.unref(zn)})`},null,8,["color","size"])]),_:2},1024)])):e.createCommentVNode("",!0)]),_:1},8,["data","headers","pagination-attributes"]))]),_:1}),m.value&&g.value?(e.openBlock(),e.createBlock(fc,{key:0,config:n.config,plugin:g.value,onClosed:E,onProceed:x[0]||(x[0]=F=>E(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-986d34db"]]),yF={class:"plugin-catalog","data-testid":"plugin-catalog"},_F={class:"plugin-filter","data-testid":"plugin-filter"},bF={class:"plugin-filter-title"},wF={class:"featured-title"},kF={class:"plugin-featured-filter"},CF=["data-testid"],EF={class:"group-title"},NF={class:"plugin-type-filter"},SF=["data-testid"],xF={class:"plugins-container"},AF={class:"plugins-filter-input-container"},vF={class:"icon-container"},IF={key:0},BF={key:3,"aria-live":"polite",class:"plugins-results-container"},TF=Me(e.defineComponent({__name:"PluginCatalog",props:{config:{},disabledPlugins:{},highlightedPluginIds:{},customPluginSupport:{default:"none"},availableOnServer:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Function,default:async()=>!0},canReadCustomPlugin:{type:Function,default:async()=>!0},canEditCustomPlugin:{type:Function,default:async()=>!0},canDeleteClonedPlugin:{},canReadClonedPlugin:{type:Function,default:async()=>!0},canEditClonedPlugin:{}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var _e;const r=t,{i18n:{t:o}}=st.useI18n(),{pluginMetaData:i}=st.usePluginMetaData(),{getMessageFromError:a}=Ie.useErrors(),{sortAlpha:s,objectsAreEqual:c}=Ie.useHelpers(),l=n,{axiosInstance:u}=Ie.useAxios((_e=l.config)==null?void 0:_e.axiosRequestConfig),p=e.useTemplateRef("filter-input"),d=e.ref(""),f=e.ref(!1),m=e.ref(!1),g=e.ref(Object.fromEntries(Bl.concat(Tl).map(ye=>[ye,!1]))),y=e.ref(!0),b=e.ref(!1),_=e.ref(""),k=e.ref(""),C=e.ref([]),N=e.ref([]),E=e.ref([]),w=e.ref({}),S=e.ref([]),I=e.ref(!1),j=e.ref(null),A=e.ref(!1),x=e.computed(()=>I.value?Re.GridIcon:Re.ListIcon),O=e.inject(ur.KM_2485_CLONED_PLUGINS,!1),P=e.computed(()=>e.unref(O)),R=ye=>ye==="none"||ye==="disabled"?new Set:new Set(Array.isArray(ye)?ye:[ye]),W=e.computed(()=>R(l.customPluginSupport)),Z=e.computed(()=>[...W.value].sort().join("|")),X=e.computed(()=>W.value.has("streaming")),F=e.computed(()=>P.value&&W.value.has("cloned")),J=ye=>zo.isAxiosError(ye)&&ye.code==="ERR_CANCELED",$=ye=>a(ye).toLowerCase().includes("requires a license"),q=e.computed(()=>{var ie;let ye=`${l.config.apiBaseUrl}${Qe.select[l.config.app].availablePlugins}`;if(l.config.app==="konnect")ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"");else if(l.config.app==="kongManager"&&((ie=l.config.gatewayInfo)==null?void 0:ie.edition)==="community")return`${l.config.apiBaseUrl}${Qe.select[l.config.app].availablePluginsForOss}`;return ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}),K=e.computed(()=>{if(X.value){let ye=`${l.config.apiBaseUrl}${Qe.select[l.config.app].streamingCustomPlugins}`;return l.config.app==="konnect"&&(ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),ae=e.computed(()=>{if(F.value){let ye=`${l.config.apiBaseUrl}${Qe.select[l.config.app].clonedPlugins}`;return l.config.app==="konnect"&&(ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),M=e.computed(()=>{if(l.config.entityType&&l.config.entityId){let ye=`${l.config.apiBaseUrl}${Qe.list[l.config.app].forEntity}`;return l.config.app==="konnect"&&(ye=ye.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),ye.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"").replace(/{entityType}/gi,l.config.entityType||"").replace(/{entityId}/gi,l.config.entityId||"")}return""}),v=e.computed(()=>{var be;if(!w.value)return{};const ye=Object.entries(g.value).filter(([,xe])=>xe).map(([xe])=>xe);let ie={};ye.length===0&&(ie=w.value),ye.forEach(xe=>{w.value[xe]&&(ie[xe]=w.value[xe])});const ee=d.value.toLowerCase();if(!ee)return ie;const se=JSON.parse(JSON.stringify(ie));for(const xe in ie){const h=((be=ie[xe])==null?void 0:be.filter(T=>[T.name.toLowerCase(),T.id.toLowerCase()].some(Y=>mT(ee,Y).length===ee.length)))||[];h.length?se[xe]=h:delete se[xe]}const ue=Object.values(se).flat().filter(xe=>!!xe),Ee=Array.from(ue.reduce((xe,h)=>(xe.has(h.id)||xe.set(h.id,h),xe),new Map).values());return Ee.length?{"Query Result":Ee}:{}}),H=e.computed(()=>Object.keys(v.value).length>0),oe=e.computed(()=>Object.keys(w.value).length>0&&!H.value),te=()=>{Object.keys(g.value).forEach(ye=>{g.value[ye]=!1})},ge=()=>{const ye=new Map(E.value.map(ue=>[ue.name,ue])),ie=new Set(N.value.map(ue=>ue.name)),ee=new Set([...ie,...ye.keys()]),se=[...new Set([...Object.keys({...l.availableOnServer?{}:i}),...C.value,...ee])].filter(ue=>{if(!l.config.entityType)return ue;const Ee=ye.has(ue)?ye.get(ue).ref:ue;return l.config.entityType==="services"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.SERVICE)||l.config.entityType==="routes"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.ROUTE)||l.config.entityType==="consumer_groups"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.CONSUMER_GROUP)||l.config.entityType==="consumers"&&i[Ee]&&!i[Ee].scope.includes(fe.PluginScope.CONSUMER)?!1:ue}).reduce((ue,Ee)=>{var re;const be=i[Ee]&&i[Ee].name||Ee,xe=ye.get(Ee),h=ie.has(Ee),T={...i[Ee],id:Ee,name:be,available:C.value.includes(Ee)||!!xe||h,disabledMessage:"",group:((re=i[Ee])==null?void 0:re.group)||fe.PluginGroup.CUSTOM_PLUGINS};T.group===fe.PluginGroup.CUSTOM_PLUGINS&&(xe?(T.customPluginType="cloned",T.clonedFromRef=xe.ref):h?T.customPluginType="streaming":T.customPluginType="schema"),l.disabledPlugins&&(T.disabledMessage=l.disabledPlugins[Ee]);const G=T.group||o("plugins.select.misc_plugins");let Y=ue[G];return Y||(Y=[]),Y.push(T),Y.sort(s("name")),ue[G]=Y,ue},{});if(l.highlightedPluginIds&&l.highlightedPluginIds.length>0){const ue=new Set(Object.values(se).flat().map(be=>be==null?void 0:be.id)),Ee=l.highlightedPluginIds.flatMap(be=>{var h;const xe=i[be];return!xe||!ue.has(be)?[]:{...xe,id:be,name:xe.name||be,available:C.value.includes(be),disabledMessage:((h=l.disabledPlugins)==null?void 0:h[be])||"",group:xe.group||fe.PluginGroup.CUSTOM_PLUGINS}}).filter(Boolean);Ee.length>0&&(se[fe.PluginGroup.FEATURED]=Ee)}return se};e.watch(()=>l.disabledPlugins,(ye,ie)=>{!c(ye||{},ie||{})&&!y.value&&(w.value=ge())}),e.watch(y,ye=>{r("loading",ye)});const me=e.ref(!1),le=e.ref(!1),he=e.ref(!1),Oe=e.ref(!1),$e=e.ref(!1),Pe=e.ref(!1),qe=async()=>{try{const[ye,ie,ee,se,ue,Ee]=await Promise.all([l.canEditCustomPlugin(),l.canDeleteCustomPlugin(),l.canReadCustomPlugin(),l.canEditClonedPlugin?l.canEditClonedPlugin():Promise.resolve(null),l.canDeleteClonedPlugin?l.canDeleteClonedPlugin():Promise.resolve(null),l.canReadClonedPlugin()]);me.value=ye,le.value=ie,he.value=ee,Oe.value=se??ye,$e.value=ue??ie,Pe.value=Ee}catch{me.value=!1,le.value=!1,he.value=!1,Oe.value=!1,$e.value=!1,Pe.value=!1}},Ye=async ye=>{if(!M.value){S.value=[];return}try{const{data:{data:ie}}=await u.get(M.value,{signal:ye});ie!=null&&ie.length&&(S.value=ie.reduce((ee,se)=>(se.name&&ee.push(se.name),ee),[]))}catch(ie){J(ie)||(S.value=[])}},et=async ye=>{const ie=[];K.value&&he.value&&ie.push(dc(u,K.value,ye).then(ee=>{N.value=ee}).catch(ee=>{J(ee)||k.value||(k.value=a(ee)??o("plugins.select.tabs.custom.fetch_error"))})),ae.value&&Pe.value&&ie.push(dc(u,ae.value,ye).then(ee=>{E.value=ee}).catch(ee=>{if(J(ee))return;const se=$(ee);(se||!k.value)&&(k.value=se?o("plugins.select.tabs.custom.license_required"):a(ee)??o("plugins.select.tabs.custom.fetch_error"))})),ie.push(Ye(ye)),await Promise.allSettled(ie)},Ve=async()=>{var ie;(ie=j.value)==null||ie.abort();const ye=new AbortController;j.value=ye,y.value=!0,b.value=!1,_.value="",k.value="",C.value=[],N.value=[],E.value=[],S.value=[];try{const{data:ee}=await u.get(q.value,{signal:ye.signal});if(l.config.app==="konnect"){const{names:se}=ee;C.value=se||[]}else if(l.config.app==="kongManager"){const{plugins:{available_on_server:se}}=ee;C.value=se?Object.keys(se):[]}await et(ye.signal),w.value=ge()}catch(ee){J(ee)||(b.value=!0,_.value=a(ee))}finally{j.value===ye&&!ye.signal.aborted&&(y.value=!1)}},ke=async({name:ye})=>{ye&&(r("delete-custom:success",ye),await Ve())};return e.onMounted(async()=>{var ye,ie;A.value=!0,(ie=(ye=p.value)==null?void 0:ye.input)==null||ie.focus(),await qe(),await Ve()}),e.watch(()=>{var ye;return[l.config.app==="konnect"?l.config.controlPlaneId:void 0,l.config.workspace,l.config.entityType,l.config.entityId,l.config.app==="kongManager"?(ye=l.config.gatewayInfo)==null?void 0:ye.edition:void 0,Z.value,P.value]},async()=>{A.value&&(await qe(),await Ve())}),e.onBeforeUnmount(()=>{var ye;(ye=j.value)==null||ye.abort()}),(ye,ie)=>{const ee=e.resolveComponent("KButton"),se=e.resolveComponent("KCheckbox"),ue=e.resolveComponent("KBadge"),Ee=e.resolveComponent("KCollapse"),be=e.resolveComponent("KInput"),xe=e.resolveComponent("KSkeletonBox"),h=e.resolveComponent("KSkeleton"),T=e.resolveComponent("KEmptyState"),G=e.resolveComponent("KAlert");return e.openBlock(),e.createElementBlock("div",yF,[e.createElementVNode("div",_F,[e.createElementVNode("div",bF,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.title"))+" ",1),e.createVNode(ee,{appearance:"tertiary",class:"clear-selection","data-testid":"clear-filter-selection",disabled:!Object.values(g.value).some(Y=>Y),onClick:te},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.clear")),1)]),_:1},8,["disabled"])]),e.createVNode(Ee,{modelValue:f.value,"onUpdate:modelValue":ie[0]||(ie[0]=Y=>f.value=Y)},{title:e.withCtx(()=>[e.createElementVNode("div",wF,e.toDisplayString(e.unref(o)("plugins.select.filter.featured")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",kF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Bl),Y=>(e.openBlock(),e.createElementBlock("div",{key:Y,class:"plugin-filter-item","data-testid":`plugin-filter-item-${Y}`},[e.createVNode(se,{modelValue:g.value[Y],"onUpdate:modelValue":re=>g.value[Y]=re,label:Y},null,8,["modelValue","onUpdate:modelValue","label"]),e.createVNode(ue,{appearance:"neutral"},{default:e.withCtx(()=>{var re,we;return[e.createTextVNode(e.toDisplayString(((we=(re=w.value)==null?void 0:re[Y])==null?void 0:we.length)||0),1)]}),_:2},1024)],8,CF))),128))])]),_:1},8,["modelValue"]),e.createVNode(Ee,{modelValue:m.value,"onUpdate:modelValue":ie[1]||(ie[1]=Y=>m.value=Y)},{title:e.withCtx(()=>[e.createElementVNode("div",EF,e.toDisplayString(e.unref(o)("plugins.select.filter.type")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",NF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Tl),Y=>(e.openBlock(),e.createElementBlock("div",{key:Y,class:"plugin-filter-item","data-testid":`plugin-filter-item-${Y}`},[e.createVNode(se,{modelValue:g.value[Y],"onUpdate:modelValue":re=>g.value[Y]=re,"data-testid":`plugin-filter-checkbox-${Y}`,label:Y},null,8,["modelValue","onUpdate:modelValue","data-testid","label"]),e.createVNode(ue,{appearance:"neutral","data-testid":`plugin-filter-count-${Y}`},{default:e.withCtx(()=>{var re,we;return[e.createTextVNode(e.toDisplayString(((we=(re=w.value)==null?void 0:re[Y])==null?void 0:we.length)||0),1)]}),_:2},1032,["data-testid"])],8,SF))),128))])]),_:1},8,["modelValue"])]),e.createElementVNode("div",xF,[e.createElementVNode("div",AF,[e.createVNode(be,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":ie[2]||(ie[2]=Y=>d.value=Y),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter-input",placeholder:e.unref(o)("search.placeholder.search_plugins"),type:"search"},null,8,["modelValue","placeholder"]),e.createElementVNode("div",vF,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.value),{class:"plugins-filter-icon",color:`var(--kui-icon-color-primary, ${e.unref(m1)})`,onClick:ie[3]||(ie[3]=Y=>I.value=!I.value)},null,8,["color"]))])]),y.value?(e.openBlock(),e.createElementBlock("section",IF,[e.createVNode(xe,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(h,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):b.value?(e.openBlock(),e.createBlock(T,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(_.value),1)]),_:1})):oe.value&&d.value?(e.openBlock(),e.createBlock(T,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(o)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",BF,[k.value?(e.openBlock(),e.createBlock(G,{key:0,appearance:"warning",class:"custom-plugins-warning",message:k.value},null,8,["message"])):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createBlock(gF,{key:1,"can-delete-cloned-plugin":$e.value,"can-delete-custom-plugin":le.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":me.value,config:n.config,"plugin-list":v.value,"onDelete:success":ke},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"])):(e.openBlock(),e.createBlock(uF,{key:2,"can-delete-cloned-plugin":$e.value,"can-delete-custom-plugin":le.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":me.value,config:n.config,"plugin-list":v.value,"onDelete:success":ke,onPluginClicked:ie[4]||(ie[4]=Y=>ye.$emit("plugin-clicked",Y))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"]))]))])])}}}),[["__scopeId","data-v-6f778468"]]),OF={key:1,class:"datakit-config-card-canvas"},PF={class:"config-card-details-label","data-testid":"datakit-configuration-label"},VF={class:"config-card-details-value datakit-canvas-container","data-testid":"datakit-configuration-canvas"},$F={class:"canvas-wrapper"},RF=Me(e.defineComponent({__name:"DatakitConfigCardCanvas",props:{pluginData:{},item:{}},setup(n){const t=e.computed(()=>{var r;return sw.safeParse((r=n.pluginData)==null?void 0:r.config).success});return Xd(n.pluginData),(r,o)=>{const i=e.resolveComponent("KLabel");return t.value?(e.openBlock(),e.createElementBlock("div",OF,[e.createElementVNode("div",PF,[e.createVNode(i,null,{default:e.withCtx(()=>[...o[0]||(o[0]=[e.createElementVNode("span",{class:"label-content"}," Nodes ",-1)])]),_:1})]),e.createElementVNode("div",VF,[e.createElementVNode("div",$F,[e.createVNode(Yf,{class:"datakit-flow-panels",mode:"view",resizable:""})])])])):(e.openBlock(),e.createBlock(e.unref(Ie.ConfigCardItem),{key:0,item:n.item},null,8,["item"]))}}}),[["__scopeId","data-v-9a3ef1ac"]]),LF={class:"kong-ui-entity-plugin-config-card"},DF={class:"name-cell-wrapper"},MF={class:"info-name"},jF={key:0},FF={key:0},UF={key:0},KF={key:0},qF={key:0},cp="config",GF=Me(e.defineComponent({__name:"PluginConfigCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string"||!n.entityId||!n.pluginType)},configCardDoc:{type:String,default:"",required:!1},showIdAsLink:{type:Boolean,default:!1},hideTitle:{type:Boolean,default:!1},scopedEntityType:{type:String,required:!1,default:""},scopedEntityId:{type:String,required:!1,default:null},expandPartial:{type:Boolean,default:!0}},emits:["loading","fetch:error","error:fetch-schema","fetch:success","navigation-click"],setup(n,{emit:t}){var N;const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=st.usePluginMetaData(),{setFieldType:s}=st.usePluginHelpers(),{getPropValue:c}=Ie.useHelpers(),l=e.computed(()=>{var w;let E=(w=Qe.item[o.config.app])==null?void 0:w[o.scopedEntityType?"forEntity":"all"].replace(/{entityType}/gi,o.scopedEntityType).replace(/{entityId}/gi,o.scopedEntityId??"").concat(o.expandPartial?"?expand_partials=true":"");if(o.config.app==="konnect"){const S=o.expandPartial?"&":"?";E=E.concat(`${S}__ui_data=true`)}return E}),u=e.computed(()=>{var S,I;const E={},w=((S=_.value)==null?void 0:S.fields)||[];for(let j=0;j<w.length;j++){const A=_.value.fields[j],x=(I=Object.keys(A))==null?void 0:I[0];s(E,x,A[x])}return{...E,instance_name:{section:Ie.ConfigurationSchemaSection.Basic,order:1.5},consumer:{label:i("plugins.fields.consumer"),section:Ie.ConfigurationSchemaSection.Basic,order:6},route:{label:i("plugins.fields.route"),section:Ie.ConfigurationSchemaSection.Basic,order:6},service:{label:i("plugins.fields.service"),section:Ie.ConfigurationSchemaSection.Basic,order:6},consumer_group:{label:i("plugins.fields.consumer_group"),section:Ie.ConfigurationSchemaSection.Basic,order:6},protocols:{type:Ie.ConfigurationSchemaType.BadgeTag,section:Ie.ConfigurationSchemaSection.Basic,order:7}}}),p=e.computed(()=>{var w,S,I;if(!((w=_.value)!=null&&w.fields))return[];const E=(S=_.value.fields)==null?void 0:S.find(j=>{var x;return((x=Object.keys(j))==null?void 0:x[0])===cp});return((I=E==null?void 0:E[cp])==null?void 0:I.fields)||[]}),d=e.computed(()=>{var w,S;const E={};if(!p.value)return E;for(let I=0;I<((w=p.value)==null?void 0:w.length);I++){const j=p.value[I],A=(S=Object.keys(j))==null?void 0:S[0],x=j[A];x.required&&(E[A]={order:1}),s(E,A,x)}return E}),f=E=>{var S;const w=(S=a.pluginMetaData[o.config.pluginType])==null?void 0:S.scope;return w?Object.fromEntries(Object.entries(E).filter(([I,j])=>j?!0:!(I==="service"&&!w.includes(fe.PluginScope.SERVICE)||I==="route"&&!w.includes(fe.PluginScope.ROUTE)||I==="consumer"&&!w.includes(fe.PluginScope.CONSUMER)||I==="consumer_group"&&!w.includes(fe.PluginScope.CONSUMER_GROUP)))):E},m=E=>Wr(E,"__ui_data"),{getMessageFromError:g}=Ie.useErrors(),{axiosInstance:y}=Ie.useAxios((N=o.config)==null?void 0:N.axiosRequestConfig),b=e.computed(()=>{var w,S;let E=`${o.config.apiBaseUrl}${Qe.form[o.config.app].pluginSchema}`;return o.config.app==="konnect"&&(E=E.replace(/{controlPlaneId}/gi,((w=o.config)==null?void 0:w.controlPlaneId)||"")),E.replace(/\/{workspace}/gi,(S=o.config)!=null&&S.workspace?`/${o.config.workspace}`:"").replace(/{plugin}/gi,o.config.pluginType)}),_=e.ref({});Ie.useSchemaProvider(_);const k=e.ref(!1),C=e.ref("");return e.onBeforeMount(async()=>{k.value=!0;try{const{data:E}=await y.get(b.value);_.value=E}catch(E){C.value=g(E),r("error:fetch-schema",E)}finally{k.value=!1}}),(E,w)=>{const S=e.resolveComponent("KSkeleton"),I=e.resolveComponent("KEmptyState"),j=e.resolveComponent("KCopy");return e.openBlock(),e.createElementBlock("div",LF,[k.value?(e.openBlock(),e.createBlock(S,{key:0,"data-testid":"plugin-config-card-loader","table-columns":2,type:"table"})):C.value?(e.openBlock(),e.createBlock(I,{key:1,"data-testid":"plugin-config-card-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(C.value),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseConfigCard),{key:2,"code-block-record-formatter":m,config:n.config,"config-card-doc":n.configCardDoc,"config-schema":u.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"fetch-url":l.value,"hide-title":n.hideTitle,"plugin-config-key":cp,"plugin-config-schema":d.value,"record-resolver":f,"onFetch:error":w[0]||(w[0]=A=>E.$emit("fetch:error",A)),"onFetch:success":w[1]||(w[1]=A=>E.$emit("fetch:success",A)),onLoading:w[2]||(w[2]=A=>E.$emit("loading",A))},e.createSlots({name:e.withCtx(A=>[e.createElementVNode("div",DF,[e.createVNode(e.unref(Er.PluginIcon),{class:"plugin-icon",name:e.unref(c)("rowValue",A),size:24},null,8,["name"]),e.createElementVNode("span",MF,e.toDisplayString(e.unref(a).getDisplayName(e.unref(c)("rowValue",A))),1)])]),consumer:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"consumer")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"consumer-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",jF,"–"))]),route:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"route")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"route-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",FF,"–"))]),service:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"service")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"service-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",UF,"–"))]),consumer_group:e.withCtx(A=>[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",A).id,value:e.unref(c)("rowValue",A).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",A).id,"consumer_group")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"consumer-group-copy-uuid",text:e.unref(c)("rowValue",A).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",KF,"–"))]),partials:e.withCtx(A=>{var x,O,P,R,W,Z,X,F,J;return[e.unref(c)("rowValue",A)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:(O=(x=e.unref(c)("rowValue",A))==null?void 0:x[0])==null?void 0:O.id,value:((R=(P=e.unref(c)("rowValue",A))==null?void 0:P[0])==null?void 0:R.id)+((Z=(W=e.unref(c)("rowValue",A))==null?void 0:W[0])!=null&&Z.name?"/"+((F=(X=e.unref(c)("rowValue",A))==null?void 0:X[0])==null?void 0:F.name):""),type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>{var $,q;return E.$emit("navigation-click",(q=($=e.unref(c)("rowValue",A))==null?void 0:$[0])==null?void 0:q.id,"partial")}},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(j,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",A).label}),"data-testid":"partial-copy-uuid",text:(J=e.unref(c)("rowValue",A))==null?void 0:J[0].id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",qF,"–"))]}),_:2},[n.config.pluginType==="datakit"&&n.config.app==="konnect"?{name:"config-card-item-nodes",fn:e.withCtx(A=>[e.createVNode(RF,{item:A.row,"plugin-data":A.record},null,8,["item","plugin-data"])]),key:"0"}:void 0]),1032,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title","plugin-config-schema"]))])}}}),[["__scopeId","data-v-03dcf2b4"]]),{usePluginMetaData:HF,useProvideExperimentalFreeForms:zF}=st;function WF(n,t=!1){const r=n.length;let o=0,i="",a=0,s=16,c=0,l=0,u=0,p=0,d=0;function f(C,N){let E=0,w=0;for(;E<C;){let S=n.charCodeAt(o);if(S>=48&&S<=57)w=w*16+S-48;else if(S>=65&&S<=70)w=w*16+S-65+10;else if(S>=97&&S<=102)w=w*16+S-97+10;else break;o++,E++}return E<C&&(w=-1),w}function m(C){o=C,i="",a=0,s=16,d=0}function g(){let C=o;if(n.charCodeAt(o)===48)o++;else for(o++;o<n.length&&Bi(n.charCodeAt(o));)o++;if(o<n.length&&n.charCodeAt(o)===46)if(o++,o<n.length&&Bi(n.charCodeAt(o)))for(o++;o<n.length&&Bi(n.charCodeAt(o));)o++;else return d=3,n.substring(C,o);let N=o;if(o<n.length&&(n.charCodeAt(o)===69||n.charCodeAt(o)===101))if(o++,(o<n.length&&n.charCodeAt(o)===43||n.charCodeAt(o)===45)&&o++,o<n.length&&Bi(n.charCodeAt(o))){for(o++;o<n.length&&Bi(n.charCodeAt(o));)o++;N=o}else d=3;return n.substring(C,N)}function y(){let C="",N=o;for(;;){if(o>=r){C+=n.substring(N,o),d=2;break}const E=n.charCodeAt(o);if(E===34){C+=n.substring(N,o),o++;break}if(E===92){if(C+=n.substring(N,o),o++,o>=r){d=2;break}switch(n.charCodeAt(o++)){case 34:C+='"';break;case 92:C+="\\";break;case 47:C+="/";break;case 98:C+="\b";break;case 102:C+="\f";break;case 110:C+=`
440
440
  `;break;case 114:C+="\r";break;case 116:C+=" ";break;case 117:const w=f(4);w>=0?C+=String.fromCharCode(w):d=4;break;default:d=5}N=o;continue}if(E>=0&&E<=31)if(Ja(E)){C+=n.substring(N,o),d=2;break}else d=6;o++}return C}function b(){if(i="",d=0,a=o,l=c,p=u,o>=r)return a=r,s=17;let C=n.charCodeAt(o);if(up(C)){do o++,i+=String.fromCharCode(C),C=n.charCodeAt(o);while(up(C));return s=15}if(Ja(C))return o++,i+=String.fromCharCode(C),C===13&&n.charCodeAt(o)===10&&(o++,i+=`
441
441
  `),c++,u=o,s=14;switch(C){case 123:return o++,s=1;case 125:return o++,s=2;case 91:return o++,s=3;case 93:return o++,s=4;case 58:return o++,s=6;case 44:return o++,s=5;case 34:return o++,i=y(),s=10;case 47:const N=o-1;if(n.charCodeAt(o+1)===47){for(o+=2;o<r&&!Ja(n.charCodeAt(o));)o++;return i=n.substring(N,o),s=12}if(n.charCodeAt(o+1)===42){o+=2;const E=r-1;let w=!1;for(;o<E;){const S=n.charCodeAt(o);if(S===42&&n.charCodeAt(o+1)===47){o+=2,w=!0;break}o++,Ja(S)&&(S===13&&n.charCodeAt(o)===10&&o++,c++,u=o)}return w||(o++,d=1),i=n.substring(N,o),s=13}return i+=String.fromCharCode(C),o++,s=16;case 45:if(i+=String.fromCharCode(C),o++,o===r||!Bi(n.charCodeAt(o)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=g(),s=11;default:for(;o<r&&_(C);)o++,C=n.charCodeAt(o);if(a!==o){switch(i=n.substring(a,o),i){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return i+=String.fromCharCode(C),o++,s=16}}function _(C){if(up(C)||Ja(C))return!1;switch(C){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function k(){let C;do C=b();while(C>=12&&C<=15);return C}return{setPosition:m,getPosition:()=>o,scan:t?k:b,getToken:()=>s,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>o-a,getTokenStartLine:()=>l,getTokenStartCharacter:()=>a-p,getTokenError:()=>d}}function up(n){return n===32||n===9}function Ja(n){return n===10||n===13}function Bi(n){return n>=48&&n<=57}var vw;(function(n){n[n.lineFeed=10]="lineFeed",n[n.carriageReturn=13]="carriageReturn",n[n.space=32]="space",n[n._0=48]="_0",n[n._1=49]="_1",n[n._2=50]="_2",n[n._3=51]="_3",n[n._4=52]="_4",n[n._5=53]="_5",n[n._6=54]="_6",n[n._7=55]="_7",n[n._8=56]="_8",n[n._9=57]="_9",n[n.a=97]="a",n[n.b=98]="b",n[n.c=99]="c",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.g=103]="g",n[n.h=104]="h",n[n.i=105]="i",n[n.j=106]="j",n[n.k=107]="k",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.p=112]="p",n[n.q=113]="q",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.v=118]="v",n[n.w=119]="w",n[n.x=120]="x",n[n.y=121]="y",n[n.z=122]="z",n[n.A=65]="A",n[n.B=66]="B",n[n.C=67]="C",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.G=71]="G",n[n.H=72]="H",n[n.I=73]="I",n[n.J=74]="J",n[n.K=75]="K",n[n.L=76]="L",n[n.M=77]="M",n[n.N=78]="N",n[n.O=79]="O",n[n.P=80]="P",n[n.Q=81]="Q",n[n.R=82]="R",n[n.S=83]="S",n[n.T=84]="T",n[n.U=85]="U",n[n.V=86]="V",n[n.W=87]="W",n[n.X=88]="X",n[n.Y=89]="Y",n[n.Z=90]="Z",n[n.asterisk=42]="asterisk",n[n.backslash=92]="backslash",n[n.closeBrace=125]="closeBrace",n[n.closeBracket=93]="closeBracket",n[n.colon=58]="colon",n[n.comma=44]="comma",n[n.dot=46]="dot",n[n.doubleQuote=34]="doubleQuote",n[n.minus=45]="minus",n[n.openBrace=123]="openBrace",n[n.openBracket=91]="openBracket",n[n.plus=43]="plus",n[n.slash=47]="slash",n[n.formFeed=12]="formFeed",n[n.tab=9]="tab"})(vw||(vw={})),new Array(20).fill(0).map((n,t)=>" ".repeat(t));const Ti=200;new Array(Ti).fill(0).map((n,t)=>`
442
442
  `+" ".repeat(t)),new Array(Ti).fill(0).map((n,t)=>"\r"+" ".repeat(t)),new Array(Ti).fill(0).map((n,t)=>`\r
@@ -455,7 +455,7 @@ nodes:
455
455
 
456
456
  See the Apache Version 2.0 License for specific language governing permissions
457
457
  and limitations under the License.
458
- ***************************************************************************** */var Vw;(function(n){(function(t){var r=typeof globalThis=="object"?globalThis:typeof Ow=="object"?Ow:typeof self=="object"?self:typeof this=="object"?this:c(),o=i(n);typeof r.Reflect<"u"&&(o=i(r.Reflect,o)),t(o,r),typeof r.Reflect>"u"&&(r.Reflect=n);function i(l,u){return function(p,d){Object.defineProperty(l,p,{configurable:!0,writable:!0,value:d}),u&&u(p,d)}}function a(){try{return Function("return this;")()}catch{}}function s(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return a()||s()}})(function(t,r){var o=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",a=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",s=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,p={create:c?function(){return h(Object.create(null))}:l?function(){return h({__proto__:null})}:function(){return h({})},has:u?function(T,G){return o.call(T,G)}:function(T,G){return G in T},get:u?function(T,G){return o.call(T,G)?T[G]:void 0}:function(T,G){return T[G]}},d=Object.getPrototypeOf(Function),f=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Ee(),m=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:_e(),g=typeof WeakMap=="function"?WeakMap:xe(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,b=ie(),_=ee(b);function k(T,G,Y,re){if(K(Y)){if(!le(T))throw new TypeError;if(!Oe(G))throw new TypeError;return O(T,G)}else{if(!le(T))throw new TypeError;if(!v(G))throw new TypeError;if(!v(re)&&!K(re)&&!ae(re))throw new TypeError;return ae(re)&&(re=void 0),Y=me(Y),P(T,G,Y,re)}}t("decorate",k);function C(T,G){function Y(re,be){if(!v(re))throw new TypeError;if(!K(be)&&!$e(be))throw new TypeError;F(T,G,re,be)}return Y}t("metadata",C);function N(T,G,Y,re){if(!v(Y))throw new TypeError;return K(re)||(re=me(re)),F(T,G,Y,re)}t("defineMetadata",N);function E(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),R(T,G,Y)}t("hasMetadata",E);function w(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),W(T,G,Y)}t("hasOwnMetadata",w);function S(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),Z(T,G,Y)}t("getMetadata",S);function I(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),X(T,G,Y)}t("getOwnMetadata",I);function j(T,G){if(!v(T))throw new TypeError;return K(G)||(G=me(G)),J(T,G)}t("getMetadataKeys",j);function A(T,G){if(!v(T))throw new TypeError;return K(G)||(G=me(G)),$(T,G)}t("getOwnMetadataKeys",A);function x(T,G,Y){if(!v(G))throw new TypeError;if(K(Y)||(Y=me(Y)),!v(G))throw new TypeError;K(Y)||(Y=me(Y));var re=ue(G,Y,!1);return K(re)?!1:re.OrdinaryDeleteMetadata(T,G,Y)}t("deleteMetadata",x);function O(T,G){for(var Y=T.length-1;Y>=0;--Y){var re=T[Y],be=re(G);if(!K(be)&&!ae(be)){if(!Oe(be))throw new TypeError;G=be}}return G}function P(T,G,Y,re){for(var be=T.length-1;be>=0;--be){var L=T[be],de=L(G,Y,re);if(!K(de)&&!ae(de)){if(!v(de))throw new TypeError;re=de}}return re}function R(T,G,Y){var re=W(T,G,Y);if(re)return!0;var be=we(G);return ae(be)?!1:R(T,be,Y)}function W(T,G,Y){var re=ue(G,Y,!1);return K(re)?!1:te(re.OrdinaryHasOwnMetadata(T,G,Y))}function Z(T,G,Y){var re=W(T,G,Y);if(re)return X(T,G,Y);var be=we(G);if(!ae(be))return Z(T,be,Y)}function X(T,G,Y){var re=ue(G,Y,!1);if(!K(re))return re.OrdinaryGetOwnMetadata(T,G,Y)}function F(T,G,Y,re){var be=ue(Y,re,!0);be.OrdinaryDefineOwnMetadata(T,G,Y,re)}function J(T,G){var Y=$(T,G),re=we(T);if(re===null)return Y;var be=J(re,G);if(be.length<=0)return Y;if(Y.length<=0)return be;for(var L=new m,de=[],Ne=0,z=Y;Ne<z.length;Ne++){var V=z[Ne],D=L.has(V);D||(L.add(V),de.push(V))}for(var ne=0,ce=be;ne<ce.length;ne++){var V=ce[ne],D=L.has(V);D||(L.add(V),de.push(V))}return de}function $(T,G){var Y=ue(T,G,!1);return Y?Y.OrdinaryOwnMetadataKeys(T,G):[]}function q(T){if(T===null)return 1;switch(typeof T){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return T===null?1:6;default:return 6}}function K(T){return T===void 0}function ae(T){return T===null}function M(T){return typeof T=="symbol"}function v(T){return typeof T=="object"?T!==null:typeof T=="function"}function H(T,G){switch(q(T)){case 0:return T;case 1:return T;case 2:return T;case 3:return T;case 4:return T;case 5:return T}var Y="string",re=qe(T,a);if(re!==void 0){var be=re.call(T,Y);if(v(be))throw new TypeError;return be}return oe(T)}function oe(T,G){var Y,re;{var be=T.toString;if(he(be)){var re=be.call(T);if(!v(re))return re}var Y=T.valueOf;if(he(Y)){var re=Y.call(T);if(!v(re))return re}}throw new TypeError}function te(T){return!!T}function ge(T){return""+T}function me(T){var G=H(T);return M(G)?G:ge(G)}function le(T){return Array.isArray?Array.isArray(T):T instanceof Object?T instanceof Array:Object.prototype.toString.call(T)==="[object Array]"}function he(T){return typeof T=="function"}function Oe(T){return typeof T=="function"}function $e(T){switch(q(T)){case 3:return!0;case 4:return!0;default:return!1}}function Pe(T,G){return T===G||T!==T&&G!==G}function qe(T,G){var Y=T[G];if(Y!=null){if(!he(Y))throw new TypeError;return Y}}function Ye(T){var G=qe(T,s);if(!he(G))throw new TypeError;var Y=G.call(T);if(!v(Y))throw new TypeError;return Y}function et(T){return T.value}function Ve(T){var G=T.next();return G.done?!1:G}function ke(T){var G=T.return;G&&G.call(T)}function we(T){var G=Object.getPrototypeOf(T);if(typeof T!="function"||T===d||G!==d)return G;var Y=T.prototype,re=Y&&Object.getPrototypeOf(Y);if(re==null||re===Object.prototype)return G;var be=re.constructor;return typeof be!="function"||be===T?G:be}function ye(){var T;!K(y)&&typeof r.Reflect<"u"&&!(y in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(T=se(r.Reflect));var G,Y,re,be=new g,L={registerProvider:de,getProvider:z,setProvider:D};return L;function de(ne){if(!Object.isExtensible(L))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case T===ne:break;case K(G):G=ne;break;case G===ne:break;case K(Y):Y=ne;break;case Y===ne:break;default:re===void 0&&(re=new m),re.add(ne);break}}function Ne(ne,ce){if(!K(G)){if(G.isProviderFor(ne,ce))return G;if(!K(Y)){if(Y.isProviderFor(ne,ce))return G;if(!K(re))for(var Ce=Ye(re);;){var Se=Ve(Ce);if(!Se)return;var ve=et(Se);if(ve.isProviderFor(ne,ce))return ke(Ce),ve}}}if(!K(T)&&T.isProviderFor(ne,ce))return T}function z(ne,ce){var Ce=be.get(ne),Se;return K(Ce)||(Se=Ce.get(ce)),K(Se)&&(Se=Ne(ne,ce),K(Se)||(K(Ce)&&(Ce=new f,be.set(ne,Ce)),Ce.set(ce,Se))),Se}function V(ne){if(K(ne))throw new TypeError;return G===ne||Y===ne||!K(re)&&re.has(ne)}function D(ne,ce,Ce){if(!V(Ce))throw new Error("Metadata provider not registered.");var Se=z(ne,ce);if(Se!==Ce){if(!K(Se))return!1;var ve=be.get(ne);K(ve)&&(ve=new f,be.set(ne,ve)),ve.set(ce,Ce)}return!0}}function ie(){var T;return!K(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&(T=r.Reflect[y]),K(T)&&(T=ye()),!K(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:T}),T}function ee(T){var G=new g,Y={isProviderFor:function(V,D){var ne=G.get(V);return K(ne)?!1:ne.has(D)},OrdinaryDefineOwnMetadata:de,OrdinaryHasOwnMetadata:be,OrdinaryGetOwnMetadata:L,OrdinaryOwnMetadataKeys:Ne,OrdinaryDeleteMetadata:z};return b.registerProvider(Y),Y;function re(V,D,ne){var ce=G.get(V),Ce=!1;if(K(ce)){if(!ne)return;ce=new f,G.set(V,ce),Ce=!0}var Se=ce.get(D);if(K(Se)){if(!ne)return;if(Se=new f,ce.set(D,Se),!T.setProvider(V,D,Y))throw ce.delete(D),Ce&&G.delete(V),new Error("Wrong provider for target.")}return Se}function be(V,D,ne){var ce=re(D,ne,!1);return K(ce)?!1:te(ce.has(V))}function L(V,D,ne){var ce=re(D,ne,!1);if(!K(ce))return ce.get(V)}function de(V,D,ne,ce){var Ce=re(ne,ce,!0);Ce.set(V,D)}function Ne(V,D){var ne=[],ce=re(V,D,!1);if(K(ce))return ne;for(var Ce=ce.keys(),Se=Ye(Ce),ve=0;;){var ze=Ve(Se);if(!ze)return ne.length=ve,ne;var Ke=et(ze);try{ne[ve]=Ke}catch(Be){try{ke(Se)}finally{throw Be}}ve++}}function z(V,D,ne){var ce=re(D,ne,!1);if(K(ce)||!ce.delete(V))return!1;if(ce.size===0){var Ce=G.get(D);K(Ce)||(Ce.delete(ne),Ce.size===0&&G.delete(Ce))}return!0}}function se(T){var G=T.defineMetadata,Y=T.hasOwnMetadata,re=T.getOwnMetadata,be=T.getOwnMetadataKeys,L=T.deleteMetadata,de=new g,Ne={isProviderFor:function(z,V){var D=de.get(z);return!K(D)&&D.has(V)?!0:be(z,V).length?(K(D)&&(D=new m,de.set(z,D)),D.add(V),!0):!1},OrdinaryDefineOwnMetadata:G,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:re,OrdinaryOwnMetadataKeys:be,OrdinaryDeleteMetadata:L};return Ne}function ue(T,G,Y){var re=b.getProvider(T,G);if(!K(re))return re;if(Y){if(b.setProvider(T,G,_))return _;throw new Error("Illegal state.")}}function Ee(){var T={},G=[],Y=function(){function Ne(z,V,D){this._index=0,this._keys=z,this._values=V,this._selector=D}return Ne.prototype["@@iterator"]=function(){return this},Ne.prototype[s]=function(){return this},Ne.prototype.next=function(){var z=this._index;if(z>=0&&z<this._keys.length){var V=this._selector(this._keys[z],this._values[z]);return z+1>=this._keys.length?(this._index=-1,this._keys=G,this._values=G):this._index++,{value:V,done:!1}}return{value:void 0,done:!0}},Ne.prototype.throw=function(z){throw this._index>=0&&(this._index=-1,this._keys=G,this._values=G),z},Ne.prototype.return=function(z){return this._index>=0&&(this._index=-1,this._keys=G,this._values=G),{value:z,done:!0}},Ne}(),re=function(){function Ne(){this._keys=[],this._values=[],this._cacheKey=T,this._cacheIndex=-2}return Object.defineProperty(Ne.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ne.prototype.has=function(z){return this._find(z,!1)>=0},Ne.prototype.get=function(z){var V=this._find(z,!1);return V>=0?this._values[V]:void 0},Ne.prototype.set=function(z,V){var D=this._find(z,!0);return this._values[D]=V,this},Ne.prototype.delete=function(z){var V=this._find(z,!1);if(V>=0){for(var D=this._keys.length,ne=V+1;ne<D;ne++)this._keys[ne-1]=this._keys[ne],this._values[ne-1]=this._values[ne];return this._keys.length--,this._values.length--,Pe(z,this._cacheKey)&&(this._cacheKey=T,this._cacheIndex=-2),!0}return!1},Ne.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=T,this._cacheIndex=-2},Ne.prototype.keys=function(){return new Y(this._keys,this._values,be)},Ne.prototype.values=function(){return new Y(this._keys,this._values,L)},Ne.prototype.entries=function(){return new Y(this._keys,this._values,de)},Ne.prototype["@@iterator"]=function(){return this.entries()},Ne.prototype[s]=function(){return this.entries()},Ne.prototype._find=function(z,V){if(!Pe(this._cacheKey,z)){this._cacheIndex=-1;for(var D=0;D<this._keys.length;D++)if(Pe(this._keys[D],z)){this._cacheIndex=D;break}}return this._cacheIndex<0&&V&&(this._cacheIndex=this._keys.length,this._keys.push(z),this._values.push(void 0)),this._cacheIndex},Ne}();return re;function be(Ne,z){return Ne}function L(Ne,z){return z}function de(Ne,z){return[Ne,z]}}function _e(){var T=function(){function G(){this._map=new f}return Object.defineProperty(G.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),G.prototype.has=function(Y){return this._map.has(Y)},G.prototype.add=function(Y){return this._map.set(Y,Y),this},G.prototype.delete=function(Y){return this._map.delete(Y)},G.prototype.clear=function(){this._map.clear()},G.prototype.keys=function(){return this._map.keys()},G.prototype.values=function(){return this._map.keys()},G.prototype.entries=function(){return this._map.entries()},G.prototype["@@iterator"]=function(){return this.keys()},G.prototype[s]=function(){return this.keys()},G}();return T}function xe(){var T=16,G=p.create(),Y=re();return function(){function z(){this._key=re()}return z.prototype.has=function(V){var D=be(V,!1);return D!==void 0?p.has(D,this._key):!1},z.prototype.get=function(V){var D=be(V,!1);return D!==void 0?p.get(D,this._key):void 0},z.prototype.set=function(V,D){var ne=be(V,!0);return ne[this._key]=D,this},z.prototype.delete=function(V){var D=be(V,!1);return D!==void 0?delete D[this._key]:!1},z.prototype.clear=function(){this._key=re()},z}();function re(){var z;do z="@@WeakMap@@"+Ne();while(p.has(G,z));return G[z]=!0,z}function be(z,V){if(!o.call(z,Y)){if(!V)return;Object.defineProperty(z,Y,{value:p.create()})}return z[Y]}function L(z,V){for(var D=0;D<V;++D)z[D]=Math.random()*255|0;return z}function de(z){if(typeof Uint8Array=="function"){var V=new Uint8Array(z);return typeof crypto<"u"?crypto.getRandomValues(V):typeof msCrypto<"u"?msCrypto.getRandomValues(V):L(V,z),V}return L(new Array(z),z)}function Ne(){var z=de(T);z[6]=z[6]&79|64,z[8]=z[8]&191|128;for(var V="",D=0;D<T;++D){var ne=z[D];(D===4||D===6||D===8)&&(V+="-"),ne<16&&(V+="0"),V+=ne.toString(16).toLowerCase()}return V}}function h(T){return T.__=void 0,delete T.__,T}})})(Vw||(Vw={}));const tU=YC({__proto__:null,default:Pw},[Pw]);/*!
458
+ ***************************************************************************** */var Vw;(function(n){(function(t){var r=typeof globalThis=="object"?globalThis:typeof Ow=="object"?Ow:typeof self=="object"?self:typeof this=="object"?this:c(),o=i(n);typeof r.Reflect<"u"&&(o=i(r.Reflect,o)),t(o,r),typeof r.Reflect>"u"&&(r.Reflect=n);function i(l,u){return function(p,d){Object.defineProperty(l,p,{configurable:!0,writable:!0,value:d}),u&&u(p,d)}}function a(){try{return Function("return this;")()}catch{}}function s(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return a()||s()}})(function(t,r){var o=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",a=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",s=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,p={create:c?function(){return h(Object.create(null))}:l?function(){return h({__proto__:null})}:function(){return h({})},has:u?function(T,G){return o.call(T,G)}:function(T,G){return G in T},get:u?function(T,G){return o.call(T,G)?T[G]:void 0}:function(T,G){return T[G]}},d=Object.getPrototypeOf(Function),f=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Ee(),m=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:be(),g=typeof WeakMap=="function"?WeakMap:xe(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,b=ie(),_=ee(b);function k(T,G,Y,re){if(K(Y)){if(!le(T))throw new TypeError;if(!Oe(G))throw new TypeError;return O(T,G)}else{if(!le(T))throw new TypeError;if(!v(G))throw new TypeError;if(!v(re)&&!K(re)&&!ae(re))throw new TypeError;return ae(re)&&(re=void 0),Y=me(Y),P(T,G,Y,re)}}t("decorate",k);function C(T,G){function Y(re,we){if(!v(re))throw new TypeError;if(!K(we)&&!$e(we))throw new TypeError;F(T,G,re,we)}return Y}t("metadata",C);function N(T,G,Y,re){if(!v(Y))throw new TypeError;return K(re)||(re=me(re)),F(T,G,Y,re)}t("defineMetadata",N);function E(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),R(T,G,Y)}t("hasMetadata",E);function w(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),W(T,G,Y)}t("hasOwnMetadata",w);function S(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),Z(T,G,Y)}t("getMetadata",S);function I(T,G,Y){if(!v(G))throw new TypeError;return K(Y)||(Y=me(Y)),X(T,G,Y)}t("getOwnMetadata",I);function j(T,G){if(!v(T))throw new TypeError;return K(G)||(G=me(G)),J(T,G)}t("getMetadataKeys",j);function A(T,G){if(!v(T))throw new TypeError;return K(G)||(G=me(G)),$(T,G)}t("getOwnMetadataKeys",A);function x(T,G,Y){if(!v(G))throw new TypeError;if(K(Y)||(Y=me(Y)),!v(G))throw new TypeError;K(Y)||(Y=me(Y));var re=ue(G,Y,!1);return K(re)?!1:re.OrdinaryDeleteMetadata(T,G,Y)}t("deleteMetadata",x);function O(T,G){for(var Y=T.length-1;Y>=0;--Y){var re=T[Y],we=re(G);if(!K(we)&&!ae(we)){if(!Oe(we))throw new TypeError;G=we}}return G}function P(T,G,Y,re){for(var we=T.length-1;we>=0;--we){var L=T[we],de=L(G,Y,re);if(!K(de)&&!ae(de)){if(!v(de))throw new TypeError;re=de}}return re}function R(T,G,Y){var re=W(T,G,Y);if(re)return!0;var we=_e(G);return ae(we)?!1:R(T,we,Y)}function W(T,G,Y){var re=ue(G,Y,!1);return K(re)?!1:te(re.OrdinaryHasOwnMetadata(T,G,Y))}function Z(T,G,Y){var re=W(T,G,Y);if(re)return X(T,G,Y);var we=_e(G);if(!ae(we))return Z(T,we,Y)}function X(T,G,Y){var re=ue(G,Y,!1);if(!K(re))return re.OrdinaryGetOwnMetadata(T,G,Y)}function F(T,G,Y,re){var we=ue(Y,re,!0);we.OrdinaryDefineOwnMetadata(T,G,Y,re)}function J(T,G){var Y=$(T,G),re=_e(T);if(re===null)return Y;var we=J(re,G);if(we.length<=0)return Y;if(Y.length<=0)return we;for(var L=new m,de=[],Ne=0,z=Y;Ne<z.length;Ne++){var V=z[Ne],D=L.has(V);D||(L.add(V),de.push(V))}for(var ne=0,ce=we;ne<ce.length;ne++){var V=ce[ne],D=L.has(V);D||(L.add(V),de.push(V))}return de}function $(T,G){var Y=ue(T,G,!1);return Y?Y.OrdinaryOwnMetadataKeys(T,G):[]}function q(T){if(T===null)return 1;switch(typeof T){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return T===null?1:6;default:return 6}}function K(T){return T===void 0}function ae(T){return T===null}function M(T){return typeof T=="symbol"}function v(T){return typeof T=="object"?T!==null:typeof T=="function"}function H(T,G){switch(q(T)){case 0:return T;case 1:return T;case 2:return T;case 3:return T;case 4:return T;case 5:return T}var Y="string",re=qe(T,a);if(re!==void 0){var we=re.call(T,Y);if(v(we))throw new TypeError;return we}return oe(T)}function oe(T,G){var Y,re;{var we=T.toString;if(he(we)){var re=we.call(T);if(!v(re))return re}var Y=T.valueOf;if(he(Y)){var re=Y.call(T);if(!v(re))return re}}throw new TypeError}function te(T){return!!T}function ge(T){return""+T}function me(T){var G=H(T);return M(G)?G:ge(G)}function le(T){return Array.isArray?Array.isArray(T):T instanceof Object?T instanceof Array:Object.prototype.toString.call(T)==="[object Array]"}function he(T){return typeof T=="function"}function Oe(T){return typeof T=="function"}function $e(T){switch(q(T)){case 3:return!0;case 4:return!0;default:return!1}}function Pe(T,G){return T===G||T!==T&&G!==G}function qe(T,G){var Y=T[G];if(Y!=null){if(!he(Y))throw new TypeError;return Y}}function Ye(T){var G=qe(T,s);if(!he(G))throw new TypeError;var Y=G.call(T);if(!v(Y))throw new TypeError;return Y}function et(T){return T.value}function Ve(T){var G=T.next();return G.done?!1:G}function ke(T){var G=T.return;G&&G.call(T)}function _e(T){var G=Object.getPrototypeOf(T);if(typeof T!="function"||T===d||G!==d)return G;var Y=T.prototype,re=Y&&Object.getPrototypeOf(Y);if(re==null||re===Object.prototype)return G;var we=re.constructor;return typeof we!="function"||we===T?G:we}function ye(){var T;!K(y)&&typeof r.Reflect<"u"&&!(y in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(T=se(r.Reflect));var G,Y,re,we=new g,L={registerProvider:de,getProvider:z,setProvider:D};return L;function de(ne){if(!Object.isExtensible(L))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case T===ne:break;case K(G):G=ne;break;case G===ne:break;case K(Y):Y=ne;break;case Y===ne:break;default:re===void 0&&(re=new m),re.add(ne);break}}function Ne(ne,ce){if(!K(G)){if(G.isProviderFor(ne,ce))return G;if(!K(Y)){if(Y.isProviderFor(ne,ce))return G;if(!K(re))for(var Ce=Ye(re);;){var Se=Ve(Ce);if(!Se)return;var ve=et(Se);if(ve.isProviderFor(ne,ce))return ke(Ce),ve}}}if(!K(T)&&T.isProviderFor(ne,ce))return T}function z(ne,ce){var Ce=we.get(ne),Se;return K(Ce)||(Se=Ce.get(ce)),K(Se)&&(Se=Ne(ne,ce),K(Se)||(K(Ce)&&(Ce=new f,we.set(ne,Ce)),Ce.set(ce,Se))),Se}function V(ne){if(K(ne))throw new TypeError;return G===ne||Y===ne||!K(re)&&re.has(ne)}function D(ne,ce,Ce){if(!V(Ce))throw new Error("Metadata provider not registered.");var Se=z(ne,ce);if(Se!==Ce){if(!K(Se))return!1;var ve=we.get(ne);K(ve)&&(ve=new f,we.set(ne,ve)),ve.set(ce,Ce)}return!0}}function ie(){var T;return!K(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&(T=r.Reflect[y]),K(T)&&(T=ye()),!K(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:T}),T}function ee(T){var G=new g,Y={isProviderFor:function(V,D){var ne=G.get(V);return K(ne)?!1:ne.has(D)},OrdinaryDefineOwnMetadata:de,OrdinaryHasOwnMetadata:we,OrdinaryGetOwnMetadata:L,OrdinaryOwnMetadataKeys:Ne,OrdinaryDeleteMetadata:z};return b.registerProvider(Y),Y;function re(V,D,ne){var ce=G.get(V),Ce=!1;if(K(ce)){if(!ne)return;ce=new f,G.set(V,ce),Ce=!0}var Se=ce.get(D);if(K(Se)){if(!ne)return;if(Se=new f,ce.set(D,Se),!T.setProvider(V,D,Y))throw ce.delete(D),Ce&&G.delete(V),new Error("Wrong provider for target.")}return Se}function we(V,D,ne){var ce=re(D,ne,!1);return K(ce)?!1:te(ce.has(V))}function L(V,D,ne){var ce=re(D,ne,!1);if(!K(ce))return ce.get(V)}function de(V,D,ne,ce){var Ce=re(ne,ce,!0);Ce.set(V,D)}function Ne(V,D){var ne=[],ce=re(V,D,!1);if(K(ce))return ne;for(var Ce=ce.keys(),Se=Ye(Ce),ve=0;;){var ze=Ve(Se);if(!ze)return ne.length=ve,ne;var Ke=et(ze);try{ne[ve]=Ke}catch(Be){try{ke(Se)}finally{throw Be}}ve++}}function z(V,D,ne){var ce=re(D,ne,!1);if(K(ce)||!ce.delete(V))return!1;if(ce.size===0){var Ce=G.get(D);K(Ce)||(Ce.delete(ne),Ce.size===0&&G.delete(Ce))}return!0}}function se(T){var G=T.defineMetadata,Y=T.hasOwnMetadata,re=T.getOwnMetadata,we=T.getOwnMetadataKeys,L=T.deleteMetadata,de=new g,Ne={isProviderFor:function(z,V){var D=de.get(z);return!K(D)&&D.has(V)?!0:we(z,V).length?(K(D)&&(D=new m,de.set(z,D)),D.add(V),!0):!1},OrdinaryDefineOwnMetadata:G,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:re,OrdinaryOwnMetadataKeys:we,OrdinaryDeleteMetadata:L};return Ne}function ue(T,G,Y){var re=b.getProvider(T,G);if(!K(re))return re;if(Y){if(b.setProvider(T,G,_))return _;throw new Error("Illegal state.")}}function Ee(){var T={},G=[],Y=function(){function Ne(z,V,D){this._index=0,this._keys=z,this._values=V,this._selector=D}return Ne.prototype["@@iterator"]=function(){return this},Ne.prototype[s]=function(){return this},Ne.prototype.next=function(){var z=this._index;if(z>=0&&z<this._keys.length){var V=this._selector(this._keys[z],this._values[z]);return z+1>=this._keys.length?(this._index=-1,this._keys=G,this._values=G):this._index++,{value:V,done:!1}}return{value:void 0,done:!0}},Ne.prototype.throw=function(z){throw this._index>=0&&(this._index=-1,this._keys=G,this._values=G),z},Ne.prototype.return=function(z){return this._index>=0&&(this._index=-1,this._keys=G,this._values=G),{value:z,done:!0}},Ne}(),re=function(){function Ne(){this._keys=[],this._values=[],this._cacheKey=T,this._cacheIndex=-2}return Object.defineProperty(Ne.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ne.prototype.has=function(z){return this._find(z,!1)>=0},Ne.prototype.get=function(z){var V=this._find(z,!1);return V>=0?this._values[V]:void 0},Ne.prototype.set=function(z,V){var D=this._find(z,!0);return this._values[D]=V,this},Ne.prototype.delete=function(z){var V=this._find(z,!1);if(V>=0){for(var D=this._keys.length,ne=V+1;ne<D;ne++)this._keys[ne-1]=this._keys[ne],this._values[ne-1]=this._values[ne];return this._keys.length--,this._values.length--,Pe(z,this._cacheKey)&&(this._cacheKey=T,this._cacheIndex=-2),!0}return!1},Ne.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=T,this._cacheIndex=-2},Ne.prototype.keys=function(){return new Y(this._keys,this._values,we)},Ne.prototype.values=function(){return new Y(this._keys,this._values,L)},Ne.prototype.entries=function(){return new Y(this._keys,this._values,de)},Ne.prototype["@@iterator"]=function(){return this.entries()},Ne.prototype[s]=function(){return this.entries()},Ne.prototype._find=function(z,V){if(!Pe(this._cacheKey,z)){this._cacheIndex=-1;for(var D=0;D<this._keys.length;D++)if(Pe(this._keys[D],z)){this._cacheIndex=D;break}}return this._cacheIndex<0&&V&&(this._cacheIndex=this._keys.length,this._keys.push(z),this._values.push(void 0)),this._cacheIndex},Ne}();return re;function we(Ne,z){return Ne}function L(Ne,z){return z}function de(Ne,z){return[Ne,z]}}function be(){var T=function(){function G(){this._map=new f}return Object.defineProperty(G.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),G.prototype.has=function(Y){return this._map.has(Y)},G.prototype.add=function(Y){return this._map.set(Y,Y),this},G.prototype.delete=function(Y){return this._map.delete(Y)},G.prototype.clear=function(){this._map.clear()},G.prototype.keys=function(){return this._map.keys()},G.prototype.values=function(){return this._map.keys()},G.prototype.entries=function(){return this._map.entries()},G.prototype["@@iterator"]=function(){return this.keys()},G.prototype[s]=function(){return this.keys()},G}();return T}function xe(){var T=16,G=p.create(),Y=re();return function(){function z(){this._key=re()}return z.prototype.has=function(V){var D=we(V,!1);return D!==void 0?p.has(D,this._key):!1},z.prototype.get=function(V){var D=we(V,!1);return D!==void 0?p.get(D,this._key):void 0},z.prototype.set=function(V,D){var ne=we(V,!0);return ne[this._key]=D,this},z.prototype.delete=function(V){var D=we(V,!1);return D!==void 0?delete D[this._key]:!1},z.prototype.clear=function(){this._key=re()},z}();function re(){var z;do z="@@WeakMap@@"+Ne();while(p.has(G,z));return G[z]=!0,z}function we(z,V){if(!o.call(z,Y)){if(!V)return;Object.defineProperty(z,Y,{value:p.create()})}return z[Y]}function L(z,V){for(var D=0;D<V;++D)z[D]=Math.random()*255|0;return z}function de(z){if(typeof Uint8Array=="function"){var V=new Uint8Array(z);return typeof crypto<"u"?crypto.getRandomValues(V):typeof msCrypto<"u"?msCrypto.getRandomValues(V):L(V,z),V}return L(new Array(z),z)}function Ne(){var z=de(T);z[6]=z[6]&79|64,z[8]=z[8]&191|128;for(var V="",D=0;D<T;++D){var ne=z[D];(D===4||D===6||D===8)&&(V+="-"),ne<16&&(V+="0"),V+=ne.toString(16).toLowerCase()}return V}}function h(T){return T.__=void 0,delete T.__,T}})})(Vw||(Vw={}));const tU=YC({__proto__:null,default:Pw},[Pw]);/*!
459
459
  * MIT License
460
460
  *
461
461
  * Copyright (c) 2017-2024 Peculiar Ventures, LLC